mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
74499e8173
171 changed files with 31060 additions and 6592 deletions
16
SRB2.cbp
16
SRB2.cbp
|
@ -33,7 +33,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="-g" />
|
<Add option="-g" />
|
||||||
<Add option="`sdl-config --cflags`" />
|
<Add option="`sdl-config --cflags`" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DPARANOIA" />
|
<Add option="-DPARANOIA" />
|
||||||
<Add option="-DRANGECHECK" />
|
<Add option="-DRANGECHECK" />
|
||||||
<Add option="-D_DEBUG" />
|
<Add option="-D_DEBUG" />
|
||||||
|
@ -56,7 +56,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="-g" />
|
<Add option="-g" />
|
||||||
<Add option="`sdl-config --cflags`" />
|
<Add option="`sdl-config --cflags`" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DNDEBUG" />
|
<Add option="-DNDEBUG" />
|
||||||
<Add option="-DCOMPVERSION" />
|
<Add option="-DCOMPVERSION" />
|
||||||
<Add option="-DHAVE_BLUA" />
|
<Add option="-DHAVE_BLUA" />
|
||||||
|
@ -77,7 +77,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="`sdl-config --cflags`" />
|
<Add option="`sdl-config --cflags`" />
|
||||||
<Add option="`libpng-config --cflags`" />
|
<Add option="`libpng-config --cflags`" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DHAVE_MIXER" />
|
<Add option="-DHAVE_MIXER" />
|
||||||
<Add option="-DHWRENDER" />
|
<Add option="-DHWRENDER" />
|
||||||
<Add option="-DHW3SOUND" />
|
<Add option="-DHW3SOUND" />
|
||||||
|
@ -107,7 +107,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="`sdl-config --cflags`" />
|
<Add option="`sdl-config --cflags`" />
|
||||||
<Add option="`libpng-config --cflags`" />
|
<Add option="`libpng-config --cflags`" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DHAVE_MIXER" />
|
<Add option="-DHAVE_MIXER" />
|
||||||
<Add option="-DHWRENDER" />
|
<Add option="-DHWRENDER" />
|
||||||
<Add option="-DHW3SOUND" />
|
<Add option="-DHW3SOUND" />
|
||||||
|
@ -138,7 +138,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
|
<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
|
||||||
<Add option="-DUSE_WGL_SWAP" />
|
<Add option="-DUSE_WGL_SWAP" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DHAVE_MIXER" />
|
<Add option="-DHAVE_MIXER" />
|
||||||
<Add option="-DHWRENDER" />
|
<Add option="-DHWRENDER" />
|
||||||
<Add option="-DHW3SOUND" />
|
<Add option="-DHW3SOUND" />
|
||||||
|
@ -185,7 +185,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
|
<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
|
||||||
<Add option="-DUSE_WGL_SWAP" />
|
<Add option="-DUSE_WGL_SWAP" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DHAVE_MIXER" />
|
<Add option="-DHAVE_MIXER" />
|
||||||
<Add option="-DHAVE_FMOD" />
|
<Add option="-DHAVE_FMOD" />
|
||||||
<Add option="-DHWRENDER" />
|
<Add option="-DHWRENDER" />
|
||||||
|
@ -551,7 +551,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="-DSTDC_HEADERS" />
|
<Add option="-DSTDC_HEADERS" />
|
||||||
<Add option="-DUSE_WGL_SWAP" />
|
<Add option="-DUSE_WGL_SWAP" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DHAVE_MIXER" />
|
<Add option="-DHAVE_MIXER" />
|
||||||
<Add option="-DHWRENDER" />
|
<Add option="-DHWRENDER" />
|
||||||
<Add option="-DHW3SOUND" />
|
<Add option="-DHW3SOUND" />
|
||||||
|
@ -592,7 +592,7 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add option="-DSTDC_HEADERS" />
|
<Add option="-DSTDC_HEADERS" />
|
||||||
<Add option="-DUSE_WGL_SWAP" />
|
<Add option="-DUSE_WGL_SWAP" />
|
||||||
<Add option="-DDIRECTFULLSCREEN" />
|
<Add option="-DDIRECTFULLSCREEN" />
|
||||||
<Add option="-DSDL" />
|
<Add option="-DHAVE_SDL" />
|
||||||
<Add option="-DHAVE_MIXER" />
|
<Add option="-DHAVE_MIXER" />
|
||||||
<Add option="-DHWRENDER" />
|
<Add option="-DHWRENDER" />
|
||||||
<Add option="-DHW3SOUND" />
|
<Add option="-DHW3SOUND" />
|
||||||
|
|
8
Srb2.dev
8
Srb2.dev
|
@ -2228,7 +2228,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
||||||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
|
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
|
||||||
ResourceIncludes=src/win32
|
ResourceIncludes=src/win32
|
||||||
MakeIncludes=comptime.mk;cpdebug.mk
|
MakeIncludes=comptime.mk;cpdebug.mk
|
||||||
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||||
CppCompiler=-Os_@@_-g_@@_-gdwarf-2_@@_
|
CppCompiler=-Os_@@_-g_@@_-gdwarf-2_@@_
|
||||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||||
PreprocDefines=NORMALSRB2_@@_
|
PreprocDefines=NORMALSRB2_@@_
|
||||||
|
@ -2305,7 +2305,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
||||||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
|
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
|
||||||
ResourceIncludes=src/win32
|
ResourceIncludes=src/win32
|
||||||
MakeIncludes=comptime.mk;cpdebug.mk
|
MakeIncludes=comptime.mk;cpdebug.mk
|
||||||
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||||
CppCompiler=-O0_@@_-g_@@_-gdwarf-2_@@_
|
CppCompiler=-O0_@@_-g_@@_-gdwarf-2_@@_
|
||||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||||
PreprocDefines=NORMALSRB2_@@_
|
PreprocDefines=NORMALSRB2_@@_
|
||||||
|
@ -2386,7 +2386,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
||||||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
|
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
|
||||||
ResourceIncludes=src/win32
|
ResourceIncludes=src/win32
|
||||||
MakeIncludes=comptime.mk;cpdebug.mk
|
MakeIncludes=comptime.mk;cpdebug.mk
|
||||||
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||||
CppCompiler=-Os_@@_-g_@@_
|
CppCompiler=-Os_@@_-g_@@_
|
||||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||||
PreprocDefines=NORMALSRB2_@@_
|
PreprocDefines=NORMALSRB2_@@_
|
||||||
|
@ -2413,7 +2413,7 @@ Includes=libs/libpng-src;libs/zlib;libs
|
||||||
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
|
Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
|
||||||
ResourceIncludes=src/win32
|
ResourceIncludes=src/win32
|
||||||
MakeIncludes=comptime.mk;cpdebug.mk
|
MakeIncludes=comptime.mk;cpdebug.mk
|
||||||
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
|
||||||
CppCompiler=-O0_@@_-g_@@_
|
CppCompiler=-O0_@@_-g_@@_
|
||||||
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
|
||||||
PreprocDefines=NORMALSRB2_@@_
|
PreprocDefines=NORMALSRB2_@@_
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1 +0,0 @@
|
||||||
fmodex64_vc.lib
|
|
|
@ -1 +0,0 @@
|
||||||
fmodexL64_vc.lib
|
|
|
@ -1 +0,0 @@
|
||||||
fmodexL_vc.lib
|
|
|
@ -1 +0,0 @@
|
||||||
fmodex_vc.lib
|
|
|
@ -1,4 +1,4 @@
|
||||||
Here it is! SRB2 v2.1.8 source code!
|
Here it is! SRB2 v2.1.9 source code!
|
||||||
(why do we keep the version number up to date
|
(why do we keep the version number up to date
|
||||||
when everything else in this file is hilariously old?
|
when everything else in this file is hilariously old?
|
||||||
- Inuyasha)
|
- Inuyasha)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# -DPC_DOS -> use DOS specific code (eg:textmode stuff)...
|
# -DPC_DOS -> use DOS specific code (eg:textmode stuff)...
|
||||||
# -DLINUX -> use for the GNU/Linux specific
|
# -DLINUX -> use for the GNU/Linux specific
|
||||||
# -D_WINDOWS -> use for the Win32/DirectX specific
|
# -D_WINDOWS -> use for the Win32/DirectX specific
|
||||||
# -DSDL -> use for the SDL interface
|
# -DHAVE_SDL -> use for the SDL interface
|
||||||
#
|
#
|
||||||
# Sets:
|
# Sets:
|
||||||
# Compile the DGJPP/DOS version with 'make WATTCP=1'
|
# Compile the DGJPP/DOS version with 'make WATTCP=1'
|
||||||
|
@ -599,6 +599,7 @@ ifndef NOUPX
|
||||||
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
|
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@echo Build is done, please look for $(EXENAME) in $(BIN), \(checking for post steps\)
|
||||||
|
|
||||||
reobjdump:
|
reobjdump:
|
||||||
@echo Redumping debugging info
|
@echo Redumping debugging info
|
||||||
|
|
|
@ -230,7 +230,6 @@ ifdef DUMMY
|
||||||
BIN:=$(BIN)/dummy
|
BIN:=$(BIN)/dummy
|
||||||
else
|
else
|
||||||
ifdef LINUX
|
ifdef LINUX
|
||||||
INTERFACE=sdl
|
|
||||||
NASMFORMAT=elf -DLINUX
|
NASMFORMAT=elf -DLINUX
|
||||||
SDL=1
|
SDL=1
|
||||||
ifndef NOGETTEXT
|
ifndef NOGETTEXT
|
||||||
|
|
|
@ -1139,7 +1139,7 @@ void CONS_Printf(const char *fmt, ...)
|
||||||
// if not in display loop, force screen update
|
// if not in display loop, force screen update
|
||||||
if (con_startup)
|
if (con_startup)
|
||||||
{
|
{
|
||||||
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (SDL))
|
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
|
||||||
static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
|
static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
|
||||||
patch_t *con_backpic;
|
patch_t *con_backpic;
|
||||||
|
|
||||||
|
@ -1383,7 +1383,6 @@ static void CON_DrawConsole(void)
|
||||||
UINT8 *p;
|
UINT8 *p;
|
||||||
size_t i;
|
size_t i;
|
||||||
INT32 y;
|
INT32 y;
|
||||||
INT32 w = 0, x2 = 0;
|
|
||||||
INT32 charflags = 0;
|
INT32 charflags = 0;
|
||||||
INT32 charwidth = (INT32)con_scalefactor << 3;
|
INT32 charwidth = (INT32)con_scalefactor << 3;
|
||||||
INT32 charheight = charwidth;
|
INT32 charheight = charwidth;
|
||||||
|
@ -1416,9 +1415,9 @@ static void CON_DrawConsole(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x2 = vid.width;
|
// inu: no more width (was always 0 and vid.width)
|
||||||
// Hurdler: what's the correct value of w and x2 in hardware mode???
|
if (rendermode != render_none)
|
||||||
if (rendermode != render_none) V_DrawFadeConsBack(w, 0, x2, con_curlines, cons_backcolor.value); // translucent background
|
V_DrawFadeConsBack(con_curlines, cons_backcolor.value); // translucent background
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw console text lines from top to bottom
|
// draw console text lines from top to bottom
|
||||||
|
|
|
@ -1041,6 +1041,40 @@ static void GetPackets(void);
|
||||||
|
|
||||||
static cl_mode_t cl_mode = cl_searching;
|
static cl_mode_t cl_mode = cl_searching;
|
||||||
|
|
||||||
|
// Player name send/load
|
||||||
|
|
||||||
|
static void CV_SavePlayerNames(UINT8 **p)
|
||||||
|
{
|
||||||
|
INT32 i = 0;
|
||||||
|
// Players in game only.
|
||||||
|
for (; i < MAXPLAYERS; ++i)
|
||||||
|
{
|
||||||
|
if (!playeringame[i])
|
||||||
|
{
|
||||||
|
WRITEUINT8(*p, 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
WRITESTRING(*p, player_names[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CV_LoadPlayerNames(UINT8 **p)
|
||||||
|
{
|
||||||
|
INT32 i = 0;
|
||||||
|
char tmp_name[MAXPLAYERNAME+1];
|
||||||
|
tmp_name[MAXPLAYERNAME] = 0;
|
||||||
|
|
||||||
|
for (; i < MAXPLAYERS; ++i)
|
||||||
|
{
|
||||||
|
READSTRING(*p, tmp_name);
|
||||||
|
if (tmp_name[0] == 0)
|
||||||
|
continue;
|
||||||
|
if (tmp_name[MAXPLAYERNAME]) // overflow detected
|
||||||
|
I_Error("Received bad server config packet when trying to join");
|
||||||
|
memcpy(player_names[i], tmp_name, MAXPLAYERNAME+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CLIENT_LOADINGSCREEN
|
#ifdef CLIENT_LOADINGSCREEN
|
||||||
//
|
//
|
||||||
// CL_DrawConnectionStatus
|
// CL_DrawConnectionStatus
|
||||||
|
@ -1070,6 +1104,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
|
|
||||||
switch (cl_mode)
|
switch (cl_mode)
|
||||||
{
|
{
|
||||||
|
#ifdef JOININGAME
|
||||||
case cl_downloadsavegame:
|
case cl_downloadsavegame:
|
||||||
cltext = M_GetText("Downloading game state...");
|
cltext = M_GetText("Downloading game state...");
|
||||||
Net_GetNetStat();
|
Net_GetNetStat();
|
||||||
|
@ -1078,6 +1113,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||||
va("%3.1fK/s ", ((double)getbps)/1024));
|
va("%3.1fK/s ", ((double)getbps)/1024));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case cl_askjoin:
|
case cl_askjoin:
|
||||||
case cl_waitjoinresponse:
|
case cl_waitjoinresponse:
|
||||||
cltext = M_GetText("Requesting to join...");
|
cltext = M_GetText("Requesting to join...");
|
||||||
|
@ -1257,27 +1293,38 @@ static boolean SV_SendServerConfig(INT32 node)
|
||||||
INT32 i;
|
INT32 i;
|
||||||
UINT8 *p, *op;
|
UINT8 *p, *op;
|
||||||
boolean waspacketsent;
|
boolean waspacketsent;
|
||||||
UINT32 playermask = 0;
|
|
||||||
|
|
||||||
netbuffer->packettype = PT_SERVERCFG;
|
netbuffer->packettype = PT_SERVERCFG;
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
if (playeringame[i])
|
|
||||||
playermask |= 1<<i;
|
|
||||||
|
|
||||||
netbuffer->u.servercfg.version = VERSION;
|
netbuffer->u.servercfg.version = VERSION;
|
||||||
netbuffer->u.servercfg.subversion = SUBVERSION;
|
netbuffer->u.servercfg.subversion = SUBVERSION;
|
||||||
|
|
||||||
netbuffer->u.servercfg.serverplayer = (UINT8)serverplayer;
|
netbuffer->u.servercfg.serverplayer = (UINT8)serverplayer;
|
||||||
netbuffer->u.servercfg.totalslotnum = (UINT8)(doomcom->numslots);
|
netbuffer->u.servercfg.totalslotnum = (UINT8)(doomcom->numslots);
|
||||||
netbuffer->u.servercfg.playerdetected = LONG(playermask);
|
|
||||||
netbuffer->u.servercfg.gametic = (tic_t)LONG(gametic);
|
netbuffer->u.servercfg.gametic = (tic_t)LONG(gametic);
|
||||||
netbuffer->u.servercfg.clientnode = (UINT8)node;
|
netbuffer->u.servercfg.clientnode = (UINT8)node;
|
||||||
netbuffer->u.servercfg.gamestate = (UINT8)gamestate;
|
netbuffer->u.servercfg.gamestate = (UINT8)gamestate;
|
||||||
netbuffer->u.servercfg.gametype = (UINT8)gametype;
|
netbuffer->u.servercfg.gametype = (UINT8)gametype;
|
||||||
netbuffer->u.servercfg.modifiedgame = (UINT8)modifiedgame;
|
netbuffer->u.servercfg.modifiedgame = (UINT8)modifiedgame;
|
||||||
netbuffer->u.servercfg.adminplayer = (SINT8)adminplayer;
|
netbuffer->u.servercfg.adminplayer = (SINT8)adminplayer;
|
||||||
|
|
||||||
|
// we fill these structs with FFs so that any players not in game get sent as 0xFFFF
|
||||||
|
// which is nice and easy for us to detect
|
||||||
|
memset(netbuffer->u.servercfg.playerskins, 0xFF, sizeof(netbuffer->u.servercfg.playerskins));
|
||||||
|
memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor));
|
||||||
|
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (!playeringame[i])
|
||||||
|
continue;
|
||||||
|
netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin;
|
||||||
|
netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(netbuffer->u.servercfg.server_context, server_context, 8);
|
memcpy(netbuffer->u.servercfg.server_context, server_context, 8);
|
||||||
op = p = netbuffer->u.servercfg.netcvarstates;
|
op = p = netbuffer->u.servercfg.varlengthinputs;
|
||||||
|
|
||||||
|
CV_SavePlayerNames(&p);
|
||||||
CV_SaveNetVars(&p);
|
CV_SaveNetVars(&p);
|
||||||
{
|
{
|
||||||
const size_t len = sizeof (serverconfig_pak) + (size_t)(p - op);
|
const size_t len = sizeof (serverconfig_pak) + (size_t)(p - op);
|
||||||
|
@ -2063,7 +2110,7 @@ static void Command_connect(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Playing())
|
if (Playing() || titledemo)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("You cannot connect while in a game. End this game first.\n"));
|
CONS_Printf(M_GetText("You cannot connect while in a game. End this game first.\n"));
|
||||||
return;
|
return;
|
||||||
|
@ -3116,6 +3163,11 @@ static void HandleConnect(SINT8 node)
|
||||||
SV_AddWaitingPlayers();
|
SV_AddWaitingPlayers();
|
||||||
player_joining = true;
|
player_joining = true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#ifndef NONET
|
||||||
|
// I guess we have no use for this if we aren't doing mid-level joins?
|
||||||
|
(void)newnode;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3248,7 +3300,6 @@ FILESTAMP
|
||||||
{
|
{
|
||||||
INT32 j;
|
INT32 j;
|
||||||
UINT8 *scp;
|
UINT8 *scp;
|
||||||
UINT32 playermask = 0;
|
|
||||||
|
|
||||||
if (server && serverrunning && node != servernode)
|
if (server && serverrunning && node != servernode)
|
||||||
{ // but wait I thought I'm the server?
|
{ // but wait I thought I'm the server?
|
||||||
|
@ -3283,11 +3334,20 @@ FILESTAMP
|
||||||
#endif
|
#endif
|
||||||
DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode));
|
DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode));
|
||||||
|
|
||||||
playermask = LONG(netbuffer->u.servercfg.playerdetected);
|
memset(playeringame, 0, sizeof(playeringame));
|
||||||
for (j = 0; j < MAXPLAYERS; j++)
|
for (j = 0; j < MAXPLAYERS; j++)
|
||||||
playeringame[j] = (playermask & (1<<j)) != 0;
|
{
|
||||||
|
if (netbuffer->u.servercfg.playerskins[j] == 0xFF
|
||||||
|
&& netbuffer->u.servercfg.playercolor[j] == 0xFF)
|
||||||
|
continue; // not in game
|
||||||
|
|
||||||
scp = netbuffer->u.servercfg.netcvarstates;
|
playeringame[j] = true;
|
||||||
|
SetPlayerSkinByNum(j, (INT32)netbuffer->u.servercfg.playerskins[j]);
|
||||||
|
players[j].skincolor = netbuffer->u.servercfg.playercolor[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
scp = netbuffer->u.servercfg.varlengthinputs;
|
||||||
|
CV_LoadPlayerNames(&scp);
|
||||||
CV_LoadNetVars(&scp);
|
CV_LoadNetVars(&scp);
|
||||||
#ifdef JOININGAME
|
#ifdef JOININGAME
|
||||||
if (netbuffer->u.servercfg.gamestate == GS_LEVEL/* ||
|
if (netbuffer->u.servercfg.gamestate == GS_LEVEL/* ||
|
||||||
|
|
|
@ -267,14 +267,17 @@ typedef struct
|
||||||
UINT8 clientnode;
|
UINT8 clientnode;
|
||||||
UINT8 gamestate;
|
UINT8 gamestate;
|
||||||
|
|
||||||
UINT32 playerdetected; // playeringame vector in bit field
|
// 0xFF == not in game; else player skin num
|
||||||
|
UINT8 playerskins[MAXPLAYERS];
|
||||||
|
UINT8 playercolor[MAXPLAYERS];
|
||||||
|
|
||||||
UINT8 gametype;
|
UINT8 gametype;
|
||||||
UINT8 modifiedgame;
|
UINT8 modifiedgame;
|
||||||
SINT8 adminplayer; // needs to be signed
|
SINT8 adminplayer; // needs to be signed
|
||||||
|
|
||||||
char server_context[8]; // unique context id, generated at server startup.
|
char server_context[8]; // unique context id, generated at server startup.
|
||||||
|
|
||||||
UINT8 netcvarstates[0];
|
UINT8 varlengthinputs[0]; // playernames and netvars
|
||||||
} ATTRPACK serverconfig_pak;
|
} ATTRPACK serverconfig_pak;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
15
src/d_main.c
15
src/d_main.c
|
@ -659,6 +659,7 @@ void D_StartTitle(void)
|
||||||
// okay, stop now
|
// okay, stop now
|
||||||
// (otherwise the game still thinks we're playing!)
|
// (otherwise the game still thinks we're playing!)
|
||||||
SV_StopServer();
|
SV_StopServer();
|
||||||
|
SV_ResetServer();
|
||||||
|
|
||||||
// In case someone exits out at the same time they start a time attack run,
|
// In case someone exits out at the same time they start a time attack run,
|
||||||
// reset modeattacking
|
// reset modeattacking
|
||||||
|
@ -731,7 +732,7 @@ static void IdentifyVersion(void)
|
||||||
char *srb2wad1, *srb2wad2;
|
char *srb2wad1, *srb2wad2;
|
||||||
const char *srb2waddir = NULL;
|
const char *srb2waddir = NULL;
|
||||||
|
|
||||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||||
// change to the directory where 'srb2.srb' is found
|
// change to the directory where 'srb2.srb' is found
|
||||||
srb2waddir = I_LocateWad();
|
srb2waddir = I_LocateWad();
|
||||||
#endif
|
#endif
|
||||||
|
@ -757,7 +758,7 @@ static void IdentifyVersion(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (macintosh) && !defined (SDL)
|
#if defined (macintosh) && !defined (HAVE_SDL)
|
||||||
// cwd is always "/" when app is dbl-clicked
|
// cwd is always "/" when app is dbl-clicked
|
||||||
if (!stricmp(srb2waddir, "/"))
|
if (!stricmp(srb2waddir, "/"))
|
||||||
srb2waddir = I_GetWadDir();
|
srb2waddir = I_GetWadDir();
|
||||||
|
@ -804,7 +805,7 @@ static void IdentifyVersion(void)
|
||||||
// Add our crappy patches to fix our bugs
|
// Add our crappy patches to fix our bugs
|
||||||
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
|
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
|
||||||
|
|
||||||
#if !defined (SDL) || defined (HAVE_MIXER)
|
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||||
{
|
{
|
||||||
#if defined (DC) && 0
|
#if defined (DC) && 0
|
||||||
const char *musicfile = "music_dc.dta";
|
const char *musicfile = "music_dc.dta";
|
||||||
|
@ -929,7 +930,7 @@ void D_SRB2Main(void)
|
||||||
D_Titlebar(srb2, title);
|
D_Titlebar(srb2, title);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__OS2__) && !defined (SDL)
|
#if defined (__OS2__) && !defined (HAVE_SDL)
|
||||||
// set PM window title
|
// set PM window title
|
||||||
snprintf(pmData->title, sizeof (pmData->title),
|
snprintf(pmData->title, sizeof (pmData->title),
|
||||||
"Sonic Robo Blast 2" VERSIONSTRING ": %s",
|
"Sonic Robo Blast 2" VERSIONSTRING ": %s",
|
||||||
|
@ -1086,14 +1087,14 @@ void D_SRB2Main(void)
|
||||||
#endif
|
#endif
|
||||||
D_CleanFile();
|
D_CleanFile();
|
||||||
|
|
||||||
#if 1 // md5s last updated 4/13/14
|
#if 1 // md5s last updated 8/03/14
|
||||||
|
|
||||||
// Check MD5s of autoloaded files
|
// Check MD5s of autoloaded files
|
||||||
W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad
|
W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad
|
||||||
W_VerifyFileMD5(1, "e956466eff2c79f7b1cdefad24761bce"); // zones.dta
|
W_VerifyFileMD5(1, "e956466eff2c79f7b1cdefad24761bce"); // zones.dta
|
||||||
W_VerifyFileMD5(2, "95a4cdbed287323dd361243f357a5fd2"); // player.dta
|
W_VerifyFileMD5(2, "95a4cdbed287323dd361243f357a5fd2"); // player.dta
|
||||||
W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta
|
W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta
|
||||||
W_VerifyFileMD5(4, "1f37fe7bcc608a23eadb0e2c2d7c7124"); // patch.dta
|
W_VerifyFileMD5(4, "636e4c7b71e770e8368b48fcfe07bbd8"); // patch.dta
|
||||||
// don't check music.dta because people like to modify it, and it doesn't matter if they do
|
// don't check music.dta because people like to modify it, and it doesn't matter if they do
|
||||||
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
|
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
|
||||||
#endif
|
#endif
|
||||||
|
@ -1136,7 +1137,7 @@ void D_SRB2Main(void)
|
||||||
|
|
||||||
G_LoadGameData();
|
G_LoadGameData();
|
||||||
|
|
||||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||||
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -800,9 +800,8 @@ static void DebugPrintpacket(const char *header)
|
||||||
fprintfstring((char *)netbuffer->u.textcmd+1, netbuffer->u.textcmd[0]);
|
fprintfstring((char *)netbuffer->u.textcmd+1, netbuffer->u.textcmd[0]);
|
||||||
break;
|
break;
|
||||||
case PT_SERVERCFG:
|
case PT_SERVERCFG:
|
||||||
fprintf(debugfile, " playermask %x playerslots %d clientnode %d serverplayer %d "
|
fprintf(debugfile, " playerslots %d clientnode %d serverplayer %d "
|
||||||
"gametic %u gamestate %d gametype %d modifiedgame %d\n",
|
"gametic %u gamestate %d gametype %d modifiedgame %d\n",
|
||||||
(UINT32)LONG(netbuffer->u.servercfg.playerdetected),
|
|
||||||
netbuffer->u.servercfg.totalslotnum, netbuffer->u.servercfg.clientnode,
|
netbuffer->u.servercfg.totalslotnum, netbuffer->u.servercfg.clientnode,
|
||||||
netbuffer->u.servercfg.serverplayer, (UINT32)LONG(netbuffer->u.servercfg.gametic),
|
netbuffer->u.servercfg.serverplayer, (UINT32)LONG(netbuffer->u.servercfg.gametic),
|
||||||
netbuffer->u.servercfg.gamestate, netbuffer->u.servercfg.gametype,
|
netbuffer->u.servercfg.gamestate, netbuffer->u.servercfg.gametype,
|
||||||
|
|
197
src/d_netcmd.c
197
src/d_netcmd.c
|
@ -106,8 +106,6 @@ static void Command_Stopdemo_f(void);
|
||||||
static void Command_StartMovie_f(void);
|
static void Command_StartMovie_f(void);
|
||||||
static void Command_StopMovie_f(void);
|
static void Command_StopMovie_f(void);
|
||||||
static void Command_Map_f(void);
|
static void Command_Map_f(void);
|
||||||
static void Command_Teleport_f(void);
|
|
||||||
static void Command_RTeleport_f(void);
|
|
||||||
static void Command_ResetCamera_f(void);
|
static void Command_ResetCamera_f(void);
|
||||||
|
|
||||||
static void Command_Addfile(void);
|
static void Command_Addfile(void);
|
||||||
|
@ -124,13 +122,11 @@ static void Command_Version_f(void);
|
||||||
static void Command_ModDetails_f(void);
|
static void Command_ModDetails_f(void);
|
||||||
#endif
|
#endif
|
||||||
static void Command_ShowGametype_f(void);
|
static void Command_ShowGametype_f(void);
|
||||||
static void Command_JumpToAxis_f(void);
|
|
||||||
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void);
|
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_Tunes_f(void);
|
||||||
static void Command_Skynum_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);
|
||||||
|
@ -258,7 +254,7 @@ consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_co
|
||||||
consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||||
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
|
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#endif
|
#endif
|
||||||
#if (defined (LJOYSTICK) || defined (SDL))
|
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||||
#ifdef LJOYSTICK
|
#ifdef LJOYSTICK
|
||||||
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
|
consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
|
||||||
|
@ -333,7 +329,7 @@ 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", 0, timetic_cons_t, NULL, CV_SAVE, NULL, NULL, 0, 0, NULL}; // use tics in display
|
consvar_t cv_timetic = {"timerres", "Normal", CV_SAVE, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
|
||||||
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, 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}};
|
||||||
|
@ -444,7 +440,6 @@ void D_RegisterServerCommands(void)
|
||||||
COM_AddCommand("suicide", Command_Suicide);
|
COM_AddCommand("suicide", Command_Suicide);
|
||||||
|
|
||||||
COM_AddCommand("gametype", Command_ShowGametype_f);
|
COM_AddCommand("gametype", Command_ShowGametype_f);
|
||||||
COM_AddCommand("jumptoaxis", Command_JumpToAxis_f);
|
|
||||||
COM_AddCommand("version", Command_Version_f);
|
COM_AddCommand("version", Command_Version_f);
|
||||||
#ifdef UPDATE_ALERT
|
#ifdef UPDATE_ALERT
|
||||||
COM_AddCommand("mod_details", Command_ModDetails_f);
|
COM_AddCommand("mod_details", Command_ModDetails_f);
|
||||||
|
@ -766,11 +761,13 @@ void D_RegisterClientCommands(void)
|
||||||
COM_AddCommand("scale", Command_Scale_f);
|
COM_AddCommand("scale", Command_Scale_f);
|
||||||
COM_AddCommand("gravflip", Command_Gravflip_f);
|
COM_AddCommand("gravflip", Command_Gravflip_f);
|
||||||
COM_AddCommand("hurtme", Command_Hurtme_f);
|
COM_AddCommand("hurtme", Command_Hurtme_f);
|
||||||
|
COM_AddCommand("jumptoaxis", Command_JumpToAxis_f);
|
||||||
COM_AddCommand("charability", Command_Charability_f);
|
COM_AddCommand("charability", Command_Charability_f);
|
||||||
COM_AddCommand("charspeed", Command_Charspeed_f);
|
COM_AddCommand("charspeed", Command_Charspeed_f);
|
||||||
COM_AddCommand("teleport", Command_Teleport_f);
|
COM_AddCommand("teleport", Command_Teleport_f);
|
||||||
COM_AddCommand("rteleport", Command_RTeleport_f);
|
COM_AddCommand("rteleport", Command_RTeleport_f);
|
||||||
COM_AddCommand("skynum", Command_Skynum_f);
|
COM_AddCommand("skynum", Command_Skynum_f);
|
||||||
|
COM_AddCommand("weather", Command_Weather_f);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
COM_AddCommand("causecfail", Command_CauseCfail_f);
|
COM_AddCommand("causecfail", Command_CauseCfail_f);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1384,149 +1381,6 @@ static void Command_ResetCamera_f(void)
|
||||||
P_ResetCamera(&players[displayplayer], &camera);
|
P_ResetCamera(&players[displayplayer], &camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Command_RTeleport_f(void)
|
|
||||||
{
|
|
||||||
fixed_t intx, inty, intz;
|
|
||||||
size_t i;
|
|
||||||
player_t *p = &players[consoleplayer];
|
|
||||||
subsector_t *ss;
|
|
||||||
|
|
||||||
if (!(cv_debug || devparm))
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("DEVMODE must be enabled."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (netgame)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("This only works in single player.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (COM_Argc() < 3 || COM_Argc() > 7)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("rteleport -x <value> -y <value> -z <value>: relative teleport to a location\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!p->mo)
|
|
||||||
return;
|
|
||||||
|
|
||||||
i = COM_CheckParm("-x");
|
|
||||||
if (i)
|
|
||||||
intx = atoi(COM_Argv(i + 1));
|
|
||||||
else
|
|
||||||
intx = 0;
|
|
||||||
|
|
||||||
i = COM_CheckParm("-y");
|
|
||||||
if (i)
|
|
||||||
inty = atoi(COM_Argv(i + 1));
|
|
||||||
else
|
|
||||||
inty = 0;
|
|
||||||
|
|
||||||
ss = R_PointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT);
|
|
||||||
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
i = COM_CheckParm("-z");
|
|
||||||
if (i)
|
|
||||||
{
|
|
||||||
intz = atoi(COM_Argv(i + 1));
|
|
||||||
intz <<= FRACBITS;
|
|
||||||
intz += p->mo->z;
|
|
||||||
if (intz < ss->sector->floorheight)
|
|
||||||
intz = ss->sector->floorheight;
|
|
||||||
if (intz > ss->sector->ceilingheight - p->mo->height)
|
|
||||||
intz = ss->sector->ceilingheight - p->mo->height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
intz = 0;
|
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Teleporting by %d, %d, %d...\n"), intx, inty, FixedInt((intz-p->mo->z)));
|
|
||||||
|
|
||||||
P_MapStart();
|
|
||||||
if (!P_TeleportMove(p->mo, p->mo->x+intx*FRACUNIT, p->mo->y+inty*FRACUNIT, intz))
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
|
|
||||||
else
|
|
||||||
S_StartSound(p->mo, sfx_mixup);
|
|
||||||
P_MapEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Command_Teleport_f(void)
|
|
||||||
{
|
|
||||||
fixed_t intx, inty, intz;
|
|
||||||
size_t i;
|
|
||||||
player_t *p = &players[consoleplayer];
|
|
||||||
subsector_t *ss;
|
|
||||||
|
|
||||||
if (!(cv_debug || devparm))
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("DEVMODE must be enabled."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (netgame)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("This only works in single player.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (COM_Argc() < 3 || COM_Argc() > 7)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("teleport -x <value> -y <value> -z <value>: teleport to a location\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!p->mo)
|
|
||||||
return;
|
|
||||||
|
|
||||||
i = COM_CheckParm("-x");
|
|
||||||
if (i)
|
|
||||||
intx = atoi(COM_Argv(i + 1));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "X");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = COM_CheckParm("-y");
|
|
||||||
if (i)
|
|
||||||
inty = atoi(COM_Argv(i + 1));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "Y");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ss = R_PointInSubsector(intx*FRACUNIT, inty*FRACUNIT);
|
|
||||||
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
i = COM_CheckParm("-z");
|
|
||||||
if (i)
|
|
||||||
{
|
|
||||||
intz = atoi(COM_Argv(i + 1));
|
|
||||||
intz <<= FRACBITS;
|
|
||||||
if (intz < ss->sector->floorheight)
|
|
||||||
intz = ss->sector->floorheight;
|
|
||||||
if (intz > ss->sector->ceilingheight - p->mo->height)
|
|
||||||
intz = ss->sector->ceilingheight - p->mo->height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
intz = ss->sector->floorheight;
|
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Teleporting to %d, %d, %d...\n"), intx, inty, FixedInt(intz));
|
|
||||||
|
|
||||||
P_MapStart();
|
|
||||||
if (!P_TeleportMove(p->mo, intx*FRACUNIT, inty*FRACUNIT, intz))
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
|
|
||||||
else
|
|
||||||
S_StartSound(p->mo, sfx_mixup);
|
|
||||||
P_MapEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
// play a demo, add .lmp for external demos
|
// play a demo, add .lmp for external demos
|
||||||
|
@ -3359,23 +3213,6 @@ static void Command_ShowGametype_f(void)
|
||||||
CONS_Printf(M_GetText("Current gametype is %d\n"), gametype);
|
CONS_Printf(M_GetText("Current gametype is %d\n"), gametype);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moves the NiGHTS player to another axis within the current mare
|
|
||||||
// Only for development purposes.
|
|
||||||
//
|
|
||||||
static void Command_JumpToAxis_f(void)
|
|
||||||
{
|
|
||||||
if (!cv_debug)
|
|
||||||
CONS_Printf(M_GetText("DEVMODE must be enabled.\n"));
|
|
||||||
|
|
||||||
if (COM_Argc() != 2)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("jumptoaxis <axisnum>: Jump to axis within current mare.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
P_TransferToAxis(&players[consoleplayer], atoi(COM_Argv(1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Plays the intro.
|
/** Plays the intro.
|
||||||
*/
|
*/
|
||||||
static void Command_Playintro_f(void)
|
static void Command_Playintro_f(void)
|
||||||
|
@ -3926,32 +3763,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_Skynum_f(void)
|
|
||||||
{
|
|
||||||
if (!cv_debug)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("DEVMODE must be enabled.\n"));
|
|
||||||
CONS_Printf(M_GetText("If you want to change the sky interactively on a map, use the linedef executor feature instead.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (netgame || multiplayer)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("This only works in single player.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (COM_Argc() != 2)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("skynum <sky#>: change the sky\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Previewing sky %s...\n"), COM_Argv(1));
|
|
||||||
|
|
||||||
P_SetupLevelSky(atoi(COM_Argv(1)), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Command_Tunes_f(void)
|
static void Command_Tunes_f(void)
|
||||||
{
|
{
|
||||||
const char *tunearg;
|
const char *tunearg;
|
||||||
|
|
|
@ -38,6 +38,7 @@ typedef enum
|
||||||
SF_HIRES = 1<<3, // Draw the sprite 2x as small?
|
SF_HIRES = 1<<3, // Draw the sprite 2x as small?
|
||||||
SF_NOSKID = 1<<4, // No skid particles etc
|
SF_NOSKID = 1<<4, // No skid particles etc
|
||||||
SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust
|
SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust
|
||||||
|
SF_RUNONWATER = 1<<6, // Run on top of water FOFs?
|
||||||
} skinflags_t;
|
} skinflags_t;
|
||||||
|
|
||||||
//Primary and secondary skin abilities
|
//Primary and secondary skin abilities
|
||||||
|
@ -55,7 +56,8 @@ typedef enum
|
||||||
CA_TELEKINESIS,
|
CA_TELEKINESIS,
|
||||||
CA_FALLSWITCH,
|
CA_FALLSWITCH,
|
||||||
CA_JUMPBOOST,
|
CA_JUMPBOOST,
|
||||||
CA_AIRDRILL
|
CA_AIRDRILL,
|
||||||
|
CA_JUMPTHOK
|
||||||
} charability_t;
|
} charability_t;
|
||||||
|
|
||||||
//Secondary skin abilities
|
//Secondary skin abilities
|
||||||
|
@ -147,7 +149,10 @@ typedef enum
|
||||||
PF_TAGGED = 1<<27, // Player has been tagged and awaits the next round in hide and seek.
|
PF_TAGGED = 1<<27, // Player has been tagged and awaits the next round in hide and seek.
|
||||||
PF_TAGIT = 1<<28, // The player is it! For Tag Mode
|
PF_TAGIT = 1<<28, // The player is it! For Tag Mode
|
||||||
|
|
||||||
// free: 1<<29 through 1<<31
|
/*** misc ***/
|
||||||
|
PF_FORCESTRAFE = 1<<29, // Turning inputs are translated into strafing inputs
|
||||||
|
|
||||||
|
// free: 1<<30 and 1<<31
|
||||||
} pflags_t;
|
} pflags_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
174
src/dehacked.c
174
src/dehacked.c
|
@ -27,6 +27,7 @@
|
||||||
#include "p_local.h" // for var1 and var2, and some constants
|
#include "p_local.h" // for var1 and var2, and some constants
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
|
#include "r_sky.h"
|
||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_hook.h"
|
#include "lua_hook.h"
|
||||||
|
@ -364,6 +365,10 @@ static void clear_levels(void)
|
||||||
if (!mapheaderinfo[i])
|
if (!mapheaderinfo[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Custom map header info
|
||||||
|
// (no need to set num to 0, we're freeing the entire header shortly)
|
||||||
|
Z_Free(mapheaderinfo[i]->customopts);
|
||||||
|
|
||||||
P_DeleteGrades(i);
|
P_DeleteGrades(i);
|
||||||
Z_Free(mapheaderinfo[i]);
|
Z_Free(mapheaderinfo[i]);
|
||||||
mapheaderinfo[i] = NULL;
|
mapheaderinfo[i] = NULL;
|
||||||
|
@ -991,6 +996,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||||
char *word = s;
|
char *word = s;
|
||||||
char *word2;
|
char *word2;
|
||||||
|
//char *word3; // Non-uppercase version of word2
|
||||||
char *tmp;
|
char *tmp;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
@ -1034,6 +1040,49 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lua custom options also go above, contents may be case sensitive.
|
||||||
|
if (fastncmp(word, "LUA.", 4))
|
||||||
|
{
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
UINT8 j;
|
||||||
|
customoption_t *modoption;
|
||||||
|
|
||||||
|
// Note: we actualy strlwr word here, so things are made a little easier for Lua
|
||||||
|
strlwr(word);
|
||||||
|
word += 4; // move past "lua."
|
||||||
|
|
||||||
|
// ... and do a simple name sanity check; the name must start with a letter
|
||||||
|
if (*word < 'a' || *word > 'z')
|
||||||
|
{
|
||||||
|
deh_warning("Level header %d: invalid custom option name \"%s\"", num, word);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanity limit of 128 params
|
||||||
|
if (mapheaderinfo[num-1]->numCustomOptions == 128)
|
||||||
|
{
|
||||||
|
deh_warning("Level header %d: too many custom parameters", num);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
j = mapheaderinfo[num-1]->numCustomOptions++;
|
||||||
|
|
||||||
|
mapheaderinfo[num-1]->customopts =
|
||||||
|
Z_Realloc(mapheaderinfo[num-1]->customopts,
|
||||||
|
sizeof(customoption_t) * mapheaderinfo[num-1]->numCustomOptions, PU_STATIC, NULL);
|
||||||
|
|
||||||
|
// Newly allocated
|
||||||
|
modoption = &mapheaderinfo[num-1]->customopts[j];
|
||||||
|
|
||||||
|
strncpy(modoption->option, word, 31);
|
||||||
|
modoption->option[31] = '\0';
|
||||||
|
strncpy(modoption->value, word2, 255);
|
||||||
|
modoption->value[255] = '\0';
|
||||||
|
#else
|
||||||
|
// Silently ignore.
|
||||||
|
#endif
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Now go to uppercase
|
// Now go to uppercase
|
||||||
strupr(word2);
|
strupr(word2);
|
||||||
|
|
||||||
|
@ -1047,19 +1096,26 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
deh_warning("Level header %d: unknown word '%s'", num, word);
|
deh_warning("Level header %d: unknown word '%s'", num, word);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
|
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strings that can be truncated
|
// Strings that can be truncated
|
||||||
else if (fastcmp(word, "LEVELNAME"))
|
else if (fastcmp(word, "LEVELNAME"))
|
||||||
|
{
|
||||||
deh_strlcpy(mapheaderinfo[num-1]->lvlttl, word2,
|
deh_strlcpy(mapheaderinfo[num-1]->lvlttl, word2,
|
||||||
sizeof(mapheaderinfo[num-1]->lvlttl), va("Level header %d: levelname", num));
|
sizeof(mapheaderinfo[num-1]->lvlttl), va("Level header %d: levelname", num));
|
||||||
|
}
|
||||||
else if (fastcmp(word, "SCRIPTNAME"))
|
else if (fastcmp(word, "SCRIPTNAME"))
|
||||||
|
{
|
||||||
deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2,
|
deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2,
|
||||||
sizeof(mapheaderinfo[num-1]->scriptname), va("Level header %d: scriptname", num));
|
sizeof(mapheaderinfo[num-1]->scriptname), va("Level header %d: scriptname", num));
|
||||||
|
}
|
||||||
else if (fastcmp(word, "RUNSOC"))
|
else if (fastcmp(word, "RUNSOC"))
|
||||||
|
{
|
||||||
deh_strlcpy(mapheaderinfo[num-1]->runsoc, word2,
|
deh_strlcpy(mapheaderinfo[num-1]->runsoc, word2,
|
||||||
sizeof(mapheaderinfo[num-1]->runsoc), va("Level header %d: runsoc", num));
|
sizeof(mapheaderinfo[num-1]->runsoc), va("Level header %d: runsoc", num));
|
||||||
|
}
|
||||||
else if (fastcmp(word, "ACT"))
|
else if (fastcmp(word, "ACT"))
|
||||||
{
|
{
|
||||||
if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19
|
if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19
|
||||||
|
@ -1240,7 +1296,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
else
|
else
|
||||||
mapheaderinfo[num-1]->menuflags &= ~LF2_NOVISITNEEDED;
|
mapheaderinfo[num-1]->menuflags &= ~LF2_NOVISITNEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
deh_warning("Level header %d: unknown word '%s'", num, word);
|
deh_warning("Level header %d: unknown word '%s'", num, word);
|
||||||
}
|
}
|
||||||
|
@ -7145,23 +7200,11 @@ static const char *const MOBJEFLAG_LIST[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const MAPTHINGFLAG_LIST[16] = {
|
static const char *const MAPTHINGFLAG_LIST[4] = {
|
||||||
NULL,
|
NULL,
|
||||||
"OBJECTFLIP", // Reverse gravity flag for objects.
|
"OBJECTFLIP", // Reverse gravity flag for objects.
|
||||||
"OBJECTSPECIAL", // Special flag used with certain objects.
|
"OBJECTSPECIAL", // Special flag used with certain objects.
|
||||||
"AMBUSH", // Deaf monsters/do not react to sound.
|
"AMBUSH" // Deaf monsters/do not react to sound.
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const PLAYERFLAG_LIST[] = {
|
static const char *const PLAYERFLAG_LIST[] = {
|
||||||
|
@ -7228,6 +7271,9 @@ static const char *const PLAYERFLAG_LIST[] = {
|
||||||
"TAGGED", // Player has been tagged and awaits the next round in hide and seek.
|
"TAGGED", // Player has been tagged and awaits the next round in hide and seek.
|
||||||
"TAGIT", // The player is it! For Tag Mode
|
"TAGIT", // The player is it! For Tag Mode
|
||||||
|
|
||||||
|
/*** misc ***/
|
||||||
|
"FORCESTRAFE", // Translate turn inputs into strafe inputs
|
||||||
|
|
||||||
NULL // stop loop here.
|
NULL // stop loop here.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7443,6 +7489,19 @@ struct {
|
||||||
{"TOL_ERZ3",TOL_ERZ3},
|
{"TOL_ERZ3",TOL_ERZ3},
|
||||||
{"TOL_XMAS",TOL_XMAS},
|
{"TOL_XMAS",TOL_XMAS},
|
||||||
|
|
||||||
|
// Level flags
|
||||||
|
{"LF_SCRIPTISFILE",LF_SCRIPTISFILE},
|
||||||
|
{"LF_SPEEDMUSIC",LF_SPEEDMUSIC},
|
||||||
|
{"LF_NOSSMUSIC",LF_NOSSMUSIC},
|
||||||
|
{"LF_NORELOAD",LF_NORELOAD},
|
||||||
|
{"LF_NOZONE",LF_NOZONE},
|
||||||
|
// And map flags
|
||||||
|
{"LF2_HIDEINMENU",LF2_HIDEINMENU},
|
||||||
|
{"LF2_HIDEINSTATS",LF2_HIDEINSTATS},
|
||||||
|
{"LF2_RECORDATTACK",LF2_RECORDATTACK},
|
||||||
|
{"LF2_NIGHTSATTACK",LF2_NIGHTSATTACK},
|
||||||
|
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
|
||||||
|
|
||||||
// NiGHTS grades
|
// NiGHTS grades
|
||||||
{"GRADE_F",GRADE_F},
|
{"GRADE_F",GRADE_F},
|
||||||
{"GRADE_E",GRADE_E},
|
{"GRADE_E",GRADE_E},
|
||||||
|
@ -7507,6 +7566,7 @@ struct {
|
||||||
{"SF_HIRES",SF_HIRES},
|
{"SF_HIRES",SF_HIRES},
|
||||||
{"SF_NOSKID",SF_NOSKID},
|
{"SF_NOSKID",SF_NOSKID},
|
||||||
{"SF_NOSPEEDADJUST",SF_NOSPEEDADJUST},
|
{"SF_NOSPEEDADJUST",SF_NOSPEEDADJUST},
|
||||||
|
{"SF_RUNONWATER",SF_RUNONWATER},
|
||||||
|
|
||||||
// Character abilities!
|
// Character abilities!
|
||||||
// Primary
|
// Primary
|
||||||
|
@ -7523,6 +7583,7 @@ struct {
|
||||||
{"CA_FALLSWITCH",CA_FALLSWITCH},
|
{"CA_FALLSWITCH",CA_FALLSWITCH},
|
||||||
{"CA_JUMPBOOST",CA_JUMPBOOST},
|
{"CA_JUMPBOOST",CA_JUMPBOOST},
|
||||||
{"CA_AIRDRILL",CA_AIRDRILL},
|
{"CA_AIRDRILL",CA_AIRDRILL},
|
||||||
|
{"CA_JUMPTHOK",CA_JUMPTHOK},
|
||||||
// Secondary
|
// Secondary
|
||||||
{"CA2_NONE",CA2_NONE}, // now slot 0!
|
{"CA2_NONE",CA2_NONE}, // now slot 0!
|
||||||
{"CA2_SPINDASH",CA2_SPINDASH},
|
{"CA2_SPINDASH",CA2_SPINDASH},
|
||||||
|
@ -7590,6 +7651,68 @@ struct {
|
||||||
{"GF_REDFLAG",GF_REDFLAG},
|
{"GF_REDFLAG",GF_REDFLAG},
|
||||||
{"GF_BLUEFLAG",GF_BLUEFLAG},
|
{"GF_BLUEFLAG",GF_BLUEFLAG},
|
||||||
|
|
||||||
|
// Customisable sounds for Skins, from sounds.h
|
||||||
|
{"SKSSPIN",SKSSPIN},
|
||||||
|
{"SKSPUTPUT",SKSPUTPUT},
|
||||||
|
{"SKSPUDPUD",SKSPUDPUD},
|
||||||
|
{"SKSPLPAN1",SKSPLPAN1}, // Ouchies
|
||||||
|
{"SKSPLPAN2",SKSPLPAN2},
|
||||||
|
{"SKSPLPAN3",SKSPLPAN3},
|
||||||
|
{"SKSPLPAN4",SKSPLPAN4},
|
||||||
|
{"SKSPLDET1",SKSPLDET1}, // Deaths
|
||||||
|
{"SKSPLDET2",SKSPLDET2},
|
||||||
|
{"SKSPLDET3",SKSPLDET3},
|
||||||
|
{"SKSPLDET4",SKSPLDET4},
|
||||||
|
{"SKSPLVCT1",SKSPLVCT1}, // Victories
|
||||||
|
{"SKSPLVCT2",SKSPLVCT2},
|
||||||
|
{"SKSPLVCT3",SKSPLVCT3},
|
||||||
|
{"SKSPLVCT4",SKSPLVCT4},
|
||||||
|
{"SKSTHOK",SKSTHOK},
|
||||||
|
{"SKSSPNDSH",SKSSPNDSH},
|
||||||
|
{"SKSZOOM",SKSZOOM},
|
||||||
|
{"SKSSKID",SKSSKID},
|
||||||
|
{"SKSGASP",SKSGASP},
|
||||||
|
{"SKSJUMP",SKSJUMP},
|
||||||
|
|
||||||
|
// 3D Floor/Fake Floor/FOF/whatever flags
|
||||||
|
{"FF_EXISTS",FF_EXISTS}, ///< Always set, to check for validity.
|
||||||
|
{"FF_BLOCKPLAYER",FF_BLOCKPLAYER}, ///< Solid to player, but nothing else
|
||||||
|
{"FF_BLOCKOTHERS",FF_BLOCKOTHERS}, ///< Solid to everything but player
|
||||||
|
{"FF_SOLID",FF_SOLID}, ///< Clips things.
|
||||||
|
{"FF_RENDERSIDES",FF_RENDERSIDES}, ///< Renders the sides.
|
||||||
|
{"FF_RENDERPLANES",FF_RENDERPLANES}, ///< Renders the floor/ceiling.
|
||||||
|
{"FF_RENDERALL",FF_RENDERALL}, ///< Renders everything.
|
||||||
|
{"FF_SWIMMABLE",FF_SWIMMABLE}, ///< Is a water block.
|
||||||
|
{"FF_NOSHADE",FF_NOSHADE}, ///< Messes with the lighting?
|
||||||
|
{"FF_CUTSOLIDS",FF_CUTSOLIDS}, ///< Cuts out hidden solid pixels.
|
||||||
|
{"FF_CUTEXTRA",FF_CUTEXTRA}, ///< Cuts out hidden translucent pixels.
|
||||||
|
{"FF_CUTLEVEL",FF_CUTLEVEL}, ///< Cuts out all hidden pixels.
|
||||||
|
{"FF_CUTSPRITES",FF_CUTSPRITES}, ///< Final step in making 3D water.
|
||||||
|
{"FF_BOTHPLANES",FF_BOTHPLANES}, ///< Renders both planes all the time.
|
||||||
|
{"FF_EXTRA",FF_EXTRA}, ///< Gets cut by ::FF_CUTEXTRA.
|
||||||
|
{"FF_TRANSLUCENT",FF_TRANSLUCENT}, ///< See through!
|
||||||
|
{"FF_FOG",FF_FOG}, ///< Fog "brush."
|
||||||
|
{"FF_INVERTPLANES",FF_INVERTPLANES}, ///< Reverse the plane visibility rules.
|
||||||
|
{"FF_ALLSIDES",FF_ALLSIDES}, ///< Render inside and outside sides.
|
||||||
|
{"FF_INVERTSIDES",FF_INVERTSIDES}, ///< Only render inside sides.
|
||||||
|
{"FF_DOUBLESHADOW",FF_DOUBLESHADOW}, ///< Make two lightlist entries to reset light?
|
||||||
|
{"FF_FLOATBOB",FF_FLOATBOB}, ///< Floats on water and bobs if you step on it.
|
||||||
|
{"FF_NORETURN",FF_NORETURN}, ///< Used with ::FF_CRUMBLE. Will not return to its original position after falling.
|
||||||
|
{"FF_CRUMBLE",FF_CRUMBLE}, ///< Falls 2 seconds after being stepped on, and randomly brings all touching crumbling 3dfloors down with it, providing their master sectors share the same tag (allows crumble platforms above or below, to also exist).
|
||||||
|
{"FF_SHATTERBOTTOM",FF_SHATTERBOTTOM}, ///< Used with ::FF_BUSTUP. Like FF_SHATTER, but only breaks from the bottom. Good for springing up through rubble.
|
||||||
|
{"FF_MARIO",FF_MARIO}, ///< Acts like a question block when hit from underneath. Goodie spawned at top is determined by master sector.
|
||||||
|
{"FF_BUSTUP",FF_BUSTUP}, ///< You can spin through/punch this block and it will crumble!
|
||||||
|
{"FF_QUICKSAND",FF_QUICKSAND}, ///< Quicksand!
|
||||||
|
{"FF_PLATFORM",FF_PLATFORM}, ///< You can jump up through this to the top.
|
||||||
|
{"FF_REVERSEPLATFORM",FF_REVERSEPLATFORM}, ///< A fall-through floor in normal gravity, a platform in reverse gravity.
|
||||||
|
{"FF_INTANGABLEFLATS",FF_INTANGABLEFLATS}, ///< Both flats are intangable, but the sides are still solid.
|
||||||
|
{"FF_SHATTER",FF_SHATTER}, ///< Used with ::FF_BUSTUP. Thinks everyone's Knuckles.
|
||||||
|
{"FF_SPINBUST",FF_SPINBUST}, ///< Used with ::FF_BUSTUP. Jump or fall onto it while curled in a ball.
|
||||||
|
{"FF_ONLYKNUX",FF_ONLYKNUX}, ///< Used with ::FF_BUSTUP. Only Knuckles can break this rock.
|
||||||
|
{"FF_RIPPLE",FF_RIPPLE}, ///< Ripple the flats
|
||||||
|
{"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel
|
||||||
|
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
|
||||||
|
|
||||||
// Angles
|
// Angles
|
||||||
{"ANG1",ANG1},
|
{"ANG1",ANG1},
|
||||||
{"ANG2",ANG2},
|
{"ANG2",ANG2},
|
||||||
|
@ -8266,7 +8389,7 @@ static inline int lib_getenum(lua_State *L)
|
||||||
}
|
}
|
||||||
else if (fastncmp("MTF_", word, 4)) {
|
else if (fastncmp("MTF_", word, 4)) {
|
||||||
p = word+4;
|
p = word+4;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (MAPTHINGFLAG_LIST[i] && fastcmp(p, MAPTHINGFLAG_LIST[i])) {
|
if (MAPTHINGFLAG_LIST[i] && fastcmp(p, MAPTHINGFLAG_LIST[i])) {
|
||||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -8296,6 +8419,11 @@ static inline int lib_getenum(lua_State *L)
|
||||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (fastcmp(p, "NETONLY"))
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, (lua_Integer)ML_NETONLY);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (mathlib) return luaL_error(L, "linedef flag '%s' could not be found.\n", word);
|
if (mathlib) return luaL_error(L, "linedef flag '%s' could not be found.\n", word);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -8543,11 +8671,25 @@ static inline int lib_getenum(lua_State *L)
|
||||||
} else if (fastcmp(word,"globalweather")) {
|
} else if (fastcmp(word,"globalweather")) {
|
||||||
lua_pushinteger(L, globalweather);
|
lua_pushinteger(L, globalweather);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (fastcmp(word,"levelskynum")) {
|
||||||
|
lua_pushinteger(L, levelskynum);
|
||||||
|
return 1;
|
||||||
|
} else if (fastcmp(word,"globallevelskynum")) {
|
||||||
|
lua_pushinteger(L, globallevelskynum);
|
||||||
|
return 1;
|
||||||
|
} else if (fastcmp(word,"mapmusic")) {
|
||||||
|
lua_pushinteger(L, mapmusic);
|
||||||
|
return 1;
|
||||||
} else if (fastcmp(word,"server")) {
|
} else if (fastcmp(word,"server")) {
|
||||||
if (dedicated || !playeringame[serverplayer])
|
if (dedicated || !playeringame[serverplayer])
|
||||||
return 0;
|
return 0;
|
||||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (fastcmp(word,"dedicatedserver")) {
|
||||||
|
if (!dedicated)
|
||||||
|
return 0;
|
||||||
|
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||||
|
return 1;
|
||||||
} else if (fastcmp(word,"admin")) {
|
} else if (fastcmp(word,"admin")) {
|
||||||
if (!playeringame[adminplayer] || adminplayer == serverplayer)
|
if (!playeringame[adminplayer] || adminplayer == serverplayer)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define SOUND_FMOD 3
|
#define SOUND_FMOD 3
|
||||||
|
|
||||||
#ifndef SOUND
|
#ifndef SOUND
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
|
|
||||||
// Use Mixer interface?
|
// Use Mixer interface?
|
||||||
#ifdef HAVE_MIXER
|
#ifdef HAVE_MIXER
|
||||||
|
@ -144,8 +144,8 @@ extern FILE *logstream;
|
||||||
#define VERSIONSTRING "Trunk"
|
#define VERSIONSTRING "Trunk"
|
||||||
#else
|
#else
|
||||||
#define VERSION 201 // Game version
|
#define VERSION 201 // Game version
|
||||||
#define SUBVERSION 8 // more precise version number
|
#define SUBVERSION 9 // more precise version number
|
||||||
#define VERSIONSTRING "v2.1.8"
|
#define VERSIONSTRING "v2.1.9"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Modification options
|
// Modification options
|
||||||
|
@ -201,7 +201,7 @@ extern FILE *logstream;
|
||||||
// it's only for detection of the version the player is using so the MS can alert them of an update.
|
// it's only for detection of the version the player is using so the MS can alert them of an update.
|
||||||
// Only set it higher, not lower, obviously.
|
// Only set it higher, not lower, obviously.
|
||||||
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
|
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
|
||||||
#define MODVERSION 13
|
#define MODVERSION 14
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,14 @@ typedef struct
|
||||||
UINT32 grade[6]; // D, C, B, A, S, X (F: failed to reach any of these)
|
UINT32 grade[6]; // D, C, B, A, S, X (F: failed to reach any of these)
|
||||||
} nightsgrades_t;
|
} nightsgrades_t;
|
||||||
|
|
||||||
|
// Custom Lua values
|
||||||
|
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char option[32]; // 31 usable characters
|
||||||
|
char value[256]; // 255 usable characters. If this seriously isn't enough then wtf.
|
||||||
|
} customoption_t;
|
||||||
|
|
||||||
/** Map header information.
|
/** Map header information.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -238,6 +246,11 @@ typedef struct
|
||||||
// NiGHTS stuff.
|
// NiGHTS stuff.
|
||||||
UINT8 numGradedMares; ///< Internal. For grade support.
|
UINT8 numGradedMares; ///< Internal. For grade support.
|
||||||
nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful.
|
nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful.
|
||||||
|
|
||||||
|
// Lua stuff.
|
||||||
|
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
|
||||||
|
UINT8 numCustomOptions; ///< Internal. For Lua custom value support.
|
||||||
|
customoption_t *customopts; ///< Custom options. Allocated dynamically for space reasons. Be careful.
|
||||||
} mapheader_t;
|
} mapheader_t;
|
||||||
|
|
||||||
// level flags
|
// level flags
|
||||||
|
|
|
@ -704,7 +704,20 @@ static void F_IntroDrawScene(void)
|
||||||
V_DrawScaledPatch(deplete, 72, 0, (patch = W_CachePatchName("PEELOUT1", PU_CACHE)));
|
V_DrawScaledPatch(deplete, 72, 0, (patch = W_CachePatchName("PEELOUT1", PU_CACHE)));
|
||||||
W_UnlockCachedPatch(patch);
|
W_UnlockCachedPatch(patch);
|
||||||
}
|
}
|
||||||
V_DrawFill(0, 112, BASEVIDWIDTH, BASEVIDHEIGHT - 112, 31);
|
|
||||||
|
{ // Fixing up the black box rendering to look right in resolutions <16:10 -Red
|
||||||
|
INT32 y = 112;
|
||||||
|
INT32 h = BASEVIDHEIGHT - 112;
|
||||||
|
if (vid.height != BASEVIDHEIGHT * vid.dupy)
|
||||||
|
{
|
||||||
|
INT32 adjust = (vid.height/vid.dupy)-200;
|
||||||
|
adjust /= 2;
|
||||||
|
y += adjust;
|
||||||
|
h += adjust;
|
||||||
|
V_DrawFill(0, 0, BASEVIDWIDTH, adjust, 31); // Render a black bar on top so it keeps the "cinematic" windowboxing... I just prefer it this way. -Red
|
||||||
|
}
|
||||||
|
V_DrawFill(0, y, BASEVIDWIDTH, h, 31);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,6 +980,7 @@ static const char *credits[] = {
|
||||||
"",
|
"",
|
||||||
"\1Programming",
|
"\1Programming",
|
||||||
"\1Assistance",
|
"\1Assistance",
|
||||||
|
"Tim \"RedEnchilada\" Bordelon",
|
||||||
"Andrew \"orospakr\" Clunis",
|
"Andrew \"orospakr\" Clunis",
|
||||||
"Gregor \"Oogaland\" Dick",
|
"Gregor \"Oogaland\" Dick",
|
||||||
"Julio \"Chaos Zero 64\" Guir",
|
"Julio \"Chaos Zero 64\" Guir",
|
||||||
|
|
35
src/g_game.c
35
src/g_game.c
|
@ -963,7 +963,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
|| (player->mo && (player->mo->flags2 & MF2_TWOD))
|
|| (player->mo && (player->mo->flags2 & MF2_TWOD))
|
||||||
|| player->climbing
|
|| player->climbing
|
||||||
|| (player->pflags & PF_NIGHTSMODE)
|
|| (player->pflags & PF_NIGHTSMODE)
|
||||||
|| (player->pflags & PF_SLIDING)) // Analog
|
|| (player->pflags & PF_SLIDING)
|
||||||
|
|| (player->pflags & PF_FORCESTRAFE)) // Analog
|
||||||
forcestrafe = true;
|
forcestrafe = true;
|
||||||
if (forcestrafe) // Analog
|
if (forcestrafe) // Analog
|
||||||
{
|
{
|
||||||
|
@ -1243,7 +1244,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
|| (player->mo && (player->mo->flags2 & MF2_TWOD))
|
|| (player->mo && (player->mo->flags2 & MF2_TWOD))
|
||||||
|| player->climbing
|
|| player->climbing
|
||||||
|| (player->pflags & PF_NIGHTSMODE)
|
|| (player->pflags & PF_NIGHTSMODE)
|
||||||
|| (player->pflags & PF_SLIDING)) // Analog
|
|| (player->pflags & PF_SLIDING)
|
||||||
|
|| (player->pflags & PF_FORCESTRAFE)) // Analog
|
||||||
forcestrafe = true;
|
forcestrafe = true;
|
||||||
if (forcestrafe) // Analog
|
if (forcestrafe) // Analog
|
||||||
{
|
{
|
||||||
|
@ -2421,6 +2423,8 @@ void G_DoReborn(INT32 playernum)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
player->playerstate = PST_REBORN;
|
||||||
|
|
||||||
P_LoadThingsOnly();
|
P_LoadThingsOnly();
|
||||||
|
|
||||||
P_ClearStarPost(player->starpostnum);
|
P_ClearStarPost(player->starpostnum);
|
||||||
|
@ -2451,6 +2455,12 @@ void G_DoReborn(INT32 playernum)
|
||||||
|
|
||||||
// Starpost support
|
// Starpost support
|
||||||
G_SpawnPlayer(playernum, starpost);
|
G_SpawnPlayer(playernum, starpost);
|
||||||
|
|
||||||
|
if (botingame)
|
||||||
|
{ // Bots respawn next to their master.
|
||||||
|
players[secondarydisplayplayer].playerstate = PST_REBORN;
|
||||||
|
G_SpawnPlayer(secondarydisplayplayer, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
|
@ -5175,19 +5185,26 @@ void G_AddGhost(char *defdemoname)
|
||||||
I_Assert(mthing);
|
I_Assert(mthing);
|
||||||
{ // A bit more complex than P_SpawnPlayer because ghosts aren't solid and won't just push themselves out of the ceiling.
|
{ // A bit more complex than P_SpawnPlayer because ghosts aren't solid and won't just push themselves out of the ceiling.
|
||||||
fixed_t x,y,z;
|
fixed_t x,y,z;
|
||||||
|
sector_t *sector;
|
||||||
x = mthing->x << FRACBITS;
|
x = mthing->x << FRACBITS;
|
||||||
y = mthing->y << FRACBITS;
|
y = mthing->y << FRACBITS;
|
||||||
if (mthing->options & MTF_AMBUSH)
|
sector = R_PointInSubsector(x, y)->sector;
|
||||||
z = R_PointInSubsector(x, y)->sector->ceilingheight - mobjinfo[MT_PLAYER].height;
|
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
||||||
else if (mthing->options >> ZSHIFT)
|
|
||||||
{
|
{
|
||||||
sector_t *sector = R_PointInSubsector(x, y)->sector;
|
z = sector->ceilingheight - mobjinfo[MT_PLAYER].height;
|
||||||
z = sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS);
|
if (mthing->options >> ZSHIFT)
|
||||||
|
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
|
if (z < sector->floorheight)
|
||||||
|
z = sector->floorheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
z = sector->floorheight;
|
||||||
|
if (mthing->options >> ZSHIFT)
|
||||||
|
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
if (z > sector->ceilingheight - mobjinfo[MT_PLAYER].height)
|
if (z > sector->ceilingheight - mobjinfo[MT_PLAYER].height)
|
||||||
z = sector->ceilingheight - mobjinfo[MT_PLAYER].height;
|
z = sector->ceilingheight - mobjinfo[MT_PLAYER].height;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
z = mthing->z << FRACBITS;
|
|
||||||
gh->mo = P_SpawnMobj(x, y, z, MT_GHOST);
|
gh->mo = P_SpawnMobj(x, y, z, MT_GHOST);
|
||||||
gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT);
|
gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "hw_dll.h"
|
#include "hw_dll.h"
|
||||||
#include "hws_data.h"
|
#include "hws_data.h"
|
||||||
|
|
||||||
#if defined (SDL) || !defined (HWD)
|
#if defined (HAVE_SDL) || !defined (HWD)
|
||||||
EXPORT void HWRAPI(Shutdown) (void);
|
EXPORT void HWRAPI(Shutdown) (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (VID_X11) && !defined (SDL)
|
#if defined (VID_X11) && !defined (HAVE_SDL)
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,12 @@
|
||||||
// STANDARD DLL EXPORTS
|
// STANDARD DLL EXPORTS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
#undef VID_X11
|
#undef VID_X11
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
||||||
#ifndef SDL
|
#ifndef HAVE_SDL
|
||||||
EXPORT void HWRAPI(Shutdown) (void);
|
EXPORT void HWRAPI(Shutdown) (void);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
@ -116,7 +116,7 @@ struct hwdriver_s
|
||||||
HookXwin pfnHookXwin;
|
HookXwin pfnHookXwin;
|
||||||
GetRenderer pfnGetRenderer;
|
GetRenderer pfnGetRenderer;
|
||||||
#endif
|
#endif
|
||||||
#ifndef SDL
|
#ifndef HAVE_SDL
|
||||||
Shutdown pfnShutdown;
|
Shutdown pfnShutdown;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SHUFFLE
|
#ifdef SHUFFLE
|
||||||
|
|
|
@ -116,10 +116,6 @@ consvar_t cv_granisotropicmode = {"gr_anisotropicmode", "1", CV_CALL, granisotro
|
||||||
consvar_t cv_grcorrecttricks = {"gr_correcttricks", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grcorrecttricks = {"gr_correcttricks", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
|
|
||||||
// console variables in development
|
|
||||||
consvar_t cv_grmd2 = {"gr_md2", "Off", 0, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
static void CV_FogDensity_ONChange(void)
|
static void CV_FogDensity_ONChange(void)
|
||||||
{
|
{
|
||||||
HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value);
|
HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value);
|
||||||
|
@ -4966,7 +4962,6 @@ static void Command_GrStats_f(void)
|
||||||
//added by Hurdler: console varibale that are saved
|
//added by Hurdler: console varibale that are saved
|
||||||
void HWR_AddCommands(void)
|
void HWR_AddCommands(void)
|
||||||
{
|
{
|
||||||
CV_RegisterVar(&cv_grmd2);
|
|
||||||
CV_RegisterVar(&cv_grrounddown);
|
CV_RegisterVar(&cv_grrounddown);
|
||||||
CV_RegisterVar(&cv_grfov);
|
CV_RegisterVar(&cv_grfov);
|
||||||
CV_RegisterVar(&cv_grfogdensity);
|
CV_RegisterVar(&cv_grfogdensity);
|
||||||
|
|
|
@ -163,7 +163,7 @@ static I_Error_t I_Error_GL = NULL;
|
||||||
// : else do nothing
|
// : else do nothing
|
||||||
// Returns :
|
// Returns :
|
||||||
// -----------------+
|
// -----------------+
|
||||||
#if !(defined (SDL) && defined (STATIC3DS))
|
#if !(defined (HAVE_SDL) && defined (STATIC3DS))
|
||||||
FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
|
FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_TO_FILE
|
#ifdef DEBUG_TO_FILE
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#ifndef _R_OPENGL_H_
|
#ifndef _R_OPENGL_H_
|
||||||
#define _R_OPENGL_H_
|
#define _R_OPENGL_H_
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable : 4214 4244)
|
#pragma warning(disable : 4214 4244)
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
#undef DEBUG_TO_FILE // maybe defined in previous *.h
|
#undef DEBUG_TO_FILE // maybe defined in previous *.h
|
||||||
#define DEBUG_TO_FILE // output debugging msgs to ogllog.txt
|
#define DEBUG_TO_FILE // output debugging msgs to ogllog.txt
|
||||||
#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||||
#undef DEBUG_TO_FILE
|
#undef DEBUG_TO_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ extern PFNglGetString pglGetString;
|
||||||
|
|
||||||
extern const GLubyte *gl_extensions;
|
extern const GLubyte *gl_extensions;
|
||||||
extern RGBA_t myPaletteData[];
|
extern RGBA_t myPaletteData[];
|
||||||
#ifndef SDL
|
#ifndef HAVE_SDL
|
||||||
extern FILE *logstream;
|
extern FILE *logstream;
|
||||||
#endif
|
#endif
|
||||||
extern GLint screen_width;
|
extern GLint screen_width;
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#undef DEBUG_TO_FILE
|
#undef DEBUG_TO_FILE
|
||||||
#define DEBUG_TO_FILE
|
#define DEBUG_TO_FILE
|
||||||
|
|
||||||
#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||||
#undef DEBUG_TO_FILE
|
#undef DEBUG_TO_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ FILE *logstream = NULL;
|
||||||
#define MAXCHANNEL 1024
|
#define MAXCHANNEL 1024
|
||||||
|
|
||||||
#undef DEBUG_TO_FILE
|
#undef DEBUG_TO_FILE
|
||||||
#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||||
#define DEBUG_TO_FILE
|
#define DEBUG_TO_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1187,7 +1187,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module
|
||||||
}
|
}
|
||||||
return TRUE; // Successful DLL_PROCESS_ATTACH.
|
return TRUE; // Successful DLL_PROCESS_ATTACH.
|
||||||
}
|
}
|
||||||
#elif !defined (SDL)
|
#elif !defined (HAVE_SDL)
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
|
|
|
@ -31,7 +31,7 @@ FILE* logstream = NULL;
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifndef SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
|
#ifndef HAVE_SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
|
||||||
FILE* logstream = NULL;
|
FILE* logstream = NULL;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,7 +49,7 @@ FILE* logstream = NULL;
|
||||||
#include "../hw3dsdrv.h"
|
#include "../hw3dsdrv.h"
|
||||||
|
|
||||||
//#undef DEBUG_TO_FILE
|
//#undef DEBUG_TO_FILE
|
||||||
//#if defined ( SDL ) && !defined ( LOGMESSAGES )
|
//#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||||
#define DEBUG_TO_FILE
|
#define DEBUG_TO_FILE
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
#include "lua_hud.h"
|
#include "lua_hud.h"
|
||||||
|
#include "lua_hook.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// coords are scaled
|
// coords are scaled
|
||||||
|
@ -514,6 +515,11 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUAh_PlayerMsg(playernum, target, flags, msg))
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
// If it's a CSAY, just CECHO and be done with it.
|
// If it's a CSAY, just CECHO and be done with it.
|
||||||
if (flags & HU_CSAY)
|
if (flags & HU_CSAY)
|
||||||
{
|
{
|
||||||
|
|
|
@ -829,7 +829,7 @@ state_t states[NUMSTATES] =
|
||||||
{SPR_NULL, 0, 0, {A_Repeat}, 5*TICRATE, S_CYBRAKDEMONELECTRICBARRIER_SPARK_RANDOMCHECK, S_CYBRAKDEMONELECTRICBARRIER_REVIVE1}, // S_CYBRAKDEMONELECTRICBARRIER_SPARK_RANDOMLOOP,
|
{SPR_NULL, 0, 0, {A_Repeat}, 5*TICRATE, S_CYBRAKDEMONELECTRICBARRIER_SPARK_RANDOMCHECK, S_CYBRAKDEMONELECTRICBARRIER_REVIVE1}, // S_CYBRAKDEMONELECTRICBARRIER_SPARK_RANDOMLOOP,
|
||||||
{SPR_NULL, 0, 0, {A_CapeChase}, 0, 0, S_CYBRAKDEMONELECTRICBARRIER_REVIVE2}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE1
|
{SPR_NULL, 0, 0, {A_CapeChase}, 0, 0, S_CYBRAKDEMONELECTRICBARRIER_REVIVE2}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE1
|
||||||
{SPR_NULL, 0, 0, {A_SpawnFreshCopy}, 0, 0, S_CYBRAKDEMONELECTRICBARRIER_REVIVE3}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE2
|
{SPR_NULL, 0, 0, {A_SpawnFreshCopy}, 0, 0, S_CYBRAKDEMONELECTRICBARRIER_REVIVE3}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE2
|
||||||
{SPR_NULL, 0, TICRATE, {A_PlaySound}, sfx_s3k79, 0, S_NULL}, // S_CYBRAKDEMONELECTRICBARRIER_INIT1
|
{SPR_NULL, 0, TICRATE, {A_PlaySound}, sfx_s3k79, 0, S_NULL}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE3
|
||||||
|
|
||||||
{SPR_TARG, 0 + FF_FULLBRIGHT, 1, {A_VileFire}, sfx_s3k9d, MT_CYBRAKDEMON_TARGET_DOT, S_CYBRAKDEMONTARGETRETICULE2}, // S_CYBRAKDEMONTARGETRETICULE1
|
{SPR_TARG, 0 + FF_FULLBRIGHT, 1, {A_VileFire}, sfx_s3k9d, MT_CYBRAKDEMON_TARGET_DOT, S_CYBRAKDEMONTARGETRETICULE2}, // S_CYBRAKDEMONTARGETRETICULE1
|
||||||
{SPR_TARG, 6 + FF_FULLBRIGHT, 1, {A_VileFire}, 0, MT_CYBRAKDEMON_TARGET_DOT, S_CYBRAKDEMONTARGETRETICULE3}, // S_CYBRAKDEMONTARGETRETICULE2
|
{SPR_TARG, 6 + FF_FULLBRIGHT, 1, {A_VileFire}, 0, MT_CYBRAKDEMON_TARGET_DOT, S_CYBRAKDEMONTARGETRETICULE3}, // S_CYBRAKDEMONTARGETRETICULE2
|
||||||
|
|
|
@ -85,6 +85,13 @@ static int lib_print(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_evalMath(lua_State *L)
|
||||||
|
{
|
||||||
|
const char *word = luaL_checkstring(L, 1);
|
||||||
|
lua_pushinteger(L, LUA_EvalMath(word));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// M_RANDOM
|
// M_RANDOM
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
|
@ -461,6 +468,19 @@ static int lib_pSetScale(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pInsideANonSolidFFloor(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
|
||||||
|
//HUDSAFE
|
||||||
|
if (!mobj)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
if (!rover)
|
||||||
|
return LUA_ErrInvalid(L, "ffloor_t");
|
||||||
|
lua_pushboolean(L, P_InsideANonSolidFFloor(mobj, rover));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pCheckDeathPitCollide(lua_State *L)
|
static int lib_pCheckDeathPitCollide(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
@ -471,6 +491,32 @@ static int lib_pCheckDeathPitCollide(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pCheckSolidLava(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
|
||||||
|
//HUDSAFE
|
||||||
|
if (!mo)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
if (!rover)
|
||||||
|
return LUA_ErrInvalid(L, "ffloor_t");
|
||||||
|
lua_pushboolean(L, P_CheckSolidLava(mo, rover));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pCanRunOnWater(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
|
||||||
|
//HUDSAFE
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
if (!rover)
|
||||||
|
return LUA_ErrInvalid(L, "ffloor_t");
|
||||||
|
lua_pushboolean(L, P_CanRunOnWater(player, rover));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// P_USER
|
// P_USER
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
@ -532,9 +578,9 @@ static int lib_pDoPlayerPain(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
if (!lua_isnone(L, 2) && lua_touserdata(L, 2))
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||||
if (!lua_isnone(L, 3) && lua_touserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
inflictor = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
inflictor = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||||
P_DoPlayerPain(player, source, inflictor);
|
P_DoPlayerPain(player, source, inflictor);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -550,6 +596,16 @@ static int lib_pResetPlayer(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pIsObjectInGoop(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
//HUDSAFE
|
||||||
|
if (!mo)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
lua_pushboolean(L, P_IsObjectInGoop(mo));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pIsObjectOnGround(lua_State *L)
|
static int lib_pIsObjectOnGround(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
@ -560,6 +616,26 @@ static int lib_pIsObjectOnGround(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pInSpaceSector(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
//HUDSAFE
|
||||||
|
if (!mo)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
lua_pushboolean(L, P_InSpaceSector(mo));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pInQuicksand(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
//HUDSAFE
|
||||||
|
if (!mo)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
lua_pushboolean(L, P_InQuicksand(mo));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pSetObjectMomZ(lua_State *L)
|
static int lib_pSetObjectMomZ(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
@ -582,6 +658,16 @@ static int lib_pRestoreMusic(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pSpawnShieldOrb(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
NOHUD
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
P_SpawnShieldOrb(player);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pSpawnGhostMobj(lua_State *L)
|
static int lib_pSpawnGhostMobj(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
@ -624,6 +710,16 @@ static int lib_pResetScore(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pDoJumpShield(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
NOHUD
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
P_DoJumpShield(player);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pBlackOw(lua_State *L)
|
static int lib_pBlackOw(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
@ -746,6 +842,41 @@ static int lib_pDoJump(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pSpawnThokMobj(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
NOHUD
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
P_SpawnThokMobj(player);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pSpawnSpinMobj(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
mobjtype_t type = luaL_checkinteger(L, 2);
|
||||||
|
NOHUD
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
if (type > MT_LASTFREESLOT)
|
||||||
|
return luaL_error(L, "mobjtype_t out of bounds error!");
|
||||||
|
P_SpawnSpinMobj(player, type);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pTelekinesis(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2);
|
||||||
|
fixed_t range = (fixed_t)luaL_checkinteger(L, 3);
|
||||||
|
NOHUD
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
P_Telekinesis(player, thrust, range);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// P_MAP
|
// P_MAP
|
||||||
///////////
|
///////////
|
||||||
|
|
||||||
|
@ -877,6 +1008,18 @@ static int lib_pFloorzAtPos(lua_State *L)
|
||||||
lua_pushinteger(L, P_FloorzAtPos(x, y, z, height));
|
lua_pushinteger(L, P_FloorzAtPos(x, y, z, height));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pDoSpring(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *spring = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
mobj_t *object = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
if (!spring || !object)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_DoSpring(spring, object);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// P_INTER
|
// P_INTER
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
@ -897,9 +1040,9 @@ static int lib_pDamageMobj(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!target)
|
if (!target)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (!lua_isnone(L, 2) && lua_touserdata(L, 2))
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||||
if (!lua_isnone(L, 3) && lua_touserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||||
damage = (INT32)luaL_optinteger(L, 4, 1);
|
damage = (INT32)luaL_optinteger(L, 4, 1);
|
||||||
lua_pushboolean(L, P_DamageMobj(target, inflictor, source, damage));
|
lua_pushboolean(L, P_DamageMobj(target, inflictor, source, damage));
|
||||||
|
@ -912,9 +1055,9 @@ static int lib_pKillMobj(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!target)
|
if (!target)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (!lua_isnone(L, 2) && lua_touserdata(L, 2))
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||||
if (!lua_isnone(L, 3) && lua_touserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||||
P_KillMobj(target, inflictor, source);
|
P_KillMobj(target, inflictor, source);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -978,9 +1121,17 @@ static int lib_pPlayerFlagBurst(lua_State *L)
|
||||||
static int lib_pPlayRinglossSound(lua_State *L)
|
static int lib_pPlayRinglossSound(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
P_PlayRinglossSound(source);
|
P_PlayRinglossSound(source);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -988,9 +1139,17 @@ static int lib_pPlayRinglossSound(lua_State *L)
|
||||||
static int lib_pPlayDeathSound(lua_State *L)
|
static int lib_pPlayDeathSound(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
P_PlayDeathSound(source);
|
P_PlayDeathSound(source);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -998,9 +1157,17 @@ static int lib_pPlayDeathSound(lua_State *L)
|
||||||
static int lib_pPlayVictorySound(lua_State *L)
|
static int lib_pPlayVictorySound(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
P_PlayVictorySound(source);
|
P_PlayVictorySound(source);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1110,7 +1277,13 @@ static int lib_pFindSpecialLineFromTag(lua_State *L)
|
||||||
static int lib_pSwitchWeather(lua_State *L)
|
static int lib_pSwitchWeather(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 weathernum = (INT32)luaL_checkinteger(L, 1);
|
INT32 weathernum = (INT32)luaL_checkinteger(L, 1);
|
||||||
|
player_t *user = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) // if a player, setup weather for only the player, otherwise setup weather for all players
|
||||||
|
user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
if (!user) // global
|
||||||
|
globalweather = weathernum;
|
||||||
|
if (!user || P_IsLocalPlayer(user))
|
||||||
P_SwitchWeather(weathernum);
|
P_SwitchWeather(weathernum);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1159,12 +1332,27 @@ static int lib_pThingOnSpecial3DFloor(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pIsFlagAtBase(lua_State *L)
|
||||||
|
{
|
||||||
|
mobjtype_t flag = luaL_checkinteger(L, 1);
|
||||||
|
NOHUD
|
||||||
|
if (flag > MT_LASTFREESLOT)
|
||||||
|
return luaL_error(L, "mobjtype_t out of bounds error!");
|
||||||
|
lua_pushboolean(L, P_IsFlagAtBase(flag));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pSetupLevelSky(lua_State *L)
|
static int lib_pSetupLevelSky(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 skynum = (INT32)luaL_checkinteger(L, 1);
|
INT32 skynum = (INT32)luaL_checkinteger(L, 1);
|
||||||
boolean global = lua_optboolean(L, 2);
|
player_t *user = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
P_SetupLevelSky(skynum, global);
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) // if a player, setup sky for only the player, otherwise setup sky for all players
|
||||||
|
user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
if (!user) // global
|
||||||
|
P_SetupLevelSky(skynum, true);
|
||||||
|
else if (P_IsLocalPlayer(user))
|
||||||
|
P_SetupLevelSky(skynum, false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1279,6 +1467,19 @@ static int lib_pStartQuake(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_evCrumbleChain(lua_State *L)
|
||||||
|
{
|
||||||
|
sector_t *sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||||
|
ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
|
||||||
|
NOHUD
|
||||||
|
if (!sec)
|
||||||
|
return LUA_ErrInvalid(L, "sector_t");
|
||||||
|
if (!rover)
|
||||||
|
return LUA_ErrInvalid(L, "ffloor_t");
|
||||||
|
EV_CrumbleChain(sec, rover);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// R_DEFS
|
// R_DEFS
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
@ -1356,6 +1557,30 @@ static int lib_rFrame2Char(lua_State *L)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// R_SetPlayerSkin technically doesn't exist either, although it's basically just SetPlayerSkin and SetPlayerSkinByNum handled in one place for convenience
|
||||||
|
static int lib_rSetPlayerSkin(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
NOHUD
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
if (lua_isnoneornil(L, 2))
|
||||||
|
return luaL_error(L, "argument #2 not given (expected number or string)");
|
||||||
|
else if (lua_type(L, 2) == LUA_TNUMBER) // skin number
|
||||||
|
{
|
||||||
|
INT32 i = luaL_checkinteger(L, 2);
|
||||||
|
if (i < 0 || i >= MAXSKINS)
|
||||||
|
return luaL_error(L, "argument #2 cannot exceed MAXSKINS");
|
||||||
|
SetPlayerSkinByNum(player-players, i);
|
||||||
|
}
|
||||||
|
else // skin name
|
||||||
|
{
|
||||||
|
const char *skinname = luaL_checkstring(L, 2);
|
||||||
|
SetPlayerSkin(player-players, skinname);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// S_SOUND
|
// S_SOUND
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
@ -1363,6 +1588,7 @@ static int lib_sStartSound(lua_State *L)
|
||||||
{
|
{
|
||||||
const void *origin = NULL;
|
const void *origin = NULL;
|
||||||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!lua_isnil(L, 1))
|
if (!lua_isnil(L, 1))
|
||||||
{
|
{
|
||||||
|
@ -1370,6 +1596,13 @@ static int lib_sStartSound(lua_State *L)
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
}
|
}
|
||||||
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
S_StartSound(origin, sound_id);
|
S_StartSound(origin, sound_id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1379,6 +1612,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||||
const void *origin = NULL;
|
const void *origin = NULL;
|
||||||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||||
INT32 volume = (INT32)luaL_checkinteger(L, 3);
|
INT32 volume = (INT32)luaL_checkinteger(L, 3);
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!lua_isnil(L, 1))
|
if (!lua_isnil(L, 1))
|
||||||
{
|
{
|
||||||
|
@ -1386,6 +1620,13 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
}
|
}
|
||||||
|
if (!lua_isnone(L, 4) && lua_isuserdata(L, 4))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1404,7 +1645,15 @@ static int lib_sChangeMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT32 music_num = (UINT32)luaL_checkinteger(L, 1);
|
UINT32 music_num = (UINT32)luaL_checkinteger(L, 1);
|
||||||
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
S_ChangeMusic(music_num, looping);
|
S_ChangeMusic(music_num, looping);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1413,14 +1662,32 @@ static int lib_sSpeedMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t fixedspeed = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t fixedspeed = (fixed_t)luaL_checkinteger(L, 1);
|
||||||
float speed = FIXED_TO_FLOAT(fixedspeed);
|
float speed = FIXED_TO_FLOAT(fixedspeed);
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
lua_pushboolean(L, S_SpeedMusic(speed));
|
lua_pushboolean(L, S_SpeedMusic(speed));
|
||||||
|
else
|
||||||
|
lua_pushboolean(L, false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_sStopMusic(lua_State *L)
|
static int lib_sStopMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||||
|
{
|
||||||
|
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
}
|
||||||
|
if (!player || P_IsLocalPlayer(player))
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1575,6 +1842,7 @@ static int lib_gTicsToMilliseconds(lua_State *L)
|
||||||
|
|
||||||
static luaL_Reg lib[] = {
|
static luaL_Reg lib[] = {
|
||||||
{"print", lib_print},
|
{"print", lib_print},
|
||||||
|
{"EvalMath", lib_evalMath,},
|
||||||
|
|
||||||
// m_random
|
// m_random
|
||||||
{"P_Random",lib_pRandom},
|
{"P_Random",lib_pRandom},
|
||||||
|
@ -1614,7 +1882,10 @@ static luaL_Reg lib[] = {
|
||||||
{"P_BossTargetPlayer",lib_pBossTargetPlayer},
|
{"P_BossTargetPlayer",lib_pBossTargetPlayer},
|
||||||
{"P_SupermanLook4Players",lib_pSupermanLook4Players},
|
{"P_SupermanLook4Players",lib_pSupermanLook4Players},
|
||||||
{"P_SetScale",lib_pSetScale},
|
{"P_SetScale",lib_pSetScale},
|
||||||
|
{"P_InsideANonSolidFFloor",lib_pInsideANonSolidFFloor},
|
||||||
{"P_CheckDeathPitCollide",lib_pCheckDeathPitCollide},
|
{"P_CheckDeathPitCollide",lib_pCheckDeathPitCollide},
|
||||||
|
{"P_CheckSolidLava",lib_pCheckSolidLava},
|
||||||
|
{"P_CanRunOnWater",lib_pCanRunOnWater},
|
||||||
|
|
||||||
// p_user
|
// p_user
|
||||||
{"P_GetPlayerHeight",lib_pGetPlayerHeight},
|
{"P_GetPlayerHeight",lib_pGetPlayerHeight},
|
||||||
|
@ -1624,13 +1895,18 @@ static luaL_Reg lib[] = {
|
||||||
{"P_PlayerInPain",lib_pPlayerInPain},
|
{"P_PlayerInPain",lib_pPlayerInPain},
|
||||||
{"P_DoPlayerPain",lib_pDoPlayerPain},
|
{"P_DoPlayerPain",lib_pDoPlayerPain},
|
||||||
{"P_ResetPlayer",lib_pResetPlayer},
|
{"P_ResetPlayer",lib_pResetPlayer},
|
||||||
|
{"P_IsObjectInGoop",lib_pIsObjectInGoop},
|
||||||
{"P_IsObjectOnGround",lib_pIsObjectOnGround},
|
{"P_IsObjectOnGround",lib_pIsObjectOnGround},
|
||||||
|
{"P_InSpaceSector",lib_pInSpaceSector},
|
||||||
|
{"P_InQuicksand",lib_pInQuicksand},
|
||||||
{"P_SetObjectMomZ",lib_pSetObjectMomZ},
|
{"P_SetObjectMomZ",lib_pSetObjectMomZ},
|
||||||
{"P_RestoreMusic",lib_pRestoreMusic},
|
{"P_RestoreMusic",lib_pRestoreMusic},
|
||||||
|
{"P_SpawnShieldOrb",lib_pSpawnShieldOrb},
|
||||||
{"P_SpawnGhostMobj",lib_pSpawnGhostMobj},
|
{"P_SpawnGhostMobj",lib_pSpawnGhostMobj},
|
||||||
{"P_GivePlayerRings",lib_pGivePlayerRings},
|
{"P_GivePlayerRings",lib_pGivePlayerRings},
|
||||||
{"P_GivePlayerLives",lib_pGivePlayerLives},
|
{"P_GivePlayerLives",lib_pGivePlayerLives},
|
||||||
{"P_ResetScore",lib_pResetScore},
|
{"P_ResetScore",lib_pResetScore},
|
||||||
|
{"P_DoJumpShield",lib_pDoJumpShield},
|
||||||
{"P_BlackOw",lib_pBlackOw},
|
{"P_BlackOw",lib_pBlackOw},
|
||||||
{"P_ElementalFireTrail",lib_pElementalFireTrail},
|
{"P_ElementalFireTrail",lib_pElementalFireTrail},
|
||||||
{"P_DoPlayerExit",lib_pDoPlayerExit},
|
{"P_DoPlayerExit",lib_pDoPlayerExit},
|
||||||
|
@ -1642,6 +1918,9 @@ static luaL_Reg lib[] = {
|
||||||
{"P_HomingAttack",lib_pHomingAttack},
|
{"P_HomingAttack",lib_pHomingAttack},
|
||||||
{"P_SuperReady",lib_pSuperReady},
|
{"P_SuperReady",lib_pSuperReady},
|
||||||
{"P_DoJump",lib_pDoJump},
|
{"P_DoJump",lib_pDoJump},
|
||||||
|
{"P_SpawnThokMobj",lib_pSpawnThokMobj},
|
||||||
|
{"P_SpawnSpinMobj",lib_pSpawnSpinMobj},
|
||||||
|
{"P_Telekinesis",lib_pTelekinesis},
|
||||||
|
|
||||||
// p_map
|
// p_map
|
||||||
{"P_CheckPosition",lib_pCheckPosition},
|
{"P_CheckPosition",lib_pCheckPosition},
|
||||||
|
@ -1654,6 +1933,7 @@ static luaL_Reg lib[] = {
|
||||||
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
|
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
|
||||||
{"P_RadiusAttack",lib_pRadiusAttack},
|
{"P_RadiusAttack",lib_pRadiusAttack},
|
||||||
{"P_FloorzAtPos",lib_pFloorzAtPos},
|
{"P_FloorzAtPos",lib_pFloorzAtPos},
|
||||||
|
{"P_DoSpring",lib_pDoSpring},
|
||||||
|
|
||||||
// p_inter
|
// p_inter
|
||||||
{"P_RemoveShield",lib_pRemoveShield},
|
{"P_RemoveShield",lib_pRemoveShield},
|
||||||
|
@ -1683,9 +1963,11 @@ static luaL_Reg lib[] = {
|
||||||
{"P_SpawnLightningFlash",lib_pSpawnLightningFlash},
|
{"P_SpawnLightningFlash",lib_pSpawnLightningFlash},
|
||||||
{"P_FadeLight",lib_pFadeLight},
|
{"P_FadeLight",lib_pFadeLight},
|
||||||
{"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor},
|
{"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor},
|
||||||
|
{"P_IsFlagAtBase",lib_pIsFlagAtBase},
|
||||||
{"P_SetupLevelSky",lib_pSetupLevelSky},
|
{"P_SetupLevelSky",lib_pSetupLevelSky},
|
||||||
{"P_SetSkyboxMobj",lib_pSetSkyboxMobj},
|
{"P_SetSkyboxMobj",lib_pSetSkyboxMobj},
|
||||||
{"P_StartQuake",lib_pStartQuake},
|
{"P_StartQuake",lib_pStartQuake},
|
||||||
|
{"EV_CrumbleChain",lib_evCrumbleChain},
|
||||||
|
|
||||||
// r_defs
|
// r_defs
|
||||||
{"R_PointToAngle",lib_rPointToAngle},
|
{"R_PointToAngle",lib_rPointToAngle},
|
||||||
|
@ -1697,6 +1979,7 @@ static luaL_Reg lib[] = {
|
||||||
// r_things (sprite)
|
// r_things (sprite)
|
||||||
{"R_Char2Frame",lib_rChar2Frame},
|
{"R_Char2Frame",lib_rChar2Frame},
|
||||||
{"R_Frame2Char",lib_rFrame2Char},
|
{"R_Frame2Char",lib_rFrame2Char},
|
||||||
|
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
|
||||||
|
|
||||||
// s_sound
|
// s_sound
|
||||||
{"S_StartSound",lib_sStartSound},
|
{"S_StartSound",lib_sStartSound},
|
||||||
|
|
|
@ -33,9 +33,15 @@ enum hook {
|
||||||
hook_MobjDeath,
|
hook_MobjDeath,
|
||||||
hook_BossDeath,
|
hook_BossDeath,
|
||||||
hook_MobjRemoved,
|
hook_MobjRemoved,
|
||||||
|
hook_JumpSpecial,
|
||||||
|
hook_AbilitySpecial,
|
||||||
|
hook_SpinSpecial,
|
||||||
|
hook_JumpSpinSpecial,
|
||||||
hook_BotTiccmd,
|
hook_BotTiccmd,
|
||||||
hook_BotAI,
|
hook_BotAI,
|
||||||
hook_LinedefExecute,
|
hook_LinedefExecute,
|
||||||
|
hook_PlayerMsg,
|
||||||
|
hook_DeathMsg,
|
||||||
|
|
||||||
hook_MAX // last hook
|
hook_MAX // last hook
|
||||||
};
|
};
|
||||||
|
@ -46,6 +52,7 @@ void LUAh_MapLoad(void); // Hook for map load
|
||||||
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
|
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
|
||||||
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
||||||
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
||||||
|
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
|
||||||
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
||||||
UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (thing) mobj type
|
UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (thing) mobj type
|
||||||
UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type
|
UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type
|
||||||
|
@ -58,8 +65,14 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
||||||
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type
|
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type
|
||||||
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
|
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
|
||||||
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
|
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
|
||||||
|
#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping)
|
||||||
|
#define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping)
|
||||||
|
#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect)
|
||||||
|
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
|
||||||
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
||||||
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
||||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo); // Hook for linedef executors
|
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo); // Hook for linedef executors
|
||||||
|
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
|
||||||
|
boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "p_mobj.h"
|
#include "p_mobj.h"
|
||||||
|
#include "g_game.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "b_bot.h"
|
#include "b_bot.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
@ -43,9 +44,15 @@ const char *const hookNames[hook_MAX+1] = {
|
||||||
"MobjDeath",
|
"MobjDeath",
|
||||||
"BossDeath",
|
"BossDeath",
|
||||||
"MobjRemoved",
|
"MobjRemoved",
|
||||||
|
"JumpSpecial",
|
||||||
|
"AbilitySpecial",
|
||||||
|
"SpinSpecial",
|
||||||
|
"JumpSpinSpecial",
|
||||||
"BotTiccmd",
|
"BotTiccmd",
|
||||||
"BotAI",
|
"BotAI",
|
||||||
"LinedefExecute",
|
"LinedefExecute",
|
||||||
|
"PlayerMsg",
|
||||||
|
"HurtMsg",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -319,6 +326,42 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which)
|
||||||
return hooked;
|
return hooked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean LUAh_PlayerHook(player_t *plr, enum hook which)
|
||||||
|
{
|
||||||
|
boolean hooked = false;
|
||||||
|
if (!gL || !(hooksAvailable[which/8] & (1<<(which%8))))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// clear the stack (just in case)
|
||||||
|
lua_pop(gL, -1);
|
||||||
|
|
||||||
|
// hook table
|
||||||
|
lua_getfield(gL, LUA_REGISTRYINDEX, "hook");
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
lua_rawgeti(gL, -1, which);
|
||||||
|
lua_remove(gL, -2);
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
|
||||||
|
LUA_PushUserdata(gL, plr, META_PLAYER);
|
||||||
|
|
||||||
|
lua_pushnil(gL);
|
||||||
|
while (lua_next(gL, -3) != 0) {
|
||||||
|
lua_pushvalue(gL, -3); // player
|
||||||
|
if (lua_pcall(gL, 1, 1, 0)) { // pops hook function, player, pushes 1 return result
|
||||||
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||||
|
lua_pop(gL, 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (lua_toboolean(gL, -1)) // if return true,
|
||||||
|
hooked = true; // override vanilla behavior
|
||||||
|
lua_pop(gL, 1); // pop return value
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pop(gL, -1);
|
||||||
|
lua_gc(gL, LUA_GCSTEP, 1);
|
||||||
|
return hooked;
|
||||||
|
}
|
||||||
|
|
||||||
// Hook for map change (before load)
|
// Hook for map change (before load)
|
||||||
void LUAh_MapChange(void)
|
void LUAh_MapChange(void)
|
||||||
{
|
{
|
||||||
|
@ -862,4 +905,99 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hook for PlayerMsg -Red
|
||||||
|
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg)
|
||||||
|
{
|
||||||
|
boolean handled = false;
|
||||||
|
|
||||||
|
if (!gL || !(hooksAvailable[hook_PlayerMsg/8] & (1<<(hook_PlayerMsg%8))))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
lua_getfield(gL, LUA_REGISTRYINDEX, "hook");
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
lua_rawgeti(gL, -1, hook_PlayerMsg);
|
||||||
|
lua_remove(gL, -2);
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
|
||||||
|
LUA_PushUserdata(gL, &players[source], META_PLAYER); // Source player
|
||||||
|
|
||||||
|
if (flags & 2 /*HU_CSAY*/) { // csay TODO: make HU_CSAY accessible outside hu_stuff.c
|
||||||
|
lua_pushinteger(gL, 3); // type
|
||||||
|
lua_pushnil(gL); // target
|
||||||
|
} else if (target == -1) { // sayteam
|
||||||
|
lua_pushinteger(gL, 1); // type
|
||||||
|
lua_pushnil(gL); // target
|
||||||
|
} else if (target == 0) { // say
|
||||||
|
lua_pushinteger(gL, 0); // type
|
||||||
|
lua_pushnil(gL); // target
|
||||||
|
} else { // sayto
|
||||||
|
lua_pushinteger(gL, 2); // type
|
||||||
|
LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pushstring(gL, msg); // msg
|
||||||
|
|
||||||
|
lua_pushnil(gL);
|
||||||
|
|
||||||
|
while (lua_next(gL, -6)) {
|
||||||
|
lua_pushvalue(gL, -6); // source
|
||||||
|
lua_pushvalue(gL, -6); // type
|
||||||
|
lua_pushvalue(gL, -6); // target
|
||||||
|
lua_pushvalue(gL, -6); // msg
|
||||||
|
if (lua_pcall(gL, 4, 1, 0)) {
|
||||||
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||||
|
lua_pop(gL, 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (lua_toboolean(gL, -1))
|
||||||
|
handled = true;
|
||||||
|
lua_pop(gL, 1); // pop return value
|
||||||
|
}
|
||||||
|
lua_pop(gL, 4); // pop arguments and mobjtype table
|
||||||
|
|
||||||
|
lua_gc(gL, LUA_GCSTEP, 1);
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook for hurt messages -Red
|
||||||
|
// The internal name is DeathMsg, but the API name is "HurtMsg". Keep that in mind. (Should this be fixed at some point?)
|
||||||
|
// @TODO This hook should be fixed to take mobj type at the addHook parameter to compare to inflictor. (I couldn't get this to work without crashing)
|
||||||
|
boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||||
|
{
|
||||||
|
boolean handled = false;
|
||||||
|
|
||||||
|
if (!gL || !(hooksAvailable[hook_DeathMsg/8] & (1<<(hook_DeathMsg%8))))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
lua_getfield(gL, LUA_REGISTRYINDEX, "hook");
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
lua_rawgeti(gL, -1, hook_DeathMsg);
|
||||||
|
lua_remove(gL, -2);
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
|
||||||
|
LUA_PushUserdata(gL, player, META_PLAYER); // Player
|
||||||
|
LUA_PushUserdata(gL, inflictor, META_MOBJ); // Inflictor
|
||||||
|
LUA_PushUserdata(gL, source, META_MOBJ); // Source
|
||||||
|
|
||||||
|
lua_pushnil(gL);
|
||||||
|
|
||||||
|
while (lua_next(gL, -5)) {
|
||||||
|
lua_pushvalue(gL, -5); // player
|
||||||
|
lua_pushvalue(gL, -5); // inflictor
|
||||||
|
lua_pushvalue(gL, -5); // source
|
||||||
|
if (lua_pcall(gL, 3, 1, 0)) {
|
||||||
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||||
|
lua_pop(gL, 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (lua_toboolean(gL, -1))
|
||||||
|
handled = true;
|
||||||
|
lua_pop(gL, 1); // pop return value
|
||||||
|
}
|
||||||
|
lua_pop(gL, 3); // pop arguments and mobjtype table
|
||||||
|
|
||||||
|
lua_gc(gL, LUA_GCSTEP, 1);
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
218
src/lua_hudlib.c
218
src/lua_hudlib.c
|
@ -15,6 +15,7 @@
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
#include "st_stuff.h" // hudinfo[]
|
#include "st_stuff.h" // hudinfo[]
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
#include "p_local.h" // camera_t
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
@ -23,6 +24,8 @@
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
#include "lua_hud.h"
|
#include "lua_hud.h"
|
||||||
|
|
||||||
|
#define HUDONLY if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
||||||
|
|
||||||
boolean hud_running = false;
|
boolean hud_running = false;
|
||||||
static UINT8 hud_enabled[(hud_MAX/8)+1];
|
static UINT8 hud_enabled[(hud_MAX/8)+1];
|
||||||
|
|
||||||
|
@ -85,17 +88,79 @@ static const char *const hudhook_opt[] = {
|
||||||
"scores",
|
"scores",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
// alignment types for v.drawString
|
||||||
enum align {
|
enum align {
|
||||||
align_left = 0,
|
align_left = 0,
|
||||||
align_center,
|
align_center,
|
||||||
align_right,
|
align_right,
|
||||||
align_fixed
|
align_fixed,
|
||||||
|
align_small,
|
||||||
|
align_smallright,
|
||||||
|
align_thin,
|
||||||
|
align_thinright
|
||||||
};
|
};
|
||||||
static const char *const align_opt[] = {
|
static const char *const align_opt[] = {
|
||||||
"left",
|
"left",
|
||||||
"center",
|
"center",
|
||||||
"right",
|
"right",
|
||||||
"fixed",
|
"fixed",
|
||||||
|
"small",
|
||||||
|
"small-right",
|
||||||
|
"thin",
|
||||||
|
"thin-right",
|
||||||
|
NULL};
|
||||||
|
|
||||||
|
// width types for v.stringWidth
|
||||||
|
enum widtht {
|
||||||
|
widtht_normal = 0,
|
||||||
|
widtht_small,
|
||||||
|
widtht_thin
|
||||||
|
};
|
||||||
|
static const char *const widtht_opt[] = {
|
||||||
|
"normal",
|
||||||
|
"small",
|
||||||
|
"thin",
|
||||||
|
NULL};
|
||||||
|
|
||||||
|
enum cameraf {
|
||||||
|
camera_chase = 0,
|
||||||
|
camera_aiming,
|
||||||
|
camera_viewheight,
|
||||||
|
camera_startangle,
|
||||||
|
camera_x,
|
||||||
|
camera_y,
|
||||||
|
camera_z,
|
||||||
|
camera_angle,
|
||||||
|
camera_subsector,
|
||||||
|
camera_floorz,
|
||||||
|
camera_ceilingz,
|
||||||
|
camera_radius,
|
||||||
|
camera_height,
|
||||||
|
camera_relativex,
|
||||||
|
camera_momx,
|
||||||
|
camera_momy,
|
||||||
|
camera_momz
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const char *const camera_opt[] = {
|
||||||
|
"chase",
|
||||||
|
"aiming",
|
||||||
|
"viewheight",
|
||||||
|
"startangle",
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"z",
|
||||||
|
"angle",
|
||||||
|
"subsector",
|
||||||
|
"floorz",
|
||||||
|
"ceilingz",
|
||||||
|
"radius",
|
||||||
|
"height",
|
||||||
|
"relativex",
|
||||||
|
"momx",
|
||||||
|
"momy",
|
||||||
|
"momz",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
static int lib_getHudInfo(lua_State *L)
|
static int lib_getHudInfo(lua_State *L)
|
||||||
|
@ -193,24 +258,85 @@ static int patch_set(lua_State *L)
|
||||||
return luaL_error(L, LUA_QL("patch_t") " struct cannot be edited by Lua.");
|
return luaL_error(L, LUA_QL("patch_t") " struct cannot be edited by Lua.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int camera_get(lua_State *L)
|
||||||
|
{
|
||||||
|
camera_t *cam = *((camera_t **)luaL_checkudata(L, 1, META_CAMERA));
|
||||||
|
enum cameraf field = luaL_checkoption(L, 2, NULL, camera_opt);
|
||||||
|
|
||||||
|
// cameras should always be valid unless I'm a nutter
|
||||||
|
I_Assert(cam != NULL);
|
||||||
|
|
||||||
|
switch (field)
|
||||||
|
{
|
||||||
|
case camera_chase:
|
||||||
|
lua_pushboolean(L, cam->chase);
|
||||||
|
break;
|
||||||
|
case camera_aiming:
|
||||||
|
lua_pushinteger(L, cam->aiming);
|
||||||
|
break;
|
||||||
|
case camera_viewheight:
|
||||||
|
lua_pushinteger(L, cam->viewheight);
|
||||||
|
break;
|
||||||
|
case camera_startangle:
|
||||||
|
lua_pushinteger(L, cam->startangle);
|
||||||
|
break;
|
||||||
|
case camera_x:
|
||||||
|
lua_pushinteger(L, cam->x);
|
||||||
|
break;
|
||||||
|
case camera_y:
|
||||||
|
lua_pushinteger(L, cam->y);
|
||||||
|
break;
|
||||||
|
case camera_z:
|
||||||
|
lua_pushinteger(L, cam->z);
|
||||||
|
break;
|
||||||
|
case camera_angle:
|
||||||
|
lua_pushinteger(L, cam->angle);
|
||||||
|
break;
|
||||||
|
case camera_subsector:
|
||||||
|
LUA_PushUserdata(L, cam->subsector, META_SUBSECTOR);
|
||||||
|
break;
|
||||||
|
case camera_floorz:
|
||||||
|
lua_pushinteger(L, cam->floorz);
|
||||||
|
break;
|
||||||
|
case camera_ceilingz:
|
||||||
|
lua_pushinteger(L, cam->ceilingz);
|
||||||
|
break;
|
||||||
|
case camera_radius:
|
||||||
|
lua_pushinteger(L, cam->radius);
|
||||||
|
break;
|
||||||
|
case camera_height:
|
||||||
|
lua_pushinteger(L, cam->height);
|
||||||
|
break;
|
||||||
|
case camera_relativex:
|
||||||
|
lua_pushinteger(L, cam->relativex);
|
||||||
|
break;
|
||||||
|
case camera_momx:
|
||||||
|
lua_pushinteger(L, cam->momx);
|
||||||
|
break;
|
||||||
|
case camera_momy:
|
||||||
|
lua_pushinteger(L, cam->momy);
|
||||||
|
break;
|
||||||
|
case camera_momz:
|
||||||
|
lua_pushinteger(L, cam->momz);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// lib_draw
|
// lib_draw
|
||||||
//
|
//
|
||||||
|
|
||||||
static int libd_patchExists(lua_State *L)
|
static int libd_patchExists(lua_State *L)
|
||||||
{
|
{
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
lua_pushboolean(L, W_LumpExists(luaL_checkstring(L, 1)));
|
lua_pushboolean(L, W_LumpExists(luaL_checkstring(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int libd_cachePatch(lua_State *L)
|
static int libd_cachePatch(lua_State *L)
|
||||||
{
|
{
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_STATIC), META_PATCH);
|
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_STATIC), META_PATCH);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -221,9 +347,7 @@ static int libd_draw(lua_State *L)
|
||||||
patch_t *patch;
|
patch_t *patch;
|
||||||
const UINT8 *colormap = NULL;
|
const UINT8 *colormap = NULL;
|
||||||
|
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
x = luaL_checkinteger(L, 1);
|
x = luaL_checkinteger(L, 1);
|
||||||
y = luaL_checkinteger(L, 2);
|
y = luaL_checkinteger(L, 2);
|
||||||
patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH));
|
patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH));
|
||||||
|
@ -244,9 +368,7 @@ static int libd_drawScaled(lua_State *L)
|
||||||
patch_t *patch;
|
patch_t *patch;
|
||||||
const UINT8 *colormap = NULL;
|
const UINT8 *colormap = NULL;
|
||||||
|
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
x = luaL_checkinteger(L, 1);
|
x = luaL_checkinteger(L, 1);
|
||||||
y = luaL_checkinteger(L, 2);
|
y = luaL_checkinteger(L, 2);
|
||||||
scale = luaL_checkinteger(L, 3);
|
scale = luaL_checkinteger(L, 3);
|
||||||
|
@ -264,9 +386,7 @@ static int libd_drawScaled(lua_State *L)
|
||||||
static int libd_drawNum(lua_State *L)
|
static int libd_drawNum(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 x, y, flags, num;
|
INT32 x, y, flags, num;
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
x = luaL_checkinteger(L, 1);
|
x = luaL_checkinteger(L, 1);
|
||||||
y = luaL_checkinteger(L, 2);
|
y = luaL_checkinteger(L, 2);
|
||||||
num = luaL_checkinteger(L, 3);
|
num = luaL_checkinteger(L, 3);
|
||||||
|
@ -280,9 +400,7 @@ static int libd_drawNum(lua_State *L)
|
||||||
static int libd_drawPaddedNum(lua_State *L)
|
static int libd_drawPaddedNum(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 x, y, flags, num, digits;
|
INT32 x, y, flags, num, digits;
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
x = luaL_checkinteger(L, 1);
|
x = luaL_checkinteger(L, 1);
|
||||||
y = luaL_checkinteger(L, 2);
|
y = luaL_checkinteger(L, 2);
|
||||||
num = abs(luaL_checkinteger(L, 3));
|
num = abs(luaL_checkinteger(L, 3));
|
||||||
|
@ -302,9 +420,7 @@ static int libd_drawFill(lua_State *L)
|
||||||
INT32 h = luaL_optinteger(L, 4, BASEVIDHEIGHT);
|
INT32 h = luaL_optinteger(L, 4, BASEVIDHEIGHT);
|
||||||
INT32 c = luaL_optinteger(L, 5, 31);
|
INT32 c = luaL_optinteger(L, 5, 31);
|
||||||
|
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
V_DrawFill(x, y, w, h, c);
|
V_DrawFill(x, y, w, h, c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -319,11 +435,10 @@ static int libd_drawString(lua_State *L)
|
||||||
|
|
||||||
flags &= ~V_PARAMMASK; // Don't let crashes happen.
|
flags &= ~V_PARAMMASK; // Don't let crashes happen.
|
||||||
|
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
|
||||||
|
|
||||||
switch(align)
|
switch(align)
|
||||||
{
|
{
|
||||||
|
// hu_font
|
||||||
case align_left:
|
case align_left:
|
||||||
V_DrawString(x, y, flags, str);
|
V_DrawString(x, y, flags, str);
|
||||||
break;
|
break;
|
||||||
|
@ -336,6 +451,20 @@ static int libd_drawString(lua_State *L)
|
||||||
case align_fixed:
|
case align_fixed:
|
||||||
V_DrawStringAtFixed(x, y, flags, str);
|
V_DrawStringAtFixed(x, y, flags, str);
|
||||||
break;
|
break;
|
||||||
|
// hu_font, 0.5x scale
|
||||||
|
case align_small:
|
||||||
|
V_DrawSmallString(x, y, flags, str);
|
||||||
|
break;
|
||||||
|
case align_smallright:
|
||||||
|
V_DrawRightAlignedSmallString(x, y, flags, str);
|
||||||
|
break;
|
||||||
|
// tny_font
|
||||||
|
case align_thin:
|
||||||
|
V_DrawThinString(x, y, flags, str);
|
||||||
|
break;
|
||||||
|
case align_thinright:
|
||||||
|
V_DrawRightAlignedThinString(x, y, flags, str);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -344,11 +473,21 @@ static int libd_stringWidth(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *str = luaL_checkstring(L, 1);
|
const char *str = luaL_checkstring(L, 1);
|
||||||
INT32 flags = luaL_optinteger(L, 2, V_ALLOWLOWERCASE);
|
INT32 flags = luaL_optinteger(L, 2, V_ALLOWLOWERCASE);
|
||||||
|
enum widtht widtht = luaL_checkoption(L, 3, "normal", widtht_opt);
|
||||||
|
|
||||||
if (!hud_running)
|
HUDONLY
|
||||||
return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
switch(widtht)
|
||||||
|
{
|
||||||
|
case widtht_normal: // hu_font
|
||||||
lua_pushinteger(L, V_StringWidth(str, flags));
|
lua_pushinteger(L, V_StringWidth(str, flags));
|
||||||
|
break;
|
||||||
|
case widtht_small: // hu_font, 0.5x scale
|
||||||
|
lua_pushinteger(L, V_SmallStringWidth(str, flags));
|
||||||
|
break;
|
||||||
|
case widtht_thin: // tny_font
|
||||||
|
lua_pushinteger(L, V_ThinStringWidth(str, flags));
|
||||||
|
break;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,6 +601,11 @@ int LUA_HudLib(lua_State *L)
|
||||||
lua_setfield(L, -2, "__newindex");
|
lua_setfield(L, -2, "__newindex");
|
||||||
lua_pop(L,1);
|
lua_pop(L,1);
|
||||||
|
|
||||||
|
luaL_newmetatable(L, META_CAMERA);
|
||||||
|
lua_pushcfunction(L, camera_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
lua_pop(L,1);
|
||||||
|
|
||||||
luaL_register(L, "hud", lib_hud);
|
luaL_register(L, "hud", lib_hud);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +618,7 @@ boolean LUA_HudEnabled(enum hud option)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook for HUD rendering
|
// Hook for HUD rendering
|
||||||
void LUAh_GameHUD(player_t *stplyr)
|
void LUAh_GameHUD(player_t *stplayr)
|
||||||
{
|
{
|
||||||
if (!gL || !(hudAvailable & (1<<hudhook_game)))
|
if (!gL || !(hudAvailable & (1<<hudhook_game)))
|
||||||
return;
|
return;
|
||||||
|
@ -490,13 +634,19 @@ void LUAh_GameHUD(player_t *stplyr)
|
||||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||||
I_Assert(lua_istable(gL, -1));
|
I_Assert(lua_istable(gL, -1));
|
||||||
lua_remove(gL, -3); // pop HUD
|
lua_remove(gL, -3); // pop HUD
|
||||||
LUA_PushUserdata(gL, stplyr, META_PLAYER);
|
LUA_PushUserdata(gL, stplayr, META_PLAYER);
|
||||||
|
|
||||||
|
if (splitscreen && stplayr == &players[secondarydisplayplayer])
|
||||||
|
LUA_PushUserdata(gL, &camera2, META_CAMERA);
|
||||||
|
else
|
||||||
|
LUA_PushUserdata(gL, &camera, META_CAMERA);
|
||||||
|
|
||||||
lua_pushnil(gL);
|
lua_pushnil(gL);
|
||||||
while (lua_next(gL, -4) != 0) {
|
while (lua_next(gL, -5) != 0) {
|
||||||
lua_pushvalue(gL, -4); // graphics library (HUD[1])
|
lua_pushvalue(gL, -5); // graphics library (HUD[1])
|
||||||
lua_pushvalue(gL, -4); // stplyr
|
lua_pushvalue(gL, -5); // stplayr
|
||||||
LUA_Call(gL, 2);
|
lua_pushvalue(gL, -5); // camera
|
||||||
|
LUA_Call(gL, 3);
|
||||||
}
|
}
|
||||||
lua_pop(gL, -1);
|
lua_pop(gL, -1);
|
||||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
lua_gc(gL, LUA_GCCOLLECT, 0);
|
||||||
|
|
|
@ -30,12 +30,15 @@ extern lua_State *gL;
|
||||||
#define META_TICCMD "TICCMD_T*"
|
#define META_TICCMD "TICCMD_T*"
|
||||||
#define META_SKIN "SKIN_T*"
|
#define META_SKIN "SKIN_T*"
|
||||||
#define META_POWERS "PLAYER_T*POWERS"
|
#define META_POWERS "PLAYER_T*POWERS"
|
||||||
|
#define META_SOUNDSID "SKIN_T*SOUNDSID"
|
||||||
|
|
||||||
#define META_VERTEX "VERTEX_T*"
|
#define META_VERTEX "VERTEX_T*"
|
||||||
#define META_LINE "LINE_T*"
|
#define META_LINE "LINE_T*"
|
||||||
#define META_SIDE "SIDE_T*"
|
#define META_SIDE "SIDE_T*"
|
||||||
#define META_SUBSECTOR "SUBSECTOR_T*"
|
#define META_SUBSECTOR "SUBSECTOR_T*"
|
||||||
#define META_SECTOR "SECTOR_T*"
|
#define META_SECTOR "SECTOR_T*"
|
||||||
|
#define META_FFLOOR "FFLOOR_T*"
|
||||||
|
#define META_MAPHEADER "MAPHEADER_T*"
|
||||||
|
|
||||||
#define META_CVAR "CONSVAR_T*"
|
#define META_CVAR "CONSVAR_T*"
|
||||||
|
|
||||||
|
@ -44,6 +47,7 @@ extern lua_State *gL;
|
||||||
#define META_HUDINFO "HUDINFO_T*"
|
#define META_HUDINFO "HUDINFO_T*"
|
||||||
#define META_PATCH "PATCH_T*"
|
#define META_PATCH "PATCH_T*"
|
||||||
#define META_COLORMAP "COLORMAP"
|
#define META_COLORMAP "COLORMAP"
|
||||||
|
#define META_CAMERA "CAMERA_T*"
|
||||||
|
|
||||||
boolean luaL_checkboolean(lua_State *L, int narg);
|
boolean luaL_checkboolean(lua_State *L, int narg);
|
||||||
|
|
||||||
|
|
600
src/lua_maplib.c
600
src/lua_maplib.c
|
@ -21,6 +21,25 @@
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
#include "lua_hud.h" // hud_running errors
|
#include "lua_hud.h" // hud_running errors
|
||||||
|
|
||||||
|
#include "dehacked.h"
|
||||||
|
#include "fastcmp.h"
|
||||||
|
#include "doomstat.h"
|
||||||
|
|
||||||
|
enum sector_e {
|
||||||
|
sector_valid = 0,
|
||||||
|
sector_floorheight,
|
||||||
|
sector_ceilingheight,
|
||||||
|
sector_floorpic,
|
||||||
|
sector_ceilingpic,
|
||||||
|
sector_lightlevel,
|
||||||
|
sector_special,
|
||||||
|
sector_tag,
|
||||||
|
sector_thinglist,
|
||||||
|
sector_heightsec,
|
||||||
|
sector_camsec,
|
||||||
|
sector_ffloors
|
||||||
|
};
|
||||||
|
|
||||||
static const char *const sector_opt[] = {
|
static const char *const sector_opt[] = {
|
||||||
"valid",
|
"valid",
|
||||||
"floorheight",
|
"floorheight",
|
||||||
|
@ -30,8 +49,20 @@ static const char *const sector_opt[] = {
|
||||||
"lightlevel",
|
"lightlevel",
|
||||||
"special",
|
"special",
|
||||||
"tag",
|
"tag",
|
||||||
|
"thinglist",
|
||||||
|
"heightsec",
|
||||||
|
"camsec",
|
||||||
|
"ffloors",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
enum subsector_e {
|
||||||
|
subsector_valid = 0,
|
||||||
|
subsector_sector,
|
||||||
|
subsector_numlines,
|
||||||
|
subsector_firstline,
|
||||||
|
subsector_validcount
|
||||||
|
};
|
||||||
|
|
||||||
static const char *const subsector_opt[] = {
|
static const char *const subsector_opt[] = {
|
||||||
"valid",
|
"valid",
|
||||||
"sector",
|
"sector",
|
||||||
|
@ -40,6 +71,27 @@ static const char *const subsector_opt[] = {
|
||||||
"validcount",
|
"validcount",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
enum line_e {
|
||||||
|
line_valid = 0,
|
||||||
|
line_v1,
|
||||||
|
line_v2,
|
||||||
|
line_dx,
|
||||||
|
line_dy,
|
||||||
|
line_flags,
|
||||||
|
line_special,
|
||||||
|
line_tag,
|
||||||
|
line_sidenum,
|
||||||
|
line_frontside,
|
||||||
|
line_backside,
|
||||||
|
line_slopetype,
|
||||||
|
line_frontsector,
|
||||||
|
line_backsector,
|
||||||
|
line_validcount,
|
||||||
|
line_firsttag,
|
||||||
|
line_nexttag,
|
||||||
|
line_text
|
||||||
|
};
|
||||||
|
|
||||||
static const char *const line_opt[] = {
|
static const char *const line_opt[] = {
|
||||||
"valid",
|
"valid",
|
||||||
"v1",
|
"v1",
|
||||||
|
@ -61,6 +113,19 @@ static const char *const line_opt[] = {
|
||||||
"text",
|
"text",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
enum side_e {
|
||||||
|
side_valid = 0,
|
||||||
|
side_textureoffset,
|
||||||
|
side_rowoffset,
|
||||||
|
side_toptexture,
|
||||||
|
side_bottomtexture,
|
||||||
|
side_midtexture,
|
||||||
|
side_sector,
|
||||||
|
side_special,
|
||||||
|
side_repeatcnt,
|
||||||
|
side_text
|
||||||
|
};
|
||||||
|
|
||||||
static const char *const side_opt[] = {
|
static const char *const side_opt[] = {
|
||||||
"valid",
|
"valid",
|
||||||
"textureoffset",
|
"textureoffset",
|
||||||
|
@ -74,6 +139,13 @@ static const char *const side_opt[] = {
|
||||||
"text",
|
"text",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
enum vertex_e {
|
||||||
|
vertex_valid = 0,
|
||||||
|
vertex_x,
|
||||||
|
vertex_y,
|
||||||
|
vertex_z
|
||||||
|
};
|
||||||
|
|
||||||
static const char *const vertex_opt[] = {
|
static const char *const vertex_opt[] = {
|
||||||
"valid",
|
"valid",
|
||||||
"x",
|
"x",
|
||||||
|
@ -81,17 +153,123 @@ static const char *const vertex_opt[] = {
|
||||||
"z",
|
"z",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
enum ffloor_e {
|
||||||
|
ffloor_valid = 0,
|
||||||
|
ffloor_topheight,
|
||||||
|
ffloor_toppic,
|
||||||
|
ffloor_toplightlevel,
|
||||||
|
ffloor_bottomheight,
|
||||||
|
ffloor_bottompic,
|
||||||
|
ffloor_sector,
|
||||||
|
ffloor_flags,
|
||||||
|
ffloor_master,
|
||||||
|
ffloor_target,
|
||||||
|
ffloor_next,
|
||||||
|
ffloor_prev,
|
||||||
|
ffloor_alpha,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *const ffloor_opt[] = {
|
||||||
|
"valid",
|
||||||
|
"topheight",
|
||||||
|
"toppic",
|
||||||
|
"toplightlevel",
|
||||||
|
"bottomheight",
|
||||||
|
"bottompic",
|
||||||
|
"sector", // secnum pushed as control sector userdata
|
||||||
|
"flags",
|
||||||
|
"master", // control linedef
|
||||||
|
"target", // target sector
|
||||||
|
"next",
|
||||||
|
"prev",
|
||||||
|
"alpha",
|
||||||
|
NULL};
|
||||||
|
|
||||||
static const char *const array_opt[] ={"iterate",NULL};
|
static const char *const array_opt[] ={"iterate",NULL};
|
||||||
static const char *const valid_opt[] ={"valid",NULL};
|
static const char *const valid_opt[] ={"valid",NULL};
|
||||||
|
|
||||||
|
// iterates through a sector's thinglist!
|
||||||
|
static int lib_iterateSectorThinglist(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *state = NULL;
|
||||||
|
mobj_t *thing = NULL;
|
||||||
|
|
||||||
|
if (lua_gettop(L) < 2)
|
||||||
|
return luaL_error(L, "Don't call sector.thinglist() directly, use it as 'for rover in sector.thinglist do <block> end'.");
|
||||||
|
|
||||||
|
if (!lua_isnil(L, 1))
|
||||||
|
state = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
else
|
||||||
|
return 0; // no thinglist to iterate through sorry!
|
||||||
|
|
||||||
|
lua_settop(L, 2);
|
||||||
|
lua_remove(L, 1); // remove state now.
|
||||||
|
|
||||||
|
if (!lua_isnil(L, 1))
|
||||||
|
{
|
||||||
|
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
thing = thing->snext;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
thing = state; // state is used as the "start" of the thinglist
|
||||||
|
|
||||||
|
if (thing)
|
||||||
|
{
|
||||||
|
LUA_PushUserdata(L, thing, META_MOBJ);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// iterates through the ffloors list in a sector!
|
||||||
|
static int lib_iterateSectorFFloors(lua_State *L)
|
||||||
|
{
|
||||||
|
ffloor_t *state = NULL;
|
||||||
|
ffloor_t *ffloor = NULL;
|
||||||
|
|
||||||
|
if (lua_gettop(L) < 2)
|
||||||
|
return luaL_error(L, "Don't call sector.ffloors() directly, use it as 'for rover in sector.ffloors do <block> end'.");
|
||||||
|
|
||||||
|
if (!lua_isnil(L, 1))
|
||||||
|
state = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
|
||||||
|
else
|
||||||
|
return 0; // no ffloors to iterate through sorry!
|
||||||
|
|
||||||
|
lua_settop(L, 2);
|
||||||
|
lua_remove(L, 1); // remove state now.
|
||||||
|
|
||||||
|
if (!lua_isnil(L, 1))
|
||||||
|
{
|
||||||
|
ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
|
||||||
|
ffloor = ffloor->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ffloor = state; // state is used as the "start" of the ffloor list
|
||||||
|
|
||||||
|
if (ffloor)
|
||||||
|
{
|
||||||
|
LUA_PushUserdata(L, ffloor, META_FFLOOR);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sector_iterate(lua_State *L)
|
||||||
|
{
|
||||||
|
lua_pushvalue(L, lua_upvalueindex(1)); // iterator function, or the "generator"
|
||||||
|
lua_pushvalue(L, lua_upvalueindex(2)); // state (used as the "start" of the list for our purposes
|
||||||
|
lua_pushnil(L); // initial value (unused)
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
static int sector_get(lua_State *L)
|
static int sector_get(lua_State *L)
|
||||||
{
|
{
|
||||||
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||||
int field = luaL_checkoption(L, 2, sector_opt[0], sector_opt);
|
enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt);
|
||||||
|
|
||||||
if (!sector)
|
if (!sector)
|
||||||
{
|
{
|
||||||
if (field == 0) {
|
if (field == sector_valid) {
|
||||||
lua_pushboolean(L, 0);
|
lua_pushboolean(L, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -100,16 +278,16 @@ static int sector_get(lua_State *L)
|
||||||
|
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case 0: // valid
|
case sector_valid: // valid
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case 1:
|
case sector_floorheight:
|
||||||
lua_pushinteger(L, sector->floorheight);
|
lua_pushinteger(L, sector->floorheight);
|
||||||
return 1;
|
return 1;
|
||||||
case 2:
|
case sector_ceilingheight:
|
||||||
lua_pushinteger(L, sector->ceilingheight);
|
lua_pushinteger(L, sector->ceilingheight);
|
||||||
return 1;
|
return 1;
|
||||||
case 3: { // floorpic
|
case sector_floorpic: { // floorpic
|
||||||
levelflat_t *levelflat;
|
levelflat_t *levelflat;
|
||||||
INT16 i;
|
INT16 i;
|
||||||
for (i = 0, levelflat = levelflats; i != sector->floorpic; i++, levelflat++)
|
for (i = 0, levelflat = levelflats; i != sector->floorpic; i++, levelflat++)
|
||||||
|
@ -117,7 +295,7 @@ static int sector_get(lua_State *L)
|
||||||
lua_pushlstring(L, levelflat->name, 8);
|
lua_pushlstring(L, levelflat->name, 8);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case 4: { // ceilingpic
|
case sector_ceilingpic: { // ceilingpic
|
||||||
levelflat_t *levelflat;
|
levelflat_t *levelflat;
|
||||||
INT16 i;
|
INT16 i;
|
||||||
for (i = 0, levelflat = levelflats; i != sector->ceilingpic; i++, levelflat++)
|
for (i = 0, levelflat = levelflats; i != sector->ceilingpic; i++, levelflat++)
|
||||||
|
@ -125,15 +303,35 @@ static int sector_get(lua_State *L)
|
||||||
lua_pushlstring(L, levelflat->name, 8);
|
lua_pushlstring(L, levelflat->name, 8);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case 5:
|
case sector_lightlevel:
|
||||||
lua_pushinteger(L, sector->lightlevel);
|
lua_pushinteger(L, sector->lightlevel);
|
||||||
return 1;
|
return 1;
|
||||||
case 6:
|
case sector_special:
|
||||||
lua_pushinteger(L, sector->special);
|
lua_pushinteger(L, sector->special);
|
||||||
return 1;
|
return 1;
|
||||||
case 7:
|
case sector_tag:
|
||||||
lua_pushinteger(L, sector->tag);
|
lua_pushinteger(L, sector->tag);
|
||||||
return 1;
|
return 1;
|
||||||
|
case sector_thinglist: // thinglist
|
||||||
|
lua_pushcfunction(L, lib_iterateSectorThinglist);
|
||||||
|
LUA_PushUserdata(L, sector->thinglist, META_MOBJ);
|
||||||
|
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateSectorThinglist and sector->thinglist as upvalues for the function
|
||||||
|
return 1;
|
||||||
|
case sector_heightsec: // heightsec - fake floor heights
|
||||||
|
if (sector->heightsec < 0)
|
||||||
|
return 0;
|
||||||
|
LUA_PushUserdata(L, §ors[sector->heightsec], META_SECTOR);
|
||||||
|
return 1;
|
||||||
|
case sector_camsec: // camsec - camera clipping heights
|
||||||
|
if (sector->camsec < 0)
|
||||||
|
return 0;
|
||||||
|
LUA_PushUserdata(L, §ors[sector->camsec], META_SECTOR);
|
||||||
|
return 1;
|
||||||
|
case sector_ffloors: // ffloors
|
||||||
|
lua_pushcfunction(L, lib_iterateSectorFFloors);
|
||||||
|
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
|
||||||
|
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +379,7 @@ static INT32 P_AddLevelFlatRuntime(const char *flatname)
|
||||||
static int sector_set(lua_State *L)
|
static int sector_set(lua_State *L)
|
||||||
{
|
{
|
||||||
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||||
int field = luaL_checkoption(L, 2, sector_opt[0], sector_opt);
|
enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt);
|
||||||
|
|
||||||
if (!sector)
|
if (!sector)
|
||||||
return luaL_error(L, "accessed sector_t doesn't exist anymore.");
|
return luaL_error(L, "accessed sector_t doesn't exist anymore.");
|
||||||
|
@ -191,10 +389,14 @@ static int sector_set(lua_State *L)
|
||||||
|
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case 0: // valid
|
case sector_valid: // valid
|
||||||
|
case sector_thinglist: // thinglist
|
||||||
|
case sector_heightsec: // heightsec
|
||||||
|
case sector_camsec: // camsec
|
||||||
|
case sector_ffloors: // ffloors
|
||||||
default:
|
default:
|
||||||
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
||||||
case 1: { // floorheight
|
case sector_floorheight: { // floorheight
|
||||||
boolean flag;
|
boolean flag;
|
||||||
fixed_t lastpos = sector->floorheight;
|
fixed_t lastpos = sector->floorheight;
|
||||||
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
|
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||||
|
@ -206,7 +408,7 @@ static int sector_set(lua_State *L)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: { // ceilingheight
|
case sector_ceilingheight: { // ceilingheight
|
||||||
boolean flag;
|
boolean flag;
|
||||||
fixed_t lastpos = sector->ceilingheight;
|
fixed_t lastpos = sector->ceilingheight;
|
||||||
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
|
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||||
|
@ -218,19 +420,19 @@ static int sector_set(lua_State *L)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case sector_floorpic:
|
||||||
sector->floorpic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
sector->floorpic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case sector_ceilingpic:
|
||||||
sector->ceilingpic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
sector->ceilingpic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case sector_lightlevel:
|
||||||
sector->lightlevel = (INT16)luaL_checkinteger(L, 3);
|
sector->lightlevel = (INT16)luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case sector_special:
|
||||||
sector->special = (INT16)luaL_checkinteger(L, 3);
|
sector->special = (INT16)luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case sector_tag:
|
||||||
P_ChangeSectorTag((UINT32)(sector - sectors), (INT16)luaL_checkinteger(L, 3));
|
P_ChangeSectorTag((UINT32)(sector - sectors), (INT16)luaL_checkinteger(L, 3));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -247,11 +449,11 @@ static int sector_num(lua_State *L)
|
||||||
static int subsector_get(lua_State *L)
|
static int subsector_get(lua_State *L)
|
||||||
{
|
{
|
||||||
subsector_t *subsector = *((subsector_t **)luaL_checkudata(L, 1, META_SUBSECTOR));
|
subsector_t *subsector = *((subsector_t **)luaL_checkudata(L, 1, META_SUBSECTOR));
|
||||||
int field = luaL_checkoption(L, 2, subsector_opt[0], subsector_opt);
|
enum subsector_e field = luaL_checkoption(L, 2, subsector_opt[0], subsector_opt);
|
||||||
|
|
||||||
if (!subsector)
|
if (!subsector)
|
||||||
{
|
{
|
||||||
if (field == 0) {
|
if (field == subsector_valid) {
|
||||||
lua_pushboolean(L, 0);
|
lua_pushboolean(L, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -260,19 +462,19 @@ static int subsector_get(lua_State *L)
|
||||||
|
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case 0: // valid
|
case subsector_valid: // valid
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case 1:
|
case subsector_sector:
|
||||||
LUA_PushUserdata(L, subsector->sector, META_SECTOR);
|
LUA_PushUserdata(L, subsector->sector, META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
case 2:
|
case subsector_numlines:
|
||||||
lua_pushinteger(L, subsector->numlines);
|
lua_pushinteger(L, subsector->numlines);
|
||||||
return 1;
|
return 1;
|
||||||
case 3:
|
case subsector_firstline:
|
||||||
lua_pushinteger(L, subsector->firstline);
|
lua_pushinteger(L, subsector->firstline);
|
||||||
return 1;
|
return 1;
|
||||||
case 4:
|
case subsector_validcount:
|
||||||
lua_pushinteger(L, subsector->validcount);
|
lua_pushinteger(L, subsector->validcount);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -289,11 +491,11 @@ static int subsector_num(lua_State *L)
|
||||||
static int line_get(lua_State *L)
|
static int line_get(lua_State *L)
|
||||||
{
|
{
|
||||||
line_t *line = *((line_t **)luaL_checkudata(L, 1, META_LINE));
|
line_t *line = *((line_t **)luaL_checkudata(L, 1, META_LINE));
|
||||||
int field = luaL_checkoption(L, 2, line_opt[0], line_opt);
|
enum line_e field = luaL_checkoption(L, 2, line_opt[0], line_opt);
|
||||||
|
|
||||||
if (!line)
|
if (!line)
|
||||||
{
|
{
|
||||||
if (field == 0) {
|
if (field == line_valid) {
|
||||||
lua_pushboolean(L, 0);
|
lua_pushboolean(L, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -302,43 +504,43 @@ static int line_get(lua_State *L)
|
||||||
|
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case 0: // valid
|
case line_valid: // valid
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case 1:
|
case line_v1:
|
||||||
LUA_PushUserdata(L, line->v1, META_VERTEX);
|
LUA_PushUserdata(L, line->v1, META_VERTEX);
|
||||||
return 1;
|
return 1;
|
||||||
case 2:
|
case line_v2:
|
||||||
LUA_PushUserdata(L, line->v2, META_VERTEX);
|
LUA_PushUserdata(L, line->v2, META_VERTEX);
|
||||||
return 1;
|
return 1;
|
||||||
case 3:
|
case line_dx:
|
||||||
lua_pushinteger(L, line->dx);
|
lua_pushinteger(L, line->dx);
|
||||||
return 1;
|
return 1;
|
||||||
case 4:
|
case line_dy:
|
||||||
lua_pushinteger(L, line->dy);
|
lua_pushinteger(L, line->dy);
|
||||||
return 1;
|
return 1;
|
||||||
case 5:
|
case line_flags:
|
||||||
lua_pushinteger(L, line->flags);
|
lua_pushinteger(L, line->flags);
|
||||||
return 1;
|
return 1;
|
||||||
case 6:
|
case line_special:
|
||||||
lua_pushinteger(L, line->special);
|
lua_pushinteger(L, line->special);
|
||||||
return 1;
|
return 1;
|
||||||
case 7:
|
case line_tag:
|
||||||
lua_pushinteger(L, line->tag);
|
lua_pushinteger(L, line->tag);
|
||||||
return 1;
|
return 1;
|
||||||
case 8:
|
case line_sidenum:
|
||||||
LUA_PushUserdata(L, line->sidenum, META_SIDENUM);
|
LUA_PushUserdata(L, line->sidenum, META_SIDENUM);
|
||||||
return 1;
|
return 1;
|
||||||
case 9: // frontside
|
case line_frontside: // frontside
|
||||||
LUA_PushUserdata(L, &sides[line->sidenum[0]], META_SIDE);
|
LUA_PushUserdata(L, &sides[line->sidenum[0]], META_SIDE);
|
||||||
return 1;
|
return 1;
|
||||||
case 10: // backside
|
case line_backside: // backside
|
||||||
if (line->sidenum[1] == 0xffff)
|
if (line->sidenum[1] == 0xffff)
|
||||||
return 0;
|
return 0;
|
||||||
LUA_PushUserdata(L, &sides[line->sidenum[1]], META_SIDE);
|
LUA_PushUserdata(L, &sides[line->sidenum[1]], META_SIDE);
|
||||||
return 1;
|
return 1;
|
||||||
case 11:
|
case line_slopetype:
|
||||||
switch(lines->slopetype)
|
switch(line->slopetype)
|
||||||
{
|
{
|
||||||
case ST_HORIZONTAL:
|
case ST_HORIZONTAL:
|
||||||
lua_pushliteral(L, "horizontal");
|
lua_pushliteral(L, "horizontal");
|
||||||
|
@ -354,22 +556,22 @@ static int line_get(lua_State *L)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case 12:
|
case line_frontsector:
|
||||||
LUA_PushUserdata(L, line->frontsector, META_SECTOR);
|
LUA_PushUserdata(L, line->frontsector, META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
case 13:
|
case line_backsector:
|
||||||
LUA_PushUserdata(L, line->backsector, META_SECTOR);
|
LUA_PushUserdata(L, line->backsector, META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
case 14:
|
case line_validcount:
|
||||||
lua_pushinteger(L, line->validcount);
|
lua_pushinteger(L, line->validcount);
|
||||||
return 1;
|
return 1;
|
||||||
case 15:
|
case line_firsttag:
|
||||||
lua_pushinteger(L, line->firsttag);
|
lua_pushinteger(L, line->firsttag);
|
||||||
return 1;
|
return 1;
|
||||||
case 16:
|
case line_nexttag:
|
||||||
lua_pushinteger(L, line->nexttag);
|
lua_pushinteger(L, line->nexttag);
|
||||||
return 1;
|
return 1;
|
||||||
case 17:
|
case line_text:
|
||||||
lua_pushstring(L, line->text);
|
lua_pushstring(L, line->text);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -414,11 +616,11 @@ static int sidenum_get(lua_State *L)
|
||||||
static int side_get(lua_State *L)
|
static int side_get(lua_State *L)
|
||||||
{
|
{
|
||||||
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
||||||
int field = luaL_checkoption(L, 2, side_opt[0], side_opt);
|
enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt);
|
||||||
|
|
||||||
if (!side)
|
if (!side)
|
||||||
{
|
{
|
||||||
if (field == 0) {
|
if (field == side_valid) {
|
||||||
lua_pushboolean(L, 0);
|
lua_pushboolean(L, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -427,34 +629,34 @@ static int side_get(lua_State *L)
|
||||||
|
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case 0: // valid
|
case side_valid: // valid
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case 1:
|
case side_textureoffset:
|
||||||
lua_pushinteger(L, side->textureoffset);
|
lua_pushinteger(L, side->textureoffset);
|
||||||
return 1;
|
return 1;
|
||||||
case 2:
|
case side_rowoffset:
|
||||||
lua_pushinteger(L, side->rowoffset);
|
lua_pushinteger(L, side->rowoffset);
|
||||||
return 1;
|
return 1;
|
||||||
case 3:
|
case side_toptexture:
|
||||||
lua_pushinteger(L, side->toptexture);
|
lua_pushinteger(L, side->toptexture);
|
||||||
return 1;
|
return 1;
|
||||||
case 4:
|
case side_bottomtexture:
|
||||||
lua_pushinteger(L, side->bottomtexture);
|
lua_pushinteger(L, side->bottomtexture);
|
||||||
return 1;
|
return 1;
|
||||||
case 5:
|
case side_midtexture:
|
||||||
lua_pushinteger(L, side->midtexture);
|
lua_pushinteger(L, side->midtexture);
|
||||||
return 1;
|
return 1;
|
||||||
case 6:
|
case side_sector:
|
||||||
LUA_PushUserdata(L, side->sector, META_SECTOR);
|
LUA_PushUserdata(L, side->sector, META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
case 7:
|
case side_special:
|
||||||
lua_pushinteger(L, side->special);
|
lua_pushinteger(L, side->special);
|
||||||
return 1;
|
return 1;
|
||||||
case 8:
|
case side_repeatcnt:
|
||||||
lua_pushinteger(L, side->repeatcnt);
|
lua_pushinteger(L, side->repeatcnt);
|
||||||
return 1;
|
return 1;
|
||||||
case 9:
|
case side_text:
|
||||||
lua_pushstring(L, side->text);
|
lua_pushstring(L, side->text);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -471,11 +673,11 @@ static int side_num(lua_State *L)
|
||||||
static int vertex_get(lua_State *L)
|
static int vertex_get(lua_State *L)
|
||||||
{
|
{
|
||||||
vertex_t *vertex = *((vertex_t **)luaL_checkudata(L, 1, META_VERTEX));
|
vertex_t *vertex = *((vertex_t **)luaL_checkudata(L, 1, META_VERTEX));
|
||||||
int field = luaL_checkoption(L, 2, vertex_opt[0], vertex_opt);
|
enum vertex_e field = luaL_checkoption(L, 2, vertex_opt[0], vertex_opt);
|
||||||
|
|
||||||
if (!vertex)
|
if (!vertex)
|
||||||
{
|
{
|
||||||
if (field == 0) {
|
if (field == vertex_valid) {
|
||||||
lua_pushboolean(L, 0);
|
lua_pushboolean(L, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -484,16 +686,16 @@ static int vertex_get(lua_State *L)
|
||||||
|
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case 0: // valid
|
case vertex_valid: // valid
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case 1:
|
case vertex_x:
|
||||||
lua_pushinteger(L, vertex->x);
|
lua_pushinteger(L, vertex->x);
|
||||||
return 1;
|
return 1;
|
||||||
case 2:
|
case vertex_y:
|
||||||
lua_pushinteger(L, vertex->y);
|
lua_pushinteger(L, vertex->y);
|
||||||
return 1;
|
return 1;
|
||||||
case 3:
|
case vertex_z:
|
||||||
lua_pushinteger(L, vertex->z);
|
lua_pushinteger(L, vertex->z);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -737,6 +939,248 @@ static int lib_numvertexes(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ffloor_get(lua_State *L)
|
||||||
|
{
|
||||||
|
ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
|
||||||
|
enum ffloor_e field = luaL_checkoption(L, 2, ffloor_opt[0], ffloor_opt);
|
||||||
|
|
||||||
|
if (!ffloor)
|
||||||
|
{
|
||||||
|
if (field == ffloor_valid) {
|
||||||
|
lua_pushboolean(L, 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return luaL_error(L, "accessed ffloor_t doesn't exist anymore.");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(field)
|
||||||
|
{
|
||||||
|
case ffloor_valid: // valid
|
||||||
|
lua_pushboolean(L, 1);
|
||||||
|
return 1;
|
||||||
|
case ffloor_topheight:
|
||||||
|
lua_pushinteger(L, *ffloor->topheight);
|
||||||
|
return 1;
|
||||||
|
case ffloor_toppic: { // toppic
|
||||||
|
levelflat_t *levelflat;
|
||||||
|
INT16 i;
|
||||||
|
for (i = 0, levelflat = levelflats; i != *ffloor->toppic; i++, levelflat++)
|
||||||
|
;
|
||||||
|
lua_pushlstring(L, levelflat->name, 8);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
case ffloor_toplightlevel:
|
||||||
|
lua_pushinteger(L, *ffloor->toplightlevel);
|
||||||
|
return 1;
|
||||||
|
case ffloor_bottomheight:
|
||||||
|
lua_pushinteger(L, *ffloor->bottomheight);
|
||||||
|
return 1;
|
||||||
|
case ffloor_bottompic: { // bottompic
|
||||||
|
levelflat_t *levelflat;
|
||||||
|
INT16 i;
|
||||||
|
for (i = 0, levelflat = levelflats; i != *ffloor->bottompic; i++, levelflat++)
|
||||||
|
;
|
||||||
|
lua_pushlstring(L, levelflat->name, 8);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
case ffloor_sector:
|
||||||
|
LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR);
|
||||||
|
return 1;
|
||||||
|
case ffloor_flags:
|
||||||
|
lua_pushinteger(L, ffloor->flags);
|
||||||
|
return 1;
|
||||||
|
case ffloor_master:
|
||||||
|
LUA_PushUserdata(L, ffloor->master, META_LINE);
|
||||||
|
return 1;
|
||||||
|
case ffloor_target:
|
||||||
|
LUA_PushUserdata(L, ffloor->target, META_SECTOR);
|
||||||
|
return 1;
|
||||||
|
case ffloor_next:
|
||||||
|
LUA_PushUserdata(L, ffloor->next, META_FFLOOR);
|
||||||
|
return 1;
|
||||||
|
case ffloor_prev:
|
||||||
|
LUA_PushUserdata(L, ffloor->prev, META_FFLOOR);
|
||||||
|
return 1;
|
||||||
|
case ffloor_alpha:
|
||||||
|
lua_pushinteger(L, ffloor->alpha);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ffloor_set(lua_State *L)
|
||||||
|
{
|
||||||
|
ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
|
||||||
|
enum ffloor_e field = luaL_checkoption(L, 2, ffloor_opt[0], ffloor_opt);
|
||||||
|
|
||||||
|
if (!ffloor)
|
||||||
|
return luaL_error(L, "accessed ffloor_t doesn't exist anymore.");
|
||||||
|
|
||||||
|
if (hud_running)
|
||||||
|
return luaL_error(L, "Do not alter ffloor_t in HUD rendering code!");
|
||||||
|
|
||||||
|
switch(field)
|
||||||
|
{
|
||||||
|
case ffloor_valid: // valid
|
||||||
|
case ffloor_sector: // sector
|
||||||
|
case ffloor_master: // master
|
||||||
|
case ffloor_target: // target
|
||||||
|
case ffloor_next: // next
|
||||||
|
case ffloor_prev: // prev
|
||||||
|
default:
|
||||||
|
return luaL_error(L, "ffloor_t field " LUA_QS " cannot be set.", ffloor_opt[field]);
|
||||||
|
case ffloor_topheight: { // topheight
|
||||||
|
boolean flag;
|
||||||
|
fixed_t lastpos = *ffloor->topheight;
|
||||||
|
sector_t *sector = §ors[ffloor->secnum];
|
||||||
|
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||||
|
flag = P_CheckSector(sector, true);
|
||||||
|
if (flag && sector->numattached)
|
||||||
|
{
|
||||||
|
*ffloor->topheight = lastpos;
|
||||||
|
P_CheckSector(sector, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ffloor_toppic:
|
||||||
|
*ffloor->toppic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
||||||
|
break;
|
||||||
|
case ffloor_toplightlevel:
|
||||||
|
*ffloor->toplightlevel = (INT16)luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
|
case ffloor_bottomheight: { // bottomheight
|
||||||
|
boolean flag;
|
||||||
|
fixed_t lastpos = *ffloor->bottomheight;
|
||||||
|
sector_t *sector = §ors[ffloor->secnum];
|
||||||
|
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||||
|
flag = P_CheckSector(sector, true);
|
||||||
|
if (flag && sector->numattached)
|
||||||
|
{
|
||||||
|
*ffloor->bottomheight = lastpos;
|
||||||
|
P_CheckSector(sector, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ffloor_bottompic:
|
||||||
|
*ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
||||||
|
break;
|
||||||
|
case ffloor_flags:
|
||||||
|
ffloor->flags = luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
|
case ffloor_alpha:
|
||||||
|
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_getMapheaderinfo(lua_State *L)
|
||||||
|
{
|
||||||
|
// i -> mapheaderinfo[i-1]
|
||||||
|
|
||||||
|
//int field;
|
||||||
|
lua_settop(L, 2);
|
||||||
|
lua_remove(L, 1); // dummy userdata table is unused.
|
||||||
|
if (lua_isnumber(L, 1))
|
||||||
|
{
|
||||||
|
size_t i = lua_tointeger(L, 1)-1;
|
||||||
|
if (i >= NUMMAPS)
|
||||||
|
return 0;
|
||||||
|
LUA_PushUserdata(L, mapheaderinfo[i], META_MAPHEADER);
|
||||||
|
//CONS_Printf(mapheaderinfo[i]->lvlttl);
|
||||||
|
return 1;
|
||||||
|
}/*
|
||||||
|
field = luaL_checkoption(L, 1, NULL, array_opt);
|
||||||
|
switch(field)
|
||||||
|
{
|
||||||
|
case 0: // iterate
|
||||||
|
lua_pushcfunction(L, lib_iterateSubsectors);
|
||||||
|
return 1;
|
||||||
|
}*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_nummapheaders(lua_State *L)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, NUMMAPS);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mapheaderinfo_get(lua_State *L)
|
||||||
|
{
|
||||||
|
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
|
||||||
|
const char *field = luaL_checkstring(L, 2);
|
||||||
|
//INT16 i;
|
||||||
|
if (fastcmp(field,"lvlttl")) {
|
||||||
|
//for (i = 0; i < 21; i++)
|
||||||
|
// if (!header->lvlttl[i])
|
||||||
|
// break;
|
||||||
|
lua_pushlstring(L, header->lvlttl, 21);
|
||||||
|
} else if (fastcmp(field,"subttl"))
|
||||||
|
lua_pushlstring(L, header->subttl, 32);
|
||||||
|
else if (fastcmp(field,"actnum"))
|
||||||
|
lua_pushinteger(L, header->actnum);
|
||||||
|
else if (fastcmp(field,"typeoflevel"))
|
||||||
|
lua_pushinteger(L, header->typeoflevel);
|
||||||
|
else if (fastcmp(field,"nextlevel"))
|
||||||
|
lua_pushinteger(L, header->nextlevel);
|
||||||
|
else if (fastcmp(field,"musicslot"))
|
||||||
|
lua_pushinteger(L, header->musicslot);
|
||||||
|
else if (fastcmp(field,"musicslottrack"))
|
||||||
|
lua_pushinteger(L, header->musicslottrack);
|
||||||
|
else if (fastcmp(field,"forcecharacter"))
|
||||||
|
lua_pushlstring(L, header->forcecharacter, 16);
|
||||||
|
else if (fastcmp(field,"weather"))
|
||||||
|
lua_pushinteger(L, header->weather);
|
||||||
|
else if (fastcmp(field,"skynum"))
|
||||||
|
lua_pushinteger(L, header->skynum);
|
||||||
|
else if (fastcmp(field,"skybox_scalex"))
|
||||||
|
lua_pushinteger(L, header->skybox_scalex);
|
||||||
|
else if (fastcmp(field,"skybox_scaley"))
|
||||||
|
lua_pushinteger(L, header->skybox_scaley);
|
||||||
|
else if (fastcmp(field,"skybox_scalez"))
|
||||||
|
lua_pushinteger(L, header->skybox_scalez);
|
||||||
|
else if (fastcmp(field,"interscreen"))
|
||||||
|
lua_pushlstring(L, header->interscreen, 8);
|
||||||
|
else if (fastcmp(field,"runsoc"))
|
||||||
|
lua_pushlstring(L, header->runsoc, 32);
|
||||||
|
else if (fastcmp(field,"scriptname"))
|
||||||
|
lua_pushlstring(L, header->scriptname, 32);
|
||||||
|
else if (fastcmp(field,"precutscenenum"))
|
||||||
|
lua_pushinteger(L, header->precutscenenum);
|
||||||
|
else if (fastcmp(field,"cutscenenum"))
|
||||||
|
lua_pushinteger(L, header->cutscenenum);
|
||||||
|
else if (fastcmp(field,"countdown"))
|
||||||
|
lua_pushinteger(L, header->countdown);
|
||||||
|
else if (fastcmp(field,"palette"))
|
||||||
|
lua_pushinteger(L, header->palette);
|
||||||
|
else if (fastcmp(field,"numlaps"))
|
||||||
|
lua_pushinteger(L, header->numlaps);
|
||||||
|
else if (fastcmp(field,"unlockrequired"))
|
||||||
|
lua_pushinteger(L, header->unlockrequired);
|
||||||
|
else if (fastcmp(field,"levelselect"))
|
||||||
|
lua_pushinteger(L, header->levelselect);
|
||||||
|
else if (fastcmp(field,"bonustype"))
|
||||||
|
lua_pushinteger(L, header->bonustype);
|
||||||
|
else if (fastcmp(field,"levelflags"))
|
||||||
|
lua_pushinteger(L, header->levelflags);
|
||||||
|
else if (fastcmp(field,"menuflags"))
|
||||||
|
lua_pushinteger(L, header->menuflags);
|
||||||
|
// TODO add support for reading numGradedMares and grades
|
||||||
|
else {
|
||||||
|
// Read custom vars now
|
||||||
|
// (note: don't include the "LUA." in your lua scripts!)
|
||||||
|
UINT8 i = 0;
|
||||||
|
for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i);
|
||||||
|
|
||||||
|
if(i < header->numCustomOptions)
|
||||||
|
lua_pushlstring(L, header->customopts[i].value, 255);
|
||||||
|
else
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int LUA_MapLib(lua_State *L)
|
int LUA_MapLib(lua_State *L)
|
||||||
{
|
{
|
||||||
luaL_newmetatable(L, META_SECTOR);
|
luaL_newmetatable(L, META_SECTOR);
|
||||||
|
@ -787,6 +1231,22 @@ int LUA_MapLib(lua_State *L)
|
||||||
lua_setfield(L, -2, "__len");
|
lua_setfield(L, -2, "__len");
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
luaL_newmetatable(L, META_FFLOOR);
|
||||||
|
lua_pushcfunction(L, ffloor_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
||||||
|
lua_pushcfunction(L, ffloor_set);
|
||||||
|
lua_setfield(L, -2, "__newindex");
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
luaL_newmetatable(L, META_MAPHEADER);
|
||||||
|
lua_pushcfunction(L, mapheaderinfo_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
||||||
|
//lua_pushcfunction(L, mapheaderinfo_num);
|
||||||
|
//lua_setfield(L, -2, "__len");
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
lua_newuserdata(L, 0);
|
lua_newuserdata(L, 0);
|
||||||
lua_createtable(L, 0, 2);
|
lua_createtable(L, 0, 2);
|
||||||
lua_pushcfunction(L, lib_getSector);
|
lua_pushcfunction(L, lib_getSector);
|
||||||
|
@ -836,6 +1296,16 @@ int LUA_MapLib(lua_State *L)
|
||||||
lua_setfield(L, -2, "__len");
|
lua_setfield(L, -2, "__len");
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
lua_setglobal(L, "vertexes");
|
lua_setglobal(L, "vertexes");
|
||||||
|
|
||||||
|
lua_newuserdata(L, 0);
|
||||||
|
lua_createtable(L, 0, 2);
|
||||||
|
lua_pushcfunction(L, lib_getMapheaderinfo);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
||||||
|
lua_pushcfunction(L, lib_nummapheaders);
|
||||||
|
lua_setfield(L, -2, "__len");
|
||||||
|
lua_setmetatable(L, -2);
|
||||||
|
lua_setglobal(L, "mapheaderinfo");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ static int mobj_set(lua_State *L)
|
||||||
return UNIMPLEMENTED;
|
return UNIMPLEMENTED;
|
||||||
case mobj_angle:
|
case mobj_angle:
|
||||||
mo->angle = (angle_t)luaL_checkinteger(L, 3);
|
mo->angle = (angle_t)luaL_checkinteger(L, 3);
|
||||||
if (mo->player == &players[displayplayer])
|
if (mo->player == &players[consoleplayer])
|
||||||
localangle = mo->angle;
|
localangle = mo->angle;
|
||||||
else if (mo->player == &players[secondarydisplayplayer])
|
else if (mo->player == &players[secondarydisplayplayer])
|
||||||
localangle2 = mo->angle;
|
localangle2 = mo->angle;
|
||||||
|
|
|
@ -267,7 +267,7 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"drilldelay"))
|
else if (fastcmp(field,"drilldelay"))
|
||||||
lua_pushinteger(L, plr->drilldelay);
|
lua_pushinteger(L, plr->drilldelay);
|
||||||
else if (fastcmp(field,"bonustime"))
|
else if (fastcmp(field,"bonustime"))
|
||||||
lua_pushinteger(L, plr->bonustime);
|
lua_pushboolean(L, plr->bonustime);
|
||||||
else if (fastcmp(field,"capsule"))
|
else if (fastcmp(field,"capsule"))
|
||||||
LUA_PushUserdata(L, plr->capsule, META_MOBJ);
|
LUA_PushUserdata(L, plr->capsule, META_MOBJ);
|
||||||
else if (fastcmp(field,"mare"))
|
else if (fastcmp(field,"mare"))
|
||||||
|
@ -345,14 +345,9 @@ static int player_set(lua_State *L)
|
||||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||||
|
|
||||||
if (fastcmp(field,"mo")) {
|
if (fastcmp(field,"mo")) {
|
||||||
if (!lua_isnil(L, 3))
|
mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||||
{
|
plr->mo->player = NULL; // remove player pointer from old mobj
|
||||||
plr->mo->player = NULL;
|
(newmo->player = plr)->mo = newmo; // set player pointer for new mobj, and set new mobj as the player's mobj
|
||||||
plr->mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
|
||||||
plr->mo->player = plr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return luaL_error(L, "player.mo should not be nil!");
|
|
||||||
}
|
}
|
||||||
else if (fastcmp(field,"cmd"))
|
else if (fastcmp(field,"cmd"))
|
||||||
return NOSET;
|
return NOSET;
|
||||||
|
@ -368,7 +363,7 @@ static int player_set(lua_State *L)
|
||||||
plr->bob = (fixed_t)luaL_checkinteger(L, 3);
|
plr->bob = (fixed_t)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"aiming")) {
|
else if (fastcmp(field,"aiming")) {
|
||||||
plr->aiming = (angle_t)luaL_checkinteger(L, 3);
|
plr->aiming = (angle_t)luaL_checkinteger(L, 3);
|
||||||
if (plr == &players[displayplayer])
|
if (plr == &players[consoleplayer])
|
||||||
localaiming = plr->aiming;
|
localaiming = plr->aiming;
|
||||||
else if (plr == &players[secondarydisplayplayer])
|
else if (plr == &players[secondarydisplayplayer])
|
||||||
localaiming2 = plr->aiming;
|
localaiming2 = plr->aiming;
|
||||||
|
@ -392,7 +387,7 @@ static int player_set(lua_State *L)
|
||||||
else if (fastcmp(field,"flashpal"))
|
else if (fastcmp(field,"flashpal"))
|
||||||
plr->flashpal = (UINT16)luaL_checkinteger(L, 3);
|
plr->flashpal = (UINT16)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"skincolor"))
|
else if (fastcmp(field,"skincolor"))
|
||||||
plr->skincolor = (UINT8)luaL_checkinteger(L, 3);
|
plr->skincolor = ((UINT8)luaL_checkinteger(L, 3)) % MAXSKINCOLORS;
|
||||||
else if (fastcmp(field,"score"))
|
else if (fastcmp(field,"score"))
|
||||||
plr->score = (UINT32)luaL_checkinteger(L, 3);
|
plr->score = (UINT32)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"dashspeed"))
|
else if (fastcmp(field,"dashspeed"))
|
||||||
|
@ -623,7 +618,7 @@ static int power_get(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
||||||
powertype_t p = luaL_checkinteger(L, 2);
|
powertype_t p = luaL_checkinteger(L, 2);
|
||||||
if (p > NUMPOWERS)
|
if (p >= NUMPOWERS)
|
||||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p);
|
return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p);
|
||||||
lua_pushinteger(L, powers[p]);
|
lua_pushinteger(L, powers[p]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -635,7 +630,7 @@ static int power_set(lua_State *L)
|
||||||
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
||||||
powertype_t p = luaL_checkinteger(L, 2);
|
powertype_t p = luaL_checkinteger(L, 2);
|
||||||
UINT16 i = (UINT16)luaL_checkinteger(L, 3);
|
UINT16 i = (UINT16)luaL_checkinteger(L, 3);
|
||||||
if (p > NUMPOWERS)
|
if (p >= NUMPOWERS)
|
||||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p);
|
return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p);
|
||||||
if (hud_running)
|
if (hud_running)
|
||||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
#include "lua_hook.h"
|
#include "lua_hook.h"
|
||||||
|
|
||||||
|
#include "doomstat.h"
|
||||||
|
|
||||||
lua_State *gL = NULL;
|
lua_State *gL = NULL;
|
||||||
|
|
||||||
// List of internal libraries to load from SRB2
|
// List of internal libraries to load from SRB2
|
||||||
|
@ -453,6 +455,7 @@ enum
|
||||||
ARCH_SIDE,
|
ARCH_SIDE,
|
||||||
ARCH_SUBSECTOR,
|
ARCH_SUBSECTOR,
|
||||||
ARCH_SECTOR,
|
ARCH_SECTOR,
|
||||||
|
ARCH_MAPHEADER,
|
||||||
|
|
||||||
ARCH_TEND=0xFF,
|
ARCH_TEND=0xFF,
|
||||||
};
|
};
|
||||||
|
@ -471,6 +474,7 @@ static const struct {
|
||||||
{META_SIDE, ARCH_SIDE},
|
{META_SIDE, ARCH_SIDE},
|
||||||
{META_SUBSECTOR,ARCH_SUBSECTOR},
|
{META_SUBSECTOR,ARCH_SUBSECTOR},
|
||||||
{META_SECTOR, ARCH_SECTOR},
|
{META_SECTOR, ARCH_SECTOR},
|
||||||
|
{META_MAPHEADER, ARCH_MAPHEADER},
|
||||||
{NULL, ARCH_NULL}
|
{NULL, ARCH_NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -665,6 +669,17 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ARCH_MAPHEADER:
|
||||||
|
{
|
||||||
|
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
||||||
|
if (!header)
|
||||||
|
WRITEUINT8(save_p, ARCH_NULL);
|
||||||
|
else {
|
||||||
|
WRITEUINT8(save_p, ARCH_MAPHEADER);
|
||||||
|
WRITEUINT16(save_p, header - *mapheaderinfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
WRITEUINT8(save_p, ARCH_NULL);
|
WRITEUINT8(save_p, ARCH_NULL);
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -835,6 +850,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
||||||
case ARCH_SECTOR:
|
case ARCH_SECTOR:
|
||||||
LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_SECTOR);
|
LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_SECTOR);
|
||||||
break;
|
break;
|
||||||
|
case ARCH_MAPHEADER:
|
||||||
|
LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_MAPHEADER);
|
||||||
|
break;
|
||||||
case ARCH_TEND:
|
case ARCH_TEND:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
|
#include "sounds.h"
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
|
@ -182,7 +183,8 @@ static int skin_get(lua_State *L)
|
||||||
lua_pushinteger(L, skin->highresscale);
|
lua_pushinteger(L, skin->highresscale);
|
||||||
break;
|
break;
|
||||||
case skin_soundsid:
|
case skin_soundsid:
|
||||||
return UNIMPLEMENTED;
|
LUA_PushUserdata(L, skin->soundsid, META_SOUNDSID);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -275,6 +277,24 @@ static int lib_numSkins(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// soundsid, i -> soundsid[i]
|
||||||
|
static int soundsid_get(lua_State *L)
|
||||||
|
{
|
||||||
|
sfxenum_t *soundsid = *((sfxenum_t **)luaL_checkudata(L, 1, META_SOUNDSID));
|
||||||
|
skinsound_t i = luaL_checkinteger(L, 2);
|
||||||
|
if (i >= NUMSKINSOUNDS)
|
||||||
|
return luaL_error(L, LUA_QL("skinsound_t") " cannot be %u", i);
|
||||||
|
lua_pushinteger(L, soundsid[i]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #soundsid -> NUMSKINSOUNDS
|
||||||
|
static int soundsid_num(lua_State *L)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, NUMSKINSOUNDS);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int LUA_SkinLib(lua_State *L)
|
int LUA_SkinLib(lua_State *L)
|
||||||
{
|
{
|
||||||
luaL_newmetatable(L, META_SKIN);
|
luaL_newmetatable(L, META_SKIN);
|
||||||
|
@ -288,6 +308,14 @@ int LUA_SkinLib(lua_State *L)
|
||||||
lua_setfield(L, -2, "__len");
|
lua_setfield(L, -2, "__len");
|
||||||
lua_pop(L,1);
|
lua_pop(L,1);
|
||||||
|
|
||||||
|
luaL_newmetatable(L, META_SOUNDSID);
|
||||||
|
lua_pushcfunction(L, soundsid_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
||||||
|
lua_pushcfunction(L, soundsid_num);
|
||||||
|
lua_setfield(L, -2, "__len");
|
||||||
|
lua_pop(L,1);
|
||||||
|
|
||||||
lua_newuserdata(L, 0);
|
lua_newuserdata(L, 0);
|
||||||
lua_createtable(L, 0, 2);
|
lua_createtable(L, 0, 2);
|
||||||
lua_pushcfunction(L, lib_getSkin);
|
lua_pushcfunction(L, lib_getSkin);
|
||||||
|
|
189
src/m_cheat.c
189
src/m_cheat.c
|
@ -16,6 +16,7 @@
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
|
|
||||||
|
#include "r_local.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
|
@ -336,6 +337,22 @@ void Command_Hurtme_f(void)
|
||||||
P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1)));
|
P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Moves the NiGHTS player to another axis within the current mare
|
||||||
|
void Command_JumpToAxis_f(void)
|
||||||
|
{
|
||||||
|
REQUIRE_DEVMODE;
|
||||||
|
REQUIRE_INLEVEL;
|
||||||
|
REQUIRE_SINGLEPLAYER;
|
||||||
|
|
||||||
|
if (COM_Argc() != 2)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("jumptoaxis <axisnum>: Jump to axis within current mare.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
P_TransferToAxis(&players[consoleplayer], atoi(COM_Argv(1)));
|
||||||
|
}
|
||||||
|
|
||||||
void Command_Charability_f(void)
|
void Command_Charability_f(void)
|
||||||
{
|
{
|
||||||
REQUIRE_DEVMODE;
|
REQUIRE_DEVMODE;
|
||||||
|
@ -384,6 +401,171 @@ void Command_Charspeed_f(void)
|
||||||
CONS_Printf(M_GetText("charspeed <normalspeed/runspeed/thrustfactor/accelstart/acceleration/actionspd> <value>: set character speed\n"));
|
CONS_Printf(M_GetText("charspeed <normalspeed/runspeed/thrustfactor/accelstart/acceleration/actionspd> <value>: set character speed\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Command_RTeleport_f(void)
|
||||||
|
{
|
||||||
|
fixed_t intx, inty, intz;
|
||||||
|
size_t i;
|
||||||
|
player_t *p = &players[consoleplayer];
|
||||||
|
subsector_t *ss;
|
||||||
|
|
||||||
|
REQUIRE_DEVMODE;
|
||||||
|
REQUIRE_INLEVEL;
|
||||||
|
REQUIRE_SINGLEPLAYER;
|
||||||
|
|
||||||
|
if (COM_Argc() < 3 || COM_Argc() > 7)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("rteleport -x <value> -y <value> -z <value>: relative teleport to a location\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!p->mo)
|
||||||
|
return;
|
||||||
|
|
||||||
|
i = COM_CheckParm("-x");
|
||||||
|
if (i)
|
||||||
|
intx = atoi(COM_Argv(i + 1));
|
||||||
|
else
|
||||||
|
intx = 0;
|
||||||
|
|
||||||
|
i = COM_CheckParm("-y");
|
||||||
|
if (i)
|
||||||
|
inty = atoi(COM_Argv(i + 1));
|
||||||
|
else
|
||||||
|
inty = 0;
|
||||||
|
|
||||||
|
ss = R_PointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT);
|
||||||
|
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
i = COM_CheckParm("-z");
|
||||||
|
if (i)
|
||||||
|
{
|
||||||
|
intz = atoi(COM_Argv(i + 1));
|
||||||
|
intz <<= FRACBITS;
|
||||||
|
intz += p->mo->z;
|
||||||
|
if (intz < ss->sector->floorheight)
|
||||||
|
intz = ss->sector->floorheight;
|
||||||
|
if (intz > ss->sector->ceilingheight - p->mo->height)
|
||||||
|
intz = ss->sector->ceilingheight - p->mo->height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
intz = p->mo->z;
|
||||||
|
|
||||||
|
CONS_Printf(M_GetText("Teleporting by %d, %d, %d...\n"), intx, inty, FixedInt((intz-p->mo->z)));
|
||||||
|
|
||||||
|
P_MapStart();
|
||||||
|
if (!P_TeleportMove(p->mo, p->mo->x+intx*FRACUNIT, p->mo->y+inty*FRACUNIT, intz))
|
||||||
|
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
|
||||||
|
else
|
||||||
|
S_StartSound(p->mo, sfx_mixup);
|
||||||
|
P_MapEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Command_Teleport_f(void)
|
||||||
|
{
|
||||||
|
fixed_t intx, inty, intz;
|
||||||
|
size_t i;
|
||||||
|
player_t *p = &players[consoleplayer];
|
||||||
|
subsector_t *ss;
|
||||||
|
|
||||||
|
REQUIRE_DEVMODE;
|
||||||
|
REQUIRE_INLEVEL;
|
||||||
|
REQUIRE_SINGLEPLAYER;
|
||||||
|
|
||||||
|
if (COM_Argc() < 3 || COM_Argc() > 7)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("teleport -x <value> -y <value> -z <value>: teleport to a location\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!p->mo)
|
||||||
|
return;
|
||||||
|
|
||||||
|
i = COM_CheckParm("-x");
|
||||||
|
if (i)
|
||||||
|
intx = atoi(COM_Argv(i + 1));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "X");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = COM_CheckParm("-y");
|
||||||
|
if (i)
|
||||||
|
inty = atoi(COM_Argv(i + 1));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "Y");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ss = R_PointInSubsector(intx*FRACUNIT, inty*FRACUNIT);
|
||||||
|
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
i = COM_CheckParm("-z");
|
||||||
|
if (i)
|
||||||
|
{
|
||||||
|
intz = atoi(COM_Argv(i + 1));
|
||||||
|
intz <<= FRACBITS;
|
||||||
|
if (intz < ss->sector->floorheight)
|
||||||
|
intz = ss->sector->floorheight;
|
||||||
|
if (intz > ss->sector->ceilingheight - p->mo->height)
|
||||||
|
intz = ss->sector->ceilingheight - p->mo->height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
intz = ss->sector->floorheight;
|
||||||
|
|
||||||
|
CONS_Printf(M_GetText("Teleporting to %d, %d, %d...\n"), intx, inty, FixedInt(intz));
|
||||||
|
|
||||||
|
P_MapStart();
|
||||||
|
if (!P_TeleportMove(p->mo, intx*FRACUNIT, inty*FRACUNIT, intz))
|
||||||
|
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
|
||||||
|
else
|
||||||
|
S_StartSound(p->mo, sfx_mixup);
|
||||||
|
P_MapEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Command_Skynum_f(void)
|
||||||
|
{
|
||||||
|
REQUIRE_DEVMODE;
|
||||||
|
REQUIRE_INLEVEL;
|
||||||
|
REQUIRE_SINGLEPLAYER;
|
||||||
|
|
||||||
|
if (COM_Argc() != 2)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("skynum <sky#>: change the sky\n"));
|
||||||
|
CONS_Printf(M_GetText("Current sky is %d\n"), levelskynum);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CONS_Printf(M_GetText("Previewing sky %s...\n"), COM_Argv(1));
|
||||||
|
|
||||||
|
P_SetupLevelSky(atoi(COM_Argv(1)), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Command_Weather_f(void)
|
||||||
|
{
|
||||||
|
REQUIRE_DEVMODE;
|
||||||
|
REQUIRE_INLEVEL;
|
||||||
|
REQUIRE_SINGLEPLAYER;
|
||||||
|
|
||||||
|
if (COM_Argc() != 2)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("weather <weather#>: change the weather\n"));
|
||||||
|
CONS_Printf(M_GetText("Current weather is %d\n"), curWeather);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CONS_Printf(M_GetText("Previewing weather %s...\n"), COM_Argv(1));
|
||||||
|
|
||||||
|
P_SwitchWeather(atoi(COM_Argv(1)));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// You never thought you needed this, did you? >=D
|
// You never thought you needed this, did you? >=D
|
||||||
// Yes, this has the specific purpose of completely screwing you up
|
// Yes, this has the specific purpose of completely screwing you up
|
||||||
|
@ -795,13 +977,6 @@ void OP_NightsObjectplace(player_t *player)
|
||||||
if (!OP_HeightOkay(player, false))
|
if (!OP_HeightOkay(player, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
angle = (UINT16)((360-player->anotherflyangle) % 360);
|
|
||||||
if (angle > 90 && angle < 270)
|
|
||||||
{
|
|
||||||
angle += 180;
|
|
||||||
angle %= 360;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->mo->target->flags & MF_AMBUSH)
|
if (player->mo->target->flags & MF_AMBUSH)
|
||||||
angle = (UINT16)player->anotherflyangle;
|
angle = (UINT16)player->anotherflyangle;
|
||||||
else
|
else
|
||||||
|
|
|
@ -57,8 +57,13 @@ void Command_Devmode_f(void);
|
||||||
void Command_Scale_f(void);
|
void Command_Scale_f(void);
|
||||||
void Command_Gravflip_f(void);
|
void Command_Gravflip_f(void);
|
||||||
void Command_Hurtme_f(void);
|
void Command_Hurtme_f(void);
|
||||||
|
void Command_JumpToAxis_f(void);
|
||||||
void Command_Charability_f(void);
|
void Command_Charability_f(void);
|
||||||
void Command_Charspeed_f(void);
|
void Command_Charspeed_f(void);
|
||||||
|
void Command_Teleport_f(void);
|
||||||
|
void Command_RTeleport_f(void);
|
||||||
|
void Command_Skynum_f(void);
|
||||||
|
void Command_Weather_f(void);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void Command_CauseCfail_f(void);
|
void Command_CauseCfail_f(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
22
src/m_menu.c
22
src/m_menu.c
|
@ -1110,7 +1110,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "3D Card Options...", &OP_OpenGLOptionsDef, 20},
|
{IT_SUBMENU|IT_STRING, NULL, "3D Card Options...", &OP_OpenGLOptionsDef, 20},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 30},
|
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 30},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -6244,8 +6244,13 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
||||||
// draw player sprite
|
// draw player sprite
|
||||||
if (!setupm_fakecolor) // should never happen but hey, who knows
|
if (!setupm_fakecolor) // should never happen but hey, who knows
|
||||||
{
|
{
|
||||||
if (skins[setupm_fakeskin].flags & SF_HIRES && skins[setupm_fakeskin].highresscale == FRACUNIT>>1)
|
if (skins[setupm_fakeskin].flags & SF_HIRES)
|
||||||
V_DrawSmallScaledPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch);
|
{
|
||||||
|
V_DrawSciencePatch((mx+98+(PLBOXW*8/2))<<FRACBITS,
|
||||||
|
(my+16+(PLBOXH*8)-12)<<FRACBITS,
|
||||||
|
flags, patch,
|
||||||
|
skins[setupm_fakeskin].highresscale);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
V_DrawScaledPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch);
|
V_DrawScaledPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch);
|
||||||
}
|
}
|
||||||
|
@ -6253,8 +6258,13 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
||||||
{
|
{
|
||||||
UINT8 *colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor, 0);
|
UINT8 *colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor, 0);
|
||||||
|
|
||||||
if (skins[setupm_fakeskin].flags & SF_HIRES && skins[setupm_fakeskin].highresscale == FRACUNIT>>1)
|
if (skins[setupm_fakeskin].flags & SF_HIRES)
|
||||||
V_DrawSmallMappedPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch, colormap);
|
{
|
||||||
|
V_DrawFixedPatch((mx+98+(PLBOXW*8/2))<<FRACBITS,
|
||||||
|
(my+16+(PLBOXH*8)-12)<<FRACBITS,
|
||||||
|
skins[setupm_fakeskin].highresscale,
|
||||||
|
flags, patch, colormap);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
V_DrawMappedPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch, colormap);
|
V_DrawMappedPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch, colormap);
|
||||||
|
|
||||||
|
@ -6827,7 +6837,7 @@ static void M_VideoModeMenu(INT32 choice)
|
||||||
|
|
||||||
memset(modedescs, 0, sizeof(modedescs));
|
memset(modedescs, 0, sizeof(modedescs));
|
||||||
|
|
||||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||||
VID_PrepareModeList(); // FIXME: hack
|
VID_PrepareModeList(); // FIXME: hack
|
||||||
#endif
|
#endif
|
||||||
vidm_nummodes = 0;
|
vidm_nummodes = 0;
|
||||||
|
|
11
src/m_misc.c
11
src/m_misc.c
|
@ -47,8 +47,11 @@
|
||||||
#include "hardware/hw_main.h"
|
#include "hardware/hw_main.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
#include "sdl/hwsym_sdl.h"
|
#include "sdl/hwsym_sdl.h"
|
||||||
|
#ifdef __linux__
|
||||||
|
typedef off_t off64_t;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
|
@ -651,7 +654,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
|
||||||
char Movietxt[] = "SRB2 Movie";
|
char Movietxt[] = "SRB2 Movie";
|
||||||
size_t i;
|
size_t i;
|
||||||
char interfacetxt[] =
|
char interfacetxt[] =
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
"SDL";
|
"SDL";
|
||||||
#elif defined (_WINDOWS)
|
#elif defined (_WINDOWS)
|
||||||
"DirectX";
|
"DirectX";
|
||||||
|
@ -806,7 +809,7 @@ static inline boolean M_PNGLib(void)
|
||||||
pnglib = GetModuleHandleA("libpng12.dll");
|
pnglib = GetModuleHandleA("libpng12.dll");
|
||||||
if (!pnglib)
|
if (!pnglib)
|
||||||
pnglib = GetModuleHandleA("libpng13.dll");
|
pnglib = GetModuleHandleA("libpng13.dll");
|
||||||
#elif defined (SDL)
|
#elif defined (HAVE_SDL)
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
pnglib = hwOpen("libpng.dylib");
|
pnglib = hwOpen("libpng.dylib");
|
||||||
#else
|
#else
|
||||||
|
@ -815,7 +818,7 @@ static inline boolean M_PNGLib(void)
|
||||||
#endif
|
#endif
|
||||||
if (!pnglib)
|
if (!pnglib)
|
||||||
return false;
|
return false;
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
apng_set_acTL = hwSym("png_set_acTL", pnglib);
|
apng_set_acTL = hwSym("png_set_acTL", pnglib);
|
||||||
apng_write_frame_head = hwSym("png_write_frame_head", pnglib);
|
apng_write_frame_head = hwSym("png_write_frame_head", pnglib);
|
||||||
apng_write_frame_tail = hwSym("png_write_frame_tail", pnglib);
|
apng_write_frame_tail = hwSym("png_write_frame_tail", pnglib);
|
||||||
|
|
|
@ -4550,7 +4550,7 @@ void A_DetonChase(mobj_t *actor)
|
||||||
}*/
|
}*/
|
||||||
// movedir is up/down angle: how much it has to go up as it goes over to the player
|
// movedir is up/down angle: how much it has to go up as it goes over to the player
|
||||||
xydist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y);
|
xydist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y);
|
||||||
exact = R_PointToAngle2(actor->x, actor->z, actor->x + xydist, actor->tracer->z);
|
exact = R_PointToAngle2(0, 0, xydist, actor->tracer->z - actor->z);
|
||||||
actor->movedir = exact;
|
actor->movedir = exact;
|
||||||
/*if (exact != actor->movedir)
|
/*if (exact != actor->movedir)
|
||||||
{
|
{
|
||||||
|
@ -6730,7 +6730,8 @@ void A_BuzzFly(mobj_t *actor)
|
||||||
actor->momz = FixedMul(FixedDiv(actor->target->z - actor->z, dist), realspeed);
|
actor->momz = FixedMul(FixedDiv(actor->target->z - actor->z, dist), realspeed);
|
||||||
|
|
||||||
if (actor->z+actor->momz >= actor->waterbottom && actor->watertop > actor->floorz
|
if (actor->z+actor->momz >= actor->waterbottom && actor->watertop > actor->floorz
|
||||||
&& actor->z+actor->momz > actor->watertop - FixedMul(256*FRACUNIT, actor->scale))
|
&& actor->z+actor->momz > actor->watertop - FixedMul(256*FRACUNIT, actor->scale)
|
||||||
|
&& actor->z+actor->momz <= actor->watertop)
|
||||||
{
|
{
|
||||||
actor->momz = 0;
|
actor->momz = 0;
|
||||||
actor->z = actor->watertop;
|
actor->z = actor->watertop;
|
||||||
|
@ -7299,11 +7300,16 @@ void A_SpawnObjectRelative(mobj_t *actor)
|
||||||
//
|
//
|
||||||
void A_ChangeAngleRelative(mobj_t *actor)
|
void A_ChangeAngleRelative(mobj_t *actor)
|
||||||
{
|
{
|
||||||
|
// Oh god, the old code /sucked/. Changed this and the absolute version to get a random range using amin and amax instead of
|
||||||
|
// getting a random angle from the _entire_ spectrum and then clipping. While we're at it, do the angle conversion to the result
|
||||||
|
// rather than the ranges, so <0 and >360 work as possible values. -Red
|
||||||
INT32 locvar1 = var1;
|
INT32 locvar1 = var1;
|
||||||
INT32 locvar2 = var2;
|
INT32 locvar2 = var2;
|
||||||
angle_t angle = (P_Random()+1)<<24;
|
//angle_t angle = (P_Random()+1)<<24;
|
||||||
const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
const fixed_t amin = locvar1*FRACUNIT;
|
||||||
const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
const fixed_t amax = locvar2*FRACUNIT;
|
||||||
|
//const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
||||||
|
//const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_CallAction("A_ChangeAngleRelative", actor))
|
if (LUA_CallAction("A_ChangeAngleRelative", actor))
|
||||||
return;
|
return;
|
||||||
|
@ -7313,13 +7319,13 @@ void A_ChangeAngleRelative(mobj_t *actor)
|
||||||
if (amin > amax)
|
if (amin > amax)
|
||||||
I_Error("A_ChangeAngleRelative: var1 is greater then var2");
|
I_Error("A_ChangeAngleRelative: var1 is greater then var2");
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
if (angle < amin)
|
if (angle < amin)
|
||||||
angle = amin;
|
angle = amin;
|
||||||
if (angle > amax)
|
if (angle > amax)
|
||||||
angle = amax;
|
angle = amax;*/
|
||||||
|
|
||||||
actor->angle += angle;
|
actor->angle += FixedAngle(P_RandomRange(amin, amax));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: A_ChangeAngleAbsolute
|
// Function: A_ChangeAngleAbsolute
|
||||||
|
@ -7333,9 +7339,11 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
||||||
{
|
{
|
||||||
INT32 locvar1 = var1;
|
INT32 locvar1 = var1;
|
||||||
INT32 locvar2 = var2;
|
INT32 locvar2 = var2;
|
||||||
angle_t angle = (P_Random()+1)<<24;
|
//angle_t angle = (P_Random()+1)<<24;
|
||||||
const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
const fixed_t amin = locvar1*FRACUNIT;
|
||||||
const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
const fixed_t amax = locvar2*FRACUNIT;
|
||||||
|
//const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
||||||
|
//const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_CallAction("A_ChangeAngelAbsolute", actor))
|
if (LUA_CallAction("A_ChangeAngelAbsolute", actor))
|
||||||
return;
|
return;
|
||||||
|
@ -7345,13 +7353,13 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
||||||
if (amin > amax)
|
if (amin > amax)
|
||||||
I_Error("A_ChangeAngleAbsolute: var1 is greater then var2");
|
I_Error("A_ChangeAngleAbsolute: var1 is greater then var2");
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
if (angle < amin)
|
if (angle < amin)
|
||||||
angle = amin;
|
angle = amin;
|
||||||
if (angle > amax)
|
if (angle > amax)
|
||||||
angle = amax;
|
angle = amax;*/
|
||||||
|
|
||||||
actor->angle = angle;
|
actor->angle = FixedAngle(P_RandomRange(amin, amax));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: A_PlaySound
|
// Function: A_PlaySound
|
||||||
|
@ -9313,9 +9321,15 @@ void A_SpikeRetract(mobj_t *actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (locvar1 == 0)
|
if (locvar1 == 0)
|
||||||
|
{
|
||||||
actor->flags &= ~MF_SOLID;
|
actor->flags &= ~MF_SOLID;
|
||||||
|
actor->flags |= MF_NOCLIPTHING;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
actor->flags |= MF_SOLID;
|
actor->flags |= MF_SOLID;
|
||||||
|
actor->flags &= ~MF_NOCLIPTHING;
|
||||||
|
}
|
||||||
if (actor->flags & MF_SOLID)
|
if (actor->flags & MF_SOLID)
|
||||||
P_CheckPosition(actor, actor->x, actor->y);
|
P_CheckPosition(actor, actor->x, actor->y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ static inline boolean P_MobjReadyToMove(mobj_t *mo, sector_t *sec, boolean secto
|
||||||
{
|
{
|
||||||
if (sectorisquicksand)
|
if (sectorisquicksand)
|
||||||
return (mo->z > sec->floorheight && mo->z < sec->ceilingheight);
|
return (mo->z > sec->floorheight && mo->z < sec->ceilingheight);
|
||||||
else if (((mo->flags & MF_SPAWNCEILING) == MF_SPAWNCEILING) ^ ((mo->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP))
|
else if (!!(mo->flags & MF_SPAWNCEILING) ^ !!(mo->eflags & MFE_VERTICALFLIP))
|
||||||
return ((sectorisffloor) ? (mo->z+mo->height != sec->floorheight) : (mo->z+mo->height != sec->ceilingheight));
|
return ((sectorisffloor) ? (mo->z+mo->height != sec->floorheight) : (mo->z+mo->height != sec->ceilingheight));
|
||||||
else
|
else
|
||||||
return ((sectorisffloor) ? (mo->z != sec->ceilingheight) : (mo->z != sec->floorheight));
|
return ((sectorisffloor) ? (mo->z != sec->ceilingheight) : (mo->z != sec->floorheight));
|
||||||
|
@ -241,7 +241,7 @@ result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crus
|
||||||
// Is the object hang from the ceiling?
|
// Is the object hang from the ceiling?
|
||||||
// In that case, swap the planes used.
|
// In that case, swap the planes used.
|
||||||
// verticalflip inverts
|
// verticalflip inverts
|
||||||
if (((mo->flags & MF_SPAWNCEILING) == MF_SPAWNCEILING) ^ ((mo->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP))
|
if (!!(mo->flags & MF_SPAWNCEILING) ^ !!(mo->eflags & MFE_VERTICALFLIP))
|
||||||
{
|
{
|
||||||
if (sectorisffloor && !sectorisquicksand)
|
if (sectorisffloor && !sectorisquicksand)
|
||||||
mo->z = mo->ceilingz - mo->height;
|
mo->z = mo->ceilingz - mo->height;
|
||||||
|
@ -886,9 +886,8 @@ void T_BounceCheese(levelspecthink_t *bouncer)
|
||||||
bouncer->speed += gravity;
|
bouncer->speed += gravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bouncer->speed < 2*FRACUNIT && bouncer->speed > -2*FRACUNIT
|
if (abs(bouncer->speed) < 2*FRACUNIT
|
||||||
&& bouncer->sector->ceilingheight < bouncer->ceilingwasheight + FRACUNIT/4
|
&& abs(bouncer->sector->ceilingheight-bouncer->ceilingwasheight) < FRACUNIT/4)
|
||||||
&& bouncer->sector->ceilingheight > bouncer->ceilingwasheight - FRACUNIT/4)
|
|
||||||
{
|
{
|
||||||
bouncer->sector->floorheight = bouncer->floorwasheight;
|
bouncer->sector->floorheight = bouncer->floorwasheight;
|
||||||
bouncer->sector->ceilingheight = bouncer->ceilingwasheight;
|
bouncer->sector->ceilingheight = bouncer->ceilingwasheight;
|
||||||
|
@ -1997,7 +1996,7 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies)
|
||||||
{
|
{
|
||||||
thing = node->m_thing;
|
thing = node->m_thing;
|
||||||
|
|
||||||
if (((thing->flags & MF_ENEMY) || (thing->flags & MF_BOSS)) && thing->health > 0
|
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0
|
||||||
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
|
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
|
||||||
{
|
{
|
||||||
exists = true;
|
exists = true;
|
||||||
|
@ -2027,12 +2026,12 @@ foundenemy:
|
||||||
//
|
//
|
||||||
// Helper function for T_EachTimeThinker
|
// Helper function for T_EachTimeThinker
|
||||||
//
|
//
|
||||||
static INT32 P_HavePlayersEnteredArea(INT32 *curPlayers, INT32 *oldPlayers, boolean inAndOut)
|
static INT32 P_HavePlayersEnteredArea(boolean *curPlayers, boolean *oldPlayers, boolean inAndOut)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
// Easy check... nothing has changed
|
// Easy check... nothing has changed
|
||||||
if (!memcmp(curPlayers, oldPlayers, sizeof(INT32)*MAXPLAYERS))
|
if (!memcmp(curPlayers, oldPlayers, sizeof(boolean)*MAXPLAYERS))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Otherwise, we have to check if any new players have entered
|
// Otherwise, we have to check if any new players have entered
|
||||||
|
@ -2061,15 +2060,15 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
sector_t *sec = NULL;
|
sector_t *sec = NULL;
|
||||||
sector_t *targetsec = NULL;
|
sector_t *targetsec = NULL;
|
||||||
sector_t *usesec = NULL;
|
//sector_t *usesec = NULL;
|
||||||
INT32 secnum = -1;
|
INT32 secnum = -1;
|
||||||
INT32 affectPlayer = 0;
|
INT32 affectPlayer = 0;
|
||||||
INT32 oldPlayersInArea[MAXPLAYERS];
|
boolean oldPlayersInArea[MAXPLAYERS];
|
||||||
INT32 playersInArea[MAXPLAYERS];
|
boolean playersInArea[MAXPLAYERS];
|
||||||
INT32 oldPlayersOnArea[MAXPLAYERS];
|
boolean oldPlayersOnArea[MAXPLAYERS];
|
||||||
INT32 playersOnArea[MAXPLAYERS];
|
boolean playersOnArea[MAXPLAYERS];
|
||||||
INT32 *oldPlayersArea;
|
boolean *oldPlayersArea;
|
||||||
INT32 *playersArea;
|
boolean *playersArea;
|
||||||
boolean FOFsector = false;
|
boolean FOFsector = false;
|
||||||
boolean inAndOut = false;
|
boolean inAndOut = false;
|
||||||
boolean floortouch = false;
|
boolean floortouch = false;
|
||||||
|
@ -2089,14 +2088,23 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
oldPlayersOnArea[i] = eachtime->var2s[i/2] >> 16;
|
oldPlayersOnArea[i] = eachtime->var2s[i/2] >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
playersInArea[i] = 0;
|
playersInArea[i] = false;
|
||||||
playersOnArea[i] = 0;
|
playersOnArea[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((secnum = P_FindSectorFromLineTag(eachtime->sourceline, secnum)) >= 0)
|
while ((secnum = P_FindSectorFromLineTag(eachtime->sourceline, secnum)) >= 0)
|
||||||
{
|
{
|
||||||
sec = §ors[secnum];
|
sec = §ors[secnum];
|
||||||
|
|
||||||
|
FOFsector = false;
|
||||||
|
|
||||||
|
if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5)
|
||||||
|
floortouch = true;
|
||||||
|
else if (GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 8)
|
||||||
|
floortouch = false;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
// Check the lines of this sector, to see if it is a FOF control sector.
|
// Check the lines of this sector, to see if it is a FOF control sector.
|
||||||
for (i = 0; i < sec->linecount; i++)
|
for (i = 0; i < sec->linecount; i++)
|
||||||
{
|
{
|
||||||
|
@ -2111,11 +2119,6 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
{
|
{
|
||||||
targetsec = §ors[targetsecnum];
|
targetsec = §ors[targetsecnum];
|
||||||
|
|
||||||
if (GETSECSPECIAL(targetsec->special, 2) == 3 || GETSECSPECIAL(targetsec->special, 2) == 5)
|
|
||||||
floortouch = true;
|
|
||||||
else
|
|
||||||
floortouch = false;
|
|
||||||
|
|
||||||
for (j = 0; j < MAXPLAYERS; j++)
|
for (j = 0; j < MAXPLAYERS; j++)
|
||||||
{
|
{
|
||||||
if (!playeringame[j])
|
if (!playeringame[j])
|
||||||
|
@ -2146,7 +2149,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
else
|
else
|
||||||
eachtime->var2s[j/2] |= 1 << 16;
|
eachtime->var2s[j/2] |= 1 << 16;
|
||||||
|
|
||||||
playersOnArea[j] = 1;
|
playersOnArea[j] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2155,7 +2158,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
else
|
else
|
||||||
eachtime->vars[j/2] |= 1 << 16;
|
eachtime->vars[j/2] |= 1 << 16;
|
||||||
|
|
||||||
playersInArea[j] = 1;
|
playersInArea[j] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2163,11 +2166,6 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
|
|
||||||
if (!FOFsector)
|
if (!FOFsector)
|
||||||
{
|
{
|
||||||
if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5)
|
|
||||||
floortouch = true;
|
|
||||||
else
|
|
||||||
floortouch = false;
|
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (!playeringame[i])
|
if (!playeringame[i])
|
||||||
|
@ -2192,7 +2190,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
else
|
else
|
||||||
eachtime->var2s[i/2] |= 1 << 16;
|
eachtime->var2s[i/2] |= 1 << 16;
|
||||||
|
|
||||||
playersOnArea[i] = 1;
|
playersOnArea[i] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2201,17 +2199,12 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
else
|
else
|
||||||
eachtime->vars[i/2] |= 1 << 16;
|
eachtime->vars[i/2] |= 1 << 16;
|
||||||
|
|
||||||
playersInArea[i] = 1;
|
playersInArea[i] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FOFsector && targetsec)
|
|
||||||
usesec = targetsec;
|
|
||||||
else
|
|
||||||
usesec = sec;
|
|
||||||
|
|
||||||
if ((eachtime->sourceline->flags & ML_BOUNCY) == ML_BOUNCY)
|
if ((eachtime->sourceline->flags & ML_BOUNCY) == ML_BOUNCY)
|
||||||
inAndOut = true;
|
inAndOut = true;
|
||||||
|
|
||||||
|
@ -2231,12 +2224,34 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||||
|
|
||||||
if ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1)
|
if ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1)
|
||||||
{
|
{
|
||||||
|
if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (!playeringame[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!players[i].mo)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (players[i].mo->health <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((netgame || multiplayer) && players[i].spectator)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!playersArea[i])
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CONS_Debug(DBG_GAMELOGIC, "Trying to activate each time executor with tag %d\n", eachtime->sourceline->tag);
|
CONS_Debug(DBG_GAMELOGIC, "Trying to activate each time executor with tag %d\n", eachtime->sourceline->tag);
|
||||||
|
|
||||||
// Fake-out P_LinedefExecute into thinking you are a continuous.
|
// 03/08/14 -Monster Iestyn
|
||||||
eachtime->sourceline->special--;
|
// No more stupid hacks involving changing eachtime->sourceline's tag or special or whatever!
|
||||||
P_LinedefExecute(eachtime->sourceline->tag, players[affectPlayer].mo, usesec);
|
// This should now run ONLY the stuff for eachtime->sourceline itself, instead of all trigger linedefs sharing the same tag.
|
||||||
eachtime->sourceline->special++;
|
// Makes much more sense doing it this way, honestly.
|
||||||
|
P_RunTriggerLinedef(eachtime->sourceline, players[affectPlayer].mo, sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
205
src/p_inter.c
205
src/p_inter.c
|
@ -295,9 +295,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING))
|
if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|
||||||
|| (toucher->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
|| (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
||||||
|| toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
||||||
{
|
{
|
||||||
if (P_MobjFlip(toucher)*toucher->momz < 0)
|
if (P_MobjFlip(toucher)*toucher->momz < 0)
|
||||||
toucher->momz = -toucher->momz;
|
toucher->momz = -toucher->momz;
|
||||||
|
@ -307,8 +307,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
}
|
}
|
||||||
else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP))
|
else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP))
|
||||||
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP)))
|
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP)))
|
||||||
&& toucher->player->charability == CA_FLY
|
&& player->charability == CA_FLY
|
||||||
&& (toucher->player->powers[pw_tailsfly]
|
&& (player->powers[pw_tailsfly]
|
||||||
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller.
|
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller.
|
||||||
{
|
{
|
||||||
toucher->momz = -toucher->momz/2;
|
toucher->momz = -toucher->momz/2;
|
||||||
|
@ -325,8 +325,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
/////ENEMIES!!//////////////////////////////////////////
|
/////ENEMIES!!//////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
if (special->type == MT_GSNAPPER && !(((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING))
|
if (special->type == MT_GSNAPPER && !(((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|
||||||
|| toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super])
|
|| player->powers[pw_invulnerability] || player->powers[pw_super])
|
||||||
&& toucher->z < special->z + special->height && toucher->z + toucher->height > special->z)
|
&& toucher->z < special->z + special->height && toucher->z + toucher->height > special->z)
|
||||||
{
|
{
|
||||||
// Can only hit snapper from above
|
// Can only hit snapper from above
|
||||||
|
@ -338,9 +338,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
// Cannot hit sharp from above or when red and angry
|
// Cannot hit sharp from above or when red and angry
|
||||||
P_DamageMobj(toucher, special, special, 1);
|
P_DamageMobj(toucher, special, special, 1);
|
||||||
}
|
}
|
||||||
else if (((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING))
|
else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|
||||||
|| (toucher->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
|| (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
||||||
|| toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
||||||
{
|
{
|
||||||
if (P_MobjFlip(toucher)*toucher->momz < 0)
|
if (P_MobjFlip(toucher)*toucher->momz < 0)
|
||||||
toucher->momz = -toucher->momz;
|
toucher->momz = -toucher->momz;
|
||||||
|
@ -349,8 +349,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
}
|
}
|
||||||
else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP))
|
else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP))
|
||||||
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE
|
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE
|
||||||
&& toucher->player->charability == CA_FLY
|
&& player->charability == CA_FLY
|
||||||
&& (toucher->player->powers[pw_tailsfly]
|
&& (player->powers[pw_tailsfly]
|
||||||
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller.
|
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller.
|
||||||
{
|
{
|
||||||
if (P_MobjFlip(toucher)*toucher->momz < 0)
|
if (P_MobjFlip(toucher)*toucher->momz < 0)
|
||||||
|
@ -429,7 +429,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
case MT_GRENADEPICKUP:
|
case MT_GRENADEPICKUP:
|
||||||
case MT_EXPLODEPICKUP:
|
case MT_EXPLODEPICKUP:
|
||||||
case MT_RAILPICKUP:
|
case MT_RAILPICKUP:
|
||||||
if (!(P_CanPickupItem(toucher->player, true)))
|
if (!(P_CanPickupItem(player, true)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Give the power and ringweapon
|
// Give the power and ringweapon
|
||||||
|
@ -453,7 +453,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
case MT_GRENADERING:
|
case MT_GRENADERING:
|
||||||
case MT_EXPLOSIONRING:
|
case MT_EXPLOSIONRING:
|
||||||
case MT_RAILRING:
|
case MT_RAILRING:
|
||||||
if (!(P_CanPickupItem(toucher->player, true)))
|
if (!(P_CanPickupItem(player, true)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (special->info->mass >= pw_infinityring && special->info->mass <= pw_railring)
|
if (special->info->mass >= pw_infinityring && special->info->mass <= pw_railring)
|
||||||
|
@ -541,7 +541,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
|
|
||||||
// Power stones / Match emeralds
|
// Power stones / Match emeralds
|
||||||
case MT_FLINGEMERALD:
|
case MT_FLINGEMERALD:
|
||||||
if (!(P_CanPickupItem(toucher->player, true)) || player->tossdelay)
|
if (!(P_CanPickupItem(player, true)) || player->tossdelay)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player->powers[pw_emeralds] |= special->threshold;
|
player->powers[pw_emeralds] |= special->threshold;
|
||||||
|
@ -612,10 +612,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
player->gotflag |= flagflag;
|
player->gotflag |= flagflag;
|
||||||
CONS_Printf(M_GetText("%s picked up the %s flag!\n"), player_names[player-players], flagtext);
|
CONS_Printf(M_GetText("%s picked up the %s flag!\n"), player_names[player-players], flagtext);
|
||||||
(*flagmobj) = NULL;
|
(*flagmobj) = NULL;
|
||||||
player->pflags &= ~PF_GLIDING;
|
// code for dealing with abilities is handled elsewhere now
|
||||||
player->climbing = 0;
|
|
||||||
if (player->powers[pw_tailsfly])
|
|
||||||
player->powers[pw_tailsfly] = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -627,15 +624,16 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
case MT_NIGHTSDRONE:
|
case MT_NIGHTSDRONE:
|
||||||
if (player->bot)
|
if (player->bot)
|
||||||
return;
|
return;
|
||||||
if (G_IsSpecialStage(gamemap) && player->bonustime && !player->exiting)
|
if (player->exiting)
|
||||||
|
return;
|
||||||
|
if (player->bonustime)
|
||||||
|
{
|
||||||
|
if (G_IsSpecialStage(gamemap)) //After-mare bonus time/emerald reward in special stages.
|
||||||
{
|
{
|
||||||
// only allow the player with the emerald in-hand to leave.
|
// only allow the player with the emerald in-hand to leave.
|
||||||
if (player->mo->tracer && player->mo->tracer->target
|
if (toucher->tracer && toucher->tracer->target
|
||||||
&& player->mo->tracer->target->type == MT_GOTEMERALD)
|
&& toucher->tracer->target->type == MT_GOTEMERALD)
|
||||||
{
|
{
|
||||||
P_NightserizePlayer(player, special->health);
|
|
||||||
P_GiveEmerald(false);
|
|
||||||
// Don't play Ideya sound in special stage mode
|
|
||||||
}
|
}
|
||||||
else // Make sure that SOMEONE has the emerald, at least!
|
else // Make sure that SOMEONE has the emerald, at least!
|
||||||
{
|
{
|
||||||
|
@ -645,37 +643,27 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
&& players[i].mo->tracer->target->type == MT_GOTEMERALD)
|
&& players[i].mo->tracer->target->type == MT_GOTEMERALD)
|
||||||
return;
|
return;
|
||||||
// Well no one has an emerald, so exit anyway!
|
// Well no one has an emerald, so exit anyway!
|
||||||
P_NightserizePlayer(player, special->health);
|
}
|
||||||
P_GiveEmerald(false);
|
P_GiveEmerald(false);
|
||||||
|
// Don't play Ideya sound in special stage mode
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (player->bonustime && !player->exiting) //After-mare bonus time/emerald reward in special stages.
|
|
||||||
{
|
|
||||||
if (!(player->pflags & PF_NIGHTSMODE))
|
|
||||||
{
|
|
||||||
if (!(netgame || multiplayer))
|
|
||||||
P_SetTarget(&special->tracer, toucher);
|
|
||||||
P_SetTarget(&toucher->tracer, P_SpawnMobj(toucher->x, toucher->y, toucher->z, MT_NIGHTSCHAR));
|
|
||||||
}
|
|
||||||
|
|
||||||
P_NightserizePlayer(player, special->health);
|
|
||||||
S_StartSound(toucher, special->info->activesound);
|
S_StartSound(toucher, special->info->activesound);
|
||||||
}
|
}
|
||||||
else if (!G_IsSpecialStage(gamemap) || !player->exiting) //Initial transformation. Don't allow second chances in special stages!
|
else //Initial transformation. Don't allow second chances in special stages!
|
||||||
{
|
{
|
||||||
if (!(player->pflags & PF_NIGHTSMODE))
|
if (player->pflags & PF_NIGHTSMODE)
|
||||||
{
|
return;
|
||||||
if (!(netgame || multiplayer))
|
|
||||||
P_SetTarget(&special->tracer, toucher);
|
|
||||||
S_StartSound(toucher, sfx_supert);
|
S_StartSound(toucher, sfx_supert);
|
||||||
P_SetTarget(&toucher->tracer, P_SpawnMobj(toucher->x, toucher->y, toucher->z, MT_NIGHTSCHAR));
|
|
||||||
P_NightserizePlayer(player, special->health);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (!(netgame || multiplayer) && !(player->pflags & PF_NIGHTSMODE))
|
||||||
|
P_SetTarget(&special->tracer, toucher);
|
||||||
|
P_NightserizePlayer(player, special->health); // Transform!
|
||||||
return;
|
return;
|
||||||
case MT_NIGHTSLOOPHELPER:
|
case MT_NIGHTSLOOPHELPER:
|
||||||
// One second delay
|
// One second delay
|
||||||
if (special->fuse < player->mo->fuse - TICRATE)
|
if (special->fuse < toucher->fuse - TICRATE)
|
||||||
{
|
{
|
||||||
thinker_t *th;
|
thinker_t *th;
|
||||||
mobj_t *mo2;
|
mobj_t *mo2;
|
||||||
|
@ -796,10 +784,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// make sure everything is as it should be, THEN take rings from players in special stages
|
// make sure everything is as it should be, THEN take rings from players in special stages
|
||||||
if ((player->pflags & PF_NIGHTSMODE) && !(toucher->target))
|
if (player->pflags & PF_NIGHTSMODE && !toucher->target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (player->mare != special->threshold)
|
if (player->mare != special->threshold) // wrong mare
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (special->reactiontime > 0) // capsule already has a player attacking it, ignore
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (G_IsSpecialStage(gamemap) && !player->exiting)
|
if (G_IsSpecialStage(gamemap) && !player->exiting)
|
||||||
|
@ -807,8 +798,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
if (playeringame[i] && (&players[i] != player) && players[i].mo->health > 1)
|
if (playeringame[i] && (&players[i] != player) && players[i].mo->health > 1)
|
||||||
{
|
{
|
||||||
player->mo->health += players[i].mo->health-1;
|
toucher->health += players[i].mo->health-1;
|
||||||
player->health = player->mo->health;
|
player->health = toucher->health;
|
||||||
players[i].mo->health = 1;
|
players[i].mo->health = 1;
|
||||||
players[i].health = players[i].mo->health;
|
players[i].health = players[i].mo->health;
|
||||||
}
|
}
|
||||||
|
@ -832,7 +823,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
|
|
||||||
if (player->bumpertime < TICRATE/4)
|
if (player->bumpertime < TICRATE/4)
|
||||||
{
|
{
|
||||||
S_StartSound(player->mo, special->info->seesound);
|
S_StartSound(toucher, special->info->seesound);
|
||||||
if (player->pflags & PF_NIGHTSMODE)
|
if (player->pflags & PF_NIGHTSMODE)
|
||||||
{
|
{
|
||||||
player->bumpertime = TICRATE/2;
|
player->bumpertime = TICRATE/2;
|
||||||
|
@ -848,7 +839,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
//player->mo->x = special->x;
|
//player->mo->x = special->x;
|
||||||
//player->mo->y = special->y;
|
//player->mo->y = special->y;
|
||||||
//P_SetThingPosition(player->mo);
|
//P_SetThingPosition(player->mo);
|
||||||
player->mo->z = special->z+(special->height/4);
|
toucher->z = special->z+(special->height/4);
|
||||||
}
|
}
|
||||||
else // More like a spring
|
else // More like a spring
|
||||||
{
|
{
|
||||||
|
@ -858,11 +849,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
|
|
||||||
player->bumpertime = TICRATE/2;
|
player->bumpertime = TICRATE/2;
|
||||||
|
|
||||||
P_UnsetThingPosition(player->mo);
|
P_UnsetThingPosition(toucher);
|
||||||
player->mo->x = special->x;
|
toucher->x = special->x;
|
||||||
player->mo->y = special->y;
|
toucher->y = special->y;
|
||||||
P_SetThingPosition(player->mo);
|
P_SetThingPosition(toucher);
|
||||||
player->mo->z = special->z+(special->height/4);
|
toucher->z = special->z+(special->height/4);
|
||||||
|
|
||||||
if (special->threshold > 0)
|
if (special->threshold > 0)
|
||||||
fa = (FixedAngle(((special->threshold*30)-1)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
|
fa = (FixedAngle(((special->threshold*30)-1)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
|
||||||
|
@ -872,19 +863,19 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
xspeed = FixedMul(FINECOSINE(fa),speed);
|
xspeed = FixedMul(FINECOSINE(fa),speed);
|
||||||
yspeed = FixedMul(FINESINE(fa),speed);
|
yspeed = FixedMul(FINESINE(fa),speed);
|
||||||
|
|
||||||
P_InstaThrust(player->mo, special->angle, xspeed/10);
|
P_InstaThrust(toucher, special->angle, xspeed/10);
|
||||||
player->mo->momz = yspeed/11;
|
toucher->momz = yspeed/11;
|
||||||
|
|
||||||
player->mo->angle = special->angle;
|
toucher->angle = special->angle;
|
||||||
|
|
||||||
if (player == &players[consoleplayer])
|
if (player == &players[consoleplayer])
|
||||||
localangle = player->mo->angle;
|
localangle = toucher->angle;
|
||||||
else if (player == &players[secondarydisplayplayer])
|
else if (player == &players[secondarydisplayplayer])
|
||||||
localangle2 = player->mo->angle;
|
localangle2 = toucher->angle;
|
||||||
|
|
||||||
P_ResetPlayer(player);
|
P_ResetPlayer(player);
|
||||||
|
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1);
|
P_SetPlayerMobjState(toucher, S_PLAY_FALL1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1125,7 +1116,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
case MT_FIREFLOWER:
|
case MT_FIREFLOWER:
|
||||||
if (player->bot)
|
if (player->bot)
|
||||||
return;
|
return;
|
||||||
toucher->player->powers[pw_shield] |= SH_FIREFLOWER;
|
player->powers[pw_shield] |= SH_FIREFLOWER;
|
||||||
toucher->color = SKINCOLOR_WHITE;
|
toucher->color = SKINCOLOR_WHITE;
|
||||||
G_GhostAddColor(GHC_FIREFLOWER);
|
G_GhostAddColor(GHC_FIREFLOWER);
|
||||||
break;
|
break;
|
||||||
|
@ -1142,7 +1133,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
{
|
{
|
||||||
// blatant reuse of a variable that's normally unused in circuit
|
// blatant reuse of a variable that's normally unused in circuit
|
||||||
if (!player->tossdelay)
|
if (!player->tossdelay)
|
||||||
S_StartSound(player->mo, sfx_lose);
|
S_StartSound(toucher, sfx_lose);
|
||||||
player->tossdelay = 3;
|
player->tossdelay = 3;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1159,8 +1150,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
|
|
||||||
// Save the player's time and position.
|
// Save the player's time and position.
|
||||||
player->starposttime = leveltime;
|
player->starposttime = leveltime;
|
||||||
player->starpostx = player->mo->x>>FRACBITS;
|
player->starpostx = toucher->x>>FRACBITS;
|
||||||
player->starposty = player->mo->y>>FRACBITS;
|
player->starposty = toucher->y>>FRACBITS;
|
||||||
player->starpostz = special->z>>FRACBITS;
|
player->starpostz = special->z>>FRACBITS;
|
||||||
player->starpostangle = special->angle;
|
player->starpostangle = special->angle;
|
||||||
player->starpostnum = special->health;
|
player->starpostnum = special->health;
|
||||||
|
@ -1189,7 +1180,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
S_StartSound(player->mo, special->info->painsound);
|
S_StartSound(toucher, special->info->painsound);
|
||||||
|
|
||||||
if (!(netgame && circuitmap && player != &players[consoleplayer]))
|
if (!(netgame && circuitmap && player != &players[consoleplayer]))
|
||||||
P_SetMobjState(special, special->info->painstate);
|
P_SetMobjState(special, special->info->painstate);
|
||||||
|
@ -1242,7 +1233,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
|
|
||||||
if (player->pflags & PF_ITEMHANG)
|
if (player->pflags & PF_ITEMHANG)
|
||||||
{
|
{
|
||||||
P_SetTarget(&player->mo->tracer, NULL);
|
P_SetTarget(&toucher->tracer, NULL);
|
||||||
player->pflags &= ~PF_ITEMHANG;
|
player->pflags &= ~PF_ITEMHANG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,8 +1286,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
S_StartSound(toucher, special->info->painsound);
|
S_StartSound(toucher, special->info->painsound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING)) || (toucher->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
||||||
|| toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
||||||
{
|
{
|
||||||
// Shatter the shield!
|
// Shatter the shield!
|
||||||
toucher->momx = -toucher->momx/2;
|
toucher->momx = -toucher->momx/2;
|
||||||
|
@ -1344,7 +1335,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
{
|
{
|
||||||
player->pflags |= PF_MACESPIN;
|
player->pflags |= PF_MACESPIN;
|
||||||
S_StartSound(toucher, sfx_spin);
|
S_StartSound(toucher, sfx_spin);
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1);
|
P_SetPlayerMobjState(toucher, S_PLAY_ATK1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player->pflags |= PF_ITEMHANG;
|
player->pflags |= PF_ITEMHANG;
|
||||||
|
@ -1370,7 +1361,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
||||||
{
|
{
|
||||||
P_RemoveShield(player);
|
P_RemoveShield(player);
|
||||||
S_StartSound(player->mo, sfx_shldls); // Ba-Dum! Shield loss.
|
S_StartSound(toucher, sfx_shldls); // Ba-Dum! Shield loss.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1409,8 +1400,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
return;
|
return;
|
||||||
if (mariomode)
|
if (mariomode)
|
||||||
return;
|
return;
|
||||||
else if (special->z < player->mo->z + player->mo->height / 3
|
else if (toucher->eflags & MFE_VERTICALFLIP)
|
||||||
|| special->z > player->mo->z + (player->mo->height*2/3))
|
{
|
||||||
|
if (special->z+special->height < toucher->z + toucher->height / 3
|
||||||
|
|| special->z+special->height > toucher->z + (toucher->height*2/3))
|
||||||
|
return; // Only go in the mouth
|
||||||
|
}
|
||||||
|
else if (special->z < toucher->z + toucher->height / 3
|
||||||
|
|| special->z > toucher->z + (toucher->height*2/3))
|
||||||
return; // Only go in the mouth
|
return; // Only go in the mouth
|
||||||
|
|
||||||
// Eaten by player!
|
// Eaten by player!
|
||||||
|
@ -1422,11 +1419,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
|
|
||||||
if (!player->climbing)
|
if (!player->climbing)
|
||||||
{
|
{
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_GASP);
|
P_SetPlayerMobjState(toucher, S_PLAY_GASP);
|
||||||
P_ResetPlayer(player);
|
P_ResetPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
toucher->momx = toucher->momy = toucher->momz = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MT_WATERDROP:
|
case MT_WATERDROP:
|
||||||
|
@ -1480,6 +1477,11 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
|
||||||
if (!netgame)
|
if (!netgame)
|
||||||
return; // Presumably it's obvious what's happening in splitscreen.
|
return; // Presumably it's obvious what's happening in splitscreen.
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUAh_DeathMsg(player, inflictor, source))
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
deadtarget = (player->health <= 0);
|
deadtarget = (player->health <= 0);
|
||||||
|
|
||||||
// Target's name
|
// Target's name
|
||||||
|
@ -2188,6 +2190,19 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||||
target->fuse = TICRATE*2;
|
target->fuse = TICRATE*2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MT_PLAYER:
|
||||||
|
target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player)
|
||||||
|
target->momx = target->momy = target->momz = 0;
|
||||||
|
if (!(source && source->type == MT_NULL && source->threshold == 42)) // Don't jump up when drowning
|
||||||
|
P_SetObjectMomZ(target, 14*FRACUNIT, false);
|
||||||
|
|
||||||
|
if (source && source->type == MT_NULL && source->threshold == 42) // drowned
|
||||||
|
S_StartSound(target, sfx_drown);
|
||||||
|
else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // Spikes
|
||||||
|
S_StartSound(target, sfx_spkdth);
|
||||||
|
else
|
||||||
|
P_PlayDeathSound(target);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2220,6 +2235,29 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||||
mo->flags2 |= MF2_OBJECTFLIP;
|
mo->flags2 |= MF2_OBJECTFLIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (target->type == MT_EGGMOBILE3)
|
||||||
|
{
|
||||||
|
thinker_t *th;
|
||||||
|
UINT32 i = 0; // to check how many clones we've removed
|
||||||
|
|
||||||
|
// scan the thinkers to make sure all the old pinch dummies are gone on death
|
||||||
|
// this can happen if the boss was hurt earlier than expected
|
||||||
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
|
{
|
||||||
|
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mo = (mobj_t *)th;
|
||||||
|
if (mo->type == (mobjtype_t)target->info->mass && mo->tracer == target)
|
||||||
|
{
|
||||||
|
P_RemoveMobj(mo);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (i == 2) // we've already removed 2 of these, let's stop now
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (target->type == MT_SPIKE && inflictor && target->info->deathstate != S_NULL)
|
if (target->type == MT_SPIKE && inflictor && target->info->deathstate != S_NULL)
|
||||||
{
|
{
|
||||||
const fixed_t x=target->x,y=target->y,z=target->z;
|
const fixed_t x=target->x,y=target->y,z=target->z;
|
||||||
|
@ -2520,27 +2558,14 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
||||||
// Get rid of shield
|
// Get rid of shield
|
||||||
player->powers[pw_shield] = SH_NONE;
|
player->powers[pw_shield] = SH_NONE;
|
||||||
player->mo->color = player->skincolor;
|
player->mo->color = player->skincolor;
|
||||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
|
||||||
|
|
||||||
// Get rid of emeralds
|
// Get rid of emeralds
|
||||||
player->powers[pw_emeralds] = 0;
|
player->powers[pw_emeralds] = 0;
|
||||||
|
|
||||||
if (player->powers[pw_underwater] != 1) // Don't jump up when drowning
|
|
||||||
P_SetObjectMomZ(player->mo, 14*FRACUNIT, false);
|
|
||||||
else
|
|
||||||
P_SetObjectMomZ(player->mo, 0, false);
|
|
||||||
|
|
||||||
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
|
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
|
||||||
|
|
||||||
P_ResetPlayer(player);
|
P_ResetPlayer(player);
|
||||||
|
|
||||||
if (source && source->type == MT_NULL && source->threshold == 42) // drowned
|
|
||||||
S_StartSound(player->mo, sfx_drown);
|
|
||||||
else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // Spikes
|
|
||||||
S_StartSound(player->mo, sfx_spkdth);
|
|
||||||
else
|
|
||||||
P_PlayDeathSound(player->mo);
|
|
||||||
|
|
||||||
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
|
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
|
||||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -128,8 +128,13 @@ boolean P_PlayerInPain(player_t *player);
|
||||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||||
void P_ResetPlayer(player_t *player);
|
void P_ResetPlayer(player_t *player);
|
||||||
boolean P_IsLocalPlayer(player_t *player);
|
boolean P_IsLocalPlayer(player_t *player);
|
||||||
|
|
||||||
|
boolean P_IsObjectInGoop(mobj_t *mo);
|
||||||
boolean P_IsObjectOnGround(mobj_t *mo);
|
boolean P_IsObjectOnGround(mobj_t *mo);
|
||||||
boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec);
|
boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec);
|
||||||
|
boolean P_InSpaceSector(mobj_t *mo);
|
||||||
|
boolean P_InQuicksand(mobj_t *mo);
|
||||||
|
|
||||||
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
||||||
void P_RestoreMusic(player_t *player);
|
void P_RestoreMusic(player_t *player);
|
||||||
void P_SpawnShieldOrb(player_t *player);
|
void P_SpawnShieldOrb(player_t *player);
|
||||||
|
@ -141,8 +146,10 @@ void P_GiveEmerald(boolean spawnObj);
|
||||||
void P_ResetScore(player_t *player);
|
void P_ResetScore(player_t *player);
|
||||||
boolean P_MenuActivePause(void);
|
boolean P_MenuActivePause(void);
|
||||||
|
|
||||||
|
void P_DoJumpShield(player_t *player);
|
||||||
void P_BlackOw(player_t *player);
|
void P_BlackOw(player_t *player);
|
||||||
void P_ElementalFireTrail(player_t *player);
|
void P_ElementalFireTrail(player_t *player);
|
||||||
|
|
||||||
void P_DoPityCheck(player_t *player);
|
void P_DoPityCheck(player_t *player);
|
||||||
void P_PlayerThink(player_t *player);
|
void P_PlayerThink(player_t *player);
|
||||||
void P_PlayerAfterThink(player_t *player);
|
void P_PlayerAfterThink(player_t *player);
|
||||||
|
@ -164,6 +171,9 @@ UINT8 P_FindLowestMare(void);
|
||||||
void P_FindEmerald(void);
|
void P_FindEmerald(void);
|
||||||
void P_TransferToAxis(player_t *player, INT32 axisnum);
|
void P_TransferToAxis(player_t *player, INT32 axisnum);
|
||||||
boolean P_PlayerMoving(INT32 pnum);
|
boolean P_PlayerMoving(INT32 pnum);
|
||||||
|
void P_SpawnThokMobj(player_t *player);
|
||||||
|
void P_SpawnSpinMobj(player_t *player, mobjtype_t type);
|
||||||
|
void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range);
|
||||||
|
|
||||||
void P_PlayLivesJingle(player_t *player);
|
void P_PlayLivesJingle(player_t *player);
|
||||||
#define P_PlayRinglossSound(s) S_StartSound(s, (mariomode) ? sfx_mario8 : sfx_altow1 + P_RandomKey(4));
|
#define P_PlayRinglossSound(s) S_StartSound(s, (mariomode) ? sfx_mario8 : sfx_altow1 + P_RandomKey(4));
|
||||||
|
@ -304,6 +314,8 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist);
|
||||||
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
|
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
|
||||||
boolean PIT_PushableMoved(mobj_t *thing);
|
boolean PIT_PushableMoved(mobj_t *thing);
|
||||||
|
|
||||||
|
void P_DoSpring(mobj_t *spring, mobj_t *object);
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_SETUP
|
// P_SETUP
|
||||||
//
|
//
|
||||||
|
|
192
src/p_map.c
192
src/p_map.c
|
@ -45,7 +45,7 @@ static fixed_t preciptmbbox[4];
|
||||||
boolean floatok;
|
boolean floatok;
|
||||||
|
|
||||||
fixed_t tmfloorz, tmceilingz;
|
fixed_t tmfloorz, tmceilingz;
|
||||||
static fixed_t tmdropoffz;
|
static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
|
||||||
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
||||||
static mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
static mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
|
||||||
// MOVEMENT ITERATOR FUNCTIONS
|
// MOVEMENT ITERATOR FUNCTIONS
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
static void P_DoSpring(mobj_t *spring, mobj_t *object)
|
void P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
{
|
{
|
||||||
INT32 pflags;
|
INT32 pflags;
|
||||||
fixed_t offx, offy;
|
fixed_t offx, offy;
|
||||||
|
@ -260,10 +260,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
|
|
||||||
// Metal Sonic destroys tiny baby objects.
|
// Metal Sonic destroys tiny baby objects.
|
||||||
if (tmthing->type == MT_METALSONIC_RACE
|
if (tmthing->type == MT_METALSONIC_RACE
|
||||||
&& (thing->flags & MF_MISSILE || thing->flags & MF_ENEMY
|
&& (thing->flags & (MF_MISSILE|MF_ENEMY|MF_BOSS) || thing->type == MT_SPIKE))
|
||||||
|| thing->flags & MF_BOSS || thing->type == MT_SPIKE))
|
|
||||||
{
|
{
|
||||||
if ((thing->flags & MF_ENEMY || thing->flags & MF_BOSS) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE)))
|
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE)))
|
||||||
return true;
|
return true;
|
||||||
blockdist = thing->radius + tmthing->radius;
|
blockdist = thing->radius + tmthing->radius;
|
||||||
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
|
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
|
||||||
|
@ -538,7 +537,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((thing->flags & MF_PUSHABLE) && (tmthing->player || tmthing->flags & MF_PUSHABLE)
|
if (thing->flags & MF_PUSHABLE && (tmthing->player || tmthing->flags & MF_PUSHABLE)
|
||||||
&& tmthing->z + tmthing->height > thing->z && tmthing->z < thing->z + thing->height
|
&& tmthing->z + tmthing->height > thing->z && tmthing->z < thing->z + thing->height
|
||||||
&& !(netgame && tmthing->player && tmthing->player->spectator)) // Push thing!
|
&& !(netgame && tmthing->player && tmthing->player->spectator)) // Push thing!
|
||||||
{
|
{
|
||||||
|
@ -636,19 +635,19 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
|
|
||||||
// Sprite Spikes!
|
// Sprite Spikes!
|
||||||
// Do not return because solidity code comes below.
|
// Do not return because solidity code comes below.
|
||||||
if (tmthing->type == MT_SPIKE && thing->player) // moving spike rams into player?!
|
if (tmthing->type == MT_SPIKE && tmthing->flags & MF_SOLID && thing->player) // moving spike rams into player?!
|
||||||
{
|
{
|
||||||
if (tmthing->eflags & MFE_VERTICALFLIP)
|
if (tmthing->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (thing->z + thing->height <= tmthing->z + FixedMul(FRACUNIT, tmthing->scale)
|
if (thing->z + thing->height <= tmthing->z + FixedMul(FRACUNIT, tmthing->scale)
|
||||||
&& thing->z + thing->height >= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz)
|
&& thing->z + thing->height + thing->momz >= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz)
|
||||||
P_DamageMobj(thing, tmthing, tmthing, 1);
|
P_DamageMobj(thing, tmthing, tmthing, 1);
|
||||||
}
|
}
|
||||||
else if (thing->z >= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale)
|
else if (thing->z >= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale)
|
||||||
&& thing->z + thing->momz <= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz)
|
&& thing->z + thing->momz <= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz)
|
||||||
P_DamageMobj(thing, tmthing, tmthing, 1);
|
P_DamageMobj(thing, tmthing, tmthing, 1);
|
||||||
}
|
}
|
||||||
else if (thing->type == MT_SPIKE && tmthing->player) // unfortunate player falls into spike?!
|
else if (thing->type == MT_SPIKE && thing->flags & MF_SOLID && tmthing->player) // unfortunate player falls into spike?!
|
||||||
{
|
{
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
if (thing->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
|
@ -815,6 +814,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
if (thing->player->pflags & PF_NIGHTSMODE)
|
if (thing->player->pflags & PF_NIGHTSMODE)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (thing->tracer && thing->tracer->type == MT_TUBEWAYPOINT
|
||||||
|
&& !(thing->player->pflags & PF_ROPEHANG))
|
||||||
|
return true; // don't steal players from zoomtubes!
|
||||||
|
|
||||||
if ((thing->eflags & MFE_VERTICALFLIP) != (tmthing->eflags & MFE_VERTICALFLIP))
|
if ((thing->eflags & MFE_VERTICALFLIP) != (tmthing->eflags & MFE_VERTICALFLIP))
|
||||||
return true; // Both should be in same gravity
|
return true; // Both should be in same gravity
|
||||||
|
|
||||||
|
@ -887,7 +890,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
&& P_IsObjectOnGround(thing)
|
&& P_IsObjectOnGround(thing)
|
||||||
&& (tmthing->flags & MF_SOLID))
|
&& (tmthing->flags & MF_SOLID))
|
||||||
{
|
{
|
||||||
if ((tmthing->flags & MF_MONITOR) || (tmthing->flags & MF_PUSHABLE))
|
if (tmthing->flags & (MF_MONITOR|MF_PUSHABLE))
|
||||||
{
|
{
|
||||||
if (thing != tmthing->target)
|
if (thing != tmthing->target)
|
||||||
P_DamageMobj(thing, tmthing, tmthing->target, 10000);
|
P_DamageMobj(thing, tmthing, tmthing->target, 10000);
|
||||||
|
@ -940,7 +943,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
&& P_IsObjectOnGround(thing)
|
&& P_IsObjectOnGround(thing)
|
||||||
&& (tmthing->flags & MF_SOLID))
|
&& (tmthing->flags & MF_SOLID))
|
||||||
{
|
{
|
||||||
if ((tmthing->flags & MF_MONITOR) || (tmthing->flags & MF_PUSHABLE))
|
if (tmthing->flags & (MF_MONITOR|MF_PUSHABLE))
|
||||||
{
|
{
|
||||||
if (thing != tmthing->target)
|
if (thing != tmthing->target)
|
||||||
P_DamageMobj(thing, tmthing, tmthing->target, 10000);
|
P_DamageMobj(thing, tmthing, tmthing->target, 10000);
|
||||||
|
@ -1071,39 +1074,29 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
else if (thing->flags & MF_MONITOR
|
else if (thing->flags & MF_MONITOR
|
||||||
&& tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
&& tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
||||||
{
|
{
|
||||||
boolean flip = (thing->eflags & MFE_VERTICALFLIP) != 0; // Save this flag in case monitor gets removed.
|
SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed.
|
||||||
fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;;
|
fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;;
|
||||||
P_DamageMobj(thing, tmthing, tmthing, 1); // break the monitor
|
P_DamageMobj(thing, tmthing, tmthing, 1); // break the monitor
|
||||||
// Going down? Then bounce back up.
|
// Going down? Then bounce back up.
|
||||||
if ((P_MobjWasRemoved(thing) // Monitor was removed
|
if ((P_MobjWasRemoved(thing) // Monitor was removed
|
||||||
|| !thing->health) // or otherwise popped
|
|| !thing->health) // or otherwise popped
|
||||||
&& ((!flip && *momz < 0) // monitor is on the floor and you're going down
|
&& (flipval*(*momz) < 0)) // monitor is on the floor and you're going down, or on the ceiling and you're going up
|
||||||
|| (flip && *momz > 0))) // or on the ceiling and you're going up
|
|
||||||
*momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically.
|
*momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (thing->flags & MF_BOSS
|
|
||||||
&& ((tmthing->player->pflags & PF_JUMPED) || (tmthing->player->pflags & PF_SPINNING)
|
|
||||||
|| tmthing->player->powers[pw_invulnerability]
|
|
||||||
|| tmthing->player->powers[pw_super]))
|
|
||||||
{
|
|
||||||
// Going down? Then bounce back up.
|
|
||||||
if (abs(tmthing->momz) > 0)
|
|
||||||
tmthing->momz = -tmthing->momz;
|
|
||||||
|
|
||||||
// Also, bounce back.
|
|
||||||
tmthing->momx = -tmthing->momx;
|
|
||||||
tmthing->momy = -tmthing->momy;
|
|
||||||
P_DamageMobj(thing, tmthing, tmthing, 1); // fight the boss!
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Monitors are not treated as solid to players who are jumping, spinning or gliding,
|
||||||
|
// unless it's a CTF team monitor and you're on the wrong team
|
||||||
|
if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)
|
||||||
|
&& !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2)))
|
||||||
|
;
|
||||||
// z checking at last
|
// z checking at last
|
||||||
// Treat noclip things as non-solid!
|
// Treat noclip things as non-solid!
|
||||||
if ((thing->flags & MF_SOLID) && (tmthing->flags & MF_SOLID) &&
|
else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID
|
||||||
!(thing->flags & MF_NOCLIP) && !(tmthing->flags & MF_NOCLIP))
|
&& (tmthing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID)
|
||||||
{
|
{
|
||||||
if (tmthing->eflags & MFE_VERTICALFLIP)
|
if (tmthing->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
|
@ -1128,7 +1121,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
&& tmthing->z + tmthing->height < tmthing->ceilingz)
|
&& tmthing->z + tmthing->height < tmthing->ceilingz)
|
||||||
return false; // block while in air
|
return false; // block while in air
|
||||||
|
|
||||||
if (topz < tmceilingz && !(thing->flags & MF_SPRING))
|
if (thing->flags & MF_SPRING)
|
||||||
|
;
|
||||||
|
else if (topz < tmceilingz && tmthing->z+tmthing->height <= thing->z+thing->height)
|
||||||
{
|
{
|
||||||
tmceilingz = topz;
|
tmceilingz = topz;
|
||||||
tmfloorthing = thing; // thing we may stand on
|
tmfloorthing = thing; // thing we may stand on
|
||||||
|
@ -1156,7 +1151,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz)
|
if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz)
|
||||||
return false; // block while in air
|
return false; // block while in air
|
||||||
|
|
||||||
if (topz > tmfloorz && !(thing->flags & MF_SPRING))
|
if (thing->flags & MF_SPRING)
|
||||||
|
;
|
||||||
|
else if (topz > tmfloorz && tmthing->z >= thing->z)
|
||||||
{
|
{
|
||||||
tmfloorz = topz;
|
tmfloorz = topz;
|
||||||
tmfloorthing = thing; // thing we may stand on
|
tmfloorthing = thing; // thing we may stand on
|
||||||
|
@ -1219,6 +1216,9 @@ static boolean PIT_CheckCameraLine(line_t *ld)
|
||||||
tmfloorz = openbottom;
|
tmfloorz = openbottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (highceiling > tmdrpoffceilz)
|
||||||
|
tmdrpoffceilz = highceiling;
|
||||||
|
|
||||||
if (lowfloor < tmdropoffz)
|
if (lowfloor < tmdropoffz)
|
||||||
tmdropoffz = lowfloor;
|
tmdropoffz = lowfloor;
|
||||||
|
|
||||||
|
@ -1266,7 +1266,7 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||||
{
|
{
|
||||||
if (ld->flags & ML_IMPASSIBLE) // block objects from moving through this linedef.
|
if (ld->flags & ML_IMPASSIBLE) // block objects from moving through this linedef.
|
||||||
return false;
|
return false;
|
||||||
if (((tmthing->flags & MF_ENEMY) || (tmthing->flags & MF_BOSS)) && ld->flags & ML_BLOCKMONSTERS)
|
if ((tmthing->flags & (MF_ENEMY|MF_BOSS)) && ld->flags & ML_BLOCKMONSTERS)
|
||||||
return false; // block monsters only
|
return false; // block monsters only
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1285,6 +1285,9 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||||
tmfloorz = openbottom;
|
tmfloorz = openbottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (highceiling > tmdrpoffceilz)
|
||||||
|
tmdrpoffceilz = highceiling;
|
||||||
|
|
||||||
if (lowfloor < tmdropoffz)
|
if (lowfloor < tmdropoffz)
|
||||||
tmdropoffz = lowfloor;
|
tmdropoffz = lowfloor;
|
||||||
|
|
||||||
|
@ -1314,6 +1317,7 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||||
// tmfloorz
|
// tmfloorz
|
||||||
// tmceilingz
|
// tmceilingz
|
||||||
// tmdropoffz
|
// tmdropoffz
|
||||||
|
// tmdrpoffceilz
|
||||||
// the lowest point contacted
|
// the lowest point contacted
|
||||||
// (monsters won't move to a dropoff)
|
// (monsters won't move to a dropoff)
|
||||||
// speciallines[]
|
// speciallines[]
|
||||||
|
@ -1356,7 +1360,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
// Any contacted lines the step closer together
|
// Any contacted lines the step closer together
|
||||||
// will adjust them.
|
// will adjust them.
|
||||||
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
|
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
|
||||||
tmceilingz = newsubsec->sector->ceilingheight;
|
tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight;
|
||||||
|
|
||||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||||
if (newsubsec->sector->ffloors)
|
if (newsubsec->sector->ffloors)
|
||||||
|
@ -1427,16 +1431,15 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
+ ((*rover->topheight - *rover->bottomheight)/2));
|
+ ((*rover->topheight - *rover->bottomheight)/2));
|
||||||
|
|
||||||
if (*rover->topheight > tmfloorz && abs(delta1) < abs(delta2)
|
if (*rover->topheight > tmfloorz && abs(delta1) < abs(delta2)
|
||||||
&& (!(rover->flags & FF_REVERSEPLATFORM)))
|
&& !(rover->flags & FF_REVERSEPLATFORM))
|
||||||
{
|
{
|
||||||
tmfloorz = tmdropoffz = *rover->topheight;
|
tmfloorz = tmdropoffz = *rover->topheight;
|
||||||
}
|
}
|
||||||
if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
||||||
&& (/*thing->z + thing->height <= *rover->bottomheight
|
&& !(rover->flags & FF_PLATFORM)
|
||||||
|| */!(rover->flags & FF_PLATFORM))
|
|
||||||
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
|
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
|
||||||
{
|
{
|
||||||
tmceilingz = *rover->bottomheight;
|
tmceilingz = tmdrpoffceilz = *rover->bottomheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1506,7 +1509,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
tmfloorz = tmdropoffz = polytop;
|
tmfloorz = tmdropoffz = polytop;
|
||||||
|
|
||||||
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2))
|
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2))
|
||||||
tmceilingz = polybottom;
|
tmceilingz = tmdrpoffceilz = polybottom;
|
||||||
}
|
}
|
||||||
plink = (polymaplink_t *)(plink->link.next);
|
plink = (polymaplink_t *)(plink->link.next);
|
||||||
}
|
}
|
||||||
|
@ -1609,7 +1612,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12)
|
if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12)
|
||||||
{ // Camera noclip on entire sector.
|
{ // Camera noclip on entire sector.
|
||||||
tmfloorz = tmdropoffz = thiscam->z;
|
tmfloorz = tmdropoffz = thiscam->z;
|
||||||
tmceilingz = thiscam->z + thiscam->height;
|
tmceilingz = tmdrpoffceilz = thiscam->z + thiscam->height;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1618,14 +1621,21 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
// Any contacted lines the step closer together
|
// Any contacted lines the step closer together
|
||||||
// will adjust them.
|
// will adjust them.
|
||||||
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
|
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
|
||||||
tmceilingz = newsubsec->sector->ceilingheight;
|
tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight;
|
||||||
|
|
||||||
// Cameras use the heightsec's heights rather then the actual sector heights.
|
// Cameras use the heightsec's heights rather then the actual sector heights.
|
||||||
// If you can see through it, why not move the camera through it too?
|
// If you can see through it, why not move the camera through it too?
|
||||||
if (newsubsec->sector->heightsec >= 0)
|
if (newsubsec->sector->heightsec >= 0)
|
||||||
{
|
{
|
||||||
tmfloorz = tmdropoffz = sectors[newsubsec->sector->heightsec].floorheight;
|
tmfloorz = tmdropoffz = sectors[newsubsec->sector->heightsec].floorheight;
|
||||||
tmceilingz = sectors[newsubsec->sector->heightsec].ceilingheight;
|
tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->heightsec].ceilingheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use preset camera clipping heights if set with Sector Special Parameters whose control sector has Camera Intangible special -Red
|
||||||
|
if (newsubsec->sector->camsec >= 0)
|
||||||
|
{
|
||||||
|
tmfloorz = tmdropoffz = sectors[newsubsec->sector->camsec].floorheight;
|
||||||
|
tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->camsec].ceilingheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||||
|
@ -1650,7 +1660,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
}
|
}
|
||||||
if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2))
|
if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2))
|
||||||
{
|
{
|
||||||
tmceilingz = *rover->bottomheight;
|
tmceilingz = tmdrpoffceilz = *rover->bottomheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1725,7 +1735,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
tmfloorz = tmdropoffz = polytop;
|
tmfloorz = tmdropoffz = polytop;
|
||||||
|
|
||||||
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2))
|
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2))
|
||||||
tmceilingz = polybottom;
|
tmceilingz = tmdrpoffceilz = polybottom;
|
||||||
}
|
}
|
||||||
plink = (polymaplink_t *)(plink->link.next);
|
plink = (polymaplink_t *)(plink->link.next);
|
||||||
}
|
}
|
||||||
|
@ -1930,11 +1940,13 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
||||||
P_SetTarget(&tmthing, oldthing);
|
P_SetTarget(&tmthing, oldthing);
|
||||||
ceilingline = oldceilline;
|
ceilingline = oldceilline;
|
||||||
blockingline = oldblockline;
|
blockingline = oldblockline;
|
||||||
|
thing->momz = stand->momz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thing->momx = stand->momx;
|
thing->momx = stand->momx;
|
||||||
thing->momy = stand->momy;
|
thing->momy = stand->momy;
|
||||||
|
thing->momz = stand->momz;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1948,6 +1960,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
fixed_t tryx = thing->x;
|
fixed_t tryx = thing->x;
|
||||||
fixed_t tryy = thing->y;
|
fixed_t tryy = thing->y;
|
||||||
fixed_t radius = thing->radius;
|
fixed_t radius = thing->radius;
|
||||||
|
fixed_t thingtop = thing->z + thing->height;
|
||||||
floatok = false;
|
floatok = false;
|
||||||
|
|
||||||
if (radius < MAXRADIUS/2)
|
if (radius < MAXRADIUS/2)
|
||||||
|
@ -1986,6 +1999,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
|
|
||||||
if (thing->player)
|
if (thing->player)
|
||||||
{
|
{
|
||||||
|
// If using type Section1:13, double the maxstep.
|
||||||
|
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
||||||
|
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13)
|
||||||
|
maxstep <<= 1;
|
||||||
|
|
||||||
// Don't 'step up' while springing,
|
// Don't 'step up' while springing,
|
||||||
// Only step up "if needed".
|
// Only step up "if needed".
|
||||||
if (thing->state == &states[S_PLAY_SPRING]
|
if (thing->state == &states[S_PLAY_SPRING]
|
||||||
|
@ -2014,27 +2032,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
return false; // mobj must raise itself to fit
|
return false; // mobj must raise itself to fit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tmceilingz - thing->z < thing->height)
|
else if (tmceilingz < thingtop)
|
||||||
{
|
{
|
||||||
CheckMissileImpact(thing);
|
CheckMissileImpact(thing);
|
||||||
return false; // mobj must lower itself to fit
|
return false; // mobj must lower itself to fit
|
||||||
}
|
}
|
||||||
|
|
||||||
// If using type Section1:13, double the maxstep.
|
|
||||||
if (thing->player && (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
|
||||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13))
|
|
||||||
maxstep <<= 1;
|
|
||||||
|
|
||||||
// Ramp test
|
// Ramp test
|
||||||
if (thing->player && !P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
if (thing->player && maxstep > 0
|
||||||
&& GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) != 14)
|
&& !(P_PlayerTouchingSectorSpecial(thing->player, 1, 14) || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14))
|
||||||
{
|
{
|
||||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||||
// step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more.
|
// step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more.
|
||||||
|
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
if (thing->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (thing->z+thing->height == thing->ceilingz && tmceilingz > thing->z+thing->height && tmceilingz - thing->z+thing->height <= maxstep)
|
if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep)
|
||||||
{
|
{
|
||||||
thing->z = tmceilingz - thing->height;
|
thing->z = tmceilingz - thing->height;
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
|
@ -2049,9 +2062,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
|
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
if (thing->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (thing->z + thing->height > tmceilingz + maxstep)
|
if (thingtop - tmceilingz > maxstep)
|
||||||
{
|
{
|
||||||
CheckMissileImpact(thing);
|
CheckMissileImpact(thing);
|
||||||
|
if (tmfloorthing)
|
||||||
|
tmhitthing = tmfloorthing;
|
||||||
return false; // too big a step up
|
return false; // too big a step up
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2065,15 +2080,21 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
|
|
||||||
if (tmfloorz > thing->z)
|
if (tmfloorz > thing->z)
|
||||||
{
|
{
|
||||||
if ((thing->flags & MF_MISSILE))
|
if (thing->flags & MF_MISSILE)
|
||||||
CheckMissileImpact(thing);
|
CheckMissileImpact(thing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allowdropoff)
|
if (!allowdropoff && !(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing)
|
||||||
if (!(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing
|
{
|
||||||
&& tmfloorz - tmdropoffz > maxstep)
|
if (thing->eflags & MFE_VERTICALFLIP)
|
||||||
|
{
|
||||||
|
if (tmdrpoffceilz - tmceilingz > maxstep)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (tmfloorz - tmdropoffz > maxstep)
|
||||||
return false; // don't stand over a dropoff
|
return false; // don't stand over a dropoff
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} while (tryx != x || tryy != y);
|
} while (tryx != x || tryy != y);
|
||||||
|
|
||||||
// The move is ok!
|
// The move is ok!
|
||||||
|
@ -2562,7 +2583,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
|
||||||
if (li->flags & ML_IMPASSIBLE)
|
if (li->flags & ML_IMPASSIBLE)
|
||||||
goto isblocking;
|
goto isblocking;
|
||||||
|
|
||||||
if (((slidemo->flags & MF_ENEMY) || (slidemo->flags & MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
||||||
goto isblocking;
|
goto isblocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2804,7 +2825,7 @@ void P_SlideMove(mobj_t *mo)
|
||||||
INT16 hitcount = 0;
|
INT16 hitcount = 0;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
if (tmhitthing)
|
if (tmhitthing && mo->z + mo->height > tmhitthing->z && mo->z < tmhitthing->z + tmhitthing->height)
|
||||||
{
|
{
|
||||||
// Don't mess with your momentum if it's a pushable object. Pushables do their own crazy things already.
|
// Don't mess with your momentum if it's a pushable object. Pushables do their own crazy things already.
|
||||||
if (tmhitthing->flags & MF_PUSHABLE)
|
if (tmhitthing->flags & MF_PUSHABLE)
|
||||||
|
@ -3205,24 +3226,34 @@ static boolean nofit;
|
||||||
//
|
//
|
||||||
static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||||
{
|
{
|
||||||
|
mobj_t *killer = NULL;
|
||||||
|
|
||||||
if (P_ThingHeightClip(thing))
|
if (P_ThingHeightClip(thing))
|
||||||
{
|
{
|
||||||
// keep checking
|
//thing fits, check next thing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(thing->flags & (MF_SHOOTABLE|MF_PUSHABLE))
|
if (!(thing->flags & (MF_SHOOTABLE|MF_PUSHABLE))
|
||||||
|| thing->flags & MF_NOCLIPHEIGHT)
|
|| thing->flags & MF_NOCLIPHEIGHT)
|
||||||
{
|
{
|
||||||
// assume it is bloody gibs or something
|
//doesn't interact with the crusher, just ignore it
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crush the thing if necessary, and if it's a crumbling FOF that did it,
|
// Thing doesn't fit. If thing is vulnerable, that means it's being crushed. If thing is pushable, it might
|
||||||
// reward the player who made it crumble!
|
// just be blocked by another object - check if it's really a ceiling!
|
||||||
if (thing->z + thing->height > thing->ceilingz && thing->z <= thing->ceilingz)
|
if (thing->z + thing->height > thing->ceilingz && thing->z <= thing->ceilingz)
|
||||||
{
|
{
|
||||||
if (realcrush && thing->subsector->sector->ffloors)
|
if (thing->flags & MF_PUSHABLE && thing->z + thing->height > thing->subsector->sector->ceilingheight)
|
||||||
|
{
|
||||||
|
//Thing is a pushable and blocks the moving ceiling
|
||||||
|
nofit = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check FOFs in the sector
|
||||||
|
if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE))
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
fixed_t delta1, delta2;
|
fixed_t delta1, delta2;
|
||||||
|
@ -3238,6 +3269,15 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||||
delta2 = thingtop - (*rover->bottomheight + *rover->topheight)/2;
|
delta2 = thingtop - (*rover->bottomheight + *rover->topheight)/2;
|
||||||
if (*rover->bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2))
|
if (*rover->bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2))
|
||||||
{
|
{
|
||||||
|
if (thing->flags & MF_PUSHABLE)
|
||||||
|
{
|
||||||
|
//FOF is blocked by pushable
|
||||||
|
nofit = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//If the thing was crushed by a crumbling FOF, reward the player who made it crumble!
|
||||||
thinker_t *think;
|
thinker_t *think;
|
||||||
elevator_t *crumbler;
|
elevator_t *crumbler;
|
||||||
|
|
||||||
|
@ -3255,33 +3295,27 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||||
&& (crumbler->type == elevateBounce
|
&& (crumbler->type == elevateBounce
|
||||||
|| crumbler->type == elevateContinuous))
|
|| crumbler->type == elevateContinuous))
|
||||||
{
|
{
|
||||||
if (netgame && thing->player && thing->player->spectator)
|
killer = crumbler->player->mo;
|
||||||
P_DamageMobj(thing, NULL, NULL, 42000); // Respawn crushed spectators
|
|
||||||
else
|
|
||||||
P_DamageMobj(thing, crumbler->player->mo, crumbler->player->mo, 10000);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thing->flags & MF_PUSHABLE)
|
|
||||||
{
|
|
||||||
nofit = true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (realcrush)
|
if (realcrush)
|
||||||
{
|
{
|
||||||
// Instant-death, but no one to blame
|
// Crush the object
|
||||||
if (netgame && thing->player && thing->player->spectator)
|
if (netgame && thing->player && thing->player->spectator)
|
||||||
P_DamageMobj(thing, NULL, NULL, 42000); // Respawn crushed spectators
|
P_DamageMobj(thing, NULL, NULL, 42000); // Respawn crushed spectators
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// So give a generic crush death message
|
if (!killer)
|
||||||
mobj_t *killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL);
|
{
|
||||||
|
//Nobody is responsible for crushing the object, so give a generic crush message
|
||||||
|
killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL);
|
||||||
killer->threshold = 44; // Special flag for crushing
|
killer->threshold = 44; // Special flag for crushing
|
||||||
|
}
|
||||||
P_DamageMobj(thing, killer, killer, 10000);
|
P_DamageMobj(thing, killer, killer, 10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
192
src/p_maputl.c
192
src/p_maputl.c
|
@ -91,6 +91,71 @@ void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// P_ClosestPointOnLine3D
|
||||||
|
// Finds the closest point on a given line to the supplied point IN 3D!!!
|
||||||
|
//
|
||||||
|
void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result)
|
||||||
|
{
|
||||||
|
fixed_t startx = line->v1->x;
|
||||||
|
fixed_t starty = line->v1->y;
|
||||||
|
fixed_t startz = line->v1->z;
|
||||||
|
fixed_t dx = line->dx;
|
||||||
|
fixed_t dy = line->dy;
|
||||||
|
fixed_t dz = line->v2->z - line->v1->z;
|
||||||
|
|
||||||
|
// Determine t (the length of the vector from <20>Line[0]<5D> to <20>p<EFBFBD>)
|
||||||
|
fixed_t cx, cy, cz;
|
||||||
|
fixed_t vx, vy, vz;
|
||||||
|
fixed_t magnitude;
|
||||||
|
fixed_t t;
|
||||||
|
|
||||||
|
//Sub (p, &Line[0], &c);
|
||||||
|
cx = x - startx;
|
||||||
|
cy = y - starty;
|
||||||
|
cz = z - startz;
|
||||||
|
|
||||||
|
//Sub (&Line[1], &Line[0], &V);
|
||||||
|
vx = dx;
|
||||||
|
vy = dy;
|
||||||
|
vz = dz;
|
||||||
|
|
||||||
|
//Normalize (&V, &V);
|
||||||
|
magnitude = R_PointToDist2(0, line->v2->z, R_PointToDist2(line->v2->x, line->v2->y, startx, starty), startz);
|
||||||
|
vx = FixedDiv(vx, magnitude);
|
||||||
|
vy = FixedDiv(vy, magnitude);
|
||||||
|
vz = FixedDiv(vz, magnitude);
|
||||||
|
|
||||||
|
t = (FixedMul(vx, cx) + FixedMul(vy, cy) + FixedMul(vz, cz));
|
||||||
|
|
||||||
|
// Set closest point to the end if it extends past -Red
|
||||||
|
if (t <= 0)
|
||||||
|
{
|
||||||
|
result->x = line->v1->x;
|
||||||
|
result->y = line->v1->y;
|
||||||
|
result->z = line->v1->z;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (t >= magnitude)
|
||||||
|
{
|
||||||
|
result->x = line->v2->x;
|
||||||
|
result->y = line->v2->y;
|
||||||
|
result->z = line->v2->z;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the point between <20>Line[0]<5D> and <20>Line[1]<5D>
|
||||||
|
vx = FixedMul(vx, t);
|
||||||
|
vy = FixedMul(vy, t);
|
||||||
|
vz = FixedMul(vz, t);
|
||||||
|
|
||||||
|
//Add (&Line[0], &V, out);
|
||||||
|
result->x = startx + vx;
|
||||||
|
result->y = starty + vy;
|
||||||
|
result->z = startz + vz;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_PointOnLineSide
|
// P_PointOnLineSide
|
||||||
// Returns 0 or 1
|
// Returns 0 or 1
|
||||||
|
@ -255,7 +320,7 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
|
||||||
// Sets opentop and openbottom to the window through a two sided line.
|
// Sets opentop and openbottom to the window through a two sided line.
|
||||||
// OPTIMIZE: keep this precalculated
|
// OPTIMIZE: keep this precalculated
|
||||||
//
|
//
|
||||||
fixed_t opentop, openbottom, openrange, lowfloor;
|
fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
|
||||||
|
|
||||||
// P_CameraLineOpening
|
// P_CameraLineOpening
|
||||||
// P_LineOpening, but for camera
|
// P_LineOpening, but for camera
|
||||||
|
@ -278,7 +343,12 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
|
|
||||||
// Cameras use the heightsec's heights rather then the actual sector heights.
|
// Cameras use the heightsec's heights rather then the actual sector heights.
|
||||||
// If you can see through it, why not move the camera through it too?
|
// If you can see through it, why not move the camera through it too?
|
||||||
if (front->heightsec >= 0)
|
if (front->camsec >= 0)
|
||||||
|
{
|
||||||
|
frontfloor = sectors[front->camsec].floorheight;
|
||||||
|
frontceiling = sectors[front->camsec].ceilingheight;
|
||||||
|
}
|
||||||
|
else if (front->heightsec >= 0)
|
||||||
{
|
{
|
||||||
frontfloor = sectors[front->heightsec].floorheight;
|
frontfloor = sectors[front->heightsec].floorheight;
|
||||||
frontceiling = sectors[front->heightsec].ceilingheight;
|
frontceiling = sectors[front->heightsec].ceilingheight;
|
||||||
|
@ -288,7 +358,12 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
frontfloor = front->floorheight;
|
frontfloor = front->floorheight;
|
||||||
frontceiling = front->ceilingheight;
|
frontceiling = front->ceilingheight;
|
||||||
}
|
}
|
||||||
if (back->heightsec >= 0)
|
if (back->camsec >= 0)
|
||||||
|
{
|
||||||
|
backfloor = sectors[back->camsec].floorheight;
|
||||||
|
backceiling = sectors[back->camsec].ceilingheight;
|
||||||
|
}
|
||||||
|
else if (back->heightsec >= 0)
|
||||||
{
|
{
|
||||||
backfloor = sectors[back->heightsec].floorheight;
|
backfloor = sectors[back->heightsec].floorheight;
|
||||||
backceiling = sectors[back->heightsec].ceilingheight;
|
backceiling = sectors[back->heightsec].ceilingheight;
|
||||||
|
@ -303,9 +378,15 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
fixed_t thingtop = mapcampointer->z + mapcampointer->height;
|
fixed_t thingtop = mapcampointer->z + mapcampointer->height;
|
||||||
|
|
||||||
if (frontceiling < backceiling)
|
if (frontceiling < backceiling)
|
||||||
|
{
|
||||||
opentop = frontceiling;
|
opentop = frontceiling;
|
||||||
|
highceiling = backceiling;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
opentop = backceiling;
|
opentop = backceiling;
|
||||||
|
highceiling = frontceiling;
|
||||||
|
}
|
||||||
|
|
||||||
if (frontfloor > backfloor)
|
if (frontfloor > backfloor)
|
||||||
{
|
{
|
||||||
|
@ -322,13 +403,12 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
if (front->ffloors || back->ffloors)
|
if (front->ffloors || back->ffloors)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
fixed_t highestceiling = highceiling;
|
||||||
fixed_t lowestceiling = opentop;
|
fixed_t lowestceiling = opentop;
|
||||||
fixed_t highestfloor = openbottom;
|
fixed_t highestfloor = openbottom;
|
||||||
fixed_t lowestfloor = lowfloor;
|
fixed_t lowestfloor = lowfloor;
|
||||||
fixed_t delta1, delta2;
|
fixed_t delta1, delta2;
|
||||||
|
|
||||||
thingtop = mapcampointer->z + mapcampointer->height;
|
|
||||||
|
|
||||||
// Check for frontsector's fake floors
|
// Check for frontsector's fake floors
|
||||||
if (front->ffloors)
|
if (front->ffloors)
|
||||||
for (rover = front->ffloors; rover; rover = rover->next)
|
for (rover = front->ffloors; rover; rover = rover->next)
|
||||||
|
@ -340,6 +420,8 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
||||||
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
|
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
|
||||||
lowestceiling = *rover->bottomheight;
|
lowestceiling = *rover->bottomheight;
|
||||||
|
else if (*rover->bottomheight < highestceiling && delta1 >= delta2)
|
||||||
|
highestceiling = *rover->bottomheight;
|
||||||
|
|
||||||
if (*rover->topheight > highestfloor && delta1 < delta2)
|
if (*rover->topheight > highestfloor && delta1 < delta2)
|
||||||
highestfloor = *rover->topheight;
|
highestfloor = *rover->topheight;
|
||||||
|
@ -358,6 +440,8 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
||||||
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
|
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
|
||||||
lowestceiling = *rover->bottomheight;
|
lowestceiling = *rover->bottomheight;
|
||||||
|
else if (*rover->bottomheight < highestceiling && delta1 >= delta2)
|
||||||
|
highestceiling = *rover->bottomheight;
|
||||||
|
|
||||||
if (*rover->topheight > highestfloor && delta1 < delta2)
|
if (*rover->topheight > highestfloor && delta1 < delta2)
|
||||||
highestfloor = *rover->topheight;
|
highestfloor = *rover->topheight;
|
||||||
|
@ -365,6 +449,9 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
lowestfloor = *rover->topheight;
|
lowestfloor = *rover->topheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (highestceiling < highceiling)
|
||||||
|
highceiling = highestceiling;
|
||||||
|
|
||||||
if (highestfloor > openbottom)
|
if (highestfloor > openbottom)
|
||||||
openbottom = highestfloor;
|
openbottom = highestfloor;
|
||||||
|
|
||||||
|
@ -407,14 +494,16 @@ void P_LineOpening(line_t *linedef)
|
||||||
I_Assert(front != NULL);
|
I_Assert(front != NULL);
|
||||||
I_Assert(back != NULL);
|
I_Assert(back != NULL);
|
||||||
|
|
||||||
if (tmthing)
|
|
||||||
{
|
|
||||||
fixed_t thingtop = tmthing->z + tmthing->height;
|
|
||||||
|
|
||||||
if (front->ceilingheight < back->ceilingheight)
|
if (front->ceilingheight < back->ceilingheight)
|
||||||
|
{
|
||||||
opentop = front->ceilingheight;
|
opentop = front->ceilingheight;
|
||||||
|
highceiling = back->ceilingheight;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
opentop = back->ceilingheight;
|
opentop = back->ceilingheight;
|
||||||
|
highceiling = front->ceilingheight;
|
||||||
|
}
|
||||||
|
|
||||||
if (front->floorheight > back->floorheight)
|
if (front->floorheight > back->floorheight)
|
||||||
{
|
{
|
||||||
|
@ -427,6 +516,10 @@ void P_LineOpening(line_t *linedef)
|
||||||
lowfloor = front->floorheight;
|
lowfloor = front->floorheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmthing)
|
||||||
|
{
|
||||||
|
fixed_t thingtop = tmthing->z + tmthing->height;
|
||||||
|
|
||||||
// Check for fake floors in the sector.
|
// Check for fake floors in the sector.
|
||||||
if (front->ffloors || back->ffloors
|
if (front->ffloors || back->ffloors
|
||||||
#ifdef POLYOBJECTS
|
#ifdef POLYOBJECTS
|
||||||
|
@ -436,16 +529,11 @@ void P_LineOpening(line_t *linedef)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
|
||||||
|
fixed_t highestceiling = highceiling;
|
||||||
fixed_t lowestceiling = opentop;
|
fixed_t lowestceiling = opentop;
|
||||||
fixed_t highestfloor = openbottom;
|
fixed_t highestfloor = openbottom;
|
||||||
fixed_t lowestfloor = lowfloor;
|
fixed_t lowestfloor = lowfloor;
|
||||||
fixed_t delta1;
|
fixed_t delta1, delta2;
|
||||||
fixed_t delta2;
|
|
||||||
|
|
||||||
if (!tmthing)
|
|
||||||
goto no_thing;
|
|
||||||
|
|
||||||
thingtop = tmthing->z + tmthing->height;
|
|
||||||
|
|
||||||
// Check for frontsector's fake floors
|
// Check for frontsector's fake floors
|
||||||
for (rover = front->ffloors; rover; rover = rover->next)
|
for (rover = front->ffloors; rover; rover = rover->next)
|
||||||
|
@ -455,22 +543,23 @@ void P_LineOpening(line_t *linedef)
|
||||||
|
|
||||||
delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
||||||
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
||||||
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
|
|
||||||
|
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_PLATFORM))
|
if (*rover->bottomheight < lowestceiling)
|
||||||
lowestceiling = *rover->bottomheight;
|
lowestceiling = *rover->bottomheight;
|
||||||
}
|
else if (*rover->bottomheight < highestceiling)
|
||||||
if (*rover->topheight < highestfloor && delta1 >= delta2)
|
highestceiling = *rover->bottomheight;
|
||||||
{
|
|
||||||
if (!(rover->flags & FF_REVERSEPLATFORM))
|
|
||||||
lowestceiling = *rover->topheight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*rover->topheight > highestfloor && delta1 < delta2)
|
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
||||||
|
{
|
||||||
|
if (*rover->topheight > highestfloor)
|
||||||
highestfloor = *rover->topheight;
|
highestfloor = *rover->topheight;
|
||||||
else if (*rover->topheight > lowestfloor && delta1 < delta2)
|
else if (*rover->topheight > lowestfloor)
|
||||||
lowestfloor = *rover->topheight;
|
lowestfloor = *rover->topheight;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for backsectors fake floors
|
// Check for backsectors fake floors
|
||||||
for (rover = back->ffloors; rover; rover = rover->next)
|
for (rover = back->ffloors; rover; rover = rover->next)
|
||||||
|
@ -480,22 +569,23 @@ void P_LineOpening(line_t *linedef)
|
||||||
|
|
||||||
delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
||||||
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)));
|
||||||
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
|
|
||||||
|
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_PLATFORM))
|
if (*rover->bottomheight < lowestceiling)
|
||||||
lowestceiling = *rover->bottomheight;
|
lowestceiling = *rover->bottomheight;
|
||||||
}
|
else if (*rover->bottomheight < highestceiling)
|
||||||
if (*rover->topheight < highestfloor && delta1 >= delta2)
|
highestceiling = *rover->bottomheight;
|
||||||
{
|
|
||||||
if (!(rover->flags & FF_REVERSEPLATFORM))
|
|
||||||
lowestceiling = *rover->topheight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*rover->topheight > highestfloor && delta1 < delta2)
|
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
||||||
|
{
|
||||||
|
if (*rover->topheight > highestfloor)
|
||||||
highestfloor = *rover->topheight;
|
highestfloor = *rover->topheight;
|
||||||
else if (*rover->topheight > lowestfloor && delta1 < delta2)
|
else if (*rover->topheight > lowestfloor)
|
||||||
lowestfloor = *rover->topheight;
|
lowestfloor = *rover->topheight;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef POLYOBJECTS
|
#ifdef POLYOBJECTS
|
||||||
// Treat polyobj's backsector like a 3D Floor
|
// Treat polyobj's backsector like a 3D Floor
|
||||||
|
@ -507,6 +597,8 @@ void P_LineOpening(line_t *linedef)
|
||||||
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
|
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
|
||||||
if (polysec->floorheight < lowestceiling && delta1 >= delta2)
|
if (polysec->floorheight < lowestceiling && delta1 >= delta2)
|
||||||
lowestceiling = polysec->floorheight;
|
lowestceiling = polysec->floorheight;
|
||||||
|
else if (polysec->floorheight < highestceiling && delta1 >= delta2)
|
||||||
|
highestceiling = polysec->floorheight;
|
||||||
|
|
||||||
if (polysec->ceilingheight > highestfloor && delta1 < delta2)
|
if (polysec->ceilingheight > highestfloor && delta1 < delta2)
|
||||||
highestfloor = polysec->ceilingheight;
|
highestfloor = polysec->ceilingheight;
|
||||||
|
@ -514,6 +606,8 @@ void P_LineOpening(line_t *linedef)
|
||||||
lowestfloor = polysec->ceilingheight;
|
lowestfloor = polysec->ceilingheight;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (highestceiling < highceiling)
|
||||||
|
highceiling = highestceiling;
|
||||||
|
|
||||||
if (highestfloor > openbottom)
|
if (highestfloor > openbottom)
|
||||||
openbottom = highestfloor;
|
openbottom = highestfloor;
|
||||||
|
@ -524,28 +618,8 @@ void P_LineOpening(line_t *linedef)
|
||||||
if (lowestfloor > lowfloor)
|
if (lowestfloor > lowfloor)
|
||||||
lowfloor = lowestfloor;
|
lowfloor = lowestfloor;
|
||||||
}
|
}
|
||||||
openrange = opentop - openbottom;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (front->ceilingheight < back->ceilingheight)
|
|
||||||
opentop = front->ceilingheight;
|
|
||||||
else
|
|
||||||
opentop = back->ceilingheight;
|
|
||||||
|
|
||||||
if (front->floorheight > back->floorheight)
|
|
||||||
{
|
|
||||||
openbottom = front->floorheight;
|
|
||||||
lowfloor = back->floorheight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
openbottom = back->floorheight;
|
|
||||||
lowfloor = front->floorheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
no_thing:
|
|
||||||
|
|
||||||
openrange = opentop - openbottom;
|
openrange = opentop - openbottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,10 +778,14 @@ void P_SetThingPosition(mobj_t *thing)
|
||||||
|
|
||||||
// Allows you to 'step' on a new linedef exec when the previous
|
// Allows you to 'step' on a new linedef exec when the previous
|
||||||
// sector's floor is the same height.
|
// sector's floor is the same height.
|
||||||
if (thing->player && oldsec != NULL && thing->subsector
|
if (thing->player && oldsec != NULL && thing->subsector && oldsec != thing->subsector->sector)
|
||||||
&& oldsec != thing->subsector->sector
|
|
||||||
&& thing->z <= thing->subsector->sector->floorheight)
|
|
||||||
{
|
{
|
||||||
|
if (thing->eflags & MFE_VERTICALFLIP)
|
||||||
|
{
|
||||||
|
if (thing->z + thing->height >= thing->subsector->sector->ceilingheight)
|
||||||
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
|
}
|
||||||
|
else if (thing->z <= thing->subsector->sector->floorheight)
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
|
||||||
|
|
||||||
FUNCMATH fixed_t P_AproxDistance(fixed_t dx, fixed_t dy);
|
FUNCMATH fixed_t P_AproxDistance(fixed_t dx, fixed_t dy);
|
||||||
void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result);
|
void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result);
|
||||||
|
void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result);
|
||||||
INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line);
|
INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line);
|
||||||
void P_MakeDivline(line_t *li, divline_t *dl);
|
void P_MakeDivline(line_t *li, divline_t *dl);
|
||||||
void P_CameraLineOpening(line_t *plinedef);
|
void P_CameraLineOpening(line_t *plinedef);
|
||||||
|
@ -53,7 +54,7 @@ void P_SetPrecipitationThingPosition(precipmobj_t *thing);
|
||||||
void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
|
void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
|
||||||
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
|
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
|
||||||
|
|
||||||
extern fixed_t opentop, openbottom, openrange, lowfloor;
|
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
|
||||||
|
|
||||||
void P_LineOpening(line_t *plinedef);
|
void P_LineOpening(line_t *plinedef);
|
||||||
|
|
||||||
|
|
859
src/p_mobj.c
859
src/p_mobj.c
File diff suppressed because it is too large
Load diff
|
@ -120,14 +120,8 @@ static inline void P_NetArchivePlayers(void)
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
// ticcmd write
|
// no longer send ticcmds, player name, skin, or color
|
||||||
WRITESINT8(save_p, players[i].cmd.forwardmove);
|
|
||||||
WRITESINT8(save_p, players[i].cmd.sidemove);
|
|
||||||
WRITEINT16(save_p, players[i].cmd.angleturn);
|
|
||||||
WRITEINT16(save_p, players[i].cmd.aiming);
|
|
||||||
WRITEUINT16(save_p, players[i].cmd.buttons);
|
|
||||||
|
|
||||||
WRITESTRINGN(save_p, player_names[i], MAXPLAYERNAME);
|
|
||||||
WRITEANGLE(save_p, players[i].aiming);
|
WRITEANGLE(save_p, players[i].aiming);
|
||||||
WRITEANGLE(save_p, players[i].awayviewaiming);
|
WRITEANGLE(save_p, players[i].awayviewaiming);
|
||||||
WRITEINT32(save_p, players[i].awayviewtics);
|
WRITEINT32(save_p, players[i].awayviewtics);
|
||||||
|
@ -148,8 +142,6 @@ static inline void P_NetArchivePlayers(void)
|
||||||
WRITEUINT16(save_p, players[i].flashpal);
|
WRITEUINT16(save_p, players[i].flashpal);
|
||||||
WRITEUINT16(save_p, players[i].flashcount);
|
WRITEUINT16(save_p, players[i].flashcount);
|
||||||
|
|
||||||
WRITEUINT8(save_p, players[i].skincolor);
|
|
||||||
WRITEINT32(save_p, players[i].skin);
|
|
||||||
WRITEUINT32(save_p, players[i].score);
|
WRITEUINT32(save_p, players[i].score);
|
||||||
WRITEINT32(save_p, players[i].dashspeed);
|
WRITEINT32(save_p, players[i].dashspeed);
|
||||||
WRITEINT32(save_p, players[i].dashtime);
|
WRITEINT32(save_p, players[i].dashtime);
|
||||||
|
@ -289,26 +281,22 @@ static inline void P_NetUnArchivePlayers(void)
|
||||||
{
|
{
|
||||||
INT32 i, j;
|
INT32 i, j;
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
ticcmd_t tmptic;
|
|
||||||
|
|
||||||
if (READUINT32(save_p) != ARCHIVEBLOCK_PLAYERS)
|
if (READUINT32(save_p) != ARCHIVEBLOCK_PLAYERS)
|
||||||
I_Error("Bad $$$.sav at archive block Players");
|
I_Error("Bad $$$.sav at archive block Players");
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
memset(&players[i], 0, sizeof (player_t));
|
// Do NOT memset player struct to 0
|
||||||
|
// other areas may initialize data elsewhere
|
||||||
|
//memset(&players[i], 0, sizeof (player_t));
|
||||||
if (!playeringame[i])
|
if (!playeringame[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
memset(&tmptic, 0, sizeof(ticcmd_t));
|
// NOTE: sending tics should (hopefully) no longer be necessary
|
||||||
tmptic.forwardmove = READSINT8(save_p);
|
// sending player names, skin and color should not be necessary at all!
|
||||||
tmptic.sidemove = READSINT8(save_p);
|
// (that data is handled in the server config now)
|
||||||
tmptic.angleturn = READINT16(save_p);
|
|
||||||
tmptic.aiming = READINT16(save_p);
|
|
||||||
tmptic.buttons = READUINT16(save_p);
|
|
||||||
G_CopyTiccmd(&players[i].cmd, &tmptic, 1);
|
|
||||||
|
|
||||||
READSTRINGN(save_p, player_names[i], MAXPLAYERNAME);
|
|
||||||
players[i].aiming = READANGLE(save_p);
|
players[i].aiming = READANGLE(save_p);
|
||||||
players[i].awayviewaiming = READANGLE(save_p);
|
players[i].awayviewaiming = READANGLE(save_p);
|
||||||
players[i].awayviewtics = READINT32(save_p);
|
players[i].awayviewtics = READINT32(save_p);
|
||||||
|
@ -329,8 +317,6 @@ static inline void P_NetUnArchivePlayers(void)
|
||||||
players[i].flashpal = READUINT16(save_p);
|
players[i].flashpal = READUINT16(save_p);
|
||||||
players[i].flashcount = READUINT16(save_p);
|
players[i].flashcount = READUINT16(save_p);
|
||||||
|
|
||||||
players[i].skincolor = READUINT8(save_p);
|
|
||||||
players[i].skin = READINT32(save_p);
|
|
||||||
players[i].score = READUINT32(save_p);
|
players[i].score = READUINT32(save_p);
|
||||||
players[i].dashspeed = READINT32(save_p); // dashing speed
|
players[i].dashspeed = READINT32(save_p); // dashing speed
|
||||||
players[i].dashtime = READINT32(save_p); // dashing speed
|
players[i].dashtime = READINT32(save_p); // dashing speed
|
||||||
|
|
|
@ -220,6 +220,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||||
mapheaderinfo[num]->menuflags = 0;
|
mapheaderinfo[num]->menuflags = 0;
|
||||||
// TODO grades support for delfile (pfft yeah right)
|
// TODO grades support for delfile (pfft yeah right)
|
||||||
P_DeleteGrades(num);
|
P_DeleteGrades(num);
|
||||||
|
// an even further impossibility, delfile custom opts support
|
||||||
|
mapheaderinfo[num]->customopts = NULL;
|
||||||
|
mapheaderinfo[num]->numCustomOptions = 0;
|
||||||
|
|
||||||
DEH_WriteUndoline(va("# uload for map %d", i), NULL, UNDO_DONE);
|
DEH_WriteUndoline(va("# uload for map %d", i), NULL, UNDO_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,6 +682,7 @@ static void P_LoadSectors(lumpnum_t lumpnum)
|
||||||
ss->lines = NULL;
|
ss->lines = NULL;
|
||||||
|
|
||||||
ss->heightsec = -1;
|
ss->heightsec = -1;
|
||||||
|
ss->camsec = -1;
|
||||||
ss->floorlightsec = -1;
|
ss->floorlightsec = -1;
|
||||||
ss->ceilinglightsec = -1;
|
ss->ceilinglightsec = -1;
|
||||||
ss->crumblestate = 0;
|
ss->crumblestate = 0;
|
||||||
|
@ -2559,6 +2564,15 @@ noscript:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// oh god I hope this helps
|
||||||
|
// (addendum: apparently it does!
|
||||||
|
// none of this needs to be done because it's not the beginning of the map when
|
||||||
|
// a netgame save is being loaded, and could actively be harmful by messing with
|
||||||
|
// the client's view of the data.)
|
||||||
|
if (fromnetsave)
|
||||||
|
goto netgameskip;
|
||||||
|
// ==========
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
{
|
{
|
||||||
|
@ -2694,6 +2708,10 @@ noscript:
|
||||||
else if (gametype == GT_RACE && server && cv_usemapnumlaps.value)
|
else if (gametype == GT_RACE && server && cv_usemapnumlaps.value)
|
||||||
CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps);
|
CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps);
|
||||||
|
|
||||||
|
// ===========
|
||||||
|
// landing point for netgames.
|
||||||
|
netgameskip:
|
||||||
|
|
||||||
if (!dedicated)
|
if (!dedicated)
|
||||||
{
|
{
|
||||||
if (players[displayplayer].mo && (server || addedtogame))
|
if (players[displayplayer].mo && (server || addedtogame))
|
||||||
|
@ -2769,7 +2787,6 @@ noscript:
|
||||||
|
|
||||||
if (twodlevel)
|
if (twodlevel)
|
||||||
{
|
{
|
||||||
CV_SetValue(&cv_cam_dist, 320);
|
|
||||||
CV_SetValue(&cv_analog2, false);
|
CV_SetValue(&cv_analog2, false);
|
||||||
CV_SetValue(&cv_analog, false);
|
CV_SetValue(&cv_analog, false);
|
||||||
}
|
}
|
||||||
|
|
358
src/p_spec.c
358
src/p_spec.c
|
@ -1536,62 +1536,35 @@ static void P_AddExecutorDelay(line_t *line, mobj_t *mobj)
|
||||||
|
|
||||||
static sector_t *triplinecaller;
|
static sector_t *triplinecaller;
|
||||||
|
|
||||||
/** Runs a linedef executor.
|
/** Used by P_LinedefExecute to check a trigger linedef's conditions
|
||||||
* Can be called by:
|
* The linedef executor specials in the trigger linedef's sector are run if all conditions are met.
|
||||||
* - a player moving into a special sector or FOF.
|
* Return false cancels P_LinedefExecute, this happens if a condition is not met.
|
||||||
* - a pushable object moving into a special sector or FOF.
|
|
||||||
* - a ceiling or floor movement from a previous linedef executor finishing.
|
|
||||||
* - any object in a state with the A_LinedefExecute() action.
|
|
||||||
*
|
*
|
||||||
* \param tag Tag of the linedef executor to run.
|
* \param triggerline Trigger linedef to check conditions for; should NEVER be NULL.
|
||||||
* \param actor Object initiating the action; should not be NULL.
|
* \param actor Object initiating the action; should not be NULL.
|
||||||
* \param caller Sector in which the action was started. May be NULL.
|
* \param caller Sector in which the action was started. May be NULL.
|
||||||
* \sa P_ProcessLineSpecial
|
* \sa P_ProcessLineSpecial, P_LinedefExecute
|
||||||
* \author Graue <graue@oceanbase.org>
|
|
||||||
*/
|
*/
|
||||||
void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller)
|
||||||
{
|
{
|
||||||
sector_t *ctlsector;
|
sector_t *ctlsector;
|
||||||
fixed_t dist;
|
fixed_t dist = P_AproxDistance(triggerline->dx, triggerline->dy)>>FRACBITS;
|
||||||
size_t masterline, i, linecnt, sectori;
|
size_t i, linecnt, sectori;
|
||||||
INT16 specialtype;
|
INT16 specialtype = triggerline->special;
|
||||||
|
|
||||||
CONS_Debug(DBG_GAMELOGIC, "P_LinedefExecute: Executing trigger linedefs of tag %d\n", tag);
|
/////////////////////////////////////////////////
|
||||||
|
// Distance-checking/sector trigger conditions //
|
||||||
I_Assert(!actor || !P_MobjWasRemoved(actor)); // If actor is there, it must be valid.
|
/////////////////////////////////////////////////
|
||||||
|
|
||||||
for (masterline = 0; masterline < numlines; masterline++)
|
|
||||||
{
|
|
||||||
if (lines[masterline].tag != tag)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// "No More Enemies" takes care of itself.
|
|
||||||
if (lines[masterline].special == 313
|
|
||||||
// Each-time exectors handle themselves, too
|
|
||||||
|| lines[masterline].special == 301
|
|
||||||
|| lines[masterline].special == 306
|
|
||||||
|| lines[masterline].special == 310
|
|
||||||
|| lines[masterline].special == 312)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (lines[masterline].special < 300
|
|
||||||
|| lines[masterline].special > 399)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
specialtype = lines[masterline].special;
|
|
||||||
|
|
||||||
// Special handling for some executors
|
|
||||||
|
|
||||||
// Linetypes 303 and 304 require a specific
|
// Linetypes 303 and 304 require a specific
|
||||||
// number, or minimum or maximum, of rings.
|
// number, or minimum or maximum, of rings.
|
||||||
if (actor && actor->player && (specialtype == 303
|
if (specialtype == 303 || specialtype == 304)
|
||||||
|| specialtype == 304))
|
|
||||||
{
|
{
|
||||||
fixed_t rings = 0;
|
fixed_t rings = 0;
|
||||||
|
|
||||||
// With the passuse flag, count all player's
|
// With the passuse flag, count all player's
|
||||||
// rings.
|
// rings.
|
||||||
if (lines[masterline].flags & ML_EFFECT4)
|
if (triggerline->flags & ML_EFFECT4)
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
@ -1605,76 +1578,38 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (!(actor && actor->player))
|
||||||
|
return false; // no player to count rings from here, sorry
|
||||||
|
|
||||||
rings = actor->health-1;
|
rings = actor->health-1;
|
||||||
|
}
|
||||||
|
|
||||||
dist = P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS;
|
if (triggerline->flags & ML_NOCLIMB)
|
||||||
|
|
||||||
if (lines[masterline].flags & ML_NOCLIMB)
|
|
||||||
{
|
{
|
||||||
if (rings > dist)
|
if (rings > dist)
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else if (lines[masterline].flags & ML_BLOCKMONSTERS)
|
else if (triggerline->flags & ML_BLOCKMONSTERS)
|
||||||
{
|
{
|
||||||
if (rings < dist)
|
if (rings < dist)
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rings != dist)
|
if (rings != dist)
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (caller)
|
else if (specialtype >= 314 && specialtype <= 315)
|
||||||
{
|
|
||||||
if (GETSECSPECIAL(caller->special, 2) == 6)
|
|
||||||
{
|
|
||||||
if (!(ALL7EMERALDS(emeralds)))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (GETSECSPECIAL(caller->special, 2) == 7)
|
|
||||||
{
|
|
||||||
UINT8 mare;
|
|
||||||
|
|
||||||
if (!(maptol & TOL_NIGHTS))
|
|
||||||
return;
|
|
||||||
|
|
||||||
dist = P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS;
|
|
||||||
mare = P_FindLowestMare();
|
|
||||||
|
|
||||||
if (lines[masterline].flags & ML_NOCLIMB)
|
|
||||||
{
|
|
||||||
if (!(mare <= dist))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (lines[masterline].flags & ML_BLOCKMONSTERS)
|
|
||||||
{
|
|
||||||
if (!(mare >= dist))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(mare == dist))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If we were not triggered by a sector type especially for the purpose,
|
|
||||||
// a Linedef Executor linedef trigger is not handling sector triggers properly, return.
|
|
||||||
|
|
||||||
else if ((!GETSECSPECIAL(caller->special, 2) || GETSECSPECIAL(caller->special, 2) > 7) && (specialtype > 318))
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING,
|
|
||||||
M_GetText("Linedef executor trigger isn't handling sector triggers properly!\nspecialtype = %d, if you are not a dev, report this warning instance\nalong with the wad that caused it!\n"),
|
|
||||||
specialtype);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (specialtype >= 314 && specialtype <= 315)
|
|
||||||
{
|
{
|
||||||
msecnode_t *node;
|
msecnode_t *node;
|
||||||
mobj_t *mo;
|
mobj_t *mo;
|
||||||
INT32 numpush = 0;
|
INT32 numpush = 0;
|
||||||
INT32 numneeded = P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS;
|
INT32 numneeded = dist;
|
||||||
|
|
||||||
|
if (!caller)
|
||||||
|
return false; // we need a calling sector to find pushables in, silly!
|
||||||
|
|
||||||
// Count the pushables in this sector
|
// Count the pushables in this sector
|
||||||
node = caller->touching_thinglist; // things touching this sector
|
node = caller->touching_thinglist; // things touching this sector
|
||||||
|
@ -1686,68 +1621,136 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
node = node->m_snext;
|
node = node->m_snext;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lines[masterline].flags & ML_NOCLIMB) // Need at least or more
|
if (triggerline->flags & ML_NOCLIMB) // Need at least or more
|
||||||
{
|
{
|
||||||
if (numpush < numneeded)
|
if (numpush < numneeded)
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else if (lines[masterline].flags & ML_EFFECT4) // Need less than
|
else if (triggerline->flags & ML_EFFECT4) // Need less than
|
||||||
{
|
{
|
||||||
if (numpush >= numneeded)
|
if (numpush >= numneeded)
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else // Need exact
|
else // Need exact
|
||||||
{
|
{
|
||||||
if (numpush != numneeded)
|
if (numpush != numneeded)
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (caller)
|
||||||
|
|
||||||
if (specialtype >= 305 && specialtype <= 307)
|
|
||||||
{
|
{
|
||||||
if (!actor)
|
if (GETSECSPECIAL(caller->special, 2) == 6)
|
||||||
return;
|
{
|
||||||
|
if (!(ALL7EMERALDS(emeralds)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (GETSECSPECIAL(caller->special, 2) == 7)
|
||||||
|
{
|
||||||
|
UINT8 mare;
|
||||||
|
|
||||||
if (!actor->player)
|
if (!(maptol & TOL_NIGHTS))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (actor->player->charability != (P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS)/10)
|
mare = P_FindLowestMare();
|
||||||
return;
|
|
||||||
|
if (triggerline->flags & ML_NOCLIMB)
|
||||||
|
{
|
||||||
|
if (!(mare <= dist))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (triggerline->flags & ML_BLOCKMONSTERS)
|
||||||
|
{
|
||||||
|
if (!(mare >= dist))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!(mare == dist))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If we were not triggered by a sector type especially for the purpose,
|
||||||
|
// a Linedef Executor linedef trigger is not handling sector triggers properly, return.
|
||||||
|
|
||||||
|
else if ((!GETSECSPECIAL(caller->special, 2) || GETSECSPECIAL(caller->special, 2) > 7) && (specialtype > 320))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING,
|
||||||
|
M_GetText("Linedef executor trigger isn't handling sector triggers properly!\nspecialtype = %d, if you are not a dev, report this warning instance\nalong with the wad that caused it!\n"),
|
||||||
|
specialtype);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////
|
||||||
|
// Miscellaneous trigger conditions //
|
||||||
|
//////////////////////////////////////
|
||||||
|
|
||||||
|
switch (specialtype)
|
||||||
|
{
|
||||||
|
case 305: // continuous
|
||||||
|
case 306: // each time
|
||||||
|
case 307: // once
|
||||||
|
if (!(actor && actor->player && actor->player->charability != dist/10))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 309: // continuous
|
||||||
|
case 310: // each time
|
||||||
// Only red team members can activate this.
|
// Only red team members can activate this.
|
||||||
if ((specialtype == 309 || specialtype == 310)
|
if (!(actor && actor->player && actor->player->ctfteam == 1))
|
||||||
&& !(actor && actor->player && actor->player->ctfteam == 1))
|
return false;
|
||||||
return;
|
break;
|
||||||
|
case 311: // continuous
|
||||||
|
case 312: // each time
|
||||||
// Only blue team members can activate this.
|
// Only blue team members can activate this.
|
||||||
if ((specialtype == 311 || specialtype == 312)
|
if (!(actor && actor->player && actor->player->ctfteam == 2))
|
||||||
&& !(actor && actor->player && actor->player->ctfteam == 2))
|
return false;
|
||||||
return;
|
break;
|
||||||
|
case 317: // continuous
|
||||||
// Unlockable triggers required
|
case 318: // once
|
||||||
if (specialtype <= 318 && specialtype >= 317)
|
{ // Unlockable triggers required
|
||||||
{
|
INT32 trigid = (INT32)(sides[triggerline->sidenum[0]].textureoffset>>FRACBITS);
|
||||||
INT32 trigid = (INT32)(sides[lines[masterline].sidenum[0]].textureoffset>>FRACBITS);
|
|
||||||
|
|
||||||
if ((modifiedgame && !savemoddata) || (netgame || multiplayer))
|
if ((modifiedgame && !savemoddata) || (netgame || multiplayer))
|
||||||
return;
|
return false;
|
||||||
else if (trigid < 0 || trigid > 31) // limited by 32 bit variable
|
else if (trigid < 0 || trigid > 31) // limited by 32 bit variable
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_GAMELOGIC, "Unlockable trigger (sidedef %hu): bad trigger ID %d\n", lines[masterline].sidenum[0], trigid);
|
CONS_Debug(DBG_GAMELOGIC, "Unlockable trigger (sidedef %hu): bad trigger ID %d\n", triggerline->sidenum[0], trigid);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else if (!(unlocktriggers & (1 << trigid)))
|
else if (!(unlocktriggers & (1 << trigid)))
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 319: // continuous
|
||||||
|
case 320: // once
|
||||||
|
{ // An unlockable itself must be unlocked!
|
||||||
|
INT32 unlockid = (INT32)(sides[triggerline->sidenum[0]].textureoffset>>FRACBITS);
|
||||||
|
|
||||||
|
if ((modifiedgame && !savemoddata) || (netgame || multiplayer))
|
||||||
|
return false;
|
||||||
|
else if (unlockid < 0 || unlockid >= MAXUNLOCKABLES) // limited by unlockable count
|
||||||
|
{
|
||||||
|
CONS_Debug(DBG_GAMELOGIC, "Unlockable check (sidedef %hu): bad unlockable ID %d\n", triggerline->sidenum[0], unlockid);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (!(unlockables[unlockid-1].unlocked))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Processing linedef specials //
|
||||||
|
/////////////////////////////////
|
||||||
|
|
||||||
triplinecaller = caller;
|
triplinecaller = caller;
|
||||||
ctlsector = lines[masterline].frontsector;
|
ctlsector = triggerline->frontsector;
|
||||||
sectori = (size_t)(ctlsector - sectors);
|
sectori = (size_t)(ctlsector - sectors);
|
||||||
linecnt = ctlsector->linecount;
|
linecnt = ctlsector->linecount;
|
||||||
|
|
||||||
if (lines[masterline].flags & ML_EFFECT5) // disregard order for efficiency
|
if (triggerline->flags & ML_EFFECT5) // disregard order for efficiency
|
||||||
{
|
{
|
||||||
for (i = 0; i < linecnt; i++)
|
for (i = 0; i < linecnt; i++)
|
||||||
if (ctlsector->lines[i]->special >= 400
|
if (ctlsector->lines[i]->special >= 400
|
||||||
|
@ -1765,7 +1768,7 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
size_t j, masterlineindex = (size_t)-1;
|
size_t j, masterlineindex = (size_t)-1;
|
||||||
|
|
||||||
for (i = 0; i < linecnt; i++)
|
for (i = 0; i < linecnt; i++)
|
||||||
if (ctlsector->lines[i] == &lines[masterline])
|
if (ctlsector->lines[i] == triggerline)
|
||||||
{
|
{
|
||||||
masterlineindex = i;
|
masterlineindex = i;
|
||||||
break;
|
break;
|
||||||
|
@ -1805,7 +1808,7 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes);
|
const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes);
|
||||||
CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n",
|
CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n",
|
||||||
sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v1->x, ctlsector->lines[i]->v1->y);
|
sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v1->x, ctlsector->lines[i]->v1->y);
|
||||||
return; // abort
|
return false; // abort
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // v1 to v2
|
else // v1 to v2
|
||||||
|
@ -1831,7 +1834,7 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes);
|
const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes);
|
||||||
CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n",
|
CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n",
|
||||||
sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v2->x, ctlsector->lines[i]->v2->y);
|
sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v2->x, ctlsector->lines[i]->v2->y);
|
||||||
return; // abort
|
return false; // abort
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1849,10 +1852,10 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special type 308, 307, 302, 304, 315, and 318 only work once
|
// Special type 308, 307, 302, 304, 315, 318, and 320 only work once
|
||||||
if (specialtype == 302 || specialtype == 304 || specialtype == 307 || specialtype == 308 || specialtype == 315 || specialtype == 318)
|
if (specialtype == 302 || specialtype == 304 || specialtype == 307 || specialtype == 308 || specialtype == 315 || specialtype == 318 || specialtype == 320)
|
||||||
{
|
{
|
||||||
lines[masterline].special = 0; // Clear it out
|
triggerline->special = 0; // Clear it out
|
||||||
|
|
||||||
// Hmm, I'm thinking that we shouldn't touch the sector special, incase
|
// Hmm, I'm thinking that we shouldn't touch the sector special, incase
|
||||||
// we have continuous executors associated with it, too?
|
// we have continuous executors associated with it, too?
|
||||||
|
@ -1861,6 +1864,50 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
caller->special = (UINT16)(caller->special-(GETSECSPECIAL(caller->special, 2) << 4)); // Only remove the relevant section
|
caller->special = (UINT16)(caller->special-(GETSECSPECIAL(caller->special, 2) << 4)); // Only remove the relevant section
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Runs a linedef executor.
|
||||||
|
* Can be called by:
|
||||||
|
* - a player moving into a special sector or FOF.
|
||||||
|
* - a pushable object moving into a special sector or FOF.
|
||||||
|
* - a ceiling or floor movement from a previous linedef executor finishing.
|
||||||
|
* - any object in a state with the A_LinedefExecute() action.
|
||||||
|
*
|
||||||
|
* \param tag Tag of the linedef executor to run.
|
||||||
|
* \param actor Object initiating the action; should not be NULL.
|
||||||
|
* \param caller Sector in which the action was started. May be NULL.
|
||||||
|
* \sa P_ProcessLineSpecial, P_RunTriggerLinedef
|
||||||
|
* \author Graue <graue@oceanbase.org>
|
||||||
|
*/
|
||||||
|
void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||||
|
{
|
||||||
|
size_t masterline;
|
||||||
|
|
||||||
|
CONS_Debug(DBG_GAMELOGIC, "P_LinedefExecute: Executing trigger linedefs of tag %d\n", tag);
|
||||||
|
|
||||||
|
I_Assert(!actor || !P_MobjWasRemoved(actor)); // If actor is there, it must be valid.
|
||||||
|
|
||||||
|
for (masterline = 0; masterline < numlines; masterline++)
|
||||||
|
{
|
||||||
|
if (lines[masterline].tag != tag)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// "No More Enemies" takes care of itself.
|
||||||
|
if (lines[masterline].special == 313
|
||||||
|
// Each-time exectors handle themselves, too
|
||||||
|
|| lines[masterline].special == 301
|
||||||
|
|| lines[masterline].special == 306
|
||||||
|
|| lines[masterline].special == 310
|
||||||
|
|| lines[masterline].special == 312)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (lines[masterline].special < 300
|
||||||
|
|| lines[masterline].special > 399)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!P_RunTriggerLinedef(&lines[masterline], actor, caller))
|
||||||
|
return; // cancel P_LinedefExecute if function returns false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2201,21 +2248,15 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo)
|
||||||
break;*/
|
break;*/
|
||||||
|
|
||||||
case 409: // Change tagged sectors' tag
|
case 409: // Change tagged sectors' tag
|
||||||
// (formerly "Change calling sectors' tag", but behavior
|
// (formerly "Change calling sectors' tag", but behavior was changed)
|
||||||
// was changed)
|
|
||||||
{
|
{
|
||||||
while ((secnum = P_FindSectorFromLineTag(line,
|
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
|
||||||
secnum)) != -1)
|
P_ChangeSectorTag(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS));
|
||||||
{
|
|
||||||
P_ChangeSectorTag(secnum,
|
|
||||||
(INT16)(P_AproxDistance(line->dx, line->dy)
|
|
||||||
>>FRACBITS));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 410: // Change front sector's tag
|
case 410: // Change front sector's tag
|
||||||
P_ChangeSectorTag((UINT32)(line->frontsector - sectors), (INT16)(P_AproxDistance(line->dx, line->dy)>>FRACBITS));
|
P_ChangeSectorTag((UINT32)(line->frontsector - sectors), (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 411: // Stop floor/ceiling movement in tagged sector(s)
|
case 411: // Stop floor/ceiling movement in tagged sector(s)
|
||||||
|
@ -3109,7 +3150,7 @@ void P_SetupSignExit(player_t *player)
|
||||||
//
|
//
|
||||||
// Checks to see if a flag is at its base.
|
// Checks to see if a flag is at its base.
|
||||||
//
|
//
|
||||||
static boolean P_IsFlagAtBase(mobjtype_t flag)
|
boolean P_IsFlagAtBase(mobjtype_t flag)
|
||||||
{
|
{
|
||||||
thinker_t *think;
|
thinker_t *think;
|
||||||
mobj_t *mo;
|
mobj_t *mo;
|
||||||
|
@ -3388,14 +3429,14 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||||
|
|
||||||
P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before
|
P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before
|
||||||
|
|
||||||
if (gametype == GT_CTF && (player->gotflag & GF_REDFLAG || player->gotflag & GF_BLUEFLAG))
|
if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||||
P_PlayerFlagBurst(player, false);
|
P_PlayerFlagBurst(player, false);
|
||||||
break;
|
break;
|
||||||
case 12: // Space Countdown
|
case 12: // Space Countdown
|
||||||
if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL && !player->powers[pw_spacetime])
|
if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL && !player->powers[pw_spacetime])
|
||||||
player->powers[pw_spacetime] = spacetimetics + 1;
|
player->powers[pw_spacetime] = spacetimetics + 1;
|
||||||
break;
|
break;
|
||||||
case 13: // Ramp Sector (Increase step-up)
|
case 13: // Ramp Sector (Increase step-up/down)
|
||||||
case 14: // Non-Ramp Sector (Don't step-down)
|
case 14: // Non-Ramp Sector (Don't step-down)
|
||||||
case 15: // Bouncy Sector (FOF Control Only)
|
case 15: // Bouncy Sector (FOF Control Only)
|
||||||
break;
|
break;
|
||||||
|
@ -4056,8 +4097,7 @@ DoneSection2:
|
||||||
junk.dx = v2.x - v1.x;
|
junk.dx = v2.x - v1.x;
|
||||||
junk.dy = v2.y - v1.y;
|
junk.dy = v2.y - v1.y;
|
||||||
|
|
||||||
P_ClosestPointOnLine(player->mo->x, player->mo->y, &junk, &resultlow);
|
P_ClosestPointOnLine3D(player->mo->x, player->mo->y, player->mo->z, &junk, &resultlow);
|
||||||
resultlow.z = waypointmid->z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waypointmid and Waypointhigh:
|
// Waypointmid and Waypointhigh:
|
||||||
|
@ -4074,11 +4114,10 @@ DoneSection2:
|
||||||
junk.dx = v2.x - v1.x;
|
junk.dx = v2.x - v1.x;
|
||||||
junk.dy = v2.y - v1.y;
|
junk.dy = v2.y - v1.y;
|
||||||
|
|
||||||
P_ClosestPointOnLine(player->mo->x, player->mo->y, &junk, &resulthigh);
|
P_ClosestPointOnLine3D(player->mo->x, player->mo->y, player->mo->z, &junk, &resulthigh);
|
||||||
resulthigh.z = waypointhigh->z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3D support not available yet. Need a 3D version of P_ClosestPointOnLine.
|
// 3D support now available. Disregard the previous notice here. -Red
|
||||||
|
|
||||||
P_UnsetThingPosition(player->mo);
|
P_UnsetThingPosition(player->mo);
|
||||||
P_ResetPlayer(player);
|
P_ResetPlayer(player);
|
||||||
|
@ -4086,23 +4125,24 @@ DoneSection2:
|
||||||
|
|
||||||
if (lines[lineindex].flags & ML_EFFECT1) // Don't wrap
|
if (lines[lineindex].flags & ML_EFFECT1) // Don't wrap
|
||||||
{
|
{
|
||||||
if (waypointhigh)
|
highest->flags |= MF_SLIDEME;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Changing the conditions on these ifs to fix issues with snapping to the wrong spot -Red
|
||||||
|
if ((lines[lineindex].flags & ML_EFFECT1) && waypointmid->health == 0)
|
||||||
{
|
{
|
||||||
closest = waypointhigh;
|
closest = waypointhigh;
|
||||||
player->mo->x = resulthigh.x;
|
player->mo->x = resulthigh.x;
|
||||||
player->mo->y = resulthigh.y;
|
player->mo->y = resulthigh.y;
|
||||||
player->mo->z = resulthigh.z - P_GetPlayerHeight(player);
|
player->mo->z = resulthigh.z - P_GetPlayerHeight(player);
|
||||||
}
|
}
|
||||||
else if (waypointlow)
|
else if ((lines[lineindex].flags & ML_EFFECT1) && waypointmid->health == highest->health)
|
||||||
{
|
{
|
||||||
closest = waypointmid;
|
closest = waypointmid;
|
||||||
player->mo->x = resultlow.x;
|
player->mo->x = resultlow.x;
|
||||||
player->mo->y = resultlow.y;
|
player->mo->y = resultlow.y;
|
||||||
player->mo->z = resultlow.z - P_GetPlayerHeight(player);
|
player->mo->z = resultlow.z - P_GetPlayerHeight(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
highest->flags |= MF_SLIDEME;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (P_AproxDistance(P_AproxDistance(player->mo->x-resultlow.x, player->mo->y-resultlow.y),
|
if (P_AproxDistance(P_AproxDistance(player->mo->x-resultlow.x, player->mo->y-resultlow.y),
|
||||||
|
@ -5528,6 +5568,9 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
|
|
||||||
if (lines[i].flags & ML_EFFECT3)
|
if (lines[i].flags & ML_EFFECT3)
|
||||||
sectors[s].flags |= SF_TRIGGERSPECIAL_TOUCH;
|
sectors[s].flags |= SF_TRIGGERSPECIAL_TOUCH;
|
||||||
|
|
||||||
|
if (lines[i].frontsector && GETSECSPECIAL(lines[i].frontsector->special, 4) == 12)
|
||||||
|
sectors[s].camsec = sides[*lines[i].sidenum].sector-sectors;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -6175,6 +6218,9 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
case 317:
|
case 317:
|
||||||
case 318:
|
case 318:
|
||||||
break;
|
break;
|
||||||
|
case 319:
|
||||||
|
case 320:
|
||||||
|
break;
|
||||||
|
|
||||||
case 399: // Linedef execute on map load
|
case 399: // Linedef execute on map load
|
||||||
// This is handled in P_RunLevelLoadExecutors.
|
// This is handled in P_RunLevelLoadExecutors.
|
||||||
|
@ -6588,7 +6634,7 @@ void T_Scroll(scroll_t *s)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!((thing = node->m_thing)->flags & MF_NOCLIP) &&
|
if (!((thing = node->m_thing)->flags & MF_NOCLIP) &&
|
||||||
(!(thing->flags & MF_NOGRAVITY || thing->z < height)))
|
(!(thing->flags & MF_NOGRAVITY || thing->z+thing->height < height)))
|
||||||
{
|
{
|
||||||
// Move objects only if on floor or underwater,
|
// Move objects only if on floor or underwater,
|
||||||
// non-floating, and clipped.
|
// non-floating, and clipped.
|
||||||
|
|
|
@ -56,9 +56,11 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start);
|
||||||
INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max);
|
INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max);
|
||||||
|
|
||||||
void P_SetupSignExit(player_t *player);
|
void P_SetupSignExit(player_t *player);
|
||||||
|
boolean P_IsFlagAtBase(mobjtype_t flag);
|
||||||
|
|
||||||
void P_SwitchWeather(INT32 weathernum);
|
void P_SwitchWeather(INT32 weathernum);
|
||||||
|
|
||||||
|
boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller);
|
||||||
void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller);
|
void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller);
|
||||||
void P_ChangeSectorTag(UINT32 sector, INT16 newtag);
|
void P_ChangeSectorTag(UINT32 sector, INT16 newtag);
|
||||||
|
|
||||||
|
|
1374
src/p_user.c
1374
src/p_user.c
File diff suppressed because it is too large
Load diff
|
@ -999,7 +999,7 @@ void R_ReInitColormaps(UINT16 num)
|
||||||
char colormap[9] = "COLORMAP";
|
char colormap[9] = "COLORMAP";
|
||||||
lumpnum_t lump;
|
lumpnum_t lump;
|
||||||
|
|
||||||
if (num <= 9999)
|
if (num > 0 && num <= 10000)
|
||||||
snprintf(colormap, 8, "CLM%04u", num-1);
|
snprintf(colormap, 8, "CLM%04u", num-1);
|
||||||
|
|
||||||
// Load in the light tables, now 64k aligned for smokie...
|
// Load in the light tables, now 64k aligned for smokie...
|
||||||
|
|
|
@ -155,8 +155,6 @@ typedef struct ffloor_s
|
||||||
fixed_t *bottomyoffs;
|
fixed_t *bottomyoffs;
|
||||||
angle_t *bottomangle;
|
angle_t *bottomangle;
|
||||||
|
|
||||||
fixed_t delta;
|
|
||||||
|
|
||||||
size_t secnum;
|
size_t secnum;
|
||||||
ffloortype_e flags;
|
ffloortype_e flags;
|
||||||
struct line_s *master;
|
struct line_s *master;
|
||||||
|
@ -269,6 +267,7 @@ typedef struct sector_s
|
||||||
angle_t ceilingpic_angle;
|
angle_t ceilingpic_angle;
|
||||||
|
|
||||||
INT32 heightsec; // other sector, or -1 if no other sector
|
INT32 heightsec; // other sector, or -1 if no other sector
|
||||||
|
INT32 camsec; // used for camera clipping
|
||||||
|
|
||||||
INT32 floorlightsec, ceilinglightsec;
|
INT32 floorlightsec, ceilinglightsec;
|
||||||
INT32 crumblestate; // used for crumbling and bobbing
|
INT32 crumblestate; // used for crumbling and bobbing
|
||||||
|
|
|
@ -1304,6 +1304,7 @@ void R_RegisterEngineStuff(void)
|
||||||
CV_RegisterVar(&cv_grdynamiclighting);
|
CV_RegisterVar(&cv_grdynamiclighting);
|
||||||
CV_RegisterVar(&cv_grcoronas);
|
CV_RegisterVar(&cv_grcoronas);
|
||||||
CV_RegisterVar(&cv_grcoronasize);
|
CV_RegisterVar(&cv_grcoronasize);
|
||||||
|
CV_RegisterVar(&cv_grmd2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
|
|
@ -253,7 +253,7 @@ void S_RegisterSoundStuff(void)
|
||||||
CV_RegisterVar(&surround);
|
CV_RegisterVar(&surround);
|
||||||
CV_RegisterVar(&cv_samplerate);
|
CV_RegisterVar(&cv_samplerate);
|
||||||
|
|
||||||
#if defined (macintosh) && !defined (SDL) // mp3 playlist stuff
|
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
for (i = 0; i < PLAYLIST_LENGTH; i++)
|
for (i = 0; i < PLAYLIST_LENGTH; i++)
|
||||||
|
@ -761,7 +761,7 @@ void S_PauseSound(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// pause cd music
|
// pause cd music
|
||||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
|
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||||
I_PauseCD();
|
I_PauseCD();
|
||||||
#else
|
#else
|
||||||
I_StopCD();
|
I_StopCD();
|
||||||
|
@ -1050,7 +1050,7 @@ static boolean S_MIDIMusic(musicinfo_t *music, boolean looping)
|
||||||
|
|
||||||
// load & register it
|
// load & register it
|
||||||
music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC);
|
music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC);
|
||||||
#if defined (macintosh) && !defined (SDL)
|
#if defined (macintosh) && !defined (HAVE_SDL)
|
||||||
music->handle = I_RegisterSong(music_num);
|
music->handle = I_RegisterSong(music_num);
|
||||||
#else
|
#else
|
||||||
music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum));
|
music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum));
|
||||||
|
@ -1154,7 +1154,7 @@ void S_StopMusic(void)
|
||||||
I_StopSong(mus_playing->handle);
|
I_StopSong(mus_playing->handle);
|
||||||
I_UnRegisterSong(mus_playing->handle);
|
I_UnRegisterSong(mus_playing->handle);
|
||||||
|
|
||||||
#ifndef SDL //SDL uses RWOPS
|
#ifndef HAVE_SDL //SDL uses RWOPS
|
||||||
Z_ChangeTag(mus_playing->data, PU_CACHE);
|
Z_ChangeTag(mus_playing->data, PU_CACHE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ extern CV_PossibleValue_t soundvolume_cons_t[];
|
||||||
//part of i_cdmus.c
|
//part of i_cdmus.c
|
||||||
extern consvar_t cd_volume, cdUpdate;
|
extern consvar_t cd_volume, cdUpdate;
|
||||||
|
|
||||||
#if defined (macintosh) && !defined (SDL)
|
#if defined (macintosh) && !defined (HAVE_SDL)
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
music_normal,
|
music_normal,
|
||||||
|
|
|
@ -30,6 +30,10 @@ ifdef NOTERMIOS
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef LINUX64
|
||||||
|
OPTS+=-DLINUX64
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
#here is Solaris
|
#here is Solaris
|
||||||
#
|
#
|
||||||
|
@ -89,4 +93,4 @@ ifndef NOHW
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# name of the exefile
|
# name of the exefile
|
||||||
EXENAME?=lsdlsrb2
|
EXENAME?=lsdl2srb2
|
||||||
|
|
|
@ -43,9 +43,9 @@ SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags)
|
||||||
SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
|
SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
|
||||||
else
|
else
|
||||||
ifdef PREFIX
|
ifdef PREFIX
|
||||||
SDL_CONFIG?=$(PREFIX)-sdl-config
|
SDL_CONFIG?=$(PREFIX)-sdl2-config
|
||||||
else
|
else
|
||||||
SDL_CONFIG?=sdl-config
|
SDL_CONFIG?=sdl2-config
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef STATIC
|
ifdef STATIC
|
||||||
|
@ -67,7 +67,7 @@ endif
|
||||||
|
|
||||||
OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
|
OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
|
||||||
|
|
||||||
OPTS+=-DDIRECTFULLSCREEN -DSDL
|
OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL
|
||||||
|
|
||||||
ifndef NOHW
|
ifndef NOHW
|
||||||
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
|
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
|
||||||
|
@ -95,33 +95,28 @@ endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef FILTERS
|
|
||||||
OBJS+=$(OBJDIR)/filters.o $(OBJDIR)/hq2x.o $(OBJDIR)/lq2x.o
|
|
||||||
OPTS+=-DHAVE_FILTER
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef NOMIXER
|
ifdef NOMIXER
|
||||||
i_sound_o=$(OBJDIR)/sdl_sound.o
|
i_sound_o=$(OBJDIR)/sdl_sound.o
|
||||||
else
|
else
|
||||||
i_sound_o=$(OBJDIR)/mixer_sound.o
|
i_sound_o=$(OBJDIR)/mixer_sound.o
|
||||||
OPTS+=-DHAVE_MIXER
|
OPTS+=-DHAVE_MIXER
|
||||||
SDL_LDFLAGS+=-lSDL_mixer
|
SDL_LDFLAGS+=-lSDL2_mixer
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef SDL_TTF
|
ifdef SDL_TTF
|
||||||
OPTS+=-DHAVE_TTF
|
OPTS+=-DHAVE_TTF
|
||||||
SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz
|
SDL_LDFLAGS+=-lSDL2_ttf -lfreetype -lz
|
||||||
OBJS+=$(OBJDIR)/i_ttf.o
|
OBJS+=$(OBJDIR)/i_ttf.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#ifdef SDL_IMAGE
|
ifdef SDL_IMAGE
|
||||||
# OPTS+=-DHAVE_IMAGE
|
OPTS+=-DHAVE_IMAGE
|
||||||
# SDL_LDFLAGS+=-lSDL_image
|
SDL_LDFLAGS+=-lSDL2_image
|
||||||
#endif
|
endif
|
||||||
|
|
||||||
ifdef SDL_NET
|
ifdef SDL_NET
|
||||||
OPTS+=-DHAVE_SDLNET
|
OPTS+=-DHAVE_SDLNET
|
||||||
SDL_LDFLAGS+=-lSDL_net
|
SDL_LDFLAGS+=-lSDL2_net
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef SDLMAIN
|
ifdef SDLMAIN
|
||||||
|
|
|
@ -74,14 +74,14 @@
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\..\..\bin\VC10\$(Platform)\$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\..\..\bin\VC10\$(Platform)\$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
||||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
||||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
||||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath)</LibraryPath>
|
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SDL20_PREFIX)\lib;$(SDL20_MIXER_PREFIX)\lib;$(LibraryPath)</LibraryPath>
|
||||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath)</LibraryPath>
|
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SDL20_PREFIX)\lib;$(SDL20_MIXER_PREFIX)\lib;$(LibraryPath)</LibraryPath>
|
||||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath)</LibraryPath>
|
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SDL20_PREFIX)\lib\x64;$(SDL20_MIXER_PREFIX)\lib\x64;$(LibraryPath)</LibraryPath>
|
||||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath)</LibraryPath>
|
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SDL20_PREFIX)\lib\x64;$(SDL20_MIXER_PREFIX)\lib\x64;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
@ -202,7 +202,7 @@
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<OmitFramePointers>true</OmitFramePointers>
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
|
||||||
|
@ -258,7 +258,7 @@
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<OmitFramePointers>true</OmitFramePointers>
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||||
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||||
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
|
@ -248,7 +248,7 @@
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||||
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
|
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
|
||||||
|
@ -350,7 +350,7 @@
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib""
|
||||||
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
|
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
|
||||||
|
|
|
@ -45,7 +45,7 @@ MTL=midl.exe
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c
|
# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
# SUBTRACT RSC /x
|
# SUBTRACT RSC /x
|
||||||
|
@ -72,7 +72,7 @@ LINK32=link.exe
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
MTL=midl.exe
|
MTL=midl.exe
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c
|
# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#pragma warning(disable : 4214 4244)
|
#pragma warning(disable : 4214 4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
|
|
@ -1,588 +1,38 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief cd music interface
|
|
||||||
///
|
|
||||||
|
|
||||||
#ifdef SDL
|
|
||||||
|
|
||||||
#if defined (DC) || defined (_WIN32_WCE) || defined(GP2X) || defined(_PS3)
|
|
||||||
#define NOSDLCD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable : 4214 4244)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(default : 4214 4244)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../doomtype.h"
|
|
||||||
#include "../i_sound.h"
|
|
||||||
#include "../command.h"
|
#include "../command.h"
|
||||||
#include "../m_argv.h"
|
|
||||||
#include "../s_sound.h"
|
#include "../s_sound.h"
|
||||||
|
#include "../i_sound.h"
|
||||||
|
|
||||||
#define MAX_CD_TRACKS 256
|
//
|
||||||
|
// CD MUSIC I/O
|
||||||
|
//
|
||||||
|
|
||||||
#ifdef _XBOX
|
UINT8 cdaudio_started = 0;
|
||||||
INT32 SDL_SYS_CDInit(void)
|
|
||||||
{
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SDL_SYS_CDQuit(void)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UINT8 cdaudio_started = 0; // for system startup/shutdown
|
|
||||||
|
|
||||||
consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
static SDL_bool cdValid = SDL_FALSE;
|
|
||||||
static SDL_bool cdPlaying = SDL_FALSE;
|
|
||||||
static SDL_bool wasPlaying = SDL_FALSE;
|
|
||||||
static SDL_bool cdEnabled = SDL_FALSE;
|
|
||||||
static SDL_bool playLooping = SDL_FALSE;
|
|
||||||
static Uint8 playTrack = 0;
|
|
||||||
static Uint8 maxTrack = MAX_CD_TRACKS-1;
|
|
||||||
static Uint8 cdRemap[MAX_CD_TRACKS];
|
|
||||||
static INT32 cdvolume = -1;
|
|
||||||
static SDL_CD *cdrom = NULL;
|
|
||||||
static CDstatus cdStatus = CD_ERROR;
|
|
||||||
|
|
||||||
/**************************************************************************
|
void I_InitCD(void){}
|
||||||
*
|
|
||||||
* function: CDAudio_GetAudioDiskInfo
|
void I_StopCD(void){}
|
||||||
*
|
|
||||||
* description:
|
void I_PauseCD(void){}
|
||||||
* set number of tracks if CD is available
|
|
||||||
*
|
void I_ResumeCD(void){}
|
||||||
**************************************************************************/
|
|
||||||
static INT32 CDAudio_GetAudioDiskInfo(void)
|
void I_ShutdownCD(void){}
|
||||||
|
|
||||||
|
void I_UpdateCD(void){}
|
||||||
|
|
||||||
|
void I_PlayCD(UINT8 track, UINT8 looping)
|
||||||
{
|
{
|
||||||
cdValid = SDL_FALSE;
|
|
||||||
maxTrack = 0;
|
|
||||||
|
|
||||||
if (!cdrom)
|
|
||||||
return 0;//Alam: Lies!
|
|
||||||
|
|
||||||
cdStatus = SDL_CDStatus(cdrom);
|
|
||||||
|
|
||||||
if (!CD_INDRIVE(cdStatus))
|
|
||||||
{
|
|
||||||
CONS_Printf("%s", M_GetText("No CD in drive\n"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cdStatus == CD_ERROR)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cdValid = SDL_TRUE;
|
|
||||||
maxTrack = (Uint8)cdrom->numtracks;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: I_EjectCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
static void I_EjectCD(void)
|
|
||||||
{
|
|
||||||
if (!cdrom || !cdEnabled)
|
|
||||||
return; // no cd init'd
|
|
||||||
|
|
||||||
I_StopCD();
|
|
||||||
|
|
||||||
if (SDL_CDEject(cdrom))
|
|
||||||
CONS_Printf("%s", M_GetText("CD eject failed\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: Command_Cd_f
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
* handles all CD commands from the console
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
static void Command_Cd_f (void)
|
|
||||||
{
|
|
||||||
const char *command;
|
|
||||||
size_t ret, n;
|
|
||||||
|
|
||||||
if (!cdaudio_started)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (COM_Argc() < 2)
|
|
||||||
{
|
|
||||||
CONS_Printf ("%s", M_GetText("cd [on] [off] [remap] [reset] [select]\n"
|
|
||||||
" [open] [info] [play <track>] [resume]\n"
|
|
||||||
" [stop] [pause] [loop <track>]\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
command = COM_Argv (1);
|
|
||||||
|
|
||||||
if (!strncmp(command, "on", 2))
|
|
||||||
{
|
|
||||||
cdEnabled = SDL_TRUE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "off", 3))
|
|
||||||
{
|
|
||||||
I_StopCD();
|
|
||||||
cdEnabled = SDL_FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "select", 6))
|
|
||||||
{
|
|
||||||
INT32 newcddrive;
|
|
||||||
newcddrive = atoi(COM_Argv(2));
|
|
||||||
command = SDL_CDName(newcddrive);
|
|
||||||
I_StopCD();
|
|
||||||
cdEnabled = SDL_FALSE;
|
|
||||||
SDL_CDClose(cdrom);
|
|
||||||
cdrom = SDL_CDOpen(newcddrive);
|
|
||||||
if (cdrom)
|
|
||||||
{
|
|
||||||
cdEnabled = SDL_TRUE;
|
|
||||||
CONS_Printf(M_GetText("Opened CD-ROM drive %s\n"), command ? command : COM_Argv(2));
|
|
||||||
}
|
|
||||||
else CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), command ? command : COM_Argv(2), SDL_GetError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "remap", 5))
|
|
||||||
{
|
|
||||||
ret = COM_Argc() - 2;
|
|
||||||
if (ret <= 0)
|
|
||||||
{
|
|
||||||
for (n = 1; n < MAX_CD_TRACKS; n++)
|
|
||||||
{
|
|
||||||
if (cdRemap[n] != n)
|
|
||||||
CONS_Printf(" %s -> %u\n", sizeu1(n), cdRemap[n]);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (n = 1; n <= ret; n++)
|
|
||||||
cdRemap[n] = (Uint8)atoi(COM_Argv (n+1));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "reset", 5))
|
|
||||||
{
|
|
||||||
if (!cdrom) return;
|
|
||||||
cdEnabled = SDL_TRUE;
|
|
||||||
I_StopCD();
|
|
||||||
for (n = 0; n < MAX_CD_TRACKS; n++)
|
|
||||||
cdRemap[n] = (Uint8)n;
|
|
||||||
CDAudio_GetAudioDiskInfo();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cdValid)
|
|
||||||
{
|
|
||||||
if (CDAudio_GetAudioDiskInfo()==-1 && !cdValid)
|
|
||||||
{
|
|
||||||
CONS_Printf("%s", M_GetText("No CD in drive\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "open", 4))
|
|
||||||
{
|
|
||||||
I_EjectCD();
|
|
||||||
cdValid = SDL_FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "info", 4))
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("%u tracks\n"), maxTrack);
|
|
||||||
if (cdPlaying)
|
|
||||||
CONS_Printf(M_GetText("Currently %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack);
|
|
||||||
else if (wasPlaying)
|
|
||||||
CONS_Printf(M_GetText("Paused %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack);
|
|
||||||
CONS_Printf(M_GetText("Volume is %d\n"), cdvolume);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "play", 4))
|
|
||||||
{
|
|
||||||
I_PlayCD((UINT8)atoi(COM_Argv (2)), SDL_FALSE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "loop", 4))
|
|
||||||
{
|
|
||||||
I_PlayCD((UINT8)atoi(COM_Argv (2)), true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "stop", 4))
|
|
||||||
{
|
|
||||||
I_StopCD();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strncmp(command, "pause", 5))
|
|
||||||
{
|
|
||||||
I_PauseCD();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncmp(command, "resume", 6))
|
|
||||||
{
|
|
||||||
I_ResumeCD();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Invalid CD command \"CD %s\"\n"), COM_Argv(1));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: StopCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
void I_StopCD(void)
|
|
||||||
{
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
if (!cdrom || !cdEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(cdPlaying || wasPlaying))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (SDL_CDStop(cdrom))
|
|
||||||
I_OutputMsg("cdromstop failed\n");
|
|
||||||
|
|
||||||
wasPlaying = SDL_FALSE;
|
|
||||||
cdPlaying = SDL_FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: PauseCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
void I_PauseCD (void)
|
|
||||||
{
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
if (!cdrom || !cdEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!cdPlaying)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (SDL_CDPause(cdrom))
|
|
||||||
I_OutputMsg("cdrompause failed\n");
|
|
||||||
|
|
||||||
wasPlaying = cdPlaying;
|
|
||||||
cdPlaying = SDL_FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: ResumeCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
// continue after a pause
|
|
||||||
void I_ResumeCD (void)
|
|
||||||
{
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
if (!cdrom || !cdEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!cdValid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!wasPlaying)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (cd_volume.value == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (SDL_CDResume(cdrom))
|
|
||||||
I_OutputMsg("cdromresume failed\n");
|
|
||||||
|
|
||||||
cdPlaying = SDL_TRUE;
|
|
||||||
wasPlaying = SDL_FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: ShutdownCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
void I_ShutdownCD (void)
|
|
||||||
{
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
if (!cdaudio_started)
|
|
||||||
return;
|
|
||||||
|
|
||||||
I_StopCD();
|
|
||||||
|
|
||||||
CONS_Printf("I_ShutdownCD: ");
|
|
||||||
SDL_CDClose(cdrom);
|
|
||||||
cdrom = NULL;
|
|
||||||
cdaudio_started = false;
|
|
||||||
CONS_Printf("%s", M_GetText("shut down\n"));
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_CDROM);
|
|
||||||
cdEnabled = SDL_FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: InitCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
* Initialize the first CD drive SDL detects and add console command 'cd'
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
void I_InitCD (void)
|
|
||||||
{
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
INT32 i;
|
|
||||||
|
|
||||||
// Has been checked in d_main.c, but doesn't hurt here
|
|
||||||
if (M_CheckParm ("-nocd"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
CONS_Printf("%s", M_GetText("I_InitCD: Init CD audio\n"));
|
|
||||||
|
|
||||||
// Initialize SDL first
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("Couldn't initialize SDL CDROM: %s\n"), SDL_GetError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open drive
|
|
||||||
cdrom = SDL_CDOpen(0);
|
|
||||||
|
|
||||||
if (!cdrom)
|
|
||||||
{
|
|
||||||
const char *cdName = SDL_CDName(0);
|
|
||||||
if (!cdName)
|
|
||||||
CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), "\b", SDL_GetError());
|
|
||||||
else
|
|
||||||
CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), cdName, SDL_GetError());
|
|
||||||
//return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_CD_TRACKS; i++)
|
|
||||||
cdRemap[i] = (Uint8)i;
|
|
||||||
|
|
||||||
cdaudio_started = true;
|
|
||||||
if (cdrom) cdEnabled = SDL_TRUE;
|
|
||||||
|
|
||||||
if (CDAudio_GetAudioDiskInfo()==-1)
|
|
||||||
{
|
|
||||||
CONS_Printf("%s", M_GetText("No CD in drive\n"));
|
|
||||||
cdValid = SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
COM_AddCommand ("cd", Command_Cd_f);
|
|
||||||
|
|
||||||
CONS_Printf("%s", M_GetText("CD audio Initialized\n"));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: UpdateCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
* sets CD volume (may have changed) and initiates play evey 2 seconds
|
|
||||||
* in case the song has elapsed
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
void I_UpdateCD (void)
|
|
||||||
{
|
|
||||||
#ifndef NOSDLCD
|
|
||||||
static Uint32 lastchk = 0;
|
|
||||||
|
|
||||||
if (!cdEnabled || !cdrom)
|
|
||||||
return;
|
|
||||||
|
|
||||||
I_SetVolumeCD(cd_volume.value);
|
|
||||||
|
|
||||||
if (cdPlaying && lastchk < SDL_GetTicks())
|
|
||||||
{
|
|
||||||
lastchk = SDL_GetTicks() + 2000; //two seconds between chks
|
|
||||||
|
|
||||||
if (CDAudio_GetAudioDiskInfo()==-1)
|
|
||||||
{
|
|
||||||
cdPlaying = SDL_FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cdStatus != CD_PLAYING && cdStatus != CD_PAUSED)
|
|
||||||
{
|
|
||||||
cdPlaying = SDL_FALSE;
|
|
||||||
if (playLooping)
|
|
||||||
I_PlayCD(playTrack, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: PlayCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
* play the requested track and set the looping flag
|
|
||||||
* pauses the CD if volume is 0
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
void I_PlayCD (UINT8 track, UINT8 looping)
|
|
||||||
{
|
|
||||||
#ifdef NOSDLCD
|
|
||||||
(void)track;
|
(void)track;
|
||||||
(void)looping;
|
(void)looping;
|
||||||
#else
|
|
||||||
if (!cdrom || !cdEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!cdValid)
|
|
||||||
{
|
|
||||||
CDAudio_GetAudioDiskInfo();
|
|
||||||
if (!cdValid)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
track = cdRemap[track];
|
|
||||||
|
|
||||||
if (track < 1 || track > maxTrack)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("Bad track number %u.\n"), track);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't try to play a non-audio track
|
|
||||||
if (cdrom->track[track].type == SDL_DATA_TRACK)
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("Track %u is not audio\n"), track);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cdPlaying)
|
|
||||||
{
|
|
||||||
if (playTrack == track)
|
|
||||||
return;
|
|
||||||
I_StopCD();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0))
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("Error playing track %d: %s\n"), track, SDL_GetError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
playLooping = looping;
|
|
||||||
playTrack = (Uint8)track;
|
|
||||||
cdPlaying = SDL_TRUE;
|
|
||||||
|
|
||||||
if (cd_volume.value == 0)
|
|
||||||
I_PauseCD();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_SetVolumeCD(int volume)
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* function: SetVolumeCD
|
|
||||||
*
|
|
||||||
* description:
|
|
||||||
* SDL does not support setting the CD volume
|
|
||||||
* use pause instead and toggle between full and no music
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
boolean I_SetVolumeCD (INT32 volume)
|
|
||||||
{
|
{
|
||||||
#ifdef NOSDLCD
|
|
||||||
(void)volume;
|
(void)volume;
|
||||||
#else
|
|
||||||
if (volume != cdvolume)
|
|
||||||
{
|
|
||||||
if (volume > 0 && volume < 16)
|
|
||||||
{
|
|
||||||
CV_SetValue(&cd_volume, 31);
|
|
||||||
cdvolume = 31;
|
|
||||||
I_ResumeCD();
|
|
||||||
}
|
|
||||||
else if (volume > 15 && volume < 31)
|
|
||||||
{
|
|
||||||
CV_SetValue(&cd_volume, 0);
|
|
||||||
cdvolume = 0;
|
|
||||||
I_PauseCD();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ PSP_MAIN_THREAD_NAME("SRB2");
|
||||||
PSP_MAIN_THREAD_STACK_SIZE_KB(256);
|
PSP_MAIN_THREAD_STACK_SIZE_KB(256);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
|
|
||||||
#ifdef HAVE_TTF
|
#ifdef HAVE_TTF
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "../i_tcp.h"
|
#include "../i_tcp.h"
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
|
|
||||||
#ifdef HAVE_SDLNET
|
#ifdef HAVE_SDLNET
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
|
||||||
#pragma warning(disable : 4214 4244)
|
#pragma warning(disable : 4214 4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
@ -996,8 +996,8 @@ void I_GetJoystickEvents(void)
|
||||||
UINT64 joyhats = 0;
|
UINT64 joyhats = 0;
|
||||||
#if 0
|
#if 0
|
||||||
UINT64 joybuttons = 0;
|
UINT64 joybuttons = 0;
|
||||||
Sint16 axisx, axisy;
|
|
||||||
#endif
|
#endif
|
||||||
|
Sint16 axisx, axisy;
|
||||||
|
|
||||||
if (!joystick_started) return;
|
if (!joystick_started) return;
|
||||||
|
|
||||||
|
@ -1070,7 +1070,6 @@ void I_GetJoystickEvents(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// send joystick axis positions
|
// send joystick axis positions
|
||||||
event.type = ev_joystick;
|
event.type = ev_joystick;
|
||||||
|
|
||||||
|
@ -1123,7 +1122,6 @@ void I_GetJoystickEvents(void)
|
||||||
}
|
}
|
||||||
D_PostEvent(&event);
|
D_PostEvent(&event);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Open joystick handle
|
/** \brief Open joystick handle
|
||||||
|
@ -1156,7 +1154,7 @@ static int joy_open(const char *fname)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
||||||
for (i = 0; i < num_joy; i++)
|
for (i = 0; i < num_joy; i++)
|
||||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||||
I_ShutdownJoystick();
|
I_ShutdownJoystick();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1175,7 @@ static int joy_open(const char *fname)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
|
CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
|
||||||
for (i = 0; i < num_joy; i++)
|
for (i = 0; i < num_joy; i++)
|
||||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
|
CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
|
||||||
|
@ -1185,7 +1183,6 @@ static int joy_open(const char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
JoyInfo.dev = SDL_JoystickOpen(joyindex-1);
|
JoyInfo.dev = SDL_JoystickOpen(joyindex-1);
|
||||||
CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(joyindex-1));
|
|
||||||
|
|
||||||
if (JoyInfo.dev == NULL)
|
if (JoyInfo.dev == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1195,6 +1192,7 @@ static int joy_open(const char *fname)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev));
|
||||||
JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev);
|
JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev);
|
||||||
if (JoyInfo.axises > JOYAXISSET*2)
|
if (JoyInfo.axises > JOYAXISSET*2)
|
||||||
JoyInfo.axises = JOYAXISSET*2;
|
JoyInfo.axises = JOYAXISSET*2;
|
||||||
|
@ -1219,7 +1217,7 @@ static int joy_open(const char *fname)
|
||||||
JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
|
JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo.dev)), "pad");
|
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad");
|
||||||
|
|
||||||
return JoyInfo.axises;
|
return JoyInfo.axises;
|
||||||
}
|
}
|
||||||
|
@ -1290,8 +1288,8 @@ void I_GetJoystick2Events(void)
|
||||||
UINT64 joyhats = 0;
|
UINT64 joyhats = 0;
|
||||||
#if 0
|
#if 0
|
||||||
INT64 joybuttons = 0;
|
INT64 joybuttons = 0;
|
||||||
INT32 axisx, axisy;
|
|
||||||
#endif
|
#endif
|
||||||
|
INT32 axisx, axisy;
|
||||||
|
|
||||||
if (!joystick2_started)
|
if (!joystick2_started)
|
||||||
return;
|
return;
|
||||||
|
@ -1361,7 +1359,6 @@ void I_GetJoystick2Events(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// send joystick axis positions
|
// send joystick axis positions
|
||||||
event.type = ev_joystick2;
|
event.type = ev_joystick2;
|
||||||
|
|
||||||
|
@ -1416,7 +1413,6 @@ void I_GetJoystick2Events(void)
|
||||||
}
|
}
|
||||||
D_PostEvent(&event);
|
D_PostEvent(&event);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1448,7 +1444,7 @@ static int joy_open2(const char *fname)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
||||||
for (i = 0; i < num_joy; i++)
|
for (i = 0; i < num_joy; i++)
|
||||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||||
I_ShutdownJoystick2();
|
I_ShutdownJoystick2();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1469,7 +1465,7 @@ static int joy_open2(const char *fname)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
|
CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
|
||||||
for (i = 0; i < num_joy; i++)
|
for (i = 0; i < num_joy; i++)
|
||||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
|
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
|
CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
|
||||||
|
@ -1477,7 +1473,6 @@ static int joy_open2(const char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
JoyInfo2.dev = SDL_JoystickOpen(joyindex-1);
|
JoyInfo2.dev = SDL_JoystickOpen(joyindex-1);
|
||||||
CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(joyindex-1));
|
|
||||||
|
|
||||||
if (!JoyInfo2.dev)
|
if (!JoyInfo2.dev)
|
||||||
{
|
{
|
||||||
|
@ -1487,6 +1482,7 @@ static int joy_open2(const char *fname)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev));
|
||||||
JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev);
|
JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev);
|
||||||
if (JoyInfo2.axises > JOYAXISSET*2)
|
if (JoyInfo2.axises > JOYAXISSET*2)
|
||||||
JoyInfo2.axises = JOYAXISSET*2;
|
JoyInfo2.axises = JOYAXISSET*2;
|
||||||
|
@ -1511,7 +1507,7 @@ static int joy_open2(const char *fname)
|
||||||
JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
|
JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo2.dev)), "pad");
|
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad");
|
||||||
|
|
||||||
return JoyInfo2.axises;
|
return JoyInfo2.axises;
|
||||||
}
|
}
|
||||||
|
@ -1582,11 +1578,11 @@ const char *I_GetJoyName(INT32 joyindex)
|
||||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||||
{
|
{
|
||||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
|
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
|
||||||
joyname = SDL_JoystickName(joyindex);
|
joyname = SDL_JoystickNameForIndex(joyindex);
|
||||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
joyname = SDL_JoystickName(joyindex);
|
joyname = SDL_JoystickNameForIndex(joyindex);
|
||||||
return joyname;
|
return joyname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2219,7 +2215,7 @@ void I_Sleep(void)
|
||||||
INT32 I_StartupSystem(void)
|
INT32 I_StartupSystem(void)
|
||||||
{
|
{
|
||||||
SDL_version SDLcompiled;
|
SDL_version SDLcompiled;
|
||||||
const SDL_version *SDLlinked;
|
SDL_version SDLlinked;
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
char DP[] =" Sonic Robo Blast 2!\n";
|
char DP[] =" Sonic Robo Blast 2!\n";
|
||||||
|
@ -2240,12 +2236,12 @@ INT32 I_StartupSystem(void)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
SDL_VERSION(&SDLcompiled)
|
SDL_VERSION(&SDLcompiled)
|
||||||
SDLlinked = SDL_Linked_Version();
|
SDL_GetVersion(&SDLlinked);
|
||||||
I_StartupConsole();
|
I_StartupConsole();
|
||||||
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
|
||||||
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
|
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
|
||||||
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
|
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
|
||||||
SDLlinked->major, SDLlinked->minor, SDLlinked->patch);
|
SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
|
||||||
#if 0 //#ifdef GP2X //start up everything
|
#if 0 //#ifdef GP2X //start up everything
|
||||||
if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0)
|
if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0)
|
||||||
#else
|
#else
|
||||||
|
@ -2875,7 +2871,7 @@ const char *I_LocateWad(void)
|
||||||
return waddir;
|
return waddir;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(LINUX64)
|
||||||
#define MEMINFO_FILE "/proc/meminfo"
|
#define MEMINFO_FILE "/proc/meminfo"
|
||||||
#define MEMTOTAL "MemTotal:"
|
#define MEMTOTAL "MemTotal:"
|
||||||
#define MEMFREE "MemFree:"
|
#define MEMFREE "MemFree:"
|
||||||
|
@ -2931,7 +2927,25 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||||
if (total)
|
if (total)
|
||||||
*total = 32 << 20;
|
*total = 32 << 20;
|
||||||
return 32 << 20;
|
return 32 << 20;
|
||||||
#elif defined (LINUX)
|
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
|
||||||
|
MEMORYSTATUS info;
|
||||||
|
|
||||||
|
info.dwLength = sizeof (MEMORYSTATUS);
|
||||||
|
GlobalMemoryStatus( &info );
|
||||||
|
if (total)
|
||||||
|
*total = (UINT32)info.dwTotalPhys;
|
||||||
|
return (UINT32)info.dwAvailPhys;
|
||||||
|
#elif defined (__OS2__)
|
||||||
|
UINT32 pr_arena;
|
||||||
|
|
||||||
|
if (total)
|
||||||
|
DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
|
||||||
|
(PVOID) total, sizeof (UINT32));
|
||||||
|
DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM,
|
||||||
|
(PVOID) &pr_arena, sizeof (UINT32));
|
||||||
|
|
||||||
|
return pr_arena;
|
||||||
|
#elif defined (LINUX) || defined (LINUX64)
|
||||||
/* Linux */
|
/* Linux */
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *memTag;
|
char *memTag;
|
||||||
|
@ -2975,24 +2989,6 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||||
if (total)
|
if (total)
|
||||||
*total = totalKBytes << 10;
|
*total = totalKBytes << 10;
|
||||||
return freeKBytes << 10;
|
return freeKBytes << 10;
|
||||||
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
|
|
||||||
MEMORYSTATUS info;
|
|
||||||
|
|
||||||
info.dwLength = sizeof (MEMORYSTATUS);
|
|
||||||
GlobalMemoryStatus( &info );
|
|
||||||
if (total)
|
|
||||||
*total = (UINT32)info.dwTotalPhys;
|
|
||||||
return (UINT32)info.dwAvailPhys;
|
|
||||||
#elif defined (__OS2__)
|
|
||||||
UINT32 pr_arena;
|
|
||||||
|
|
||||||
if (total)
|
|
||||||
DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
|
|
||||||
(PVOID) total, sizeof (UINT32));
|
|
||||||
DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM,
|
|
||||||
(PVOID) &pr_arena, sizeof (UINT32));
|
|
||||||
|
|
||||||
return pr_arena;
|
|
||||||
#else
|
#else
|
||||||
// Guess 48 MB.
|
// Guess 48 MB.
|
||||||
if (total)
|
if (total)
|
||||||
|
@ -3039,8 +3035,8 @@ const CPUInfoFlags *I_CPUInfo(void)
|
||||||
WIN_CPUInfo.SSE2 = SDL_HasSSE2();
|
WIN_CPUInfo.SSE2 = SDL_HasSSE2();
|
||||||
WIN_CPUInfo.AltiVec = SDL_HasAltiVec();
|
WIN_CPUInfo.AltiVec = SDL_HasAltiVec();
|
||||||
}
|
}
|
||||||
WIN_CPUInfo.MMXExt = SDL_HasMMXExt();
|
WIN_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
|
||||||
WIN_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
|
WIN_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
|
||||||
#endif
|
#endif
|
||||||
GetSystemInfo(&SI);
|
GetSystemInfo(&SI);
|
||||||
WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors;
|
WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors;
|
||||||
|
@ -3052,9 +3048,9 @@ const CPUInfoFlags *I_CPUInfo(void)
|
||||||
memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags));
|
memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags));
|
||||||
SDL_CPUInfo.RDTSC = SDL_HasRDTSC();
|
SDL_CPUInfo.RDTSC = SDL_HasRDTSC();
|
||||||
SDL_CPUInfo.MMX = SDL_HasMMX();
|
SDL_CPUInfo.MMX = SDL_HasMMX();
|
||||||
SDL_CPUInfo.MMXExt = SDL_HasMMXExt();
|
SDL_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
|
||||||
SDL_CPUInfo.AMD3DNow = SDL_Has3DNow();
|
SDL_CPUInfo.AMD3DNow = SDL_Has3DNow();
|
||||||
SDL_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
|
SDL_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
|
||||||
SDL_CPUInfo.SSE = SDL_HasSSE();
|
SDL_CPUInfo.SSE = SDL_HasSSE();
|
||||||
SDL_CPUInfo.SSE2 = SDL_HasSSE2();
|
SDL_CPUInfo.SSE2 = SDL_HasSSE2();
|
||||||
SDL_CPUInfo.AltiVec = SDL_HasAltiVec();
|
SDL_CPUInfo.AltiVec = SDL_HasAltiVec();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
|
/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
|
||||||
|
|
||||||
#if defined(SDL) && defined(HAVE_TTF)
|
#if defined(HAVE_SDL) && defined(HAVE_TTF)
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "SDL_ttf.h"
|
#include "SDL_ttf.h"
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
|
|
1536
src/sdl/i_video.c
1536
src/sdl/i_video.c
File diff suppressed because it is too large
Load diff
|
@ -1214,7 +1214,7 @@
|
||||||
C01FCF4B08A954540054247B /* Debug */ = {
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.8;
|
CURRENT_PROJECT_VERSION = 2.1.9;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
NORMALSRB2,
|
NORMALSRB2,
|
||||||
|
@ -1226,7 +1226,7 @@
|
||||||
C01FCF4C08A954540054247B /* Release */ = {
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.8;
|
CURRENT_PROJECT_VERSION = 2.1.9;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
@ -1264,7 +1264,7 @@
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
MAC_ALERT,
|
MAC_ALERT,
|
||||||
SDLMAIN,
|
SDLMAIN,
|
||||||
SDL,
|
HAVE_SDL,
|
||||||
HAVE_MIXER,
|
HAVE_MIXER,
|
||||||
HAVE_PNG,
|
HAVE_PNG,
|
||||||
HAVE_BLUA,
|
HAVE_BLUA,
|
||||||
|
@ -1386,7 +1386,7 @@
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
MAC_ALERT,
|
MAC_ALERT,
|
||||||
SDLMAIN,
|
SDLMAIN,
|
||||||
SDL,
|
HAVE_SDL,
|
||||||
HAVE_MIXER,
|
HAVE_MIXER,
|
||||||
HAVE_PNG,
|
HAVE_PNG,
|
||||||
HAVE_BLUA,
|
HAVE_BLUA,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
|
|
||||||
#if defined(SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER
|
#if defined(HAVE_SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER
|
||||||
|
|
||||||
#include "../sounds.h"
|
#include "../sounds.h"
|
||||||
#include "../s_sound.h"
|
#include "../s_sound.h"
|
||||||
|
@ -617,7 +617,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
|
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
|
||||||
if (!music)
|
if (!music)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||||
|
@ -778,7 +778,7 @@ void I_SetMIDIMusicVolume(UINT8 volume)
|
||||||
|
|
||||||
INT32 I_RegisterSong(void *data, size_t len)
|
INT32 I_RegisterSong(void *data, size_t len)
|
||||||
{
|
{
|
||||||
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
|
music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
|
||||||
if (!music)
|
if (!music)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||||
|
|
|
@ -21,10 +21,12 @@
|
||||||
#pragma warning(disable : 4214 4244)
|
#pragma warning(disable : 4214 4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL
|
#ifdef HAVE_SDL
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
#include "sdlmain.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(default : 4214 4244)
|
#pragma warning(default : 4214 4244)
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,19 +64,11 @@ PFNglGetIntegerv pglGetIntegerv;
|
||||||
PFNglGetString pglGetString;
|
PFNglGetString pglGetString;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _PSP
|
|
||||||
static const Uint32 WOGLFlags = SDL_HWSURFACE|SDL_OPENGL/*|SDL_RESIZABLE*/;
|
|
||||||
static const Uint32 FOGLFlags = SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN;
|
|
||||||
#else
|
|
||||||
static const Uint32 WOGLFlags = SDL_OPENGL/*|SDL_RESIZABLE*/;
|
|
||||||
static const Uint32 FOGLFlags = SDL_OPENGL|SDL_FULLSCREEN;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** \brief SDL video display surface
|
/** \brief SDL video display surface
|
||||||
*/
|
*/
|
||||||
SDL_Surface *vidSurface = NULL;
|
|
||||||
INT32 oglflags = 0;
|
INT32 oglflags = 0;
|
||||||
void *GLUhandle = NULL;
|
void *GLUhandle = NULL;
|
||||||
|
SDL_GLContext sdlglcontext = 0;
|
||||||
|
|
||||||
#ifndef STATIC_OPENGL
|
#ifndef STATIC_OPENGL
|
||||||
void *GetGLFunc(const char *proc)
|
void *GetGLFunc(const char *proc)
|
||||||
|
@ -156,36 +150,13 @@ boolean LoadGL(void)
|
||||||
|
|
||||||
\return if true, changed video mode
|
\return if true, changed video mode
|
||||||
*/
|
*/
|
||||||
boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
|
boolean OglSdlSurface(INT32 w, INT32 h)
|
||||||
{
|
{
|
||||||
INT32 cbpp;
|
INT32 cbpp;
|
||||||
Uint32 OGLFlags;
|
|
||||||
const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;
|
const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;
|
||||||
|
|
||||||
cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
|
cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
|
||||||
|
|
||||||
if (vidSurface)
|
|
||||||
{
|
|
||||||
//Alam: SDL_Video system free vidSurface for me
|
|
||||||
#ifdef VOODOOSAFESWITCHING
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFullscreen)
|
|
||||||
OGLFlags = FOGLFlags;
|
|
||||||
else
|
|
||||||
OGLFlags = WOGLFlags;
|
|
||||||
|
|
||||||
cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags);
|
|
||||||
if (cbpp < 16)
|
|
||||||
return true; //Alam: Let just say we did, ok?
|
|
||||||
|
|
||||||
vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags);
|
|
||||||
if (!vidSurface)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
glvendor = pglGetString(GL_VENDOR);
|
glvendor = pglGetString(GL_VENDOR);
|
||||||
// Get info and extensions.
|
// Get info and extensions.
|
||||||
//BP: why don't we make it earlier ?
|
//BP: why don't we make it earlier ?
|
||||||
|
@ -200,55 +171,21 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
|
||||||
DBG_Printf("Extensions : %s\n", gl_extensions);
|
DBG_Printf("Extensions : %s\n", gl_extensions);
|
||||||
oglflags = 0;
|
oglflags = 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// BP: disable advenced feature that don't work on somes hardware
|
|
||||||
// Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04
|
|
||||||
if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD;
|
|
||||||
#elif defined (unix) || defined (UNIXCOMMON)
|
|
||||||
// disable advanced features not working on somes hardware
|
|
||||||
if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV;
|
|
||||||
if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV;
|
|
||||||
#endif
|
|
||||||
DBG_Printf("oglflags : 0x%X\n", oglflags );
|
|
||||||
|
|
||||||
#ifdef USE_PALETTED_TEXTURE
|
|
||||||
if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions))
|
|
||||||
glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT");
|
|
||||||
else
|
|
||||||
glColorTableEXT = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WGL_SWAP
|
|
||||||
if (isExtAvailable("WGL_EXT_swap_control", gl_extensions))
|
|
||||||
wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT");
|
|
||||||
else
|
|
||||||
wglSwapIntervalEXT = NULL;
|
|
||||||
#else
|
|
||||||
if (isExtAvailable("GLX_SGI_swap_control", gl_extensions))
|
|
||||||
glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI");
|
|
||||||
else
|
|
||||||
glXSwapIntervalSGIEXT = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
|
||||||
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
||||||
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
||||||
else
|
else
|
||||||
#endif
|
maximumAnisotropy = 1;
|
||||||
maximumAnisotropy = 0;
|
|
||||||
|
|
||||||
granisotropicmode_cons_t[1].value = maximumAnisotropy;
|
granisotropicmode_cons_t[1].value = maximumAnisotropy;
|
||||||
|
|
||||||
|
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||||
|
|
||||||
SetModelView(w, h);
|
SetModelView(w, h);
|
||||||
SetStates();
|
SetStates();
|
||||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
HWR_Startup();
|
HWR_Startup();
|
||||||
#ifdef KOS_GL_COMPATIBILITY
|
|
||||||
textureformatGL = GL_ARGB4444;
|
|
||||||
#else
|
|
||||||
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
|
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -264,17 +201,11 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||||
static boolean oldwaitvbl = false;
|
static boolean oldwaitvbl = false;
|
||||||
if (oldwaitvbl != waitvbl)
|
if (oldwaitvbl != waitvbl)
|
||||||
{
|
{
|
||||||
#ifdef USE_WGL_SWAP
|
SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
|
||||||
if (wglSwapIntervalEXT)
|
|
||||||
wglSwapIntervalEXT(waitvbl);
|
|
||||||
#else
|
|
||||||
if (glXSwapIntervalSGIEXT)
|
|
||||||
glXSwapIntervalSGIEXT(waitvbl);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
oldwaitvbl = waitvbl;
|
oldwaitvbl = waitvbl;
|
||||||
|
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
||||||
|
@ -283,10 +214,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
||||||
UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
|
UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
|
||||||
bluegamma = pgamma->s.blue;
|
bluegamma = pgamma->s.blue;
|
||||||
|
|
||||||
#if 0 // changing the gamma to 127 is a bad idea
|
|
||||||
i = SDL_SetGamma(byteasfloat(redgamma), byteasfloat(greengamma), byteasfloat(bluegamma));
|
|
||||||
#endif
|
|
||||||
if (i == 0) redgamma = greengamma = bluegamma = 0x7F; //Alam: cool
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255);
|
myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255);
|
||||||
|
@ -294,20 +221,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
||||||
myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255);
|
myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255);
|
||||||
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
||||||
}
|
}
|
||||||
#ifdef USE_PALETTED_TEXTURE
|
|
||||||
if (glColorTableEXT)
|
|
||||||
{
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
palette_tex[(3*i)+0] = palette[i].s.red;
|
|
||||||
palette_tex[(3*i)+1] = palette[i].s.green;
|
|
||||||
palette_tex[(3*i)+2] = palette[i].s.blue;
|
|
||||||
}
|
|
||||||
glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// on a chang<6E>de palette, il faut recharger toutes les textures
|
|
||||||
// jaja, und noch viel mehr ;-)
|
|
||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,16 @@
|
||||||
|
|
||||||
#include "../v_video.h"
|
#include "../v_video.h"
|
||||||
|
|
||||||
extern SDL_Surface *vidSurface;
|
|
||||||
extern void *GLUhandle;
|
extern void *GLUhandle;
|
||||||
|
|
||||||
boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen);
|
boolean OglSdlSurface(INT32 w, INT32 h);
|
||||||
|
|
||||||
void OglSdlFinishUpdate(boolean vidwait);
|
void OglSdlFinishUpdate(boolean vidwait);
|
||||||
|
|
||||||
|
extern SDL_Window *window;
|
||||||
|
extern SDL_Renderer *renderer;
|
||||||
|
extern SDL_GLContext sdlglcontext;
|
||||||
|
|
||||||
#ifdef _CREATE_DLL_
|
#ifdef _CREATE_DLL_
|
||||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma);
|
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#pragma warning(disable : 4214 4244)
|
#pragma warning(disable : 4214 4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SDL) && SOUND==SOUND_SDL
|
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
@ -856,6 +856,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16S(Uint8 *stream, int len)
|
||||||
|
|
||||||
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
||||||
|
|
||||||
|
|
||||||
// Mix sounds into the mixing buffer.
|
// Mix sounds into the mixing buffer.
|
||||||
// Loop over len
|
// Loop over len
|
||||||
while (len--)
|
while (len--)
|
||||||
|
@ -945,6 +946,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len)
|
||||||
|
|
||||||
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
||||||
|
|
||||||
|
|
||||||
// Mix sounds into the mixing buffer.
|
// Mix sounds into the mixing buffer.
|
||||||
// Loop over len
|
// Loop over len
|
||||||
while (len--)
|
while (len--)
|
||||||
|
@ -1050,10 +1052,7 @@ static void SDLCALL I_UpdateStream(void *userdata, Uint8 *stream, int len)
|
||||||
if (!sound_started || !userdata)
|
if (!sound_started || !userdata)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
|
||||||
if (musicStarted)
|
|
||||||
memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80
|
memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((audio.channels != 1 && audio.channels != 2) ||
|
if ((audio.channels != 1 && audio.channels != 2) ||
|
||||||
(audio.format != AUDIO_S8 && audio.format != AUDIO_S16SYS))
|
(audio.format != AUDIO_S8 && audio.format != AUDIO_S16SYS))
|
||||||
|
@ -1320,8 +1319,8 @@ void I_StartupSound(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char ad[100];
|
//char ad[100];
|
||||||
CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
|
//CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
|
||||||
}
|
}
|
||||||
samplecount = audio.samples;
|
samplecount = audio.samples;
|
||||||
CV_SetValue(&cv_samplerate, audio.freq);
|
CV_SetValue(&cv_samplerate, audio.freq);
|
||||||
|
@ -1782,7 +1781,9 @@ static boolean I_StartGMESong(const char *musicname, boolean looping)
|
||||||
gme_set_user_data(emu, data);
|
gme_set_user_data(emu, data);
|
||||||
gme_set_user_cleanup(emu, I_CleanupGME);
|
gme_set_user_cleanup(emu, I_CleanupGME);
|
||||||
gme_start_track(emu, 0);
|
gme_start_track(emu, 0);
|
||||||
|
#ifdef HAVE_MIXER
|
||||||
gme_set_fade(emu, Digfade);
|
gme_set_fade(emu, Digfade);
|
||||||
|
#endif
|
||||||
|
|
||||||
Snd_LockAudio();
|
Snd_LockAudio();
|
||||||
localdata.gme_emu = emu;
|
localdata.gme_emu = emu;
|
||||||
|
@ -2027,4 +2028,4 @@ static void SDLCALL I_FinishMusic(void)
|
||||||
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
|
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif //SDL
|
#endif //HAVE_SDL
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
extern SDL_bool consolevent;
|
extern SDL_bool consolevent;
|
||||||
extern SDL_bool framebuffer;
|
extern SDL_bool framebuffer;
|
||||||
|
|
||||||
|
#include "../m_fixed.h"
|
||||||
|
|
||||||
|
// SDL2 stub macro
|
||||||
|
#define SDL2STUB(name) CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
|
||||||
|
|
||||||
/** \brief The JoyInfo_s struct
|
/** \brief The JoyInfo_s struct
|
||||||
|
|
||||||
info about joystick
|
info about joystick
|
||||||
|
|
506
src/sdl12/IMG_xpm.c
Normal file
506
src/sdl12/IMG_xpm.c
Normal file
|
@ -0,0 +1,506 @@
|
||||||
|
/*
|
||||||
|
SDL_image: An example image loading library for use with SDL
|
||||||
|
Copyright (C) 1999-2004 Sam Lantinga
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Sam Lantinga
|
||||||
|
slouken@libsdl.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Id: IMG_xpm.c,v 1.10 2004/01/04 22:04:38 slouken Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPM (X PixMap) image loader:
|
||||||
|
*
|
||||||
|
* Supports the XPMv3 format, EXCEPT:
|
||||||
|
* - hotspot coordinates are ignored
|
||||||
|
* - only colour ('c') colour symbols are used
|
||||||
|
* - rgb.txt is not used (for portability), so only RGB colours
|
||||||
|
* are recognized (#rrggbb etc) - only a few basic colour names are
|
||||||
|
* handled
|
||||||
|
*
|
||||||
|
* The result is an 8bpp indexed surface if possible, otherwise 32bpp.
|
||||||
|
* The colourkey is correctly set if transparency is used.
|
||||||
|
*
|
||||||
|
* Besides the standard API, also provides
|
||||||
|
*
|
||||||
|
* SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
|
||||||
|
*
|
||||||
|
* that reads the image data from an XPM file included in the C source.
|
||||||
|
*
|
||||||
|
* TODO: include rgb.txt here. The full table (from solaris 2.6) only
|
||||||
|
* requires about 13K in binary form.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
//#include "SDL_image.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOAD_XPM
|
||||||
|
|
||||||
|
/* See if an image is contained in a data source */
|
||||||
|
#if 0
|
||||||
|
int IMG_isXPM(SDL_RWops *src)
|
||||||
|
{
|
||||||
|
char magic[9];
|
||||||
|
|
||||||
|
return (SDL_RWread(src, magic, sizeof (magic), 1)
|
||||||
|
&& memcmp(magic, "/* XPM */", 9) == 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Hash table to look up colors from pixel strings */
|
||||||
|
#define STARTING_HASH_SIZE 256
|
||||||
|
|
||||||
|
struct hash_entry {
|
||||||
|
char *key;
|
||||||
|
Uint32 color;
|
||||||
|
struct hash_entry *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct color_hash {
|
||||||
|
struct hash_entry **table;
|
||||||
|
struct hash_entry *entries; /* array of all entries */
|
||||||
|
struct hash_entry *next_free;
|
||||||
|
size_t size;
|
||||||
|
int maxnum;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int hash_key(const char *key, int cpp, size_t size)
|
||||||
|
{
|
||||||
|
int hash;
|
||||||
|
|
||||||
|
hash = 0;
|
||||||
|
while ( cpp-- > 0 ) {
|
||||||
|
hash = hash * 33 + *key++;
|
||||||
|
}
|
||||||
|
return (int)(hash & (size - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct color_hash *create_colorhash(int maxnum)
|
||||||
|
{
|
||||||
|
size_t bytes;
|
||||||
|
int s;
|
||||||
|
struct color_hash *hash;
|
||||||
|
|
||||||
|
/* we know how many entries we need, so we can allocate
|
||||||
|
everything here */
|
||||||
|
hash = malloc(sizeof *hash);
|
||||||
|
if (!hash)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* use power-of-2 sized hash table for decoding speed */
|
||||||
|
for (s = STARTING_HASH_SIZE; s < maxnum; s <<= 1)
|
||||||
|
;
|
||||||
|
hash->size = s;
|
||||||
|
hash->maxnum = maxnum;
|
||||||
|
bytes = hash->size * sizeof (struct hash_entry **);
|
||||||
|
hash->entries = NULL; /* in case malloc fails */
|
||||||
|
hash->table = malloc(bytes);
|
||||||
|
if (!hash->table)
|
||||||
|
return NULL;
|
||||||
|
memset(hash->table, 0, bytes);
|
||||||
|
hash->entries = malloc(maxnum * sizeof (struct hash_entry));
|
||||||
|
if (!hash->entries)
|
||||||
|
{
|
||||||
|
free(hash->table);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
hash->next_free = hash->entries;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int add_colorhash(struct color_hash *hash,
|
||||||
|
char *key, int cpp, Uint32 color)
|
||||||
|
{
|
||||||
|
const int indexkey = hash_key(key, cpp, hash->size);
|
||||||
|
struct hash_entry *e = hash->next_free++;
|
||||||
|
e->color = color;
|
||||||
|
e->key = key;
|
||||||
|
e->next = hash->table[indexkey];
|
||||||
|
hash->table[indexkey] = e;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fast lookup that works if cpp == 1 */
|
||||||
|
#define QUICK_COLORHASH(hash, key) ((hash)->table[*(const Uint8 *)(key)]->color)
|
||||||
|
|
||||||
|
static Uint32 get_colorhash(struct color_hash *hash, const char *key, int cpp)
|
||||||
|
{
|
||||||
|
struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)];
|
||||||
|
while (entry) {
|
||||||
|
if (memcmp(key, entry->key, cpp) == 0)
|
||||||
|
return entry->color;
|
||||||
|
entry = entry->next;
|
||||||
|
}
|
||||||
|
return 0; /* garbage in - garbage out */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_colorhash(struct color_hash *hash)
|
||||||
|
{
|
||||||
|
if (hash && hash->table) {
|
||||||
|
free(hash->table);
|
||||||
|
free(hash->entries);
|
||||||
|
free(hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* portable case-insensitive string comparison */
|
||||||
|
static int string_equal(const char *a, const char *b, size_t n)
|
||||||
|
{
|
||||||
|
while (*a && *b && n) {
|
||||||
|
if (toupper((unsigned char)*a) != toupper((unsigned char)*b))
|
||||||
|
return 0;
|
||||||
|
a++;
|
||||||
|
b++;
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
return *a == *b;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef ARRAYSIZE
|
||||||
|
#define ARRAYSIZE(a) (int)(sizeof (a) / sizeof ((a)[0]))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* convert colour spec to RGB (in 0xrrggbb format).
|
||||||
|
* return 1 if successful.
|
||||||
|
*/
|
||||||
|
static int color_to_rgb(const char *spec, size_t speclen, Uint32 *rgb)
|
||||||
|
{
|
||||||
|
/* poor man's rgb.txt */
|
||||||
|
static struct { const char *name; Uint32 rgb; } known[] = {
|
||||||
|
{"none", 0xffffffff},
|
||||||
|
{"black", 0x00000000},
|
||||||
|
{"white", 0x00ffffff},
|
||||||
|
{"red", 0x00ff0000},
|
||||||
|
{"green", 0x0000ff00},
|
||||||
|
{"blue", 0x000000ff}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (spec[0] == '#') {
|
||||||
|
char buf[7];
|
||||||
|
switch (speclen) {
|
||||||
|
case 4:
|
||||||
|
buf[0] = buf[1] = spec[1];
|
||||||
|
buf[2] = buf[3] = spec[2];
|
||||||
|
buf[4] = buf[5] = spec[3];
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
memcpy(buf, spec + 1, 6);
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
buf[0] = spec[1];
|
||||||
|
buf[1] = spec[2];
|
||||||
|
buf[2] = spec[5];
|
||||||
|
buf[3] = spec[6];
|
||||||
|
buf[4] = spec[9];
|
||||||
|
buf[5] = spec[10];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
buf[6] = '\0';
|
||||||
|
*rgb = (Uint32)strtol(buf, NULL, 16);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < ARRAYSIZE(known); i++)
|
||||||
|
if (string_equal(known[i].name, spec, speclen)) {
|
||||||
|
*rgb = known[i].rgb;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char *linebuf;
|
||||||
|
static int buflen;
|
||||||
|
static const char *error;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read next line from the source.
|
||||||
|
* If len > 0, it's assumed to be at least len chars (for efficiency).
|
||||||
|
* Return NULL and set error upon EOF or parse error.
|
||||||
|
*/
|
||||||
|
static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
|
||||||
|
{
|
||||||
|
char *linebufnew;
|
||||||
|
if (lines) {
|
||||||
|
return *(*lines)++;
|
||||||
|
} else {
|
||||||
|
char c;
|
||||||
|
int n;
|
||||||
|
do {
|
||||||
|
if (SDL_RWread(src, &c, 1, 1) <= 0) {
|
||||||
|
error = "Premature end of data";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} while (c != '"');
|
||||||
|
if (len) {
|
||||||
|
len += 4; /* "\",\n\0" */
|
||||||
|
if (len > buflen){
|
||||||
|
buflen = len;
|
||||||
|
linebufnew = realloc(linebuf, buflen);
|
||||||
|
if(!linebufnew) {
|
||||||
|
free(linebuf);
|
||||||
|
error = "Out of memory";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
linebuf = linebufnew;
|
||||||
|
}
|
||||||
|
if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
|
||||||
|
error = "Premature end of data";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
n = len - 2;
|
||||||
|
} else {
|
||||||
|
n = 0;
|
||||||
|
do {
|
||||||
|
if (n >= buflen - 1) {
|
||||||
|
if (buflen == 0)
|
||||||
|
buflen = 16;
|
||||||
|
buflen *= 2;
|
||||||
|
linebufnew = realloc(linebuf, buflen);
|
||||||
|
if(!linebufnew) {
|
||||||
|
free(linebuf);
|
||||||
|
error = "Out of memory";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
linebuf = linebufnew;
|
||||||
|
}
|
||||||
|
if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
|
||||||
|
error = "Premature end of data";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} while (linebuf[n++] != '"');
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
linebuf[n] = '\0';
|
||||||
|
return linebuf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SKIPSPACE(p) \
|
||||||
|
do { \
|
||||||
|
while (isspace((unsigned char)*(p))) \
|
||||||
|
++(p); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define SKIPNONSPACE(p) \
|
||||||
|
do { \
|
||||||
|
while (!isspace((unsigned char)*(p)) && *p) \
|
||||||
|
++(p); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* read XPM from either array or RWops */
|
||||||
|
static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
|
||||||
|
{
|
||||||
|
SDL_Surface *image = NULL;
|
||||||
|
int indexc;
|
||||||
|
int x, y;
|
||||||
|
int w, h, ncolors, cpp;
|
||||||
|
int indexed;
|
||||||
|
Uint8 *dst;
|
||||||
|
struct color_hash *colors = NULL;
|
||||||
|
SDL_Color *im_colors = NULL;
|
||||||
|
char *keystrings = NULL, *nextkey;
|
||||||
|
const char *line;
|
||||||
|
const char ***xpmlines = NULL;
|
||||||
|
int pixels_len;
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
|
linebuf = NULL;
|
||||||
|
buflen = 0;
|
||||||
|
|
||||||
|
if (xpm)
|
||||||
|
xpmlines = &xpm;
|
||||||
|
|
||||||
|
line = get_next_line(xpmlines, src, 0);
|
||||||
|
if (!line)
|
||||||
|
goto done;
|
||||||
|
/*
|
||||||
|
* The header string of an XPMv3 image has the format
|
||||||
|
*
|
||||||
|
* <width> <height> <ncolors> <cpp> [ <hotspot_x> <hotspot_y> ]
|
||||||
|
*
|
||||||
|
* where the hotspot coords are intended for mouse cursors.
|
||||||
|
* Right now we don't use the hotspots but it should be handled
|
||||||
|
* one day.
|
||||||
|
*/
|
||||||
|
if (sscanf(line, "%d %d %d %d", &w, &h, &ncolors, &cpp) != 4
|
||||||
|
|| w <= 0 || h <= 0 || ncolors <= 0 || cpp <= 0) {
|
||||||
|
error = "Invalid format description";
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
keystrings = malloc(ncolors * cpp);
|
||||||
|
if (!keystrings) {
|
||||||
|
error = "Out of memory";
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
nextkey = keystrings;
|
||||||
|
|
||||||
|
/* Create the new surface */
|
||||||
|
if (ncolors <= 256) {
|
||||||
|
indexed = 1;
|
||||||
|
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
|
||||||
|
0, 0, 0, 0);
|
||||||
|
im_colors = image->format->palette->colors;
|
||||||
|
image->format->palette->ncolors = ncolors;
|
||||||
|
} else {
|
||||||
|
indexed = 0;
|
||||||
|
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
|
||||||
|
0xff0000, 0x00ff00, 0x0000ff, 0);
|
||||||
|
}
|
||||||
|
if (!image) {
|
||||||
|
/* Hmm, some SDL error (out of memory?) */
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the colors */
|
||||||
|
colors = create_colorhash(ncolors);
|
||||||
|
if (!colors) {
|
||||||
|
error = "Out of memory";
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
for (indexc = 0; indexc < ncolors; ++indexc ) {
|
||||||
|
const char *p;
|
||||||
|
line = get_next_line(xpmlines, src, 0);
|
||||||
|
if (!line)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
p = line + cpp + 1;
|
||||||
|
|
||||||
|
/* parse a colour definition */
|
||||||
|
for (;;) {
|
||||||
|
char nametype;
|
||||||
|
const char *colname;
|
||||||
|
Uint32 rgb, pixel;
|
||||||
|
|
||||||
|
SKIPSPACE(p);
|
||||||
|
if (!*p) {
|
||||||
|
error = "colour parse error";
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
nametype = *p;
|
||||||
|
SKIPNONSPACE(p);
|
||||||
|
SKIPSPACE(p);
|
||||||
|
colname = p;
|
||||||
|
SKIPNONSPACE(p);
|
||||||
|
if (nametype == 's')
|
||||||
|
continue; /* skip symbolic colour names */
|
||||||
|
|
||||||
|
if (!color_to_rgb(colname, p - colname, &rgb))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
memcpy(nextkey, line, cpp);
|
||||||
|
if (indexed) {
|
||||||
|
SDL_Color *c = im_colors + indexc;
|
||||||
|
c->r = (Uint8)(rgb >> 16);
|
||||||
|
c->g = (Uint8)(rgb >> 8);
|
||||||
|
c->b = (Uint8)(rgb);
|
||||||
|
pixel = indexc;
|
||||||
|
} else
|
||||||
|
pixel = rgb;
|
||||||
|
add_colorhash(colors, nextkey, cpp, pixel);
|
||||||
|
nextkey += cpp;
|
||||||
|
if (rgb == 0xffffffff)
|
||||||
|
SDL_SetColorKey(image, SDL_SRCCOLORKEY, pixel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the pixels */
|
||||||
|
pixels_len = w * cpp;
|
||||||
|
dst = image->pixels;
|
||||||
|
for (y = 0; y < h; y++) {
|
||||||
|
line = get_next_line(xpmlines, src, pixels_len);
|
||||||
|
if (indexed) {
|
||||||
|
/* optimization for some common cases */
|
||||||
|
if (cpp == 1)
|
||||||
|
for (x = 0; x < w; x++)
|
||||||
|
dst[x] = (Uint8)QUICK_COLORHASH(colors,
|
||||||
|
line + x);
|
||||||
|
else
|
||||||
|
for (x = 0; x < w; x++)
|
||||||
|
dst[x] = (Uint8)get_colorhash(colors,
|
||||||
|
line + x * cpp,
|
||||||
|
cpp);
|
||||||
|
} else {
|
||||||
|
for (x = 0; x < w; x++)
|
||||||
|
((Uint32*)dst)[x] = get_colorhash(colors,
|
||||||
|
line + x * cpp,
|
||||||
|
cpp);
|
||||||
|
}
|
||||||
|
dst += image->pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (error) {
|
||||||
|
SDL_FreeSurface(image);
|
||||||
|
image = NULL;
|
||||||
|
SDL_SetError(error);
|
||||||
|
}
|
||||||
|
free(keystrings);
|
||||||
|
free_colorhash(colors);
|
||||||
|
free(linebuf);
|
||||||
|
return(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load a XPM type image from an RWops datasource */
|
||||||
|
#if 0
|
||||||
|
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
|
||||||
|
{
|
||||||
|
if ( !src ) {
|
||||||
|
/* The error message has been set in SDL_RWFromFile */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return load_xpm(NULL, src);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
|
||||||
|
{
|
||||||
|
return load_xpm(xpm, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* not LOAD_XPM */
|
||||||
|
|
||||||
|
/* See if an image is contained in a data source */
|
||||||
|
#if 0
|
||||||
|
int IMG_isXPM(SDL_RWops *src)
|
||||||
|
{
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load a XPM type image from an SDL datasource */
|
||||||
|
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
|
||||||
|
{
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif /* not LOAD_XPM */
|
17
src/sdl12/MakeCYG.cfg
Normal file
17
src/sdl12/MakeCYG.cfg
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#
|
||||||
|
# sdl/makeCYG.cfg for SRB2/Cygwin
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
#Cygwin, for debugging
|
||||||
|
|
||||||
|
NOHW=1
|
||||||
|
NOHS=1
|
||||||
|
NOASM=1
|
||||||
|
|
||||||
|
OPTS+=-DLINUX
|
||||||
|
|
||||||
|
i_system_o+=$(OBJDIR)/SRB2.res
|
||||||
|
|
||||||
|
# name of the exefile
|
||||||
|
EXENAME?=lsdlsrb2.exe
|
92
src/sdl12/MakeNIX.cfg
Normal file
92
src/sdl12/MakeNIX.cfg
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#
|
||||||
|
# sdl/makeNIX.cfg for SRB2/?nix
|
||||||
|
#
|
||||||
|
|
||||||
|
#Valgrind support
|
||||||
|
ifdef VALGRIND
|
||||||
|
VALGRIND_PKGCONFIG?=valgrind
|
||||||
|
VALGRIND_CFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --cflags)
|
||||||
|
VALGRIND_LDFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --libs)
|
||||||
|
ZDEBUG=1
|
||||||
|
LIBS+=$(VALGRIND_LDFLAGS)
|
||||||
|
ifdef GCC46
|
||||||
|
WFLAGS+=-Wno-error=unused-but-set-variable
|
||||||
|
WFLAGS+=-Wno-unused-but-set-variable
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
#here is GNU/Linux and other
|
||||||
|
#
|
||||||
|
|
||||||
|
OPTS=-DUNIXCOMMON
|
||||||
|
|
||||||
|
#LDFLAGS = -L/usr/local/lib
|
||||||
|
LIBS=-lm
|
||||||
|
ifdef LINUX
|
||||||
|
LIBS+=-lrt
|
||||||
|
ifdef NOTERMIOS
|
||||||
|
OPTS+=-DNOTERMIOS
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
#here is Solaris
|
||||||
|
#
|
||||||
|
ifdef SOLARIS
|
||||||
|
NOIPX=1
|
||||||
|
NOASM=1
|
||||||
|
OPTS+=-DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
|
||||||
|
OPTS+=-I/usr/local/include -I/opt/sfw/include
|
||||||
|
LDFLAGS+=-L/opt/sfw/lib
|
||||||
|
LIBS+=-lsocket -lnsl
|
||||||
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
#here is FreeBSD
|
||||||
|
#
|
||||||
|
ifdef FREEBSD
|
||||||
|
OPTS+=-DLINUX -DFREEBSD -I/usr/X11R6/include
|
||||||
|
SDL_CONFIG?=sdl11-config
|
||||||
|
LDFLAGS+=-L/usr/X11R6/lib
|
||||||
|
LIBS+=-lipx -lkvm
|
||||||
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
#here is GP2x (arm-gp2x-linux)
|
||||||
|
#
|
||||||
|
ifdef GP2X
|
||||||
|
PNG_CONFIG?=$(PREFIX)-libpng12-config
|
||||||
|
ifdef STATIC #need a better setting name
|
||||||
|
CFLAGS+=-I$(OPEN2X)/include
|
||||||
|
ifndef NOMIXER
|
||||||
|
LIBS+=-lvorbisidec
|
||||||
|
ifdef MIKMOD
|
||||||
|
LIBS+=-lmikmod
|
||||||
|
endif
|
||||||
|
ifdef SMPEGLIB
|
||||||
|
LIBS+=-lsmpeg
|
||||||
|
LD=$(CXX)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
NONET=1
|
||||||
|
endif
|
||||||
|
ifndef ARCHNAME
|
||||||
|
"error"
|
||||||
|
endif
|
||||||
|
NONX86=1
|
||||||
|
NOHW=1
|
||||||
|
NOHS=1
|
||||||
|
NOMD5=1
|
||||||
|
WFLAGS+=-O0
|
||||||
|
OPTS+=-DGP2X -ffast-math -mcpu=arm920t
|
||||||
|
EXENAME?=SRB2GP2X.gpe
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef NOHW
|
||||||
|
OPTS+=-I/usr/X11R6/include
|
||||||
|
LDFLAGS+=-L/usr/X11R6/lib
|
||||||
|
endif
|
||||||
|
|
||||||
|
# name of the exefile
|
||||||
|
EXENAME?=lsdlsrb2
|
163
src/sdl12/Makefile.cfg
Normal file
163
src/sdl12/Makefile.cfg
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
#
|
||||||
|
# sdl/makefile.cfg for SRB2/SDL
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
#SDL...., *looks at Alam*, THIS IS A MESS!
|
||||||
|
#
|
||||||
|
|
||||||
|
ifdef UNIXCOMMON
|
||||||
|
include sdl/MakeNIX.cfg
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef PANDORA
|
||||||
|
include sdl/SRB2Pandora/Makefile.cfg
|
||||||
|
endif #ifdef PANDORA
|
||||||
|
|
||||||
|
ifdef DC
|
||||||
|
include sdl/SRB2DC/Makefile.cfg
|
||||||
|
endif #ifdef DC
|
||||||
|
|
||||||
|
ifdef PS3N
|
||||||
|
include sdl/SRB2PS3/Makefile.cfg
|
||||||
|
endif #ifdef PS3N
|
||||||
|
|
||||||
|
ifdef PSP
|
||||||
|
include sdl/SRB2PSP/Makefile.cfg
|
||||||
|
endif #ifdef PSP
|
||||||
|
|
||||||
|
ifdef XBOX
|
||||||
|
include sdl/SRB2XBOX/Makefile.cfg
|
||||||
|
endif #ifdef XBOX
|
||||||
|
|
||||||
|
ifdef WINCE
|
||||||
|
include sdl/SRB2CE/Makefile.cfg
|
||||||
|
endif #ifef WINCE
|
||||||
|
|
||||||
|
ifdef CYGWIN32
|
||||||
|
include sdl/MakeCYG.cfg
|
||||||
|
endif #ifdef CYGWIN32
|
||||||
|
|
||||||
|
ifdef SDL_PKGCONFIG
|
||||||
|
SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags)
|
||||||
|
SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
|
||||||
|
else
|
||||||
|
ifdef PREFIX
|
||||||
|
SDL_CONFIG?=$(PREFIX)-sdl-config
|
||||||
|
else
|
||||||
|
SDL_CONFIG?=sdl-config
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef STATIC
|
||||||
|
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
|
||||||
|
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --static-libs)
|
||||||
|
else
|
||||||
|
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
|
||||||
|
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --libs)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
#use the x86 asm code
|
||||||
|
ifndef CYGWIN32
|
||||||
|
ifndef NOASM
|
||||||
|
USEASM=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
|
||||||
|
|
||||||
|
OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL
|
||||||
|
|
||||||
|
ifndef NOHW
|
||||||
|
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef NOHS
|
||||||
|
ifdef OPENAL
|
||||||
|
OBJS+=$(OBJDIR)/s_openal.o
|
||||||
|
OPTS+=-DSTATIC3DS
|
||||||
|
STATICHS=1
|
||||||
|
else
|
||||||
|
ifdef FMOD
|
||||||
|
OBJS+=$(OBJDIR)/s_fmod.o
|
||||||
|
OPTS+=-DSTATIC3DS
|
||||||
|
STATICHS=1
|
||||||
|
else
|
||||||
|
ifdef MINGW
|
||||||
|
ifdef DS3D
|
||||||
|
OBJS+=$(OBJDIR)/s_ds3d.o
|
||||||
|
OPTS+=-DSTATIC3DS
|
||||||
|
STATICHS=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef FILTERS
|
||||||
|
OBJS+=$(OBJDIR)/filters.o $(OBJDIR)/hq2x.o $(OBJDIR)/lq2x.o
|
||||||
|
OPTS+=-DHAVE_FILTER
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef NOMIXER
|
||||||
|
i_sound_o=$(OBJDIR)/sdl_sound.o
|
||||||
|
else
|
||||||
|
i_sound_o=$(OBJDIR)/mixer_sound.o
|
||||||
|
OPTS+=-DHAVE_MIXER
|
||||||
|
SDL_LDFLAGS+=-lSDL_mixer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef SDL_TTF
|
||||||
|
OPTS+=-DHAVE_TTF
|
||||||
|
SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz
|
||||||
|
OBJS+=$(OBJDIR)/i_ttf.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
#ifdef SDL_IMAGE
|
||||||
|
# OPTS+=-DHAVE_IMAGE
|
||||||
|
# SDL_LDFLAGS+=-lSDL_image
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ifdef SDL_NET
|
||||||
|
OPTS+=-DHAVE_SDLNET
|
||||||
|
SDL_LDFLAGS+=-lSDL_net
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef SDLMAIN
|
||||||
|
OPTS+=-DSDLMAIN
|
||||||
|
else
|
||||||
|
ifdef MINGW
|
||||||
|
SDL_CFLAGS+=-Umain
|
||||||
|
SDL_LDFLAGS+=-mconsole
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef NOHW
|
||||||
|
ifdef OPENAL
|
||||||
|
ifdef MINGW
|
||||||
|
LIBS:=-lopenal32 $(LIBS)
|
||||||
|
else
|
||||||
|
LIBS:=-lopenal $(LIBS)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifdef MINGW
|
||||||
|
ifdef DS3D
|
||||||
|
LIBS:=-ldsound -luuid $(LIBS)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order
|
||||||
|
ifdef WII
|
||||||
|
include sdl/SRB2WII/Makefile.cfg
|
||||||
|
endif #ifdef WII
|
||||||
|
|
||||||
|
CFLAGS+=$(SDL_CFLAGS)
|
||||||
|
LIBS:=$(SDL_LDFLAGS) $(LIBS)
|
||||||
|
ifndef WII
|
||||||
|
ifdef STATIC
|
||||||
|
LIBS+=$(shell $(SDL_CONFIG) --static-libs)
|
||||||
|
endif
|
||||||
|
endif
|
80
src/sdl12/SDL_icon.xpm
Normal file
80
src/sdl12/SDL_icon.xpm
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/* XPM */
|
||||||
|
static const char * SDL_icon_xpm[] = {
|
||||||
|
"32 32 45 1",
|
||||||
|
" c None",
|
||||||
|
". c #6B6BFF",
|
||||||
|
"+ c #3D00B9",
|
||||||
|
"@ c #4848FF",
|
||||||
|
"# c #2525FF",
|
||||||
|
"$ c #310096",
|
||||||
|
"% c #003196",
|
||||||
|
"& c #003DB9",
|
||||||
|
"* c #620096",
|
||||||
|
"= c #6E6E6E",
|
||||||
|
"- c #966200",
|
||||||
|
"; c #250073",
|
||||||
|
"> c #626262",
|
||||||
|
", c #FF8F6B",
|
||||||
|
"' c #FFC66B",
|
||||||
|
") c #FFAB8E",
|
||||||
|
"! c #000080",
|
||||||
|
"~ c #B6B6B6",
|
||||||
|
"{ c #929292",
|
||||||
|
"] c #FFD48E",
|
||||||
|
"^ c #0000B9",
|
||||||
|
"/ c #565656",
|
||||||
|
"( c #868686",
|
||||||
|
"_ c #808080",
|
||||||
|
": c #C0C0C0",
|
||||||
|
"< c #DADADA",
|
||||||
|
"[ c #F2F2F2",
|
||||||
|
"} c #FFFFFF",
|
||||||
|
"| c #CECECE",
|
||||||
|
"1 c #AAAAAA",
|
||||||
|
"2 c #E6E6E6",
|
||||||
|
"3 c #000096",
|
||||||
|
"4 c #AB8EFF",
|
||||||
|
"5 c #190050",
|
||||||
|
"6 c #000000",
|
||||||
|
"7 c #8E8EFF",
|
||||||
|
"8 c #3E3E3E",
|
||||||
|
"9 c #7A7A7A",
|
||||||
|
"0 c #0E0E0E",
|
||||||
|
"a c #9E9E9E",
|
||||||
|
"b c #001950",
|
||||||
|
"c c #C2C2C2",
|
||||||
|
"d c #323232",
|
||||||
|
"e c #002573",
|
||||||
|
"f c #A0A0A4",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" .+@##@. ",
|
||||||
|
" @@.@#######@ ",
|
||||||
|
" @@....######### ",
|
||||||
|
" .. .@.....@+##$%%%&&% ",
|
||||||
|
" ..@# @@....@+#*=-;%%%%% ",
|
||||||
|
" ..@#@......@>,')!%%%$ ",
|
||||||
|
" ~..$#.........{])^#+%/ ",
|
||||||
|
" +##@.........()^@@@@@_ ",
|
||||||
|
" $####@........#=#######+ ",
|
||||||
|
" +######....@@##^#########_ ",
|
||||||
|
" +#####=:<<:+##############/ ",
|
||||||
|
"[<=####{<}}}}|###############= ",
|
||||||
|
" }1###=2}}}}}}.############### ",
|
||||||
|
" }<3#3~}}}}}}}4################ ",
|
||||||
|
" }<5#6:}}}}}}}7################/",
|
||||||
|
" }:6861}}}}}}}.########$$ 9 .@$",
|
||||||
|
" }:0a6~}}}}}}}@######5b ",
|
||||||
|
"22cd262}}}}}}2######5b$ ",
|
||||||
|
" 2>1a}}}}}}}{(*###%be## ",
|
||||||
|
" 860)1<[22c1)]]+##be### ",
|
||||||
|
" ~)]]]))))]]]]]=#bb#### ",
|
||||||
|
" )]]]]]]]]](]]=eb$#### ",
|
||||||
|
" :]]]]]]]]]'9bbb$##### ",
|
||||||
|
" ),'''''( >db+### ",
|
||||||
|
" =##f ",
|
||||||
|
" { ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
12
src/sdl12/SDL_main/SDL_dummy_main.c
Normal file
12
src/sdl12/SDL_main/SDL_dummy_main.c
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* Include the SDL main definition header */
|
||||||
|
#include "SDL_main.h"
|
||||||
|
|
||||||
|
#ifdef main
|
||||||
|
#undef main
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return(SDL_main(argc, argv));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* Nothing to do on this platform */;
|
||||||
|
#endif
|
11
src/sdl12/SDL_main/SDL_macosx_main.h
Normal file
11
src/sdl12/SDL_main/SDL_macosx_main.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||||
|
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||||
|
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||||
|
|
||||||
|
Feel free to customize this file to suit your needs
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@interface SDLMain : NSObject
|
||||||
|
@end
|
374
src/sdl12/SDL_main/SDL_macosx_main.m
Normal file
374
src/sdl12/SDL_main/SDL_macosx_main.m
Normal file
|
@ -0,0 +1,374 @@
|
||||||
|
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||||
|
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||||
|
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||||
|
|
||||||
|
Feel free to customize this file to suit your needs
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "SDL.h"
|
||||||
|
#import "SDL_macosx_main.h"
|
||||||
|
#import <sys/param.h> /* for MAXPATHLEN */
|
||||||
|
#import <unistd.h>
|
||||||
|
|
||||||
|
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||||
|
but the method still is there and works. To avoid warnings, we declare
|
||||||
|
it ourselves here. */
|
||||||
|
@interface NSApplication(SDL_Missing_Methods)
|
||||||
|
- (void)setAppleMenu:(NSMenu *)menu;
|
||||||
|
@end
|
||||||
|
|
||||||
|
/* Use this flag to determine whether we use SDLMain.nib or not */
|
||||||
|
#define SDL_USE_NIB_FILE 0
|
||||||
|
|
||||||
|
/* Use this flag to determine whether we use CPS (docking) or not */
|
||||||
|
#define SDL_USE_CPS 1
|
||||||
|
#if SDL_USE_CPS
|
||||||
|
/* Portions of CPS.h */
|
||||||
|
typedef struct CPSProcessSerNum
|
||||||
|
{
|
||||||
|
UInt32 lo;
|
||||||
|
UInt32 hi;
|
||||||
|
} CPSProcessSerNum;
|
||||||
|
|
||||||
|
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
|
||||||
|
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
|
||||||
|
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
|
||||||
|
|
||||||
|
#endif /* SDL_USE_CPS */
|
||||||
|
|
||||||
|
static int gArgc;
|
||||||
|
static char **gArgv;
|
||||||
|
static BOOL gFinderLaunch;
|
||||||
|
|
||||||
|
static void addArgument(const char *value)
|
||||||
|
{
|
||||||
|
if(!gArgc)
|
||||||
|
gArgv = (char **)malloc(sizeof(*gArgv));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char **newgArgv = (char **)realloc(gArgv, sizeof(*gArgv) * (gArgc + 1));
|
||||||
|
if (!newgArgv)
|
||||||
|
{
|
||||||
|
newgArgv = malloc(sizeof(*gArgv) * (gArgc + 1));
|
||||||
|
memcpy(newgArgv, gArgv, sizeof(*gArgv) * gArgc);
|
||||||
|
free(gArgv);
|
||||||
|
}
|
||||||
|
gArgv = newgArgv;
|
||||||
|
}
|
||||||
|
gArgc++;
|
||||||
|
gArgv[gArgc - 1] = (char *)malloc(sizeof(char) * (strlen(value) + 1));
|
||||||
|
strcpy(gArgv[gArgc - 1], value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *getApplicationName(void)
|
||||||
|
{
|
||||||
|
NSDictionary *dict;
|
||||||
|
NSString *appName = NULL;
|
||||||
|
|
||||||
|
/* Determine the application name */
|
||||||
|
dict = ( NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
|
||||||
|
if (dict)
|
||||||
|
appName = [dict objectForKey: @"CFBundleName"];
|
||||||
|
|
||||||
|
if (![appName length])
|
||||||
|
appName = [[NSProcessInfo processInfo] processName];
|
||||||
|
|
||||||
|
return appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SDL_USE_NIB_FILE
|
||||||
|
/* A helper category for NSString */
|
||||||
|
@interface NSString (ReplaceSubString)
|
||||||
|
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
|
||||||
|
@end
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface SDLApplication : NSApplication
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation SDLApplication
|
||||||
|
/* Invoked from the Quit menu item */
|
||||||
|
- (void)terminate:(id)sender
|
||||||
|
{
|
||||||
|
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||||
|
(void)sender;
|
||||||
|
#endif
|
||||||
|
/* Post a SDL_QUIT event */
|
||||||
|
SDL_Event event;
|
||||||
|
event.type = SDL_QUIT;
|
||||||
|
SDL_PushEvent(&event);
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
/* The main class of the application, the application's delegate */
|
||||||
|
@implementation SDLMain
|
||||||
|
|
||||||
|
/* Set the working directory to the .app's parent directory */
|
||||||
|
- (void) setupWorkingDirectory:(BOOL)shouldChdir
|
||||||
|
{
|
||||||
|
if (shouldChdir)
|
||||||
|
{
|
||||||
|
char parentdir[MAXPATHLEN];
|
||||||
|
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||||
|
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
|
||||||
|
if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN))
|
||||||
|
{
|
||||||
|
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
|
||||||
|
}
|
||||||
|
CFRelease(url);
|
||||||
|
CFRelease(url2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SDL_USE_NIB_FILE
|
||||||
|
|
||||||
|
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||||
|
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
|
||||||
|
{
|
||||||
|
NSRange aRange;
|
||||||
|
NSEnumerator *enumerator;
|
||||||
|
NSMenuItem *menuItem;
|
||||||
|
|
||||||
|
aRange = [[aMenu title] rangeOfString:@"SDL App"];
|
||||||
|
if (aRange.length != 0)
|
||||||
|
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
|
||||||
|
|
||||||
|
enumerator = [[aMenu itemArray] objectEnumerator];
|
||||||
|
while ((menuItem = [enumerator nextObject]))
|
||||||
|
{
|
||||||
|
aRange = [[menuItem title] rangeOfString:@"SDL App"];
|
||||||
|
if (aRange.length != 0)
|
||||||
|
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
|
||||||
|
if ([menuItem hasSubmenu])
|
||||||
|
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||||
|
}
|
||||||
|
[ aMenu sizeToFit ];
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static void setApplicationMenu(void)
|
||||||
|
{
|
||||||
|
/* warning: this code is very odd */
|
||||||
|
NSMenu *appleMenu;
|
||||||
|
NSMenuItem *menuItem;
|
||||||
|
NSString *title;
|
||||||
|
NSString *appName;
|
||||||
|
|
||||||
|
appName = getApplicationName();
|
||||||
|
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||||
|
|
||||||
|
/* Add menu items */
|
||||||
|
title = [@"About " stringByAppendingString:appName];
|
||||||
|
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||||
|
|
||||||
|
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
|
title = [@"Hide " stringByAppendingString:appName];
|
||||||
|
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
|
||||||
|
|
||||||
|
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
||||||
|
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
|
||||||
|
|
||||||
|
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||||
|
|
||||||
|
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
|
title = [@"Quit " stringByAppendingString:appName];
|
||||||
|
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||||
|
|
||||||
|
|
||||||
|
/* Put menu into the menubar */
|
||||||
|
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||||
|
[menuItem setSubmenu:appleMenu];
|
||||||
|
[[NSApp mainMenu] addItem:menuItem];
|
||||||
|
|
||||||
|
/* Tell the application object that this is now the application menu */
|
||||||
|
[NSApp setAppleMenu:appleMenu];
|
||||||
|
|
||||||
|
/* Finally give up our references to the objects */
|
||||||
|
[appleMenu release];
|
||||||
|
[menuItem release];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a window menu */
|
||||||
|
static void setupWindowMenu(void)
|
||||||
|
{
|
||||||
|
NSMenu *windowMenu;
|
||||||
|
NSMenuItem *windowMenuItem;
|
||||||
|
NSMenuItem *menuItem;
|
||||||
|
|
||||||
|
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||||
|
|
||||||
|
/* "Minimize" item */
|
||||||
|
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
||||||
|
[windowMenu addItem:menuItem];
|
||||||
|
[menuItem release];
|
||||||
|
|
||||||
|
/* Put menu into the menubar */
|
||||||
|
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
||||||
|
[windowMenuItem setSubmenu:windowMenu];
|
||||||
|
[[NSApp mainMenu] addItem:windowMenuItem];
|
||||||
|
|
||||||
|
/* Tell the application object that this is now the window menu */
|
||||||
|
[NSApp setWindowsMenu:windowMenu];
|
||||||
|
|
||||||
|
/* Finally give up our references to the objects */
|
||||||
|
[windowMenu release];
|
||||||
|
[windowMenuItem release];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replacement for NSApplicationMain */
|
||||||
|
static void CustomApplicationMain (int argc, char **argv)
|
||||||
|
{
|
||||||
|
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
#endif
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
SDLMain *sdlMain;
|
||||||
|
|
||||||
|
/* Ensure the application object is initialised */
|
||||||
|
[SDLApplication sharedApplication];
|
||||||
|
|
||||||
|
#if SDL_USE_CPS
|
||||||
|
{
|
||||||
|
CPSProcessSerNum PSN;
|
||||||
|
/* Tell the dock about us */
|
||||||
|
if (!CPSGetCurrentProcess(&PSN))
|
||||||
|
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
|
||||||
|
if (!CPSSetFrontProcess(&PSN))
|
||||||
|
[SDLApplication sharedApplication];
|
||||||
|
}
|
||||||
|
#endif /* SDL_USE_CPS */
|
||||||
|
|
||||||
|
/* Set up the menubar */
|
||||||
|
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||||
|
setApplicationMenu();
|
||||||
|
setupWindowMenu();
|
||||||
|
|
||||||
|
/* Create SDLMain and make it the app delegate */
|
||||||
|
sdlMain = [[SDLMain alloc] init];
|
||||||
|
[NSApp setDelegate:sdlMain];
|
||||||
|
|
||||||
|
/* Start the main event loop */
|
||||||
|
[NSApp run];
|
||||||
|
|
||||||
|
[sdlMain release];
|
||||||
|
[pool release];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||||
|
{
|
||||||
|
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||||
|
(void)theApplication;
|
||||||
|
#endif
|
||||||
|
addArgument("-iwad");
|
||||||
|
addArgument([filename UTF8String]);
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Called when the internal event loop has just started running */
|
||||||
|
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||||
|
{
|
||||||
|
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||||
|
(void)note;
|
||||||
|
#endif
|
||||||
|
int status;
|
||||||
|
|
||||||
|
/* Set the working directory to the .app's parent directory */
|
||||||
|
[self setupWorkingDirectory:gFinderLaunch];
|
||||||
|
|
||||||
|
#if SDL_USE_NIB_FILE
|
||||||
|
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||||
|
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!getenv("SRB2WADDIR"))
|
||||||
|
setenv("SRB2WADDIR", [[[NSBundle mainBundle] resourcePath] UTF8String], 1);
|
||||||
|
|
||||||
|
/* Hand off to main application code */
|
||||||
|
status = SDL_main (gArgc, gArgv);
|
||||||
|
|
||||||
|
/* We're done, thank you for playing */
|
||||||
|
exit(status);
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@implementation NSString (ReplaceSubString)
|
||||||
|
|
||||||
|
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
|
||||||
|
{
|
||||||
|
size_t bufferSize;
|
||||||
|
size_t selfLen = [self length];
|
||||||
|
size_t aStringLen = [aString length];
|
||||||
|
unichar *buffer;
|
||||||
|
NSRange localRange;
|
||||||
|
NSString *result;
|
||||||
|
|
||||||
|
bufferSize = selfLen + aStringLen - aRange.length;
|
||||||
|
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
|
||||||
|
|
||||||
|
/* Get first part into buffer */
|
||||||
|
localRange.location = 0;
|
||||||
|
localRange.length = aRange.location;
|
||||||
|
[self getCharacters:buffer range:localRange];
|
||||||
|
|
||||||
|
/* Get middle part into buffer */
|
||||||
|
localRange.location = 0;
|
||||||
|
localRange.length = aStringLen;
|
||||||
|
[aString getCharacters:(buffer+aRange.location) range:localRange];
|
||||||
|
|
||||||
|
/* Get last part into buffer */
|
||||||
|
localRange.location = aRange.location + aRange.length;
|
||||||
|
localRange.length = selfLen - localRange.location;
|
||||||
|
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
|
||||||
|
|
||||||
|
/* Build output string */
|
||||||
|
result = [NSString stringWithCharacters:buffer length:bufferSize];
|
||||||
|
|
||||||
|
NSDeallocateMemoryPages(buffer, bufferSize);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef main
|
||||||
|
# undef main
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Main entry point to executable - should *not* be SDL_main! */
|
||||||
|
int main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Copy the arguments into a global variable */
|
||||||
|
|
||||||
|
/* This is passed if we are launched by double-clicking */
|
||||||
|
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||||
|
gArgc = 1;
|
||||||
|
gFinderLaunch = YES;
|
||||||
|
} else {
|
||||||
|
gArgc = argc;
|
||||||
|
gFinderLaunch = NO;
|
||||||
|
}
|
||||||
|
gArgv = argv;
|
||||||
|
|
||||||
|
/* Some additional arguments we always want to run with. */
|
||||||
|
//addArgument("-opengl");
|
||||||
|
|
||||||
|
#if SDL_USE_NIB_FILE
|
||||||
|
[SDLApplication poseAsClass:[NSApplication class]];
|
||||||
|
NSApplicationMain (argc, argv);
|
||||||
|
#else
|
||||||
|
CustomApplicationMain (argc, argv);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
7
src/sdl12/SDL_main/SDL_openxdk_main.c
Normal file
7
src/sdl12/SDL_main/SDL_openxdk_main.c
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* Include the SDL main definition header */
|
||||||
|
#include "SDL_main.h"
|
||||||
|
|
||||||
|
void XBoxStartup()
|
||||||
|
{
|
||||||
|
SDL_main(0, NULL); /// \todo ?
|
||||||
|
}
|
406
src/sdl12/SDL_main/SDL_win32_main.c
Normal file
406
src/sdl12/SDL_main/SDL_win32_main.c
Normal file
|
@ -0,0 +1,406 @@
|
||||||
|
/*
|
||||||
|
SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98
|
||||||
|
|
||||||
|
The WinMain function -- calls your program's main() function
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#define RPC_NO_WINDOWS_H
|
||||||
|
#include <windows.h>
|
||||||
|
#include <malloc.h> /* For _alloca() */
|
||||||
|
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
# define DIR_SEPERATOR TEXT("\\")
|
||||||
|
# define _tgetcwd(str,len) wcscpy(str,TEXT(""))
|
||||||
|
# define setbuf(f,b)
|
||||||
|
# define setvbuf(w,x,y,z)
|
||||||
|
# define _tremove(x) DeleteFile(x)
|
||||||
|
#else
|
||||||
|
# define DIR_SEPERATOR TEXT("/")
|
||||||
|
# include <direct.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Include the SDL main definition header */
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable : 4214 4244)
|
||||||
|
#endif
|
||||||
|
#include "SDL.h"
|
||||||
|
#include "SDL_main.h"
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(default : 4214 4244)
|
||||||
|
#endif
|
||||||
|
#include "../../win32/win_dbg.h"
|
||||||
|
#define USE_MESSAGEBOX
|
||||||
|
|
||||||
|
#ifdef main
|
||||||
|
# ifndef _WIN32_WCE_EMULATION
|
||||||
|
# undef main
|
||||||
|
# endif /* _WIN32_WCE_EMULATION */
|
||||||
|
#endif /* main */
|
||||||
|
|
||||||
|
/* The standard output files */
|
||||||
|
//#ifdef _WIN32_WCE
|
||||||
|
//#define STDOUT_FILE TEXT("/Storage Card/SRB2DEMO/stdout.txt")
|
||||||
|
//#define STDERR_FILE TEXT("/Storage Card/SRB2DEMO/stderr.txt")
|
||||||
|
//#else
|
||||||
|
#define STDOUT_FILE TEXT("stdout.txt")
|
||||||
|
#define STDERR_FILE TEXT("stderr.txt")
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
#ifndef NO_STDIO_REDIRECT
|
||||||
|
static TCHAR stdoutPath[MAX_PATH];
|
||||||
|
static TCHAR stderrPath[MAX_PATH];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
|
||||||
|
/* seems to be undefined in Win CE although in online help */
|
||||||
|
#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
|
||||||
|
|
||||||
|
/* seems to be undefined in Win CE although in online help */
|
||||||
|
char *strrchr(char *str, int c)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
/* Skip to the end of the string */
|
||||||
|
p=str;
|
||||||
|
while (*p)
|
||||||
|
p++;
|
||||||
|
|
||||||
|
/* Look for the given character */
|
||||||
|
while ( (p >= str) && (*p != (CHAR)c) )
|
||||||
|
p--;
|
||||||
|
|
||||||
|
/* Return NULL if character not found */
|
||||||
|
if ( p < str ) {
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
#endif /* _WIN32_WCE < 300 */
|
||||||
|
|
||||||
|
/* Parse a command line buffer into arguments */
|
||||||
|
static int ParseCommandLine(char *cmdline, char **argv)
|
||||||
|
{
|
||||||
|
char *bufp;
|
||||||
|
int argc;
|
||||||
|
|
||||||
|
argc = 0;
|
||||||
|
for ( bufp = cmdline; *bufp; ) {
|
||||||
|
/* Skip leading whitespace */
|
||||||
|
while ( isspace(*bufp) ) {
|
||||||
|
++bufp;
|
||||||
|
}
|
||||||
|
/* Skip over argument */
|
||||||
|
if ( *bufp == '"' ) {
|
||||||
|
++bufp;
|
||||||
|
if ( *bufp ) {
|
||||||
|
if ( argv ) {
|
||||||
|
argv[argc] = bufp;
|
||||||
|
}
|
||||||
|
++argc;
|
||||||
|
}
|
||||||
|
/* Skip over word */
|
||||||
|
while ( *bufp && (*bufp != '"') ) {
|
||||||
|
++bufp;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( *bufp ) {
|
||||||
|
if ( argv ) {
|
||||||
|
argv[argc] = bufp;
|
||||||
|
}
|
||||||
|
++argc;
|
||||||
|
}
|
||||||
|
/* Skip over word */
|
||||||
|
while ( *bufp && ! isspace(*bufp) ) {
|
||||||
|
++bufp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( *bufp ) {
|
||||||
|
if ( argv ) {
|
||||||
|
*bufp = '\0';
|
||||||
|
}
|
||||||
|
++bufp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( argv ) {
|
||||||
|
argv[argc] = NULL;
|
||||||
|
}
|
||||||
|
return(argc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show an error message */
|
||||||
|
static void ShowError(const char *title, const char *message)
|
||||||
|
{
|
||||||
|
/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
|
||||||
|
#ifdef USE_MESSAGEBOX
|
||||||
|
MessageBoxA(NULL,
|
||||||
|
message,
|
||||||
|
title,
|
||||||
|
MB_ICONEXCLAMATION|MB_OK);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "%s: %s\n", title, message);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pop up an out of memory message, returns to Windows */
|
||||||
|
static BOOL OutOfMemory(void)
|
||||||
|
{
|
||||||
|
ShowError("Fatal Error", "Out of memory - aborting");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove the output files if there was no output written */
|
||||||
|
static void __cdecl cleanup_output(void)
|
||||||
|
{
|
||||||
|
#ifndef NO_STDIO_REDIRECT
|
||||||
|
FILE *file;
|
||||||
|
int empty;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flush the output in case anything is queued */
|
||||||
|
fclose(stdout);
|
||||||
|
fclose(stderr);
|
||||||
|
|
||||||
|
#ifndef NO_STDIO_REDIRECT
|
||||||
|
/* See if the files have any output in them */
|
||||||
|
if ( stdoutPath[0] ) {
|
||||||
|
file = _tfopen(stdoutPath, TEXT("rb"));
|
||||||
|
if ( file ) {
|
||||||
|
empty = (fgetc(file) == EOF) ? 1 : 0;
|
||||||
|
fclose(file);
|
||||||
|
if ( empty ) {
|
||||||
|
_tremove(stdoutPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( stderrPath[0] ) {
|
||||||
|
file = _tfopen(stderrPath, TEXT("rb"));
|
||||||
|
if ( file ) {
|
||||||
|
empty = (fgetc(file) == EOF) ? 1 : 0;
|
||||||
|
fclose(file);
|
||||||
|
if ( empty ) {
|
||||||
|
_tremove(stderrPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
|
||||||
|
/* The VC++ compiler needs main defined */
|
||||||
|
#define console_main main
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is where execution begins [console apps] */
|
||||||
|
int console_main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
size_t n;
|
||||||
|
int st;
|
||||||
|
char *bufp, *appname;
|
||||||
|
|
||||||
|
/* Get the class name from argv[0] */
|
||||||
|
appname = argv[0];
|
||||||
|
if ( (bufp=strrchr(argv[0], '\\')) != NULL ) {
|
||||||
|
appname = bufp+1;
|
||||||
|
} else
|
||||||
|
if ( (bufp=strrchr(argv[0], '/')) != NULL ) {
|
||||||
|
appname = bufp+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (bufp=strrchr(appname, '.')) == NULL )
|
||||||
|
n = strlen(appname);
|
||||||
|
else
|
||||||
|
n = (bufp-appname);
|
||||||
|
|
||||||
|
bufp = (char *)alloca(n+1);
|
||||||
|
if ( bufp == NULL ) {
|
||||||
|
return OutOfMemory();
|
||||||
|
}
|
||||||
|
strncpy(bufp, appname, n);
|
||||||
|
bufp[n] = '\0';
|
||||||
|
appname = bufp;
|
||||||
|
|
||||||
|
/* Load SDL dynamic link library */
|
||||||
|
if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
|
||||||
|
ShowError("WinMain() error", SDL_GetError());
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
atexit(cleanup_output);
|
||||||
|
atexit(SDL_Quit);
|
||||||
|
|
||||||
|
#ifndef DISABLE_VIDEO
|
||||||
|
#if 0
|
||||||
|
/* Create and register our class *
|
||||||
|
DJM: If we do this here, the user nevers gets a chance to
|
||||||
|
putenv(SDL_WINDOWID). This is already called later by
|
||||||
|
the (DIB|DX5)_CreateWindow function, so it should be
|
||||||
|
safe to comment it out here.
|
||||||
|
if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT,
|
||||||
|
GetModuleHandle(NULL)) < 0 ) {
|
||||||
|
ShowError("WinMain() error", SDL_GetError());
|
||||||
|
exit(1);
|
||||||
|
}*/
|
||||||
|
#else
|
||||||
|
/* Sam:
|
||||||
|
We still need to pass in the application handle so that
|
||||||
|
DirectInput will initialize properly when SDL_RegisterApp()
|
||||||
|
is called later in the video initialization.
|
||||||
|
*/
|
||||||
|
SDL_SetModuleHandle(GetModuleHandle(NULL));
|
||||||
|
#endif /* 0 */
|
||||||
|
#endif /* !DISABLE_VIDEO */
|
||||||
|
|
||||||
|
/* Run the application main() code */
|
||||||
|
st = SDL_main(argc, argv);
|
||||||
|
|
||||||
|
/* Exit cleanly, calling atexit() functions */
|
||||||
|
//exit(0);
|
||||||
|
cleanup_output();
|
||||||
|
SDL_Quit();
|
||||||
|
|
||||||
|
/* Hush little compiler, don't you cry... */
|
||||||
|
return st;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is where execution begins [windowed apps] */
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw)
|
||||||
|
#else
|
||||||
|
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
HINSTANCE handle;
|
||||||
|
int Result = -1;
|
||||||
|
char **argv;
|
||||||
|
int argc;
|
||||||
|
LPSTR cmdline;
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
size_t nLen;
|
||||||
|
LPTSTR bufp;
|
||||||
|
#else
|
||||||
|
LPSTR bufp;
|
||||||
|
#endif
|
||||||
|
#ifndef NO_STDIO_REDIRECT
|
||||||
|
FILE *newfp;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
|
||||||
|
keep them open. This is a hack.. hopefully it will be fixed
|
||||||
|
someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
|
||||||
|
*/
|
||||||
|
hPrev = hInst = NULL;
|
||||||
|
sw = 0;
|
||||||
|
handle = LoadLibrary(TEXT("DDRAW.DLL"));
|
||||||
|
if ( handle != NULL ) {
|
||||||
|
FreeLibrary(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NO_STDIO_REDIRECT
|
||||||
|
_tgetcwd( stdoutPath, sizeof( stdoutPath ) );
|
||||||
|
_tcscat( stdoutPath, DIR_SEPERATOR STDOUT_FILE );
|
||||||
|
|
||||||
|
/* Redirect standard input and standard output */
|
||||||
|
newfp = _tfreopen(stdoutPath, TEXT("w"), stdout);
|
||||||
|
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
if ( newfp == NULL ) { /* This happens on NT */
|
||||||
|
#if !defined(stdout)
|
||||||
|
stdout = _tfopen(stdoutPath, TEXT("w"));
|
||||||
|
#else
|
||||||
|
newfp = _tfopen(stdoutPath, TEXT("w"));
|
||||||
|
if ( newfp ) {
|
||||||
|
*stdout = *newfp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* _WIN32_WCE */
|
||||||
|
|
||||||
|
_tgetcwd( stderrPath, sizeof( stderrPath ) );
|
||||||
|
_tcscat( stderrPath, DIR_SEPERATOR STDERR_FILE );
|
||||||
|
|
||||||
|
newfp = _tfreopen(stderrPath, TEXT("w"), stderr);
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
if ( newfp == NULL ) { /* This happens on NT */
|
||||||
|
#if !defined(stderr)
|
||||||
|
stderr = _tfopen(stderrPath, TEXT("w"));
|
||||||
|
#else
|
||||||
|
newfp = _tfopen(stderrPath, TEXT("w"));
|
||||||
|
if ( newfp ) {
|
||||||
|
*stderr = *newfp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* _WIN32_WCE */
|
||||||
|
|
||||||
|
setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */
|
||||||
|
setbuf(stderr, NULL); /* No buffering */
|
||||||
|
#endif /* !NO_STDIO_REDIRECT */
|
||||||
|
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
nLen = wcslen(szCmdLine)+128+1;
|
||||||
|
bufp = (wchar_t *)alloca(nLen*2);
|
||||||
|
wcscpy (bufp, TEXT("\""));
|
||||||
|
GetModuleFileName(NULL, bufp+1, 128-3);
|
||||||
|
wcscpy (bufp+wcslen(bufp), TEXT("\" "));
|
||||||
|
wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
|
||||||
|
nLen = wcslen(bufp)+1;
|
||||||
|
cmdline = (char *)alloca(nLen);
|
||||||
|
if ( cmdline == NULL ) {
|
||||||
|
return OutOfMemory();
|
||||||
|
}
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
|
||||||
|
#else
|
||||||
|
szCmdLine = NULL;
|
||||||
|
/* Grab the command line (use alloca() on Windows) */
|
||||||
|
bufp = GetCommandLineA();
|
||||||
|
cmdline = (LPSTR)alloca(strlen(bufp)+1);
|
||||||
|
if ( cmdline == NULL ) {
|
||||||
|
return OutOfMemory();
|
||||||
|
}
|
||||||
|
strcpy(cmdline, bufp);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Parse it into argv and argc */
|
||||||
|
argc = ParseCommandLine(cmdline, NULL);
|
||||||
|
argv = (char **)alloca((argc+1)*(sizeof *argv));
|
||||||
|
if ( argv == NULL ) {
|
||||||
|
return OutOfMemory();
|
||||||
|
}
|
||||||
|
ParseCommandLine(cmdline, argv);
|
||||||
|
|
||||||
|
#ifdef BUGTRAP
|
||||||
|
/* Try BugTrap. */
|
||||||
|
if(InitBugTrap())
|
||||||
|
Result = console_main(argc, argv);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Run the main program (after a little SDL initialization) */
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
__try
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Result = console_main(argc, argv);
|
||||||
|
}
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
__except ( RecordExceptionInfo(GetExceptionInformation()))
|
||||||
|
{
|
||||||
|
SetUnhandledExceptionFilter(EXCEPTION_CONTINUE_SEARCH); //Do nothing here.
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BUGTRAP
|
||||||
|
} /* BT failure clause. */
|
||||||
|
|
||||||
|
/* This is safe even if BT didn't start. */
|
||||||
|
ShutdownBugTrap();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue