Compare commits
196
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4676885521 | ||
|
|
df10855483 | ||
|
|
dc6bf05f35 | ||
|
|
871545024d | ||
|
|
aeb172f2ab | ||
|
|
4fccb48d2a | ||
|
|
3e0150d4f3 | ||
|
|
7c1f17bb8d | ||
|
|
c8ae4a89d9 | ||
|
|
42b1f849c0 | ||
|
|
c0f24ebbbc | ||
|
|
de73c53665 | ||
|
|
908e073628 | ||
|
|
eaee95a026 | ||
|
|
456a380e3a | ||
|
|
c428472c6f | ||
|
|
feff5a7c17 | ||
|
|
ae306351ba | ||
|
|
03de30df3e | ||
|
|
e45c72f525 | ||
|
|
36c43d89e6 | ||
|
|
f34a47c50d | ||
|
|
24895874ed | ||
|
|
129f88b6a7 | ||
|
|
cb5c4e482e | ||
|
|
db2062ed1d | ||
|
|
45ee50b47d | ||
|
|
694a8eeb69 | ||
|
|
908bba2c8a | ||
|
|
88363cf45d | ||
|
|
509e7140e3 | ||
|
|
056f919bbe | ||
|
|
548cad76b2 | ||
|
|
e26fb91350 | ||
|
|
28685ea658 | ||
|
|
a69df8807d | ||
|
|
26fc417555 | ||
|
|
bb3dd435f0 | ||
|
|
16a531272f | ||
|
|
ba5b79e48a | ||
|
|
59470ddbd4 | ||
|
|
82c4191516 | ||
|
|
8a305d3c79 | ||
|
|
7c507c7b3b | ||
|
|
ca27dad6c1 | ||
|
|
383d55cac6 | ||
|
|
0e2ffdeb1d | ||
|
|
b84d101337 | ||
|
|
852aa74d62 | ||
|
|
aa06459c09 | ||
|
|
c07502bf5a | ||
|
|
f751161693 | ||
|
|
ed16c4fd9f | ||
|
|
41407538d4 | ||
|
|
5f394cd938 | ||
|
|
e5bae89d0f | ||
|
|
f749800276 | ||
|
|
5289027272 | ||
|
|
77f4d4ef3b | ||
|
|
a94740f5e9 | ||
|
|
ab27090ecf | ||
|
|
93d0106c28 | ||
|
|
27433f6fb5 | ||
|
|
f8e5049d76 | ||
|
|
2009cdeaeb | ||
|
|
0f43f19b71 | ||
|
|
1ac7852bd2 | ||
|
|
f5e7b65ae0 | ||
|
|
4c5d34e82c | ||
|
|
0dad927c05 | ||
|
|
f231417465 | ||
|
|
51b8dc9101 | ||
|
|
71e9c4f5af | ||
|
|
1acae3e4af | ||
|
|
4c04d09d18 | ||
|
|
b99cd88947 | ||
|
|
4a786449c4 | ||
|
|
aef6dcdbc9 | ||
|
|
0e9ec096c2 | ||
|
|
50ce3c4431 | ||
|
|
c6c1dbd066 | ||
|
|
ece8d9e80c | ||
|
|
fdcbd276e9 | ||
|
|
6d77672ee3 | ||
|
|
28aec6cad5 | ||
|
|
1f028f523e | ||
|
|
349bf06e4b | ||
|
|
e044db73f5 | ||
|
|
7555d689db | ||
|
|
a6438da531 | ||
|
|
8c6893cff6 | ||
|
|
af03b51191 | ||
|
|
178d8b7b53 | ||
|
|
de99a3036d | ||
|
|
5c613f6c8f | ||
|
|
59628377fa | ||
|
|
278f3c3ef6 | ||
|
|
3ba1596976 | ||
|
|
02f6fa0665 | ||
|
|
f4aec1d591 | ||
|
|
5c2a87dea6 | ||
|
|
d5aa9ae0f1 | ||
|
|
6096822cbb | ||
|
|
0030367649 | ||
|
|
66f67c91e8 | ||
|
|
c73c1af2d5 | ||
|
|
638e95325a | ||
|
|
66ce745e91 | ||
|
|
2b39d137b4 | ||
|
|
1ed616dcef | ||
|
|
24ef2819b0 | ||
|
|
a9732e9564 | ||
|
|
c262d3f532 | ||
|
|
ae456fee31 | ||
|
|
68f69049d4 | ||
|
|
e180918e48 | ||
|
|
951c090b35 | ||
|
|
a87e07155a | ||
|
|
da16ce3a23 | ||
|
|
64bdae5e5d | ||
|
|
4f91a0b234 | ||
|
|
bb0a59540f | ||
|
|
dd9d6de0d6 | ||
|
|
3de4c7cbad | ||
|
|
0eeacaf51e | ||
|
|
a4684b3004 | ||
|
|
9c014eb2ea | ||
|
|
37579187cc | ||
|
|
af8ce028ba | ||
|
|
9310a68cff | ||
|
|
89b8121282 | ||
|
|
b2260bbebb | ||
|
|
6a9aea4dd1 | ||
|
|
6f4dfb35fa | ||
|
|
459b2e62ce | ||
|
|
5765f3df5a | ||
|
|
8488da4b1a | ||
|
|
c82495f48b | ||
|
|
f55b8793ec | ||
|
|
b0b048c703 | ||
|
|
b7f1a0b631 | ||
|
|
513613d83b | ||
|
|
f2afc5135c | ||
|
|
3783e30a8a | ||
|
|
ff80a34627 | ||
|
|
38c96d5ec2 | ||
|
|
2ec467f062 | ||
|
|
b3106d55d1 | ||
|
|
90c3d02dbf | ||
|
|
48dc5461cd | ||
|
|
0843a586f8 | ||
|
|
8c8f96cf49 | ||
|
|
55afe9be7e | ||
|
|
fe54f2fba2 | ||
|
|
b12989f51c | ||
|
|
57990100c5 | ||
|
|
32504b9e8e | ||
|
|
ba3404d823 | ||
|
|
c9f50ca0c8 | ||
|
|
b6943ce92e | ||
|
|
41b78feef5 | ||
|
|
c9b6276a02 | ||
|
|
39a5165d91 | ||
|
|
e5a03dc3bb | ||
|
|
4deebf8912 | ||
|
|
fa8901f6b0 | ||
|
|
23512f0a6c | ||
|
|
b44548b7ac | ||
|
|
955812bd8d | ||
|
|
e4ac394d29 | ||
|
|
2b6185d7d6 | ||
|
|
2753052ee7 | ||
|
|
3c9292c137 | ||
|
|
e68136de3e | ||
|
|
e852c23441 | ||
|
|
031e8ee477 | ||
|
|
d7422b8ec9 | ||
|
|
0bbd8246cc | ||
|
|
9e8ddd5f9e | ||
|
|
3964d4e188 | ||
|
|
005af4362e | ||
|
|
f817676033 | ||
|
|
79140b3bdc | ||
|
|
48722ef591 | ||
|
|
6be5478fa8 | ||
|
|
953d9d15d6 | ||
|
|
0c56755e09 | ||
|
|
c166075754 | ||
|
|
90ff1c4fc0 | ||
|
|
1d0fedddfd | ||
|
|
f5b60c3f36 | ||
|
|
78ad3e9710 | ||
|
|
b03d5c53ed | ||
|
|
c5dce0e785 | ||
|
|
f85c7ef961 | ||
|
|
4d211f8f82 |
No files matched your search
+22
-13
@@ -49,6 +49,7 @@
|
|||||||
# Already enabled by default for 32-bit
|
# Already enabled by default for 32-bit
|
||||||
# Windows.
|
# Windows.
|
||||||
# NOCURL=1 - Disable libcurl--HTTP capability.
|
# NOCURL=1 - Disable libcurl--HTTP capability.
|
||||||
|
# NOHOLEPUNCH=1 - Disable holepunch capability.
|
||||||
# NOLIBGME=1 - Disable game music emu, retro VGM support.
|
# NOLIBGME=1 - Disable game music emu, retro VGM support.
|
||||||
# NOOPENMPT=1 - Disable module (tracker) music support.
|
# NOOPENMPT=1 - Disable module (tracker) music support.
|
||||||
# NOMIXER=1 - Disable SDL Mixer (audio playback).
|
# NOMIXER=1 - Disable SDL Mixer (audio playback).
|
||||||
@@ -69,6 +70,7 @@
|
|||||||
# VALGRIND=1 - Enable Valgrind memory debugging support.
|
# VALGRIND=1 - Enable Valgrind memory debugging support.
|
||||||
# PROFILEMODE=1 - Enable performance profiling (gprof).
|
# PROFILEMODE=1 - Enable performance profiling (gprof).
|
||||||
# USEASAN=1 - Enable building with Address Sanitizer.
|
# USEASAN=1 - Enable building with Address Sanitizer.
|
||||||
|
# USEUBSAN=1 - Enable building with Undefined Behavior Sanitizer.
|
||||||
# NOLIBBACKTRACE=1 - Disable using Libbacktrace for crashlog traces.
|
# NOLIBBACKTRACE=1 - Disable using Libbacktrace for crashlog traces.
|
||||||
#
|
#
|
||||||
# General flags for building:
|
# General flags for building:
|
||||||
@@ -243,10 +245,14 @@ ifdef STATIC
|
|||||||
libs+=-static
|
libs+=-static
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter $(CC) $(CXX),gcc g++))
|
||||||
|
opts+=-mno-ms-bitfields
|
||||||
|
endif
|
||||||
|
|
||||||
# build with profiling information
|
# build with profiling information
|
||||||
ifdef PROFILEMODE
|
ifdef PROFILEMODE
|
||||||
opts+=-pg
|
opts+=-pg
|
||||||
LDFLAGS+=-pg
|
libs+=-pg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef DEBUGMODE
|
ifdef DEBUGMODE
|
||||||
@@ -256,29 +262,32 @@ debug_opts=-DNDEBUG
|
|||||||
opts+=-O3
|
opts+=-O3
|
||||||
ifdef USELTO
|
ifdef USELTO
|
||||||
# compile with LTO
|
# compile with LTO
|
||||||
ifdef MINGW
|
|
||||||
opts+=-flto=auto -g
|
|
||||||
LDFLAGS+=-flto=auto -g
|
|
||||||
else
|
|
||||||
opts+=-flto=auto
|
opts+=-flto=auto
|
||||||
LDFLAGS+=-flto=auto
|
libs+=-flto=auto
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef USEASAN
|
ifdef USEASAN
|
||||||
# compile with asan
|
# compile with asan
|
||||||
ifdef MINGW
|
|
||||||
opts+=-fsanitize=address -g
|
|
||||||
libs+=-fsanitize=address -g
|
|
||||||
else
|
|
||||||
opts+=-fsanitize=address
|
opts+=-fsanitize=address
|
||||||
libs+=-fsanitize=address
|
libs+=-fsanitize=address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef USEUBSAN
|
||||||
|
# compile with asan
|
||||||
|
opts+=-fsanitize=undefined
|
||||||
|
libs+=-fsanitize=undefined
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CC),clang)
|
ifneq (,$(filter $(CC) $(CXX),clang clang++))
|
||||||
LDFLAGS+= -fuse-ld=lld
|
libs+=-fuse-ld=lld
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef MINGW
|
||||||
|
# mingw needs this passed AFTER lto and the likes were passed
|
||||||
|
# otherwise libbacktrace may break
|
||||||
|
opts+=-g
|
||||||
|
libs+=-g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# debug_opts also get passed to windres
|
# debug_opts also get passed to windres
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ passthru_opts+=\
|
|||||||
NOHW NOMD5 NOPOSTPROCESSING\
|
NOHW NOMD5 NOPOSTPROCESSING\
|
||||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
||||||
HAVE_MINIUPNPC\
|
HAVE_MINIUPNPC\
|
||||||
HAVE_DISCORDRPC DEVELOP
|
HAVE_DISCORDRPC DEVELOP\
|
||||||
|
NOHOLEPUNCH\
|
||||||
|
|
||||||
# build with debugging information
|
# build with debugging information
|
||||||
ifdef DEBUGMODE
|
ifdef DEBUGMODE
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
makedir:=$(makedir)/SDL
|
makedir:=$(makedir)/SDL
|
||||||
|
|
||||||
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
|
opts+=-DHAVE_SDL
|
||||||
sources+=$(call List,sdl/Sourcefile)
|
sources+=$(call List,sdl/Sourcefile)
|
||||||
|
|
||||||
NOUPNP=1
|
NOUPNP=1
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
# Mingw, if you don't know, that's Win32/Win64
|
# Mingw, if you don't know, that's Win32/Win64
|
||||||
#
|
#
|
||||||
|
|
||||||
|
sources+=$(call List,win32/Sourcefile)
|
||||||
|
|
||||||
ifndef MINGW64
|
ifndef MINGW64
|
||||||
EXENAME?=srb2kart-saturn_32bit.exe
|
EXENAME?=srb2kart-saturn_32bit.exe
|
||||||
else
|
else
|
||||||
@@ -95,7 +97,7 @@ LIBBACKTRACE_libs:=-L$(lib)/lib/x86_64 -lbacktrace
|
|||||||
$(eval $(call _set,LIBBACKTRACE))
|
$(eval $(call _set,LIBBACKTRACE))
|
||||||
else
|
else
|
||||||
lib:=../libs/drmingw
|
lib:=../libs/drmingw
|
||||||
opts+=-I$(lib)/include
|
opts+=-I$(lib)/include -DHAVE_DRMINGW
|
||||||
libs+=-L$(lib)/lib/win32 -lmgwhelp -lexchndl
|
libs+=-L$(lib)/lib/win32 -lmgwhelp -lexchndl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ r_data.c
|
|||||||
r_draw.c
|
r_draw.c
|
||||||
r_fps.cpp
|
r_fps.cpp
|
||||||
r_main.cpp
|
r_main.cpp
|
||||||
r_patch.c
|
r_patch.cpp
|
||||||
r_patchrotation.c
|
r_patchrotation.c
|
||||||
r_plane.cpp
|
r_plane.cpp
|
||||||
r_segs.cpp
|
r_segs.cpp
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void I_Error(const char *error, ...)
|
|||||||
char logbuf[8192];
|
char logbuf[8192];
|
||||||
|
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(logbuf, error, argptr);
|
vsnprintf(logbuf, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
LOGE(logbuf);
|
LOGE(logbuf);
|
||||||
@@ -166,7 +166,7 @@ void I_OutputMsg(const char *fmt, ...)
|
|||||||
char logbuf[8192];
|
char logbuf[8192];
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
vsprintf(logbuf, fmt, argptr);
|
vsnprintf(logbuf, 8192, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
LOGD(logbuf);
|
LOGD(logbuf);
|
||||||
|
|||||||
+4
-2
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include "lauxlib.h"
|
#include "lauxlib.h"
|
||||||
|
|
||||||
|
#include "../doomdef.h"
|
||||||
|
|
||||||
|
|
||||||
#define FREELIST_REF 0 /* free list of references */
|
#define FREELIST_REF 0 /* free list of references */
|
||||||
|
|
||||||
@@ -40,7 +42,7 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
|
|||||||
if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
|
if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
|
||||||
return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
|
return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
|
||||||
lua_getinfo(L, "n", &ar);
|
lua_getinfo(L, "n", &ar);
|
||||||
if (strcmp(ar.namewhat, "method") == 0) {
|
if (fastcmp(ar.namewhat, "method")) {
|
||||||
narg--; /* do not count `self' */
|
narg--; /* do not count `self' */
|
||||||
if (narg == 0) /* error is in the self argument itself? */
|
if (narg == 0) /* error is in the self argument itself? */
|
||||||
return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
|
return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
|
||||||
@@ -97,7 +99,7 @@ LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
|
|||||||
luaL_checkstring(L, narg);
|
luaL_checkstring(L, narg);
|
||||||
int i;
|
int i;
|
||||||
for (i=0; lst[i]; i++)
|
for (i=0; lst[i]; i++)
|
||||||
if (strcmp(lst[i], name) == 0)
|
if (fastcmp(lst[i], name))
|
||||||
return i;
|
return i;
|
||||||
return luaL_argerror(L, narg,
|
return luaL_argerror(L, narg,
|
||||||
lua_pushfstring(L, "invalid option " LUA_QS, name));
|
lua_pushfstring(L, "invalid option " LUA_QS, name));
|
||||||
|
|||||||
+5
-3
@@ -161,12 +161,13 @@ static int io_tostring (lua_State *L) {
|
|||||||
|
|
||||||
static int StartsWith(const char *a, const char *b) // this is wolfs being lazy yet again
|
static int StartsWith(const char *a, const char *b) // this is wolfs being lazy yet again
|
||||||
{
|
{
|
||||||
if(strncmp(a, b, strlen(b)) == 0) return 1;
|
if (strncmp(a, b, strlen(b)) == 0) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int io_open (lua_State *L) {
|
static int io_open(lua_State *L)
|
||||||
|
{
|
||||||
FILE **pf;
|
FILE **pf;
|
||||||
const char *filename = luaL_checkstring(L, 1);
|
const char *filename = luaL_checkstring(L, 1);
|
||||||
int pass = 0;
|
int pass = 0;
|
||||||
@@ -178,12 +179,13 @@ static int io_open (lua_State *L) {
|
|||||||
|
|
||||||
for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
|
for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
|
||||||
{
|
{
|
||||||
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
|
if (fasticmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
|
||||||
{
|
{
|
||||||
pass = 1;
|
pass = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||||
|| StartsWith(filename, "/") || !pass))
|
|| StartsWith(filename, "/") || !pass))
|
||||||
{
|
{
|
||||||
|
|||||||
+65
-62
@@ -359,7 +359,7 @@ size_t COM_CheckParm(const char *check)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 1; i < com_argc; i++)
|
for (i = 1; i < com_argc; i++)
|
||||||
if (!strcasecmp(check, com_argv[i]))
|
if (fasticmp(check, com_argv[i]))
|
||||||
return i;
|
return i;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -456,7 +456,7 @@ void COM_AddCommand(const char *name, com_func_t func)
|
|||||||
// fail if the command already exists
|
// fail if the command already exists
|
||||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
|
if (fasticmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||||
{
|
{
|
||||||
// don't I_Error for Lua commands
|
// don't I_Error for Lua commands
|
||||||
// Lua commands can replace game commands, and they have priority.
|
// Lua commands can replace game commands, and they have priority.
|
||||||
@@ -492,7 +492,7 @@ int COM_AddLuaCommand(const char *name)
|
|||||||
// command already exists
|
// command already exists
|
||||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
|
if (fasticmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||||
{
|
{
|
||||||
// replace the built in command.
|
// replace the built in command.
|
||||||
cmd->function = COM_Lua_f;
|
cmd->function = COM_Lua_f;
|
||||||
@@ -519,7 +519,7 @@ static boolean COM_Exists(const char *com_name)
|
|||||||
xcommand_t *cmd;
|
xcommand_t *cmd;
|
||||||
|
|
||||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
if (!stricmp(com_name, cmd->name))
|
if (fasticmp(com_name, cmd->name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -571,7 +571,7 @@ static void COM_ExecuteString(char *ptext)
|
|||||||
// check functions
|
// check functions
|
||||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
if (fasticmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||||
{
|
{
|
||||||
cmd->function();
|
cmd->function();
|
||||||
return;
|
return;
|
||||||
@@ -581,7 +581,7 @@ static void COM_ExecuteString(char *ptext)
|
|||||||
// check aliases
|
// check aliases
|
||||||
for (a = com_alias; a; a = a->next)
|
for (a = com_alias; a; a = a->next)
|
||||||
{
|
{
|
||||||
if (!stricmp(com_argv[0], a->name))
|
if (fasticmp(com_argv[0], a->name))
|
||||||
{
|
{
|
||||||
if (recursion > MAX_ALIAS_RECURSION)
|
if (recursion > MAX_ALIAS_RECURSION)
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
||||||
@@ -700,6 +700,7 @@ static void COM_Echo_f(void)
|
|||||||
|
|
||||||
for (i = 1; i < COM_Argc(); i++)
|
for (i = 1; i < COM_Argc(); i++)
|
||||||
CONS_Printf("%s ", COM_Argv(i));
|
CONS_Printf("%s ", COM_Argv(i));
|
||||||
|
|
||||||
CONS_Printf("\n");
|
CONS_Printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,11 +709,11 @@ static void COM_Echo_f(void)
|
|||||||
static void COM_CEcho_f(void)
|
static void COM_CEcho_f(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
char cechotext[1024] = "";
|
char cechotext[1024] = {0};
|
||||||
|
|
||||||
for (i = 1; i < COM_Argc(); i++)
|
for (i = 1; i < COM_Argc(); i++)
|
||||||
{
|
{
|
||||||
strlcpy(cechotext, COM_Argv(i), sizeof(cechotext)-1);
|
strlcat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
|
||||||
strlcat(cechotext, " ", sizeof(cechotext)-1);
|
strlcat(cechotext, " ", sizeof(cechotext)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +836,7 @@ static void COM_Help_f(void)
|
|||||||
if (cvar->PossibleValue)
|
if (cvar->PossibleValue)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
|
if (fasticmp(cvar->PossibleValue[0].strvalue, "MIN") && fasticmp(cvar->PossibleValue[1].strvalue, "MAX"))
|
||||||
{
|
{
|
||||||
if (floatmode)
|
if (floatmode)
|
||||||
{
|
{
|
||||||
@@ -878,7 +879,7 @@ static void COM_Help_f(void)
|
|||||||
{
|
{
|
||||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
if (strcmp(cmd->name, help))
|
if (!fastcmp(cmd->name, help))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CONS_Printf("\x82""Command %s:\n", cmd->name);
|
CONS_Printf("\x82""Command %s:\n", cmd->name);
|
||||||
@@ -938,6 +939,8 @@ static void COM_Find_f(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
help = COM_Argv(1);
|
help = COM_Argv(1);
|
||||||
|
if (!help)
|
||||||
|
return;
|
||||||
helplen = strlen(help);
|
helplen = strlen(help);
|
||||||
CONS_Printf("\x82""Variables:\n");
|
CONS_Printf("\x82""Variables:\n");
|
||||||
matchesany = false;
|
matchesany = false;
|
||||||
@@ -1173,7 +1176,7 @@ consvar_t *CV_FindVar(const char *name)
|
|||||||
consvar_t *cvar;
|
consvar_t *cvar;
|
||||||
|
|
||||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||||
if (!stricmp(name,cvar->name))
|
if (fasticmp(name,cvar->name))
|
||||||
return cvar;
|
return cvar;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1363,7 +1366,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
|
|||||||
v = INT32_MIN; // Invalid integer trigger
|
v = INT32_MIN; // Invalid integer trigger
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var->PossibleValue[0].strvalue && !stricmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar
|
if (var->PossibleValue[0].strvalue && fasticmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar
|
||||||
{
|
{
|
||||||
#define MINVAL 0
|
#define MINVAL 0
|
||||||
#define MAXVAL 1
|
#define MAXVAL 1
|
||||||
@@ -1376,21 +1379,21 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
|
|||||||
|
|
||||||
// search for other
|
// search for other
|
||||||
for (i = MAXVAL+1; var->PossibleValue[i].strvalue; i++)
|
for (i = MAXVAL+1; var->PossibleValue[i].strvalue; i++)
|
||||||
if (v == var->PossibleValue[i].value || !stricmp(var->PossibleValue[i].strvalue, valstr))
|
if (v == var->PossibleValue[i].value || fasticmp(var->PossibleValue[i].strvalue, valstr))
|
||||||
{
|
{
|
||||||
var->value = var->PossibleValue[i].value;
|
var->value = var->PossibleValue[i].value;
|
||||||
var->string = var->PossibleValue[i].strvalue;
|
var->string = var->PossibleValue[i].strvalue;
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((v != INT32_MIN && v < var->PossibleValue[MINVAL].value) || !stricmp(valstr, "MIN"))
|
if ((v != INT32_MIN && v < var->PossibleValue[MINVAL].value) || fasticmp(valstr, "MIN"))
|
||||||
{
|
{
|
||||||
v = var->PossibleValue[MINVAL].value;
|
v = var->PossibleValue[MINVAL].value;
|
||||||
valstr = var->PossibleValue[MINVAL].strvalue;
|
valstr = var->PossibleValue[MINVAL].strvalue;
|
||||||
override = true;
|
override = true;
|
||||||
overrideval = v;
|
overrideval = v;
|
||||||
}
|
}
|
||||||
else if ((v != INT32_MIN && v > var->PossibleValue[MAXVAL].value) || !stricmp(valstr, "MAX"))
|
else if ((v != INT32_MIN && v > var->PossibleValue[MAXVAL].value) || fasticmp(valstr, "MAX"))
|
||||||
{
|
{
|
||||||
v = var->PossibleValue[MAXVAL].value;
|
v = var->PossibleValue[MAXVAL].value;
|
||||||
valstr = var->PossibleValue[MAXVAL].strvalue;
|
valstr = var->PossibleValue[MAXVAL].strvalue;
|
||||||
@@ -1408,7 +1411,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
|
|||||||
|
|
||||||
// check first strings
|
// check first strings
|
||||||
for (i = 0; var->PossibleValue[i].strvalue; i++)
|
for (i = 0; var->PossibleValue[i].strvalue; i++)
|
||||||
if (!stricmp(var->PossibleValue[i].strvalue, valstr))
|
if (fasticmp(var->PossibleValue[i].strvalue, valstr))
|
||||||
goto found;
|
goto found;
|
||||||
if (v != INT32_MIN)
|
if (v != INT32_MIN)
|
||||||
{
|
{
|
||||||
@@ -1421,9 +1424,9 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
|
|||||||
if (var->PossibleValue == CV_OnOff || var->PossibleValue == CV_YesNo)
|
if (var->PossibleValue == CV_OnOff || var->PossibleValue == CV_YesNo)
|
||||||
{
|
{
|
||||||
overrideval = -1;
|
overrideval = -1;
|
||||||
if (!stricmp(valstr, "on") || !stricmp(valstr, "yes"))
|
if (fasticmp(valstr, "on") || fasticmp(valstr, "yes"))
|
||||||
overrideval = 1;
|
overrideval = 1;
|
||||||
else if (!stricmp(valstr, "off") || !stricmp(valstr, "no"))
|
else if (fasticmp(valstr, "off") || fasticmp(valstr, "no"))
|
||||||
overrideval = 0;
|
overrideval = 0;
|
||||||
|
|
||||||
if (overrideval != -1)
|
if (overrideval != -1)
|
||||||
@@ -1607,7 +1610,7 @@ void CV_ResetCheatNetVars(void)
|
|||||||
// Returns true if the variable's current value is its default value
|
// Returns true if the variable's current value is its default value
|
||||||
boolean CV_IsSetToDefault(consvar_t *v)
|
boolean CV_IsSetToDefault(consvar_t *v)
|
||||||
{
|
{
|
||||||
return (!(strcmp(v->defaultvalue, v->string)));
|
return (fastcmp(v->defaultvalue, v->string));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any cheats CVars are not at their default settings, return true.
|
// If any cheats CVars are not at their default settings, return true.
|
||||||
@@ -1619,7 +1622,7 @@ UINT8 CV_CheatsEnabled(void)
|
|||||||
consvar_t *cvar;
|
consvar_t *cvar;
|
||||||
|
|
||||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||||
if ((cvar->flags & CV_CHEAT) && strcmp(cvar->defaultvalue, cvar->string))
|
if ((cvar->flags & CV_CHEAT) && !fastcmp(cvar->defaultvalue, cvar->string))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1640,7 +1643,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
|||||||
if (!var->string)
|
if (!var->string)
|
||||||
I_Error("CV_Set: %s no string set!\n", var->name);
|
I_Error("CV_Set: %s no string set!\n", var->name);
|
||||||
#endif
|
#endif
|
||||||
if (!var || !var->string || !value || !stricmp(var->string, value))
|
if (!var || !var->string || !value || fasticmp(var->string, value))
|
||||||
return; // no changes
|
return; // no changes
|
||||||
|
|
||||||
if (var->flags & CV_NETVAR)
|
if (var->flags & CV_NETVAR)
|
||||||
@@ -1650,21 +1653,21 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
|||||||
UINT8 *p = buf;
|
UINT8 *p = buf;
|
||||||
if (!(server || (IsPlayerAdmin(consoleplayer))))
|
if (!(server || (IsPlayerAdmin(consoleplayer))))
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Only the server or admin can change: %s %s\n"), var->name, var->string);
|
CONS_Alert(CONS_NOTICE, "Only the server or admin can change: %s %s\n", var->name, var->string);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var == &cv_kartencore && !M_SecretUnlocked(SECRET_ENCORE))
|
if (var == &cv_kartencore && !M_SecretUnlocked(SECRET_ENCORE))
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("You haven't unlocked Encore Mode yet!\n"));
|
CONS_Alert(CONS_NOTICE, "You haven't unlocked Encore Mode yet!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var == &cv_kartspeed && !M_SecretUnlocked(SECRET_HARDSPEED))
|
if (var == &cv_kartspeed && !M_SecretUnlocked(SECRET_HARDSPEED))
|
||||||
{
|
{
|
||||||
if (!stricmp(value, "Hard") || atoi(value) == 2)
|
if (fasticmp(value, "Hard") || atoi(value) == 2)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("You haven't unlocked this yet!\n"));
|
CONS_Alert(CONS_NOTICE, "You haven't unlocked this yet!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1681,14 +1684,13 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
|||||||
else
|
else
|
||||||
Setvalue(var, value, stealth);
|
Setvalue(var, value, stealth);
|
||||||
}
|
}
|
||||||
|
else if ((var->flags & CV_NOTINNET) && netgame)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, "This variable can't be changed while in netgame: %s %s\n", var->name, var->string);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if ((var->flags & CV_NOTINNET) && netgame)
|
Setvalue(var, value, stealth);
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("This variable can't be changed while in netgame: %s %s\n"), var->name, var->string);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Setvalue(var, value, stealth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets a value to a variable without calling its callback function.
|
/** Sets a value to a variable without calling its callback function.
|
||||||
@@ -1771,7 +1773,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
newvalue = var->value - 1;
|
newvalue = var->value - 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(increment > 0) // Going up!
|
if (increment > 0) // Going up!
|
||||||
{
|
{
|
||||||
if (++newvalue == NUMMAPS)
|
if (++newvalue == NUMMAPS)
|
||||||
newvalue = -1;
|
newvalue = -1;
|
||||||
@@ -1785,7 +1787,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
if (newvalue == oldvalue)
|
if (newvalue == oldvalue)
|
||||||
break; // don't loop forever if there's none of a certain gametype
|
break; // don't loop forever if there's none of a certain gametype
|
||||||
|
|
||||||
if(!mapheaderinfo[newvalue])
|
if (newvalue >= 0 && !mapheaderinfo[newvalue])
|
||||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||||
|
|
||||||
} while (!M_CanShowLevelInList(newvalue, gt));
|
} while (!M_CanShowLevelInList(newvalue, gt));
|
||||||
@@ -1797,7 +1799,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
}
|
}
|
||||||
#define MINVAL 0
|
#define MINVAL 0
|
||||||
#define MAXVAL 1
|
#define MAXVAL 1
|
||||||
else if (var->PossibleValue[MINVAL].strvalue && !strcmp(var->PossibleValue[MINVAL].strvalue, "MIN"))
|
else if (var->PossibleValue[MINVAL].strvalue && fastcmp(var->PossibleValue[MINVAL].strvalue, "MIN"))
|
||||||
{ // SRB2Kart
|
{ // SRB2Kart
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
if (!var->PossibleValue[MAXVAL].strvalue)
|
if (!var->PossibleValue[MAXVAL].strvalue)
|
||||||
@@ -1914,13 +1916,14 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
max = (M_SecretUnlocked(SECRET_HARDSPEED) ? 3 : 2);
|
max = (M_SecretUnlocked(SECRET_HARDSPEED) ? 3 : 2);
|
||||||
}
|
}
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
if (currentindice == -1)
|
if (currentindice == -1 || max == 0)
|
||||||
I_Error("CV_AddValue: current value %d not found in possible value\n",
|
I_Error("CV_AddValue: current value %d not found in possible value\n", var->value);
|
||||||
var->value);
|
|
||||||
#endif
|
#endif
|
||||||
|
if (max > 0)
|
||||||
newindice = (currentindice + increment + max) % max;
|
{
|
||||||
CV_Set(var, var->PossibleValue[newindice].strvalue);
|
newindice = (currentindice + increment + max) % max;
|
||||||
|
CV_Set(var, var->PossibleValue[newindice].strvalue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1968,12 +1971,12 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
|||||||
{
|
{
|
||||||
if (joyaxis_default[i])
|
if (joyaxis_default[i])
|
||||||
{
|
{
|
||||||
if (!stricmp(v->name, "joyaxis_fire"))
|
if (fasticmp(v->name, "joyaxis_fire"))
|
||||||
{
|
{
|
||||||
if (joyaxis_count[i] > 7) return false;
|
if (joyaxis_count[i] > 7) return false;
|
||||||
else if (joyaxis_count[i] == 7) return true;
|
else if (joyaxis_count[i] == 7) return true;
|
||||||
|
|
||||||
if (!stricmp(valstr, "None")) joyaxis_count[i]++;
|
if (fasticmp(valstr, "None")) joyaxis_count[i]++;
|
||||||
else joyaxis_default[i] = false;
|
else joyaxis_default[i] = false;
|
||||||
}
|
}
|
||||||
// reset all axis settings to defaults
|
// reset all axis settings to defaults
|
||||||
@@ -2005,37 +2008,37 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
|||||||
// Block the Xbox DInput default axes and reset to the current defaults
|
// Block the Xbox DInput default axes and reset to the current defaults
|
||||||
static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr)
|
static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr)
|
||||||
{
|
{
|
||||||
if (!stricmp(v->name, "joyaxis_turn") && !stricmp(valstr, "X-Axis"))
|
if (fasticmp(v->name, "joyaxis_turn") && fasticmp(valstr, "X-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis2_turn") && !stricmp(valstr, "X-Axis"))
|
if (fasticmp(v->name, "joyaxis2_turn") && fasticmp(valstr, "X-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis3_turn") && !stricmp(valstr, "X-Axis"))
|
if (fasticmp(v->name, "joyaxis3_turn") && fasticmp(valstr, "X-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis4_turn") && !stricmp(valstr, "X-Axis"))
|
if (fasticmp(v->name, "joyaxis4_turn") && fasticmp(valstr, "X-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis_aim") && !stricmp(valstr, "Y-Axis"))
|
if (fasticmp(v->name, "joyaxis_aim") && fasticmp(valstr, "Y-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis2_aim") && !stricmp(valstr, "Y-Axis"))
|
if (fasticmp(v->name, "joyaxis2_aim") && fasticmp(valstr, "Y-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis3_aim") && !stricmp(valstr, "Y-Axis"))
|
if (fasticmp(v->name, "joyaxis3_aim") && fasticmp(valstr, "Y-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis4_aim") && !stricmp(valstr, "Y-Axis"))
|
if (fasticmp(v->name, "joyaxis4_aim") && fasticmp(valstr, "Y-Axis"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis_fire") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis_fire") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis2_fire") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis2_fire") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis3_fire") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis3_fire") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis4_fire") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis4_fire") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis_drift") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis_drift") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis2_drift") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis2_drift") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis3_drift") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis3_drift") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
if (!stricmp(v->name, "joyaxis4_drift") && !stricmp(valstr, "None"))
|
if (fasticmp(v->name, "joyaxis4_drift") && fasticmp(valstr, "None"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2052,8 +2055,8 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
|
|||||||
|
|
||||||
if (GETMAJOREXECVERSION(cv_execversion.value) < 8) // 8 = 1.4
|
if (GETMAJOREXECVERSION(cv_execversion.value) < 8) // 8 = 1.4
|
||||||
{
|
{
|
||||||
if (!stricmp(v->name, "masterserver") // Replaces a hack in MasterServer_OnChange for the original SRB2 MS.
|
if (fasticmp(v->name, "masterserver") // Replaces a hack in MasterServer_OnChange for the original SRB2 MS.
|
||||||
|| !stricmp(v->name, "gamma")) // Too easy to accidentially change in prior versions.
|
|| fasticmp(v->name, "gamma")) // Too easy to accidentially change in prior versions.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2136,7 +2139,7 @@ void CV_SaveVariables(FILE *f)
|
|||||||
char stringtowrite[MAXTEXTCMD+1];
|
char stringtowrite[MAXTEXTCMD+1];
|
||||||
|
|
||||||
// Silly hack for Min/Max vars
|
// Silly hack for Min/Max vars
|
||||||
if (!strcmp(cvar->string, "MAX") || !strcmp(cvar->string, "MIN"))
|
if (fastcmp(cvar->string, "MAX") || fastcmp(cvar->string, "MIN"))
|
||||||
{
|
{
|
||||||
if (cvar->flags & CV_FLOAT)
|
if (cvar->flags & CV_FLOAT)
|
||||||
sprintf(stringtowrite, "%f", FixedToFloat(cvar->value));
|
sprintf(stringtowrite, "%f", FixedToFloat(cvar->value));
|
||||||
|
|||||||
+3
-34
@@ -69,14 +69,9 @@ static boolean consoleready; // console prompt is ready
|
|||||||
INT32 con_destlines; // vid lines used by console at final position
|
INT32 con_destlines; // vid lines used by console at final position
|
||||||
static INT32 con_curlines; // vid lines currently used by console
|
static INT32 con_curlines; // vid lines currently used by console
|
||||||
|
|
||||||
INT32 con_clipviewtop; // (useless)
|
|
||||||
|
|
||||||
static UINT8 con_hudlines; // number of console heads up message lines
|
static UINT8 con_hudlines; // number of console heads up message lines
|
||||||
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
||||||
|
|
||||||
INT32 con_clearlines; // top screen lines to refresh when view reduced
|
|
||||||
boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh
|
|
||||||
|
|
||||||
// console text output
|
// console text output
|
||||||
static char *con_line; // console text output current line
|
static char *con_line; // console text output current line
|
||||||
static size_t con_cx; // cursor position in current line
|
static size_t con_cx; // cursor position in current line
|
||||||
@@ -393,9 +388,6 @@ void CON_Init(void)
|
|||||||
|
|
||||||
Lock_state();
|
Lock_state();
|
||||||
|
|
||||||
//note: CON_Ticker should always execute at least once before D_Display()
|
|
||||||
con_clipviewtop = -1; // -1 does not clip
|
|
||||||
|
|
||||||
con_hudlines = atoi(cons_hudlines.defaultvalue);
|
con_hudlines = atoi(cons_hudlines.defaultvalue);
|
||||||
|
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
@@ -727,7 +719,6 @@ void CON_ToggleOff(void)
|
|||||||
con_curlines = 0;
|
con_curlines = 0;
|
||||||
CON_ClearHUD();
|
CON_ClearHUD();
|
||||||
con_forcepic = 0;
|
con_forcepic = 0;
|
||||||
con_clipviewtop = -1; // remove console clipping of view
|
|
||||||
|
|
||||||
I_SetTextInput(false);
|
I_SetTextInput(false);
|
||||||
|
|
||||||
@@ -779,18 +770,6 @@ void CON_Ticker(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clip the view, so that the part under the console is not drawn
|
|
||||||
con_clipviewtop = -1;
|
|
||||||
if (cons_backpic.value) // clip only when using an opaque background
|
|
||||||
{
|
|
||||||
if (con_curlines > 0)
|
|
||||||
con_clipviewtop = con_curlines - viewwindowy - 1 - 10;
|
|
||||||
// NOTE: BIG HACK::SUBTRACT 10, SO THAT WATER DON'T COPY LINES OF THE CONSOLE
|
|
||||||
// WINDOW!!! (draw some more lines behind the bottom of the console)
|
|
||||||
if (con_clipviewtop < 0)
|
|
||||||
con_clipviewtop = -1; // maybe not necessary, provided it's < 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if console ready for prompt
|
// check if console ready for prompt
|
||||||
if (con_destlines >= minheight)
|
if (con_destlines >= minheight)
|
||||||
{
|
{
|
||||||
@@ -1031,7 +1010,7 @@ boolean CON_Responder(event_t *ev)
|
|||||||
Lock_state();
|
Lock_state();
|
||||||
|
|
||||||
// Only add command to history if it differs from previous one
|
// Only add command to history if it differs from previous one
|
||||||
if (strcmp(input.buffer, inputlines[(inputline-1) & 31]))
|
if (!fastcmp(input.buffer, inputlines[(inputline-1) & 31]))
|
||||||
{
|
{
|
||||||
inputline = (inputline+1) & 31;
|
inputline = (inputline+1) & 31;
|
||||||
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
|
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
|
||||||
@@ -1100,9 +1079,6 @@ static void CON_Linefeed(void)
|
|||||||
|
|
||||||
con_line = &con_buffer[(con_cy%con_totallines)*con_width];
|
con_line = &con_buffer[(con_cy%con_totallines)*con_width];
|
||||||
memset(con_line, ' ', con_width);
|
memset(con_line, ' ', con_width);
|
||||||
|
|
||||||
// make sure the view borders are refreshed if hud messages scroll
|
|
||||||
con_hudupdate = true; // see HU_Erase()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outputs text into the console text buffer
|
// Outputs text into the console text buffer
|
||||||
@@ -1282,7 +1258,7 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...)
|
|||||||
txt = malloc(8192);
|
txt = malloc(8192);
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
vsprintf(txt, fmt, argptr);
|
vsnprintf(txt, 8192, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
switch (level)
|
switch (level)
|
||||||
@@ -1318,7 +1294,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
|||||||
txt = malloc(8192);
|
txt = malloc(8192);
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
vsprintf(txt, fmt, argptr);
|
vsnprintf(txt, 8192, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
// Again I am lazy, oh well
|
// Again I am lazy, oh well
|
||||||
@@ -1489,9 +1465,6 @@ static void CON_DrawHudlines(void)
|
|||||||
//V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
//V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||||
y += charheight;
|
y += charheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// top screen lines that might need clearing when view is reduced
|
|
||||||
con_clearlines = y; // this is handled by HU_Erase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the console background, text, and prompt if enough place
|
// draw the console background, text, and prompt if enough place
|
||||||
@@ -1509,10 +1482,6 @@ static void CON_DrawConsole(void)
|
|||||||
if (con_curlines <= 0)
|
if (con_curlines <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//FIXME: refresh borders only when console bg is translucent
|
|
||||||
con_clearlines = con_curlines; // clear console draw from view borders
|
|
||||||
con_hudupdate = true; // always refresh while console is on
|
|
||||||
|
|
||||||
// draw console background
|
// draw console background
|
||||||
if (cons_backpic.value || con_forcepic)
|
if (cons_backpic.value || con_forcepic)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,14 +30,9 @@ extern boolean con_recalc;
|
|||||||
|
|
||||||
extern boolean con_startup;
|
extern boolean con_startup;
|
||||||
|
|
||||||
// top clip value for view render: do not draw part of view hidden by console
|
|
||||||
extern INT32 con_clipviewtop;
|
|
||||||
|
|
||||||
// 0 means console if off, or moving out
|
// 0 means console if off, or moving out
|
||||||
extern INT32 con_destlines;
|
extern INT32 con_destlines;
|
||||||
|
|
||||||
extern INT32 con_clearlines; // lines of top of screen to refresh
|
|
||||||
extern boolean con_hudupdate; // hud messages have changed, need refresh
|
|
||||||
extern UINT32 con_scalefactor; // console text scale factor
|
extern UINT32 con_scalefactor; // console text scale factor
|
||||||
|
|
||||||
extern consvar_t cons_backcolor, cons_menuhighlight;
|
extern consvar_t cons_backcolor, cons_menuhighlight;
|
||||||
|
|||||||
+24
-14
@@ -823,7 +823,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
|||||||
P_SetThingPosition(players[i].mo);
|
P_SetThingPosition(players[i].mo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void resynch_write_ctf(resynchend_pak *rst)
|
static void resynch_write_ctf(resynchend_pak *rst)
|
||||||
{
|
{
|
||||||
mobj_t *mflag;
|
mobj_t *mflag;
|
||||||
UINT8 i, j;
|
UINT8 i, j;
|
||||||
@@ -863,7 +863,7 @@ static inline void resynch_write_ctf(resynchend_pak *rst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void resynch_read_ctf(resynchend_pak *p)
|
static void resynch_read_ctf(resynchend_pak *p)
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
@@ -1656,12 +1656,7 @@ static void SV_SendPlayerInfo(INT32 node)
|
|||||||
|
|
||||||
netbuffer->u.playerinfo[i].node = i;
|
netbuffer->u.playerinfo[i].node = i;
|
||||||
|
|
||||||
// Can't really change this because net compatibility, but the warning is annoying
|
strlcpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
|
||||||
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
|
|
||||||
|
|
||||||
//fetch IP address
|
//fetch IP address
|
||||||
//No, don't do that, you fuckface.
|
//No, don't do that, you fuckface.
|
||||||
@@ -2179,7 +2174,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
|||||||
if (info->subversion != SUBVERSION)
|
if (info->subversion != SUBVERSION)
|
||||||
return; // Close, but no cigar.
|
return; // Close, but no cigar.
|
||||||
|
|
||||||
if (strcmp(info->application, SRB2APPLICATION))
|
if (!fastcmp(info->application, SRB2APPLICATION))
|
||||||
return;/* that's a different mod */
|
return;/* that's a different mod */
|
||||||
|
|
||||||
i = serverlistcount++;
|
i = serverlistcount++;
|
||||||
@@ -2224,7 +2219,7 @@ void CL_QueryServerList (msg_server_t *server_list)
|
|||||||
// thwart nefarious servers who lie to the MS.
|
// thwart nefarious servers who lie to the MS.
|
||||||
|
|
||||||
/* lol bruh, that version COMES from the servers */
|
/* lol bruh, that version COMES from the servers */
|
||||||
//if (strcmp(version, server_list[i].version) == 0)
|
//if (fastcmp(version, server_list[i].version))
|
||||||
{
|
{
|
||||||
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
|
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
|
||||||
if (node == -1)
|
if (node == -1)
|
||||||
@@ -3220,7 +3215,7 @@ static void Command_connect(void)
|
|||||||
|
|
||||||
server = false;
|
server = false;
|
||||||
|
|
||||||
if (!stricmp(COM_Argv(1), "self"))
|
if (fasticmp(COM_Argv(1), "self"))
|
||||||
{
|
{
|
||||||
servernode = 0;
|
servernode = 0;
|
||||||
server = true;
|
server = true;
|
||||||
@@ -3230,7 +3225,7 @@ static void Command_connect(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// used in menu to connect to a server in the list
|
// used in menu to connect to a server in the list
|
||||||
if (netgame && !stricmp(COM_Argv(1), "node"))
|
if (netgame && fasticmp(COM_Argv(1), "node"))
|
||||||
{
|
{
|
||||||
servernode = (SINT8)atoi(COM_Argv(2));
|
servernode = (SINT8)atoi(COM_Argv(2));
|
||||||
}
|
}
|
||||||
@@ -3245,7 +3240,7 @@ static void Command_connect(void)
|
|||||||
netgame = true;
|
netgame = true;
|
||||||
multiplayer = true;
|
multiplayer = true;
|
||||||
|
|
||||||
if (!stricmp(COM_Argv(1), "any"))
|
if (fasticmp(COM_Argv(1), "any"))
|
||||||
servernode = BROADCASTADDR;
|
servernode = BROADCASTADDR;
|
||||||
else if (I_NetMakeNodewPort && COM_Argc() >= 3)
|
else if (I_NetMakeNodewPort && COM_Argc() >= 3)
|
||||||
servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2));
|
servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2));
|
||||||
@@ -3269,6 +3264,7 @@ static void Command_connect(void)
|
|||||||
splitscreen = cv_splitplayers.value-1;
|
splitscreen = cv_splitplayers.value-1;
|
||||||
SplitScreen_OnChange();
|
SplitScreen_OnChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
botingame = false;
|
botingame = false;
|
||||||
botskin = 0;
|
botskin = 0;
|
||||||
CL_ConnectToServer();
|
CL_ConnectToServer();
|
||||||
@@ -4161,7 +4157,10 @@ static void Joinable_OnChange(void)
|
|||||||
UINT8 maxplayer;
|
UINT8 maxplayer;
|
||||||
|
|
||||||
if (!server)
|
if (!server)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, ("Only the server can change: %s %s\n"), cv_allownewplayer.name, cv_allownewplayer.string);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SATURNJOIN
|
#ifdef SATURNJOIN
|
||||||
// disabling joins should also disable saturn joins unless its called with CV_StealthSet and vice versa to make life a bit easier
|
// disabling joins should also disable saturn joins unless its called with CV_StealthSet and vice versa to make life a bit easier
|
||||||
@@ -4651,11 +4650,22 @@ void SV_StopServer(void)
|
|||||||
Y_EndIntermission();
|
Y_EndIntermission();
|
||||||
if (gamestate == GS_VOTING)
|
if (gamestate == GS_VOTING)
|
||||||
Y_EndVote();
|
Y_EndVote();
|
||||||
gamestate = wipegamestate = GS_NULL;
|
|
||||||
|
G_SetGamestate(GS_NULL);
|
||||||
|
wipegamestate = GS_NULL;
|
||||||
|
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
|
{
|
||||||
localtextcmd[i][0] = 0;
|
localtextcmd[i][0] = 0;
|
||||||
|
|
||||||
|
while (textcmdbuf[i] != NULL)
|
||||||
|
{
|
||||||
|
textcmdbuf_t *buf = textcmdbuf[i];
|
||||||
|
textcmdbuf[i] = textcmdbuf[i]->next;
|
||||||
|
Z_Free(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++)
|
for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++)
|
||||||
D_Clearticcmd(i);
|
D_Clearticcmd(i);
|
||||||
|
|
||||||
|
|||||||
+194
-187
@@ -97,15 +97,15 @@
|
|||||||
UINT8 window_notinfocus = false;
|
UINT8 window_notinfocus = false;
|
||||||
|
|
||||||
static char *startupiwadfiles[MAX_WADFILES];
|
static char *startupiwadfiles[MAX_WADFILES];
|
||||||
|
static size_t startupiwadcount = 0;
|
||||||
static char *startuppwads[MAX_WADFILES];
|
static char *startuppwads[MAX_WADFILES];
|
||||||
|
static size_t startuppwadcount = 0;
|
||||||
|
|
||||||
// autoloading
|
// autoloading
|
||||||
static char *autoloadwadfiles[MAX_WADFILES];
|
static char *autoloadwadfiles[MAX_WADFILES];
|
||||||
static char *autoloadwadfilespost[MAX_WADFILES];
|
static char *autoloadwadfilespost[MAX_WADFILES];
|
||||||
boolean autoloading;
|
static size_t autoloadcount = 0;
|
||||||
boolean autoloaded;
|
static size_t postloadcount = 0;
|
||||||
boolean postautoloaded = false;
|
|
||||||
boolean wasautoloaded = false;
|
|
||||||
//
|
//
|
||||||
|
|
||||||
boolean devparm = false; // started game with -devparm
|
boolean devparm = false; // started game with -devparm
|
||||||
@@ -113,7 +113,9 @@ boolean devparm = false; // started game with -devparm
|
|||||||
boolean singletics = false; // timedemo
|
boolean singletics = false; // timedemo
|
||||||
boolean lastdraw = false;
|
boolean lastdraw = false;
|
||||||
|
|
||||||
|
#ifdef MOTIONBLUR
|
||||||
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||||
|
#endif
|
||||||
|
|
||||||
// These variables are only true if
|
// These variables are only true if
|
||||||
// whether the respective sound system is disabled
|
// whether the respective sound system is disabled
|
||||||
@@ -347,11 +349,69 @@ static void D_Renderview(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i <= splitscreen; i++)
|
||||||
|
{
|
||||||
|
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||||
|
{
|
||||||
|
viewssnum = i;
|
||||||
|
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
if (splitscreen > 1)
|
||||||
|
{
|
||||||
|
viewwindowx = viewwidth;
|
||||||
|
viewwindowy = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewwindowx = 0;
|
||||||
|
viewwindowy = viewheight;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
viewwindowx = 0;
|
||||||
|
viewwindowy = viewheight;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
viewwindowx = viewwidth;
|
||||||
|
viewwindowy = viewheight;
|
||||||
|
break;
|
||||||
|
default: // Initialize for P1
|
||||||
|
viewwindowy = viewwindowx = 0;
|
||||||
|
objectsdrawn = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
{
|
||||||
|
HWR_RenderPlayerView();
|
||||||
|
}
|
||||||
|
else if (rendermode == render_soft)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rendermode == render_soft)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
R_ApplyViewMorph();
|
||||||
|
|
||||||
|
#ifdef MOTIONBLUR
|
||||||
|
V_DoPostProcessor(i, postimgparam[i]);
|
||||||
|
#else
|
||||||
|
V_DoPostProcessor(i, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Draw over the fourth screen so you don't have to stare at a HOM :V
|
// Draw over the fourth screen so you don't have to stare at a HOM :V
|
||||||
if (splitscreen == 2)
|
if (splitscreen == 2)
|
||||||
{
|
{
|
||||||
// V_DrawPatchFill, but for the fourth screen only
|
// V_DrawPatchFill, but for the fourth screen only
|
||||||
patch_t *pat = W_CachePatchName("SRB2BACK", PU_CACHE);
|
patch_t *pat = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||||
INT32 x, y, pw = SHORT(pat->width) * vid.dup, ph = SHORT(pat->height) * vid.dup;
|
INT32 x, y, pw = SHORT(pat->width) * vid.dup, ph = SHORT(pat->height) * vid.dup;
|
||||||
|
|
||||||
for (x = vid.width>>1; x < vid.width; x += pw)
|
for (x = vid.width>>1; x < vid.width; x += pw)
|
||||||
@@ -361,65 +421,6 @@ static void D_Renderview(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
|
||||||
{
|
|
||||||
const boolean issplitscreen = (i > 0);
|
|
||||||
|
|
||||||
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
|
|
||||||
{
|
|
||||||
viewssnum = i;
|
|
||||||
|
|
||||||
if (!issplitscreen) // Initialize for P1
|
|
||||||
{
|
|
||||||
viewwindowy = viewwindowx = 0;
|
|
||||||
objectsdrawn = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode == render_opengl)
|
|
||||||
{
|
|
||||||
HWR_RenderPlayerView();
|
|
||||||
R_RestoreLevelInterpolators();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (issplitscreen) // Splitscreen-specific
|
|
||||||
{
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
if (splitscreen > 1)
|
|
||||||
{
|
|
||||||
viewwindowx = viewwidth;
|
|
||||||
viewwindowy = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
viewwindowx = 0;
|
|
||||||
viewwindowy = viewheight;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
viewwindowx = 0;
|
|
||||||
viewwindowy = viewheight;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
viewwindowx = viewwidth;
|
|
||||||
viewwindowy = viewheight;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!issplitscreen)
|
|
||||||
R_ApplyViewMorph();
|
|
||||||
|
|
||||||
V_DoPostProcessor(i, postimgparam[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_RestoreLevelInterpolators();
|
R_RestoreLevelInterpolators();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,19 +523,16 @@ static boolean D_Display(void)
|
|||||||
case GS_LEVEL:
|
case GS_LEVEL:
|
||||||
if (!gametic)
|
if (!gametic)
|
||||||
break;
|
break;
|
||||||
HU_Erase();
|
|
||||||
AM_Drawer();
|
AM_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_INTERMISSION:
|
case GS_INTERMISSION:
|
||||||
Y_IntermissionDrawer();
|
Y_IntermissionDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_VOTING:
|
case GS_VOTING:
|
||||||
Y_VoteDrawer();
|
Y_VoteDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -549,7 +547,6 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
case GS_CUTSCENE:
|
case GS_CUTSCENE:
|
||||||
F_CutsceneDrawer();
|
F_CutsceneDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -559,7 +556,6 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
case GS_EVALUATION:
|
case GS_EVALUATION:
|
||||||
F_GameEvaluationDrawer();
|
F_GameEvaluationDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -569,7 +565,6 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
case GS_CREDITS:
|
case GS_CREDITS:
|
||||||
F_CreditDrawer();
|
F_CreditDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -586,7 +581,6 @@ static boolean D_Display(void)
|
|||||||
{
|
{
|
||||||
// I don't think HOM from nothing drawing is independent...
|
// I don't think HOM from nothing drawing is independent...
|
||||||
F_WaitingPlayersDrawer();
|
F_WaitingPlayersDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
}
|
}
|
||||||
case GS_TIMEATTACK:
|
case GS_TIMEATTACK:
|
||||||
@@ -774,6 +768,7 @@ void D_SRB2Loop(void)
|
|||||||
precise_t capbudget;
|
precise_t capbudget;
|
||||||
precise_t enterprecise = I_GetPreciseTime();
|
precise_t enterprecise = I_GetPreciseTime();
|
||||||
|
|
||||||
|
memset(&g_dc, 0, sizeof(g_dc));
|
||||||
Z_Frame_Reset();
|
Z_Frame_Reset();
|
||||||
|
|
||||||
// Casting the return value of a function is bad practice (apparently)
|
// Casting the return value of a function is bad practice (apparently)
|
||||||
@@ -889,12 +884,6 @@ void D_SRB2Loop(void)
|
|||||||
// always update console and hud
|
// always update console and hud
|
||||||
// otherwise it may take minutes to open it
|
// otherwise it may take minutes to open it
|
||||||
CON_Drawer();
|
CON_Drawer();
|
||||||
|
|
||||||
if (gamestate == GS_LEVEL)
|
|
||||||
{
|
|
||||||
ST_Drawer();
|
|
||||||
HU_Drawer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -978,8 +967,11 @@ void D_ClearState(void)
|
|||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
demo.title = false;
|
||||||
|
|
||||||
// okay, stop now
|
// okay, stop now
|
||||||
// (otherwise the game still thinks we're playing!)
|
// (otherwise the game still thinks we're playing!)
|
||||||
|
CURLAbortFile();
|
||||||
SV_StopServer();
|
SV_StopServer();
|
||||||
SV_ResetServer();
|
SV_ResetServer();
|
||||||
serverlistultimatecount = 0;
|
serverlistultimatecount = 0;
|
||||||
@@ -988,7 +980,10 @@ void D_ClearState(void)
|
|||||||
CL_ClearPlayer(i);
|
CL_ClearPlayer(i);
|
||||||
|
|
||||||
splitscreen = 0;
|
splitscreen = 0;
|
||||||
SplitScreen_OnChange();
|
|
||||||
|
// recompute screen size
|
||||||
|
R_ExecuteSetViewSize();
|
||||||
|
|
||||||
botingame = false;
|
botingame = false;
|
||||||
botskin = 0;
|
botskin = 0;
|
||||||
cv_debug = 0;
|
cv_debug = 0;
|
||||||
@@ -1007,7 +1002,6 @@ void D_ClearState(void)
|
|||||||
gameaction = ga_nothing;
|
gameaction = ga_nothing;
|
||||||
memset(displayplayers, 0, sizeof(displayplayers));
|
memset(displayplayers, 0, sizeof(displayplayers));
|
||||||
consoleplayer = 0;
|
consoleplayer = 0;
|
||||||
//demosequence = -1;
|
|
||||||
gametype = GT_RACE; // SRB2kart
|
gametype = GT_RACE; // SRB2kart
|
||||||
paused = false;
|
paused = false;
|
||||||
|
|
||||||
@@ -1026,10 +1020,15 @@ void D_ClearState(void)
|
|||||||
S_StopSounds();
|
S_StopSounds();
|
||||||
S_ResetKeepAndSpecialMus(); // just in case
|
S_ResetKeepAndSpecialMus(); // just in case
|
||||||
|
|
||||||
P_FreeLevelState();
|
//P_FreeLevelState();
|
||||||
|
|
||||||
G_SetGamestate(GS_NULL);
|
G_SetGamestate(GS_NULL);
|
||||||
wipegamestate = GS_NULL;
|
wipegamestate = GS_NULL;
|
||||||
|
|
||||||
|
M_ClearMenus(true);
|
||||||
|
|
||||||
|
// map palettes affect this
|
||||||
|
D_ResetDeviceLED();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1037,25 +1036,18 @@ void D_ClearState(void)
|
|||||||
//
|
//
|
||||||
void D_StartTitle(void)
|
void D_StartTitle(void)
|
||||||
{
|
{
|
||||||
demo.title = false;
|
|
||||||
D_ClearState();
|
D_ClearState();
|
||||||
netgame = false; // title menu shouldnt be a netgame lmao
|
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
|
||||||
M_ClearMenus(true);
|
|
||||||
F_StartTitleScreen();
|
F_StartTitleScreen();
|
||||||
D_ResetDeviceLED();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// D_AddFile
|
// D_AddFile
|
||||||
//
|
//
|
||||||
static void D_AddFile(const char *file, char **filearray)
|
static void D_AddFile(const char *file, char **filearray, size_t index)
|
||||||
{
|
{
|
||||||
size_t pnumwadfiles;
|
|
||||||
char *newfile;
|
char *newfile;
|
||||||
|
|
||||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
|
||||||
;
|
|
||||||
|
|
||||||
newfile = malloc(strlen(file) + 1);
|
newfile = malloc(strlen(file) + 1);
|
||||||
if (!newfile)
|
if (!newfile)
|
||||||
{
|
{
|
||||||
@@ -1063,16 +1055,17 @@ static void D_AddFile(const char *file, char **filearray)
|
|||||||
}
|
}
|
||||||
strcpy(newfile, file);
|
strcpy(newfile, file);
|
||||||
|
|
||||||
filearray[pnumwadfiles] = newfile;
|
filearray[index] = newfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void D_CleanFile(char **filearray)
|
static void D_CleanFile(char **filearray, size_t count)
|
||||||
{
|
{
|
||||||
size_t pnumwadfiles;
|
size_t i;
|
||||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
free(filearray[pnumwadfiles]);
|
free(filearray[i]);
|
||||||
filearray[pnumwadfiles] = NULL;
|
filearray[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,28 +1078,27 @@ static INT32 D_DetectFileType(const char* filename)
|
|||||||
|
|
||||||
const size_t len = strlen(filename);
|
const size_t len = strlen(filename);
|
||||||
|
|
||||||
if (!stricmp(&filename[len - 4], ".wad"))
|
if (fasticmp(&filename[len - 4], ".wad"))
|
||||||
return 2;
|
return 2;
|
||||||
else if (!stricmp(&filename[len - 4], ".pk3"))
|
else if (fasticmp(&filename[len - 4], ".pk3"))
|
||||||
return 3;
|
return 3;
|
||||||
else if (!stricmp(&filename[len - 5], ".kart"))
|
else if (fasticmp(&filename[len - 5], ".kart"))
|
||||||
return 4;
|
return 4;
|
||||||
else if (!stricmp(&filename[len - 4], ".lua"))
|
else if (fasticmp(&filename[len - 4], ".lua"))
|
||||||
return 5;
|
return 5;
|
||||||
else if (!stricmp(&filename[len - 4], ".soc"))
|
else if (fasticmp(&filename[len - 4], ".soc"))
|
||||||
return 6;
|
return 6;
|
||||||
else if (!stricmp(&filename[len - 4], ".cfg"))
|
else if (fasticmp(&filename[len - 4], ".cfg"))
|
||||||
return 7;
|
return 7;
|
||||||
else if (!stricmp(&filename[len - 4], ".txt"))
|
else if (fasticmp(&filename[len - 4], ".txt"))
|
||||||
return 8;
|
return 8;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// autoload that shit
|
// autoload that shit
|
||||||
static void D_AutoloadFile(const char *file, char **filearray)
|
static void D_AutoloadFile(const char *file, char **filearray, size_t index)
|
||||||
{
|
{
|
||||||
size_t pnumwadfiles;
|
|
||||||
char *newfile;
|
char *newfile;
|
||||||
INT32 fileType = D_DetectFileType(file);
|
INT32 fileType = D_DetectFileType(file);
|
||||||
|
|
||||||
@@ -1116,9 +1108,6 @@ static void D_AutoloadFile(const char *file, char **filearray)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
|
||||||
;
|
|
||||||
|
|
||||||
if (fileType <= 6)
|
if (fileType <= 6)
|
||||||
{
|
{
|
||||||
newfile = malloc(strlen(file) + 1);
|
newfile = malloc(strlen(file) + 1);
|
||||||
@@ -1126,7 +1115,7 @@ static void D_AutoloadFile(const char *file, char **filearray)
|
|||||||
I_Error("No more free memory to AutoloadFile %s",file);
|
I_Error("No more free memory to AutoloadFile %s",file);
|
||||||
|
|
||||||
strcpy(newfile, file);
|
strcpy(newfile, file);
|
||||||
filearray[pnumwadfiles] = newfile;
|
filearray[index] = newfile;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1156,42 +1145,44 @@ static void D_FindAddonsToAutoload(void)
|
|||||||
{
|
{
|
||||||
FILE *autoloadconfigfile;
|
FILE *autoloadconfigfile;
|
||||||
const char *autoloadpath;
|
const char *autoloadpath;
|
||||||
|
char *newline;
|
||||||
|
|
||||||
boolean postload;
|
boolean postload;
|
||||||
|
|
||||||
INT32 i;
|
|
||||||
char wadsToAutoload[256] = "";
|
char wadsToAutoload[256] = "";
|
||||||
|
|
||||||
// does it exist tho
|
// does it exist tho
|
||||||
autoloadpath = va("%s"PATHSEP"%s",srb2home,AUTOLOADCONFIGFILENAME);
|
autoloadpath = va("%s"PATHSEP"%s", srb2home, AUTOLOADCONFIGFILENAME);
|
||||||
autoloadconfigfile = fopen(autoloadpath, "r");
|
autoloadconfigfile = fopen(autoloadpath, "r");
|
||||||
|
|
||||||
// If the file is found, run our shit
|
// If the file is found, run our shit
|
||||||
if (!autoloadconfigfile) // nope outta here
|
if (!autoloadconfigfile) // nope outta here
|
||||||
{
|
{
|
||||||
wasautoloaded = postautoloaded = true; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
|
autoloadcount = postloadcount = 0; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL)
|
while (fgets(wadsToAutoload, sizeof(wadsToAutoload), autoloadconfigfile) != NULL)
|
||||||
{
|
{
|
||||||
postload = false;
|
postload = false;
|
||||||
|
|
||||||
// skip if commented or empty
|
// skip if commented or empty
|
||||||
if ((wadsToAutoload[1] == '\0' || wadsToAutoload[1] == '\n')
|
if (wadsToAutoload[0] == '\n' ||
|
||||||
|| (wadsToAutoload[0] == '#'))
|
wadsToAutoload[0] == '#' ||
|
||||||
|
wadsToAutoload[0] == '\0')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// this marks it so that it loads after loading server addons
|
// this marks it so that it loads after loading server addons
|
||||||
else if (fastncmp(wadsToAutoload, "postload ", 9))
|
if (fastncmp(wadsToAutoload, "postload ", 9))
|
||||||
{
|
{
|
||||||
strremove(wadsToAutoload, "postload ");
|
strremove(wadsToAutoload, "postload ");
|
||||||
postload = true;
|
postload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove Any Empty or Skipped Lines
|
// Remove Any Empty or Skipped Lines
|
||||||
for (i = 0; wadsToAutoload[i] != '\0'; i++)
|
newline = strchr(wadsToAutoload, '\n');
|
||||||
{
|
if (newline)
|
||||||
if (wadsToAutoload[i] == '\n')
|
*newline = '\0';
|
||||||
wadsToAutoload[i] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!postload && W_CheckPostLoadList(wadsToAutoload))
|
if (!postload && W_CheckPostLoadList(wadsToAutoload))
|
||||||
{
|
{
|
||||||
@@ -1201,56 +1192,67 @@ static void D_FindAddonsToAutoload(void)
|
|||||||
|
|
||||||
// LOAD IT
|
// LOAD IT
|
||||||
if (!postload)
|
if (!postload)
|
||||||
D_AutoloadFile(wadsToAutoload, autoloadwadfiles);
|
{
|
||||||
|
D_AutoloadFile(wadsToAutoload, autoloadwadfiles, autoloadcount);
|
||||||
|
autoloadcount++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost);
|
{
|
||||||
|
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost, postloadcount);
|
||||||
// end it here
|
postloadcount++;
|
||||||
for (i = 0; wadsToAutoload[i] != '\0'; i++)
|
}
|
||||||
wadsToAutoload[i] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autoloadwadfiles[autoloadcount] = NULL;
|
||||||
|
autoloadwadfilespost[postloadcount] = NULL;
|
||||||
|
|
||||||
// we dont want memory leaks around here do we?
|
// we dont want memory leaks around here do we?
|
||||||
fclose(autoloadconfigfile);
|
fclose(autoloadconfigfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void D_AddAutoloadFiles(void)
|
static void D_AddAutoloadFiles(void)
|
||||||
{
|
{
|
||||||
if (wasautoloaded)
|
// nothing to autoload
|
||||||
|
if (autoloadcount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||||
|
|
||||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||||
D_CleanFile(autoloadwadfiles);
|
|
||||||
|
|
||||||
wasautoloaded = true;
|
D_CleanFile(autoloadwadfiles, autoloadcount);
|
||||||
|
|
||||||
|
autoloadcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void D_AddPostloadFiles(void)
|
void D_AddPostloadFiles(void)
|
||||||
{
|
{
|
||||||
if (postautoloaded || !netgame)
|
// nothing to postload
|
||||||
|
if (postloadcount == 0 || !netgame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
|
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
|
||||||
|
|
||||||
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
||||||
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
|
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
|
||||||
D_CleanFile(autoloadwadfilespost);
|
|
||||||
|
|
||||||
postautoloaded = true;
|
D_CleanFile(autoloadwadfilespost, postloadcount);
|
||||||
|
|
||||||
|
postloadcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Identify the SRB2 version, and IWAD file to use.
|
// Identify the SRB2 version, and IWAD file to use.
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
static boolean AddIWAD(void)
|
static boolean AddIWAD(const char * file, const char *dir)
|
||||||
{
|
{
|
||||||
char * path = va(pandf, srb2path, "srb2.srb");
|
char * path = va(pandf, dir, file);
|
||||||
|
|
||||||
if (FIL_ReadFileOK(path))
|
if (FIL_ReadFileOK(path))
|
||||||
{
|
{
|
||||||
D_AddFile(path, startupiwadfiles);
|
D_AddFile(path, startupiwadfiles, startupiwadcount++);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1286,14 +1288,14 @@ static void IdentifyVersion(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (1) // reduce the amount of findfile by only using full cwd in this func
|
#if (1) // reduce the amount of findfile by only using full cwd in this func
|
||||||
if (strcmp(tempsrb2path, srb2waddir))
|
if (!fastcmp(tempsrb2path, srb2waddir))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
strlcpy(srb2path, srb2waddir, sizeof (srb2path));
|
strlcpy(srb2path, srb2waddir, sizeof (srb2path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the IWAD
|
// Load the IWAD
|
||||||
if (!AddIWAD())
|
if (!AddIWAD("srb2.srb", srb2path)) // not sure why this uses srb2path and not srb2waddir?
|
||||||
{
|
{
|
||||||
I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir);
|
I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir);
|
||||||
}
|
}
|
||||||
@@ -1307,57 +1309,60 @@ static void IdentifyVersion(void)
|
|||||||
|
|
||||||
#ifdef USE_PATCH_DTA
|
#ifdef USE_PATCH_DTA
|
||||||
// Add our crappy patches to fix our bugs
|
// Add our crappy patches to fix our bugs
|
||||||
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
|
if (!AddIWAD("patch.dta", srb2waddir))
|
||||||
|
{
|
||||||
|
I_Error("patch.dta not found! Expected in %s\n", srb2waddir);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!AddIWAD("gfx.kart", srb2waddir))
|
||||||
|
{
|
||||||
|
I_Error("gfx.kart not found! Expected in %s\n", srb2waddir);
|
||||||
|
}
|
||||||
|
|
||||||
D_AddFile(va(pandf, srb2waddir, "gfx.kart"), startupiwadfiles);
|
if (!AddIWAD("textures.kart", srb2waddir))
|
||||||
D_AddFile(va(pandf, srb2waddir, "textures.kart"), startupiwadfiles);
|
{
|
||||||
D_AddFile(va(pandf, srb2waddir, "chars.kart"), startupiwadfiles);
|
I_Error("textures.kart not found! Expected in %s\n", srb2waddir);
|
||||||
D_AddFile(va(pandf, srb2waddir, "maps.kart"), startupiwadfiles);
|
}
|
||||||
|
|
||||||
|
if (!AddIWAD("chars.kart", srb2waddir))
|
||||||
|
{
|
||||||
|
I_Error("chars.kart not found! Expected in %s\n", srb2waddir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!AddIWAD("maps.kart", srb2waddir))
|
||||||
|
{
|
||||||
|
I_Error("maps.kart not found! Expected in %s\n", srb2waddir);
|
||||||
|
}
|
||||||
#ifdef USE_PATCH_KART
|
#ifdef USE_PATCH_KART
|
||||||
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupiwadfiles);
|
if (!AddIWAD("patch.kart", srb2waddir))
|
||||||
|
{
|
||||||
|
I_Error("patch.kart not found! Expected in %s\n", srb2waddir);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *path = NULL;
|
|
||||||
|
|
||||||
path = va(pandf, srb2waddir, "extra.kart");
|
|
||||||
|
|
||||||
// completely optional
|
// completely optional
|
||||||
if (FIL_ReadFileOK(path))
|
if (AddIWAD("extra.kart", srb2waddir))
|
||||||
{
|
|
||||||
D_AddFile(path, startupiwadfiles);
|
|
||||||
found_extra_kart = true;
|
found_extra_kart = true;
|
||||||
}
|
|
||||||
|
|
||||||
path = va(pandf, srb2waddir, "extra2.kart");
|
|
||||||
|
|
||||||
// completely optional 2: Back with a vengence
|
// completely optional 2: Back with a vengence
|
||||||
if (FIL_ReadFileOK(path))
|
if (AddIWAD("extra2.kart", srb2waddir))
|
||||||
{
|
|
||||||
D_AddFile(path, startupiwadfiles);
|
|
||||||
found_extra2_kart = true;
|
found_extra2_kart = true;
|
||||||
}
|
|
||||||
|
|
||||||
path = va(pandf, srb2waddir, "extra3.kart");
|
if (AddIWAD("extra3.kart", srb2waddir))
|
||||||
|
|
||||||
if (FIL_ReadFileOK(path))
|
|
||||||
{
|
|
||||||
D_AddFile(path, startupiwadfiles);
|
|
||||||
found_extra3_kart = true;
|
found_extra3_kart = true;
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||||
#define MUSICTEST(str) \
|
#define MUSICTEST(str) \
|
||||||
musicpath = va(pandf,srb2waddir,str);\
|
musicpath = va(pandf, srb2waddir, str);\
|
||||||
handle = W_OpenWadFile(&musicpath, false); \
|
handle = W_OpenWadFile(&musicpath, false); \
|
||||||
if (handle) \
|
if (handle) \
|
||||||
{\
|
{ \
|
||||||
int ms = W_VerifyNMUSlumps(musicpath, handle, false); \
|
int ms = W_VerifyNMUSlumps(musicpath, handle, false); \
|
||||||
fclose(handle); \
|
fclose(handle); \
|
||||||
if (ms == 0) \
|
if (ms == 0) \
|
||||||
I_Error("File " str " has been modified with non-music/sound lumps"); \
|
I_Error("File " str " has been modified with non-music/sound lumps"); \
|
||||||
if (ms == 1) \
|
if (ms == 1) \
|
||||||
D_AddFile(musicpath, startupiwadfiles); \
|
D_AddFile(musicpath, startupiwadfiles, startupiwadcount++); \
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const char *musicpath;
|
const char *musicpath;
|
||||||
@@ -1731,8 +1736,14 @@ void D_SRB2Main(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// use user specific config file
|
// use user specific config file
|
||||||
|
if (M_CheckParm("-workdir") && M_IsNextParm())
|
||||||
|
snprintf(srb2home, sizeof srb2home, "%s", M_GetNextParm());
|
||||||
|
else
|
||||||
#ifdef DEFAULTDIR
|
#ifdef DEFAULTDIR
|
||||||
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
|
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
|
||||||
|
#else // DEFAULTDIR
|
||||||
|
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
||||||
|
#endif // DEFAULTDIR
|
||||||
snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home);
|
snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home);
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
|
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
|
||||||
@@ -1741,17 +1752,6 @@ void D_SRB2Main(void)
|
|||||||
|
|
||||||
// can't use sprintf since there is %u in savegamename
|
// can't use sprintf since there is %u in savegamename
|
||||||
strcatbf(savegamename, srb2home, PATHSEP);
|
strcatbf(savegamename, srb2home, PATHSEP);
|
||||||
#else
|
|
||||||
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
|
||||||
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
|
|
||||||
if (dedicated)
|
|
||||||
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome);
|
|
||||||
else
|
|
||||||
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, userhome);
|
|
||||||
|
|
||||||
// can't use sprintf since there is %u in savegamename
|
|
||||||
strcatbf(savegamename, userhome, PATHSEP);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configfile[sizeof configfile - 1] = '\0';
|
configfile[sizeof configfile - 1] = '\0';
|
||||||
@@ -1777,6 +1777,9 @@ void D_SRB2Main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure workdir exists
|
||||||
|
I_mkdir(srb2home, 0755);
|
||||||
|
|
||||||
// Create addons dir
|
// Create addons dir
|
||||||
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
|
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
|
||||||
I_mkdir(addonsdir, 0755);
|
I_mkdir(addonsdir, 0755);
|
||||||
@@ -1805,7 +1808,7 @@ void D_SRB2Main(void)
|
|||||||
const char *s = M_GetNextParm();
|
const char *s = M_GetNextParm();
|
||||||
|
|
||||||
if (s) // Check for NULL?
|
if (s) // Check for NULL?
|
||||||
D_AddFile(s, startuppwads);
|
D_AddFile(s, startuppwads, startuppwadcount++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1838,8 +1841,10 @@ void D_SRB2Main(void)
|
|||||||
// load wad, including the main wad file
|
// load wad, including the main wad file
|
||||||
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
||||||
|
|
||||||
W_InitMultipleFiles(startupiwadfiles, false);
|
W_InitMultipleFiles(startupiwadfiles, startupiwadcount, false);
|
||||||
D_CleanFile(startupiwadfiles);
|
//mainwads = startupiwadcount - musicwads;
|
||||||
|
D_CleanFile(startupiwadfiles, startupiwadcount);
|
||||||
|
startupiwadcount = 0;
|
||||||
mainwads = 0;
|
mainwads = 0;
|
||||||
|
|
||||||
#ifndef DEVELOP
|
#ifndef DEVELOP
|
||||||
@@ -1878,15 +1883,16 @@ void D_SRB2Main(void)
|
|||||||
|
|
||||||
D_CheckMaps(false);
|
D_CheckMaps(false);
|
||||||
|
|
||||||
W_InitMultipleFiles(startuppwads, true);
|
W_InitMultipleFiles(startuppwads, startuppwadcount, true);
|
||||||
|
|
||||||
// Only search for pwad maps if we actually have a pwad added
|
// Only search for pwad maps if we actually have a pwad added
|
||||||
if (startuppwads[0] != NULL)
|
if (startuppwadcount > 0)
|
||||||
{
|
{
|
||||||
D_CheckMaps(true);
|
D_CheckMaps(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
D_CleanFile(startuppwads);
|
D_CleanFile(startuppwads, startuppwadcount);
|
||||||
|
startuppwadcount = 0;
|
||||||
|
|
||||||
cht_Init();
|
cht_Init();
|
||||||
|
|
||||||
@@ -1930,9 +1936,7 @@ void D_SRB2Main(void)
|
|||||||
|
|
||||||
G_LoadGameData();
|
G_LoadGameData();
|
||||||
|
|
||||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
|
||||||
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
||||||
#endif
|
|
||||||
|
|
||||||
// set user default mode or mode set at cmdline
|
// set user default mode or mode set at cmdline
|
||||||
SCR_CheckDefaultMode();
|
SCR_CheckDefaultMode();
|
||||||
@@ -2152,11 +2156,14 @@ void D_SRB2Main(void)
|
|||||||
const char *sskill = M_GetNextParm();
|
const char *sskill = M_GetNextParm();
|
||||||
|
|
||||||
for (j = 0; kartspeed_cons_t[j].strvalue; j++)
|
for (j = 0; kartspeed_cons_t[j].strvalue; j++)
|
||||||
if (!strcasecmp(kartspeed_cons_t[j].strvalue, sskill))
|
{
|
||||||
|
if (fasticmp(kartspeed_cons_t[j].strvalue, sskill))
|
||||||
{
|
{
|
||||||
newskill = (INT16)kartspeed_cons_t[j].value;
|
newskill = (INT16)kartspeed_cons_t[j].value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match
|
if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match
|
||||||
{
|
{
|
||||||
j = atoi(sskill); // assume they gave us a skill number, which is okay too
|
j = atoi(sskill); // assume they gave us a skill number, which is okay too
|
||||||
|
|||||||
@@ -61,9 +61,6 @@ extern boolean minilighticon; // mkwii-style minimap headlight
|
|||||||
//
|
//
|
||||||
|
|
||||||
// autoload stuff
|
// autoload stuff
|
||||||
extern boolean autoloading;
|
|
||||||
extern boolean autoloaded;
|
|
||||||
extern boolean postautoloaded;
|
|
||||||
void D_AddPostloadFiles(void);
|
void D_AddPostloadFiles(void);
|
||||||
|
|
||||||
// the infinite loop of D_SRB2Loop() called from win_main for windows version
|
// the infinite loop of D_SRB2Loop() called from win_main for windows version
|
||||||
|
|||||||
+2
-3
@@ -1127,9 +1127,7 @@ boolean HGetPacket(void)
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
I_NetGet();
|
if (!I_NetGet()) // No packets received
|
||||||
|
|
||||||
if (doomcom->remotenode == -1) // No packet received
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
getbytes += packetheaderlength + doomcom->datalength; // For stat
|
getbytes += packetheaderlength + doomcom->datalength; // For stat
|
||||||
@@ -1165,6 +1163,7 @@ boolean HGetPacket(void)
|
|||||||
GotAcks();
|
GotAcks();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
doomcom->datalength -= BASEPACKETSIZE;
|
doomcom->datalength -= BASEPACKETSIZE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-56
@@ -292,6 +292,10 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
|
|||||||
// Lagless camera! Yay!
|
// Lagless camera! Yay!
|
||||||
consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
// makes the camera use the saved angleturn in replays instead of the players angle
|
||||||
|
// more accurate to how the recording player seen things in game, but may be jittery if they encountered net issues
|
||||||
|
consvar_t cv_demoangturn = {"useangleturninreplays", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
|
consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
|
||||||
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
{"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
{"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
@@ -964,10 +968,11 @@ void D_RegisterClientCommands(void)
|
|||||||
|
|
||||||
// g_input.c
|
// g_input.c
|
||||||
CV_RegisterVar(&cv_controlperkey);
|
CV_RegisterVar(&cv_controlperkey);
|
||||||
CV_RegisterVar(&cv_turnsmooth);
|
|
||||||
|
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
CV_RegisterVar(&cv_turnsmooth[i]);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_turnaxis[i]);
|
CV_RegisterVar(&cv_turnaxis[i]);
|
||||||
CV_RegisterVar(&cv_moveaxis[i]);
|
CV_RegisterVar(&cv_moveaxis[i]);
|
||||||
CV_RegisterVar(&cv_camturnaxis[i]);
|
CV_RegisterVar(&cv_camturnaxis[i]);
|
||||||
@@ -984,6 +989,8 @@ void D_RegisterClientCommands(void)
|
|||||||
CV_RegisterVar(&cv_xdeadzone[i]);
|
CV_RegisterVar(&cv_xdeadzone[i]);
|
||||||
CV_RegisterVar(&cv_ydeadzone[i]);
|
CV_RegisterVar(&cv_ydeadzone[i]);
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_litesteer[i]);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_usejoystick[i]);
|
CV_RegisterVar(&cv_usejoystick[i]);
|
||||||
CV_RegisterVar(&cv_joyscale[i]);
|
CV_RegisterVar(&cv_joyscale[i]);
|
||||||
CV_RegisterVar(&cv_rumble[i]);
|
CV_RegisterVar(&cv_rumble[i]);
|
||||||
@@ -1040,6 +1047,7 @@ void D_RegisterClientCommands(void)
|
|||||||
CV_RegisterVar(&cv_betainterscreen);
|
CV_RegisterVar(&cv_betainterscreen);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_laglesscam);
|
CV_RegisterVar(&cv_laglesscam);
|
||||||
|
CV_RegisterVar(&cv_demoangturn);
|
||||||
|
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
{
|
{
|
||||||
@@ -1211,7 +1219,7 @@ static boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
|
|||||||
for (ix = 0; ix < MAXPLAYERS; ix++)
|
for (ix = 0; ix < MAXPLAYERS; ix++)
|
||||||
{
|
{
|
||||||
if (ix != playernum && playeringame[ix]
|
if (ix != playernum && playeringame[ix]
|
||||||
&& strcasecmp(name, player_names[ix]) == 0)
|
&& fasticmp(name, player_names[ix]))
|
||||||
{
|
{
|
||||||
// We shouldn't kick people out just because
|
// We shouldn't kick people out just because
|
||||||
// they joined the game with the same name
|
// they joined the game with the same name
|
||||||
@@ -1328,7 +1336,7 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
|
|||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (i != playernum && playeringame[i]
|
if (i != playernum && playeringame[i]
|
||||||
&& strcasecmp(tmpname, player_names[i]) == 0)
|
&& fasticmp(tmpname, player_names[i]))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1378,7 +1386,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
|
|||||||
{
|
{
|
||||||
if (EnsurePlayerNameIsGood(newname, playernum))
|
if (EnsurePlayerNameIsGood(newname, playernum))
|
||||||
{
|
{
|
||||||
if (strcasecmp(newname, player_names[playernum]) != 0)
|
if (!fasticmp(newname, player_names[playernum]))
|
||||||
{
|
{
|
||||||
if (netgame)
|
if (netgame)
|
||||||
HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false);
|
HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false);
|
||||||
@@ -1500,9 +1508,9 @@ static void SendNameAndColor(void)
|
|||||||
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
|
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(cv_playername.string, player_names[consoleplayer])
|
if (fastcmp(cv_playername.string, player_names[consoleplayer])
|
||||||
&& cv_playercolor.value == players[consoleplayer].skincolor
|
&& cv_playercolor.value == players[consoleplayer].skincolor
|
||||||
&& !strcmp(cv_skin.string, skins[players[consoleplayer].skin].name))
|
&& fastcmp(cv_skin.string, skins[players[consoleplayer].skin].name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We'll handle it later if we're not playing.
|
// We'll handle it later if we're not playing.
|
||||||
@@ -1937,7 +1945,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||||||
// set name
|
// set name
|
||||||
if (player_name_changes[playernum] < MAXNAMECHANGES)
|
if (player_name_changes[playernum] < MAXNAMECHANGES)
|
||||||
{
|
{
|
||||||
if (strcasecmp(player_names[playernum], name) != 0)
|
if (!fasticmp(player_names[playernum], name))
|
||||||
SetPlayerName(playernum, name);
|
SetPlayerName(playernum, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1991,11 +1999,6 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
SetPlayerSkinByNum(playernum, skin);
|
SetPlayerSkinByNum(playernum, skin);
|
||||||
|
|
||||||
#ifdef HAVE_DISCORDRPC
|
|
||||||
if (playernum == consoleplayer)
|
|
||||||
DRPC_UpdatePresence();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendWeaponPref(void)
|
void SendWeaponPref(void)
|
||||||
@@ -2319,8 +2322,8 @@ static void Command_Playdemo_f(void)
|
|||||||
|
|
||||||
CONS_Printf(M_GetText("Playing back demo '%s'.\n"), name);
|
CONS_Printf(M_GetText("Playing back demo '%s'.\n"), name);
|
||||||
|
|
||||||
demo.loadfiles = strcmp(COM_Argv(2), "-addfiles") == 0;
|
demo.loadfiles = fastcmp(COM_Argv(2), "-addfiles");
|
||||||
demo.ignorefiles = strcmp(COM_Argv(2), "-force") == 0;
|
demo.ignorefiles = fastcmp(COM_Argv(2), "-force");
|
||||||
|
|
||||||
// Internal if no extension, external if one exists
|
// Internal if no extension, external if one exists
|
||||||
// If external, convert the file name to a path in SRB2's home directory
|
// If external, convert the file name to a path in SRB2's home directory
|
||||||
@@ -2489,15 +2492,18 @@ void D_SetupVote(void)
|
|||||||
INT32 i;
|
INT32 i;
|
||||||
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
|
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
|
||||||
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
|
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
|
||||||
INT16 votebuffer[4] = {-1,-1,-1,0};
|
INT16 votebuffer[4] = {-1,-1,-1, 0};
|
||||||
INT16 luamaps[4] = {0, 0, 0, 0};
|
INT16 luamaps[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
|
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
|
||||||
|
|
||||||
// Correct secondgt if needed
|
// Correct secondgt if needed
|
||||||
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
if (luamaps[2])
|
||||||
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
{
|
||||||
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
||||||
|
if ((typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
||||||
|
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
||||||
|
}
|
||||||
|
|
||||||
if (cv_kartencore.value && gt == GT_RACE)
|
if (cv_kartencore.value && gt == GT_RACE)
|
||||||
WRITEUINT8(p, (gt|0x80));
|
WRITEUINT8(p, (gt|0x80));
|
||||||
@@ -2598,14 +2604,18 @@ ConcatCommandArgv (int start, int end)
|
|||||||
size += strlen(COM_Argv(i)) + 1;
|
size += strlen(COM_Argv(i)) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
final = ZZ_Alloc(size);
|
p = final = ZZ_Alloc(size);
|
||||||
p = final;
|
|
||||||
|
if (!p)
|
||||||
|
I_Error("ConcatCommandArgv: Out of memory!\n");
|
||||||
|
|
||||||
--end;/* handle the final argument separately */
|
--end;/* handle the final argument separately */
|
||||||
|
|
||||||
for (i = start; i < end; ++i)
|
for (i = start; i < end; ++i)
|
||||||
{
|
{
|
||||||
p += sprintf(p, "%s ", COM_Argv(i));
|
p += sprintf(p, "%s ", COM_Argv(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* at this point "end" is actually the last argument's position */
|
/* at this point "end" is actually the last argument's position */
|
||||||
strcpy(p, COM_Argv(end));
|
strcpy(p, COM_Argv(end));
|
||||||
|
|
||||||
@@ -3184,20 +3194,20 @@ static void Command_Teamchange_f(void)
|
|||||||
|
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 1;
|
NetPacket.packet.newteam = 1;
|
||||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
|
||||||
NetPacket.packet.newteam = 2;
|
NetPacket.packet.newteam = 2;
|
||||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else if (G_GametypeHasSpectators())
|
else if (G_GametypeHasSpectators())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
|
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 3;
|
NetPacket.packet.newteam = 3;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
@@ -3274,20 +3284,20 @@ static void Command_Teamchange2_f(void)
|
|||||||
|
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 1;
|
NetPacket.packet.newteam = 1;
|
||||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
|
||||||
NetPacket.packet.newteam = 2;
|
NetPacket.packet.newteam = 2;
|
||||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else if (G_GametypeHasSpectators())
|
else if (G_GametypeHasSpectators())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
|
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 3;
|
NetPacket.packet.newteam = 3;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
@@ -3365,20 +3375,20 @@ static void Command_Teamchange3_f(void)
|
|||||||
|
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 1;
|
NetPacket.packet.newteam = 1;
|
||||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
|
||||||
NetPacket.packet.newteam = 2;
|
NetPacket.packet.newteam = 2;
|
||||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else if (G_GametypeHasSpectators())
|
else if (G_GametypeHasSpectators())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
|
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 3;
|
NetPacket.packet.newteam = 3;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
@@ -3456,20 +3466,20 @@ static void Command_Teamchange4_f(void)
|
|||||||
|
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 1;
|
NetPacket.packet.newteam = 1;
|
||||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
|
||||||
NetPacket.packet.newteam = 2;
|
NetPacket.packet.newteam = 2;
|
||||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else if (G_GametypeHasSpectators())
|
else if (G_GametypeHasSpectators())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
|
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
|
||||||
NetPacket.packet.newteam = 3;
|
NetPacket.packet.newteam = 3;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
@@ -3555,33 +3565,33 @@ static void Command_ServerTeamChange_f(void)
|
|||||||
|
|
||||||
if (G_TagGametype())
|
if (G_TagGametype())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(2), "it") || !strcasecmp(COM_Argv(2), "1"))
|
if (fasticmp(COM_Argv(2), "it") || fasticmp(COM_Argv(2), "1"))
|
||||||
NetPacket.packet.newteam = 1;
|
NetPacket.packet.newteam = 1;
|
||||||
else if (!strcasecmp(COM_Argv(2), "notit") || !strcasecmp(COM_Argv(2), "2"))
|
else if (fasticmp(COM_Argv(2), "notit") || fasticmp(COM_Argv(2), "2"))
|
||||||
NetPacket.packet.newteam = 2;
|
NetPacket.packet.newteam = 2;
|
||||||
else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "3"))
|
else if (fasticmp(COM_Argv(2), "playing") || fasticmp(COM_Argv(2), "3"))
|
||||||
NetPacket.packet.newteam = 3;
|
NetPacket.packet.newteam = 3;
|
||||||
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
|
else if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else if (G_GametypeHasTeams())
|
else if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(2), "red") || !strcasecmp(COM_Argv(2), "1"))
|
if (fasticmp(COM_Argv(2), "red") || fasticmp(COM_Argv(2), "1"))
|
||||||
NetPacket.packet.newteam = 1;
|
NetPacket.packet.newteam = 1;
|
||||||
else if (!strcasecmp(COM_Argv(2), "blue") || !strcasecmp(COM_Argv(2), "2"))
|
else if (fasticmp(COM_Argv(2), "blue") || fasticmp(COM_Argv(2), "2"))
|
||||||
NetPacket.packet.newteam = 2;
|
NetPacket.packet.newteam = 2;
|
||||||
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
|
else if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else if (G_GametypeHasSpectators())
|
else if (G_GametypeHasSpectators())
|
||||||
{
|
{
|
||||||
if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
|
if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
|
||||||
NetPacket.packet.newteam = 0;
|
NetPacket.packet.newteam = 0;
|
||||||
else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "1"))
|
else if (fasticmp(COM_Argv(2), "playing") || fasticmp(COM_Argv(2), "1"))
|
||||||
NetPacket.packet.newteam = 3;
|
NetPacket.packet.newteam = 3;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
@@ -4216,23 +4226,32 @@ static void Command_MotD_f(void)
|
|||||||
|
|
||||||
mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
|
mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
|
||||||
|
|
||||||
strlcpy(mymotd, COM_Argv(1), sizeof motd);
|
if (!mymotd)
|
||||||
|
return;
|
||||||
|
//I_Error("Command_MotD_f: Out of memory!\n"); // idk if this aint a bit too much lel
|
||||||
|
|
||||||
|
strlcpy(mymotd, COM_Argv(1), sizeof(motd));
|
||||||
|
|
||||||
for (i = 2; i < j; i++)
|
for (i = 2; i < j; i++)
|
||||||
{
|
{
|
||||||
strlcat(mymotd, " ", sizeof motd);
|
strlcat(mymotd, " ", sizeof(motd));
|
||||||
strlcat(mymotd, COM_Argv(i), sizeof motd);
|
strlcat(mymotd, COM_Argv(i), sizeof(motd));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallow non-printing characters and semicolons.
|
// Disallow non-printing characters and semicolons.
|
||||||
for (i = 0; mymotd[i] != '\0'; i++)
|
for (i = 0; mymotd[i] != '\0'; i++)
|
||||||
|
{
|
||||||
if (!isprint(mymotd[i]) || mymotd[i] == ';')
|
if (!isprint(mymotd[i]) || mymotd[i] == ';')
|
||||||
{
|
{
|
||||||
Z_Free(mymotd);
|
Z_Free(mymotd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((netgame || multiplayer) && client)
|
if ((netgame || multiplayer) && client)
|
||||||
|
{
|
||||||
SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size
|
SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(motd, mymotd);
|
strcpy(motd, mymotd);
|
||||||
@@ -4431,7 +4450,7 @@ static void Command_Addfile(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||||
if (!(netgame || multiplayer) || musiconly)
|
if (!netgame || musiconly)
|
||||||
{
|
{
|
||||||
P_AddWadFile(fn, false);
|
P_AddWadFile(fn, false);
|
||||||
return;
|
return;
|
||||||
@@ -4474,7 +4493,7 @@ static void Command_Addfile(void)
|
|||||||
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
|
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
|
||||||
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
|
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
|
||||||
else
|
else
|
||||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);;
|
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds something at runtime.
|
/** Adds something at runtime.
|
||||||
@@ -5190,14 +5209,14 @@ static void Ringslinger_OnChange(void)
|
|||||||
static void Gravity_OnChange(void)
|
static void Gravity_OnChange(void)
|
||||||
{
|
{
|
||||||
if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cv_debug
|
if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cv_debug
|
||||||
&& strcmp(cv_gravity.string, cv_gravity.defaultvalue))
|
&& !fastcmp(cv_gravity.string, cv_gravity.defaultvalue))
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("You haven't earned this yet.\n"));
|
CONS_Printf(M_GetText("You haven't earned this yet.\n"));
|
||||||
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
|
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifndef NETGAME_GRAVITY
|
#ifndef NETGAME_GRAVITY
|
||||||
if(netgame)
|
if (netgame)
|
||||||
{
|
{
|
||||||
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
|
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -209,6 +209,8 @@ extern consvar_t cv_betainterscreen;
|
|||||||
|
|
||||||
extern consvar_t cv_laglesscam;
|
extern consvar_t cv_laglesscam;
|
||||||
|
|
||||||
|
extern consvar_t cv_demoangturn;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SKINMENUTYPE_SCROLL = 0,
|
SKINMENUTYPE_SCROLL = 0,
|
||||||
|
|||||||
+17
-16
@@ -550,7 +550,8 @@ INT32 CL_CheckFiles(void)
|
|||||||
for (j = mainwads+1; j < numwadfiles; j++)
|
for (j = mainwads+1; j < numwadfiles; j++)
|
||||||
{
|
{
|
||||||
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
||||||
if (!stricmp(wadfilename, fileneeded[i].filename) &&
|
|
||||||
|
if (fasticmp(wadfilename, fileneeded[i].filename) &&
|
||||||
!memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
|
!memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_NETPLAY, "already loaded\n");
|
CONS_Debug(DBG_NETPLAY, "already loaded\n");
|
||||||
@@ -665,7 +666,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||||||
strlcpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH);
|
strlcpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH);
|
||||||
nameonly(wadfilename);
|
nameonly(wadfilename);
|
||||||
|
|
||||||
if (!stricmp(wadfilename, p->id.filename))
|
if (fasticmp(wadfilename, p->id.filename))
|
||||||
{
|
{
|
||||||
// Copy file name with full path
|
// Copy file name with full path
|
||||||
strlcpy(p->id.filename, wadfiles[wadnum]->filename, MAX_WADPATH);
|
strlcpy(p->id.filename, wadfiles[wadnum]->filename, MAX_WADPATH);
|
||||||
@@ -946,17 +947,17 @@ void Got_Filetxpak(void)
|
|||||||
char *filename = file->filename;
|
char *filename = file->filename;
|
||||||
static INT32 filetime = 0;
|
static INT32 filetime = 0;
|
||||||
|
|
||||||
if (!(strcmp(filename, "srb2.srb")
|
if ((fastcmp(filename, "srb2.srb")
|
||||||
//&& strcmp(filename, "srb2.wad")
|
//|| fastcmp(filename, "srb2.wad")
|
||||||
//&& strcmp(filename, "patch.dta")
|
//|| fastcmp(filename, "patch.dta")
|
||||||
//&& strcmp(filename, "music.dta")
|
//|| fastcmp(filename, "music.dta")
|
||||||
&& strcmp(filename, "gfx.kart")
|
|| fastcmp(filename, "gfx.kart")
|
||||||
&& strcmp(filename, "textures.kart")
|
|| fastcmp(filename, "textures.kart")
|
||||||
&& strcmp(filename, "chars.kart")
|
|| fastcmp(filename, "chars.kart")
|
||||||
&& strcmp(filename, "maps.kart")
|
|| fastcmp(filename, "maps.kart")
|
||||||
&& strcmp(filename, "sounds.kart")
|
|| fastcmp(filename, "sounds.kart")
|
||||||
&& strcmp(filename, "music.kart")
|
|| fastcmp(filename, "music.kart")
|
||||||
&& strcmp(filename, "patch.kart")
|
|| fastcmp(filename, "patch.kart")
|
||||||
))
|
))
|
||||||
I_Error("Tried to download \"%s\"", filename);
|
I_Error("Tried to download \"%s\"", filename);
|
||||||
|
|
||||||
@@ -1197,7 +1198,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// next, check SRB2's "home" directory (if non-'.')
|
// next, check SRB2's "home" directory (if non-'.')
|
||||||
if (strcmp(srb2home, "."))
|
if (!fastcmp(srb2home, "."))
|
||||||
{
|
{
|
||||||
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
|
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
|
||||||
|
|
||||||
@@ -1209,7 +1210,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
|||||||
}
|
}
|
||||||
|
|
||||||
// next, check SRB2's "path" directory (also if non-'.')
|
// next, check SRB2's "path" directory (also if non-'.')
|
||||||
if (strcmp(srb2path, "."))
|
if (!fastcmp(srb2path, "."))
|
||||||
{
|
{
|
||||||
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
|
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
|
||||||
|
|
||||||
@@ -1554,7 +1555,7 @@ CURLGetLogin (const char *url, HTTP_login ***return_prev_next)
|
|||||||
( login = (*prev_next));
|
( login = (*prev_next));
|
||||||
prev_next = &login->next
|
prev_next = &login->next
|
||||||
){
|
){
|
||||||
if (strcmp(login->url, url) == 0)
|
if (fastcmp(login->url, url) != 0)
|
||||||
{
|
{
|
||||||
if (return_prev_next)
|
if (return_prev_next)
|
||||||
(*return_prev_next) = prev_next;
|
(*return_prev_next) = prev_next;
|
||||||
|
|||||||
+2
-2
@@ -211,12 +211,12 @@ void D_SetupProtocol(void)
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if (strcmp(buffer, "no") == 0)
|
if (!fastcmp(buffer, "no"))
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (strcmp(buffer, exe_path) != 0)
|
else if (fastcmp(buffer, exe_path))
|
||||||
{
|
{
|
||||||
// overwrite
|
// overwrite
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|||||||
@@ -1442,7 +1442,7 @@ static INT32 errorcount = 0;
|
|||||||
*/
|
*/
|
||||||
static boolean shutdowning = false;
|
static boolean shutdowning = false;
|
||||||
|
|
||||||
void I_Error(const char *error, ...)
|
FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char buffer[8192];
|
char buffer[8192];
|
||||||
@@ -1468,7 +1468,7 @@ void I_Error(const char *error, ...)
|
|||||||
if (errorcount > 20)
|
if (errorcount > 20)
|
||||||
{
|
{
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(buffer, error, argptr);
|
vsnprintf(buffer, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
I_OutputMsg("SRB2Kart %s Recursive Error", buffer);
|
I_OutputMsg("SRB2Kart %s Recursive Error", buffer);
|
||||||
@@ -1482,7 +1482,7 @@ void I_Error(const char *error, ...)
|
|||||||
|
|
||||||
// Display error message in the console before we start shutting it down
|
// Display error message in the console before we start shutting it down
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(buffer, error, argptr);
|
vsnprintf(buffer, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
||||||
|
|
||||||
@@ -1709,9 +1709,9 @@ char *I_GetUserName(void)
|
|||||||
strncpy(username, p, MAXPLAYERNAME);
|
strncpy(username, p, MAXPLAYERNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fastcmp(username, ""))
|
||||||
if (strcmp(username, "") != 0)
|
|
||||||
return username;
|
return username;
|
||||||
|
|
||||||
return NULL; // dummy for platform independent version
|
return NULL; // dummy for platform independent version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+30
-4
@@ -49,6 +49,27 @@ discordRequest_t *discordRequestList = NULL;
|
|||||||
|
|
||||||
static char self_ip[IP_SIZE+1];
|
static char self_ip[IP_SIZE+1];
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
* const char *DRPC_HideUsername(const char *input)
|
||||||
|
*
|
||||||
|
* See header file for description.
|
||||||
|
* --------------------------------------------------*/
|
||||||
|
const char *DRPC_HideUsername(const char *input)
|
||||||
|
{
|
||||||
|
static char buffer[5];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
buffer[0] = input[0];
|
||||||
|
|
||||||
|
for (i = 1; i < 4; ++i)
|
||||||
|
{
|
||||||
|
buffer[i] = '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[4] = '\0';
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
boolean drpc_init = false;
|
boolean drpc_init = false;
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
@@ -105,7 +126,7 @@ static void DRPC_HandleReady(const DiscordUser *user)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Printf("Discord: connected to %s#%s (%s)\n", user->username, user->discriminator, user->userId);
|
CONS_Printf("Discord: connected to %s (%s)\n", user->username, user->userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,8 +262,10 @@ static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
|
|||||||
newRequest->username = Z_Calloc(344, PU_STATIC, NULL);
|
newRequest->username = Z_Calloc(344, PU_STATIC, NULL);
|
||||||
snprintf(newRequest->username, 344, "%s", requestUser->username);
|
snprintf(newRequest->username, 344, "%s", requestUser->username);
|
||||||
|
|
||||||
|
#if 0
|
||||||
newRequest->discriminator = Z_Calloc(8, PU_STATIC, NULL);
|
newRequest->discriminator = Z_Calloc(8, PU_STATIC, NULL);
|
||||||
snprintf(newRequest->discriminator, 8, "%s", requestUser->discriminator);
|
snprintf(newRequest->discriminator, 8, "%s", requestUser->discriminator);
|
||||||
|
#endif
|
||||||
|
|
||||||
newRequest->userID = Z_Calloc(32, PU_STATIC, NULL);
|
newRequest->userID = Z_Calloc(32, PU_STATIC, NULL);
|
||||||
snprintf(newRequest->userID, 32, "%s", requestUser->userId);
|
snprintf(newRequest->userID, 32, "%s", requestUser->userId);
|
||||||
@@ -254,7 +277,7 @@ static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
|
|||||||
while (append != NULL)
|
while (append != NULL)
|
||||||
{
|
{
|
||||||
// CHECK FOR DUPES!! Ignore any that already exist from the same user.
|
// CHECK FOR DUPES!! Ignore any that already exist from the same user.
|
||||||
if (!strcmp(newRequest->userID, append->userID))
|
if (fastcmp(newRequest->userID, append->userID))
|
||||||
{
|
{
|
||||||
Discord_Respond(newRequest->userID, DISCORD_REPLY_IGNORE);
|
Discord_Respond(newRequest->userID, DISCORD_REPLY_IGNORE);
|
||||||
DRPC_RemoveRequest(newRequest);
|
DRPC_RemoveRequest(newRequest);
|
||||||
@@ -308,6 +331,9 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(removeRequest->username);
|
Z_Free(removeRequest->username);
|
||||||
|
#if 0
|
||||||
|
Z_Free(removeRequest->discriminator);
|
||||||
|
#endif
|
||||||
Z_Free(removeRequest->userID);
|
Z_Free(removeRequest->userID);
|
||||||
Z_Free(removeRequest);
|
Z_Free(removeRequest);
|
||||||
}
|
}
|
||||||
@@ -393,7 +419,7 @@ static const char *DRPC_GetServerIP(void)
|
|||||||
// If you're connected
|
// If you're connected
|
||||||
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
|
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
|
||||||
{
|
{
|
||||||
if (strcmp(address, "self"))
|
if (!fastcmp(address, "self"))
|
||||||
{
|
{
|
||||||
// We're not the server, so we could successfully get the IP!
|
// We're not the server, so we could successfully get the IP!
|
||||||
// No need to do anything else :)
|
// No need to do anything else :)
|
||||||
@@ -658,7 +684,7 @@ void DRPC_UpdatePresence(void)
|
|||||||
// Character image
|
// Character image
|
||||||
while (supportedSkins[checkSkin] != NULL)
|
while (supportedSkins[checkSkin] != NULL)
|
||||||
{
|
{
|
||||||
if (!strcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin]))
|
if (fastcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin]))
|
||||||
{
|
{
|
||||||
snprintf(charimg, 21, "char%s", supportedSkins[checkSkin]);
|
snprintf(charimg, 21, "char%s", supportedSkins[checkSkin]);
|
||||||
discordPresence.smallImageKey = charimg;
|
discordPresence.smallImageKey = charimg;
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ extern struct discordInfo_s {
|
|||||||
|
|
||||||
typedef struct discordRequest_s {
|
typedef struct discordRequest_s {
|
||||||
char *username; // Discord user name.
|
char *username; // Discord user name.
|
||||||
|
#if 0 // Good night, sweet prince...
|
||||||
char *discriminator; // Discord discriminator (The little hashtag thing after the username). Separated for a "hide discriminators" cvar.
|
char *discriminator; // Discord discriminator (The little hashtag thing after the username). Separated for a "hide discriminators" cvar.
|
||||||
|
#endif
|
||||||
char *userID; // The ID of the Discord user, gets used with Discord_Respond()
|
char *userID; // The ID of the Discord user, gets used with Discord_Respond()
|
||||||
|
|
||||||
// HAHAHA, no.
|
// HAHAHA, no.
|
||||||
@@ -44,6 +46,15 @@ typedef struct discordRequest_s {
|
|||||||
|
|
||||||
extern discordRequest_t *discordRequestList;
|
extern discordRequest_t *discordRequestList;
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
* const char *DRPC_HideUsername(const char *input);
|
||||||
|
*
|
||||||
|
* Handle usernames while cv_discordstreamer is activated.
|
||||||
|
* (The loss of discriminators is still a dumbass regression
|
||||||
|
* that I will never forgive the Discord developers for.)
|
||||||
|
* --------------------------------------------------*/
|
||||||
|
|
||||||
|
const char *DRPC_HideUsername(const char *input);
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
void DRPC_RemoveRequest(void);
|
void DRPC_RemoveRequest(void);
|
||||||
|
|||||||
+4
-6
@@ -69,6 +69,8 @@ extern "C" {
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "fastcmp.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -90,12 +92,6 @@ extern FILE *logstream;
|
|||||||
extern char logfilename[1024];
|
extern char logfilename[1024];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// not sure if this belongs here lul
|
|
||||||
// TODO: figure out whats preventing 32bit windows from working with libbacktrace
|
|
||||||
#if defined(_WIN32) && !defined(__MINGW64__)
|
|
||||||
#define HAVE_DRMINGW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (HAVE_LIBBACKTRACE)
|
#if defined (HAVE_LIBBACKTRACE)
|
||||||
#define CRASH_LOGFILE_NAME "srb2kart-crash-log.txt"
|
#define CRASH_LOGFILE_NAME "srb2kart-crash-log.txt"
|
||||||
#elif defined (HAVE_DRMINGW)
|
#elif defined (HAVE_DRMINGW)
|
||||||
@@ -657,7 +653,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||||||
|
|
||||||
#if defined (HAVE_CURL)
|
#if defined (HAVE_CURL)
|
||||||
#define MASTERSERVER
|
#define MASTERSERVER
|
||||||
|
#ifndef NOHOLEPUNCH
|
||||||
#define HOLEPUNCH
|
#define HOLEPUNCH
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#undef UPDATE_ALERT
|
#undef UPDATE_ALERT
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -116,7 +116,10 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
|
|||||||
extern boolean nodrawers;
|
extern boolean nodrawers;
|
||||||
extern boolean noblit;
|
extern boolean noblit;
|
||||||
extern boolean lastdraw;
|
extern boolean lastdraw;
|
||||||
|
|
||||||
|
#ifdef MOTIONBLUR
|
||||||
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||||
|
#endif
|
||||||
|
|
||||||
extern INT32 viewwindowx, viewwindowy;
|
extern INT32 viewwindowx, viewwindowy;
|
||||||
extern INT32 viewwidth;
|
extern INT32 viewwidth;
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ extern "C" {
|
|||||||
#define UINT64 uint64_t
|
#define UINT64 uint64_t
|
||||||
|
|
||||||
#ifdef __APPLE_CC__
|
#ifdef __APPLE_CC__
|
||||||
#define DIRECTFULLSCREEN 1
|
|
||||||
#define DEBUG_LOG
|
#define DEBUG_LOG
|
||||||
#define NOIPX
|
#define NOIPX
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -963,6 +963,7 @@ void F_StartTitleScreen(void)
|
|||||||
finalecount = 0;
|
finalecount = 0;
|
||||||
else
|
else
|
||||||
wipegamestate = GS_TITLESCREEN;
|
wipegamestate = GS_TITLESCREEN;
|
||||||
|
|
||||||
G_SetGamestate(GS_TITLESCREEN);
|
G_SetGamestate(GS_TITLESCREEN);
|
||||||
CON_ClearHUD();
|
CON_ClearHUD();
|
||||||
|
|
||||||
|
|||||||
+14
-14
@@ -44,7 +44,7 @@ consvar_t cv_addons_search_case = {"addons_search_case", "No", CV_SAVE, CV_YesNo
|
|||||||
static CV_PossibleValue_t addons_search_type_cons_t[] = {{0, "Start"}, {1, "Anywhere"}, {0, NULL}};
|
static CV_PossibleValue_t addons_search_type_cons_t[] = {{0, "Start"}, {1, "Anywhere"}, {0, NULL}};
|
||||||
consvar_t cv_addons_search_type = {"addons_search_type", "Anywhere", CV_SAVE, addons_search_type_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_addons_search_type = {"addons_search_type", "Anywhere", CV_SAVE, addons_search_type_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
char menupath[1024];
|
char menupath[MAXFILEPATH];
|
||||||
size_t menupathindex[menudepth];
|
size_t menupathindex[menudepth];
|
||||||
size_t menudepthleft = menudepth;
|
size_t menudepthleft = menudepth;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
int found = 0;
|
int found = 0;
|
||||||
char *searchname;
|
char *searchname;
|
||||||
int depthleft = maxsearchdepth;
|
int depthleft = maxsearchdepth;
|
||||||
char searchpath[1024];
|
char searchpath[MAXFILEPATH];
|
||||||
size_t *searchpathindex;
|
size_t *searchpathindex;
|
||||||
|
|
||||||
dirhandle = (DIR**)malloc(maxsearchdepth * sizeof(DIR*));
|
dirhandle = (DIR**)malloc(maxsearchdepth * sizeof(DIR*));
|
||||||
@@ -198,7 +198,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
|
|
||||||
for (; *path != NULL; path++)
|
for (; *path != NULL; path++)
|
||||||
{
|
{
|
||||||
if (strcasecmp(*path, dent->d_name) == 0)
|
if (fasticmp(*path, dent->d_name))
|
||||||
{
|
{
|
||||||
skipfolder = true;
|
skipfolder = true;
|
||||||
break;
|
break;
|
||||||
@@ -212,7 +212,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcasecmp(".git", dent->d_name) // sanity if you're weird like me
|
if (!fasticmp(".git", dent->d_name) // sanity if you're weird like me
|
||||||
&& (dirhandle[depthleft-1] = opendir(searchpath)) != NULL)
|
&& (dirhandle[depthleft-1] = opendir(searchpath)) != NULL)
|
||||||
{
|
{
|
||||||
// Got read permissions!
|
// Got read permissions!
|
||||||
@@ -227,7 +227,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
|
|
||||||
// I am a file!
|
// I am a file!
|
||||||
|
|
||||||
if (strcasecmp(searchname, dent->d_name))
|
if (!fasticmp(searchname, dent->d_name))
|
||||||
continue; // Not what we're looking for!
|
continue; // Not what we're looking for!
|
||||||
|
|
||||||
switch (checkfilemd5(searchpath, wantedmd5sum))
|
switch (checkfilemd5(searchpath, wantedmd5sum))
|
||||||
@@ -353,7 +353,7 @@ void searchfilemenu(char *tempname)
|
|||||||
{
|
{
|
||||||
for (i = first; i < sizedirmenu; i++)
|
for (i = first; i < sizedirmenu; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp(dirmenu[i]+DIR_STRING, tempname))
|
if (fastcmp(dirmenu[i]+DIR_STRING, tempname))
|
||||||
{
|
{
|
||||||
dir_on[menudepthleft] = i;
|
dir_on[menudepthleft] = i;
|
||||||
break;
|
break;
|
||||||
@@ -400,7 +400,7 @@ void searchfilemenu(char *tempname)
|
|||||||
{
|
{
|
||||||
if (filemenucmp(coredirmenu[i]+DIR_STRING, localmenusearch))
|
if (filemenucmp(coredirmenu[i]+DIR_STRING, localmenusearch))
|
||||||
{
|
{
|
||||||
if (tempname && !strcmp(coredirmenu[i]+DIR_STRING, tempname))
|
if (tempname && fastcmp(coredirmenu[i]+DIR_STRING, tempname))
|
||||||
{
|
{
|
||||||
dir_on[menudepthleft] = sizedirmenu;
|
dir_on[menudepthleft] = sizedirmenu;
|
||||||
Z_Free(tempname);
|
Z_Free(tempname);
|
||||||
@@ -478,14 +478,14 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
|
|
||||||
if (replayhut)
|
if (replayhut)
|
||||||
{
|
{
|
||||||
if (strcasecmp(".lmp", dent->d_name+len-5))
|
if (!fasticmp(".lmp", dent->d_name+len-5))
|
||||||
continue; // Not a replay
|
continue; // Not a replay
|
||||||
}
|
}
|
||||||
else if (!cv_addons_showall.value)
|
else if (!cv_addons_showall.value)
|
||||||
{
|
{
|
||||||
UINT8 ext;
|
UINT8 ext;
|
||||||
for (ext = 0; ext < NUM_EXT_TABLE; ext++)
|
for (ext = 0; ext < NUM_EXT_TABLE; ext++)
|
||||||
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
|
if (fasticmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
|
||||||
break; // extension comparison
|
break; // extension comparison
|
||||||
|
|
||||||
if (ext == NUM_EXT_TABLE)
|
if (ext == NUM_EXT_TABLE)
|
||||||
@@ -559,7 +559,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
|
|
||||||
if (replayhut)
|
if (replayhut)
|
||||||
{
|
{
|
||||||
if (strcasecmp(".lmp", dent->d_name+len-5))
|
if (!fasticmp(".lmp", dent->d_name+len-5))
|
||||||
continue; // Not a replay
|
continue; // Not a replay
|
||||||
|
|
||||||
ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this...
|
ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this...
|
||||||
@@ -567,7 +567,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (; ext < NUM_EXT_TABLE; ext++)
|
for (; ext < NUM_EXT_TABLE; ext++)
|
||||||
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
|
if (fasticmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
|
||||||
break; // extension comparison
|
break; // extension comparison
|
||||||
|
|
||||||
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value)
|
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value)
|
||||||
@@ -587,7 +587,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
nameonly(filenamebuf[i]);
|
nameonly(filenamebuf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(dent->d_name, filenamebuf[i]))
|
if (!fastcmp(dent->d_name, filenamebuf[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
|
if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
|
||||||
@@ -598,11 +598,11 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
}
|
}
|
||||||
else if (ext == EXT_TXT)
|
else if (ext == EXT_TXT)
|
||||||
{
|
{
|
||||||
if (!strncmp(dent->d_name, "log-", 4) || !strcmp(dent->d_name, "errorlog.txt"))
|
if (!strncmp(dent->d_name, "log-", 4) || fastcmp(dent->d_name, "errorlog.txt"))
|
||||||
ext |= EXT_LOADED;
|
ext |= EXT_LOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(dent->d_name, configfile))
|
if (fastcmp(dent->d_name, configfile))
|
||||||
ext |= EXT_LOADED;
|
ext |= EXT_LOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -34,7 +34,8 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
|
|
||||||
#define menudepth 20
|
#define menudepth 20
|
||||||
|
|
||||||
extern char menupath[1024];
|
#define MAXFILEPATH 1024
|
||||||
|
extern char menupath[MAXFILEPATH];
|
||||||
extern size_t menupathindex[menudepth];
|
extern size_t menupathindex[menudepth];
|
||||||
extern size_t menudepthleft;
|
extern size_t menudepthleft;
|
||||||
|
|
||||||
|
|||||||
+413
-333
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -67,7 +67,7 @@ typedef enum {
|
|||||||
} menudemotype_e;
|
} menudemotype_e;
|
||||||
|
|
||||||
typedef struct menudemo_s {
|
typedef struct menudemo_s {
|
||||||
char filepath[256];
|
char filepath[1023 + 256]; // see M_PrepReplayList and sizeof menupath
|
||||||
menudemotype_e type;
|
menudemotype_e type;
|
||||||
|
|
||||||
char title[65]; // Null-terminated for string prints
|
char title[65]; // Null-terminated for string prints
|
||||||
|
|||||||
+35
-21
@@ -452,6 +452,13 @@ consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS] = {
|
|||||||
{"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
{"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS] = {
|
||||||
|
{"litesteer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
|
{"litesteer2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
|
{"litesteer3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
|
{"litesteer4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
@@ -1014,8 +1021,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||||||
else
|
else
|
||||||
th = 0;
|
th = 0;
|
||||||
|
|
||||||
if (th < SLOWTURNTICS)
|
if (th < (cv_turnsmooth[forplayer].value * 3))
|
||||||
tspeed = cv_turnsmooth.value == 2 ? 2 : 0; // slow turn
|
tspeed = cv_turnsmooth[forplayer].value == 2 ? 2 : 0; // slow turn
|
||||||
else
|
else
|
||||||
tspeed = 1;
|
tspeed = 1;
|
||||||
|
|
||||||
@@ -1024,30 +1031,32 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||||||
// let movement keys cancel each other out
|
// let movement keys cancel each other out
|
||||||
if (turnright && !(turnleft))
|
if (turnright && !(turnleft))
|
||||||
{
|
{
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed]));
|
cmd->angleturn -= angleturn[tspeed];
|
||||||
cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[tspeed]));
|
|
||||||
side += sidemove[1];
|
side += sidemove[1];
|
||||||
}
|
}
|
||||||
else if (turnleft && !(turnright))
|
else if (turnleft && !(turnright))
|
||||||
{
|
{
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed]));
|
cmd->angleturn += angleturn[tspeed];
|
||||||
cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[tspeed]));
|
|
||||||
side -= sidemove[1];
|
side -= sidemove[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && axis != 0)
|
||||||
{
|
{
|
||||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
cmd->angleturn -= (axis * KART_FULLTURN) / JOYAXISRANGE;
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10))); // ANALOG!
|
side += (axis * sidemove[0]) / JOYAXISRANGE;
|
||||||
cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10)));
|
|
||||||
side += ((axis * sidemove[0]) >> 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_mouseturn.value)
|
if (cv_mouseturn.value)
|
||||||
{
|
{
|
||||||
//THIS WORKS WTF????????
|
//THIS WORKS WTF????????
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
cmd->angleturn -= (mousex*(encoremode ? -1 : 1)*8);
|
||||||
cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
}
|
||||||
|
|
||||||
|
// Digital users can input diagonal-back for shallow turns.
|
||||||
|
if (cv_litesteer[forplayer].value && InputDown(gc_aimbackward, ssplayer)
|
||||||
|
&& abs(cmd->angleturn) == KART_FULLTURN) // My keyboard hits 1024 but my keyboard only hits 1023, video games
|
||||||
|
{
|
||||||
|
cmd->angleturn /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectplacing) // SRB2Kart: spectators need special controls // not anymore huehuehue
|
if (objectplacing) // SRB2Kart: spectators need special controls // not anymore huehuehue
|
||||||
@@ -1160,10 +1169,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||||||
else if (cmd->angleturn < (-angleturn[1]))
|
else if (cmd->angleturn < (-angleturn[1]))
|
||||||
cmd->angleturn = (-angleturn[1]);
|
cmd->angleturn = (-angleturn[1]);
|
||||||
|
|
||||||
if (cmd->driftturn > (angleturn[1]))
|
// until here both are the very same
|
||||||
cmd->driftturn = (angleturn[1]);
|
cmd->driftturn = cmd->angleturn;
|
||||||
else if (cmd->driftturn < (-angleturn[1]))
|
|
||||||
cmd->driftturn = (-angleturn[1]);
|
|
||||||
|
|
||||||
if (player->mo)
|
if (player->mo)
|
||||||
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
|
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
|
||||||
@@ -2761,7 +2768,7 @@ INT32 G_GetGametypeByName(const char *gametypestr)
|
|||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
for (i = 0; i < NUMGAMETYPES; i++)
|
for (i = 0; i < NUMGAMETYPES; i++)
|
||||||
if (!stricmp(gametypestr, Gametype_Names[i]))
|
if (fasticmp(gametypestr, Gametype_Names[i]))
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return -1; // unknown gametype
|
return -1; // unknown gametype
|
||||||
@@ -3456,7 +3463,8 @@ void G_LoadGameData(void)
|
|||||||
if (READUINT32(save.p) != 0xFCAFE211)
|
if (READUINT32(save.p) != 0xFCAFE211)
|
||||||
{
|
{
|
||||||
const char *gdfolder = "the SRB2Kart folder";
|
const char *gdfolder = "the SRB2Kart folder";
|
||||||
if (strcmp(srb2home,"."))
|
|
||||||
|
if (!fastcmp(srb2home,"."))
|
||||||
gdfolder = srb2home;
|
gdfolder = srb2home;
|
||||||
|
|
||||||
Z_Free(save.buffer);
|
Z_Free(save.buffer);
|
||||||
@@ -3540,7 +3548,8 @@ void G_LoadGameData(void)
|
|||||||
datacorrupt:
|
datacorrupt:
|
||||||
{
|
{
|
||||||
const char *gdfolder = "the SRB2Kart folder";
|
const char *gdfolder = "the SRB2Kart folder";
|
||||||
if (strcmp(srb2home,"."))
|
|
||||||
|
if (!fastcmp(srb2home,"."))
|
||||||
gdfolder = srb2home;
|
gdfolder = srb2home;
|
||||||
|
|
||||||
Z_Free(save.buffer);
|
Z_Free(save.buffer);
|
||||||
@@ -3751,7 +3760,8 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
|
|||||||
|
|
||||||
memset(vcheck, 0, sizeof (vcheck));
|
memset(vcheck, 0, sizeof (vcheck));
|
||||||
sprintf(vcheck, "version %d", VERSION);
|
sprintf(vcheck, "version %d", VERSION);
|
||||||
if (strcmp((const char *)save.p, (const char *)vcheck))
|
|
||||||
|
if (!fastcmp((const char *)save.p, (const char *)vcheck))
|
||||||
{
|
{
|
||||||
#ifdef SAVEGAME_OTHERVERSIONS
|
#ifdef SAVEGAME_OTHERVERSIONS
|
||||||
M_StartMessage(M_GetText("Save game from different version.\nYou can load this savegame, but\nsaving afterwards will be disabled.\n\nDo you want to continue anyway?\n\n(Press 'Y' to confirm)\n"),
|
M_StartMessage(M_GetText("Save game from different version.\nYou can load this savegame, but\nsaving afterwards will be disabled.\n\nDo you want to continue anyway?\n\n(Press 'Y' to confirm)\n"),
|
||||||
@@ -4029,7 +4039,7 @@ char *G_BuildMapTitle(INT32 mapnum)
|
|||||||
if (!mapheaderinfo[mapnum-1])
|
if (!mapheaderinfo[mapnum-1])
|
||||||
P_AllocMapHeader(mapnum-1);
|
P_AllocMapHeader(mapnum-1);
|
||||||
|
|
||||||
if (strcmp(mapheaderinfo[mapnum-1]->lvlttl, ""))
|
if (!fastcmp(mapheaderinfo[mapnum-1]->lvlttl, ""))
|
||||||
{
|
{
|
||||||
size_t len = 1;
|
size_t len = 1;
|
||||||
const char *zonetext = NULL;
|
const char *zonetext = NULL;
|
||||||
@@ -4054,7 +4064,11 @@ char *G_BuildMapTitle(INT32 mapnum)
|
|||||||
|
|
||||||
title = Z_Malloc(len, PU_STATIC, NULL);
|
title = Z_Malloc(len, PU_STATIC, NULL);
|
||||||
|
|
||||||
|
if (!title)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl);
|
sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl);
|
||||||
|
|
||||||
if (zonetext) sprintf(title + strlen(title), " %s", zonetext);
|
if (zonetext) sprintf(title + strlen(title), " %s", zonetext);
|
||||||
if (actnum) sprintf(title + strlen(title), " %s", actnum);
|
if (actnum) sprintf(title + strlen(title), " %s", actnum);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -72,6 +72,8 @@ extern consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS];
|
|||||||
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
|
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
|
||||||
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
|
extern consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||||
|
|
||||||
// Hud offsets
|
// Hud offsets
|
||||||
@@ -153,7 +155,6 @@ typedef enum
|
|||||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||||
#define KB_LOOKSPEED (1<<25)
|
#define KB_LOOKSPEED (1<<25)
|
||||||
#define MAXPLMOVE (50)
|
#define MAXPLMOVE (50)
|
||||||
#define SLOWTURNTICS (cv_turnsmooth.value * 3)
|
|
||||||
|
|
||||||
// build an internal map name MAPxx from map number
|
// build an internal map name MAPxx from map number
|
||||||
const char *G_BuildMapName(INT32 map);
|
const char *G_BuildMapName(INT32 map);
|
||||||
|
|||||||
+11
-4
@@ -37,7 +37,13 @@ static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "
|
|||||||
consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_turnsmooth = {"turnsmoothing", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS] = {
|
||||||
|
{"turnsmoothing", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
|
{"turnsmoothing2", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
|
{"turnsmoothing3", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||||
|
{"turnsmoothing4", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
static void G_ResetPlayerDeviceRumble(INT32 player);
|
static void G_ResetPlayerDeviceRumble(INT32 player);
|
||||||
static void rumble_off_handle(void);
|
static void rumble_off_handle(void);
|
||||||
@@ -1027,7 +1033,7 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
|||||||
return atoi(&keystr[3]);
|
return atoi(&keystr[3]);
|
||||||
|
|
||||||
for (j = 0; j < NUMKEYNAMES; j++)
|
for (j = 0; j < NUMKEYNAMES; j++)
|
||||||
if (!stricmp(keynames[j].name, keystr))
|
if (fasticmp(keynames[j].name, keystr))
|
||||||
return keynames[j].keynum;
|
return keynames[j].keynum;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1327,14 +1333,15 @@ static void setcontrol(INT32 (*gc)[2])
|
|||||||
player = 0;
|
player = 0;
|
||||||
|
|
||||||
namectrl = COM_Argv(1);
|
namectrl = COM_Argv(1);
|
||||||
for (numctrl = 0; numctrl < num_gamecontrols && stricmp(namectrl, gamecontrolname[numctrl]);
|
for (numctrl = 0; numctrl < num_gamecontrols && !fasticmp(namectrl, gamecontrolname[numctrl]); numctrl++)
|
||||||
numctrl++)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
if (numctrl == num_gamecontrols)
|
if (numctrl == num_gamecontrols)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Control '%s' unknown\n"), namectrl);
|
CONS_Printf(M_GetText("Control '%s' unknown\n"), namectrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
keynum1 = G_KeyStringtoNum(COM_Argv(2));
|
keynum1 = G_KeyStringtoNum(COM_Argv(2));
|
||||||
keynum2 = G_KeyStringtoNum(COM_Argv(3));
|
keynum2 = G_KeyStringtoNum(COM_Argv(3));
|
||||||
keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride);
|
keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride);
|
||||||
|
|||||||
+2
-1
@@ -110,7 +110,8 @@ typedef enum
|
|||||||
|
|
||||||
// mouse values are used once
|
// mouse values are used once
|
||||||
extern consvar_t cv_mousesens, cv_mouseysens;
|
extern consvar_t cv_mousesens, cv_mouseysens;
|
||||||
extern consvar_t cv_controlperkey, cv_turnsmooth;
|
extern consvar_t cv_controlperkey;
|
||||||
|
extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS];
|
||||||
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
||||||
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
|
|||||||
+26
-21
@@ -437,8 +437,16 @@ void HWR_MakePatch(const patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipma
|
|||||||
// CACHING HANDLING
|
// CACHING HANDLING
|
||||||
// =================================================
|
// =================================================
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GLMapTexture_t normal;
|
||||||
|
#ifdef GLENCORE
|
||||||
|
GLMapTexture_t encore;
|
||||||
|
#endif
|
||||||
|
} GLMapTextureSet_t; // idk i suck at naming things
|
||||||
|
|
||||||
static size_t gl_numtextures = 0; // Texture count
|
static size_t gl_numtextures = 0; // Texture count
|
||||||
static GLMapTexture_t *gl_textures; // For all textures
|
static GLMapTextureSet_t *gl_textures; // For all textures
|
||||||
|
|
||||||
static void HWR_FreeTextureData(patch_t *patch)
|
static void HWR_FreeTextureData(patch_t *patch)
|
||||||
{
|
{
|
||||||
@@ -578,13 +586,12 @@ void HWR_FreeMapTextures(void)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
#ifdef GLENCORE
|
|
||||||
for (i = 0; i < gl_numtextures*2; i++)
|
|
||||||
#else
|
|
||||||
for (i = 0; i < gl_numtextures; i++)
|
for (i = 0; i < gl_numtextures; i++)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
FreeMapTexture(&gl_textures[i]);
|
FreeMapTexture(&gl_textures[i].normal);
|
||||||
|
#ifdef GLENCORE
|
||||||
|
FreeMapTexture(&gl_textures[i].encore);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// now the heap don't have any 'user' pointing to our
|
// now the heap don't have any 'user' pointing to our
|
||||||
@@ -603,7 +610,7 @@ static void HWR_PrecacheLevelFlats(void)
|
|||||||
|
|
||||||
// special case for encore
|
// special case for encore
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremode)
|
if (encoremap)
|
||||||
{
|
{
|
||||||
// go through all sectors to determine if it should be remapped for encore
|
// go through all sectors to determine if it should be remapped for encore
|
||||||
for (i = 0; i < numsectors; i++)
|
for (i = 0; i < numsectors; i++)
|
||||||
@@ -678,8 +685,6 @@ static void HWR_PrecacheLevelTextures(void)
|
|||||||
const line_t *line = &lines[i];
|
const line_t *line = &lines[i];
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1);
|
const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1);
|
||||||
#else
|
|
||||||
const int noencoremap = 1;
|
|
||||||
#endif
|
#endif
|
||||||
// two sides
|
// two sides
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
@@ -695,11 +700,14 @@ static void HWR_PrecacheLevelTextures(void)
|
|||||||
for (f = 0; f < 3; f++)
|
for (f = 0; f < 3; f++)
|
||||||
{
|
{
|
||||||
const INT32 texnum = sidetex[f];
|
const INT32 texnum = sidetex[f];
|
||||||
|
|
||||||
if (texnum < 0 || texnum >= numtextures || texturepresent[texnum])
|
if (texnum < 0 || texnum >= numtextures || texturepresent[texnum])
|
||||||
continue;
|
continue;
|
||||||
|
#ifdef GLENCORE
|
||||||
texturepresent[texnum] = 1|noencoremap;
|
texturepresent[texnum] = 1|noencoremap;
|
||||||
|
#else
|
||||||
|
texturepresent[texnum] = 1;
|
||||||
|
#endif
|
||||||
HWR_GetTexture(texnum, false);
|
HWR_GetTexture(texnum, false);
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (noencoremap & 2)
|
if (noencoremap & 2)
|
||||||
@@ -737,7 +745,7 @@ static void HWR_PrecacheLevelTextures(void)
|
|||||||
free(texturepresent);
|
free(texturepresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HWR_PrecacheLevelSprites(void)
|
/*static void HWR_PrecacheLevelSprites(void)
|
||||||
{
|
{
|
||||||
patch_t *spritepatch;
|
patch_t *spritepatch;
|
||||||
char *spritepresent;
|
char *spritepresent;
|
||||||
@@ -800,11 +808,11 @@ static void HWR_PrecacheLevelSprites(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(spritepresent);
|
free(spritepresent);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void HWR_PrecacheLevel(void)
|
void HWR_PrecacheLevel(void)
|
||||||
{
|
{
|
||||||
if (rendermode != render_opengl)
|
if (gamestate != GS_LEVEL || !cv_precachetextures.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Precache flats.
|
// Precache flats.
|
||||||
@@ -814,7 +822,7 @@ void HWR_PrecacheLevel(void)
|
|||||||
HWR_PrecacheLevelTextures();
|
HWR_PrecacheLevelTextures();
|
||||||
|
|
||||||
// Precache sprites.
|
// Precache sprites.
|
||||||
HWR_PrecacheLevelSprites();
|
//HWR_PrecacheLevelSprites();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HWR_LoadMapTextures(size_t pnumtextures)
|
void HWR_LoadMapTextures(size_t pnumtextures)
|
||||||
@@ -823,11 +831,8 @@ void HWR_LoadMapTextures(size_t pnumtextures)
|
|||||||
HWR_FreeMapTextures();
|
HWR_FreeMapTextures();
|
||||||
|
|
||||||
gl_numtextures = pnumtextures;
|
gl_numtextures = pnumtextures;
|
||||||
#ifdef GLENCORE
|
gl_textures = calloc(gl_numtextures, sizeof(*gl_textures)); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore), see: GLMapTextureSet_t
|
||||||
gl_textures = calloc(gl_numtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
|
|
||||||
#else
|
|
||||||
gl_textures = calloc(gl_numtextures, sizeof (*gl_textures));
|
|
||||||
#endif
|
|
||||||
if (gl_textures == NULL)
|
if (gl_textures == NULL)
|
||||||
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures. Sad!");
|
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures. Sad!");
|
||||||
}
|
}
|
||||||
@@ -851,7 +856,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
|||||||
// Every texture in memory, stored in the
|
// Every texture in memory, stored in the
|
||||||
// hardware renderer's bit depth format. Wow!
|
// hardware renderer's bit depth format. Wow!
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
|
gltex = (encoremap && !noencore) ? &gl_textures[tex].encore : &gl_textures[tex].normal;
|
||||||
#else
|
#else
|
||||||
gltex = &gl_textures[tex];
|
gltex = &gl_textures[tex];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+30
-223
@@ -31,11 +31,6 @@
|
|||||||
#include "../st_stuff.h"
|
#include "../st_stuff.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "../i_video.h" // for rendermode != render_glide
|
|
||||||
|
|
||||||
#ifndef O_BINARY
|
|
||||||
#define O_BINARY 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -51,75 +46,13 @@ typedef struct
|
|||||||
UINT8 image_descriptor; //18
|
UINT8 image_descriptor; //18
|
||||||
} ATTRPACK TGAHeader; // sizeof is 18
|
} ATTRPACK TGAHeader; // sizeof is 18
|
||||||
|
|
||||||
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
static const UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||||
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
static const UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||||
static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
|
static const UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
|
||||||
|
|
||||||
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
|
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
|
||||||
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
|
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
|
||||||
|
|
||||||
//
|
|
||||||
// -----------------+
|
|
||||||
// HWR_DrawPatch : Draw a 'tile' graphic
|
|
||||||
// Notes : x,y : positions relative to the original Doom resolution
|
|
||||||
// : textes(console+score) + menus + status bar
|
|
||||||
// -----------------+
|
|
||||||
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|
||||||
{
|
|
||||||
FOutVector v[4];
|
|
||||||
FBITFIELD flags;
|
|
||||||
GLPatch_t *hwrPatch;
|
|
||||||
|
|
||||||
// 3--2
|
|
||||||
// | /|
|
|
||||||
// |/ |
|
|
||||||
// 0--1
|
|
||||||
float sdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
|
|
||||||
float pdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
|
|
||||||
|
|
||||||
// make patch ready in hardware cache
|
|
||||||
HWR_GetPatch(gpatch);
|
|
||||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
|
||||||
|
|
||||||
switch (option & V_SCALEPATCHMASK)
|
|
||||||
{
|
|
||||||
case V_NOSCALEPATCH:
|
|
||||||
pdup = 2.0f;
|
|
||||||
break;
|
|
||||||
case V_SMALLSCALEPATCH:
|
|
||||||
pdup = 2.0f * FIXED_TO_FLOAT(vid.smalldup*FRACUNIT);
|
|
||||||
break;
|
|
||||||
case V_MEDSCALEPATCH:
|
|
||||||
pdup = 2.0f * FIXED_TO_FLOAT(vid.meddup*FRACUNIT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option & V_NOSCALESTART)
|
|
||||||
sdup = 2.0f;
|
|
||||||
|
|
||||||
v[0].x = v[3].x = (x*sdup-gpatch->leftoffset*pdup)/vid.width - 1;
|
|
||||||
v[2].x = v[1].x = (x*sdup+(gpatch->width - gpatch->leftoffset)*pdup)/vid.width - 1;
|
|
||||||
v[0].y = v[1].y = 1-(y*sdup-gpatch->topoffset*pdup)/vid.height;
|
|
||||||
v[2].y = v[3].y = 1-(y*sdup+(gpatch->height - gpatch->topoffset)*pdup)/vid.height;
|
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
|
||||||
|
|
||||||
v[0].s = v[3].s = 0.0f;
|
|
||||||
v[2].s = v[1].s = hwrPatch->max_s;
|
|
||||||
v[0].t = v[1].t = 0.0f;
|
|
||||||
v[2].t = v[3].t = hwrPatch->max_t;
|
|
||||||
|
|
||||||
flags = PF_Translucent|PF_NoDepthTest;
|
|
||||||
|
|
||||||
if (option & V_WRAPX)
|
|
||||||
flags |= PF_ForceWrapX;
|
|
||||||
if (option & V_WRAPY)
|
|
||||||
flags |= PF_ForceWrapY;
|
|
||||||
|
|
||||||
// clip it since it is used for bunny scroll in doom I
|
|
||||||
GL_DrawPolygon(NULL, v, 4, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags)
|
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags)
|
||||||
{
|
{
|
||||||
FOutVector v[4];
|
FOutVector v[4];
|
||||||
@@ -154,15 +87,15 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||||||
|
|
||||||
switch (option & V_SCALEPATCHMASK)
|
switch (option & V_SCALEPATCHMASK)
|
||||||
{
|
{
|
||||||
case V_NOSCALEPATCH:
|
case V_NOSCALEPATCH:
|
||||||
dup = 1.0f;
|
dup = 1.0f;
|
||||||
break;
|
break;
|
||||||
case V_SMALLSCALEPATCH:
|
case V_SMALLSCALEPATCH:
|
||||||
dup = (float)vid.smalldup;
|
dup = (float)vid.smalldup;
|
||||||
break;
|
break;
|
||||||
case V_MEDSCALEPATCH:
|
case V_MEDSCALEPATCH:
|
||||||
dup = (float)vid.meddup;
|
dup = (float)vid.meddup;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fscalew = fscaleh = FIXED_TO_FLOAT(pscale);
|
fscalew = fscaleh = FIXED_TO_FLOAT(pscale);
|
||||||
@@ -336,15 +269,15 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||||||
|
|
||||||
switch (option & V_SCALEPATCHMASK)
|
switch (option & V_SCALEPATCHMASK)
|
||||||
{
|
{
|
||||||
case V_NOSCALEPATCH:
|
case V_NOSCALEPATCH:
|
||||||
dup = 1.0f;
|
dup = 1.0f;
|
||||||
break;
|
break;
|
||||||
case V_SMALLSCALEPATCH:
|
case V_SMALLSCALEPATCH:
|
||||||
dup = (float)vid.smalldup;
|
dup = (float)vid.smalldup;
|
||||||
break;
|
break;
|
||||||
case V_MEDSCALEPATCH:
|
case V_MEDSCALEPATCH:
|
||||||
dup = (float)vid.meddup;
|
dup = (float)vid.meddup;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fscale = FIXED_TO_FLOAT(pscale);
|
fscale = FIXED_TO_FLOAT(pscale);
|
||||||
@@ -573,7 +506,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||||||
|
|
||||||
if (color & 0xFF00) // Do COLORMAP fade.
|
if (color & 0xFF00) // Do COLORMAP fade.
|
||||||
{
|
{
|
||||||
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
|
if (cv_glscreentextures.value && HWR_ShouldUsePaletteRendering())
|
||||||
{
|
{
|
||||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||||
|
|
||||||
@@ -585,12 +518,10 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||||||
GL_UnSetShader();
|
GL_UnSetShader();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
Surf.PolyColor.s.alpha = (strength*8);
|
||||||
Surf.PolyColor.s.alpha = (strength*8);
|
poly_flags |= PF_Translucent;
|
||||||
poly_flags |= PF_Translucent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // Do TRANSMAP** fade.
|
else // Do TRANSMAP** fade.
|
||||||
{
|
{
|
||||||
@@ -636,133 +567,6 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
|
||||||
// R_DRAW.C STUFF
|
|
||||||
// ==========================================================================
|
|
||||||
|
|
||||||
// ------------------
|
|
||||||
// HWR_DrawViewBorder
|
|
||||||
// Fill the space around the view window with a Doom flat texture, draw the
|
|
||||||
// beveled edges.
|
|
||||||
// 'clearlines' is useful to clear the heads up messages, when the view
|
|
||||||
// window is reduced, it doesn't refresh all the view borders.
|
|
||||||
// ------------------
|
|
||||||
void HWR_DrawViewBorder(INT32 clearlines)
|
|
||||||
{
|
|
||||||
INT32 x, y;
|
|
||||||
INT32 top, side;
|
|
||||||
INT32 baseviewwidth, baseviewheight;
|
|
||||||
INT32 basewindowx, basewindowy;
|
|
||||||
patch_t *patch;
|
|
||||||
|
|
||||||
if (!clearlines)
|
|
||||||
clearlines = BASEVIDHEIGHT; // refresh all
|
|
||||||
|
|
||||||
// calc view size based on original game resolution
|
|
||||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdup)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
|
||||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdup));
|
|
||||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdup));
|
|
||||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdup));
|
|
||||||
|
|
||||||
// top
|
|
||||||
HWR_DrawFlatFill(0, 0,
|
|
||||||
BASEVIDWIDTH, (top < clearlines ? top : clearlines),
|
|
||||||
st_borderpatchnum);
|
|
||||||
|
|
||||||
// left
|
|
||||||
if (top < clearlines)
|
|
||||||
HWR_DrawFlatFill(0, top, side,
|
|
||||||
(clearlines-top < baseviewheight ? clearlines-top : baseviewheight),
|
|
||||||
st_borderpatchnum);
|
|
||||||
|
|
||||||
// right
|
|
||||||
if (top < clearlines)
|
|
||||||
HWR_DrawFlatFill(side + baseviewwidth, top, side,
|
|
||||||
(clearlines-top < baseviewheight ? clearlines-top : baseviewheight),
|
|
||||||
st_borderpatchnum);
|
|
||||||
|
|
||||||
// bottom
|
|
||||||
if (top + baseviewheight < clearlines)
|
|
||||||
HWR_DrawFlatFill(0, top + baseviewheight,
|
|
||||||
BASEVIDWIDTH, BASEVIDHEIGHT, st_borderpatchnum);
|
|
||||||
|
|
||||||
//
|
|
||||||
// draw the view borders
|
|
||||||
//
|
|
||||||
|
|
||||||
basewindowx = (BASEVIDWIDTH - baseviewwidth)>>1;
|
|
||||||
if (baseviewwidth == BASEVIDWIDTH)
|
|
||||||
basewindowy = 0;
|
|
||||||
else
|
|
||||||
basewindowy = top;
|
|
||||||
|
|
||||||
// top edge
|
|
||||||
if (clearlines > basewindowy - 8)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH);
|
|
||||||
for (x = 0; x < baseviewwidth; x += 8)
|
|
||||||
HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// bottom edge
|
|
||||||
if (clearlines > basewindowy + baseviewheight)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH);
|
|
||||||
for (x = 0; x < baseviewwidth; x += 8)
|
|
||||||
HWR_DrawPatch(patch, basewindowx + x,
|
|
||||||
basewindowy + baseviewheight, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// left edge
|
|
||||||
if (clearlines > basewindowy)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
|
|
||||||
for (y = 0; y < baseviewheight && basewindowy + y < clearlines;
|
|
||||||
y += 8)
|
|
||||||
{
|
|
||||||
HWR_DrawPatch(patch, basewindowx - 8, basewindowy + y,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// right edge
|
|
||||||
if (clearlines > basewindowy)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
|
|
||||||
for (y = 0; y < baseviewheight && basewindowy+y < clearlines;
|
|
||||||
y += 8)
|
|
||||||
{
|
|
||||||
HWR_DrawPatch(patch, basewindowx + baseviewwidth,
|
|
||||||
basewindowy + y, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw beveled corners.
|
|
||||||
if (clearlines > basewindowy - 8)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx - 8, basewindowy - 8, 0);
|
|
||||||
|
|
||||||
if (clearlines > basewindowy - 8)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx + baseviewwidth, basewindowy - 8, 0);
|
|
||||||
|
|
||||||
if (clearlines > basewindowy+baseviewheight)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx - 8, basewindowy + baseviewheight, 0);
|
|
||||||
|
|
||||||
if (clearlines > basewindowy + baseviewheight)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx + baseviewwidth,
|
|
||||||
basewindowy + baseviewheight, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// AM_MAP.C DRAWING STUFF
|
// AM_MAP.C DRAWING STUFF
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -1084,11 +888,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||||||
|
|
||||||
if (fx >= vid.width || fy >= vid.height)
|
if (fx >= vid.width || fy >= vid.height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fx < 0)
|
if (fx < 0)
|
||||||
{
|
{
|
||||||
fw += fx;
|
fw += fx;
|
||||||
fx = 0;
|
fx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fy < 0)
|
if (fy < 0)
|
||||||
{
|
{
|
||||||
fh += fy;
|
fh += fy;
|
||||||
@@ -1100,6 +906,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||||||
|
|
||||||
if (fx + fw > vid.width)
|
if (fx + fw > vid.width)
|
||||||
fw = fvw - fx;
|
fw = fvw - fx;
|
||||||
|
|
||||||
if (fy + fh > vid.height)
|
if (fy + fh > vid.height)
|
||||||
fh = fvh - fy;
|
fh = fvh - fy;
|
||||||
|
|
||||||
@@ -1168,7 +975,7 @@ static inline boolean saveTGA(const char *file_name, void *buffer,
|
|||||||
INT32 i;
|
INT32 i;
|
||||||
UINT8 *buf8 = buffer;
|
UINT8 *buf8 = buffer;
|
||||||
|
|
||||||
fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
|
fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
+39
-71
@@ -65,8 +65,6 @@
|
|||||||
// Globals
|
// Globals
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
|
||||||
|
|
||||||
// false if shaders have not been initialized yet, or if shaders are not available
|
// false if shaders have not been initialized yet, or if shaders are not available
|
||||||
boolean gl_shadersavailable = false;
|
boolean gl_shadersavailable = false;
|
||||||
|
|
||||||
@@ -77,11 +75,6 @@ boolean gl_drawing_stencil = false;
|
|||||||
|
|
||||||
static INT32 current_bsp_culling_distance = 0;
|
static INT32 current_bsp_culling_distance = 0;
|
||||||
|
|
||||||
// base values set at SetViewSize
|
|
||||||
float gl_baseviewwindowy, gl_baseviewwindowx;
|
|
||||||
static float gl_viewwindowy, gl_viewwindowx; // top left corner of view window
|
|
||||||
float gl_viewwidth, gl_viewheight; // viewport clipping boundaries (screen coords)
|
|
||||||
|
|
||||||
FTransform atransform;
|
FTransform atransform;
|
||||||
|
|
||||||
// Float variants of viewx, viewy, viewz, etc.
|
// Float variants of viewx, viewy, viewz, etc.
|
||||||
@@ -284,6 +277,7 @@ static void CV_glshaders_OnChange(void)
|
|||||||
{
|
{
|
||||||
// can't do palette rendering without shaders, so update the state if needed
|
// can't do palette rendering without shaders, so update the state if needed
|
||||||
HWR_TogglePaletteRendering();
|
HWR_TogglePaletteRendering();
|
||||||
|
HWR_PrecacheLevel();
|
||||||
}
|
}
|
||||||
M_UpdateOGLMenu();
|
M_UpdateOGLMenu();
|
||||||
}
|
}
|
||||||
@@ -301,18 +295,21 @@ static void CV_gltextureformat_OnChange(void)
|
|||||||
{
|
{
|
||||||
ONLY_IF_GL_LOADED
|
ONLY_IF_GL_LOADED
|
||||||
GL_SetSpecialState(HWD_SET_TEXTURE_FORMAT, cv_gltexturedepth.value);
|
GL_SetSpecialState(HWD_SET_TEXTURE_FORMAT, cv_gltexturedepth.value);
|
||||||
|
HWR_PrecacheLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CV_filtermode_OnChange(void)
|
static void CV_filtermode_OnChange(void)
|
||||||
{
|
{
|
||||||
ONLY_IF_GL_LOADED
|
ONLY_IF_GL_LOADED
|
||||||
GL_SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
GL_SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||||
|
HWR_PrecacheLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CV_anisotropic_OnChange(void)
|
static void CV_anisotropic_OnChange(void)
|
||||||
{
|
{
|
||||||
ONLY_IF_GL_LOADED
|
ONLY_IF_GL_LOADED
|
||||||
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||||
|
HWR_PrecacheLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CV_glpaletterendering_OnChange(void)
|
static void CV_glpaletterendering_OnChange(void)
|
||||||
@@ -325,7 +322,9 @@ static void CV_glpaletterendering_OnChange(void)
|
|||||||
{
|
{
|
||||||
HWR_CompileShaders();
|
HWR_CompileShaders();
|
||||||
HWR_TogglePaletteRendering();
|
HWR_TogglePaletteRendering();
|
||||||
|
HWR_PrecacheLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
M_UpdateOGLMenu();
|
M_UpdateOGLMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3377,6 +3376,9 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
|||||||
fixed_t slopez;
|
fixed_t slopez;
|
||||||
float offset = 0;
|
float offset = 0;
|
||||||
|
|
||||||
|
if (!spr->mobj)
|
||||||
|
return;
|
||||||
|
|
||||||
R_GetShadowZ(spr->mobj, &floorslope);
|
R_GetShadowZ(spr->mobj, &floorslope);
|
||||||
|
|
||||||
mobjfloor = HWR_OpaqueFloorAtPos(
|
mobjfloor = HWR_OpaqueFloorAtPos(
|
||||||
@@ -3388,14 +3390,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
|||||||
angle_t shadowdir;
|
angle_t shadowdir;
|
||||||
|
|
||||||
// Set direction
|
// Set direction
|
||||||
if (splitscreen && R_GetViewNumber() == 1)
|
shadowdir = localangle[viewssnum] + FixedAngle(cv_cam_rotate[viewssnum].value);
|
||||||
shadowdir = localangle[1] + FixedAngle(cv_cam_rotate[1].value);
|
|
||||||
else if (splitscreen > 1 && R_GetViewNumber() == 2)
|
|
||||||
shadowdir = localangle[2] + FixedAngle(cv_cam_rotate[2].value);
|
|
||||||
else if (splitscreen > 2 && R_GetViewNumber() == 3)
|
|
||||||
shadowdir = localangle[3] + FixedAngle(cv_cam_rotate[3].value);
|
|
||||||
else
|
|
||||||
shadowdir = localangle[0] + FixedAngle(cv_cam_rotate[0].value);
|
|
||||||
|
|
||||||
// Find floorheight
|
// Find floorheight
|
||||||
floorheight = HWR_OpaqueFloorAtPos(
|
floorheight = HWR_OpaqueFloorAtPos(
|
||||||
@@ -3407,18 +3402,17 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
|||||||
// Don't draw it, then!
|
// Don't draw it, then!
|
||||||
if (spr->mobj->z < floorheight)
|
if (spr->mobj->z < floorheight)
|
||||||
return;
|
return;
|
||||||
else
|
|
||||||
{
|
fixed_t floorz;
|
||||||
fixed_t floorz;
|
floorz = HWR_OpaqueFloorAtPos(
|
||||||
floorz = HWR_OpaqueFloorAtPos(
|
spr->mobj->x + P_ReturnThrustX(spr->mobj, shadowdir, spr->mobj->z - floorheight),
|
||||||
spr->mobj->x + P_ReturnThrustX(spr->mobj, shadowdir, spr->mobj->z - floorheight),
|
spr->mobj->y + P_ReturnThrustY(spr->mobj, shadowdir, spr->mobj->z - floorheight),
|
||||||
spr->mobj->y + P_ReturnThrustY(spr->mobj, shadowdir, spr->mobj->z - floorheight),
|
spr->mobj->z, spr->mobj->height);
|
||||||
spr->mobj->z, spr->mobj->height);
|
|
||||||
// The shadow would be falling on a wall? Don't draw it, then.
|
// The shadow would be falling on a wall? Don't draw it, then.
|
||||||
// Would draw midair otherwise.
|
// Would draw midair otherwise.
|
||||||
if (floorz < floorheight)
|
if (floorz < floorheight)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
floorheight = FixedInt(spr->mobj->z - floorheight);
|
floorheight = FixedInt(spr->mobj->z - floorheight);
|
||||||
|
|
||||||
@@ -3428,12 +3422,11 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
|||||||
floorheight = FixedInt(spr->mobj->z - mobjfloor);
|
floorheight = FixedInt(spr->mobj->z - mobjfloor);
|
||||||
|
|
||||||
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
|
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
|
||||||
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
|
this_scale = FixedToFloat(spr->mobj->scale);
|
||||||
|
|
||||||
if (spr->mobj)
|
const skin_t *moskin = K_GetMobjSkin(spr->mobj);
|
||||||
this_scale = FixedToFloat(spr->mobj->scale);
|
if (moskin && moskin->flags & SF_HIRES)
|
||||||
if (hires)
|
this_scale *= FixedToFloat(moskin->highresscale);
|
||||||
this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale);
|
|
||||||
|
|
||||||
// create the sprite billboard
|
// create the sprite billboard
|
||||||
//
|
//
|
||||||
@@ -4054,7 +4047,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
|||||||
|
|
||||||
const precipmobj_t *sprmo = spr->precip;
|
const precipmobj_t *sprmo = spr->precip;
|
||||||
|
|
||||||
if (UNLIKELY(!sprmo || !sprmo->subsector))
|
if (UNLIKELY(!sprmo->subsector))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// cache sprite graphics
|
// cache sprite graphics
|
||||||
@@ -4335,7 +4328,7 @@ static int CompareDrawNodePlanes(const void *p1, const void *p2)
|
|||||||
const INT32 n1 = *(const INT32*)p1;
|
const INT32 n1 = *(const INT32*)p1;
|
||||||
const INT32 n2 = *(const INT32*)p2;
|
const INT32 n2 = *(const INT32*)p2;
|
||||||
|
|
||||||
return ABS(drawnodes[n2].u.plane.fixedheight - viewz) - ABS(drawnodes[n1].u.plane.fixedheight - viewz);
|
return abs(drawnodes[n2].u.plane.fixedheight - viewz) - abs(drawnodes[n1].u.plane.fixedheight - viewz);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -5316,10 +5309,10 @@ static void HWR_DrawSkyBackground(void)
|
|||||||
// -----------------+
|
// -----------------+
|
||||||
static inline void HWR_ClearView(void)
|
static inline void HWR_ClearView(void)
|
||||||
{
|
{
|
||||||
GL_GClipRect((INT32)gl_viewwindowx,
|
GL_GClipRect(viewwindowx,
|
||||||
(INT32)gl_viewwindowy,
|
viewwindowy,
|
||||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
(viewwindowx + viewwidth),
|
||||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
(viewwindowy + viewheight),
|
||||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||||
GL_ClearBuffer(false, true, true, NULL);
|
GL_ClearBuffer(false, true, true, NULL);
|
||||||
}
|
}
|
||||||
@@ -5329,19 +5322,6 @@ static inline void HWR_ClearView(void)
|
|||||||
// -----------------+
|
// -----------------+
|
||||||
void HWR_SetViewSize(void)
|
void HWR_SetViewSize(void)
|
||||||
{
|
{
|
||||||
// setup view size
|
|
||||||
gl_viewwidth = (float)vid.width;
|
|
||||||
gl_viewheight = (float)vid.height;
|
|
||||||
|
|
||||||
if (splitscreen)
|
|
||||||
gl_viewheight /= 2;
|
|
||||||
|
|
||||||
if (splitscreen > 1)
|
|
||||||
gl_viewwidth /= 2;
|
|
||||||
|
|
||||||
gl_baseviewwindowy = 0;
|
|
||||||
gl_baseviewwindowx = 0;
|
|
||||||
|
|
||||||
GL_FlushScreenTextures();
|
GL_FlushScreenTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5352,7 +5332,9 @@ static void HWR_SetTransformAiming(FTransform *trans)
|
|||||||
if (cv_glshearing.value)
|
if (cv_glshearing.value)
|
||||||
{
|
{
|
||||||
fixed_t fixedaiming = AIMINGTODY(aimingangle);
|
fixed_t fixedaiming = AIMINGTODY(aimingangle);
|
||||||
trans->viewaiming = FixedToFloat(fixedaiming);
|
trans->viewaiming = FixedToFloat(fixedaiming) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT);
|
||||||
|
if (splitscreen == 1) // only for 2 player splitscreen
|
||||||
|
trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
|
||||||
trans->shearing = true;
|
trans->shearing = true;
|
||||||
gl_aimingangle = 0;
|
gl_aimingangle = 0;
|
||||||
}
|
}
|
||||||
@@ -5594,20 +5576,6 @@ extern "C" {
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
static void HWR_RenderFrame(player_t *player, boolean skybox)
|
static void HWR_RenderFrame(player_t *player, boolean skybox)
|
||||||
{
|
{
|
||||||
// set window position
|
|
||||||
gl_viewwindowx = gl_baseviewwindowx;
|
|
||||||
gl_viewwindowy = gl_baseviewwindowy;
|
|
||||||
|
|
||||||
if ((splitscreen == 1 && viewssnum == 1) || (splitscreen > 1 && viewssnum > 1))
|
|
||||||
{
|
|
||||||
gl_viewwindowy += gl_viewheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (splitscreen > 1 && viewssnum & 1)
|
|
||||||
{
|
|
||||||
gl_viewwindowx += gl_viewwidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for new console commands.
|
// check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
@@ -5623,10 +5591,10 @@ static void HWR_RenderFrame(player_t *player, boolean skybox)
|
|||||||
|
|
||||||
if (!skybox && cv_glrenderdistance.value)
|
if (!skybox && cv_glrenderdistance.value)
|
||||||
{
|
{
|
||||||
GL_GClipRect((INT32)gl_viewwindowx,
|
GL_GClipRect(viewwindowx,
|
||||||
(INT32)gl_viewwindowy,
|
viewwindowy,
|
||||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
(viewwindowx + viewwidth),
|
||||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
(viewwindowy + viewheight),
|
||||||
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
||||||
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
|
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
|
||||||
}
|
}
|
||||||
@@ -5872,7 +5840,7 @@ static void COM_HWR_glinfo(void)
|
|||||||
{
|
{
|
||||||
argv = COM_Argv(i);
|
argv = COM_Argv(i);
|
||||||
|
|
||||||
if (strcmp(argv, "--list-extensions") == 0 || strcmp(argv, "-l") == 0)
|
if (fastcmp(argv, "--list-extensions")|| fastcmp(argv, "-l"))
|
||||||
{
|
{
|
||||||
list_extensions = 1;
|
list_extensions = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ extern "C" {
|
|||||||
void HWR_Startup(void);
|
void HWR_Startup(void);
|
||||||
void HWR_Shutdown(void);
|
void HWR_Shutdown(void);
|
||||||
|
|
||||||
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
|
|
||||||
|
|
||||||
extern float gl_basewindowcenterx, gl_basewindowcentery;
|
|
||||||
|
|
||||||
extern unsigned msaa;
|
extern unsigned msaa;
|
||||||
extern boolean a2c;
|
extern boolean a2c;
|
||||||
|
|
||||||
@@ -89,7 +85,6 @@ extern ps_metric_t ps_hw_batchdrawtime;
|
|||||||
extern boolean gl_shadersavailable;
|
extern boolean gl_shadersavailable;
|
||||||
|
|
||||||
// hw_draw.c
|
// hw_draw.c
|
||||||
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
|
||||||
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags);
|
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags);
|
||||||
void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
||||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||||
@@ -98,7 +93,6 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color);
|
|||||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
|
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
|
||||||
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
||||||
void HWR_DrawViewBorder(INT32 clearlines);
|
|
||||||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
||||||
|
|
||||||
UINT8 *HWR_GetScreenshot(INT32 scale);
|
UINT8 *HWR_GetScreenshot(INT32 scale);
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ void HWR_InitMD2(void)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < NUMSPRITES; i++)
|
for (i = 0; i < NUMSPRITES; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(name, sprnames[i]) == 0)
|
if (fasticmp(name, sprnames[i]))
|
||||||
{
|
{
|
||||||
md2_models[i].scale = scale;
|
md2_models[i].scale = scale;
|
||||||
md2_models[i].offset = offset;
|
md2_models[i].offset = offset;
|
||||||
@@ -561,7 +561,7 @@ void HWR_InitMD2(void)
|
|||||||
|
|
||||||
for (s = 0; s < MAXSKINS; s++)
|
for (s = 0; s < MAXSKINS; s++)
|
||||||
{
|
{
|
||||||
if (stricmp(name, skins[s].name) == 0)
|
if (fasticmp(name, skins[s].name))
|
||||||
{
|
{
|
||||||
md2_playermodels[s].skin = s;
|
md2_playermodels[s].skin = s;
|
||||||
md2_playermodels[s].scale = scale;
|
md2_playermodels[s].scale = scale;
|
||||||
@@ -607,11 +607,12 @@ void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added afte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
md2s = ( (local) ? md2_localplayermodels : md2_playermodels );
|
md2s = (local ? md2_localplayermodels : md2_playermodels);
|
||||||
|
|
||||||
// Check for any MD2s that match the names of player skins!
|
// Check for any MD2s that match the names of player skins!
|
||||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||||
{
|
{
|
||||||
if (stricmp(name, K_GetSkinArray(local)[skin].name) == 0)
|
if (fasticmp(name, K_GetSkinArray(local)[skin].name))
|
||||||
{
|
{
|
||||||
md2s[skin].skin = skin;
|
md2s[skin].skin = skin;
|
||||||
md2s[skin].scale = scale;
|
md2s[skin].scale = scale;
|
||||||
@@ -650,6 +651,7 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
|
|||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
f = fopen(va("%s"PATHSEP"%s", srb2path, "mdls.dat"), "rt");
|
f = fopen(va("%s"PATHSEP"%s", srb2path, "mdls.dat"), "rt");
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
CONS_Printf("%s %s\n", M_GetText("Error while loading mdls.dat:"), strerror(errno));
|
CONS_Printf("%s %s\n", M_GetText("Error while loading mdls.dat:"), strerror(errno));
|
||||||
@@ -661,7 +663,7 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
|
|||||||
// Check for any MD2s that match the names of sprite names!
|
// Check for any MD2s that match the names of sprite names!
|
||||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||||
{
|
{
|
||||||
if (stricmp(name, sprnames[spritenum]) == 0)
|
if (fasticmp(name, sprnames[spritenum]))
|
||||||
{
|
{
|
||||||
md2_models[spritenum].scale = scale;
|
md2_models[spritenum].scale = scale;
|
||||||
md2_models[spritenum].offset = offset;
|
md2_models[spritenum].offset = offset;
|
||||||
|
|||||||
+5
-150
@@ -114,7 +114,6 @@ void UnloadModel(model_t *model)
|
|||||||
if (model->materials)
|
if (model->materials)
|
||||||
Z_Free(model->materials);
|
Z_Free(model->materials);
|
||||||
|
|
||||||
DeleteVBOs(model);
|
|
||||||
Z_Free(model);
|
Z_Free(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +126,7 @@ tag_t *GetTagByName(model_t *model, char *name, int frame)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < model->numTags; i++)
|
for (i = 0; i < model->numTags; i++)
|
||||||
{
|
{
|
||||||
if (!stricmp(iterator[i].name, name))
|
if (fasticmp(iterator[i].name, name))
|
||||||
return &iterator[i];
|
return &iterator[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,22 +163,22 @@ model_t *LoadModel(const char *filename, int ztag)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(extension, ".md3"))
|
if (fastcmp(extension, ".md3"))
|
||||||
{
|
{
|
||||||
if (!(model = MD3_LoadModel(filename, ztag, false)))
|
if (!(model = MD3_LoadModel(filename, ztag, false)))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (!strcmp(extension, ".md3s")) // MD3 that will be converted in memory to use full floats
|
else if (fastcmp(extension, ".md3s")) // MD3 that will be converted in memory to use full floats
|
||||||
{
|
{
|
||||||
if (!(model = MD3_LoadModel(filename, ztag, true)))
|
if (!(model = MD3_LoadModel(filename, ztag, true)))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (!strcmp(extension, ".md2"))
|
else if (fastcmp(extension, ".md2"))
|
||||||
{
|
{
|
||||||
if (!(model = MD2_LoadModel(filename, ztag, false)))
|
if (!(model = MD2_LoadModel(filename, ztag, false)))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (!strcmp(extension, ".md2s"))
|
else if (fastcmp(extension, ".md2s"))
|
||||||
{
|
{
|
||||||
if (!(model = MD2_LoadModel(filename, ztag, true)))
|
if (!(model = MD2_LoadModel(filename, ztag, true)))
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -194,7 +193,6 @@ model_t *LoadModel(const char *filename, int ztag)
|
|||||||
strcpy(model->mdlFilename, filename);
|
strcpy(model->mdlFilename, filename);
|
||||||
|
|
||||||
Optimize(model);
|
Optimize(model);
|
||||||
GeneratePolygonNormals(model, ztag);
|
|
||||||
|
|
||||||
// Default material properties
|
// Default material properties
|
||||||
for (i = 0 ; i < model->numMaterials; i++)
|
for (i = 0 ; i < model->numMaterials; i++)
|
||||||
@@ -246,13 +244,6 @@ void GenerateVertexNormals(model_t *model)
|
|||||||
|
|
||||||
M_Memcpy(newNormals, frame->normals, sizeof(float)*3*mesh->numTriangles*3);
|
M_Memcpy(newNormals, frame->normals, sizeof(float)*3*mesh->numTriangles*3);
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
memTag = Z_GetTag(frame->tangents);
|
|
||||||
float *newTangents = (float*)Z_Malloc(sizeof(float)*3*mesh->numTriangles*3, memTag);
|
|
||||||
M_Memcpy(newTangents, frame->tangents, sizeof(float)*3*mesh->numTriangles*3);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
for (k = 0; k < mesh->numVertices; k++)
|
for (k = 0; k < mesh->numVertices; k++)
|
||||||
{
|
{
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
@@ -288,32 +279,15 @@ void GenerateVertexNormals(model_t *model)
|
|||||||
|
|
||||||
if (vCount > 1)
|
if (vCount > 1)
|
||||||
{
|
{
|
||||||
// Vector::Normalize(&normal);
|
|
||||||
newNormals[3 * k + 0] = (float)normal.x;
|
newNormals[3 * k + 0] = (float)normal.x;
|
||||||
newNormals[3 * k + 1] = (float)normal.y;
|
newNormals[3 * k + 1] = (float)normal.y;
|
||||||
newNormals[3 * k + 2] = (float)normal.z;
|
newNormals[3 * k + 2] = (float)normal.z;
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
Vector::vector_t tangent;
|
|
||||||
Vector::Tangent(&normal, &tangent);
|
|
||||||
newTangents[3 * k + 0] = tangent.x;
|
|
||||||
newTangents[3 * k + 1] = tangent.y;
|
|
||||||
newTangents[3 * k + 2] = tangent.z;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oldNormals = frame->normals;
|
oldNormals = frame->normals;
|
||||||
frame->normals = newNormals;
|
frame->normals = newNormals;
|
||||||
Z_Free(oldNormals);
|
Z_Free(oldNormals);
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
float *oldTangents = frame->tangents;
|
|
||||||
frame->tangents = newTangents;
|
|
||||||
Z_Free(oldTangents);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -404,15 +378,11 @@ void Optimize(model_t *model)
|
|||||||
newMesh->numTriangles = numTriangles;
|
newMesh->numTriangles = numTriangles;
|
||||||
newMesh->numVertices = numTriangles * 3;
|
newMesh->numVertices = numTriangles * 3;
|
||||||
newMesh->uvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, 0);
|
newMesh->uvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, 0);
|
||||||
// if (node->material->lightmap)
|
|
||||||
// newMesh->lightuvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, 0);
|
|
||||||
newMesh->frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t), memTag, 0);
|
newMesh->frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t), memTag, 0);
|
||||||
curFrame = &newMesh->frames[0];
|
curFrame = &newMesh->frames[0];
|
||||||
|
|
||||||
curFrame->material = curMat;
|
curFrame->material = curMat;
|
||||||
curFrame->normals = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
curFrame->normals = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
||||||
// if (!systemSucks)
|
|
||||||
// curFrame->tangents = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
|
||||||
curFrame->vertices = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
curFrame->vertices = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
||||||
curFrame->colors = (char*)Z_Malloc(sizeof(char)*4*numTriangles*3, memTag, 0);
|
curFrame->colors = (char*)Z_Malloc(sizeof(char)*4*numTriangles*3, memTag, 0);
|
||||||
|
|
||||||
@@ -436,12 +406,6 @@ void Optimize(model_t *model)
|
|||||||
curMesh->uvs,
|
curMesh->uvs,
|
||||||
sizeof(float)*2*curMesh->numTriangles*3);
|
sizeof(float)*2*curMesh->numTriangles*3);
|
||||||
|
|
||||||
/* if (node->material->lightmap)
|
|
||||||
{
|
|
||||||
M_Memcpy(&newMesh->lightuvs[uvCount],
|
|
||||||
curMesh->lightuvs,
|
|
||||||
sizeof(float)*2*curMesh->numTriangles*3);
|
|
||||||
}*/
|
|
||||||
uvCount += 2*curMesh->numTriangles*3;
|
uvCount += 2*curMesh->numTriangles*3;
|
||||||
|
|
||||||
dest = (float*)newMesh->frames[0].vertices;
|
dest = (float*)newMesh->frames[0].vertices;
|
||||||
@@ -456,15 +420,6 @@ void Optimize(model_t *model)
|
|||||||
src,
|
src,
|
||||||
sizeof(float)*3*curMesh->numTriangles*3);
|
sizeof(float)*3*curMesh->numTriangles*3);
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
dest = (float*)newMesh->frames[0].tangents;
|
|
||||||
src = (float*)curMesh->frames[0].tangents;
|
|
||||||
M_Memcpy(&dest[vertCount],
|
|
||||||
src,
|
|
||||||
sizeof(float)*3*curMesh->numTriangles*3);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
vertCount += 3 * curMesh->numTriangles * 3;
|
vertCount += 3 * curMesh->numTriangles * 3;
|
||||||
|
|
||||||
destByte = (char*)newMesh->frames[0].colors;
|
destByte = (char*)newMesh->frames[0].colors;
|
||||||
@@ -494,103 +449,3 @@ void Optimize(model_t *model)
|
|||||||
model->meshes = newMeshes;
|
model->meshes = newMeshes;
|
||||||
model->numMeshes = numMeshes;
|
model->numMeshes = numMeshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneratePolygonNormals(model_t *model, int ztag)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < model->numMeshes; i++)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
mesh_t *mesh = &model->meshes[i];
|
|
||||||
|
|
||||||
if (!mesh->frames)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (j = 0; j < mesh->numFrames; j++)
|
|
||||||
{
|
|
||||||
int k;
|
|
||||||
mdlframe_t *frame = &mesh->frames[j];
|
|
||||||
const float *vertices = frame->vertices;
|
|
||||||
vector_t *polyNormals;
|
|
||||||
|
|
||||||
frame->polyNormals = (vector_t*)Z_Malloc(sizeof(vector_t) * mesh->numTriangles, ztag, 0);
|
|
||||||
|
|
||||||
polyNormals = frame->polyNormals;
|
|
||||||
|
|
||||||
for (k = 0; k < mesh->numTriangles; k++)
|
|
||||||
{
|
|
||||||
/// TODO: normalize vectors
|
|
||||||
(void)vertices;
|
|
||||||
(void)polyNormals;
|
|
||||||
// Vector::Normal(vertices, polyNormals);
|
|
||||||
vertices += 3 * 3;
|
|
||||||
polyNormals++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reload
|
|
||||||
//
|
|
||||||
// Reload VBOs
|
|
||||||
//
|
|
||||||
#if 0
|
|
||||||
static void Reload(void)
|
|
||||||
{
|
|
||||||
/* model_t *node;
|
|
||||||
for (node = modelHead; node; node = node->next)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < node->numMeshes; i++)
|
|
||||||
{
|
|
||||||
mesh_t *mesh = &node->meshes[i];
|
|
||||||
|
|
||||||
if (mesh->frames)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < mesh->numFrames; j++)
|
|
||||||
CreateVBO(mesh, &mesh->frames[j]);
|
|
||||||
}
|
|
||||||
else if (mesh->tinyframes)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < mesh->numFrames; j++)
|
|
||||||
CreateVBO(mesh, &mesh->tinyframes[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DeleteVBOs(model_t *model)
|
|
||||||
{
|
|
||||||
(void)model;
|
|
||||||
/* for (int i = 0; i < model->numMeshes; i++)
|
|
||||||
{
|
|
||||||
mesh_t *mesh = &model->meshes[i];
|
|
||||||
|
|
||||||
if (mesh->frames)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < mesh->numFrames; j++)
|
|
||||||
{
|
|
||||||
mdlframe_t *frame = &mesh->frames[j];
|
|
||||||
if (!frame->vboID)
|
|
||||||
continue;
|
|
||||||
bglDeleteBuffers(1, &frame->vboID);
|
|
||||||
frame->vboID = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mesh->tinyframes)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < mesh->numFrames; j++)
|
|
||||||
{
|
|
||||||
tinyframe_t *frame = &mesh->tinyframes[j];
|
|
||||||
if (!frame->vboID)
|
|
||||||
continue;
|
|
||||||
bglDeleteBuffers(1, &frame->vboID);
|
|
||||||
frame->vboID = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
@@ -28,8 +28,6 @@ typedef struct
|
|||||||
float ambient[4], diffuse[4], specular[4], emissive[4];
|
float ambient[4], diffuse[4], specular[4], emissive[4];
|
||||||
float shininess;
|
float shininess;
|
||||||
boolean spheremap;
|
boolean spheremap;
|
||||||
// Texture::texture_t *texture;
|
|
||||||
// Texture::texture_t *lightmap;
|
|
||||||
} material_t;
|
} material_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -40,7 +38,6 @@ typedef struct
|
|||||||
float *tangents;
|
float *tangents;
|
||||||
char *colors;
|
char *colors;
|
||||||
unsigned int vboID;
|
unsigned int vboID;
|
||||||
vector_t *polyNormals;
|
|
||||||
} mdlframe_t;
|
} mdlframe_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -70,7 +67,6 @@ typedef struct mesh_s
|
|||||||
typedef struct tag_s
|
typedef struct tag_s
|
||||||
{
|
{
|
||||||
char name[64];
|
char name[64];
|
||||||
// matrix_t transform;
|
|
||||||
} tag_t;
|
} tag_t;
|
||||||
|
|
||||||
typedef struct model_s
|
typedef struct model_s
|
||||||
@@ -96,9 +92,7 @@ model_t *LoadModel(const char *filename, int ztag);
|
|||||||
void UnloadModel(model_t *model);
|
void UnloadModel(model_t *model);
|
||||||
void Optimize(model_t *model);
|
void Optimize(model_t *model);
|
||||||
void GenerateVertexNormals(model_t *model);
|
void GenerateVertexNormals(model_t *model);
|
||||||
void GeneratePolygonNormals(model_t *model, int ztag);
|
|
||||||
void CreateVBOTiny(mesh_t *mesh, tinyframe_t *frame);
|
void CreateVBOTiny(mesh_t *mesh, tinyframe_t *frame);
|
||||||
void CreateVBO(mesh_t *mesh, mdlframe_t *frame);
|
void CreateVBO(mesh_t *mesh, mdlframe_t *frame);
|
||||||
void DeleteVBOs(model_t *model);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -586,7 +586,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
|||||||
goto skip_field;
|
goto skip_field;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stricmp(stoken, "GLSL"))
|
if (fasticmp(stoken, "GLSL"))
|
||||||
{
|
{
|
||||||
value = strtok(NULL, "\r\n ");
|
value = strtok(NULL, "\r\n ");
|
||||||
if (!value)
|
if (!value)
|
||||||
@@ -596,9 +596,9 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
|||||||
goto skip_lump;
|
goto skip_lump;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stricmp(value, "VERTEX"))
|
if (fasticmp(value, "VERTEX"))
|
||||||
shadertype = 1;
|
shadertype = 1;
|
||||||
else if (!stricmp(value, "FRAGMENT"))
|
else if (fasticmp(value, "FRAGMENT"))
|
||||||
shadertype = 2;
|
shadertype = 2;
|
||||||
|
|
||||||
skip_lump:
|
skip_lump:
|
||||||
@@ -624,7 +624,7 @@ skip_lump:
|
|||||||
|
|
||||||
for (i = 0; shaderxlat[i].type; i++)
|
for (i = 0; shaderxlat[i].type; i++)
|
||||||
{
|
{
|
||||||
if (!stricmp(shaderxlat[i].type, stoken))
|
if (fasticmp(shaderxlat[i].type, stoken))
|
||||||
{
|
{
|
||||||
size_t shader_string_length;
|
size_t shader_string_length;
|
||||||
char *shader_source;
|
char *shader_source;
|
||||||
|
|||||||
@@ -253,6 +253,9 @@ HMS_connect (const char *format, ...)
|
|||||||
cc = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
|
cc = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
|
||||||
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
|
||||||
|
cc = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 30L);
|
||||||
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
|
||||||
cc = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
cc = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
||||||
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
|
||||||
|
|||||||
+110
-161
@@ -431,7 +431,7 @@ void HU_Start(void)
|
|||||||
|
|
||||||
void HU_Shiftform(void)
|
void HU_Shiftform(void)
|
||||||
{
|
{
|
||||||
shiftxform = cv_keyboardlayout.value == 3 ? french_shiftxform : english_shiftxform;
|
shiftxform = (cv_keyboardlayout.value == 3) ? french_shiftxform : english_shiftxform;
|
||||||
}
|
}
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
@@ -465,8 +465,8 @@ static INT16 addy = 0; // use this to make the messages scroll smoothly when one
|
|||||||
static void HU_removeChatText_Mini(void)
|
static void HU_removeChatText_Mini(void)
|
||||||
{
|
{
|
||||||
// MPC: Don't create new arrays, just iterate through an existing one
|
// MPC: Don't create new arrays, just iterate through an existing one
|
||||||
size_t i;
|
for (size_t i = 0; i < chat_nummsg_min - 1; i++)
|
||||||
for(i=0;i<chat_nummsg_min-1;i++) {
|
{
|
||||||
strcpy(chat_mini[i], chat_mini[i+1]);
|
strcpy(chat_mini[i], chat_mini[i+1]);
|
||||||
chat_timers[i] = chat_timers[i+1];
|
chat_timers[i] = chat_timers[i+1];
|
||||||
}
|
}
|
||||||
@@ -485,8 +485,8 @@ static void HU_removeChatText_Log(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
free(chat_log[0]);
|
free(chat_log[0]);
|
||||||
size_t i;
|
|
||||||
for(i=0;i<chat_nummsg_log-1;i++)
|
for (size_t i = 0; i < chat_nummsg_log - 1;i++)
|
||||||
{
|
{
|
||||||
chat_log[i] = chat_log[i+1];
|
chat_log[i] = chat_log[i+1];
|
||||||
}
|
}
|
||||||
@@ -1101,14 +1101,14 @@ void HU_Ticker(void)
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
// handle spam while we're at it:
|
// handle spam while we're at it:
|
||||||
for(; (i<MAXPLAYERS); i++)
|
for(; (i < MAXPLAYERS); i++)
|
||||||
{
|
{
|
||||||
if (stop_spamming[i] > 0)
|
if (stop_spamming[i] > 0)
|
||||||
stop_spamming[i]--;
|
stop_spamming[i]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle chat timers
|
// handle chat timers
|
||||||
for (i=0; (i<chat_nummsg_min); i++)
|
for (i = 0; (i < chat_nummsg_min); i++)
|
||||||
{
|
{
|
||||||
if (chat_timers[i] > 0)
|
if (chat_timers[i] > 0)
|
||||||
chat_timers[i]--;
|
chat_timers[i]--;
|
||||||
@@ -1231,7 +1231,7 @@ static void HU_SendChatMessage(void)
|
|||||||
nodenum[2] = '\0';
|
nodenum[2] = '\0';
|
||||||
|
|
||||||
// check for undesirable characters in our "number"
|
// check for undesirable characters in our "number"
|
||||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||||
{
|
{
|
||||||
// check if nodenum[1] is a space
|
// check if nodenum[1] is a space
|
||||||
if (nodenum[1] == ' ')
|
if (nodenum[1] == ' ')
|
||||||
@@ -1499,7 +1499,7 @@ static void HU_drawMiniChat(void)
|
|||||||
if (splitscreen > 1)
|
if (splitscreen > 1)
|
||||||
boxw = max(64, boxw/2);
|
boxw = max(64, boxw/2);
|
||||||
|
|
||||||
for (; i>0; i--)
|
for (; i > 0; i--)
|
||||||
{
|
{
|
||||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
@@ -1572,7 +1572,7 @@ static void HU_drawMiniChat(void)
|
|||||||
i = 0;
|
i = 0;
|
||||||
prev_linereturn = false;
|
prev_linereturn = false;
|
||||||
|
|
||||||
for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
|
for (; i <= (chat_nummsg_min-1); i++) // iterate through our hot messages
|
||||||
{
|
{
|
||||||
INT32 clrflag = 0;
|
INT32 clrflag = 0;
|
||||||
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
||||||
@@ -1749,7 +1749,6 @@ static void HU_drawChatLog(INT32 offset)
|
|||||||
Z_Free(msg);
|
Z_Free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
||||||
{
|
{
|
||||||
atbottom = true; // we should scroll
|
atbottom = true; // we should scroll
|
||||||
@@ -2284,6 +2283,7 @@ static void HU_DrawSongCreditsBox(void)
|
|||||||
V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<<V_ALPHASHIFT));
|
V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<<V_ALPHASHIFT));
|
||||||
V_DrawFill(x+dup, y+dup, (strwidth-2)*dup, (BOXCREDITHEIGHT-2)*dup, 30|flags|(bgt<<V_ALPHASHIFT));
|
V_DrawFill(x+dup, y+dup, (strwidth-2)*dup, (BOXCREDITHEIGHT-2)*dup, 30|flags|(bgt<<V_ALPHASHIFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursongcredit.trans < NUMTRANSMAPS)
|
if (cursongcredit.trans < NUMTRANSMAPS)
|
||||||
{
|
{
|
||||||
V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
||||||
@@ -2391,76 +2391,6 @@ void HU_Drawer(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//======================================================================
|
|
||||||
// HUD MESSAGES CLEARING FROM SCREEN
|
|
||||||
//======================================================================
|
|
||||||
|
|
||||||
// Clear old messages from the borders around the view window
|
|
||||||
// (only for reduced view, refresh the borders when needed)
|
|
||||||
//
|
|
||||||
// startline: y coord to start clear,
|
|
||||||
// clearlines: how many lines to clear.
|
|
||||||
//
|
|
||||||
static INT32 oldclearlines;
|
|
||||||
|
|
||||||
void HU_Erase(void)
|
|
||||||
{
|
|
||||||
INT32 topline, bottomline;
|
|
||||||
INT32 y, yoffset;
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
// clear hud msgs on double buffer (OpenGL mode)
|
|
||||||
boolean secondframe;
|
|
||||||
static INT32 secondframelines;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (con_clearlines == oldclearlines && !con_hudupdate && !chat_on)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
// clear the other frame in double-buffer modes
|
|
||||||
secondframe = (con_clearlines != oldclearlines);
|
|
||||||
if (secondframe)
|
|
||||||
secondframelines = oldclearlines;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clear the message lines that go away, so use _oldclearlines_
|
|
||||||
bottomline = oldclearlines;
|
|
||||||
oldclearlines = con_clearlines;
|
|
||||||
if (chat_on && OLDCHAT)
|
|
||||||
if (bottomline < 8)
|
|
||||||
bottomline = 8; // only do it for consolechat. consolechat is gay.
|
|
||||||
|
|
||||||
if (automapactive || viewwindowx == 0) // hud msgs don't need to be cleared
|
|
||||||
return;
|
|
||||||
|
|
||||||
// software mode copies view border pattern & beveled edges from the backbuffer
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
topline = 0;
|
|
||||||
for (y = topline, yoffset = y*vid.width; y < bottomline; y++, yoffset += vid.width)
|
|
||||||
{
|
|
||||||
if (y < viewwindowy || y >= viewwindowy + viewheight)
|
|
||||||
R_VideoErase(yoffset, vid.width); // erase entire line
|
|
||||||
else
|
|
||||||
{
|
|
||||||
R_VideoErase(yoffset, viewwindowx); // erase left border
|
|
||||||
// erase right border
|
|
||||||
R_VideoErase(yoffset + viewwindowx + viewwidth, viewwindowx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
con_hudupdate = false; // if it was set..
|
|
||||||
}
|
|
||||||
#ifdef HWRENDER
|
|
||||||
else if (rendermode != render_none)
|
|
||||||
{
|
|
||||||
// refresh just what is needed from the view borders
|
|
||||||
HWR_DrawViewBorder(secondframelines);
|
|
||||||
con_hudupdate = secondframe;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// IN-LEVEL MULTIPLAYER RANKINGS
|
// IN-LEVEL MULTIPLAYER RANKINGS
|
||||||
//======================================================================
|
//======================================================================
|
||||||
@@ -2540,17 +2470,91 @@ Ping_conversion (UINT32 lag)
|
|||||||
// HU_drawPing
|
// HU_drawPing
|
||||||
//
|
//
|
||||||
|
|
||||||
|
static void HU_drawOldPing(INT32 x, INT32 y, UINT32 lag, INT32 flags, boolean gentleman)
|
||||||
|
{
|
||||||
|
const INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||||
|
|
||||||
|
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
||||||
|
{
|
||||||
|
if (measureid == 1)
|
||||||
|
{
|
||||||
|
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", Ping_conversion(lag)));
|
||||||
|
}
|
||||||
|
else if (measureid == 0)
|
||||||
|
{
|
||||||
|
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", Ping_conversion(lag)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cv_pingicon.value)
|
||||||
|
{
|
||||||
|
UINT8 numbars = 0; // how many ping bars do we draw?
|
||||||
|
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
||||||
|
SINT8 i = 0;
|
||||||
|
SINT8 yoffset = 6;
|
||||||
|
|
||||||
|
switch (lag)
|
||||||
|
{
|
||||||
|
case 0 ... 1:
|
||||||
|
numbars = 3;
|
||||||
|
barcolor = 215; // Blue
|
||||||
|
break;
|
||||||
|
case 2 ... 3:
|
||||||
|
numbars = 3;
|
||||||
|
barcolor = 184; // Green
|
||||||
|
break;
|
||||||
|
case 4 ... 6:
|
||||||
|
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
||||||
|
barcolor = 103; // Yellow
|
||||||
|
break;
|
||||||
|
case 7 ... 9:
|
||||||
|
numbars = 1;
|
||||||
|
barcolor = 155; // Red
|
||||||
|
break;
|
||||||
|
default: // Brazil
|
||||||
|
numbars = 0;
|
||||||
|
barcolor = 31; // black
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gentleman)
|
||||||
|
{
|
||||||
|
barcolor = 194; // make it purplish
|
||||||
|
// bars get indirectly set earlier
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; (i < 3); i++) // Draw the ping bar
|
||||||
|
{
|
||||||
|
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
|
||||||
|
if (i < numbars)
|
||||||
|
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
|
||||||
|
|
||||||
|
yoffset -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void HU_drawKartPing(INT32 x, INT32 y, UINT32 lag, INT32 flags, boolean gentleman)
|
||||||
|
{
|
||||||
|
const INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||||
|
|
||||||
|
if (measureid == 1)
|
||||||
|
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||||
|
|
||||||
|
if (cv_pingicon.value)
|
||||||
|
{
|
||||||
|
INT32 gfxnum = Ping_gfx_num(lag); // gfx to draw
|
||||||
|
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||||
|
}
|
||||||
|
|
||||||
|
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, Ping_conversion(lag), Ping_gfx_colormap(lag, gentleman));
|
||||||
|
|
||||||
|
if (measureid == 0)
|
||||||
|
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||||
|
}
|
||||||
|
|
||||||
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
|
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
|
||||||
{
|
{
|
||||||
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
|
||||||
INT32 gfxnum; // gfx to draw
|
|
||||||
|
|
||||||
//SRB2/Kart v1.0 style
|
|
||||||
UINT8 numbars = 0; // how many ping bars do we draw?
|
|
||||||
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
|
||||||
SINT8 i = 0;
|
|
||||||
SINT8 yoffset = 6;
|
|
||||||
|
|
||||||
UINT32 lag = playerpingtable[pnum];
|
UINT32 lag = playerpingtable[pnum];
|
||||||
const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag));
|
const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag));
|
||||||
|
|
||||||
@@ -2561,74 +2565,11 @@ void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
|
|||||||
|
|
||||||
if (cv_pingstyle.value == 0) // kart
|
if (cv_pingstyle.value == 0) // kart
|
||||||
{
|
{
|
||||||
gfxnum = Ping_gfx_num(lag);
|
HU_drawKartPing(x, y, lag, flags, gentleman);
|
||||||
|
|
||||||
if (measureid == 1)
|
|
||||||
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
|
||||||
|
|
||||||
if (cv_pingicon.value)
|
|
||||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
|
||||||
|
|
||||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, Ping_conversion(lag), Ping_gfx_colormap(lag, gentleman));
|
|
||||||
|
|
||||||
if (measureid == 0)
|
|
||||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
|
||||||
}
|
}
|
||||||
else if (cv_pingstyle.value == 1) // old style ping
|
else if (cv_pingstyle.value == 1) // old style ping
|
||||||
{
|
{
|
||||||
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
HU_drawOldPing(x, y, lag, flags, gentleman);
|
||||||
{
|
|
||||||
if (measureid == 1)
|
|
||||||
{
|
|
||||||
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", Ping_conversion(lag)));
|
|
||||||
}
|
|
||||||
else if (measureid == 0)
|
|
||||||
{
|
|
||||||
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", Ping_conversion(lag)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cv_pingicon.value)
|
|
||||||
{
|
|
||||||
switch (lag)
|
|
||||||
{
|
|
||||||
case 0 ... 1:
|
|
||||||
numbars = 3;
|
|
||||||
barcolor = 215; // Blue
|
|
||||||
break;
|
|
||||||
case 2 ... 3:
|
|
||||||
numbars = 3;
|
|
||||||
barcolor = 184; // Green
|
|
||||||
break;
|
|
||||||
case 4 ... 6:
|
|
||||||
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
|
||||||
barcolor = 103; // Yellow
|
|
||||||
break;
|
|
||||||
case 7 ... 9:
|
|
||||||
numbars = 1;
|
|
||||||
barcolor = 155; // Red
|
|
||||||
break;
|
|
||||||
default: // Brazil
|
|
||||||
numbars = 0;
|
|
||||||
barcolor = 31; // black
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gentleman)
|
|
||||||
{
|
|
||||||
barcolor = 194; // make it purplish
|
|
||||||
// bars get indirectly set earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; (i < 3); i++) // Draw the ping bar
|
|
||||||
{
|
|
||||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
|
|
||||||
if (i < numbars)
|
|
||||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
|
|
||||||
|
|
||||||
yoffset -= 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2904,12 +2845,8 @@ void HU_SetCEchoFlags(INT32 flags)
|
|||||||
|
|
||||||
void HU_DoCEcho(const char *msg)
|
void HU_DoCEcho(const char *msg)
|
||||||
{
|
{
|
||||||
#pragma GCC diagnostic push
|
strlcpy(cechotext, msg, sizeof(cechotext));
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-truncation" // This is fine, we set null byte later
|
strlcat(cechotext, "\\", sizeof(cechotext));
|
||||||
strncpy(cechotext, msg, sizeof(cechotext));
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1);
|
|
||||||
cechotext[sizeof(cechotext) - 1] = '\0';
|
|
||||||
|
|
||||||
// just print it to console
|
// just print it to console
|
||||||
if (cv_cechotoggle.value == 2)
|
if (cv_cechotoggle.value == 2)
|
||||||
@@ -2918,8 +2855,20 @@ void HU_DoCEcho(const char *msg)
|
|||||||
strncpy(temp, cechotext, sizeof(temp));
|
strncpy(temp, cechotext, sizeof(temp));
|
||||||
|
|
||||||
for (char *p = temp; *p != '\0'; ++p)
|
for (char *p = temp; *p != '\0'; ++p)
|
||||||
|
{
|
||||||
if (*p == '\\')
|
if (*p == '\\')
|
||||||
|
{
|
||||||
*p = '\n';
|
*p = '\n';
|
||||||
|
++p;
|
||||||
|
char *skip_p = p; // Point at which we will move part of string after all \'s
|
||||||
|
|
||||||
|
while (*p == '\\')
|
||||||
|
++p;
|
||||||
|
|
||||||
|
memmove(skip_p, p, strlen(p)+1); // move the rest of string with null byte
|
||||||
|
p = skip_p; // Restore p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CONS_Printf("%s\n", temp);
|
CONS_Printf("%s\n", temp);
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ void HU_TickSongCredits(void);
|
|||||||
void HU_DrawSongCredits(void);
|
void HU_DrawSongCredits(void);
|
||||||
void HU_Drawer(void);
|
void HU_Drawer(void);
|
||||||
char HU_dequeueChatChar(void);
|
char HU_dequeueChatChar(void);
|
||||||
void HU_Erase(void);
|
|
||||||
void HU_clearChatChars(void);
|
void HU_clearChatChars(void);
|
||||||
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard.
|
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard.
|
||||||
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
||||||
|
|||||||
@@ -1,680 +0,0 @@
|
|||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2011-2018 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file i_addrinfo.c
|
|
||||||
/// \brief getaddr stubs, for lesser OSes
|
|
||||||
///
|
|
||||||
/// Some systems/SDKs, like PSL1GHT v2 does not have addrinfo functions
|
|
||||||
/// So a stub is needed
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
#else
|
|
||||||
#include <winsock.h>
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "i_addrinfo.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This addrinfo stub have a testcases:
|
|
||||||
* To test the stub, use this command to compile the stub testcase:
|
|
||||||
* gcc -g -DTESTCASE -Dtest_stub -Wall -W i_addrinfo.c -o stub
|
|
||||||
* To test the real getaddrinfo API, use this command to get real one:
|
|
||||||
* gcc -g -DTESTCASE -Utest_stub -Wall -W i_addrinfo.c -o real
|
|
||||||
* For Win32,you need the WinSock library, version 1.1 or 2.2
|
|
||||||
* for 1.1, add -lwsock32
|
|
||||||
* i686-w64-mingw32-gcc -g -DTESTCASE -Dtest_stub -UUSE_WINSOCK2 -Wall -W i_addrinfo.c -o stub.exe -lwsock32
|
|
||||||
* for 2.2, add -DUSE_WINSOCK2 -lws2_32
|
|
||||||
* i686-w64-mingw32-gcc -g -DTESTCASE -Utest_stub -DUSE_WINSOCK2 -Wall -W i_addrinfo.c -o real.exe -lws2_32
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef I_getaddrinfo
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// it seems windows doesn't define that... maybe some other OS? OS/2
|
|
||||||
static int inet_aton(const char *cp, struct in_addr *addr)
|
|
||||||
{
|
|
||||||
if( cp == NULL || addr == NULL )
|
|
||||||
{
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if (strcmp(cp, "255.255.255.225") == 0)
|
|
||||||
{
|
|
||||||
addr->s_addr = htonl(INADDR_BROADCAST);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return (addr->s_addr = inet_addr(cp)) != htonl(INADDR_NONE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
static HMODULE ipv6dll = NULL;
|
|
||||||
typedef int (WSAAPI *p_getaddrinfo) (const char *, const char *,
|
|
||||||
const struct my_addrinfo *,
|
|
||||||
struct my_addrinfo **);
|
|
||||||
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *);
|
|
||||||
|
|
||||||
static p_getaddrinfo WS_getaddrinfo = NULL;
|
|
||||||
static p_freeaddrinfo WS_freeaddrinfo = NULL;
|
|
||||||
|
|
||||||
static HMODULE WS_getfunctions(HMODULE tmp)
|
|
||||||
{
|
|
||||||
if (tmp != NULL)
|
|
||||||
{
|
|
||||||
WS_getaddrinfo = (p_getaddrinfo)(LPVOID)GetProcAddress(tmp, "getaddrinfo");
|
|
||||||
if (WS_getaddrinfo == NULL)
|
|
||||||
return NULL;
|
|
||||||
WS_freeaddrinfo = (p_freeaddrinfo)(LPVOID)GetProcAddress(tmp, "freeaddrinfo");
|
|
||||||
if (WS_freeaddrinfo == NULL)
|
|
||||||
{
|
|
||||||
WS_getaddrinfo = NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void WS_addrinfosetup(void)
|
|
||||||
{
|
|
||||||
if (WS_getaddrinfo && WS_freeaddrinfo)
|
|
||||||
return; // already have the functions
|
|
||||||
// why not hold it into ipv6dll? becase we already link with ws2_32, silly!
|
|
||||||
if (WS_getfunctions(GetModuleHandleA("ws2_32.dll")) == NULL)
|
|
||||||
ipv6dll = WS_getfunctions(LoadLibraryA("wship6.dll"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WS_addrinfocleanup(void)
|
|
||||||
{
|
|
||||||
if (ipv6dll)
|
|
||||||
FreeLibrary(ipv6dll);
|
|
||||||
ipv6dll = NULL;
|
|
||||||
WS_getaddrinfo = NULL;
|
|
||||||
WS_freeaddrinfo = NULL;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void WS_addrinfocleanup(void) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int I_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct my_addrinfo *hints,
|
|
||||||
struct my_addrinfo **res)
|
|
||||||
{
|
|
||||||
struct hostent *nodename = NULL;
|
|
||||||
bool hostlookup = true, passivemode = false;
|
|
||||||
int flags = 0;
|
|
||||||
int socktype = 0;
|
|
||||||
int sockport = 0;
|
|
||||||
struct my_addrinfo *ai;
|
|
||||||
struct sockaddr_in *addr;
|
|
||||||
struct in_addr ipv4;
|
|
||||||
size_t addrlen = 1;
|
|
||||||
size_t ailen = 1, i = 0, j;
|
|
||||||
size_t famsize = sizeof(struct sockaddr_in);
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
WS_addrinfosetup();
|
|
||||||
if (WS_getaddrinfo)
|
|
||||||
return WS_getaddrinfo(node, service, hints, res);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// param check
|
|
||||||
if (node == NULL && service == NULL)
|
|
||||||
return EAI_NONAME;
|
|
||||||
//note: testcase show NULL as res crashes libc
|
|
||||||
if (res == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
// check hints
|
|
||||||
if (hints)
|
|
||||||
{
|
|
||||||
// no support for IPv6
|
|
||||||
if (hints->ai_family != AF_INET && hints->ai_family != AF_UNSPEC)
|
|
||||||
return -1; //EAI_FAMILY
|
|
||||||
#ifdef AI_NUMERICHOST
|
|
||||||
// do not look up hostnames
|
|
||||||
if ((hints->ai_flags & AI_NUMERICHOST) == AI_NUMERICHOST)
|
|
||||||
{
|
|
||||||
hostlookup = false;
|
|
||||||
flags |= AI_NUMERICHOST;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef AI_PASSIVE
|
|
||||||
// return loopback or any address?
|
|
||||||
if ((hints->ai_flags & AI_PASSIVE) == AI_PASSIVE)
|
|
||||||
{
|
|
||||||
passivemode = true;
|
|
||||||
flags |= AI_PASSIVE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// why no support for canon names? lazy
|
|
||||||
//AI_CANONNAME
|
|
||||||
// what kind of socket?
|
|
||||||
socktype = hints->ai_socktype;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef AI_V4MAPPED
|
|
||||||
flags |= AI_V4MAPPED;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_ADDRCONFIG
|
|
||||||
flags |= AI_ADDRCONFIG;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// we need gethostbyname to convert numeric strings
|
|
||||||
if (node && hostlookup)
|
|
||||||
{
|
|
||||||
if (node == NULL)
|
|
||||||
return -1;
|
|
||||||
nodename = gethostbyname(node);
|
|
||||||
if (nodename == NULL)
|
|
||||||
{
|
|
||||||
if (inet_aton(node, &ipv4) != 0)
|
|
||||||
addrlen = 1;
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else while (nodename->h_addr_list[addrlen] != NULL)
|
|
||||||
addrlen++;
|
|
||||||
}
|
|
||||||
else if (node)
|
|
||||||
{
|
|
||||||
if (inet_aton(node, &ipv4) != 0)
|
|
||||||
addrlen = 1;
|
|
||||||
else if (!hostlookup)
|
|
||||||
return EAI_NONAME;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
addrlen = 1;
|
|
||||||
|
|
||||||
if (service) //AI_NUMERICSERV
|
|
||||||
sockport = atoi(service);
|
|
||||||
|
|
||||||
if (socktype == 0)
|
|
||||||
ailen = addrlen*3;
|
|
||||||
else
|
|
||||||
ailen = addrlen;
|
|
||||||
|
|
||||||
ai = calloc(ailen, sizeof(struct my_addrinfo));
|
|
||||||
if (ai == NULL)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
*res = ai;
|
|
||||||
|
|
||||||
addr = calloc(ailen*2, famsize);
|
|
||||||
if (addr == NULL)
|
|
||||||
{
|
|
||||||
free(ai);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ai->ai_addr = memset(addr, 0x00, ailen*ai->ai_addrlen);
|
|
||||||
|
|
||||||
for (i = 0; i < ailen; i++)
|
|
||||||
{
|
|
||||||
ai = *res+i;
|
|
||||||
ai->ai_flags = flags;
|
|
||||||
ai->ai_family = AF_INET;
|
|
||||||
ai->ai_socktype = socktype;
|
|
||||||
switch (ai->ai_socktype)
|
|
||||||
{
|
|
||||||
case SOCK_STREAM:
|
|
||||||
ai->ai_protocol = IPPROTO_TCP;
|
|
||||||
break;
|
|
||||||
case SOCK_DGRAM:
|
|
||||||
ai->ai_protocol = IPPROTO_UDP;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ai->ai_protocol = 0;
|
|
||||||
}
|
|
||||||
ai->ai_addrlen = famsize;
|
|
||||||
ai->ai_addr = (struct sockaddr *)&addr[i];
|
|
||||||
//ai_cannonname
|
|
||||||
ai->ai_next = ai+1;
|
|
||||||
}
|
|
||||||
ai->ai_next = NULL;
|
|
||||||
ai = *res;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < ailen; i++, j++)
|
|
||||||
{
|
|
||||||
ai = *res+i;
|
|
||||||
addr[i].sin_port = htons((UINT16)sockport);
|
|
||||||
if (nodename)
|
|
||||||
{
|
|
||||||
memcpy(&addr[i].sin_addr, nodename->h_addr_list[j], ai->ai_addrlen);
|
|
||||||
addr[i].sin_family = nodename->h_addrtype;
|
|
||||||
}
|
|
||||||
else if (node)
|
|
||||||
{
|
|
||||||
memcpy(&addr[i].sin_addr, &ipv4, ai->ai_addrlen);
|
|
||||||
addr[i].sin_family = AF_INET;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (passivemode)
|
|
||||||
addr[i].sin_addr.s_addr = htonl(INADDR_ANY);
|
|
||||||
else
|
|
||||||
addr[i].sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
|
||||||
addr[i].sin_family = AF_INET;
|
|
||||||
}
|
|
||||||
if (socktype == 0)
|
|
||||||
{
|
|
||||||
ai->ai_socktype = SOCK_STREAM;
|
|
||||||
ai->ai_protocol = IPPROTO_TCP;
|
|
||||||
memcpy(&addr[i+1], &addr[i], ai->ai_addrlen);
|
|
||||||
i++; ai++;
|
|
||||||
ai->ai_socktype = SOCK_DGRAM;
|
|
||||||
ai->ai_protocol = IPPROTO_UDP;
|
|
||||||
memcpy(&addr[i+1], &addr[i], ai->ai_addrlen);
|
|
||||||
i++; ai++;
|
|
||||||
ai->ai_socktype = SOCK_RAW;
|
|
||||||
ai->ai_protocol = IPPROTO_IP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef I_freeaddrinfo
|
|
||||||
void I_freeaddrinfo(struct my_addrinfo *res)
|
|
||||||
{
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
if (WS_freeaddrinfo)
|
|
||||||
{
|
|
||||||
WS_freeaddrinfo(res);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!res)
|
|
||||||
return;
|
|
||||||
free(res->ai_addr);
|
|
||||||
free(res);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TESTCASE
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
#define inet_ntop inet_ntopA
|
|
||||||
#define HAVE_NTOP
|
|
||||||
static const char* inet_ntopA(int af, const void *cp, char *buf, socklen_t len)
|
|
||||||
{
|
|
||||||
DWORD Dlen = len, AFlen = 0;
|
|
||||||
SOCKADDR_STORAGE any;
|
|
||||||
LPSOCKADDR anyp = (LPSOCKADDR)&any;
|
|
||||||
LPSOCKADDR_IN any4 = (LPSOCKADDR_IN)&any;
|
|
||||||
LPSOCKADDR_IN6 any6 = (LPSOCKADDR_IN6)&any;
|
|
||||||
|
|
||||||
if (!buf)
|
|
||||||
{
|
|
||||||
WSASetLastError(STATUS_INVALID_PARAMETER);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (af != AF_INET && af != AF_INET6)
|
|
||||||
{
|
|
||||||
WSASetLastError(WSAEAFNOSUPPORT);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZeroMemory(&any, sizeof(SOCKADDR_STORAGE));
|
|
||||||
any.ss_family = af;
|
|
||||||
|
|
||||||
switch (af)
|
|
||||||
{
|
|
||||||
case AF_INET:
|
|
||||||
{
|
|
||||||
CopyMemory(&any4->sin_addr, cp, sizeof(IN_ADDR));
|
|
||||||
AFlen = sizeof(SOCKADDR_IN);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case AF_INET6:
|
|
||||||
{
|
|
||||||
CopyMemory(&any6->sin6_addr, cp, sizeof(IN6_ADDR));
|
|
||||||
AFlen = sizeof(SOCKADDR_IN6);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WSAAddressToStringA(anyp, AFlen, NULL, buf, &Dlen) == SOCKET_ERROR)
|
|
||||||
return NULL;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
#elif defined (_WIN32)
|
|
||||||
// w32api, ws2tcpip.h, r1.12
|
|
||||||
static inline char* gai_strerror(int ecode)
|
|
||||||
{
|
|
||||||
static char message[1024+1];
|
|
||||||
DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM
|
|
||||||
| FORMAT_MESSAGE_IGNORE_INSERTS
|
|
||||||
| FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
|
||||||
DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
|
||||||
FormatMessageA(dwFlags, NULL, ecode, dwLanguageId, message, 1024, NULL);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define HAVE_NTOP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INET_ADDRSTRLEN
|
|
||||||
#define INET_ADDRSTRLEN 16
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline void printflags(int ai_flags)
|
|
||||||
{
|
|
||||||
printf("flags: %x(", ai_flags);
|
|
||||||
if (ai_flags == 0)
|
|
||||||
printf("NONE|");
|
|
||||||
#ifdef AI_PASSIVE
|
|
||||||
if ((ai_flags & AI_PASSIVE) == AI_PASSIVE)
|
|
||||||
printf("AI_PASSIVE|");
|
|
||||||
ai_flags &= ~AI_PASSIVE;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_CANONNAME
|
|
||||||
if ((ai_flags & AI_CANONNAME) == AI_CANONNAME)
|
|
||||||
printf("AI_CANONNAME|");
|
|
||||||
ai_flags &= ~AI_CANONNAME;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_NUMERICHOST
|
|
||||||
if ((ai_flags & AI_NUMERICHOST) == AI_NUMERICHOST)
|
|
||||||
printf("AI_NUMERICHOST|");
|
|
||||||
ai_flags &= ~AI_NUMERICHOST;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_V4MAPPED
|
|
||||||
if ((ai_flags & AI_V4MAPPED) == AI_V4MAPPED)
|
|
||||||
printf("AI_V4MAPPED|");
|
|
||||||
ai_flags &= ~AI_V4MAPPED;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_ALL
|
|
||||||
if ((ai_flags & AI_ALL) == AI_ALL)
|
|
||||||
printf("AI_ALL|");
|
|
||||||
ai_flags &= ~AI_ALL;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_ADDRCONFIG
|
|
||||||
if ((ai_flags & AI_ADDRCONFIG) == AI_ADDRCONFIG)
|
|
||||||
printf("AI_ADDRCONFIG|");
|
|
||||||
ai_flags &= ~AI_ADDRCONFIG;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_IDN
|
|
||||||
if ((ai_flags & AI_IDN) == AI_IDN)
|
|
||||||
printf("AI_IDN|");
|
|
||||||
ai_flags &= ~AI_IDN;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_CANONIDN
|
|
||||||
if ((ai_flags & AI_CANONIDN) == AI_CANONIDN)
|
|
||||||
printf("AI_CANONIDN|");
|
|
||||||
ai_flags &= ~AI_CANONIDN;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_IDN_ALLOW_UNASSIGNED
|
|
||||||
if ((ai_flags & AI_IDN_ALLOW_UNASSIGNED) == AI_IDN_ALLOW_UNASSIGNED)
|
|
||||||
printf("AI_IDN_ALLOW_UNASSIGNED|");
|
|
||||||
ai_flags &= ~AI_IDN_ALLOW_UNASSIGNED;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_IDN_USE_STD3_ASCII_RULES
|
|
||||||
if ((ai_flags & AI_IDN_USE_STD3_ASCII_RULES) == AI_IDN_USE_STD3_ASCII_RULES)
|
|
||||||
printf("AI_IDN_USE_STD3_ASCII_RULES|");
|
|
||||||
ai_flags &= ~AI_PASSIVE;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_NUMERICSERV
|
|
||||||
if ((ai_flags & AI_NUMERICSERV) == AI_NUMERICSERV)
|
|
||||||
printf("AI_NUMERICSERV|");
|
|
||||||
ai_flags &= ~AI_NUMERICSERV;
|
|
||||||
#endif
|
|
||||||
printf("%x", ai_flags);
|
|
||||||
printf(")\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void printsocktype(int ai_socktype)
|
|
||||||
{
|
|
||||||
printf("socktype: %d(", ai_socktype);
|
|
||||||
switch (ai_socktype)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
printf("SOCK_ Woe32");
|
|
||||||
break;
|
|
||||||
case SOCK_STREAM:
|
|
||||||
printf("SOCK_STREAM");
|
|
||||||
break;
|
|
||||||
case SOCK_DGRAM:
|
|
||||||
printf("SOCK_DGRAM");
|
|
||||||
break;
|
|
||||||
case SOCK_RAW:
|
|
||||||
printf("SOCK_RAW");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("SOCK_ERROR\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
printf(")\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void printprotocol(int ai_protocol)
|
|
||||||
{
|
|
||||||
printf("protocol: %d(", ai_protocol);
|
|
||||||
switch (ai_protocol)
|
|
||||||
{
|
|
||||||
case IPPROTO_IP:
|
|
||||||
printf("IPPROTO_IP");
|
|
||||||
break;
|
|
||||||
case IPPROTO_TCP:
|
|
||||||
printf("IPPROTO_TCP");
|
|
||||||
break;
|
|
||||||
case IPPROTO_UDP:
|
|
||||||
printf("IPPROTO_UDP");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("IPPROTO_ERROR\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
printf(")\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void printaddr(int ai_family, const struct sockaddr *ai_addr)
|
|
||||||
{
|
|
||||||
char str[INET_ADDRSTRLEN+1] = "FAKE";
|
|
||||||
printf("family: %d(", ai_family);
|
|
||||||
switch (ai_family)
|
|
||||||
{
|
|
||||||
case AF_UNSPEC:
|
|
||||||
printf("AF_UNSPEC");
|
|
||||||
break;
|
|
||||||
case AF_INET:
|
|
||||||
printf("AF_INET");
|
|
||||||
break;
|
|
||||||
#ifdef AF_INET6
|
|
||||||
case AF_INET6:
|
|
||||||
printf("AF_INET6");
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
printf("AF_ERROR\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
printf(")\n");
|
|
||||||
if (ai_family == AF_INET && ai_addr)
|
|
||||||
{
|
|
||||||
const struct sockaddr_in *ip4 = (void *)ai_addr;
|
|
||||||
#ifdef HAVE_NTOP
|
|
||||||
inet_ntop(ai_family, &ip4->sin_addr, str, INET_ADDRSTRLEN);
|
|
||||||
#else
|
|
||||||
strncpy(str, inet_ntoa(ip4->sin_addr), INET_ADDRSTRLEN);
|
|
||||||
#endif
|
|
||||||
printf("port: %d\n", ntohs(ip4->sin_port));
|
|
||||||
}
|
|
||||||
printf("addr: %s\n", str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printaddrinfo(const struct my_addrinfo *data)
|
|
||||||
{
|
|
||||||
if(data == NULL)
|
|
||||||
{
|
|
||||||
printf("no data\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf("starting addrinfo dump\n");
|
|
||||||
while (data != NULL)
|
|
||||||
{
|
|
||||||
printflags(data->ai_flags);
|
|
||||||
printsocktype(data->ai_socktype);
|
|
||||||
printaddr(data->ai_family, data->ai_addr);
|
|
||||||
printprotocol(data->ai_protocol);
|
|
||||||
//addrlen
|
|
||||||
data = data->ai_next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct my_addrinfo *res = NULL, hints;
|
|
||||||
int gaie;
|
|
||||||
|
|
||||||
(void)argc;
|
|
||||||
(void)argv;
|
|
||||||
memset(&hints, 0x00, sizeof(struct my_addrinfo));
|
|
||||||
hints.ai_family = AF_INET;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
{
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
const WORD VerNeed = MAKEWORD(2,2);
|
|
||||||
#else
|
|
||||||
const WORD VerNeed = MAKEWORD(1,1);
|
|
||||||
#endif
|
|
||||||
WSADATA WSAData;
|
|
||||||
WSAStartup(VerNeed, &WSAData);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
#ifndef _WIN32 //NULL as res crashes Win32
|
|
||||||
gaie = I_getaddrinfo(NULL, NULL, &hints, NULL);
|
|
||||||
if (gaie != EAI_NONAME)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
I_freeaddrinfo(res);
|
|
||||||
#endif
|
|
||||||
#if 0 //NULL as res crashes
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", NULL, NULL);
|
|
||||||
if (gaie == 0)
|
|
||||||
printf("NULL crashes: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
I_freeaddrinfo(res);
|
|
||||||
#endif
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
|
||||||
hints.ai_protocol = IPPROTO_TCP;
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_socktype = SOCK_DGRAM;
|
|
||||||
hints.ai_protocol = IPPROTO_UDP;
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_flags = AI_NUMERICHOST;
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
gaie = I_getaddrinfo("127.0.0.1", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("127.0.0.1", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
gaie = I_getaddrinfo("255.255.255.255", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("255.255.255.255", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_flags = AI_PASSIVE;
|
|
||||||
gaie = I_getaddrinfo("0.0.0.0", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("0.0.0.0", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2011-2018 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file i_addrinfo.h
|
|
||||||
/// \brief getaddrinfo stub
|
|
||||||
|
|
||||||
#ifndef __I_ADDRINFO__
|
|
||||||
#define __I_ADDRINFO__
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma interface
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AI_PASSIVE
|
|
||||||
#define AI_PASSIVE 0x01
|
|
||||||
#endif
|
|
||||||
#ifndef AI_NUMERICHOST
|
|
||||||
#define AI_NUMERICHOST 0x04
|
|
||||||
#endif
|
|
||||||
#ifndef AI_V4MAPPED
|
|
||||||
#define AI_V4MAPPED 0x08
|
|
||||||
#endif
|
|
||||||
#ifndef AI_ADDRCONFIG
|
|
||||||
#define AI_ADDRCONFIG 0x20
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef EAI_NONAME
|
|
||||||
#define EAI_NONAME WSAHOST_NOT_FOUND
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EAI_NONAME
|
|
||||||
#define EAI_NONAME -2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32 // already use the stub for Win32
|
|
||||||
// w32api, ws2tcpip.h, r1.12
|
|
||||||
struct my_addrinfo {
|
|
||||||
int ai_flags;
|
|
||||||
int ai_family;
|
|
||||||
int ai_socktype;
|
|
||||||
int ai_protocol;
|
|
||||||
size_t ai_addrlen;
|
|
||||||
char *ai_canonname;
|
|
||||||
struct sockaddr *ai_addr;
|
|
||||||
struct my_addrinfo *ai_next;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
#define my_addrinfo addrinfo
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WS_addrinfocleanup(void);
|
|
||||||
|
|
||||||
#ifndef my_addrinfo
|
|
||||||
void I_freeaddrinfo(struct my_addrinfo *res);
|
|
||||||
int I_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct my_addrinfo *hints,
|
|
||||||
struct my_addrinfo **res);
|
|
||||||
#elif !defined (test_stub)
|
|
||||||
#define I_getaddrinfo getaddrinfo
|
|
||||||
#define I_freeaddrinfo freeaddrinfo
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
+106
-117
@@ -28,43 +28,37 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define USE_WINSOCK
|
#define USE_WINSOCK
|
||||||
#if defined (_WIN64) || defined (HAVE_IPV6)
|
|
||||||
#define USE_WINSOCK2
|
|
||||||
#else //_WIN64/HAVE_IPV6
|
|
||||||
#define USE_WINSOCK1
|
|
||||||
#endif
|
|
||||||
#endif //WIN32 OS
|
#endif //WIN32 OS
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
#ifdef USE_WINSOCK
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
#define addrinfo_t ADDRINFOA
|
||||||
|
#else
|
||||||
|
#define addrinfo_t struct addrinfo
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
||||||
|
#ifndef USE_WINSOCK
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#ifdef __APPLE_CC__
|
||||||
|
#ifndef _BSD_SOCKLEN_T_
|
||||||
|
#define _BSD_SOCKLEN_T_
|
||||||
|
#endif //_BSD_SOCKLEN_T_
|
||||||
|
#endif //__APPLE_CC__
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#endif //normal BSD API
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef USE_WINSOCK1
|
|
||||||
#include <winsock.h>
|
|
||||||
#else
|
|
||||||
#ifndef USE_WINSOCK
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#ifdef __APPLE_CC__
|
|
||||||
#ifndef _BSD_SOCKLEN_T_
|
|
||||||
#define _BSD_SOCKLEN_T_
|
|
||||||
#endif //_BSD_SOCKLEN_T_
|
|
||||||
#endif //__APPLE_CC__
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#endif //normal BSD API
|
|
||||||
|
|
||||||
#include <errno.h>
|
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||||
|
#include <sys/time.h>
|
||||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
#endif // UNIXCOMMON
|
||||||
#include <sys/time.h>
|
|
||||||
#endif // UNIXCOMMON
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
// some undefined under win32
|
// some undefined under win32
|
||||||
@@ -152,27 +146,22 @@ static UINT8 UPNP_support = TRUE;
|
|||||||
#define close closesocket
|
#define close closesocket
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "i_addrinfo.h"
|
|
||||||
#define DEFAULTPORT "5029"
|
#define DEFAULTPORT "5029"
|
||||||
|
|
||||||
#if defined (USE_WINSOCK)
|
#ifdef USE_WINSOCK
|
||||||
typedef SOCKET SOCKET_TYPE;
|
typedef SOCKET SOCKET_TYPE;
|
||||||
#define ERRSOCKET (SOCKET_ERROR)
|
#define ERRSOCKET (SOCKET_ERROR)
|
||||||
#else
|
#else
|
||||||
#if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__)
|
#if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__)
|
||||||
typedef int SOCKET_TYPE;
|
typedef int SOCKET_TYPE;
|
||||||
#else
|
#else
|
||||||
typedef unsigned long SOCKET_TYPE;
|
typedef unsigned long SOCKET_TYPE;
|
||||||
#endif
|
#endif
|
||||||
#define ERRSOCKET (-1)
|
#define ERRSOCKET (-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12"
|
#define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12"
|
||||||
|
|
||||||
#ifdef USE_WINSOCK1
|
|
||||||
typedef int socklen_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
mysockaddr_t address;
|
mysockaddr_t address;
|
||||||
@@ -232,9 +221,8 @@ static char *get_WSAErrorStr(int e)
|
|||||||
#define strerror get_WSAErrorStr
|
#define strerror get_WSAErrorStr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
#ifdef USE_WINSOCK
|
||||||
#define inet_ntop inet_ntopA
|
#define inet_ntop inet_ntopA
|
||||||
#define HAVE_NTOP
|
|
||||||
static const char* inet_ntopA(short af, const void *cp, char *buf, socklen_t len)
|
static const char* inet_ntopA(short af, const void *cp, char *buf, socklen_t len)
|
||||||
{
|
{
|
||||||
DWORD Dlen = len, AFlen = 0;
|
DWORD Dlen = len, AFlen = 0;
|
||||||
@@ -278,8 +266,6 @@ static const char* inet_ntopA(short af, const void *cp, char *buf, socklen_t len
|
|||||||
return NULL;
|
return NULL;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#elif !defined (USE_WINSOCK1)
|
|
||||||
#define HAVE_NTOP
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MINIUPNPC // based on old XChat patch
|
#ifdef HAVE_MINIUPNPC // based on old XChat patch
|
||||||
@@ -359,18 +345,15 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
|||||||
{
|
{
|
||||||
static char s[64]; // 255.255.255.255:65535 or
|
static char s[64]; // 255.255.255.255:65535 or
|
||||||
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
||||||
|
|
||||||
#ifdef HAVE_NTOP
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
int v6 = (sk->any.sa_family == AF_INET6);
|
int v6 = (sk->any.sa_family == AF_INET6);
|
||||||
#else
|
#else
|
||||||
int v6 = 0;
|
int v6 = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void *addr;
|
void *addr;
|
||||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||||
|
|
||||||
if(sk->any.sa_family == AF_INET)
|
if (sk->any.sa_family == AF_INET)
|
||||||
addr = &sk->ip4.sin_addr;
|
addr = &sk->ip4.sin_addr;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
else if(sk->any.sa_family == AF_INET6)
|
else if(sk->any.sa_family == AF_INET6)
|
||||||
@@ -379,9 +362,11 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
|||||||
else
|
else
|
||||||
addr = NULL;
|
addr = NULL;
|
||||||
|
|
||||||
if(addr == NULL)
|
if (addr == NULL)
|
||||||
|
{
|
||||||
sprintf(s, "No address");
|
sprintf(s, "No address");
|
||||||
else if(inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
}
|
||||||
|
else if (inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
||||||
{
|
{
|
||||||
e = errno;
|
e = errno;
|
||||||
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e));
|
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e));
|
||||||
@@ -396,17 +381,9 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
|||||||
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if(sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
else if (sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||||
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
||||||
#else
|
|
||||||
if (sk->any.sa_family == AF_INET)
|
|
||||||
{
|
|
||||||
strcpy(s, inet_ntoa(sk->ip4.sin_addr));
|
|
||||||
if (sk->ip4.sin_port != 0) strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sprintf(s, "Unknown type");
|
|
||||||
#endif
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +481,6 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is a hack. For some reason, nodes aren't being freed properly.
|
// This is a hack. For some reason, nodes aren't being freed properly.
|
||||||
// This goes through and cleans up what nodes were supposed to be freed.
|
// This goes through and cleans up what nodes were supposed to be freed.
|
||||||
/** \warning This function causes the file downloading to stop if someone joins.
|
/** \warning This function causes the file downloading to stop if someone joins.
|
||||||
@@ -659,7 +635,7 @@ static boolean SOCK_Get(void)
|
|||||||
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
|
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
|
||||||
(void *)&fromaddress, &fromlen);
|
(void *)&fromaddress, &fromlen);
|
||||||
|
|
||||||
if (c > 0)
|
if (c != ERRSOCKET)
|
||||||
{
|
{
|
||||||
#ifdef USE_STUN
|
#ifdef USE_STUN
|
||||||
if (STUN_got_response(doomcom->data, c))
|
if (STUN_got_response(doomcom->data, c))
|
||||||
@@ -675,20 +651,21 @@ static boolean SOCK_Get(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// find remote node number
|
// find remote node number
|
||||||
for (j = 1; j <= MAXNETNODES; j++) //include LAN
|
for (j = 1; j <= MAXNETNODES; j++) // include LAN
|
||||||
{
|
{
|
||||||
if (SOCK_cmpaddr(&fromaddress, &clientaddress[j], 0))
|
if (SOCK_cmpaddr(&fromaddress, &clientaddress[j], 0))
|
||||||
{
|
{
|
||||||
doomcom->remotenode = (INT16)j; // good packet from a game player
|
doomcom->remotenode = (INT16)j; // good packet from a game player
|
||||||
doomcom->datalength = (INT16)c;
|
doomcom->datalength = (INT16)c;
|
||||||
nodesocket[j] = mysockets[n];
|
nodesocket[j] = mysockets[n];
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// not found
|
// not found
|
||||||
|
|
||||||
// find a free slot
|
// find a free slot
|
||||||
j = getfreenode();
|
j = getfreenode();
|
||||||
|
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
const time_t curTime = time(NULL);
|
const time_t curTime = time(NULL);
|
||||||
@@ -775,7 +752,7 @@ static void SOCK_Send(void)
|
|||||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
if (!nodeconnected[doomcom->remotenode])
|
if (doomcom->remotenode < 0 || !nodeconnected[doomcom->remotenode])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (doomcom->remotenode == BROADCASTADDR)
|
if (doomcom->remotenode == BROADCASTADDR)
|
||||||
@@ -868,15 +845,11 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
|||||||
|
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
{ // Alam_GBC: disable the new UDP connection reset behavior for Win2k and up
|
{ // Alam_GBC: disable the new UDP connection reset behavior for Win2k and up
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
DWORD dwBytesReturned = 0;
|
DWORD dwBytesReturned = 0;
|
||||||
BOOL bfalse = FALSE;
|
BOOL bfalse = FALSE;
|
||||||
rc = WSAIoctl(s, SIO_UDP_CONNRESET, &bfalse, sizeof(bfalse),
|
rc = WSAIoctl(s, SIO_UDP_CONNRESET, &bfalse, sizeof(bfalse),
|
||||||
NULL, 0, &dwBytesReturned, NULL, NULL);
|
NULL, 0, &dwBytesReturned, NULL, NULL);
|
||||||
#else
|
|
||||||
unsigned long falseval = false;
|
|
||||||
rc = ioctl(s, SIO_UDP_CONNRESET, &falseval);
|
|
||||||
#endif
|
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
{
|
{
|
||||||
e = errno;
|
e = errno;
|
||||||
@@ -997,7 +970,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
|||||||
e = errno;
|
e = errno;
|
||||||
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
|
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
|
||||||
}
|
}
|
||||||
CONS_Printf(M_GetText("Network system buffer: %dKb\n"), opt>>10);
|
CONS_Printf(M_GetText("Network receive buffer: %dKb\n"), opt>>10);
|
||||||
|
|
||||||
if (opt < 64<<10) // 64k
|
if (opt < 64<<10) // 64k
|
||||||
{
|
{
|
||||||
@@ -1018,9 +991,44 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opt < 64<<10)
|
if (opt < 64<<10)
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Can't set buffer length to 64k, file transfer will be bad\n"));
|
CONS_Alert(CONS_WARNING, M_GetText("Can't set receive buffer length to 64k, file transfer will be bad\n"));
|
||||||
else
|
else
|
||||||
CONS_Printf(M_GetText("Network system buffer set to: %dKb\n"), opt>>10);
|
CONS_Printf(M_GetText("Network receive buffer set to: %dKb\n"), opt>>10);
|
||||||
|
}
|
||||||
|
|
||||||
|
opt = 0;
|
||||||
|
opts = (socklen_t)sizeof(opt);
|
||||||
|
rc = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, &opts);
|
||||||
|
if (rc <= -1)
|
||||||
|
{
|
||||||
|
e = errno;
|
||||||
|
I_OutputMsg("getting SO_SNDBUF failed: #%u, %s\n", e, strerror(e));
|
||||||
|
}
|
||||||
|
CONS_Printf(M_GetText("Network send buffer: %dKb\n"), opt>>10);
|
||||||
|
|
||||||
|
if (opt < 64<<10) // 64k
|
||||||
|
{
|
||||||
|
opt = 64<<10;
|
||||||
|
opts = (socklen_t)sizeof(opt);
|
||||||
|
rc = setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, opts);
|
||||||
|
if (rc <= -1)
|
||||||
|
{
|
||||||
|
e = errno;
|
||||||
|
I_OutputMsg("setting SO_SNDBUF to %dKb failed: #%u, %s\n", opt>>10, e, strerror(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
opt = 0;
|
||||||
|
rc = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, &opts);
|
||||||
|
if (rc <= -1)
|
||||||
|
{
|
||||||
|
e = errno;
|
||||||
|
I_OutputMsg("getting SO_SNDBUF failed: #%u, %s\n", e, strerror(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opt < 64<<10)
|
||||||
|
CONS_Alert(CONS_WARNING, M_GetText("Can't set send buffer length to 64k, file transfer will be bad\n"));
|
||||||
|
else
|
||||||
|
CONS_Printf(M_GetText("Network send system buffer set to: %dKb\n"), opt>>10);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = getsockname(s, &straddr.any, &len);
|
rc = getsockname(s, &straddr.any, &len);
|
||||||
@@ -1046,7 +1054,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
|||||||
static boolean UDP_Socket(void)
|
static boolean UDP_Socket(void)
|
||||||
{
|
{
|
||||||
size_t s;
|
size_t s;
|
||||||
struct my_addrinfo *ai, *runp, hints;
|
addrinfo_t *ai, *runp, hints;
|
||||||
int gaie;
|
int gaie;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
||||||
@@ -1075,7 +1083,7 @@ static boolean UDP_Socket(void)
|
|||||||
{
|
{
|
||||||
while (M_IsNextParm())
|
while (M_IsNextParm())
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
gaie = getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1089,13 +1097,13 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
gaie = getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1116,7 +1124,7 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1128,7 +1136,7 @@ static boolean UDP_Socket(void)
|
|||||||
{
|
{
|
||||||
while (M_IsNextParm())
|
while (M_IsNextParm())
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
gaie = getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1142,13 +1150,13 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo("::", serv, &hints, &ai);
|
gaie = getaddrinfo("::", serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1162,7 +1170,7 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1216,11 +1224,7 @@ boolean I_InitTcpDriver(void)
|
|||||||
if (!init_tcp_driver)
|
if (!init_tcp_driver)
|
||||||
{
|
{
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
const WORD VerNeed = MAKEWORD(2,2);
|
const WORD VerNeed = MAKEWORD(2,2);
|
||||||
#else
|
|
||||||
const WORD VerNeed = MAKEWORD(1,1);
|
|
||||||
#endif
|
|
||||||
WSADATA WSAData;
|
WSADATA WSAData;
|
||||||
const int WSAresult = WSAStartup(VerNeed, &WSAData);
|
const int WSAresult = WSAStartup(VerNeed, &WSAData);
|
||||||
if (WSAresult != 0)
|
if (WSAresult != 0)
|
||||||
@@ -1247,21 +1251,14 @@ boolean I_InitTcpDriver(void)
|
|||||||
if (WSAresult != WSAVERNOTSUPPORTED)
|
if (WSAresult != WSAVERNOTSUPPORTED)
|
||||||
CONS_Debug(DBG_NETPLAY, "WinSock(TCP/IP) error: %s\n",WSError);
|
CONS_Debug(DBG_NETPLAY, "WinSock(TCP/IP) error: %s\n",WSError);
|
||||||
}
|
}
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
if(LOBYTE(WSAData.wVersion) != 2 ||
|
if (LOBYTE(WSAData.wVersion) != 2 ||
|
||||||
HIBYTE(WSAData.wVersion) != 2)
|
HIBYTE(WSAData.wVersion) != 2)
|
||||||
{
|
{
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
CONS_Debug(DBG_NETPLAY, "No WinSock(TCP/IP) 2.2 driver detected\n");
|
CONS_Debug(DBG_NETPLAY, "No WinSock(TCP/IP) 2.2 driver detected\n");
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (LOBYTE(WSAData.wVersion) != 1 ||
|
|
||||||
HIBYTE(WSAData.wVersion) != 1)
|
|
||||||
{
|
|
||||||
WSACleanup();
|
|
||||||
CONS_Debug(DBG_NETPLAY, "No WinSock(TCP/IP) 1.1 driver detected\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
|
CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
|
||||||
CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
|
CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
|
||||||
#endif
|
#endif
|
||||||
@@ -1301,35 +1298,31 @@ void I_ShutdownTcpDriver(void)
|
|||||||
|
|
||||||
CONS_Printf("I_ShutdownTcpDriver: ");
|
CONS_Printf("I_ShutdownTcpDriver: ");
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
WS_addrinfocleanup();
|
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
CONS_Printf("shut down\n");
|
CONS_Printf("shut down\n");
|
||||||
init_tcp_driver = false;
|
init_tcp_driver = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
static boolean SOCK_GetAddr(mysockaddr_t *sin, const char *address, const char *port, boolean test)
|
||||||
{
|
{
|
||||||
struct my_addrinfo *ai = NULL, *runp, hints;
|
addrinfo_t *ai, *runp, hints;
|
||||||
int gaie;
|
int gaie;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!port || !port[0])
|
if (!port || !port[0])
|
||||||
port = DEFAULTPORT;
|
port = DEFAULTPORT;
|
||||||
|
|
||||||
memset (&hints, 0x00, sizeof (hints));
|
memset(&hints, 0x00, sizeof (hints));
|
||||||
hints.ai_flags = AI_ADDRCONFIG;
|
hints.ai_flags = AI_ADDRCONFIG;
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
hints.ai_socktype = SOCK_DGRAM;
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
hints.ai_protocol = IPPROTO_UDP;
|
hints.ai_protocol = IPPROTO_UDP;
|
||||||
|
|
||||||
gaie = I_getaddrinfo(address, port, &hints, &ai);
|
gaie = getaddrinfo(address, port, &hints, &ai);
|
||||||
|
|
||||||
if (gaie != 0)
|
if (gaie != 0)
|
||||||
{
|
|
||||||
I_freeaddrinfo(ai);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
runp = ai;
|
runp = ai;
|
||||||
|
|
||||||
@@ -1356,7 +1349,7 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
|
|||||||
if (runp != NULL)
|
if (runp != NULL)
|
||||||
memcpy(sin, runp->ai_addr, runp->ai_addrlen);
|
memcpy(sin, runp->ai_addr, runp->ai_addrlen);
|
||||||
|
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
return (runp != NULL);
|
return (runp != NULL);
|
||||||
}
|
}
|
||||||
@@ -1369,7 +1362,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
|
|||||||
|
|
||||||
if (newnode != -1)
|
if (newnode != -1)
|
||||||
{
|
{
|
||||||
if (!SOCK_GetAddr(&clientaddress[newnode].ip4, address, port, true))
|
if (!SOCK_GetAddr(&clientaddress[newnode], address, port, true))
|
||||||
{
|
{
|
||||||
nodeconnected[newnode] = false;
|
nodeconnected[newnode] = false;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1397,7 +1390,7 @@ static void rendezvous(int size)
|
|||||||
|
|
||||||
if (tic != refreshtic)
|
if (tic != refreshtic)
|
||||||
{
|
{
|
||||||
if (SOCK_GetAddr(&rzv.ip4, host, (port ? port : "7777"), false))
|
if (SOCK_GetAddr(&rzv, host, (port ? port : "7777"), false))
|
||||||
{
|
{
|
||||||
refreshtic = tic;
|
refreshtic = tic;
|
||||||
}
|
}
|
||||||
@@ -1554,7 +1547,7 @@ static boolean SOCK_SetUnbanTime(time_t timestamp)
|
|||||||
|
|
||||||
static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
||||||
{
|
{
|
||||||
struct my_addrinfo *ai, *runp, hints;
|
addrinfo_t *ai, *runp, hints;
|
||||||
int gaie;
|
int gaie;
|
||||||
|
|
||||||
if (!address)
|
if (!address)
|
||||||
@@ -1566,7 +1559,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
|||||||
hints.ai_socktype = SOCK_DGRAM;
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
hints.ai_protocol = IPPROTO_UDP;
|
hints.ai_protocol = IPPROTO_UDP;
|
||||||
|
|
||||||
gaie = I_getaddrinfo(address, "0", &hints, &ai);
|
gaie = getaddrinfo(address, "0", &hints, &ai);
|
||||||
if (gaie != 0)
|
if (gaie != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1611,7 +1604,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
|||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1660,8 +1653,6 @@ boolean I_InitTcpNetwork(void)
|
|||||||
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
|
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
doomcom->numnodes = 0;
|
doomcom->numnodes = 0;
|
||||||
/* else if (M_IsNextParm())
|
|
||||||
doomcom->numnodes = (INT16)atoi(M_GetNextParm());*/
|
|
||||||
else
|
else
|
||||||
doomcom->numnodes = 1;
|
doomcom->numnodes = 1;
|
||||||
|
|
||||||
@@ -1746,5 +1737,3 @@ boolean I_InitTcpNetwork(void)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "i_addrinfo.c"
|
|
||||||
+1
-1
@@ -94,8 +94,8 @@ INT32 VID_SetMode(INT32 modenum);
|
|||||||
\return name of video mode
|
\return name of video mode
|
||||||
*/
|
*/
|
||||||
const char *VID_GetModeName(INT32 modenum);
|
const char *VID_GetModeName(INT32 modenum);
|
||||||
void VID_PrepareModeList(void); /// note hack for SDL
|
|
||||||
|
|
||||||
|
void VID_PrepareModeList(void);
|
||||||
|
|
||||||
/** \brief can video system do fullscreen
|
/** \brief can video system do fullscreen
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -4333,7 +4333,7 @@ static void K_drawInput(void)
|
|||||||
target = 0;
|
target = 0;
|
||||||
else // turning of multiple strengths!
|
else // turning of multiple strengths!
|
||||||
{
|
{
|
||||||
target = ((abs(cmd->driftturn) - 1)/125)+1;
|
target = ((abs(cmd->driftturn) - 1)/200)+1; // was 125, do we need another toggle for this? Zzz...
|
||||||
if (target > 4)
|
if (target > 4)
|
||||||
target = 4;
|
target = 4;
|
||||||
if (cmd->driftturn < 0)
|
if (cmd->driftturn < 0)
|
||||||
|
|||||||
+4
-4
@@ -608,9 +608,6 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
|
|||||||
if (color >= MAXTRANSLATIONS)
|
if (color >= MAXTRANSLATIONS)
|
||||||
I_Error("Invalid skin color #%hu.", (UINT16)color);
|
I_Error("Invalid skin color #%hu.", (UINT16)color);
|
||||||
|
|
||||||
if (skinnum < 0 && skinnum > TC_DEFAULT)
|
|
||||||
I_Error("Invalid translation colormap index %d.", skinnum);
|
|
||||||
|
|
||||||
starttranscolor = (skinnum != TC_DEFAULT) ? K_GetSkinArray(local)[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
starttranscolor = (skinnum != TC_DEFAULT) ? K_GetSkinArray(local)[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||||
|
|
||||||
if (starttranscolor >= NUM_PALETTE_ENTRIES)
|
if (starttranscolor >= NUM_PALETTE_ENTRIES)
|
||||||
@@ -640,11 +637,14 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
|
|||||||
UINT8 K_GetKartColorByName(const char *name)
|
UINT8 K_GetKartColorByName(const char *name)
|
||||||
{
|
{
|
||||||
UINT8 color = (UINT8)atoi(name);
|
UINT8 color = (UINT8)atoi(name);
|
||||||
|
|
||||||
if (color > 0 && color < MAXSKINCOLORS)
|
if (color > 0 && color < MAXSKINCOLORS)
|
||||||
return color;
|
return color;
|
||||||
|
|
||||||
for (color = 1; color < MAXSKINCOLORS; color++)
|
for (color = 1; color < MAXSKINCOLORS; color++)
|
||||||
if (!stricmp(KartColor_Names[color], name))
|
if (fasticmp(KartColor_Names[color], name))
|
||||||
return color;
|
return color;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file k_stats.c
|
||||||
|
/// \brief Game statistics handling
|
||||||
|
|
||||||
#include "k_stats.h"
|
#include "k_stats.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file k_stats.h
|
||||||
|
/// \brief Game statistics handling
|
||||||
|
|
||||||
#ifndef __K_STATS__
|
#ifndef __K_STATS__
|
||||||
#define __K_STATS__
|
#define __K_STATS__
|
||||||
|
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ static int lib_cvRegisterVar(lua_State *L)
|
|||||||
if (cvar->flags & CV_MODIFIED)
|
if (cvar->flags & CV_MODIFIED)
|
||||||
return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
|
return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
|
||||||
|
|
||||||
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && stricmp(cvar->string, "0"))))
|
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && !fasticmp(cvar->string, "0"))))
|
||||||
{
|
{
|
||||||
if (!category)
|
if (!category)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -83,7 +83,7 @@ FUNCINLINE static ATTRINLINE unsigned hook_in_list
|
|||||||
|
|
||||||
for (type = 0; list[type] != NULL; ++type)
|
for (type = 0; list[type] != NULL; ++type)
|
||||||
{
|
{
|
||||||
if (strcmp(name, list[type]) == 0)
|
if (fastcmp(name, list[type]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ static int lib_addHook(lua_State *L)
|
|||||||
{
|
{
|
||||||
add_hook(&hookIds[type]);
|
add_hook(&hookIds[type]);
|
||||||
}
|
}
|
||||||
/*else if (strcmp(name, "HUD") == 0) // ehh this is cool and all, but i dont want modders potentially breaking vanilla clients lol
|
/*else if (fastcmp(name, "HUD")) // ehh this is cool and all, but i dont want modders potentially breaking vanilla clients lol
|
||||||
{
|
{
|
||||||
add_hud_hook(L, 3);
|
add_hud_hook(L, 3);
|
||||||
}*/
|
}*/
|
||||||
@@ -818,7 +818,7 @@ typedef struct {
|
|||||||
|
|
||||||
FUNCINLINE static ATTRINLINE boolean checkbotkey(const char *field)
|
FUNCINLINE static ATTRINLINE boolean checkbotkey(const char *field)
|
||||||
{
|
{
|
||||||
return lua_toboolean(gL, -1) && strcmp(lua_tostring(gL, -2), field) == 0;
|
return lua_toboolean(gL, -1) && fastcmp(lua_tostring(gL, -2), field);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void res_botai(Hook_State *hook)
|
static void res_botai(Hook_State *hook)
|
||||||
|
|||||||
+3
-3
@@ -455,12 +455,12 @@ int mobj_localskin_setter(lua_State *L)
|
|||||||
strlcpy(skin, luaL_optstring(L, 2, "none"), sizeof skin);
|
strlcpy(skin, luaL_optstring(L, 2, "none"), sizeof skin);
|
||||||
strlwr(skin); // all skin names are lowercase
|
strlwr(skin); // all skin names are lowercase
|
||||||
|
|
||||||
if (stricmp(skin, "none"))
|
if (!fasticmp(skin, "none"))
|
||||||
{
|
{
|
||||||
// Try localskins
|
// Try localskins
|
||||||
for (i = 0; i < numlocalskins; i++)
|
for (i = 0; i < numlocalskins; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(localskins[i].name, skin) == 0)
|
if (fasticmp(localskins[i].name, skin))
|
||||||
{
|
{
|
||||||
mo->localskin = &localskins[i];
|
mo->localskin = &localskins[i];
|
||||||
mo->skinlocal = true;
|
mo->skinlocal = true;
|
||||||
@@ -471,7 +471,7 @@ int mobj_localskin_setter(lua_State *L)
|
|||||||
// Try other skins
|
// Try other skins
|
||||||
for (i = 0; i < numskins; i++)
|
for (i = 0; i < numskins; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(skins[i].name, skin) == 0)
|
if (fasticmp(skins[i].name, skin))
|
||||||
{
|
{
|
||||||
mo->localskin = &skins[i];
|
mo->localskin = &skins[i];
|
||||||
mo->skinlocal = false;
|
mo->skinlocal = false;
|
||||||
|
|||||||
+64
-16
@@ -288,6 +288,10 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
|
|||||||
lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
|
lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
|
||||||
len += 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
len += 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||||
name = malloc(len+1);
|
name = malloc(len+1);
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
I_Error("LUA_LoadLump: Out of memory!\n");
|
||||||
|
|
||||||
sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->fullname);
|
sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->fullname);
|
||||||
name[len] = '\0';
|
name[len] = '\0';
|
||||||
}
|
}
|
||||||
@@ -797,8 +801,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
mobj_t *mobj = *((mobj_t **)lua_touserdata(gL, myindex));
|
mobj_t *mobj = *((mobj_t **)lua_touserdata(gL, myindex));
|
||||||
if (!mobj)
|
if (!mobj)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_MOBJ);
|
WRITEUINT8(*p, ARCH_MOBJ);
|
||||||
WRITEUINT32(*p, mobj->mobjnum);
|
WRITEUINT32(*p, mobj->mobjnum);
|
||||||
}
|
}
|
||||||
@@ -808,8 +816,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
player_t *player = *((player_t **)lua_touserdata(gL, myindex));
|
player_t *player = *((player_t **)lua_touserdata(gL, myindex));
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_PLAYER);
|
WRITEUINT8(*p, ARCH_PLAYER);
|
||||||
WRITEUINT8(*p, player - players);
|
WRITEUINT8(*p, player - players);
|
||||||
}
|
}
|
||||||
@@ -819,8 +831,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
mapthing_t *mapthing = *((mapthing_t **)lua_touserdata(gL, myindex));
|
mapthing_t *mapthing = *((mapthing_t **)lua_touserdata(gL, myindex));
|
||||||
if (!mapthing)
|
if (!mapthing)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_MAPTHING);
|
WRITEUINT8(*p, ARCH_MAPTHING);
|
||||||
WRITEUINT16(*p, mapthing - mapthings);
|
WRITEUINT16(*p, mapthing - mapthings);
|
||||||
}
|
}
|
||||||
@@ -830,8 +846,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
vertex_t *vertex = *((vertex_t **)lua_touserdata(gL, myindex));
|
vertex_t *vertex = *((vertex_t **)lua_touserdata(gL, myindex));
|
||||||
if (!vertex)
|
if (!vertex)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_VERTEX);
|
WRITEUINT8(*p, ARCH_VERTEX);
|
||||||
WRITEUINT16(*p, vertex - vertexes);
|
WRITEUINT16(*p, vertex - vertexes);
|
||||||
}
|
}
|
||||||
@@ -841,8 +861,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
line_t *line = *((line_t **)lua_touserdata(gL, myindex));
|
line_t *line = *((line_t **)lua_touserdata(gL, myindex));
|
||||||
if (!line)
|
if (!line)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_LINE);
|
WRITEUINT8(*p, ARCH_LINE);
|
||||||
WRITEUINT16(*p, line - lines);
|
WRITEUINT16(*p, line - lines);
|
||||||
}
|
}
|
||||||
@@ -852,8 +876,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
side_t *side = *((side_t **)lua_touserdata(gL, myindex));
|
side_t *side = *((side_t **)lua_touserdata(gL, myindex));
|
||||||
if (!side)
|
if (!side)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SIDE);
|
WRITEUINT8(*p, ARCH_SIDE);
|
||||||
WRITEUINT16(*p, side - sides);
|
WRITEUINT16(*p, side - sides);
|
||||||
}
|
}
|
||||||
@@ -863,8 +891,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
subsector_t *subsector = *((subsector_t **)lua_touserdata(gL, myindex));
|
subsector_t *subsector = *((subsector_t **)lua_touserdata(gL, myindex));
|
||||||
if (!subsector)
|
if (!subsector)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SUBSECTOR);
|
WRITEUINT8(*p, ARCH_SUBSECTOR);
|
||||||
WRITEUINT16(*p, subsector - subsectors);
|
WRITEUINT16(*p, subsector - subsectors);
|
||||||
}
|
}
|
||||||
@@ -874,8 +906,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
sector_t *sector = *((sector_t **)lua_touserdata(gL, myindex));
|
sector_t *sector = *((sector_t **)lua_touserdata(gL, myindex));
|
||||||
if (!sector)
|
if (!sector)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SECTOR);
|
WRITEUINT8(*p, ARCH_SECTOR);
|
||||||
WRITEUINT16(*p, sector - sectors);
|
WRITEUINT16(*p, sector - sectors);
|
||||||
}
|
}
|
||||||
@@ -885,8 +921,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
||||||
if (!slope)
|
if (!slope)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SLOPE);
|
WRITEUINT8(*p, ARCH_SLOPE);
|
||||||
WRITEUINT16(*p, slope->id);
|
WRITEUINT16(*p, slope->id);
|
||||||
}
|
}
|
||||||
@@ -896,8 +936,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
||||||
if (!header)
|
if (!header)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_MAPHEADER);
|
WRITEUINT8(*p, ARCH_MAPHEADER);
|
||||||
WRITEUINT16(*p, header - *mapheaderinfo);
|
WRITEUINT16(*p, header - *mapheaderinfo);
|
||||||
}
|
}
|
||||||
@@ -1003,19 +1047,23 @@ static void ArchiveTables(UINT8 **p)
|
|||||||
e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
|
e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
|
||||||
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
||||||
{
|
{
|
||||||
lua_pushvalue(gL, -2);
|
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -2), luaL_typename(gL, -2), i);
|
||||||
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -1), luaL_typename(gL, -1), i);
|
|
||||||
lua_pop(gL, 1);
|
|
||||||
}
|
}
|
||||||
|
else if (e == 3) // nil key due to invalid userdata. NOT an error.
|
||||||
|
{
|
||||||
|
lua_pop(gL, 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Write value
|
// Write value
|
||||||
e = ArchiveValue(p, TABLESINDEX, -1);
|
e = ArchiveValue(p, TABLESINDEX, -1);
|
||||||
if (e == 1)
|
if (e == 1)
|
||||||
|
{
|
||||||
n++; // the table contained a new table we'll have to archive. :(
|
n++; // the table contained a new table we'll have to archive. :(
|
||||||
|
}
|
||||||
else if (e == 2) // invalid value type
|
else if (e == 2) // invalid value type
|
||||||
{
|
{
|
||||||
lua_pushvalue(gL, -2);
|
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -2), luaL_typename(gL, -1));
|
||||||
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -1), luaL_typename(gL, -1));
|
|
||||||
lua_pop(gL, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_pop(gL, 1);
|
lua_pop(gL, 1);
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file lua_udatalib.c
|
||||||
|
/// \brief Implementation of lua userdata object metatables based on getter/setter functions
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
#include "lua_udatalib.h"
|
#include "lua_udatalib.h"
|
||||||
|
|||||||
+12
-1
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file lua_udatalib.h
|
||||||
|
/// \brief Implementation of lua userdata object metatables based on getter/setter functions
|
||||||
|
|
||||||
#ifndef __LUA_UDATALIB_H__
|
#ifndef __LUA_UDATALIB_H__
|
||||||
#define __LUA_UDATALIB_H__
|
#define __LUA_UDATALIB_H__
|
||||||
|
|
||||||
@@ -100,4 +111,4 @@ void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[]);
|
|||||||
return 0; \
|
return 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+2
-2
@@ -183,7 +183,7 @@ static aatree_node_t *M_AATreeSetString_Node(aatree_node_t *node, UINT32 flags,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
aatree_entry_t *entry = node->value;
|
aatree_entry_t *entry = node->value;
|
||||||
if (entry != NULL && strcmp(entry->key, key) != 0)
|
if (entry != NULL && !fastcmp(entry->key, key))
|
||||||
entry = entry->next;
|
entry = entry->next;
|
||||||
if (entry != NULL)
|
if (entry != NULL)
|
||||||
{
|
{
|
||||||
@@ -252,7 +252,7 @@ void *M_AATreeGetString(aatree_t *aatree, const char *key)
|
|||||||
I_Assert((aatree->flags & AATREE_STRING) == AATREE_STRING);
|
I_Assert((aatree->flags & AATREE_STRING) == AATREE_STRING);
|
||||||
UINT32 hash = FNV1a_HashString(key);
|
UINT32 hash = FNV1a_HashString(key);
|
||||||
aatree_entry_t *entry = M_AATreeGet_Node(aatree->root, hash);
|
aatree_entry_t *entry = M_AATreeGet_Node(aatree->root, hash);
|
||||||
while (entry != NULL && strcmp(entry->key, key) != 0)
|
while (entry != NULL && !fastcmp(entry->key, key))
|
||||||
entry = entry->next;
|
entry = entry->next;
|
||||||
return entry != NULL ? entry->value : NULL;
|
return entry != NULL ? entry->value : NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -49,7 +49,7 @@ INT32 M_CheckParm(const char *check)
|
|||||||
|
|
||||||
for (i = 1; i < myargc; i++)
|
for (i = 1; i < myargc; i++)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(check, myargv[i]))
|
if (fasticmp(check, myargv[i]))
|
||||||
{
|
{
|
||||||
found = i;
|
found = i;
|
||||||
return i;
|
return i;
|
||||||
@@ -69,16 +69,18 @@ INT32 M_CheckProtoParam(const char *check)
|
|||||||
|
|
||||||
for (i = 1; i < myargc; i++)
|
for (i = 1; i < myargc; i++)
|
||||||
{
|
{
|
||||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||||
{
|
{
|
||||||
if (strncmp(myargv[i]+11, check, strlen(check))==0)
|
if (strncmp(myargv[i]+11, check, strlen(check)) == 0)
|
||||||
{
|
{
|
||||||
found = i;
|
found = i;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
found = 0;
|
found = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +95,7 @@ const char *M_GetProtoParam(void)
|
|||||||
|
|
||||||
for (i = 1; i < myargc; i++)
|
for (i = 1; i < myargc; i++)
|
||||||
{
|
{
|
||||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||||
{
|
{
|
||||||
string = strchr(myargv[i], '/');
|
string = strchr(myargv[i], '/');
|
||||||
string = strchr(string+1, '/');
|
string = strchr(string+1, '/');
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file m_curl.c
|
||||||
|
/// \brief Common curl-related functions shared across http-mserv and file download
|
||||||
|
|
||||||
#include "m_curl.h"
|
#include "m_curl.h"
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "i_system.h" // I_OutputMsg
|
#include "i_system.h" // I_OutputMsg
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file m_curl.h
|
||||||
|
/// \brief Common curl-related functions shared across http-mserv and file download
|
||||||
|
|
||||||
#ifndef __M_CURL__
|
#ifndef __M_CURL__
|
||||||
#define __M_CURL__
|
#define __M_CURL__
|
||||||
|
|
||||||
|
|||||||
+15
-4
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file m_emotes.cpp
|
||||||
|
/// \brief Chat emotes handling
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -81,7 +92,7 @@ void M_LoadEmotes(UINT16 wadnum)
|
|||||||
if (emote_name.size() > MAXEMOTENAME)
|
if (emote_name.size() > MAXEMOTENAME)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, "EMOTES: Emote name is too long, truncating. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
CONS_Alert(CONS_WARNING, "EMOTES: Emote name is too long, truncating. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
||||||
emote_name = emote_name.substr(0, MAXEMOTENAME);
|
emote_name.resize(MAXEMOTENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
emote = &emotes[emote_name];
|
emote = &emotes[emote_name];
|
||||||
@@ -101,7 +112,7 @@ void M_LoadEmotes(UINT16 wadnum)
|
|||||||
trim(field);
|
trim(field);
|
||||||
trim(value);
|
trim(value);
|
||||||
|
|
||||||
if (stricmp(field.c_str(), "frames") == 0)
|
if (fasticmp(field.c_str(), "frames"))
|
||||||
{
|
{
|
||||||
UINT8 numframes = 0;
|
UINT8 numframes = 0;
|
||||||
|
|
||||||
@@ -128,7 +139,7 @@ void M_LoadEmotes(UINT16 wadnum)
|
|||||||
if (framelumpname.size() > 8)
|
if (framelumpname.size() > 8)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, "EMOTES: Frame %d name is too long. (file %s, line %d)", numframes, wadfiles[wadnum]->filename, linenum);
|
CONS_Alert(CONS_WARNING, "EMOTES: Frame %d name is too long. (file %s, line %d)", numframes, wadfiles[wadnum]->filename, linenum);
|
||||||
framelumpname = framelumpname.substr(0, 8);
|
framelumpname.resize(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::strncpy(emote->frames[numframes], framelumpname.c_str(), framelumpname.size()+1);
|
std::strncpy(emote->frames[numframes], framelumpname.c_str(), framelumpname.size()+1);
|
||||||
@@ -147,7 +158,7 @@ void M_LoadEmotes(UINT16 wadnum)
|
|||||||
|
|
||||||
emote->numframes = numframes;
|
emote->numframes = numframes;
|
||||||
}
|
}
|
||||||
else if (stricmp(field.c_str(), "timeperframe") == 0)
|
else if (fasticmp(field.c_str(), "timeperframe"))
|
||||||
{
|
{
|
||||||
emote->timeperframe = std::stoi(value);
|
emote->timeperframe = std::stoi(value);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file m_emotes.h
|
||||||
|
/// \brief Chat emotes handling
|
||||||
|
|
||||||
#ifndef __M_EMOTES__
|
#ifndef __M_EMOTES__
|
||||||
#define __M_EMOTES__
|
#define __M_EMOTES__
|
||||||
|
|
||||||
|
|||||||
+45
-34
@@ -702,7 +702,13 @@ static void M_CheckStringItem(void)
|
|||||||
|
|
||||||
// Just in case
|
// Just in case
|
||||||
memset(menu_text_input_buf, 0, sizeof menu_text_input_buf);
|
memset(menu_text_input_buf, 0, sizeof menu_text_input_buf);
|
||||||
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
|
|
||||||
|
// special case: name input, cap it to prevent writing outside the textbox
|
||||||
|
// kinda ugly but itll work
|
||||||
|
if (cv == &cv_playername)
|
||||||
|
M_TextInputInit(&menuinput, menu_text_input_buf, MAXPLAYERNAME +1);
|
||||||
|
else
|
||||||
|
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
|
||||||
|
|
||||||
M_TextInputSetString(&menuinput, cv->string);
|
M_TextInputSetString(&menuinput, cv->string);
|
||||||
}
|
}
|
||||||
@@ -2713,6 +2719,10 @@ static void M_PrepareLevelSelect(void)
|
|||||||
//
|
//
|
||||||
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||||
{
|
{
|
||||||
|
// invalid mapnum
|
||||||
|
if (mapnum < -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Random map!
|
// Random map!
|
||||||
if (mapnum == -1)
|
if (mapnum == -1)
|
||||||
return (gamestate != GS_TIMEATTACK && !modeattacking);
|
return (gamestate != GS_TIMEATTACK && !modeattacking);
|
||||||
@@ -3103,7 +3113,7 @@ static void M_AddonsInternal(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(menupath, pathname, 1024);
|
strlcpy(menupath, pathname, MAXFILEPATH);
|
||||||
menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath) + 1;
|
menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath) + 1;
|
||||||
|
|
||||||
if (menupath[menupathindex[menudepthleft]-2] != PATHSEP[0])
|
if (menupath[menupathindex[menudepthleft]-2] != PATHSEP[0])
|
||||||
@@ -3216,9 +3226,9 @@ static void M_DrawTemperature(INT32 x, fixed_t t)
|
|||||||
static char *M_AddonsHeaderPath(void)
|
static char *M_AddonsHeaderPath(void)
|
||||||
{
|
{
|
||||||
UINT32 len;
|
UINT32 len;
|
||||||
static char header[1024];
|
static char header[MAXFILEPATH];
|
||||||
|
|
||||||
strlcpy(header, va("%s folder%s", cv_addons_option.string, menupath+menupathindex[menudepth-1]-1), 1024);
|
strlcpy(header, va("%s folder%s", cv_addons_option.string, menupath+menupathindex[menudepth-1]-1), MAXFILEPATH);
|
||||||
len = strlen(header);
|
len = strlen(header);
|
||||||
if (len > 34)
|
if (len > 34)
|
||||||
{
|
{
|
||||||
@@ -3709,10 +3719,10 @@ static void M_HandleAddons(INT32 choice)
|
|||||||
break;
|
break;
|
||||||
case EXT_TXT:
|
case EXT_TXT:
|
||||||
case EXT_CFG:
|
case EXT_CFG:
|
||||||
if ((strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, CONFIGFILENAME) == 0)
|
if (fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, CONFIGFILENAME)
|
||||||
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, AUTOLOADCONFIGFILENAME) == 0)
|
|| fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, AUTOLOADCONFIGFILENAME)
|
||||||
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartserv.cfg") == 0)
|
|| fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartserv.cfg")
|
||||||
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartexec.cfg") == 0))
|
|| fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartexec.cfg"))
|
||||||
{
|
{
|
||||||
M_StartMessage(va("%c%s\x80\nYou can't autoload this builds' base console scripts, silly!\n They're already autoloaded on startup! \n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
|
M_StartMessage(va("%c%s\x80\nYou can't autoload this builds' base console scripts, silly!\n They're already autoloaded on startup! \n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
|
||||||
S_StartSound(NULL, sfx_s26d);
|
S_StartSound(NULL, sfx_s26d);
|
||||||
@@ -3820,7 +3830,7 @@ static void ReplayNamesLoadThread(void* userdata)
|
|||||||
|
|
||||||
Lock_search_state();
|
Lock_search_state();
|
||||||
|
|
||||||
if (strcmp(menupath, replaydirpath) == 0)
|
if (fastcmp(menupath, replaydirpath))
|
||||||
{
|
{
|
||||||
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu);
|
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu);
|
||||||
replaynamesloaded = true;
|
replaynamesloaded = true;
|
||||||
@@ -3954,9 +3964,7 @@ static void PrepReplayList(boolean reset)
|
|||||||
|
|
||||||
Lock_search_state();
|
Lock_search_state();
|
||||||
|
|
||||||
if (demolist_all)
|
Z_Free(demolist_all);
|
||||||
Z_Free(demolist_all);
|
|
||||||
|
|
||||||
demolist_all = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
|
demolist_all = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
|
||||||
|
|
||||||
for (i = 0; i < sizedirmenu; i++)
|
for (i = 0; i < sizedirmenu; i++)
|
||||||
@@ -3974,9 +3982,9 @@ static void PrepReplayList(boolean reset)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
demolist_all[i].type = MD_NOTLOADED;
|
demolist_all[i].type = MD_NOTLOADED;
|
||||||
// FIXME - do something with buffer sizes. menupath is 1024 chars but filepath is only
|
snprintf(demolist_all[i].filepath, sizeof(demolist_all[i].filepath),
|
||||||
// 256. I'm not really sure what to do here but don't want to leave warnings...
|
// 255 = UINT8 limit. dirmenu entries are restricted to this length (see DIR_LEN).
|
||||||
snprintf(demolist_all[i].filepath, 255, "%.254s%s", menupath, dirmenu[i] + DIR_STRING);
|
"%s%.255s", menupath, dirmenu[i] + DIR_STRING);
|
||||||
sprintf(demolist_all[i].title, ".....");
|
sprintf(demolist_all[i].title, ".....");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4331,7 +4339,7 @@ static void DrawReplayHutReplayInfo(void)
|
|||||||
static void M_DrawReplayHut(void)
|
static void M_DrawReplayHut(void)
|
||||||
{
|
{
|
||||||
INT32 x, y, cursory = 0;
|
INT32 x, y, cursory = 0;
|
||||||
INT16 i;
|
INT32 i;
|
||||||
INT16 replaylistitem = currentMenu->numitems-2;
|
INT16 replaylistitem = currentMenu->numitems-2;
|
||||||
boolean processed_one_this_frame = false;
|
boolean processed_one_this_frame = false;
|
||||||
const INT32 scaledviewheight = (vid.height/vid.dup);
|
const INT32 scaledviewheight = (vid.height/vid.dup);
|
||||||
@@ -4404,7 +4412,7 @@ static void M_DrawReplayHut(void)
|
|||||||
V_DrawCenteredString(160, 100, V_ALLOWLOWERCASE, msg);
|
V_DrawCenteredString(160, 100, V_ALLOWLOWERCASE, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < (INT16)replayqueryfound; i++)
|
for (i = 0; i < (INT32)replayqueryfound; i++)
|
||||||
{
|
{
|
||||||
INT32 localy = y+i*10;
|
INT32 localy = y+i*10;
|
||||||
INT32 localx = x;
|
INT32 localx = x;
|
||||||
@@ -6948,9 +6956,9 @@ static void M_ConnectMenuModChecks(INT32 choice)
|
|||||||
(void)choice;
|
(void)choice;
|
||||||
// okay never mind we want to COMMUNICATE to the player pre-emptively instead of letting them try and then get confused when it doesn't work
|
// okay never mind we want to COMMUNICATE to the player pre-emptively instead of letting them try and then get confused when it doesn't work
|
||||||
|
|
||||||
if (modifiedgame || autoloaded)
|
if (modifiedgame)
|
||||||
{
|
{
|
||||||
M_StartMessage(M_GetText("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER);
|
M_StartMessage("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n", M_ConnectMenu, MM_EVENTHANDLER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7171,17 +7179,21 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
|||||||
namescroll = 0;
|
namescroll = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderisnewtic) namescroll++;
|
if (renderisnewtic)
|
||||||
|
namescroll++;
|
||||||
|
|
||||||
char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename;
|
char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename;
|
||||||
INT32 len;
|
INT32 len;
|
||||||
INT32 charlimit = min((size_t)(21 + (dupadjust/5)), sizeof(namescrollbuf)-1);
|
INT32 charlimit = min((size_t)(21 + (dupadjust/5)), sizeof(namescrollbuf)-1);
|
||||||
|
|
||||||
nameonly(addonname);
|
nameonly(addonname);
|
||||||
len = strlen(addonname);
|
len = strlen(addonname);
|
||||||
|
|
||||||
if (len > charlimit)
|
if (len > charlimit)
|
||||||
M_ScrollString(addonname, len, namescrollbuf, charlimit, namescroll);
|
M_ScrollString(addonname, len, namescrollbuf, charlimit, namescroll);
|
||||||
else
|
else
|
||||||
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf));
|
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf) - 1);
|
||||||
|
|
||||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, namescrollbuf); // variable reuse...
|
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, namescrollbuf); // variable reuse...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7220,7 +7232,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
|||||||
if (i == oldval)
|
if (i == oldval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!mapheaderinfo[i])
|
if (i >= 0 && !mapheaderinfo[i])
|
||||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||||
|
|
||||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||||
@@ -7258,7 +7270,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
|||||||
if (i == oldval)
|
if (i == oldval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!mapheaderinfo[i])
|
if (i >= 0 && !mapheaderinfo[i])
|
||||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||||
|
|
||||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||||
@@ -8271,12 +8283,12 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
|
|
||||||
sprframe = &sprdef->spriteframes[frame];
|
sprframe = &sprdef->spriteframes[frame];
|
||||||
|
|
||||||
//minenice's speen css, it's a piece of shit but hey
|
// minenice's speen css, it's a piece of shit but hey
|
||||||
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
||||||
|
|
||||||
//this is a very shitty solution for checking if a sprite needs flipping
|
// this is a very shitty solution for checking if a sprite needs flipping
|
||||||
//but it works
|
// but it works
|
||||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4))
|
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||||
flags = V_FLIP; // This sprite is left/right flipped!
|
flags = V_FLIP; // This sprite is left/right flipped!
|
||||||
|
|
||||||
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
||||||
@@ -8796,7 +8808,7 @@ static boolean M_QuitMultiPlayerMenu(void)
|
|||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
// send name if changed
|
// send name if changed
|
||||||
if (strcmp(setupm_name, setupm_cvname->string))
|
if (!fastcmp(setupm_name, setupm_cvname->string))
|
||||||
{
|
{
|
||||||
// remove trailing whitespaces
|
// remove trailing whitespaces
|
||||||
for (l= strlen(setupm_name)-1;
|
for (l= strlen(setupm_name)-1;
|
||||||
@@ -9438,9 +9450,8 @@ static void M_VideoModeMenu(INT32 choice)
|
|||||||
|
|
||||||
memset(modedescs, 0, sizeof(modedescs));
|
memset(modedescs, 0, sizeof(modedescs));
|
||||||
|
|
||||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
|
||||||
VID_PrepareModeList(); // FIXME: hack
|
VID_PrepareModeList(); // FIXME: hack
|
||||||
#endif
|
|
||||||
vidm_nummodes = 0;
|
vidm_nummodes = 0;
|
||||||
vidm_selected = 0;
|
vidm_selected = 0;
|
||||||
nummodes = VID_NumModes();
|
nummodes = VID_NumModes();
|
||||||
@@ -9458,7 +9469,7 @@ static void M_VideoModeMenu(INT32 choice)
|
|||||||
// VESA mode, which is always a higher modenum
|
// VESA mode, which is always a higher modenum
|
||||||
for (j = 0; j < vidm_nummodes; j++)
|
for (j = 0; j < vidm_nummodes; j++)
|
||||||
{
|
{
|
||||||
if (!strcmp(modedescs[j].desc, desc))
|
if (fastcmp(modedescs[j].desc, desc))
|
||||||
{
|
{
|
||||||
// mode(0): 320x200 is always standard VGA, not vesa
|
// mode(0): 320x200 is always standard VGA, not vesa
|
||||||
if (modedescs[j].modenum)
|
if (modedescs[j].modenum)
|
||||||
@@ -9632,7 +9643,7 @@ static void M_DrawLocalSkinMenu(void)
|
|||||||
|
|
||||||
//this is a very shitty solution for checking if a sprite needs flipping
|
//this is a very shitty solution for checking if a sprite needs flipping
|
||||||
//but it works
|
//but it works
|
||||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4))
|
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||||
{
|
{
|
||||||
flags = V_FLIP; // This sprite is left/right flipped!
|
flags = V_FLIP; // This sprite is left/right flipped!
|
||||||
}
|
}
|
||||||
@@ -10331,9 +10342,9 @@ static const char *M_GetDiscordName(discordRequest_t *r)
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (cv_discordstreamer.value)
|
if (cv_discordstreamer.value)
|
||||||
return r->username;
|
return DRPC_HideUsername(r->username);
|
||||||
|
|
||||||
return va("%s#%s", r->username, r->discriminator);
|
return r->username;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (this goes in k_hud.c when merged into v2)
|
// (this goes in k_hud.c when merged into v2)
|
||||||
|
|||||||
+48
-26
@@ -645,10 +645,20 @@ static menuitem_t OP_ControlsMenu[] =
|
|||||||
{IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30},
|
{IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30},
|
||||||
{IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40},
|
{IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40},
|
||||||
|
|
||||||
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 60},
|
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 55},
|
||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 80},
|
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 75},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 90},
|
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P1)", &cv_turnsmooth[0], 85},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P2)", &cv_turnsmooth[1], 95},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P3)", &cv_turnsmooth[2], 105},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P4)", &cv_turnsmooth[3], 115},
|
||||||
|
|
||||||
|
// i hate our menus sincerly
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P1)", &cv_litesteer[0], 135},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P2)", &cv_litesteer[1], 145},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P3)", &cv_litesteer[2], 155},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P4)", &cv_litesteer[3], 165},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* OP_ControlsTooltips[] =
|
static const char* OP_ControlsTooltips[] =
|
||||||
@@ -659,7 +669,15 @@ static const char* OP_ControlsTooltips[] =
|
|||||||
"Setup player 4 controls.",
|
"Setup player 4 controls.",
|
||||||
"Options for mouse control.",
|
"Options for mouse control.",
|
||||||
"Allowed amount of controls per key.",
|
"Allowed amount of controls per key.",
|
||||||
"Turn smoothing for non-analog turning.",
|
"Turn smoothing for non-analog turning (Player 1).",
|
||||||
|
"Turn smoothing for non-analog turning (Player 2).",
|
||||||
|
"Turn smoothing for non-analog turning (Player 3).",
|
||||||
|
"Turn smoothing for non-analog turning (Player 4).",
|
||||||
|
|
||||||
|
"Hold DOWN on d-pad/keyboard for shallow turns (Player 1).",
|
||||||
|
"Hold DOWN on d-pad/keyboard for shallow turns (Player 2).",
|
||||||
|
"Hold DOWN on d-pad/keyboard for shallow turns (Player 3).",
|
||||||
|
"Hold DOWN on d-pad/keyboard for shallow turns (Player 4).",
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_AllControlsMenu[] =
|
static menuitem_t OP_AllControlsMenu[] =
|
||||||
@@ -926,21 +944,23 @@ static menuitem_t OP_ExpOptionsMenu[] =
|
|||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 40},
|
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 40},
|
||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 50},
|
{IT_STRING | IT_CVAR, NULL, "Precache Level Textures", &cv_precachetextures, 50},
|
||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "Frameskip", &cv_frameskip, 60},
|
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 60},
|
||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 70},
|
{IT_STRING | IT_CVAR, NULL, "Frameskip", &cv_frameskip, 70},
|
||||||
|
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 80},
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 80},
|
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 90},
|
||||||
#ifdef USE_FBO_OGL
|
#ifdef USE_FBO_OGL
|
||||||
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 85},
|
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 95},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 95},
|
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 105},
|
||||||
{IT_DISABLED, NULL, "", NULL, 105}, // dummy text
|
{IT_DISABLED, NULL, "", NULL, 115}, // dummy text
|
||||||
#else
|
#else
|
||||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 90},
|
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 100},
|
||||||
{IT_DISABLED, NULL, "", NULL, 100}, // dummy text
|
{IT_DISABLED, NULL, "", NULL, 110}, // dummy text
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -950,16 +970,17 @@ static const char* OP_ExpTooltips[] =
|
|||||||
NULL,
|
NULL,
|
||||||
"How far Mobj interpolation should take effect.",
|
"How far Mobj interpolation should take effect.",
|
||||||
"When weather is on this will cut the object amount used in half.",
|
"When weather is on this will cut the object amount used in half.",
|
||||||
"Sets minimum sector brightness, useful for dark areas",
|
"Sets minimum sector brightness, useful for dark areas.",
|
||||||
//"Should the directional lightning be randomized each map?\nTakes effect on next map load.",
|
//"Should the directional lightning be randomized each map?\nTakes effect on next map load.",
|
||||||
"Toggle being able to see the sky.",
|
"Toggle being able to see the sky.",
|
||||||
"Change the FPS counter sampling method\nInaccurate updates slower and might miss frame drops and such\nAccurate updates faster and is more accurate, but might be less readable", // how to ingles??
|
"Preload all level textures on level load.\nMassively reduces texture related stuttering during gameplay\nat the cost of longer level loading times.\nDisable this if you experience timeouts during level switches.",
|
||||||
"Skips rendering frames if game logic takes too long preventing issues during performance drops." // idk im shit as describing things
|
"Change the FPS counter sampling method\nInaccurate updates slower\nand might miss sudden framerate changes and drops,\nproviding a more averaged result.\nAccurate updates faster, but might be less readable.", // how to ingles??
|
||||||
|
"Skips rendering frames if game logic takes too long\npreventing gameplay issues during performance drops.", // idk im shit as describing things
|
||||||
"Different methods of scaling the votescreen backgrounds.",
|
"Different methods of scaling the votescreen backgrounds.",
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
|
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
|
||||||
#ifdef USE_FBO_OGL
|
#ifdef USE_FBO_OGL
|
||||||
"Allows the game to downsample from a higher resolution than your display\nin OpenGL renderer mode. Requires a GPU with atleast OpenGL 3.0 support.",
|
"Allows the game to downsample from a higher resolution\nthan your display in OpenGL renderer mode.\nRequires a GPU with atleast OpenGL 2.1 support.",
|
||||||
#endif
|
#endif
|
||||||
"Change the bit depth of the Lookup Palette in Palette rendering mode\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.",
|
"Change the bit depth of the Lookup Palette in Palette rendering mode\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.",
|
||||||
#endif
|
#endif
|
||||||
@@ -973,6 +994,7 @@ enum
|
|||||||
op_exp_secbright,
|
op_exp_secbright,
|
||||||
//op_exp_dirlight,
|
//op_exp_dirlight,
|
||||||
op_exp_skybox,
|
op_exp_skybox,
|
||||||
|
op_exp_texcache,
|
||||||
op_exp_accuratefps,
|
op_exp_accuratefps,
|
||||||
op_exp_frameskip,
|
op_exp_frameskip,
|
||||||
op_exp_votescrn,
|
op_exp_votescrn,
|
||||||
@@ -1357,15 +1379,15 @@ static menuitem_t OP_Player4CamOptionsMenu[] =
|
|||||||
static const char* OP_PlayerCamOptionsTooltips[] =
|
static const char* OP_PlayerCamOptionsTooltips[] =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"Should the Camera flip on gravity flipped sections?.",
|
"Should the Camera flip on gravity flipped sections?",
|
||||||
"Camera distance relative to the Player.",
|
"Camera distance relative to the Player.",
|
||||||
"Height of the Camera",
|
"Height of the Camera.",
|
||||||
"Pitch Camera on Upwards or Downhill Slopes",
|
"Pitch Camera on Upwards or Downhill Slopes.",
|
||||||
"Speed of the Camera",
|
"Speed of the Camera.",
|
||||||
"Should looking back inherit the Players Momentum?\nEither inherit Player Momentum or double of it\nmay make looking back while boosting or going in high speed less jarring",
|
"Should looking back inherit the Players Momentum?\nEither inherit Player Momentum or double of it\nmay make looking back while boosting or going in high speed less jarring.",
|
||||||
"Allows looking up/down by holding\naim forward/backward while standing still.",
|
"Allows looking up/down by holding\naim forward/backward while standing still.",
|
||||||
"Speed of the Freecam/Spectator Camera",
|
"Speed of the Freecam/Spectator Camera.",
|
||||||
"Toggle between Third or First Person camera",
|
"Toggle between Third or First Person camera.",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ok it's still called chatoptions but we'll put ping display in here to be clean
|
// Ok it's still called chatoptions but we'll put ping display in here to be clean
|
||||||
@@ -1745,7 +1767,7 @@ static const char* OP_PlayerDistortTooltips[] =
|
|||||||
"Distance object rotation should be visable.",
|
"Distance object rotation should be visable.",
|
||||||
"Player rotation when sliptiding.",
|
"Player rotation when sliptiding.",
|
||||||
"Rotation of a player's boost trails and drift sparks.",
|
"Rotation of a player's boost trails and drift sparks.",
|
||||||
"Should banans rotate when thrown?\nAnd should they stay rotated when on the ground?.",
|
"Should banans rotate when thrown?\nAnd should they stay rotated when on the ground?",
|
||||||
"Player squash and stretch.",
|
"Player squash and stretch.",
|
||||||
"Player landing sound effect.",
|
"Player landing sound effect.",
|
||||||
"Kart hopping while drifting. This is purely visual.",
|
"Kart hopping while drifting. This is purely visual.",
|
||||||
@@ -2424,7 +2446,7 @@ menu_t OP_MainDef =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30, OP_ControlsTooltips);
|
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 40, 15, OP_ControlsTooltips);
|
||||||
//WTF
|
//WTF
|
||||||
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips);
|
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips);
|
||||||
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef);
|
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef);
|
||||||
|
|||||||
+1
-1
@@ -423,7 +423,7 @@ void Command_SaveConfig_f(void)
|
|||||||
FIL_ForceExtension(tmpstr, ".cfg");
|
FIL_ForceExtension(tmpstr, ".cfg");
|
||||||
|
|
||||||
M_SaveConfig(tmpstr);
|
M_SaveConfig(tmpstr);
|
||||||
if (stricmp(COM_Argv(2), "-silent"))
|
if (!fasticmp(COM_Argv(2), "-silent"))
|
||||||
CONS_Printf(M_GetText("config saved as %s\n"), configfile);
|
CONS_Printf(M_GetText("config saved as %s\n"), configfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -916,7 +916,7 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
|
|||||||
int len = (int)strlen(str);
|
int len = (int)strlen(str);
|
||||||
char* str_ptr;
|
char* str_ptr;
|
||||||
|
|
||||||
if (strcmp(".lua", str + len - 4) == 0)
|
if (fastcmp(".lua", str + len - 4))
|
||||||
{
|
{
|
||||||
str[len-4] = '\0'; // remove .lua at end
|
str[len-4] = '\0'; // remove .lua at end
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-2
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file m_textinput.c
|
||||||
|
/// \brief User text input implementation
|
||||||
|
|
||||||
#include "m_textinput.h"
|
#include "m_textinput.h"
|
||||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
@@ -228,8 +239,8 @@ void M_TextInputClear(textinput_t *input)
|
|||||||
void M_TextInputSetString(textinput_t *input, const char *c)
|
void M_TextInputSetString(textinput_t *input, const char *c)
|
||||||
{
|
{
|
||||||
memset(input->buffer, 0, input->buffer_size);
|
memset(input->buffer, 0, input->buffer_size);
|
||||||
strcpy(input->buffer, c);
|
strncpy(input->buffer, c, input->buffer_size);
|
||||||
input->cursor = input->select = input->length = strlen(c);
|
input->cursor = input->select = input->length = strlen(input->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emotes)
|
static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emotes)
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART SATURN
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Indev.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file m_textinput.h
|
||||||
|
/// \brief User text input implementation
|
||||||
|
|
||||||
#ifndef __M_TEXTINPUT__
|
#ifndef __M_TEXTINPUT__
|
||||||
#define __M_TEXTINPUT__
|
#define __M_TEXTINPUT__
|
||||||
|
|
||||||
|
|||||||
+41
-23
@@ -708,7 +708,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||||||
HU_SetCEchoFlags(0);
|
HU_SetCEchoFlags(0);
|
||||||
HU_SetCEchoDuration(5);
|
HU_SetCEchoDuration(5);
|
||||||
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[thing->player-players]));
|
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[thing->player-players]));
|
||||||
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[thing->player-players]);
|
//I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[thing->player-players]);
|
||||||
P_DamageMobj(thing, tmthing, tmthing->target, DMG_INSTAKILL);
|
P_DamageMobj(thing, tmthing, tmthing->target, DMG_INSTAKILL);
|
||||||
P_KillMobj(tmthing, thing, thing);
|
P_KillMobj(tmthing, thing, thing);
|
||||||
}
|
}
|
||||||
@@ -977,7 +977,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||||||
HU_SetCEchoFlags(0);
|
HU_SetCEchoFlags(0);
|
||||||
HU_SetCEchoDuration(5);
|
HU_SetCEchoDuration(5);
|
||||||
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[tmthing->player-players]));
|
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[tmthing->player-players]));
|
||||||
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[tmthing->player-players]);
|
//I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[tmthing->player-players]);
|
||||||
P_DamageMobj(tmthing, thing, thing->target, DMG_INSTAKILL);
|
P_DamageMobj(tmthing, thing, thing->target, DMG_INSTAKILL);
|
||||||
P_KillMobj(thing, tmthing, tmthing);
|
P_KillMobj(thing, tmthing, tmthing);
|
||||||
}
|
}
|
||||||
@@ -2189,7 +2189,7 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
//
|
//
|
||||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
{
|
{
|
||||||
subsector_t *s;
|
subsector_t *subsec;
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
floatok = false;
|
floatok = false;
|
||||||
@@ -2198,9 +2198,9 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
||||||
s = R_PointInSubsectorFast(x, y);
|
subsec = R_PointInSubsectorFast(x, y);
|
||||||
else
|
else
|
||||||
s = thiscam->subsector;
|
subsec = thiscam->subsector;
|
||||||
|
|
||||||
if (players[displayplayers[0]].mo)
|
if (players[displayplayers[0]].mo)
|
||||||
{
|
{
|
||||||
@@ -2220,7 +2220,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
thiscam->ceilingz = thiscam->z + thiscam->height;
|
thiscam->ceilingz = thiscam->z + thiscam->height;
|
||||||
thiscam->x = x;
|
thiscam->x = x;
|
||||||
thiscam->y = y;
|
thiscam->y = y;
|
||||||
thiscam->subsector = s;
|
thiscam->subsector = subsec;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2232,6 +2232,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
tryx -= MAXRADIUS;
|
tryx -= MAXRADIUS;
|
||||||
else
|
else
|
||||||
tryx = x;
|
tryx = x;
|
||||||
|
|
||||||
if (y-tryy > MAXRADIUS)
|
if (y-tryy > MAXRADIUS)
|
||||||
tryy += MAXRADIUS;
|
tryy += MAXRADIUS;
|
||||||
else if (y-tryy < -MAXRADIUS)
|
else if (y-tryy < -MAXRADIUS)
|
||||||
@@ -2249,14 +2250,14 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
|
|
||||||
if (tmceilingz - thiscam->z < thiscam->height)
|
if (tmceilingz - thiscam->z < thiscam->height)
|
||||||
{
|
{
|
||||||
if (s == thiscam->subsector && tmceilingz >= thiscam->z)
|
if (subsec == thiscam->subsector && tmceilingz >= thiscam->z)
|
||||||
{
|
{
|
||||||
floatok = true;
|
floatok = true;
|
||||||
thiscam->floorz = tmfloorz;
|
thiscam->floorz = tmfloorz;
|
||||||
thiscam->ceilingz = tmfloorz + thiscam->height;
|
thiscam->ceilingz = tmfloorz + thiscam->height;
|
||||||
thiscam->x = x;
|
thiscam->x = x;
|
||||||
thiscam->y = y;
|
thiscam->y = y;
|
||||||
thiscam->subsector = s;
|
thiscam->subsector = subsec;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2281,7 +2282,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
thiscam->ceilingz = tmceilingz;
|
thiscam->ceilingz = tmceilingz;
|
||||||
thiscam->x = x;
|
thiscam->x = x;
|
||||||
thiscam->y = y;
|
thiscam->y = y;
|
||||||
thiscam->subsector = s;
|
thiscam->subsector = subsec;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2394,6 +2395,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||||||
tryx -= radius;
|
tryx -= radius;
|
||||||
else
|
else
|
||||||
tryx = x;
|
tryx = x;
|
||||||
|
|
||||||
if (y-tryy > radius)
|
if (y-tryy > radius)
|
||||||
tryy += radius;
|
tryy += radius;
|
||||||
else if (y-tryy < -radius)
|
else if (y-tryy < -radius)
|
||||||
@@ -2409,28 +2411,34 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||||||
{
|
{
|
||||||
//All things are affected by their scale.
|
//All things are affected by their scale.
|
||||||
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||||
|
INT32 special = 0;
|
||||||
|
|
||||||
if (thing->player)
|
if (thing->player)
|
||||||
{
|
{
|
||||||
const INT32 special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||||
|
|
||||||
// If using type Section1:13, double the maxstep.
|
// If using type Section1:13, double the maxstep.
|
||||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) || special == 13)
|
||||||
|| special == 13)
|
{
|
||||||
maxstep <<= 1;
|
maxstep <<= 1;
|
||||||
|
}
|
||||||
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
|
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
|
||||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) || special == 12)
|
||||||
|| special == 12)
|
{
|
||||||
maxstep = 0;
|
maxstep = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thing->type == MT_SKIM)
|
if (thing->type == MT_SKIM)
|
||||||
|
{
|
||||||
maxstep = 0;
|
maxstep = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (tmceilingz - tmfloorz < thing->height)
|
if (tmceilingz - tmfloorz < thing->height)
|
||||||
{
|
{
|
||||||
if (tmfloorthing)
|
if (tmfloorthing)
|
||||||
tmhitthing = tmfloorthing;
|
tmhitthing = tmfloorthing;
|
||||||
|
|
||||||
return false; // doesn't fit
|
return false; // doesn't fit
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2463,11 +2471,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||||||
return false; // mobj must lower itself to fit
|
return false; // mobj must lower itself to fit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (maxstep > 0 && !(
|
else if (maxstep > 0 && !(thing->player &&
|
||||||
thing->player && (
|
(P_PlayerTouchingSectorSpecial(thing->player, 1, 14) || special == 14))) // Step down
|
||||||
P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
|
||||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)
|
|
||||||
)) // Step down
|
|
||||||
{
|
{
|
||||||
// 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.
|
||||||
@@ -2489,10 +2494,14 @@ 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 (tmdrpoffceilz - tmceilingz > maxstep)
|
if (tmdrpoffceilz - tmceilingz > maxstep)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (tmfloorz - tmdropoffz > maxstep)
|
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);
|
||||||
@@ -2568,6 +2577,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
|||||||
|
|
||||||
tryx = thing->x;
|
tryx = thing->x;
|
||||||
tryy = thing->y;
|
tryy = thing->y;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (x-tryx > MAXRADIUS)
|
if (x-tryx > MAXRADIUS)
|
||||||
tryx += MAXRADIUS;
|
tryx += MAXRADIUS;
|
||||||
@@ -2575,6 +2585,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
|||||||
tryx -= MAXRADIUS;
|
tryx -= MAXRADIUS;
|
||||||
else
|
else
|
||||||
tryx = x;
|
tryx = x;
|
||||||
|
|
||||||
if (y-tryy > MAXRADIUS)
|
if (y-tryy > MAXRADIUS)
|
||||||
tryy += MAXRADIUS;
|
tryy += MAXRADIUS;
|
||||||
else if (y-tryy < -MAXRADIUS)
|
else if (y-tryy < -MAXRADIUS)
|
||||||
@@ -2587,14 +2598,14 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
|||||||
|
|
||||||
if (!(thing->flags & MF_NOCLIP))
|
if (!(thing->flags & MF_NOCLIP))
|
||||||
{
|
{
|
||||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
|
||||||
|
|
||||||
if (tmceilingz - tmfloorz < thing->height)
|
if (tmceilingz - tmfloorz < thing->height)
|
||||||
return false; // doesn't fit
|
return false; // doesn't fit
|
||||||
|
|
||||||
if (tmceilingz - thing->z < thing->height)
|
if (tmceilingz - thing->z < thing->height)
|
||||||
return false; // mobj must lower itself to fit
|
return false; // mobj must lower itself to fit
|
||||||
|
|
||||||
|
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||||
|
|
||||||
if (tmfloorz - thing->z > maxstep)
|
if (tmfloorz - thing->z > maxstep)
|
||||||
return false; // too big a step up
|
return false; // too big a step up
|
||||||
}
|
}
|
||||||
@@ -2928,6 +2939,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
|
|||||||
{
|
{
|
||||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
||||||
return true; // don't hit the back side
|
return true; // don't hit the back side
|
||||||
|
|
||||||
goto isblocking;
|
goto isblocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3346,10 +3358,12 @@ void P_BouncePlayerMove(mobj_t *mo)
|
|||||||
|
|
||||||
{
|
{
|
||||||
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
|
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
|
||||||
|
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
fx->eflags |= MFE_VERTICALFLIP;
|
fx->eflags |= MFE_VERTICALFLIP;
|
||||||
else
|
else
|
||||||
fx->eflags &= ~MFE_VERTICALFLIP;
|
fx->eflags &= ~MFE_VERTICALFLIP;
|
||||||
|
|
||||||
fx->scale = mo->scale;
|
fx->scale = mo->scale;
|
||||||
|
|
||||||
S_StartSound(mo, sfx_s3k49);
|
S_StartSound(mo, sfx_s3k49);
|
||||||
@@ -3363,7 +3377,8 @@ void P_BouncePlayerMove(mobj_t *mo)
|
|||||||
mo->player->cmomx = tmxmove;
|
mo->player->cmomx = tmxmove;
|
||||||
mo->player->cmomy = tmymove;
|
mo->player->cmomy = tmymove;
|
||||||
|
|
||||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) {
|
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
|
||||||
|
{
|
||||||
P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true);
|
P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3740,6 +3755,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
sector_t *sec;
|
sector_t *sec;
|
||||||
|
|
||||||
for (i = 0; i < sector->numattached; i++)
|
for (i = 0; i < sector->numattached; i++)
|
||||||
{
|
{
|
||||||
sec = §ors[sector->attached[i]];
|
sec = §ors[sector->attached[i]];
|
||||||
@@ -3946,6 +3962,7 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
|
|||||||
|
|
||||||
tp = node->m_sectorlist_prev;
|
tp = node->m_sectorlist_prev;
|
||||||
tn = node->m_sectorlist_next;
|
tn = node->m_sectorlist_next;
|
||||||
|
|
||||||
if (tp)
|
if (tp)
|
||||||
tp->m_sectorlist_next = tn;
|
tp->m_sectorlist_next = tn;
|
||||||
if (tn)
|
if (tn)
|
||||||
@@ -3956,6 +3973,7 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
|
|||||||
|
|
||||||
sp = node->m_thinglist_prev;
|
sp = node->m_thinglist_prev;
|
||||||
sn = node->m_thinglist_next;
|
sn = node->m_thinglist_next;
|
||||||
|
|
||||||
if (sp)
|
if (sp)
|
||||||
sp->m_thinglist_next = sn;
|
sp->m_thinglist_next = sn;
|
||||||
else
|
else
|
||||||
@@ -4003,7 +4021,7 @@ static inline boolean PIT_GetSectors(line_t *ld)
|
|||||||
// allowed to move to this position, then the sector_list
|
// allowed to move to this position, then the sector_list
|
||||||
// will be attached to the Thing's mobj_t at touching_sectorlist.
|
// will be attached to the Thing's mobj_t at touching_sectorlist.
|
||||||
|
|
||||||
sector_list = P_AddSecnode(ld->frontsector,tmthing,sector_list);
|
sector_list = P_AddSecnode(ld->frontsector, tmthing, sector_list);
|
||||||
|
|
||||||
// Don't assume all lines are 2-sided, since some Things
|
// Don't assume all lines are 2-sided, since some Things
|
||||||
// like MT_TFOG are allowed regardless of whether their radius takes
|
// like MT_TFOG are allowed regardless of whether their radius takes
|
||||||
|
|||||||
+1
-1
@@ -11889,7 +11889,7 @@ void P_SpawnHoops(mapthing_t *mthing)
|
|||||||
|
|
||||||
z += P_GetSectorFloorZAt(sec, x, y);
|
z += P_GetSectorFloorZAt(sec, x, y);
|
||||||
|
|
||||||
hoopcenter->z -= hoopcenter->height/2;
|
hoopcenter->z = z - hoopcenter->height/2;
|
||||||
|
|
||||||
P_UnsetThingPosition(hoopcenter);
|
P_UnsetThingPosition(hoopcenter);
|
||||||
hoopcenter->x = x;
|
hoopcenter->x = x;
|
||||||
|
|||||||
+37
-37
@@ -61,7 +61,7 @@ typedef enum
|
|||||||
//
|
//
|
||||||
// P_ArchivePlayer
|
// P_ArchivePlayer
|
||||||
//
|
//
|
||||||
static inline void P_ArchivePlayer(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_ArchivePlayer(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
const player_t *player = &players[consoleplayer];
|
const player_t *player = &players[consoleplayer];
|
||||||
INT32 pllives = player->lives;
|
INT32 pllives = player->lives;
|
||||||
@@ -85,7 +85,7 @@ static inline void P_ArchivePlayer(savebuffer_t *save)
|
|||||||
//
|
//
|
||||||
// P_UnArchivePlayer
|
// P_UnArchivePlayer
|
||||||
//
|
//
|
||||||
static inline void P_UnArchivePlayer(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_UnArchivePlayer(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
savedata.skincolor = READUINT8(save->p);
|
savedata.skincolor = READUINT8(save->p);
|
||||||
savedata.skin = READUINT8(save->p);
|
savedata.skin = READUINT8(save->p);
|
||||||
@@ -1043,25 +1043,25 @@ typedef enum
|
|||||||
tc_end
|
tc_end
|
||||||
} specials_e;
|
} specials_e;
|
||||||
|
|
||||||
static inline UINT32 SaveMobjnum(const mobj_t *mobj)
|
FUNCINLINE static ATTRINLINE UINT32 SaveMobjnum(const mobj_t *mobj)
|
||||||
{
|
{
|
||||||
if (mobj) return mobj->mobjnum;
|
if (mobj) return mobj->mobjnum;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UINT32 SaveSector(const sector_t *sector)
|
FUNCINLINE static ATTRINLINE UINT32 SaveSector(const sector_t *sector)
|
||||||
{
|
{
|
||||||
if (sector) return (UINT32)(sector - sectors);
|
if (sector) return (UINT32)(sector - sectors);
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UINT32 SaveLine(const line_t *line)
|
FUNCINLINE static ATTRINLINE UINT32 SaveLine(const line_t *line)
|
||||||
{
|
{
|
||||||
if (line) return (UINT32)(line - lines);
|
if (line) return (UINT32)(line - lines);
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UINT32 SavePlayer(const player_t *player)
|
FUNCINLINE static ATTRINLINE UINT32 SavePlayer(const player_t *player)
|
||||||
{
|
{
|
||||||
if (player) return (UINT32)(player - players);
|
if (player) return (UINT32)(player - players);
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
@@ -1476,7 +1476,7 @@ static void SaveElevatorThinker(savebuffer_t *save, const thinker_t *th, const U
|
|||||||
//
|
//
|
||||||
// Saves a scroll_t thinker
|
// Saves a scroll_t thinker
|
||||||
//
|
//
|
||||||
static inline void SaveScrollThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SaveScrollThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const scroll_t *ht = (const void *)th;
|
const scroll_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1497,7 +1497,7 @@ static inline void SaveScrollThinker(savebuffer_t *save, const thinker_t *th, co
|
|||||||
//
|
//
|
||||||
// Saves a friction_t thinker
|
// Saves a friction_t thinker
|
||||||
//
|
//
|
||||||
static inline void SaveFrictionThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SaveFrictionThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const friction_t *ht = (const void *)th;
|
const friction_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1513,7 +1513,7 @@ static inline void SaveFrictionThinker(savebuffer_t *save, const thinker_t *th,
|
|||||||
//
|
//
|
||||||
// Saves a pusher_t thinker
|
// Saves a pusher_t thinker
|
||||||
//
|
//
|
||||||
static inline void SavePusherThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SavePusherThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const pusher_t *ht = (const void *)th;
|
const pusher_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1598,7 +1598,7 @@ static void SaveDisappearThinker(savebuffer_t *save, const thinker_t *th, const
|
|||||||
//
|
//
|
||||||
// Saves a polyrotate_t thinker
|
// Saves a polyrotate_t thinker
|
||||||
//
|
//
|
||||||
static inline void SavePolyrotatetThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SavePolyrotatetThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const polyrotate_t *ht = (const void *)th;
|
const polyrotate_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1935,25 +1935,25 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline mobj_t *LoadMobj(UINT32 mobjnum)
|
FUNCINLINE static ATTRINLINE mobj_t *LoadMobj(UINT32 mobjnum)
|
||||||
{
|
{
|
||||||
if (mobjnum == 0) return NULL;
|
if (mobjnum == 0) return NULL;
|
||||||
return (mobj_t *)(size_t)mobjnum;
|
return (mobj_t *)(size_t)mobjnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline sector_t *LoadSector(UINT32 sector)
|
FUNCINLINE static ATTRINLINE sector_t *LoadSector(UINT32 sector)
|
||||||
{
|
{
|
||||||
if (sector >= numsectors) return NULL;
|
if (sector >= numsectors) return NULL;
|
||||||
return §ors[sector];
|
return §ors[sector];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline line_t *LoadLine(UINT32 line)
|
FUNCINLINE static ATTRINLINE line_t *LoadLine(UINT32 line)
|
||||||
{
|
{
|
||||||
if (line >= numlines) return NULL;
|
if (line >= numlines) return NULL;
|
||||||
return &lines[line];
|
return &lines[line];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline player_t *LoadPlayer(UINT32 player)
|
FUNCINLINE static ATTRINLINE player_t *LoadPlayer(UINT32 player)
|
||||||
{
|
{
|
||||||
if (player >= MAXPLAYERS) return NULL;
|
if (player >= MAXPLAYERS) return NULL;
|
||||||
return &players[player];
|
return &players[player];
|
||||||
@@ -2529,7 +2529,7 @@ static void LoadScrollThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a friction_t from a save game
|
// Loads a friction_t from a save game
|
||||||
//
|
//
|
||||||
static inline void LoadFrictionThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadFrictionThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
friction_t *ht = (friction_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
friction_t *ht = (friction_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2576,7 +2576,7 @@ static void LoadPusherThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a laserthink_t from a save game
|
// Loads a laserthink_t from a save game
|
||||||
//
|
//
|
||||||
static inline void LoadLaserThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadLaserThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
laserthink_t *ht = (laserthink_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
laserthink_t *ht = (laserthink_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2621,7 +2621,7 @@ FUNCINLINE static ATTRINLINE void LoadLightlevelThinker(savebuffer_t *save, acti
|
|||||||
//
|
//
|
||||||
// Loads a executor_t from a save game
|
// Loads a executor_t from a save game
|
||||||
//
|
//
|
||||||
static inline void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
executor_t *ht = (executor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
executor_t *ht = (executor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2639,7 +2639,7 @@ static inline void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a disappear_t thinker
|
// Loads a disappear_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
disappear_t *ht = (disappear_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
disappear_t *ht = (disappear_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2660,7 +2660,7 @@ static inline void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a polyrotate_t thinker
|
// Loads a polyrotate_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyrotate_t *ht = (polyrotate_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polyrotate_t *ht = (polyrotate_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2720,7 +2720,7 @@ static void LoadPolymoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a polywaypoint_t thinker
|
// Loads a polywaypoint_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polywaypoint_t *ht = (polywaypoint_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polywaypoint_t *ht = (polywaypoint_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2776,7 +2776,7 @@ static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinke
|
|||||||
//
|
//
|
||||||
// loads a polyslidedoor_t thinker
|
// loads a polyslidedoor_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyslidedoor_t *ht = (polyslidedoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polyslidedoor_t *ht = (polyslidedoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2814,7 +2814,7 @@ static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
//
|
//
|
||||||
// Loads a polyswingdoor_t thinker
|
// Loads a polyswingdoor_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyswingdoor_t *ht = (polyswingdoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polyswingdoor_t *ht = (polyswingdoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2847,7 +2847,7 @@ static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
//
|
//
|
||||||
// Loads a polydisplace_t thinker
|
// Loads a polydisplace_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polydisplace_t *ht = (polydisplace_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polydisplace_t *ht = (polydisplace_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -3115,7 +3115,7 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
|||||||
#define PD_FLAGS 0x01
|
#define PD_FLAGS 0x01
|
||||||
#define PD_TRANS 0x02
|
#define PD_TRANS 0x02
|
||||||
|
|
||||||
static inline void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
FUNCINLINE static ATTRINLINE void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
{
|
{
|
||||||
UINT8 diff = 0;
|
UINT8 diff = 0;
|
||||||
WRITEINT32(save->p, po->id);
|
WRITEINT32(save->p, po->id);
|
||||||
@@ -3137,7 +3137,7 @@ static inline void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
|||||||
WRITEINT32(save->p, po->translucency);
|
WRITEINT32(save->p, po->translucency);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
FUNCINLINE static ATTRINLINE void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
{
|
{
|
||||||
INT32 id;
|
INT32 id;
|
||||||
UINT32 angle;
|
UINT32 angle;
|
||||||
@@ -3172,7 +3172,7 @@ static inline void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
|||||||
Polyobj_MoveOnLoad(po, angle, x, y);
|
Polyobj_MoveOnLoad(po, angle, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_ArchivePolyObjects(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_ArchivePolyObjects(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
@@ -3185,7 +3185,7 @@ static inline void P_ArchivePolyObjects(savebuffer_t *save)
|
|||||||
P_ArchivePolyObj(save, &PolyObjects[i]);
|
P_ArchivePolyObj(save, &PolyObjects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchivePolyObjects(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_UnArchivePolyObjects(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
INT32 i, numSavedPolys;
|
INT32 i, numSavedPolys;
|
||||||
|
|
||||||
@@ -3203,7 +3203,7 @@ static inline void P_UnArchivePolyObjects(savebuffer_t *save)
|
|||||||
//
|
//
|
||||||
// P_FinishMobjs
|
// P_FinishMobjs
|
||||||
//
|
//
|
||||||
static inline void P_FinishMobjs(void)
|
FUNCINLINE static ATTRINLINE void P_FinishMobjs(void)
|
||||||
{
|
{
|
||||||
thinker_t *currentthinker;
|
thinker_t *currentthinker;
|
||||||
mobj_t *mobj;
|
mobj_t *mobj;
|
||||||
@@ -3220,7 +3220,7 @@ static inline void P_FinishMobjs(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline mobj_t *RelinkMobj(mobj_t **ptr)
|
FUNCINLINE static ATTRINLINE mobj_t *RelinkMobj(mobj_t **ptr)
|
||||||
{
|
{
|
||||||
UINT32 temp = (UINT32)(size_t)*ptr;
|
UINT32 temp = (UINT32)(size_t)*ptr;
|
||||||
*ptr = NULL;
|
*ptr = NULL;
|
||||||
@@ -3269,7 +3269,7 @@ static void P_RelinkPointers(void)
|
|||||||
//
|
//
|
||||||
// P_NetArchiveSpecials
|
// P_NetArchiveSpecials
|
||||||
//
|
//
|
||||||
static inline void P_NetArchiveSpecials(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_NetArchiveSpecials(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
size_t i, z;
|
size_t i, z;
|
||||||
|
|
||||||
@@ -3347,7 +3347,7 @@ static void P_NetUnArchiveSpecials(savebuffer_t *save)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
// Misc
|
// Misc
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
static inline void P_ArchiveMisc(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_ArchiveMisc(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
if (gamecomplete)
|
if (gamecomplete)
|
||||||
WRITEINT16(save->p, gamemap | 8192);
|
WRITEINT16(save->p, gamemap | 8192);
|
||||||
@@ -3360,7 +3360,7 @@ static inline void P_ArchiveMisc(savebuffer_t *save)
|
|||||||
WRITESTRINGN(save->p, timeattackfolder, sizeof(timeattackfolder));
|
WRITESTRINGN(save->p, timeattackfolder, sizeof(timeattackfolder));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchiveSPGame(savebuffer_t *save, INT16 mapoverride)
|
FUNCINLINE static ATTRINLINE void P_UnArchiveSPGame(savebuffer_t *save, INT16 mapoverride)
|
||||||
{
|
{
|
||||||
char testname[sizeof(timeattackfolder)];
|
char testname[sizeof(timeattackfolder)];
|
||||||
|
|
||||||
@@ -3391,7 +3391,7 @@ static inline void P_UnArchiveSPGame(savebuffer_t *save, INT16 mapoverride)
|
|||||||
|
|
||||||
READSTRINGN(save->p, testname, sizeof(testname));
|
READSTRINGN(save->p, testname, sizeof(testname));
|
||||||
|
|
||||||
if (strcmp(testname, timeattackfolder))
|
if (!fastcmp(testname, timeattackfolder))
|
||||||
{
|
{
|
||||||
if (modifiedgame)
|
if (modifiedgame)
|
||||||
I_Error("Save game not for this modification.");
|
I_Error("Save game not for this modification.");
|
||||||
@@ -3531,7 +3531,8 @@ static void P_ReloadSaveLevelData(void)
|
|||||||
ss->floorpic_angle = spawnss->floorpic_angle;
|
ss->floorpic_angle = spawnss->floorpic_angle;
|
||||||
ss->ceilingpic_angle = spawnss->ceilingpic_angle;
|
ss->ceilingpic_angle = spawnss->ceilingpic_angle;
|
||||||
ss->tag = spawnss->tag;
|
ss->tag = spawnss->tag;
|
||||||
ss->firsttag = ss->nexttag = -1;
|
ss->firsttag = spawnss->firsttag;
|
||||||
|
ss->nexttag = spawnss->nexttag;
|
||||||
|
|
||||||
if (ss->ffloors)
|
if (ss->ffloors)
|
||||||
{
|
{
|
||||||
@@ -3556,7 +3557,8 @@ static void P_ReloadSaveLevelData(void)
|
|||||||
li->callcount = 0;
|
li->callcount = 0;
|
||||||
|
|
||||||
li->tag = spawnli->tag;
|
li->tag = spawnli->tag;
|
||||||
li->firsttag = li->nexttag = -1;
|
li->firsttag = spawnli->firsttag;
|
||||||
|
li->nexttag = spawnli->nexttag;
|
||||||
|
|
||||||
if (li->sidenum[0] != 0xffff)
|
if (li->sidenum[0] != 0xffff)
|
||||||
{
|
{
|
||||||
@@ -3580,8 +3582,6 @@ static void P_ReloadSaveLevelData(void)
|
|||||||
si->midtexture = spawnsi->midtexture;
|
si->midtexture = spawnsi->midtexture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
P_InitTagLists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
|
FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
|
||||||
|
|||||||
+4
-3
@@ -1983,11 +1983,12 @@ static void P_LoadMapData(const virtres_t* virt)
|
|||||||
P_LoadLinedefs(virtlinedefs->data);
|
P_LoadLinedefs(virtlinedefs->data);
|
||||||
P_LoadSidedefs(virtsidedefs->data);
|
P_LoadSidedefs(virtsidedefs->data);
|
||||||
P_LoadThings(virtthings->data);
|
P_LoadThings(virtthings->data);
|
||||||
|
P_InitTagLists(); // Create xref tables for tags
|
||||||
|
|
||||||
// Copy relevant map data for NetArchive purposes.
|
// Copy relevant map data for NetArchive purposes.
|
||||||
spawnsectors = Z_Calloc(numsectors * sizeof(*sectors), PU_LEVEL, NULL);
|
spawnsectors = Z_Malloc(numsectors * sizeof(*sectors), PU_LEVEL, NULL);
|
||||||
spawnlines = Z_Calloc(numlines * sizeof(*lines), PU_LEVEL, NULL);
|
spawnlines = Z_Malloc(numlines * sizeof(*lines), PU_LEVEL, NULL);
|
||||||
spawnsides = Z_Calloc(numsides * sizeof(*sides), PU_LEVEL, NULL);
|
spawnsides = Z_Malloc(numsides * sizeof(*sides), PU_LEVEL, NULL);
|
||||||
|
|
||||||
memcpy(spawnsectors, sectors, numsectors * sizeof(*sectors));
|
memcpy(spawnsectors, sectors, numsectors * sizeof(*sectors));
|
||||||
memcpy(spawnlines, lines, numlines * sizeof(*lines));
|
memcpy(spawnlines, lines, numlines * sizeof(*lines));
|
||||||
|
|||||||
+39
-17
@@ -324,6 +324,7 @@ void P_InitPicAnims(void)
|
|||||||
lastanim->speed = LONG(animdefs[i].speed);
|
lastanim->speed = LONG(animdefs[i].speed);
|
||||||
lastanim++;
|
lastanim++;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastanim->istexture = -1;
|
lastanim->istexture = -1;
|
||||||
R_ClearTextureNumCache(false);
|
R_ClearTextureNumCache(false);
|
||||||
|
|
||||||
@@ -331,6 +332,7 @@ void P_InitPicAnims(void)
|
|||||||
// We'll only be using anims from now on.
|
// We'll only be using anims from now on.
|
||||||
if (animdefs != harddefs)
|
if (animdefs != harddefs)
|
||||||
Z_Free(animdefs);
|
Z_Free(animdefs);
|
||||||
|
|
||||||
animdefs = NULL;
|
animdefs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,20 +363,21 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
|
|||||||
|
|
||||||
// Now, let's start parsing this thing
|
// Now, let's start parsing this thing
|
||||||
p = animdefsText;
|
p = animdefsText;
|
||||||
|
|
||||||
animdefsToken = M_GetToken(p);
|
animdefsToken = M_GetToken(p);
|
||||||
while (animdefsToken != NULL)
|
while (animdefsToken != NULL)
|
||||||
{
|
{
|
||||||
if (stricmp(animdefsToken, "TEXTURE") == 0)
|
if (fasticmp(animdefsToken, "TEXTURE"))
|
||||||
{
|
{
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
P_ParseAnimationDefintion(1);
|
P_ParseAnimationDefintion(1);
|
||||||
}
|
}
|
||||||
else if (stricmp(animdefsToken, "FLAT") == 0)
|
else if (fasticmp(animdefsToken, "FLAT"))
|
||||||
{
|
{
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
P_ParseAnimationDefintion(0);
|
P_ParseAnimationDefintion(0);
|
||||||
}
|
}
|
||||||
else if (stricmp(animdefsToken, "OSCILLATE") == 0)
|
else if (fasticmp(animdefsToken, "OSCILLATE"))
|
||||||
{
|
{
|
||||||
// This probably came off the tail of an earlier definition. It's technically legal syntax, but we don't support it.
|
// This probably came off the tail of an earlier definition. It's technically legal syntax, but we don't support it.
|
||||||
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"OSCILLATE\" (the animation plays in reverse when it reaches the end) are not supported by SRB2");
|
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"OSCILLATE\" (the animation plays in reverse when it reaches the end) are not supported by SRB2");
|
||||||
@@ -383,11 +386,17 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Expected \"TEXTURE\" or \"FLAT\", got \"%s\"",animdefsToken);
|
I_Error("Error parsing ANIMDEFS lump: Expected \"TEXTURE\" or \"FLAT\", got \"%s\"",animdefsToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse next line
|
// parse next line
|
||||||
while (*p != '\0' && *p != '\n') ++p;
|
while (*p != '\0' && *p != '\n')
|
||||||
if (*p == '\n') ++p;
|
++p;
|
||||||
|
|
||||||
|
if (*p == '\n')
|
||||||
|
++p;
|
||||||
|
|
||||||
animdefsToken = M_GetToken(p);
|
animdefsToken = M_GetToken(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
Z_Free((void *)animdefsText);
|
Z_Free((void *)animdefsText);
|
||||||
}
|
}
|
||||||
@@ -406,7 +415,8 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be");
|
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be");
|
||||||
}
|
}
|
||||||
if (stricmp(animdefsToken, "OPTIONAL") == 0)
|
|
||||||
|
if (fasticmp(animdefsToken, "OPTIONAL"))
|
||||||
{
|
{
|
||||||
// This is meaningful to ZDoom - it tells the program NOT to bomb out
|
// This is meaningful to ZDoom - it tells the program NOT to bomb out
|
||||||
// if the textures can't be found - but it's useless in SRB2, so we'll
|
// if the textures can't be found - but it's useless in SRB2, so we'll
|
||||||
@@ -418,7 +428,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be");
|
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be");
|
||||||
}
|
}
|
||||||
else if (stricmp(animdefsToken, "RANGE") == 0)
|
else if (fasticmp(animdefsToken, "RANGE"))
|
||||||
{
|
{
|
||||||
// Oh. Um. Apparently "OPTIONAL" is a texture name. Naughty.
|
// Oh. Um. Apparently "OPTIONAL" is a texture name. Naughty.
|
||||||
// I should probably handle this more gracefully, but right now
|
// I should probably handle this more gracefully, but right now
|
||||||
@@ -427,15 +437,17 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
I_Error("Error parsing ANIMDEFS lump: \"OPTIONAL\" is a keyword; you cannot use it as the startname of an animation");
|
I_Error("Error parsing ANIMDEFS lump: \"OPTIONAL\" is a keyword; you cannot use it as the startname of an animation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
animdefsTokenLength = strlen(animdefsToken);
|
animdefsTokenLength = strlen(animdefsToken);
|
||||||
if (animdefsTokenLength>8)
|
if (animdefsTokenLength > 8)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
|
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for existing animdef
|
// Search for existing animdef
|
||||||
for (i = 0; i < maxanims; i++)
|
for (i = 0; i < maxanims; i++)
|
||||||
if (stricmp(animdefsToken, animdefs[i].startname) == 0)
|
{
|
||||||
|
if (fasticmp(animdefsToken, animdefs[i].startname))
|
||||||
{
|
{
|
||||||
//CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken);
|
//CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken);
|
||||||
|
|
||||||
@@ -444,6 +456,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Not found
|
// Not found
|
||||||
if (i == maxanims)
|
if (i == maxanims)
|
||||||
@@ -467,21 +480,25 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"RANGE\" after \"%s\"'s startname should be", animdefs[i].startname);
|
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"RANGE\" after \"%s\"'s startname should be", animdefs[i].startname);
|
||||||
}
|
}
|
||||||
if (stricmp(animdefsToken, "ALLOWDECALS") == 0)
|
|
||||||
|
if (fasticmp(animdefsToken, "ALLOWDECALS"))
|
||||||
{
|
{
|
||||||
// Another ZDoom keyword, ho-hum. Skip it, move on to the next token.
|
// Another ZDoom keyword, ho-hum. Skip it, move on to the next token.
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
animdefsToken = M_GetToken(NULL);
|
animdefsToken = M_GetToken(NULL);
|
||||||
}
|
}
|
||||||
if (stricmp(animdefsToken, "PIC") == 0)
|
|
||||||
|
if (fasticmp(animdefsToken, "PIC"))
|
||||||
{
|
{
|
||||||
// This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it.
|
// This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it.
|
||||||
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"PIC\" (specific frames instead of a consecutive range) are not supported by SRB2");
|
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"PIC\" (specific frames instead of a consecutive range) are not supported by SRB2");
|
||||||
}
|
}
|
||||||
if (stricmp(animdefsToken, "RANGE") != 0)
|
|
||||||
|
if (!fasticmp(animdefsToken, "RANGE"))
|
||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Expected \"RANGE\" after \"%s\"'s startname, got \"%s\"", animdefs[i].startname, animdefsToken);
|
I_Error("Error parsing ANIMDEFS lump: Expected \"RANGE\" after \"%s\"'s startname, got \"%s\"", animdefs[i].startname, animdefsToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
|
|
||||||
// Endname
|
// Endname
|
||||||
@@ -490,11 +507,13 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s end texture/flat name should be", animdefs[i].startname);
|
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s end texture/flat name should be", animdefs[i].startname);
|
||||||
}
|
}
|
||||||
|
|
||||||
animdefsTokenLength = strlen(animdefsToken);
|
animdefsTokenLength = strlen(animdefsToken);
|
||||||
if (animdefsTokenLength>8)
|
if (animdefsTokenLength>8)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
|
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(animdefs[i].endname, animdefsToken, 9);
|
strncpy(animdefs[i].endname, animdefsToken, 9);
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
|
|
||||||
@@ -504,15 +523,18 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s \"TICS\" should be", animdefs[i].startname);
|
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s \"TICS\" should be", animdefs[i].startname);
|
||||||
}
|
}
|
||||||
if (stricmp(animdefsToken, "RAND") == 0)
|
|
||||||
|
if (fasticmp(animdefsToken, "RAND"))
|
||||||
{
|
{
|
||||||
// This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it.
|
// This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it.
|
||||||
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"RAND\" (random duration per frame) are not supported by SRB2");
|
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"RAND\" (random duration per frame) are not supported by SRB2");
|
||||||
}
|
}
|
||||||
if (stricmp(animdefsToken, "TICS") != 0)
|
|
||||||
|
if (!fasticmp(animdefsToken, "TICS"))
|
||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Expected \"TICS\" in animation definition for \"%s\", got \"%s\"", animdefs[i].startname, animdefsToken);
|
I_Error("Error parsing ANIMDEFS lump: Expected \"TICS\" in animation definition for \"%s\", got \"%s\"", animdefs[i].startname, animdefsToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
|
|
||||||
// Speed
|
// Speed
|
||||||
@@ -521,6 +543,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s animation speed should be", animdefs[i].startname);
|
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s animation speed should be", animdefs[i].startname);
|
||||||
}
|
}
|
||||||
|
|
||||||
endPos = NULL;
|
endPos = NULL;
|
||||||
#ifndef AVOID_ERRNO
|
#ifndef AVOID_ERRNO
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@@ -535,6 +558,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing ANIMDEFS lump: Expected a positive integer for \"%s\"'s animation speed, got \"%s\"", animdefs[i].startname, animdefsToken);
|
I_Error("Error parsing ANIMDEFS lump: Expected a positive integer for \"%s\"'s animation speed, got \"%s\"", animdefs[i].startname, animdefsToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
animdefs[i].speed = animSpeed;
|
animdefs[i].speed = animSpeed;
|
||||||
Z_Free(animdefsToken);
|
Z_Free(animdefsToken);
|
||||||
}
|
}
|
||||||
@@ -2091,8 +2115,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||||||
// Change the music and apply position/fade operations
|
// Change the music and apply position/fade operations
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(mapmusic.name, sides[line->sidenum[0]].text, 7);
|
strlcpy(mapmusic.name, sides[line->sidenum[0]].text, sizeof(mapmusic.name));
|
||||||
mapmusic.name[6] = 0;
|
|
||||||
|
|
||||||
mapmusic.flags = tracknum & MUSIC_TRACKMASK;
|
mapmusic.flags = tracknum & MUSIC_TRACKMASK;
|
||||||
if (!(line->flags & ML_BLOCKMONSTERS))
|
if (!(line->flags & ML_BLOCKMONSTERS))
|
||||||
@@ -5387,7 +5410,6 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
|||||||
// set current weather
|
// set current weather
|
||||||
curWeather = mapheaderinfo[gamemap-1]->weather;
|
curWeather = mapheaderinfo[gamemap-1]->weather;
|
||||||
|
|
||||||
P_InitTagLists(); // Create xref tables for tags
|
|
||||||
P_SearchForDisableLinedefs(); // Disable linedefs are now allowed to disable *any* line
|
P_SearchForDisableLinedefs(); // Disable linedefs are now allowed to disable *any* line
|
||||||
|
|
||||||
P_SpawnScrollers(); // Add generalized scrollers
|
P_SpawnScrollers(); // Add generalized scrollers
|
||||||
|
|||||||
+17
-7
@@ -3315,7 +3315,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
|||||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||||
}
|
}
|
||||||
|
|
||||||
lang += (cmd->angleturn<<16);
|
lang += (cmd->angleturn << 16);
|
||||||
|
|
||||||
cam->localangle = lang;
|
cam->localangle = lang;
|
||||||
if (!cam->reset_aiming)
|
if (!cam->reset_aiming)
|
||||||
@@ -3821,7 +3821,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||||||
|
|
||||||
if (demo.playback)
|
if (demo.playback)
|
||||||
{
|
{
|
||||||
focusangle = mo->angle;
|
// Hack-adjacent.
|
||||||
|
// Sometimes stale ticcmds send a weird angle at the start of the race.
|
||||||
|
// P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here.
|
||||||
|
if (cv_demoangturn.value && leveltime > starttime)
|
||||||
|
focusangle = player->cmd.angleturn << 16;
|
||||||
|
else
|
||||||
|
focusangle = mo->angle; // Just use something known sane.
|
||||||
focusaiming = 0;
|
focusaiming = 0;
|
||||||
}
|
}
|
||||||
else if (P_IsLocalPlayer(player))
|
else if (P_IsLocalPlayer(player))
|
||||||
@@ -4309,17 +4315,19 @@ static void P_CalcPostImg(player_t *player, camera_t *thiscam)
|
|||||||
{
|
{
|
||||||
sector_t *sector = NULL;
|
sector_t *sector = NULL;
|
||||||
UINT8 postimgtype = 0;
|
UINT8 postimgtype = 0;
|
||||||
//INT32 *param;
|
|
||||||
fixed_t pviewheight = 0;
|
fixed_t pviewheight = 0;
|
||||||
|
#ifdef MOTIONBLUR
|
||||||
|
INT32 *param;
|
||||||
|
|
||||||
/*for (i = 0; i <= splitscreen; i++)
|
for (i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
if (player == &players[displayplayers[i]])
|
if (player == &players[displayplayers[i]])
|
||||||
{
|
{
|
||||||
param = &postimgparam[i];
|
param = &postimgparam[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (encoremode) // srb2kart
|
if (encoremode) // srb2kart
|
||||||
postimgtype |= POSTIMG_MIRROR;
|
postimgtype |= POSTIMG_MIRROR;
|
||||||
@@ -4355,16 +4363,18 @@ static void P_CalcPostImg(player_t *player, camera_t *thiscam)
|
|||||||
else if (P_CameraCheckHeatFirstperson(player, sector, pviewheight))
|
else if (P_CameraCheckHeatFirstperson(player, sector, pviewheight))
|
||||||
postimgtype |= POSTIMG_HEAT;
|
postimgtype |= POSTIMG_HEAT;
|
||||||
|
|
||||||
|
#ifdef MOTIONBLUR
|
||||||
// Motion blur
|
// Motion blur
|
||||||
// unused
|
// unused
|
||||||
/*if (player->speed > (35<<FRACBITS))
|
if (player->speed > (35<<FRACBITS))
|
||||||
{
|
{
|
||||||
postimgtype |= POSTIMG_MOTION;
|
postimgtype |= POSTIMG_MOTION;
|
||||||
*param = (player->speed - 32)/4;
|
*param = (player->speed - 32)/4;
|
||||||
|
|
||||||
if (*param > 5)
|
if (*param > 5)
|
||||||
*param = 5;
|
*param = 5;
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
thiscam->postimg = postimgtype;
|
thiscam->postimg = postimgtype;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ void R_ClearDrawSegs(void)
|
|||||||
// CPhipps -
|
// CPhipps -
|
||||||
// Instead of clipsegs, let's try using an array with one entry for each column,
|
// Instead of clipsegs, let's try using an array with one entry for each column,
|
||||||
// indicating whether it's blocked by a solid wall yet or not.
|
// indicating whether it's blocked by a solid wall yet or not.
|
||||||
UINT8 *solidcol;
|
UINT8 *solidcol = NULL;
|
||||||
|
|
||||||
void R_AllocClipSegMemory(void)
|
void R_AllocClipSegMemory(void)
|
||||||
{
|
{
|
||||||
|
|||||||
+151
-96
@@ -90,21 +90,21 @@ INT32 numtextures = 0; // total number of textures found,
|
|||||||
// size of following tables
|
// size of following tables
|
||||||
|
|
||||||
texture_t **textures = NULL;
|
texture_t **textures = NULL;
|
||||||
static UINT32 **texturecolumnofs; // column offset lookup table for each texture
|
static UINT32 **texturecolumnofs = NULL; // column offset lookup table for each texture
|
||||||
UINT8 **texturecache; // graphics data for each generated full-size texture
|
UINT8 **texturecache = NULL; // graphics data for each generated full-size texture
|
||||||
|
|
||||||
// texture width is a power of 2, so it can easily repeat along sidedefs using a simple mask
|
// texture width is a power of 2, so it can easily repeat along sidedefs using a simple mask
|
||||||
static INT32 *texturewidthmask;
|
static INT32 *texturewidth = NULL;
|
||||||
|
|
||||||
fixed_t *textureheight; // needed for texture pegging
|
fixed_t *textureheight = NULL; // needed for texture pegging
|
||||||
|
|
||||||
INT32 *texturetranslation;
|
INT32 *texturetranslation = NULL;
|
||||||
|
|
||||||
// needed for pre rendering
|
// needed for pre rendering
|
||||||
sprcache_t *spritecachedinfo;
|
sprcache_t *spritecachedinfo = NULL;
|
||||||
|
|
||||||
lighttable_t *colormaps;
|
lighttable_t *colormaps = NULL;
|
||||||
UINT8 *encoremap;
|
UINT8 *encoremap = NULL;
|
||||||
#ifdef HASINVERT
|
#ifdef HASINVERT
|
||||||
UINT8 invertmap[256];
|
UINT8 invertmap[256];
|
||||||
#endif
|
#endif
|
||||||
@@ -241,11 +241,12 @@ static INT32 tidcachelen = 0;
|
|||||||
// R_DrawColumnInCache
|
// R_DrawColumnInCache
|
||||||
// Clip and draw a column from a patch into a cached post.
|
// Clip and draw a column from a patch into a cached post.
|
||||||
//
|
//
|
||||||
static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 originy, INT32 cacheheight)
|
static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, texpatch_t *originPatch, INT32 cacheheight)
|
||||||
{
|
{
|
||||||
INT32 count, position;
|
INT32 count, position;
|
||||||
UINT8 *source;
|
UINT8 *source;
|
||||||
INT32 topdelta, prevdelta = -1;
|
INT32 topdelta, prevdelta = -1;
|
||||||
|
INT32 originy = originPatch->originy;
|
||||||
|
|
||||||
while (patch->topdelta != 0xff)
|
while (patch->topdelta != 0xff)
|
||||||
{
|
{
|
||||||
@@ -260,6 +261,7 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 orig
|
|||||||
if (position < 0)
|
if (position < 0)
|
||||||
{
|
{
|
||||||
count += position;
|
count += position;
|
||||||
|
source -= position; // start further down the column
|
||||||
position = 0;
|
position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +275,50 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 orig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UINT8 *R_AllocateTextureBlock(size_t blocksize, UINT8 **user)
|
||||||
|
{
|
||||||
|
texturememory += blocksize;
|
||||||
|
|
||||||
|
return Z_Malloc(blocksize, PU_LEVEL, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT8 *R_AllocateDummyTextureBlock(size_t width, UINT8 **user)
|
||||||
|
{
|
||||||
|
// Allocate dummy data. Keep 4-bytes aligned.
|
||||||
|
// Column offsets will be initialized to 0, which points to the 0xff byte (empty column flag).
|
||||||
|
size_t blocksize = 4 + (width * 4);
|
||||||
|
UINT8 *block = R_AllocateTextureBlock(blocksize, user);
|
||||||
|
|
||||||
|
memset(block, 0, blocksize);
|
||||||
|
block[0] = 0xff;
|
||||||
|
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean R_CheckTextureLumpLength(texture_t *texture, size_t patch)
|
||||||
|
{
|
||||||
|
UINT16 wadnum = texture->patches[patch].wad;
|
||||||
|
UINT16 lumpnum = texture->patches[patch].lump;
|
||||||
|
size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
|
|
||||||
|
// The header does not exist
|
||||||
|
if (lumplength < offsetof(softwarepatch_t, columnofs))
|
||||||
|
{
|
||||||
|
CONS_Alert(
|
||||||
|
CONS_ERROR,
|
||||||
|
"%.8s: texture lump data is too small. Expected %s bytes, got %s. (%s)\n",
|
||||||
|
texture->name,
|
||||||
|
sizeu1(offsetof(softwarepatch_t, columnofs)),
|
||||||
|
sizeu2(lumplength),
|
||||||
|
wadfiles[wadnum]->lumpinfo[lumpnum].fullname
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_GenerateTexture
|
// R_GenerateTexture
|
||||||
//
|
//
|
||||||
@@ -297,6 +343,10 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
column_t *patchcol;
|
column_t *patchcol;
|
||||||
UINT8 *colofs;
|
UINT8 *colofs;
|
||||||
|
|
||||||
|
UINT16 wadnum;
|
||||||
|
lumpnum_t lumpnum;
|
||||||
|
size_t lumplength;
|
||||||
|
|
||||||
I_Assert(texnum <= (size_t)numtextures);
|
I_Assert(texnum <= (size_t)numtextures);
|
||||||
texture = textures[texnum];
|
texture = textures[texnum];
|
||||||
I_Assert(texture != NULL);
|
I_Assert(texture != NULL);
|
||||||
@@ -311,45 +361,57 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
{
|
{
|
||||||
boolean holey = false;
|
boolean holey = false;
|
||||||
patch = texture->patches;
|
patch = texture->patches;
|
||||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL);
|
|
||||||
|
wadnum = patch->wad;
|
||||||
|
lumpnum = patch->lump;
|
||||||
|
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
|
|
||||||
|
// The header does not exist
|
||||||
|
if (R_CheckTextureLumpLength(texture, 0) == false)
|
||||||
|
{
|
||||||
|
block = R_AllocateDummyTextureBlock(texture->width, &texturecache[texnum]);
|
||||||
|
texturecolumnofs[texnum] = (UINT32*)&block[4];
|
||||||
|
textures[texnum]->holes = true;
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdata = (UINT8*)W_CacheLumpNumPwad(wadnum, lumpnum, PU_LEVEL);
|
||||||
realpatch = (softwarepatch_t *)pdata;
|
realpatch = (softwarepatch_t *)pdata;
|
||||||
|
|
||||||
// Check the patch for holes.
|
// Check the patch for holes.
|
||||||
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
||||||
holey = true;
|
holey = true;
|
||||||
else
|
|
||||||
|
colofs = (UINT8 *)realpatch->columnofs;
|
||||||
|
|
||||||
|
for (x = 0; x < texture->width && !holey; x++)
|
||||||
{
|
{
|
||||||
colofs = (UINT8 *)realpatch->columnofs;
|
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
|
||||||
|
|
||||||
for (x = 0; x < texture->width; x++)
|
INT32 topdelta, prevdelta = -1, y = 0;
|
||||||
|
|
||||||
|
while (col->topdelta != 0xff)
|
||||||
{
|
{
|
||||||
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
|
topdelta = col->topdelta;
|
||||||
|
if (topdelta <= prevdelta)
|
||||||
INT32 topdelta, prevdelta = -1, y = 0;
|
topdelta += prevdelta;
|
||||||
|
prevdelta = topdelta;
|
||||||
while (col->topdelta != 0xff)
|
if (topdelta > y)
|
||||||
{
|
break;
|
||||||
topdelta = col->topdelta;
|
y = topdelta + col->length + 1;
|
||||||
if (topdelta <= prevdelta)
|
col = (column_t *)((UINT8 *)col + col->length + 4);
|
||||||
topdelta += prevdelta;
|
|
||||||
prevdelta = topdelta;
|
|
||||||
if (topdelta > y)
|
|
||||||
break;
|
|
||||||
y = topdelta + col->length + 1;
|
|
||||||
col = (column_t *)((UINT8 *)col + col->length + 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y < texture->height)
|
|
||||||
holey = true; // this texture is HOLEy! D:
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (y < texture->height)
|
||||||
|
holey = true; // this texture is HOLEy! D:
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the patch uses transparency, we have to save it this way.
|
// If the patch uses transparency, we have to save it this way.
|
||||||
if (holey)
|
if (holey)
|
||||||
{
|
{
|
||||||
texture->holes = true;
|
texture->holes = true;
|
||||||
blocksize = W_LumpLengthPwad(patch->wad, patch->lump);
|
blocksize = lumplength;
|
||||||
block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]);
|
block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]); // will change tag at end of this function
|
||||||
M_Memcpy(block, realpatch, blocksize);
|
M_Memcpy(block, realpatch, blocksize);
|
||||||
texturememory += blocksize;
|
texturememory += blocksize;
|
||||||
|
|
||||||
@@ -365,7 +427,6 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, do multipatch format.
|
// Otherwise, do multipatch format.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,10 +445,18 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
// texture data after the lookup table
|
// texture data after the lookup table
|
||||||
blocktex = block + (texture->width*4);
|
blocktex = block + (texture->width*4);
|
||||||
|
|
||||||
|
for (x = 0; x < texture->width; ++x)
|
||||||
|
{
|
||||||
|
// generate column ofset lookup
|
||||||
|
*(UINT32 *)&colofs[x<<2] = LONG((x * texture->height) + (texture->width*4));
|
||||||
|
}
|
||||||
|
|
||||||
// Composite the columns together.
|
// Composite the columns together.
|
||||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||||
{
|
{
|
||||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL);
|
wadnum = patch->wad;
|
||||||
|
lumpnum = patch->lump;
|
||||||
|
pdata = (UINT8*)W_CacheLumpNumPwad(wadnum, lumpnum, PU_LEVEL);
|
||||||
realpatch = (softwarepatch_t *)pdata;
|
realpatch = (softwarepatch_t *)pdata;
|
||||||
|
|
||||||
x1 = patch->originx;
|
x1 = patch->originx;
|
||||||
@@ -418,9 +487,7 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
{
|
{
|
||||||
patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1]));
|
patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1]));
|
||||||
|
|
||||||
// generate column ofset lookup
|
R_DrawColumnInCache(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch, texture->height);
|
||||||
*(UINT32 *)&colofs[x<<2] = LONG((x * texture->height) + (texture->width*4));
|
|
||||||
R_DrawColumnInCache(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch->originy, texture->height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +506,7 @@ INT32 R_GetTextureNum(INT32 texnum)
|
|||||||
{
|
{
|
||||||
if (texnum < 0 || texnum >= numtextures)
|
if (texnum < 0 || texnum >= numtextures)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return texturetranslation[texnum];
|
return texturetranslation[texnum];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,17 +524,12 @@ void R_CheckTextureCache(INT32 tex)
|
|||||||
|
|
||||||
static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
||||||
{
|
{
|
||||||
if (texturewidthmask[tex])
|
INT32 width = texturewidth[tex];
|
||||||
col &= texturewidthmask[tex]; // set by load textures
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const INT16 texwidth = textures[tex]->width;
|
|
||||||
|
|
||||||
// Odd width texture, cannot just mask.
|
if (width & (width - 1))
|
||||||
// Sometime gets colnum = -1 or = width, even without tiling.
|
col = (UINT32)col % width;
|
||||||
// Test LostCiv, Map 20, crates.
|
else
|
||||||
col = ((col % texwidth) + texwidth) % texwidth;
|
col &= (width - 1);
|
||||||
}
|
|
||||||
|
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
@@ -476,13 +539,6 @@ static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
|||||||
//
|
//
|
||||||
UINT8 *R_GetColumn(fixed_t tex, INT32 col)
|
UINT8 *R_GetColumn(fixed_t tex, INT32 col)
|
||||||
{
|
{
|
||||||
if (!texturecache[tex])
|
|
||||||
{
|
|
||||||
// This must be here because cache can be freed by other operations.
|
|
||||||
// To prevent must lock individual texture cache on every draw.
|
|
||||||
R_GenerateTexture(tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return texturecache[tex] + LONG(texturecolumnofs[tex][wrap_column(tex, col)]);
|
return texturecache[tex] + LONG(texturecolumnofs[tex][wrap_column(tex, col)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,11 +572,10 @@ static INT32
|
|||||||
Rloadtextures (INT32 i, INT32 w)
|
Rloadtextures (INT32 i, INT32 w)
|
||||||
{
|
{
|
||||||
UINT16 j, numlumps = 0;
|
UINT16 j, numlumps = 0;
|
||||||
INT32 k;
|
|
||||||
UINT16 texstart, texend, texturesLumpPos;
|
UINT16 texstart, texend, texturesLumpPos;
|
||||||
softwarepatch_t *patchlump;
|
|
||||||
texpatch_t *patch;
|
texpatch_t *patch;
|
||||||
texture_t *texture;
|
texture_t *texture;
|
||||||
|
softwarepatch_t patchlump;
|
||||||
|
|
||||||
// Get the lump numbers for the markers in the WAD, if they exist.
|
// Get the lump numbers for the markers in the WAD, if they exist.
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
if (W_FileHasFolders(wadfiles[w]))
|
||||||
@@ -560,7 +615,7 @@ Rloadtextures (INT32 i, INT32 w)
|
|||||||
continue; // If it is then SKIP IT
|
continue; // If it is then SKIP IT
|
||||||
}
|
}
|
||||||
|
|
||||||
patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC);
|
W_ReadLumpHeaderPwad(wadnum, lumpnum, &patchlump, PNG_HEADER_SIZE, 0);
|
||||||
|
|
||||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((wadnum, lumpnum), patchlump->width, patchlump->height);
|
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((wadnum, lumpnum), patchlump->width, patchlump->height);
|
||||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||||
@@ -568,8 +623,10 @@ Rloadtextures (INT32 i, INT32 w)
|
|||||||
// Set texture properties.
|
// Set texture properties.
|
||||||
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||||
texture->hash = quickncasehash(texture->name, 8);
|
texture->hash = quickncasehash(texture->name, 8);
|
||||||
texture->width = SHORT(patchlump->width);
|
|
||||||
texture->height = SHORT(patchlump->height);
|
texture->width = SHORT(patchlump.width);
|
||||||
|
texture->height = SHORT(patchlump.height);
|
||||||
|
|
||||||
texture->type = TEXTURETYPE_SINGLEPATCH;
|
texture->type = TEXTURETYPE_SINGLEPATCH;
|
||||||
texture->patchcount = 1;
|
texture->patchcount = 1;
|
||||||
texture->holes = false;
|
texture->holes = false;
|
||||||
@@ -581,27 +638,7 @@ Rloadtextures (INT32 i, INT32 w)
|
|||||||
patch->wad = wadnum;
|
patch->wad = wadnum;
|
||||||
patch->lump = texstart + j;
|
patch->lump = texstart + j;
|
||||||
|
|
||||||
Z_Free(patchlump);
|
texturewidth[i] = texture->width;
|
||||||
|
|
||||||
// determine width power of 2
|
|
||||||
#if 1
|
|
||||||
// [WDJ] only need to determine if exact power of 2.
|
|
||||||
k = 1;
|
|
||||||
while (k < texture->width)
|
|
||||||
k<<=1;
|
|
||||||
#else
|
|
||||||
// Largest power of 2 that fits within width.
|
|
||||||
k = 1;
|
|
||||||
while (k << 1 <= texture->width)
|
|
||||||
k <<= 1;
|
|
||||||
#endif
|
|
||||||
if (k != texture->width)
|
|
||||||
{
|
|
||||||
// Odd width
|
|
||||||
k = 1; // make texturewidthmask = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
texturewidthmask[i] = k - 1;
|
|
||||||
textureheight[i] = texture->height << FRACBITS;
|
textureheight[i] = texture->height << FRACBITS;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -709,7 +746,7 @@ static void R_AllocateTextures(INT32 add)
|
|||||||
// Allocate texture referencing cache.
|
// Allocate texture referencing cache.
|
||||||
recallocuser(&texturecache, oldsize, newsize);
|
recallocuser(&texturecache, oldsize, newsize);
|
||||||
// Allocate texture width table.
|
// Allocate texture width table.
|
||||||
recallocuser(&texturewidthmask, oldsize, newsize);
|
recallocuser(&texturewidth, oldsize, newsize);
|
||||||
// Allocate texture height table.
|
// Allocate texture height table.
|
||||||
recallocuser(&textureheight, oldsize, newsize);
|
recallocuser(&textureheight, oldsize, newsize);
|
||||||
// Create translation table for global animation.
|
// Create translation table for global animation.
|
||||||
@@ -830,7 +867,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
|||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after \"%s\"'s patch name should be",patchName);
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after \"%s\"'s patch name should be",patchName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(texturesToken,",")!=0)
|
if (!fastcmp(texturesToken,","))
|
||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Expected \",\" after %s's patch name, got \"%s\"",patchName,texturesToken);
|
I_Error("Error parsing TEXTURES lump: Expected \",\" after %s's patch name, got \"%s\"",patchName,texturesToken);
|
||||||
}
|
}
|
||||||
@@ -870,7 +907,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
|||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after patch \"%s\"'s x coordinate should be",patchName);
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after patch \"%s\"'s x coordinate should be",patchName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(texturesToken,",")!=0)
|
if (!fastcmp(texturesToken,","))
|
||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Expected \",\" after patch \"%s\"'s x coordinate, got \"%s\"",patchName,texturesToken);
|
I_Error("Error parsing TEXTURES lump: Expected \",\" after patch \"%s\"'s x coordinate, got \"%s\"",patchName,texturesToken);
|
||||||
}
|
}
|
||||||
@@ -939,8 +976,9 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where texture name should be");
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where texture name should be");
|
||||||
}
|
}
|
||||||
|
|
||||||
texturesTokenLength = strlen(texturesToken);
|
texturesTokenLength = strlen(texturesToken);
|
||||||
if (texturesTokenLength>8)
|
if (texturesTokenLength > 8)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Texture name \"%s\" exceeds 8 characters",texturesToken);
|
I_Error("Error parsing TEXTURES lump: Texture name \"%s\" exceeds 8 characters",texturesToken);
|
||||||
}
|
}
|
||||||
@@ -951,6 +989,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
// ^^ we've confirmed that the token is <= 8 characters so it will never overflow a 9 byte char buffer
|
// ^^ we've confirmed that the token is <= 8 characters so it will never overflow a 9 byte char buffer
|
||||||
strupr(newTextureName); // Just do this now so we don't have to worry about it
|
strupr(newTextureName); // Just do this now so we don't have to worry about it
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
|
|
||||||
// Comma 1
|
// Comma 1
|
||||||
@@ -959,10 +998,11 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s name should be",newTextureName);
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s name should be",newTextureName);
|
||||||
}
|
}
|
||||||
else if (strcmp(texturesToken,",")!=0)
|
else if (!fastcmp(texturesToken, ","))
|
||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s name, got \"%s\"",newTextureName,texturesToken);
|
I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s name, got \"%s\"",newTextureName,texturesToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
|
|
||||||
// Width
|
// Width
|
||||||
@@ -993,10 +1033,12 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s width should be",newTextureName);
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s width should be",newTextureName);
|
||||||
}
|
}
|
||||||
if (strcmp(texturesToken,",")!=0)
|
|
||||||
|
if (!fastcmp(texturesToken, ","))
|
||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s width, got \"%s\"",newTextureName,texturesToken);
|
I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s width, got \"%s\"",newTextureName,texturesToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
|
|
||||||
// Height
|
// Height
|
||||||
@@ -1029,7 +1071,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where open curly brace for texture \"%s\" should be",newTextureName);
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where open curly brace for texture \"%s\" should be",newTextureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(texturesToken,"{")==0)
|
if (fastcmp(texturesToken, "{"))
|
||||||
{
|
{
|
||||||
if (actuallyLoadTexture)
|
if (actuallyLoadTexture)
|
||||||
{
|
{
|
||||||
@@ -1041,15 +1083,18 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
resultTexture->height = newTextureHeight;
|
resultTexture->height = newTextureHeight;
|
||||||
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
|
|
||||||
texturesToken = M_GetToken(NULL);
|
texturesToken = M_GetToken(NULL);
|
||||||
if (texturesToken == NULL)
|
if (texturesToken == NULL)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch definition for texture \"%s\" should be",newTextureName);
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch definition for texture \"%s\" should be",newTextureName);
|
||||||
}
|
}
|
||||||
while (strcmp(texturesToken,"}")!=0)
|
|
||||||
|
while (!fastcmp(texturesToken, "}"))
|
||||||
{
|
{
|
||||||
if (stricmp(texturesToken, "PATCH")==0)
|
if (fasticmp(texturesToken, "PATCH"))
|
||||||
{
|
{
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
if (resultTexture)
|
if (resultTexture)
|
||||||
@@ -1081,6 +1126,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch declaration or right curly brace for texture \"%s\" should be",newTextureName);
|
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch declaration or right curly brace for texture \"%s\" should be",newTextureName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultTexture && resultTexture->patchcount == 0)
|
if (resultTexture && resultTexture->patchcount == 0)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Texture \"%s\" must have at least one patch",newTextureName);
|
I_Error("Error parsing TEXTURES lump: Texture \"%s\" must have at least one patch",newTextureName);
|
||||||
@@ -1090,10 +1136,13 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Expected \"{\" for texture \"%s\", got \"%s\"",newTextureName,texturesToken);
|
I_Error("Error parsing TEXTURES lump: Expected \"{\" for texture \"%s\", got \"%s\"",newTextureName,texturesToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
|
|
||||||
if (actuallyLoadTexture) return resultTexture;
|
if (actuallyLoadTexture)
|
||||||
else return NULL;
|
return resultTexture;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses the TEXTURES lump... but just to count the number of textures.
|
// Parses the TEXTURES lump... but just to count the number of textures.
|
||||||
@@ -1125,7 +1174,7 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum)
|
|||||||
texturesToken = M_GetToken(texturesText);
|
texturesToken = M_GetToken(texturesText);
|
||||||
while (texturesToken != NULL)
|
while (texturesToken != NULL)
|
||||||
{
|
{
|
||||||
if (stricmp(texturesToken, "WALLTEXTURE")==0)
|
if (fasticmp(texturesToken, "WALLTEXTURE"))
|
||||||
{
|
{
|
||||||
numTexturesInLump++;
|
numTexturesInLump++;
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
@@ -1135,8 +1184,10 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken);
|
I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
texturesToken = M_GetToken(NULL);
|
texturesToken = M_GetToken(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
Z_Free((void *)texturesText);
|
Z_Free((void *)texturesText);
|
||||||
|
|
||||||
@@ -1174,14 +1225,14 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
|
|||||||
texturesToken = M_GetToken(texturesText);
|
texturesToken = M_GetToken(texturesText);
|
||||||
while (texturesToken != NULL)
|
while (texturesToken != NULL)
|
||||||
{
|
{
|
||||||
if (stricmp(texturesToken, "WALLTEXTURE")==0)
|
if (fasticmp(texturesToken, "WALLTEXTURE"))
|
||||||
{
|
{
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
// Get the new texture
|
// Get the new texture
|
||||||
newTexture = R_ParseTexture(true);
|
newTexture = R_ParseTexture(true);
|
||||||
// Store the new texture
|
// Store the new texture
|
||||||
textures[*texindex] = newTexture;
|
textures[*texindex] = newTexture;
|
||||||
texturewidthmask[*texindex] = newTexture->width - 1;
|
texturewidth[*texindex] = newTexture->width;
|
||||||
textureheight[*texindex] = newTexture->height << FRACBITS;
|
textureheight[*texindex] = newTexture->height << FRACBITS;
|
||||||
// Increment i back in R_LoadTextures()
|
// Increment i back in R_LoadTextures()
|
||||||
(*texindex)++;
|
(*texindex)++;
|
||||||
@@ -1190,8 +1241,10 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken);
|
I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
texturesToken = M_GetToken(NULL);
|
texturesToken = M_GetToken(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(texturesToken);
|
Z_Free(texturesToken);
|
||||||
Z_Free((void *)texturesText);
|
Z_Free((void *)texturesText);
|
||||||
}
|
}
|
||||||
@@ -1297,8 +1350,9 @@ lumpnum_t R_GetFlatNumForName(const char *name)
|
|||||||
|
|
||||||
if (lump == LUMPERROR)
|
if (lump == LUMPERROR)
|
||||||
{
|
{
|
||||||
if (strcmp(name, SKYFLATNAME))
|
if (!fastcmp(name, SKYFLATNAME))
|
||||||
CONS_Debug(DBG_SETUP, "R_GetFlatNumForName: Could not find flat %.8s\n", name);
|
CONS_Debug(DBG_SETUP, "R_GetFlatNumForName: Could not find flat %.8s\n", name);
|
||||||
|
|
||||||
lump = W_CheckNumForName("REDFLR");
|
lump = W_CheckNumForName("REDFLR");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1354,6 +1408,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
|||||||
|
|
||||||
// Load in the light tables, now 64k aligned for smokie...
|
// Load in the light tables, now 64k aligned for smokie...
|
||||||
lump = W_GetNumForName(colormap);
|
lump = W_GetNumForName(colormap);
|
||||||
|
|
||||||
if (lump == LUMPERROR)
|
if (lump == LUMPERROR)
|
||||||
lump = basecolormaplump;
|
lump = basecolormaplump;
|
||||||
else
|
else
|
||||||
|
|||||||
+2
-2
@@ -615,12 +615,12 @@ typedef struct drawseg_s
|
|||||||
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
|
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
|
||||||
INT16 *sprtopclip;
|
INT16 *sprtopclip;
|
||||||
INT16 *sprbottomclip;
|
INT16 *sprbottomclip;
|
||||||
INT16 *maskedtexturecol;
|
fixed_t *maskedtexturecol;
|
||||||
|
|
||||||
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
||||||
INT32 numffloorplanes;
|
INT32 numffloorplanes;
|
||||||
struct ffloor_s *thicksides[MAXFFLOORS];
|
struct ffloor_s *thicksides[MAXFFLOORS];
|
||||||
INT16 *thicksidecol;
|
fixed_t *thicksidecol;
|
||||||
INT32 numthicksides;
|
INT32 numthicksides;
|
||||||
fixed_t *frontscale;
|
fixed_t *frontscale;
|
||||||
|
|
||||||
|
|||||||
+107
-150
@@ -41,8 +41,7 @@
|
|||||||
|
|
||||||
/** \brief view info
|
/** \brief view info
|
||||||
*/
|
*/
|
||||||
INT32 linesize, viewwidth, viewheight, viewwindowx, viewwindowy;
|
INT32 viewwidth, viewheight, viewwindowx, viewwindowy;
|
||||||
UINT8 *renderscreen; // haleyjd
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// COLUMN DRAWING CODE STUFF
|
// COLUMN DRAWING CODE STUFF
|
||||||
@@ -489,6 +488,92 @@ void R_FlushTranslationColormapCache(void)
|
|||||||
// in reality, the few routines that can work for either mode, are
|
// in reality, the few routines that can work for either mode, are
|
||||||
// put here
|
// put here
|
||||||
|
|
||||||
|
enum columncontext_e columncontext = COLUMNCONTEXT_DIRECT;
|
||||||
|
|
||||||
|
enum ColumnFlushType
|
||||||
|
{
|
||||||
|
FLUSH_NONE = 0x0000,
|
||||||
|
FLUSH_OPAQUE = 0x0001,
|
||||||
|
FLUSH_TRANS = 0x0002,
|
||||||
|
FLUSH_COLORMAP = 0x0004,
|
||||||
|
FLUSH_COLORMAP_TRANS = 0x0008,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct drawcolumndata_temp_s
|
||||||
|
{
|
||||||
|
INT32 x;
|
||||||
|
INT32 yl[8], yh[8];
|
||||||
|
|
||||||
|
// e6y: resolution limitation is removed
|
||||||
|
UINT8 *buf;
|
||||||
|
|
||||||
|
INT32 startx;
|
||||||
|
ColumnFlushType type;
|
||||||
|
INT32 commontop, commonbot;
|
||||||
|
UINT8 *transmap;
|
||||||
|
// SoM 7-28-04: Fix the fuzz problem.
|
||||||
|
UINT8 *translation;
|
||||||
|
} drawcolumndata_temp_t;
|
||||||
|
|
||||||
|
drawcolumndata_temp_t temp_dc = {};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Error functions that will abort if R_FlushColumns tries to flush
|
||||||
|
// columns without a column type.
|
||||||
|
//
|
||||||
|
FUNCNORETURN static ATTRNORETURN void R_FlushWholeError(void)
|
||||||
|
{
|
||||||
|
I_Error("R_FlushWholeColumns called without being initialized.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCNORETURN static ATTRNORETURN void R_FlushHTError(void)
|
||||||
|
{
|
||||||
|
I_Error("R_FlushHTColumns called without being initialized.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCNORETURN static ATTRNORETURN void R_QuadFlushError(void)
|
||||||
|
{
|
||||||
|
I_Error("R_FlushQuadColumn called without being initialized.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (*R_FlushWholeColumns)(void) = R_FlushWholeError;
|
||||||
|
static void (*R_FlushHTColumns)(void) = R_FlushHTError;
|
||||||
|
static void (*R_FlushQuadColumn)(void) = R_QuadFlushError;
|
||||||
|
|
||||||
|
static void R_FlushColumns(void)
|
||||||
|
{
|
||||||
|
if (temp_dc.x != 8 || temp_dc.commontop >= temp_dc.commonbot)
|
||||||
|
R_FlushWholeColumns();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
R_FlushHTColumns();
|
||||||
|
R_FlushQuadColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
temp_dc.x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_ResetColumnBuffer
|
||||||
|
//
|
||||||
|
// haleyjd 09/13/04: new function to call from main rendering loop
|
||||||
|
// which gets rid of the unnecessary reset of various variables during
|
||||||
|
// column drawing.
|
||||||
|
//
|
||||||
|
void R_ResetColumnBuffer(void)
|
||||||
|
{
|
||||||
|
// haleyjd 10/06/05: this must not be done if x == 0!
|
||||||
|
if (temp_dc.x)
|
||||||
|
{
|
||||||
|
R_FlushColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
temp_dc.type = FLUSH_NONE;
|
||||||
|
R_FlushWholeColumns = R_FlushWholeError;
|
||||||
|
R_FlushHTColumns = R_FlushHTError;
|
||||||
|
R_FlushQuadColumn = R_QuadFlushError;
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief The R_InitViewBuffer function
|
/** \brief The R_InitViewBuffer function
|
||||||
|
|
||||||
Creates lookup tables for getting the framebuffer address
|
Creates lookup tables for getting the framebuffer address
|
||||||
@@ -521,40 +606,35 @@ static void R_AllocViewMemory(void)
|
|||||||
R_AllocVisSpriteMemory();
|
R_AllocVisSpriteMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_InitViewBuffer(void)
|
||||||
void R_InitViewBuffer(INT32 width, INT32 height)
|
|
||||||
{
|
{
|
||||||
if (width > MAXVIDWIDTH)
|
|
||||||
width = MAXVIDWIDTH;
|
|
||||||
if (height > MAXVIDHEIGHT)
|
|
||||||
height = MAXVIDHEIGHT;
|
|
||||||
|
|
||||||
R_AllocViewMemory();
|
R_AllocViewMemory();
|
||||||
|
|
||||||
viewwindowx = 0;
|
viewwindowx = 0;
|
||||||
viewwindowy = 0;
|
viewwindowy = 0;
|
||||||
|
|
||||||
linesize = vid.width; // killough 11/98
|
INT32 bufsize = (vid.width * 8) * sizeof(*temp_dc.buf);
|
||||||
renderscreen = vid.screens[0]; // haleyjd 07/02/14
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief viewborder patches lump numbers
|
if (temp_dc.buf)
|
||||||
*/
|
{
|
||||||
lumpnum_t viewborderlump[8];
|
#if defined(__SSE__)
|
||||||
|
aligned_free(temp_dc.buf);
|
||||||
|
#else
|
||||||
|
Z_Free(temp_dc.buf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief Store the lumpnumber of the viewborder patches
|
memset(&temp_dc, 0, sizeof(temp_dc));
|
||||||
*/
|
|
||||||
|
|
||||||
void R_InitViewBorder(void)
|
#if defined(__SSE__)
|
||||||
{
|
while (bufsize & 15)
|
||||||
viewborderlump[BRDR_T] = W_GetNumForName("brdr_t");
|
bufsize++;
|
||||||
viewborderlump[BRDR_B] = W_GetNumForName("brdr_b");
|
temp_dc.buf = static_cast<UINT8*>(aligned_alloc(16, bufsize));
|
||||||
viewborderlump[BRDR_L] = W_GetNumForName("brdr_l");
|
#else
|
||||||
viewborderlump[BRDR_R] = W_GetNumForName("brdr_r");
|
temp_dc.buf = static_cast<UINT8*>(Z_Malloc(bufsize, PU_STATIC, NULL));
|
||||||
viewborderlump[BRDR_TL] = W_GetNumForName("brdr_tl");
|
#endif
|
||||||
viewborderlump[BRDR_BL] = W_GetNumForName("brdr_bl");
|
|
||||||
viewborderlump[BRDR_TR] = W_GetNumForName("brdr_tr");
|
memset(temp_dc.buf, 0, bufsize);
|
||||||
viewborderlump[BRDR_BR] = W_GetNumForName("brdr_br");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief The R_VideoErase function
|
/** \brief The R_VideoErase function
|
||||||
@@ -578,129 +658,6 @@ void R_VideoErase(size_t ofs, INT32 count)
|
|||||||
M_Memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count);
|
M_Memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/** \brief R_FillBackScreen
|
|
||||||
|
|
||||||
Fills the back screen with a pattern for variable screen sizes
|
|
||||||
Also draws a beveled edge.
|
|
||||||
*/
|
|
||||||
void R_FillBackScreen(void)
|
|
||||||
{
|
|
||||||
UINT8 *src, *dest;
|
|
||||||
patch_t *patch;
|
|
||||||
INT32 x, y, step, boff;
|
|
||||||
|
|
||||||
// quickfix, don't cache lumps in both modes
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// draw pattern around the status bar too (when hires),
|
|
||||||
// so return only when in full-screen without status bar.
|
|
||||||
if (scaledviewwidth == vid.width && viewheight == vid.height)
|
|
||||||
return;
|
|
||||||
|
|
||||||
src = scr_borderpatch;
|
|
||||||
dest = vid.screens[1];
|
|
||||||
|
|
||||||
for (y = 0; y < vid.height; y++)
|
|
||||||
{
|
|
||||||
for (x = 0; x < vid.width/128; x++)
|
|
||||||
{
|
|
||||||
M_Memcpy (dest, src+((y&127)<<7), 128);
|
|
||||||
dest += 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vid.width&127)
|
|
||||||
{
|
|
||||||
M_Memcpy(dest, src+((y&127)<<7), vid.width&127);
|
|
||||||
dest += (vid.width&127);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't draw the borders when viewwidth is full vid.width.
|
|
||||||
if (scaledviewwidth == vid.width)
|
|
||||||
return;
|
|
||||||
|
|
||||||
step = 8;
|
|
||||||
boff = 8;
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_T], PU_CACHE);
|
|
||||||
for (x = 0; x < scaledviewwidth; x += step)
|
|
||||||
V_DrawPatch(viewwindowx + x, viewwindowy - boff, 1, patch);
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_B], PU_CACHE);
|
|
||||||
for (x = 0; x < scaledviewwidth; x += step)
|
|
||||||
V_DrawPatch(viewwindowx + x, viewwindowy + viewheight, 1, patch);
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_L], PU_CACHE);
|
|
||||||
for (y = 0; y < viewheight; y += step)
|
|
||||||
V_DrawPatch(viewwindowx - boff, viewwindowy + y, 1, patch);
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_R],PU_CACHE);
|
|
||||||
for (y = 0; y < viewheight; y += step)
|
|
||||||
V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy + y, 1,
|
|
||||||
patch);
|
|
||||||
|
|
||||||
// Draw beveled corners.
|
|
||||||
V_DrawPatch(viewwindowx - boff, viewwindowy - boff, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_TL], PU_CACHE));
|
|
||||||
V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy - boff, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_TR], PU_CACHE));
|
|
||||||
V_DrawPatch(viewwindowx - boff, viewwindowy + viewheight, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_BL], PU_CACHE));
|
|
||||||
V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy + viewheight, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_BR], PU_CACHE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The R_DrawViewBorder
|
|
||||||
|
|
||||||
Draws the border around the view
|
|
||||||
for different size windows?
|
|
||||||
*/
|
|
||||||
void R_DrawViewBorder(void)
|
|
||||||
{
|
|
||||||
INT32 top, side, ofs;
|
|
||||||
|
|
||||||
if (rendermode == render_none)
|
|
||||||
return;
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
HWR_DrawViewBorder(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr,"RDVB: vidwidth %d vidheight %d scaledviewwidth %d viewheight %d\n",
|
|
||||||
vid.width, vid.height, scaledviewwidth, viewheight);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (scaledviewwidth == vid.width)
|
|
||||||
return;
|
|
||||||
|
|
||||||
top = (vid.height - viewheight)>>1;
|
|
||||||
side = (vid.width - scaledviewwidth)>>1;
|
|
||||||
|
|
||||||
// copy top and one line of left side
|
|
||||||
R_VideoErase(0, top*vid.width+side);
|
|
||||||
|
|
||||||
// copy one line of right side and bottom
|
|
||||||
ofs = (viewheight+top)*vid.width - side;
|
|
||||||
R_VideoErase(ofs, top*vid.width + side);
|
|
||||||
|
|
||||||
// copy sides using wraparound
|
|
||||||
ofs = top*vid.width + vid.width-side;
|
|
||||||
side <<= 1;
|
|
||||||
|
|
||||||
// simpler using our VID_Blit routine
|
|
||||||
VID_BlitLinearScreen(vid.screens[1] + ofs, vid.screens[0] + ofs, side, viewheight - 1,
|
|
||||||
vid.width, vid.width);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// INCLUDE DRAWING CODE HERE
|
// INCLUDE DRAWING CODE HERE
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|||||||
+24
-35
@@ -25,15 +25,12 @@ extern "C" {
|
|||||||
// -------------------------------
|
// -------------------------------
|
||||||
// COMMON STUFF FOR 8bpp AND 16bpp
|
// COMMON STUFF FOR 8bpp AND 16bpp
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
extern UINT8 *renderscreen;
|
|
||||||
extern INT32 linesize;
|
|
||||||
|
|
||||||
FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
|
FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
|
||||||
{
|
{
|
||||||
return renderscreen + (py + viewwindowy) * linesize + (viewwindowx + px);
|
return vid.screens[0] + (py + viewwindowy) * vid.width + (viewwindowx + px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
} floatv3_t;
|
} floatv3_t;
|
||||||
@@ -102,6 +99,16 @@ extern floatv3_t *ds_su, *ds_sv, *ds_sz;
|
|||||||
|
|
||||||
extern float focallengthf;
|
extern float focallengthf;
|
||||||
|
|
||||||
|
enum columncontext_e
|
||||||
|
{
|
||||||
|
COLUMNCONTEXT_DIRECT = 0,
|
||||||
|
COLUMNCONTEXT_FLUSH,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern enum columncontext_e columncontext;
|
||||||
|
void R_SetColumnContext(enum columncontext_e _columncontext);
|
||||||
|
|
||||||
|
void R_ResetColumnBuffer(void);
|
||||||
|
|
||||||
typedef void (coldrawfunc_t)(drawcolumndata_t*);
|
typedef void (coldrawfunc_t)(drawcolumndata_t*);
|
||||||
typedef void (spandrawfunc_t)(drawspandata_t*);
|
typedef void (spandrawfunc_t)(drawspandata_t*);
|
||||||
@@ -152,29 +159,12 @@ extern spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
|
|||||||
|
|
||||||
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column);
|
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column);
|
||||||
|
|
||||||
/// \brief Top border
|
|
||||||
#define BRDR_T 0
|
|
||||||
/// \brief Bottom border
|
|
||||||
#define BRDR_B 1
|
|
||||||
/// \brief Left border
|
|
||||||
#define BRDR_L 2
|
|
||||||
/// \brief Right border
|
|
||||||
#define BRDR_R 3
|
|
||||||
/// \brief Topleft border
|
|
||||||
#define BRDR_TL 4
|
|
||||||
/// \brief Topright border
|
|
||||||
#define BRDR_TR 5
|
|
||||||
/// \brief Bottomleft border
|
|
||||||
#define BRDR_BL 6
|
|
||||||
/// \brief Bottomright border
|
|
||||||
#define BRDR_BR 7
|
|
||||||
|
|
||||||
extern lumpnum_t viewborderlump[8];
|
|
||||||
|
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
// r_draw.c COMMON ROUTINES FOR BOTH 8bpp and 16bpp
|
// r_draw.c
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
|
|
||||||
|
// Custom player skin translation
|
||||||
|
|
||||||
#define GTC_CACHE 1
|
#define GTC_CACHE 1
|
||||||
#define GTC_MENUCACHE GTC_CACHE
|
#define GTC_MENUCACHE GTC_CACHE
|
||||||
//@TODO Add a separate caching mechanism for menu colormaps distinct from in-level GTC_CACHE. For now this is still preferable to memory leaks...
|
//@TODO Add a separate caching mechanism for menu colormaps distinct from in-level GTC_CACHE. For now this is still preferable to memory leaks...
|
||||||
@@ -219,19 +209,9 @@ UINT8 *R_GetBlendTable(int style, INT32 alphalevel);
|
|||||||
|
|
||||||
boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel);
|
boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel);
|
||||||
|
|
||||||
// Custom player skin translation
|
void R_InitViewBuffer(void);
|
||||||
void R_InitViewBuffer(INT32 width, INT32 height);
|
|
||||||
void R_InitViewBorder(void);
|
|
||||||
void R_VideoErase(size_t ofs, INT32 count);
|
void R_VideoErase(size_t ofs, INT32 count);
|
||||||
|
|
||||||
// Rendering function.
|
|
||||||
#if 0
|
|
||||||
void R_FillBackScreen(void);
|
|
||||||
|
|
||||||
// If the view size is not full screen, draws a border around it.
|
|
||||||
void R_DrawViewBorder(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TRANSPARENTPIXEL 247
|
#define TRANSPARENTPIXEL 247
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
@@ -250,6 +230,15 @@ void R_DrawTranslatedTranslucentColumn(drawcolumndata_t* dc);
|
|||||||
void R_Draw2sMultiPatchColumn(drawcolumndata_t* dc);
|
void R_Draw2sMultiPatchColumn(drawcolumndata_t* dc);
|
||||||
void R_Draw2sMultiPatchTranslucentColumn(drawcolumndata_t* dc);
|
void R_Draw2sMultiPatchTranslucentColumn(drawcolumndata_t* dc);
|
||||||
|
|
||||||
|
// column drawers which use buffered drawing with flush
|
||||||
|
void R_DrawColumn_Flush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawTranslucentColumn_Flush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawTranslatedColumn_Flush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawColumnShadowed_Flush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawTranslatedTranslucentColumn_Flush(drawcolumndata_t* dc);
|
||||||
|
void R_Draw2sMultiPatchColumn_Flush(drawcolumndata_t* dc);
|
||||||
|
void R_Draw2sMultiPatchTranslucentColumn_Flush(drawcolumndata_t* dc);
|
||||||
|
|
||||||
void R_DrawFogColumn(drawcolumndata_t* dc);
|
void R_DrawFogColumn(drawcolumndata_t* dc);
|
||||||
|
|
||||||
// span drawers
|
// span drawers
|
||||||
|
|||||||
+64
-18
@@ -21,6 +21,8 @@
|
|||||||
// a has a constant z depth from top to bottom.
|
// a has a constant z depth from top to bottom.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "r_draw_flush.cpp"
|
||||||
|
|
||||||
enum DrawColumnType
|
enum DrawColumnType
|
||||||
{
|
{
|
||||||
DC_BASIC = 0x0000,
|
DC_BASIC = 0x0000,
|
||||||
@@ -28,10 +30,12 @@ enum DrawColumnType
|
|||||||
DC_TRANSMAP = 0x0002,
|
DC_TRANSMAP = 0x0002,
|
||||||
DC_HOLES = 0x0004,
|
DC_HOLES = 0x0004,
|
||||||
DC_LIGHTLIST = 0x0008,
|
DC_LIGHTLIST = 0x0008,
|
||||||
|
DC_DIRECT = 0x0010, // draw our columns directly to screen!
|
||||||
};
|
};
|
||||||
|
|
||||||
template<DrawColumnType Type>
|
template<DrawColumnType Type>
|
||||||
static constexpr UINT8 R_GetColumnTranslated(drawcolumndata_t* dc, UINT8 col, const UINT8 * restrict colormap)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetColumnTranslated(const drawcolumndata_t* dc, UINT8 col, const UINT8 * restrict colormap)
|
||||||
{
|
{
|
||||||
if constexpr (Type & DrawColumnType::DC_COLORMAP)
|
if constexpr (Type & DrawColumnType::DC_COLORMAP)
|
||||||
{
|
{
|
||||||
@@ -41,8 +45,10 @@ static constexpr UINT8 R_GetColumnTranslated(drawcolumndata_t* dc, UINT8 col, co
|
|||||||
return colormap[col];
|
return colormap[col];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// translucency is handled on flush side now!
|
||||||
template<DrawColumnType Type>
|
template<DrawColumnType Type>
|
||||||
static constexpr UINT8 R_GetColumnTranslucent(drawcolumndata_t* dc, UINT8 * restrict dest, UINT8 col, const UINT8 * restrict colormap)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetColumnTranslucent(const drawcolumndata_t* dc, UINT8 * restrict dest, UINT8 col, const UINT8 * restrict colormap)
|
||||||
{
|
{
|
||||||
col = R_GetColumnTranslated<Type>(dc, col, colormap);
|
col = R_GetColumnTranslated<Type>(dc, col, colormap);
|
||||||
|
|
||||||
@@ -57,7 +63,8 @@ static constexpr UINT8 R_GetColumnTranslucent(drawcolumndata_t* dc, UINT8 * rest
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<DrawColumnType Type>
|
template<DrawColumnType Type>
|
||||||
static constexpr UINT8 R_DrawColumnPixel(drawcolumndata_t* dc, UINT8 * restrict dest, UINT32 bit, const UINT8 * restrict source, const UINT8 * restrict colormap)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_DrawColumnPixel(const drawcolumndata_t* dc, UINT8 * restrict dest, UINT32 bit, const UINT8 * restrict source, const UINT8 * restrict colormap)
|
||||||
{
|
{
|
||||||
UINT8 col = source[bit];
|
UINT8 col = source[bit];
|
||||||
|
|
||||||
@@ -69,6 +76,7 @@ static constexpr UINT8 R_DrawColumnPixel(drawcolumndata_t* dc, UINT8 * restrict
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we dont buffer our columns, we need to handle translucency again
|
||||||
return R_GetColumnTranslucent<Type>(dc, dest, col, colormap);
|
return R_GetColumnTranslucent<Type>(dc, dest, col, colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,8 +88,18 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
{
|
{
|
||||||
INT32 count;
|
INT32 count;
|
||||||
|
|
||||||
|
// leban 1/17/99:
|
||||||
|
// removed the + 1 here, adjusted the if test, and added an increment
|
||||||
|
// later. this helps a compiler pipeline a bit better. the x86
|
||||||
|
// assembler also does this.
|
||||||
count = dc->yh - dc->yl;
|
count = dc->yh - dc->yl;
|
||||||
|
|
||||||
|
// leban 1/17/99:
|
||||||
|
// this case isn't executed too often. depending on how many instructions
|
||||||
|
// there are between here and the second if test below, this case could
|
||||||
|
// be moved down and might save instructions overall. since there are
|
||||||
|
// probably different wads that favor one way or the other, i'll leave
|
||||||
|
// this alone for now.
|
||||||
if (count < 0) // Zero length, column does not exceed a pixel.
|
if (count < 0) // Zero length, column does not exceed a pixel.
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -150,6 +168,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
R_DrawColumnTemplate<NewType>(&dc_copy);
|
R_DrawColumnTemplate<NewType>(&dc_copy);
|
||||||
|
|
||||||
if (solid)
|
if (solid)
|
||||||
{
|
{
|
||||||
dc_copy.yl = bheight;
|
dc_copy.yl = bheight;
|
||||||
@@ -183,19 +202,37 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
// killough 2/1/98: more performance tuning
|
// killough 2/1/98: more performance tuning
|
||||||
|
|
||||||
intptr_t frac;
|
intptr_t frac;
|
||||||
|
// Looks familiar.
|
||||||
const intptr_t fracstep = dc->iscale;
|
const intptr_t fracstep = dc->iscale;
|
||||||
const intptr_t heightmask = dc->sourcelength-1;
|
const intptr_t heightmask = dc->sourcelength-1; // CPhipps - specify type
|
||||||
constexpr INT32 npow2min = -1;
|
constexpr INT32 npow2min = -1;
|
||||||
const INT32 npow2max = dc->sourcelength;
|
const INT32 npow2max = dc->sourcelength;
|
||||||
const INT32 stride = vid.width;
|
|
||||||
|
|
||||||
const UINT8 * restrict source = dc->source;
|
const UINT8 * restrict source = dc->source;
|
||||||
const lighttable_t * restrict colormap = dc->colormap;
|
const lighttable_t * restrict colormap = dc->colormap;
|
||||||
|
|
||||||
// Framebuffer destination address.
|
// Framebuffer destination address.
|
||||||
UINT8 * restrict dest = R_Address(dc->x, dc->yl);
|
// SoM: MAGIC
|
||||||
|
UINT8 * restrict dest;
|
||||||
|
|
||||||
count++;
|
if constexpr (Type & DrawColumnType::DC_DIRECT)
|
||||||
|
dest = R_Address(dc->x, dc->yl);
|
||||||
|
else if constexpr ((Type & (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP))
|
||||||
|
== (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP))
|
||||||
|
dest = R_GetBufferColormapTrans(dc);
|
||||||
|
else if constexpr (Type & DrawColumnType::DC_TRANSMAP)
|
||||||
|
dest = R_GetBufferTrans(dc);
|
||||||
|
else if constexpr (Type & DrawColumnType::DC_COLORMAP)
|
||||||
|
dest = R_GetBufferColormap(dc);
|
||||||
|
else
|
||||||
|
dest = R_GetBufferOpaque(dc);
|
||||||
|
|
||||||
|
INT32 stride = 8; //SoM: Oh, Oh it's MAGIC! You know...
|
||||||
|
|
||||||
|
if constexpr (Type & DrawColumnType::DC_DIRECT)
|
||||||
|
stride = vid.width;
|
||||||
|
|
||||||
|
count++; // killough 1/99: minor tuning
|
||||||
|
|
||||||
// Determine scaling, which is the only mapping to be done.
|
// Determine scaling, which is the only mapping to be done.
|
||||||
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
|
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
|
||||||
@@ -205,15 +242,16 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
case 255:
|
case 255:
|
||||||
case 127:
|
case 127:
|
||||||
{
|
{
|
||||||
while(count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case -1:
|
case npow2min:
|
||||||
{
|
{
|
||||||
if (frac < 0)
|
if (frac < 0)
|
||||||
// adjust in case we underread
|
// adjust in case we underread
|
||||||
@@ -222,7 +260,8 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
// texture has no height, so just go
|
// texture has no height, so just go
|
||||||
while (--count >= 0)
|
while (--count >= 0)
|
||||||
{
|
{
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, frac>>FRACBITS, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS), source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
}
|
}
|
||||||
@@ -235,10 +274,12 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
while ((count -= 2) >= 0) // texture height is a power of 2 -- killough
|
while ((count -= 2) >= 0) // texture height is a power of 2 -- killough
|
||||||
{
|
{
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
|
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
}
|
}
|
||||||
@@ -271,7 +312,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
{
|
{
|
||||||
// Re-map color indices from wall texture column
|
// Re-map color indices from wall texture column
|
||||||
// using a lighting/special effects LUT.
|
// using a lighting/special effects LUT.
|
||||||
// heightmask is the Tutti-Frutti fix
|
// heightmask is the Tutti-Frutti fix -- killough
|
||||||
|
|
||||||
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
|
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
|
||||||
// and a few bytes after as well
|
// and a few bytes after as well
|
||||||
@@ -311,13 +352,18 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
R_DrawColumnTemplate<opt>(dc); \
|
R_DrawColumnTemplate<opt>(dc); \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_COLUMN_FUNC(R_DrawColumn, DC_BASIC)
|
#define DEFINE_COLUMN_COMBO(name, flags) \
|
||||||
DEFINE_COLUMN_FUNC(R_DrawTranslucentColumn, DC_TRANSMAP)
|
DEFINE_COLUMN_FUNC(name, flags|DC_DIRECT) \
|
||||||
DEFINE_COLUMN_FUNC(R_DrawTranslatedColumn, DC_COLORMAP)
|
DEFINE_COLUMN_FUNC(name ## _Flush, flags)
|
||||||
DEFINE_COLUMN_FUNC(R_DrawColumnShadowed, DC_LIGHTLIST)
|
|
||||||
DEFINE_COLUMN_FUNC(R_DrawTranslatedTranslucentColumn, DC_COLORMAP|DC_TRANSMAP)
|
DEFINE_COLUMN_COMBO(R_DrawColumn, DC_BASIC)
|
||||||
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchColumn, DC_HOLES)
|
DEFINE_COLUMN_COMBO(R_DrawTranslucentColumn, DC_TRANSMAP)
|
||||||
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchTranslucentColumn, DC_HOLES|DC_TRANSMAP)
|
DEFINE_COLUMN_COMBO(R_DrawTranslatedColumn, DC_COLORMAP)
|
||||||
|
DEFINE_COLUMN_COMBO(R_DrawColumnShadowed, DC_LIGHTLIST)
|
||||||
|
DEFINE_COLUMN_COMBO(R_DrawTranslatedTranslucentColumn, DC_COLORMAP|DC_TRANSMAP)
|
||||||
|
DEFINE_COLUMN_COMBO(R_Draw2sMultiPatchColumn, DC_HOLES)
|
||||||
|
DEFINE_COLUMN_COMBO(R_Draw2sMultiPatchTranslucentColumn, DC_HOLES|DC_TRANSMAP)
|
||||||
|
|
||||||
|
|
||||||
/** \brief The R_DrawFogColumn function
|
/** \brief The R_DrawFogColumn function
|
||||||
Fog wall.
|
Fog wall.
|
||||||
|
|||||||
@@ -0,0 +1,269 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Kart Krew.
|
||||||
|
// Copyright (C) 2020 by Sonic Team Junior.
|
||||||
|
// Copyright (C) 2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1996 by id Software, Inc.
|
||||||
|
// Copyright (C) 1999 by Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||||
|
// Copyright (C) 1999-2000 by Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||||
|
// Copyright (C) Copyright 2005, 2006 by Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||||
|
// Copyright (C) 2013 by James Haley, Stephen McGranahan, et al.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file r_draw_flush.cpp
|
||||||
|
/// \brief Optimized quad column buffer code. By SoM.
|
||||||
|
/// \note no includes because this is included as part of r_draw.cpp
|
||||||
|
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetFlushPixelTranslated(const drawcolumndata_temp_t *t_dc, UINT8 col)
|
||||||
|
{
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_COLORMAP | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
col = t_dc->translation[col];
|
||||||
|
}
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetFlushPixelTranslucent(const drawcolumndata_temp_t *t_dc, UINT8 * restrict dest, UINT8 col)
|
||||||
|
{
|
||||||
|
col = R_GetFlushPixelTranslated<Type>(t_dc, col);
|
||||||
|
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_TRANS | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
// haleyjd 09/11/04: use temptranmap here
|
||||||
|
return *(t_dc->transmap + (col << 8) + (*dest));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_DrawFlushPixel(const drawcolumndata_temp_t *t_dc, UINT8 * restrict dest, const UINT8 * restrict source)
|
||||||
|
{
|
||||||
|
UINT8 col = *source;
|
||||||
|
return R_GetFlushPixelTranslucent<Type>(t_dc, dest, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_FlushWhole
|
||||||
|
//
|
||||||
|
// Flushes the entire columns in the buffer, one at a time.
|
||||||
|
// This is used when a quad flush isn't possible.
|
||||||
|
//
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static void R_FlushWhole(void)
|
||||||
|
{
|
||||||
|
UINT8 * restrict source;
|
||||||
|
UINT8 * restrict dest;
|
||||||
|
INT32 count, yl;
|
||||||
|
const INT32 stride = vid.width;
|
||||||
|
drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
UINT8 *restrict buf = t_dc->buf;
|
||||||
|
|
||||||
|
while (--t_dc->x >= 0)
|
||||||
|
{
|
||||||
|
yl = t_dc->yl[t_dc->x];
|
||||||
|
source = &buf[t_dc->x + (yl << 3)];
|
||||||
|
dest = R_Address(t_dc->startx + t_dc->x, yl);
|
||||||
|
count = t_dc->yh[t_dc->x] - yl + 1;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest = R_DrawFlushPixel<Type>(t_dc, dest, source);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_FlushHT
|
||||||
|
//
|
||||||
|
// Flushes the head and tail of columns in the buffer in
|
||||||
|
// preparation for a quad flush.
|
||||||
|
//
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static void R_FlushHT(void)
|
||||||
|
{
|
||||||
|
UINT8 * restrict source;
|
||||||
|
UINT8 * restrict dest;
|
||||||
|
INT32 count, colnum = 0;
|
||||||
|
INT32 yl, yh;
|
||||||
|
const INT32 stride = vid.width;
|
||||||
|
const drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
UINT8 *restrict buf = t_dc->buf;
|
||||||
|
|
||||||
|
while (colnum < 8)
|
||||||
|
{
|
||||||
|
yl = t_dc->yl[colnum];
|
||||||
|
yh = t_dc->yh[colnum];
|
||||||
|
|
||||||
|
// flush column head
|
||||||
|
if (yl < t_dc->commontop)
|
||||||
|
{
|
||||||
|
source = &buf[colnum + (yl << 3)];
|
||||||
|
dest = R_Address(t_dc->startx + colnum, yl);
|
||||||
|
count = t_dc->commontop - yl;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest = R_DrawFlushPixel<Type>(t_dc, dest, source);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// flush column tail
|
||||||
|
if (yh > t_dc->commonbot)
|
||||||
|
{
|
||||||
|
source = &buf[colnum + ((t_dc->commonbot + 1) << 3)];
|
||||||
|
dest = R_Address(t_dc->startx + colnum, t_dc->commonbot + 1);
|
||||||
|
count = yh - t_dc->commonbot;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest = R_DrawFlushPixel<Type>(t_dc, dest, source);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++colnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Begin: Quad column flushing functions.
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static void R_FlushQuad(void)
|
||||||
|
{
|
||||||
|
const INT32 stride = vid.width;
|
||||||
|
const drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
INT32 count = t_dc->commonbot - t_dc->commontop + 1;
|
||||||
|
const UINT8 *restrict buf = t_dc->buf;
|
||||||
|
|
||||||
|
const UINT8 * restrict source = buf + (t_dc->commontop << 3);
|
||||||
|
UINT8 * restrict dest = R_Address(t_dc->startx, t_dc->commontop);
|
||||||
|
|
||||||
|
if constexpr (Type & ColumnFlushType::FLUSH_OPAQUE)
|
||||||
|
{
|
||||||
|
#if __SIZEOF_POINTER__ >= 8 // does not make much sense on 32bit targets
|
||||||
|
// 8 byte aligned copy -- make sure our dest ptr, source ptr AND stride are a multiple of 8!
|
||||||
|
if ((((uintptr_t)dest | (uintptr_t)source | stride) & 7) == 0)
|
||||||
|
{
|
||||||
|
const INT64 *source64 = reinterpret_cast<const INT64 *>(source);
|
||||||
|
INT64 *dest64 = reinterpret_cast<INT64 *>(dest);
|
||||||
|
const INT32 deststep = stride / 8;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest64 = *source64++;
|
||||||
|
dest64 += deststep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
dest[0] = source[0];
|
||||||
|
dest[1] = source[1];
|
||||||
|
dest[2] = source[2];
|
||||||
|
dest[3] = source[3];
|
||||||
|
dest[4] = source[4];
|
||||||
|
dest[5] = source[5];
|
||||||
|
dest[6] = source[6];
|
||||||
|
dest[7] = source[7];
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
dest[0] = R_DrawFlushPixel<Type>(t_dc, &dest[0], &source[0]);
|
||||||
|
dest[1] = R_DrawFlushPixel<Type>(t_dc, &dest[1], &source[1]);
|
||||||
|
dest[2] = R_DrawFlushPixel<Type>(t_dc, &dest[2], &source[2]);
|
||||||
|
dest[3] = R_DrawFlushPixel<Type>(t_dc, &dest[3], &source[3]);
|
||||||
|
dest[4] = R_DrawFlushPixel<Type>(t_dc, &dest[4], &source[4]);
|
||||||
|
dest[5] = R_DrawFlushPixel<Type>(t_dc, &dest[5], &source[5]);
|
||||||
|
dest[6] = R_DrawFlushPixel<Type>(t_dc, &dest[6], &source[6]);
|
||||||
|
dest[7] = R_DrawFlushPixel<Type>(t_dc, &dest[7], &source[7]);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// haleyjd 09/12/04: split up R_GetBuffer into various different
|
||||||
|
// functions to minimize the number of branches and take advantage
|
||||||
|
// of as much precalculated information as possible.
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static UINT8 *R_GetBuffer(drawcolumndata_t *dc)
|
||||||
|
{
|
||||||
|
drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
|
||||||
|
// haleyjd: reordered predicates
|
||||||
|
if (t_dc->x == 8 ||
|
||||||
|
(t_dc->x && (t_dc->type != Type || t_dc->x + t_dc->startx != dc->x)))
|
||||||
|
R_FlushColumns();
|
||||||
|
|
||||||
|
if (!t_dc->x)
|
||||||
|
{
|
||||||
|
++t_dc->x;
|
||||||
|
t_dc->startx = dc->x;
|
||||||
|
t_dc->yl[0] = t_dc->commontop = dc->yl;
|
||||||
|
t_dc->yh[0] = t_dc->commonbot = dc->yh;
|
||||||
|
t_dc->type = Type;
|
||||||
|
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_TRANS | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
t_dc->transmap = dc->transmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_COLORMAP | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
t_dc->translation = dc->translation;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_FlushWholeColumns = R_FlushWhole<Type>;
|
||||||
|
R_FlushHTColumns = R_FlushHT<Type>;
|
||||||
|
R_FlushQuadColumn = R_FlushQuad<Type>;
|
||||||
|
|
||||||
|
return &t_dc->buf[dc->yl << 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
t_dc->yl[t_dc->x] = dc->yl;
|
||||||
|
t_dc->yh[t_dc->x] = dc->yh;
|
||||||
|
|
||||||
|
if (dc->yl > t_dc->commontop)
|
||||||
|
t_dc->commontop = dc->yl;
|
||||||
|
if (dc->yh < t_dc->commonbot)
|
||||||
|
t_dc->commonbot = dc->yh;
|
||||||
|
|
||||||
|
return &t_dc->buf[(dc->yl << 3) + t_dc->x++];
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEFINE_GETBUF_FUNC(name, flags) \
|
||||||
|
FUNCINLINE static ATTRINLINE UINT8 *name(drawcolumndata_t *dc) \
|
||||||
|
{ \
|
||||||
|
constexpr ColumnFlushType opt = static_cast<ColumnFlushType>(flags); \
|
||||||
|
return R_GetBuffer<opt>(dc); \
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferOpaque, FLUSH_OPAQUE)
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferTrans, FLUSH_TRANS)
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferColormap, FLUSH_COLORMAP)
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferColormapTrans, FLUSH_COLORMAP_TRANS)
|
||||||
|
|
||||||
+87
-84
@@ -25,6 +25,9 @@
|
|||||||
#define local_for_thread static
|
#define local_for_thread static
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// SPANS
|
// SPANS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -47,7 +50,8 @@ enum DrawSpanType
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<DrawSpanType Type>
|
template<DrawSpanType Type>
|
||||||
static constexpr UINT8 R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetSpanTranslated(const drawspandata_t* ds, UINT8 col)
|
||||||
{
|
{
|
||||||
if constexpr (Type & DrawSpanType::DS_COLORMAP)
|
if constexpr (Type & DrawSpanType::DS_COLORMAP)
|
||||||
{
|
{
|
||||||
@@ -60,7 +64,8 @@ static constexpr UINT8 R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<DrawSpanType Type>
|
template<DrawSpanType Type>
|
||||||
static constexpr UINT8 R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT8 col)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetSpanTranslucent(const drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT8 col)
|
||||||
{
|
{
|
||||||
col = colormap[R_GetSpanTranslated<Type>(ds, col)];
|
col = colormap[R_GetSpanTranslated<Type>(ds, col)];
|
||||||
|
|
||||||
@@ -75,7 +80,8 @@ static constexpr UINT8 R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<DrawSpanType Type>
|
template<DrawSpanType Type>
|
||||||
static constexpr UINT8 R_DrawSpanPixel(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT32 bit, const UINT8 *source)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_DrawSpanPixel(const drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT32 bit, const UINT8 *source)
|
||||||
{
|
{
|
||||||
UINT8 col = source[bit];
|
UINT8 col = source[bit];
|
||||||
|
|
||||||
@@ -154,14 +160,18 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
|||||||
{
|
{
|
||||||
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
||||||
|
|
||||||
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
||||||
|
else
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dest[i], colormap, bit, source);
|
||||||
|
|
||||||
xposition += xstep;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest += 8;
|
dest += 8;
|
||||||
dsrc += 8;
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc += 8;
|
||||||
|
|
||||||
count -= 8;
|
count -= 8;
|
||||||
}
|
}
|
||||||
@@ -170,10 +180,14 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
|||||||
{
|
{
|
||||||
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
||||||
|
|
||||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||||
|
else
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dest, colormap, bit, source);
|
||||||
|
|
||||||
dest++;
|
dest++;
|
||||||
dsrc++;
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc++;
|
||||||
|
|
||||||
xposition += xstep;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
@@ -182,35 +196,43 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
|||||||
|
|
||||||
// R_CalcTiltedLighting
|
// R_CalcTiltedLighting
|
||||||
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
||||||
static void R_CalcTiltedLighting(INT32 *lightbuffer, INT32 x1, INT32 x2, fixed_t start, fixed_t end)
|
static void R_CalcTiltedLighting(std::vector<INT32>& lightbuffer, INT32 x1, INT32 x2, fixed_t start, fixed_t end)
|
||||||
{
|
{
|
||||||
// ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version
|
// ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version
|
||||||
// of this function. Here's my own.
|
// of this function. Here's my own.
|
||||||
INT32 i, left = x1, right = x2;
|
INT32 i;
|
||||||
const fixed_t step = (end-start)/(x2 - x1 + 1);
|
const fixed_t step = (end-start)/(x2 - x1 + 1);
|
||||||
|
|
||||||
// I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once,
|
// I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once,
|
||||||
// but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now...
|
// but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now...
|
||||||
|
|
||||||
for (i = left; i <= right; i++)
|
for (i = x1; i <= x2; i++)
|
||||||
{
|
{
|
||||||
lightbuffer[i] = (start += step) >> FRACBITS;
|
const fixed_t light = start >> FRACBITS;
|
||||||
|
lightbuffer[i] = CLAMP(light, 0, MAXLIGHTSCALE - 1);
|
||||||
if (lightbuffer[i] < 0)
|
start += step;
|
||||||
{
|
|
||||||
lightbuffer[i] = 0;
|
|
||||||
}
|
|
||||||
else if (lightbuffer[i] >= MAXLIGHTSCALE)
|
|
||||||
{
|
|
||||||
lightbuffer[i] = MAXLIGHTSCALE-1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const INT32 width, const INT32 stride)
|
||||||
|
{
|
||||||
|
const float planelightfloat = PLANELIGHTFLOAT;
|
||||||
|
const fixed_t lightstart = FloatToFixed(iz * planelightfloat);
|
||||||
|
const fixed_t lightend = FloatToFixed((iz + ds->szp.x * width) * planelightfloat);
|
||||||
|
|
||||||
|
if (tiltlighting.size() != (size_t)viewwidth)
|
||||||
|
{
|
||||||
|
tiltlighting.resize(viewwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, lightstart, lightend);
|
||||||
|
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", FixedToFloat(lightstart), FixedToFloat(lightend), focallengthf);
|
||||||
|
}
|
||||||
|
|
||||||
template<DrawSpanType Type>
|
template<DrawSpanType Type>
|
||||||
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||||
{
|
{
|
||||||
int width = ds->x2 - ds->x1;
|
INT32 width = ds->x2 - ds->x1;
|
||||||
float iz, uz, vz;
|
float iz, uz, vz;
|
||||||
UINT32 u, v;
|
UINT32 u, v;
|
||||||
int i;
|
int i;
|
||||||
@@ -223,41 +245,27 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
float endz, endu, endv;
|
float endz, endu, endv;
|
||||||
UINT32 stepu, stepv;
|
UINT32 stepu, stepv;
|
||||||
UINT32 bit;
|
UINT32 bit;
|
||||||
local_for_thread INT32 *tiltlighting = NULL;
|
|
||||||
local_for_thread INT32 oldviewwidth = 0;
|
|
||||||
|
|
||||||
// dont realloc every frame pls thx
|
|
||||||
if (tiltlighting == NULL || oldviewwidth != viewwidth)
|
|
||||||
{
|
|
||||||
tiltlighting = static_cast<INT32*>(realloc(tiltlighting, sizeof(*tiltlighting) * viewwidth));
|
|
||||||
oldviewwidth = viewwidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
INT32 x1 = ds->x1;
|
|
||||||
const INT32 nflatxshift = ds->nflatxshift;
|
const INT32 nflatxshift = ds->nflatxshift;
|
||||||
const INT32 nflatyshift = ds->nflatyshift;
|
const INT32 nflatyshift = ds->nflatyshift;
|
||||||
const INT32 nflatmask = ds->nflatmask;
|
const INT32 nflatmask = ds->nflatmask;
|
||||||
const INT32 stride = vid.width;
|
const INT32 stride = vid.width;
|
||||||
|
local_for_thread std::vector<INT32> tiltlighting;
|
||||||
|
|
||||||
iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds->szp.x*width) * planelightfloat;
|
|
||||||
lightstart = iz * planelightfloat;
|
|
||||||
|
|
||||||
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
|
||||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
|
||||||
}
|
|
||||||
|
|
||||||
uz = ds->sup.z + ds->sup.y*(centery-ds->y) + ds->sup.x*(ds->x1-centerx);
|
uz = ds->sup.z + ds->sup.y*(centery-ds->y) + ds->sup.x*(ds->x1-centerx);
|
||||||
vz = ds->svp.z + ds->svp.y*(centery-ds->y) + ds->svp.x*(ds->x1-centerx);
|
vz = ds->svp.z + ds->svp.y*(centery-ds->y) + ds->svp.x*(ds->x1-centerx);
|
||||||
|
|
||||||
const UINT8 *source = ds->source;
|
// Lighting is simple. It's just linear interpolation from start to end
|
||||||
const UINT8 *colormap = ds->colormap;
|
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
|
||||||
|
|
||||||
|
const UINT8 * restrict source = ds->source;
|
||||||
|
const UINT8 * restrict colormap = ds->colormap;
|
||||||
|
|
||||||
|
const ptrdiff_t colormap_diff = (colormap - colormaps);
|
||||||
|
|
||||||
|
const INT32 * restrict tiltlight = tiltlighting.data();
|
||||||
|
lighttable_t * const * restrict planezlight = ds->planezlight;
|
||||||
|
|
||||||
if constexpr (Type & DS_RIPPLE)
|
if constexpr (Type & DS_RIPPLE)
|
||||||
{
|
{
|
||||||
@@ -296,7 +304,6 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
izstep = ds->szp.x * SPANSIZE;
|
izstep = ds->szp.x * SPANSIZE;
|
||||||
uzstep = ds->sup.x * SPANSIZE;
|
uzstep = ds->sup.x * SPANSIZE;
|
||||||
vzstep = ds->svp.x * SPANSIZE;
|
vzstep = ds->svp.x * SPANSIZE;
|
||||||
//x1 = 0;
|
|
||||||
width++;
|
width++;
|
||||||
|
|
||||||
while (width >= SPANSIZE)
|
while (width >= SPANSIZE)
|
||||||
@@ -313,18 +320,22 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
u = (INT64)(startu);
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv);
|
v = (INT64)(startv);
|
||||||
|
|
||||||
x1 = ds->x1;
|
const INT32 x1 = ds->x1;
|
||||||
|
|
||||||
for (i = 0; i < SPANSIZE; i++)
|
for (i = 0; i < SPANSIZE; i++)
|
||||||
{
|
{
|
||||||
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
|
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
|
||||||
colormap = ds->planezlight[tiltlighting[x1 + i]] + (ds->colormap - colormaps);
|
colormap = planezlight[tiltlight[x1 + i]] + colormap_diff;
|
||||||
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
||||||
|
else
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dest[i], colormap, bit, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
ds->x1 += SPANSIZE;
|
ds->x1 += SPANSIZE;
|
||||||
dest += SPANSIZE;
|
dest += SPANSIZE;
|
||||||
dsrc += SPANSIZE;
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc += SPANSIZE;
|
||||||
startu = endu;
|
startu = endu;
|
||||||
startv = endv;
|
startv = endv;
|
||||||
width -= SPANSIZE;
|
width -= SPANSIZE;
|
||||||
@@ -337,8 +348,11 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
u = (INT64)(startu);
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv);
|
v = (INT64)(startv);
|
||||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
|
||||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||||
|
else
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dest, colormap, bit, source);
|
||||||
ds->x1++;
|
ds->x1++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -360,11 +374,15 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
|
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
|
||||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
|
||||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||||
|
else
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dest, colormap, bit, source);
|
||||||
dest++;
|
dest++;
|
||||||
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc++;
|
||||||
ds->x1++;
|
ds->x1++;
|
||||||
dsrc++;
|
|
||||||
u += stepu;
|
u += stepu;
|
||||||
v += stepv;
|
v += stepv;
|
||||||
}
|
}
|
||||||
@@ -395,11 +413,11 @@ DEFINE_SPAN_COMBO(R_DrawTranslucentWaterSpan, DS_TRANSMAP|DS_RIPPLE)
|
|||||||
*/
|
*/
|
||||||
void R_DrawFogSpan(drawspandata_t* ds)
|
void R_DrawFogSpan(drawspandata_t* ds)
|
||||||
{
|
{
|
||||||
|
intptr_t count = ds->x2 - ds->x1 + 1;
|
||||||
|
|
||||||
const UINT8 * restrict colormap = ds->colormap;
|
const UINT8 * restrict colormap = ds->colormap;
|
||||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||||
|
|
||||||
intptr_t count = ds->x2 - ds->x1 + 1;
|
|
||||||
|
|
||||||
while (count >= 4)
|
while (count >= 4)
|
||||||
{
|
{
|
||||||
dest[0] = colormap[dest[0]];
|
dest[0] = colormap[dest[0]];
|
||||||
@@ -407,7 +425,7 @@ void R_DrawFogSpan(drawspandata_t* ds)
|
|||||||
dest[2] = colormap[dest[2]];
|
dest[2] = colormap[dest[2]];
|
||||||
dest[3] = colormap[dest[3]];
|
dest[3] = colormap[dest[3]];
|
||||||
|
|
||||||
dest += 4;
|
dest += 4;
|
||||||
count -= 4;
|
count -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,38 +438,23 @@ void R_DrawFogSpan(drawspandata_t* ds)
|
|||||||
|
|
||||||
void R_DrawFogSpan_Tilted(drawspandata_t* ds)
|
void R_DrawFogSpan_Tilted(drawspandata_t* ds)
|
||||||
{
|
{
|
||||||
int width = ds->x2 - ds->x1;
|
INT32 width = ds->x2 - ds->x1;
|
||||||
float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
|
||||||
UINT8 * restrict dest;
|
|
||||||
|
|
||||||
local_for_thread INT32 *tiltlighting = NULL;
|
|
||||||
local_for_thread INT32 oldviewwidth = 0;
|
|
||||||
|
|
||||||
// dont realloc every frame pls thx
|
|
||||||
if (tiltlighting == NULL || oldviewwidth != viewwidth)
|
|
||||||
{
|
|
||||||
tiltlighting = static_cast<INT32*>(realloc(tiltlighting, sizeof(*tiltlighting) * viewwidth));
|
|
||||||
oldviewwidth = viewwidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
dest = R_Address(ds->x1, ds->y);
|
|
||||||
const INT32 stride = vid.width;
|
const INT32 stride = vid.width;
|
||||||
|
const float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||||
|
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||||
|
const ptrdiff_t colormap_diff = (ds->colormap - colormaps);
|
||||||
|
|
||||||
|
local_for_thread std::vector<INT32> tiltlighting;
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
// Lighting is simple. It's just linear interpolation from start to end
|
||||||
{
|
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds->szp.x*width) * planelightfloat;
|
const INT32 * restrict tiltlight = tiltlighting.data();
|
||||||
lightstart = iz * planelightfloat;
|
lighttable_t * const * restrict planezlight = ds->planezlight;
|
||||||
|
|
||||||
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
|
||||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
UINT8 *colormap = ds->planezlight[tiltlighting[ds->x1++]] + (ds->colormap - colormaps);
|
UINT8 *colormap = planezlight[tiltlight[ds->x1++]] + colormap_diff;
|
||||||
*dest = colormap[*dest];
|
*dest = colormap[*dest];
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -172,7 +172,7 @@ static vector3_t *R_LerpVector3(const vector3_t *from, const vector3_t *to, fixe
|
|||||||
// recalc necessary stuff for mouseaiming
|
// recalc necessary stuff for mouseaiming
|
||||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||||
// 18/08/18: (No it's actually 16*viewheight, thanks Lactozilla for finding this out)
|
// 18/08/18: (No it's actually 16*viewheight, thanks Lactozilla for finding this out)
|
||||||
static void R_SetupFreelook(void)
|
void R_SetupFreelook(void)
|
||||||
{
|
{
|
||||||
// clip it in the case we are looking a hardware 90 degrees full aiming
|
// clip it in the case we are looking a hardware 90 degrees full aiming
|
||||||
// (lmps, network and use F12...)
|
// (lmps, network and use F12...)
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ typedef struct levelinterpolator_s {
|
|||||||
};
|
};
|
||||||
} levelinterpolator_t;
|
} levelinterpolator_t;
|
||||||
|
|
||||||
|
void R_SetupFreelook(void);
|
||||||
// Interpolates the current view variables (r_state.h) against the selected view context in R_SetViewContext
|
// Interpolates the current view variables (r_state.h) against the selected view context in R_SetViewContext
|
||||||
void R_InterpolateView(fixed_t frac, boolean forceinvalid);
|
void R_InterpolateView(fixed_t frac, boolean forceinvalid);
|
||||||
// Special function just for software
|
// Special function just for software
|
||||||
|
|||||||
+18
-7
@@ -63,7 +63,7 @@ size_t loopcount;
|
|||||||
|
|
||||||
fixed_t viewx, viewy, viewz;
|
fixed_t viewx, viewy, viewz;
|
||||||
angle_t viewangle, aimingangle, viewroll;
|
angle_t viewangle, aimingangle, viewroll;
|
||||||
UINT8 viewssnum;
|
UINT8 viewssnum = 0;
|
||||||
fixed_t viewcos, viewsin;
|
fixed_t viewcos, viewsin;
|
||||||
boolean skyVisible;
|
boolean skyVisible;
|
||||||
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player
|
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player
|
||||||
@@ -88,7 +88,7 @@ INT32 viewangletox[FINEANGLES/2];
|
|||||||
// The xtoviewangleangle[] table maps a screen pixel
|
// The xtoviewangleangle[] table maps a screen pixel
|
||||||
// to the lowest viewangle that maps back to x ranges
|
// to the lowest viewangle that maps back to x ranges
|
||||||
// from clipangle to -clipangle.
|
// from clipangle to -clipangle.
|
||||||
angle_t *xtoviewangle;
|
angle_t *xtoviewangle = NULL;
|
||||||
|
|
||||||
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
||||||
lighttable_t *scalelightfixed[MAXLIGHTSCALE];
|
lighttable_t *scalelightfixed[MAXLIGHTSCALE];
|
||||||
@@ -253,6 +253,7 @@ void SplitScreen_OnChange(void)
|
|||||||
if (playeringame[i] && i != consoleplayer)
|
if (playeringame[i] && i != consoleplayer)
|
||||||
{
|
{
|
||||||
UINT8 j;
|
UINT8 j;
|
||||||
|
|
||||||
for (j = 1; j < MAXSPLITSCREENPLAYERS; j++)
|
for (j = 1; j < MAXSPLITSCREENPLAYERS; j++)
|
||||||
{
|
{
|
||||||
if (displayplayers[j] == consoleplayer)
|
if (displayplayers[j] == consoleplayer)
|
||||||
@@ -268,6 +269,7 @@ void SplitScreen_OnChange(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Fov_OnChange(void)
|
static void Fov_OnChange(void)
|
||||||
{
|
{
|
||||||
R_SetViewSize();
|
R_SetViewSize();
|
||||||
@@ -943,9 +945,10 @@ void R_ExecuteSetViewSize(void)
|
|||||||
memset(scalelight, 0xFF, sizeof(scalelight));
|
memset(scalelight, 0xFF, sizeof(scalelight));
|
||||||
|
|
||||||
// Calculate the light levels to use for each level/scale combination.
|
// Calculate the light levels to use for each level/scale combination.
|
||||||
for (i = 0; i< LIGHTLEVELS; i++)
|
for (i = 0; i < LIGHTLEVELS; i++)
|
||||||
{
|
{
|
||||||
startmapl = ((LIGHTLEVELS - 1 - i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
|
startmapl = ((LIGHTLEVELS - 1 - i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
|
||||||
|
|
||||||
for (j = 0; j < MAXLIGHTSCALE; j++)
|
for (j = 0; j < MAXLIGHTSCALE; j++)
|
||||||
{
|
{
|
||||||
level = startmapl - j*vid.width/(viewwidth)/DISTMAP;
|
level = startmapl - j*vid.width/(viewwidth)/DISTMAP;
|
||||||
@@ -960,6 +963,8 @@ void R_ExecuteSetViewSize(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R_SetupFreelook();
|
||||||
|
|
||||||
am_recalc = true;
|
am_recalc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1003,7 +1008,7 @@ static void R_InitViewMapping(void)
|
|||||||
static void R_SetupViewBuffers(void)
|
static void R_SetupViewBuffers(void)
|
||||||
{
|
{
|
||||||
R_CalcFov(cv_fov.value);
|
R_CalcFov(cv_fov.value);
|
||||||
R_InitViewBuffer(viewwidth, viewheight);
|
R_InitViewBuffer();
|
||||||
R_InitViewMapping();
|
R_InitViewMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1023,8 +1028,6 @@ void R_Init(void)
|
|||||||
//I_OutputMsg("\nR_InitData");
|
//I_OutputMsg("\nR_InitData");
|
||||||
R_InitData();
|
R_InitData();
|
||||||
|
|
||||||
//I_OutputMsg("\nR_InitViewBorder");
|
|
||||||
R_InitViewBorder();
|
|
||||||
R_SetViewSize(); // setsizeneeded is set true
|
R_SetViewSize(); // setsizeneeded is set true
|
||||||
|
|
||||||
// this is now done by SCR_Recalc() at the first mode set
|
// this is now done by SCR_Recalc() at the first mode set
|
||||||
@@ -1400,12 +1403,16 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
|
|
||||||
R_ClearClipSegs();
|
R_ClearClipSegs();
|
||||||
R_ClearDrawSegs();
|
R_ClearDrawSegs();
|
||||||
|
R_ClearSegTables();
|
||||||
R_ClearPlanes();
|
R_ClearPlanes();
|
||||||
R_ClearSprites();
|
R_ClearSprites();
|
||||||
|
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_FLUSH);
|
||||||
R_RenderViewpoint(&masks[nummasks - 1], false);
|
R_RenderViewpoint(&masks[nummasks - 1], false);
|
||||||
|
|
||||||
R_ClipSprites(drawsegs, NULL);
|
R_ClipSprites(drawsegs, NULL);
|
||||||
|
R_ResetColumnBuffer();
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_DIRECT);
|
||||||
R_DrawSkyPlanes(); // draw the fucker again to prevent some artifacts
|
R_DrawSkyPlanes(); // draw the fucker again to prevent some artifacts
|
||||||
R_DrawPlanes();
|
R_DrawPlanes();
|
||||||
R_DrawMasked(masks, nummasks);
|
R_DrawMasked(masks, nummasks);
|
||||||
@@ -1434,11 +1441,13 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
R_ClearClipSegs();
|
R_ClearClipSegs();
|
||||||
}
|
}
|
||||||
R_ClearDrawSegs();
|
R_ClearDrawSegs();
|
||||||
|
R_ClearSegTables();
|
||||||
R_ClearSprites();
|
R_ClearSprites();
|
||||||
|
|
||||||
// check for new console commands.
|
// check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_FLUSH);
|
||||||
ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0;
|
ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0;
|
||||||
PS_START_TIMING(ps_bsptime);
|
PS_START_TIMING(ps_bsptime);
|
||||||
R_RenderViewpoint(&masks[nummasks - 1], true);
|
R_RenderViewpoint(&masks[nummasks - 1], true);
|
||||||
@@ -1446,6 +1455,7 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
PS_START_TIMING(ps_sw_spritecliptime);
|
PS_START_TIMING(ps_sw_spritecliptime);
|
||||||
R_ClipSprites(drawsegs, NULL);
|
R_ClipSprites(drawsegs, NULL);
|
||||||
PS_STOP_TIMING(ps_sw_spritecliptime);
|
PS_STOP_TIMING(ps_sw_spritecliptime);
|
||||||
|
R_ResetColumnBuffer();
|
||||||
|
|
||||||
ps_numsprites.value.i = numvisiblesprites;
|
ps_numsprites.value.i = numvisiblesprites;
|
||||||
|
|
||||||
@@ -1482,12 +1492,14 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
R_RenderViewpoint(&masks[nummasks - 1], true);
|
R_RenderViewpoint(&masks[nummasks - 1], true);
|
||||||
|
|
||||||
R_ClipSprites(ds_p - (masks[nummasks - 1].drawsegs[1] - masks[nummasks - 1].drawsegs[0]), portal);
|
R_ClipSprites(ds_p - (masks[nummasks - 1].drawsegs[1] - masks[nummasks - 1].drawsegs[0]), portal);
|
||||||
|
R_ResetColumnBuffer();
|
||||||
|
|
||||||
Portal_Remove(portal);
|
Portal_Remove(portal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PS_STOP_TIMING(ps_sw_portaltime);
|
PS_STOP_TIMING(ps_sw_portaltime);
|
||||||
|
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_DIRECT);
|
||||||
PS_START_TIMING(ps_sw_planetime);
|
PS_START_TIMING(ps_sw_planetime);
|
||||||
if (!skybox)
|
if (!skybox)
|
||||||
R_DrawSkyPlanes();
|
R_DrawSkyPlanes();
|
||||||
@@ -1498,7 +1510,6 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
PS_START_TIMING(ps_sw_maskedtime);
|
PS_START_TIMING(ps_sw_maskedtime);
|
||||||
R_DrawMasked(masks, nummasks);
|
R_DrawMasked(masks, nummasks);
|
||||||
PS_STOP_TIMING(ps_sw_maskedtime);
|
PS_STOP_TIMING(ps_sw_maskedtime);
|
||||||
|
|
||||||
free(masks);
|
free(masks);
|
||||||
|
|
||||||
// Check for new console commands.
|
// Check for new console commands.
|
||||||
|
|||||||
+1
-1
@@ -97,7 +97,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y,
|
|||||||
|
|
||||||
// Try to quickly decide by looking at sign bits.
|
// Try to quickly decide by looking at sign bits.
|
||||||
// also use a mask to avoid branch prediction
|
// also use a mask to avoid branch prediction
|
||||||
INT32 mask = (node->dy ^ node->dx ^ x ^ y) >> 31;
|
INT32 mask = (((node->dy ^ node->dx ^ x ^ y) < 0) ? -1 : 0);
|
||||||
return (mask & ((node->dy ^ x) < 0)) | // (left is negative)
|
return (mask & ((node->dy ^ x) < 0)) | // (left is negative)
|
||||||
(~mask & (FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x)));
|
(~mask & (FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x)));
|
||||||
}
|
}
|
||||||
|
|||||||
+105
-71
@@ -19,6 +19,7 @@
|
|||||||
#include "r_skins.h"
|
#include "r_skins.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "hardware/hw_glob.h"
|
#include "hardware/hw_glob.h"
|
||||||
@@ -37,7 +38,7 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||||||
UINT8 frameFrame = 0xFF;
|
UINT8 frameFrame = 0xFF;
|
||||||
INT16 frameXPivot = 0;
|
INT16 frameXPivot = 0;
|
||||||
INT16 frameYPivot = 0;
|
INT16 frameYPivot = 0;
|
||||||
rotaxis_t frameRotAxis = 0;
|
rotaxis_t frameRotAxis = ROTAXIS_X;
|
||||||
|
|
||||||
// Sprite identifier
|
// Sprite identifier
|
||||||
sprinfoToken = M_GetToken(NULL);
|
sprinfoToken = M_GetToken(NULL);
|
||||||
@@ -45,13 +46,14 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite frame should be");
|
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite frame should be");
|
||||||
}
|
}
|
||||||
|
|
||||||
sprinfoTokenLength = strlen(sprinfoToken);
|
sprinfoTokenLength = strlen(sprinfoToken);
|
||||||
if (sprinfoTokenLength != 1)
|
if (sprinfoTokenLength != 1)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing SPRTINFO lump: Invalid frame \"%s\"",sprinfoToken);
|
I_Error("Error parsing SPRTINFO lump: Invalid frame \"%s\"",sprinfoToken);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
frameChar = sprinfoToken;
|
frameChar = sprinfoToken;
|
||||||
|
|
||||||
frameFrame = R_Char2Frame(frameChar[0]);
|
frameFrame = R_Char2Frame(frameChar[0]);
|
||||||
Z_Free(sprinfoToken);
|
Z_Free(sprinfoToken);
|
||||||
@@ -60,53 +62,53 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||||||
sprinfoToken = M_GetToken(NULL);
|
sprinfoToken = M_GetToken(NULL);
|
||||||
if (sprinfoToken == NULL)
|
if (sprinfoToken == NULL)
|
||||||
I_Error("Error parsing SPRTINFO lump: Missing sprite info");
|
I_Error("Error parsing SPRTINFO lump: Missing sprite info");
|
||||||
else
|
|
||||||
|
if (fastcmp(sprinfoToken, "{"))
|
||||||
{
|
{
|
||||||
if (strcmp(sprinfoToken,"{")==0)
|
Z_Free(sprinfoToken);
|
||||||
|
sprinfoToken = M_GetToken(NULL);
|
||||||
|
if (sprinfoToken == NULL)
|
||||||
{
|
{
|
||||||
|
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info should be");
|
||||||
|
}
|
||||||
|
while (!fastcmp(sprinfoToken, "}"))
|
||||||
|
{
|
||||||
|
if (fasticmp(sprinfoToken, "XPIVOT"))
|
||||||
|
{
|
||||||
|
Z_Free(sprinfoToken);
|
||||||
|
sprinfoToken = M_GetToken(NULL);
|
||||||
|
frameXPivot = atoi(sprinfoToken);
|
||||||
|
}
|
||||||
|
else if (fasticmp(sprinfoToken, "YPIVOT"))
|
||||||
|
{
|
||||||
|
Z_Free(sprinfoToken);
|
||||||
|
sprinfoToken = M_GetToken(NULL);
|
||||||
|
frameYPivot = atoi(sprinfoToken);
|
||||||
|
}
|
||||||
|
else if (fasticmp(sprinfoToken, "ROTAXIS"))
|
||||||
|
{
|
||||||
|
Z_Free(sprinfoToken);
|
||||||
|
sprinfoToken = M_GetToken(NULL);
|
||||||
|
if (fasticmp(sprinfoToken, "X") || fasticmp(sprinfoToken, "XAXIS") || fasticmp(sprinfoToken, "ROLL"))
|
||||||
|
frameRotAxis = ROTAXIS_X;
|
||||||
|
else if (fasticmp(sprinfoToken, "Y") || fasticmp(sprinfoToken, "YAXIS") || fasticmp(sprinfoToken, "PITCH"))
|
||||||
|
frameRotAxis = ROTAXIS_Y;
|
||||||
|
else if (fasticmp(sprinfoToken, "Z") || fasticmp(sprinfoToken, "ZAXIS") || fasticmp(sprinfoToken, "YAW"))
|
||||||
|
frameRotAxis = ROTAXIS_Z;
|
||||||
|
}
|
||||||
|
|
||||||
Z_Free(sprinfoToken);
|
Z_Free(sprinfoToken);
|
||||||
|
|
||||||
sprinfoToken = M_GetToken(NULL);
|
sprinfoToken = M_GetToken(NULL);
|
||||||
if (sprinfoToken == NULL)
|
if (sprinfoToken == NULL)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info should be");
|
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info or right curly brace should be");
|
||||||
}
|
|
||||||
while (strcmp(sprinfoToken,"}")!=0)
|
|
||||||
{
|
|
||||||
if (stricmp(sprinfoToken, "XPIVOT")==0)
|
|
||||||
{
|
|
||||||
Z_Free(sprinfoToken);
|
|
||||||
sprinfoToken = M_GetToken(NULL);
|
|
||||||
frameXPivot = atoi(sprinfoToken);
|
|
||||||
}
|
|
||||||
else if (stricmp(sprinfoToken, "YPIVOT")==0)
|
|
||||||
{
|
|
||||||
Z_Free(sprinfoToken);
|
|
||||||
sprinfoToken = M_GetToken(NULL);
|
|
||||||
frameYPivot = atoi(sprinfoToken);
|
|
||||||
}
|
|
||||||
else if (stricmp(sprinfoToken, "ROTAXIS")==0)
|
|
||||||
{
|
|
||||||
Z_Free(sprinfoToken);
|
|
||||||
sprinfoToken = M_GetToken(NULL);
|
|
||||||
if ((stricmp(sprinfoToken, "X")==0) || (stricmp(sprinfoToken, "XAXIS")==0) || (stricmp(sprinfoToken, "ROLL")==0))
|
|
||||||
frameRotAxis = ROTAXIS_X;
|
|
||||||
else if ((stricmp(sprinfoToken, "Y")==0) || (stricmp(sprinfoToken, "YAXIS")==0) || (stricmp(sprinfoToken, "PITCH")==0))
|
|
||||||
frameRotAxis = ROTAXIS_Y;
|
|
||||||
else if ((stricmp(sprinfoToken, "Z")==0) || (stricmp(sprinfoToken, "ZAXIS")==0) || (stricmp(sprinfoToken, "YAW")==0))
|
|
||||||
frameRotAxis = ROTAXIS_Z;
|
|
||||||
}
|
|
||||||
Z_Free(sprinfoToken);
|
|
||||||
|
|
||||||
sprinfoToken = M_GetToken(NULL);
|
|
||||||
if (sprinfoToken == NULL)
|
|
||||||
{
|
|
||||||
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info or right curly brace should be");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Z_Free(sprinfoToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Z_Free(sprinfoToken);
|
||||||
|
|
||||||
// set fields
|
// set fields
|
||||||
info->pivot[frameFrame].x = frameXPivot;
|
info->pivot[frameFrame].x = frameXPivot;
|
||||||
info->pivot[frameFrame].y = frameYPivot;
|
info->pivot[frameFrame].y = frameYPivot;
|
||||||
@@ -136,6 +138,7 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite name should be");
|
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite name should be");
|
||||||
}
|
}
|
||||||
|
|
||||||
sprinfoTokenLength = strlen(sprinfoToken);
|
sprinfoTokenLength = strlen(sprinfoToken);
|
||||||
if (sprinfoTokenLength != 4)
|
if (sprinfoTokenLength != 4)
|
||||||
{
|
{
|
||||||
@@ -148,6 +151,7 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||||||
// ^^ we've confirmed that the token is == 4 characters so it will never overflow a 5 byte char buffer
|
// ^^ we've confirmed that the token is == 4 characters so it will never overflow a 5 byte char buffer
|
||||||
strupr(newSpriteName); // Just do this now so we don't have to worry about it
|
strupr(newSpriteName); // Just do this now so we don't have to worry about it
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(sprinfoToken);
|
Z_Free(sprinfoToken);
|
||||||
|
|
||||||
if (!spr2)
|
if (!spr2)
|
||||||
@@ -156,16 +160,17 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||||||
{
|
{
|
||||||
if (i == NUMSPRITES)
|
if (i == NUMSPRITES)
|
||||||
I_Error("Error parsing SPRTINFO lump: Unknown sprite name \"%s\"", newSpriteName);
|
I_Error("Error parsing SPRTINFO lump: Unknown sprite name \"%s\"", newSpriteName);
|
||||||
if (!memcmp(newSpriteName,sprnames[i],4))
|
|
||||||
|
if (!memcmp(newSpriteName,sprnames[i], 4))
|
||||||
{
|
{
|
||||||
sprnum = i;
|
sprnum = static_cast<spritenum_t>(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate a spriteinfo
|
// allocate a spriteinfo
|
||||||
info = Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL);
|
info = static_cast<spriteinfo_t*>(Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL));
|
||||||
info->available = true;
|
info->available = true;
|
||||||
|
|
||||||
// Left Curly Brace
|
// Left Curly Brace
|
||||||
@@ -174,17 +179,20 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where open curly brace for sprite \"%s\" should be",newSpriteName);
|
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where open curly brace for sprite \"%s\" should be",newSpriteName);
|
||||||
}
|
}
|
||||||
if (strcmp(sprinfoToken,"{")==0)
|
|
||||||
|
if (fastcmp(sprinfoToken, "{"))
|
||||||
{
|
{
|
||||||
Z_Free(sprinfoToken);
|
Z_Free(sprinfoToken);
|
||||||
|
|
||||||
sprinfoToken = M_GetToken(NULL);
|
sprinfoToken = M_GetToken(NULL);
|
||||||
if (sprinfoToken == NULL)
|
if (sprinfoToken == NULL)
|
||||||
{
|
{
|
||||||
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where definition for sprite \"%s\" should be",newSpriteName);
|
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where definition for sprite \"%s\" should be",newSpriteName);
|
||||||
}
|
}
|
||||||
while (strcmp(sprinfoToken,"}")!=0)
|
|
||||||
|
while (!fastcmp(sprinfoToken, "}"))
|
||||||
{
|
{
|
||||||
if (stricmp(sprinfoToken, "SKIN")==0)
|
if (fasticmp(sprinfoToken, "SKIN"))
|
||||||
{
|
{
|
||||||
INT32 skinnum;
|
INT32 skinnum;
|
||||||
char *skinName = NULL;
|
char *skinName = NULL;
|
||||||
@@ -215,10 +223,11 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||||||
skinnumbers[foundskins] = skinnum;
|
skinnumbers[foundskins] = skinnum;
|
||||||
foundskins++;
|
foundskins++;
|
||||||
}
|
}
|
||||||
else if (stricmp(sprinfoToken, "FRAME")==0)
|
else if (fasticmp(sprinfoToken, "FRAME"))
|
||||||
{
|
{
|
||||||
R_ParseSpriteInfoFrame(info);
|
R_ParseSpriteInfoFrame(info);
|
||||||
Z_Free(sprinfoToken);
|
Z_Free(sprinfoToken);
|
||||||
|
|
||||||
if (spr2)
|
if (spr2)
|
||||||
{
|
{
|
||||||
if (!foundskins)
|
if (!foundskins)
|
||||||
@@ -253,6 +262,7 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||||||
{
|
{
|
||||||
I_Error("Error parsing SPRTINFO lump: Expected \"{\" for sprite \"%s\", got \"%s\"",newSpriteName,sprinfoToken);
|
I_Error("Error parsing SPRTINFO lump: Expected \"{\" for sprite \"%s\", got \"%s\"",newSpriteName,sprinfoToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(sprinfoToken);
|
Z_Free(sprinfoToken);
|
||||||
Z_Free(info);
|
Z_Free(info);
|
||||||
}
|
}
|
||||||
@@ -290,15 +300,18 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum)
|
|||||||
while (sprinfoToken != NULL)
|
while (sprinfoToken != NULL)
|
||||||
{
|
{
|
||||||
CONS_Printf("Attempting to parse le SPRTINFO lump for ya..\n");
|
CONS_Printf("Attempting to parse le SPRTINFO lump for ya..\n");
|
||||||
if (!stricmp(sprinfoToken, "SPRITE"))
|
|
||||||
|
if (fasticmp(sprinfoToken, "SPRITE"))
|
||||||
R_ParseSpriteInfo(false);
|
R_ParseSpriteInfo(false);
|
||||||
else if (!stricmp(sprinfoToken, "SPRITE2"))
|
else if (fasticmp(sprinfoToken, "SPRITE2"))
|
||||||
R_ParseSpriteInfo(true);
|
R_ParseSpriteInfo(true);
|
||||||
else
|
else
|
||||||
I_Error("Error parsing SPRTINFO lump: Unknown keyword \"%s\"", sprinfoToken);
|
I_Error("Error parsing SPRTINFO lump: Unknown keyword \"%s\"", sprinfoToken);
|
||||||
|
|
||||||
Z_Free(sprinfoToken);
|
Z_Free(sprinfoToken);
|
||||||
sprinfoToken = M_GetToken(NULL);
|
sprinfoToken = M_GetToken(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free((void *)sprinfoText);
|
Z_Free((void *)sprinfoText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +342,7 @@ void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps)
|
|||||||
|
|
||||||
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
||||||
{
|
{
|
||||||
patch_t *patch = (dest == NULL) ? Z_Calloc(sizeof(patch_t), PU_PATCH, NULL) : (patch_t *)(dest);
|
patch_t *patch = static_cast<patch_t*>((dest == NULL) ? Z_Calloc(sizeof(patch_t), PU_PATCH, NULL) : dest);
|
||||||
|
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
@@ -341,7 +354,7 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
|||||||
patch->height = SHORT(source->height);
|
patch->height = SHORT(source->height);
|
||||||
patch->leftoffset = SHORT(source->leftoffset);
|
patch->leftoffset = SHORT(source->leftoffset);
|
||||||
patch->topoffset = SHORT(source->topoffset);
|
patch->topoffset = SHORT(source->topoffset);
|
||||||
patch->columnofs = Z_Calloc(size, PU_PATCH_DATA, NULL);
|
patch->columnofs = static_cast<INT32*>(Z_Calloc(size, PU_PATCH_DATA, NULL));
|
||||||
|
|
||||||
for (col = 0; col < source->width; col++)
|
for (col = 0; col < source->width; col++)
|
||||||
{
|
{
|
||||||
@@ -357,7 +370,7 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
|||||||
if (colsize <= 0)
|
if (colsize <= 0)
|
||||||
I_Error("Patch_Create: no column data!");
|
I_Error("Patch_Create: no column data!");
|
||||||
|
|
||||||
patch->columns = Z_Calloc(colsize, PU_PATCH_DATA, NULL);
|
patch->columns = static_cast<UINT8*>(Z_Calloc(colsize, PU_PATCH_DATA, NULL));
|
||||||
M_Memcpy(patch->columns, ((UINT8 *)source + LONG(source->columnofs[0])), colsize);
|
M_Memcpy(patch->columns, ((UINT8 *)source + LONG(source->columnofs[0])), colsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,8 +442,8 @@ void *Patch_AllocateHardwarePatch(patch_t *patch)
|
|||||||
{
|
{
|
||||||
if (!patch->hardware)
|
if (!patch->hardware)
|
||||||
{
|
{
|
||||||
GLPatch_t *glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, &patch->hardware);
|
GLPatch_t *glPatch = static_cast<GLPatch_t*>(Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, &patch->hardware));
|
||||||
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, &glPatch->mipmap);
|
glPatch->mipmap = static_cast<GLMipmap_t*>(Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, &glPatch->mipmap));
|
||||||
}
|
}
|
||||||
return (void *)(patch->hardware);
|
return (void *)(patch->hardware);
|
||||||
}
|
}
|
||||||
@@ -448,7 +461,8 @@ void *Patch_CreateGL(patch_t *patch)
|
|||||||
}
|
}
|
||||||
#endif // HWRENDER
|
#endif // HWRENDER
|
||||||
|
|
||||||
static UINT8 *imgbuf = NULL;
|
// 1 MB should be enough for most cases
|
||||||
|
static std::vector<UINT8> imgbuf(1024 * 1024);
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_MaskedFlatToPatch
|
// R_MaskedFlatToPatch
|
||||||
@@ -458,17 +472,27 @@ static UINT8 *imgbuf = NULL;
|
|||||||
void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
||||||
{
|
{
|
||||||
INT16 x, y;
|
INT16 x, y;
|
||||||
UINT8 *img;
|
UINT8 *img, *imgptr;
|
||||||
UINT8 *colpointers, *startofspan;
|
UINT8 *colpointers, *startofspan;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
if (!raw)
|
if (!raw)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!imgbuf)
|
// Allocate a staging buffer with the maximum size needed for a patch of the same size as the input.
|
||||||
imgbuf = Z_Malloc(1<<26, PU_STATIC, NULL);
|
|
||||||
|
|
||||||
UINT8 *imgptr = imgbuf;
|
// round up to nearest multiple of 254-pixel posts, plus 1 more 254-pixel post for paranoia reasons
|
||||||
|
size_t maxcolumnsize = (2 + (height - 1) / 256) * 256;
|
||||||
|
// the patch header, and width columns of the max column size
|
||||||
|
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
|
||||||
|
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
|
||||||
|
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
|
||||||
|
while (imgbuf.size() < maxoutsize)
|
||||||
|
{
|
||||||
|
imgbuf.resize(imgbuf.size() * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
imgptr = imgbuf.data();
|
||||||
|
|
||||||
// Write image size and offset
|
// Write image size and offset
|
||||||
WRITEINT16(imgptr, width);
|
WRITEINT16(imgptr, width);
|
||||||
@@ -488,7 +512,7 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
startofspan = NULL;
|
startofspan = NULL;
|
||||||
|
|
||||||
// Write column pointer
|
// Write column pointer
|
||||||
WRITEINT32(colpointers, imgptr - imgbuf);
|
WRITEINT32(colpointers, imgptr - imgbuf.data());
|
||||||
|
|
||||||
// Write pixels
|
// Write pixels
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
@@ -557,9 +581,9 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
WRITEUINT8(imgptr, 0xFF);
|
WRITEUINT8(imgptr, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = imgptr-imgbuf;
|
size = imgptr-imgbuf.data();
|
||||||
img = Z_Malloc(size, PU_STATIC, NULL);
|
img = static_cast<UINT8*>(Z_Malloc(size, PU_STATIC, NULL));
|
||||||
memcpy(img, imgbuf, size);
|
memcpy(img, imgbuf.data(), size);
|
||||||
|
|
||||||
if (destsize != NULL)
|
if (destsize != NULL)
|
||||||
*destsize = size;
|
*destsize = size;
|
||||||
@@ -582,17 +606,27 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
||||||
{
|
{
|
||||||
INT16 x, y;
|
INT16 x, y;
|
||||||
UINT8 *img;
|
UINT8 *img, *imgptr;
|
||||||
UINT8 *colpointers, *startofspan;
|
UINT8 *colpointers, *startofspan;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
if (!raw)
|
if (!raw)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!imgbuf)
|
// Allocate a staging buffer with the maximum size needed for a patch of the same size as the input.
|
||||||
imgbuf = Z_Malloc(1<<26, PU_STATIC, NULL);
|
|
||||||
|
|
||||||
UINT8 *imgptr = imgbuf;
|
// round up to nearest multiple of 254-pixel posts, plus 1 more 254-pixel post for paranoia reasons
|
||||||
|
size_t maxcolumnsize = (2 + (height - 1) / 256) * 256;
|
||||||
|
// the patch header, and width columns of the max column size
|
||||||
|
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
|
||||||
|
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
|
||||||
|
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
|
||||||
|
while (imgbuf.size() < maxoutsize)
|
||||||
|
{
|
||||||
|
imgbuf.resize(imgbuf.size() * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
imgptr = imgbuf.data();
|
||||||
|
|
||||||
// Write image size and offset
|
// Write image size and offset
|
||||||
WRITEINT16(imgptr, width);
|
WRITEINT16(imgptr, width);
|
||||||
@@ -612,7 +646,7 @@ void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffs
|
|||||||
startofspan = NULL;
|
startofspan = NULL;
|
||||||
|
|
||||||
// Write column pointer
|
// Write column pointer
|
||||||
WRITEINT32(colpointers, imgptr - imgbuf);
|
WRITEINT32(colpointers, imgptr - imgbuf.data());
|
||||||
|
|
||||||
// Write pixels
|
// Write pixels
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
@@ -682,9 +716,9 @@ void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffs
|
|||||||
WRITEUINT8(imgptr, 0xFF);
|
WRITEUINT8(imgptr, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = imgptr-imgbuf;
|
size = imgptr-imgbuf.data();
|
||||||
img = Z_Malloc(size, PU_STATIC, NULL);
|
img = static_cast<UINT8*>(Z_Malloc(size, PU_STATIC, NULL));
|
||||||
memcpy(img, imgbuf, size);
|
memcpy(img, imgbuf.data(), size);
|
||||||
|
|
||||||
if (destsize != NULL)
|
if (destsize != NULL)
|
||||||
*destsize = size;
|
*destsize = size;
|
||||||
@@ -14,6 +14,10 @@
|
|||||||
#ifndef __R_PATCH__
|
#ifndef __R_PATCH__
|
||||||
#define __R_PATCH__
|
#define __R_PATCH__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
|
||||||
// Structs
|
// Structs
|
||||||
@@ -36,6 +40,8 @@ typedef struct
|
|||||||
boolean available;
|
boolean available;
|
||||||
} spriteinfo_t;
|
} spriteinfo_t;
|
||||||
|
|
||||||
|
#define PNG_HEADER_SIZE (8)
|
||||||
|
|
||||||
// Patch functions
|
// Patch functions
|
||||||
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest);
|
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest);
|
||||||
void Patch_Free(patch_t *patch);
|
void Patch_Free(patch_t *patch);
|
||||||
@@ -61,4 +67,8 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
UINT16 R_GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip);
|
UINT16 R_GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip);
|
||||||
void R_PatchToPixels(patch_t *patch, UINT8 *dst); // Important: dst must have enough space for patch->width*patch->height pixels!
|
void R_PatchToPixels(patch_t *patch, UINT8 *dst); // Important: dst must have enough space for patch->width*patch->height pixels!
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __R_PATCH__
|
#endif // __R_PATCH__
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "r_patchrotation.h"
|
#include "r_patchrotation.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#ifdef ROTSPRITE
|
#ifdef ROTSPRITE
|
||||||
//
|
//
|
||||||
@@ -89,14 +90,14 @@ patch_t *Patch_GetRotatedSprite(spriteframe_t *sprite, size_t frame, size_t spri
|
|||||||
RotatedPatch_DoRotation(rotsprite, patch, rotationangle, xpivot, ypivot, flip);
|
RotatedPatch_DoRotation(rotsprite, patch, rotationangle, xpivot, ypivot, flip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rotsprite->patches[idx];
|
return static_cast<patch_t*>(rotsprite->patches[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
rotsprite_t *RotatedPatch_Create(INT32 numangles)
|
rotsprite_t *RotatedPatch_Create(INT32 numangles)
|
||||||
{
|
{
|
||||||
rotsprite_t *rotsprite = Z_Calloc(sizeof(rotsprite_t), PU_STATIC, NULL);
|
rotsprite_t *rotsprite = static_cast<rotsprite_t*>(Z_Calloc(sizeof(rotsprite_t), PU_STATIC, NULL));
|
||||||
rotsprite->angles = numangles;
|
rotsprite->angles = numangles;
|
||||||
rotsprite->patches = Z_Calloc(rotsprite->angles * 2 * sizeof(void *), PU_STATIC, NULL);
|
rotsprite->patches = static_cast<void**>(Z_Calloc(rotsprite->angles * 2 * sizeof(void *), PU_STATIC, NULL));
|
||||||
return rotsprite;
|
return rotsprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,30 +119,8 @@ static void RotatedPatch_CalculateDimensions(
|
|||||||
h1 = FixedInt(FixedCeil(h1 + (FRACUNIT/2)));
|
h1 = FixedInt(FixedCeil(h1 + (FRACUNIT/2)));
|
||||||
h2 = FixedInt(FixedCeil(h2 + (FRACUNIT/2)));
|
h2 = FixedInt(FixedCeil(h2 + (FRACUNIT/2)));
|
||||||
|
|
||||||
*newwidth = max(width, max(w1, w2));
|
*newwidth = std::max(width, std::max(w1, w2));
|
||||||
*newheight = max(height, max(h1, h2));
|
*newheight = std::max(height, std::max(h1, h2));
|
||||||
}
|
|
||||||
|
|
||||||
static void RotatedPatch_AllocImgBuf(UINT16 **buf, size_t size, size_t *capacity)
|
|
||||||
{
|
|
||||||
if (!*buf)
|
|
||||||
{
|
|
||||||
*buf = Z_Malloc(*capacity, PU_STATIC, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t allocsize = size * sizeof(UINT16);
|
|
||||||
|
|
||||||
// make sure our buffer always fits with what we need
|
|
||||||
if (allocsize > *capacity)
|
|
||||||
{
|
|
||||||
while (*capacity < allocsize)
|
|
||||||
*capacity *= 2;
|
|
||||||
|
|
||||||
Z_Free(*buf);
|
|
||||||
*buf = Z_Malloc(*capacity, PU_STATIC, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
//CONS_Printf("RotatedPatch_AllocBuf: Allocated %.2f KB\n", *capacity / 1024.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, boolean flip)
|
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, boolean flip)
|
||||||
@@ -149,10 +128,10 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
UINT32 i;
|
UINT32 i;
|
||||||
patch_t *rotated;
|
patch_t *rotated;
|
||||||
|
|
||||||
static UINT16 *rawdst = NULL, *rawconv = NULL;
|
static std::vector<UINT16> rawdst(1024 * 1024), rawconv(1024 * 1024); // 1 MB should be enough for most cases
|
||||||
|
|
||||||
UINT16 *rawout;
|
UINT16 *rawout;
|
||||||
size_t size;
|
size_t size;
|
||||||
static size_t dst_capacity = (1024 * 1024), conv_capacity = (1024 * 1024); // 1 MB should be enough for most cases
|
|
||||||
INT32 bflip = (flip != 0x00);
|
INT32 bflip = (flip != 0x00);
|
||||||
|
|
||||||
INT32 width = patch->width;
|
INT32 width = patch->width;
|
||||||
@@ -206,7 +185,10 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
if (!size)
|
if (!size)
|
||||||
size = (width * height);
|
size = (width * height);
|
||||||
|
|
||||||
RotatedPatch_AllocImgBuf(&rawdst, size, &dst_capacity);
|
while (rawdst.size() < size)
|
||||||
|
{
|
||||||
|
rawdst.resize(rawdst.size() * 2);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
rawdst[i] = 0xFF00;
|
rawdst[i] = 0xFF00;
|
||||||
@@ -250,11 +232,11 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
|
|
||||||
size = (width * height);
|
size = (width * height);
|
||||||
|
|
||||||
RotatedPatch_AllocImgBuf(&rawconv, size, &conv_capacity);
|
rawconv.resize(size);
|
||||||
memset(rawconv, 0, conv_capacity * sizeof(UINT16));
|
memset(rawconv.data(), 0, size * sizeof(UINT16));
|
||||||
|
|
||||||
src = &rawdst[(miny * newwidth) + minx];
|
src = &rawdst[(miny * newwidth) + minx];
|
||||||
dest = rawconv;
|
dest = rawconv.data();
|
||||||
dy = height;
|
dy = height;
|
||||||
|
|
||||||
while (dy--)
|
while (dy--)
|
||||||
@@ -267,14 +249,14 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
ox -= minx;
|
ox -= minx;
|
||||||
oy -= miny;
|
oy -= miny;
|
||||||
|
|
||||||
rawout = rawconv;
|
rawout = rawconv.data();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width = newwidth;
|
width = newwidth;
|
||||||
height = newheight;
|
height = newheight;
|
||||||
|
|
||||||
rawout = rawdst;
|
rawout = rawdst.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
// make patch
|
// make patch
|
||||||
+38
-52
@@ -46,31 +46,27 @@
|
|||||||
// good night sweet prince
|
// good night sweet prince
|
||||||
//#define SHITPLANESPARENCY
|
//#define SHITPLANESPARENCY
|
||||||
|
|
||||||
visplane_t *visplanes[MAXVISPLANES];
|
visplane_t *visplanes[MAXVISPLANES] = {};
|
||||||
static visplane_t *freetail;
|
static visplane_t *freetail;
|
||||||
static visplane_t **freehead = &freetail;
|
static visplane_t **freehead = &freetail;
|
||||||
|
|
||||||
visplane_t *floorplane;
|
visplane_t *floorplane = NULL;
|
||||||
visplane_t *ceilingplane;
|
visplane_t *ceilingplane = NULL;
|
||||||
|
|
||||||
visffloor_t visffloor[MAXFFLOORS];
|
visffloor_t visffloor[MAXFFLOORS] = {};
|
||||||
INT32 numffloors;
|
INT32 numffloors = 0;
|
||||||
|
|
||||||
//SoM: 3/23/2000: Boom visplane hashing routine.
|
//SoM: 3/23/2000: Boom visplane hashing routine.
|
||||||
#define visplane_hash(picnum,lightlevel,height) \
|
#define visplane_hash(picnum,lightlevel,height) \
|
||||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
||||||
|
|
||||||
//SoM: 3/23/2000: Use boom opening limit removal
|
|
||||||
size_t maxopenings;
|
|
||||||
INT16 *openings, *lastopening; /// \todo free leak
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clip values are the solid pixel bounding the range.
|
// Clip values are the solid pixel bounding the range.
|
||||||
// floorclip starts out SCREENHEIGHT
|
// floorclip starts out SCREENHEIGHT
|
||||||
// ceilingclip starts out -1
|
// ceilingclip starts out -1
|
||||||
//
|
//
|
||||||
INT16 *floorclip, *ceilingclip;
|
INT16 *floorclip = NULL, *ceilingclip = NULL;
|
||||||
fixed_t *frontscale;
|
fixed_t *frontscale = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// spanstart holds the start of a plane span
|
// spanstart holds the start of a plane span
|
||||||
@@ -85,13 +81,13 @@ static INT32 *spanstart;
|
|||||||
// (this is to calculate yslopes only when really needed)
|
// (this is to calculate yslopes only when really needed)
|
||||||
// (when mouselookin', yslope is moving into yslopetab)
|
// (when mouselookin', yslope is moving into yslopetab)
|
||||||
// Check R_SetupFrame, R_SetViewSize for more...
|
// Check R_SetupFrame, R_SetViewSize for more...
|
||||||
fixed_t *yslopetab;
|
fixed_t *yslopetab = NULL;
|
||||||
fixed_t *yslope;
|
fixed_t *yslope = NULL;
|
||||||
|
|
||||||
fixed_t basexscale, baseyscale;
|
fixed_t basexscale = 0, baseyscale = 0;
|
||||||
|
|
||||||
static INT16 *ffloor_f_clip;
|
static INT16 *ffloor_f_clip = NULL;
|
||||||
static INT16 *ffloor_c_clip;
|
static INT16 *ffloor_c_clip = NULL;
|
||||||
|
|
||||||
static void R_SetTiltedSpan(drawspandata_t* ds, INT32 span);
|
static void R_SetTiltedSpan(drawspandata_t* ds, INT32 span);
|
||||||
static void R_SetSlopePlaneVectors(drawspandata_t* ds, visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff);
|
static void R_SetSlopePlaneVectors(drawspandata_t* ds, visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff);
|
||||||
@@ -339,13 +335,13 @@ void R_ClearPlanes(void)
|
|||||||
R_ClearFFloorClips();
|
R_ClearFFloorClips();
|
||||||
|
|
||||||
for (i = 0; i < MAXVISPLANES; i++)
|
for (i = 0; i < MAXVISPLANES; i++)
|
||||||
|
{
|
||||||
for (*freehead = visplanes[i], visplanes[i] = NULL;
|
for (*freehead = visplanes[i], visplanes[i] = NULL;
|
||||||
freehead && *freehead ;)
|
freehead && *freehead ;)
|
||||||
{
|
{
|
||||||
freehead = &(*freehead)->next;
|
freehead = &(*freehead)->next;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lastopening = openings;
|
|
||||||
|
|
||||||
// left to right mapping
|
// left to right mapping
|
||||||
angle = (viewangle-ANGLE_90)>>ANGLETOFINESHIFT;
|
angle = (viewangle-ANGLE_90)>>ANGLETOFINESHIFT;
|
||||||
@@ -620,14 +616,12 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
|
|||||||
//
|
//
|
||||||
static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), spandrawfunc_t* localspanfunc, drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel)
|
static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), spandrawfunc_t* localspanfunc, drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel)
|
||||||
{
|
{
|
||||||
const INT32 vidheight = vid.height;
|
|
||||||
|
|
||||||
// Alam: from r_splats's R_RenderFloorSplat
|
// Alam: from r_splats's R_RenderFloorSplat
|
||||||
if (t1 >= vidheight) t1 = vidheight-1;
|
if (t1 >= viewheight) t1 = viewheight-1;
|
||||||
if (b1 >= vidheight) b1 = vidheight-1;
|
if (b1 >= viewheight) b1 = viewheight-1;
|
||||||
if (t2 >= vidheight) t2 = vidheight-1;
|
if (t2 >= viewheight) t2 = viewheight-1;
|
||||||
if (b2 >= vidheight) b2 = vidheight-1;
|
if (b2 >= viewheight) b2 = viewheight-1;
|
||||||
if (x-1 >= vid.width) x = vid.width;
|
if (x-1 >= viewwidth) x = viewwidth;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
// We want to draw N spans per subtask to ensure the work is
|
// We want to draw N spans per subtask to ensure the work is
|
||||||
@@ -720,13 +714,10 @@ void R_DrawPlanes(void)
|
|||||||
visplane_t *pl;
|
visplane_t *pl;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
drawspandata_t ds = {};
|
drawspandata_t ds = {};
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
srb2::ThreadPool::Sema tp_sema;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
R_UpdatePlaneRipple(&ds);
|
R_UpdatePlaneRipple(&ds);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
|
srb2::ThreadPool::Sema tp_sema;
|
||||||
srb2::g_main_threadpool->begin_sema();
|
srb2::g_main_threadpool->begin_sema();
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
||||||
@@ -746,13 +737,20 @@ void R_DrawPlanes(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), boolean allow_parallel);
|
static void R_DrawSkyPlane(visplane_t *pl, void(*skycolfunc)(drawcolumndata_t*), boolean allow_parallel);
|
||||||
|
|
||||||
void R_DrawSkyPlanes(void)
|
void R_DrawSkyPlanes(void)
|
||||||
{
|
{
|
||||||
visplane_t *pl;
|
visplane_t *pl;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
// If we're not supposed to draw the sky (e.g. for skyboxes), don't do anything!
|
||||||
|
// This probably utterly ruins sky rendering for FOFs and polyobjects, unfortunately
|
||||||
|
if (!newview->sky)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
srb2::ThreadPool::Sema tp_sema;
|
srb2::ThreadPool::Sema tp_sema;
|
||||||
srb2::g_main_threadpool->begin_sema();
|
srb2::g_main_threadpool->begin_sema();
|
||||||
@@ -774,23 +772,17 @@ void R_DrawSkyPlanes(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), boolean allow_parallel)
|
static void R_DrawSkyPlane(visplane_t *pl, void(*skycolfunc)(drawcolumndata_t*), boolean allow_parallel)
|
||||||
{
|
{
|
||||||
INT32 x;
|
INT32 x;
|
||||||
|
|
||||||
if (!(pl->minx <= pl->maxx))
|
if (!(pl->minx <= pl->maxx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If we're not supposed to draw the sky (e.g. for skyboxes), don't do anything!
|
|
||||||
// This probably utterly ruins sky rendering for FOFs and polyobjects, unfortunately
|
|
||||||
if (!newview->sky)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawcolumndata_t dc = {};
|
drawcolumndata_t dc = {};
|
||||||
|
const INT32 texture = texturetranslation[skytexture];
|
||||||
|
|
||||||
// Reset column drawer function (note: couldn't we just call walldrawerfunc directly?)
|
// Reset column drawer function (note: couldn't we just call colfuncs[BASEDRAWFUNC] directly?)
|
||||||
// (that is, unless we'll need to switch drawers in future for some reason)
|
// (that is, unless we'll need to switch drawers in future for some reason)
|
||||||
R_SetColumnFunc(BASEDRAWFUNC);
|
R_SetColumnFunc(BASEDRAWFUNC);
|
||||||
|
|
||||||
@@ -807,16 +799,13 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
|||||||
dc.colormap += COLORMAP_REMAPOFFSET;
|
dc.colormap += COLORMAP_REMAPOFFSET;
|
||||||
|
|
||||||
dc.texturemid = skytexturemid;
|
dc.texturemid = skytexturemid;
|
||||||
dc.texheight = textureheight[skytexture] >>FRACBITS;
|
dc.texheight = textureheight[texture] >>FRACBITS;
|
||||||
dc.sourcelength = dc.texheight;
|
dc.sourcelength = dc.texheight;
|
||||||
|
|
||||||
x = pl->minx;
|
x = pl->minx;
|
||||||
|
|
||||||
// Precache the texture so we don't corrupt the zoned heap off-main thread
|
// Precache the texture so we don't corrupt the zoned heap off-main thread
|
||||||
if (!texturecache[texturetranslation[skytexture]])
|
R_CheckTextureCache(texture);
|
||||||
{
|
|
||||||
R_GenerateTexture(texturetranslation[skytexture]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
while (x <= pl->maxx)
|
while (x <= pl->maxx)
|
||||||
@@ -841,11 +830,9 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
|||||||
|
|
||||||
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x + i]>>ANGLETOFINESHIFT));
|
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x + i]>>ANGLETOFINESHIFT));
|
||||||
dc.x = x + i;
|
dc.x = x + i;
|
||||||
dc.source =
|
dc.source = R_GetColumn(texture, -angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
||||||
R_GetColumn(texturetranslation[skytexture],
|
|
||||||
-angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
|
||||||
|
|
||||||
colfunc2(&dc);
|
skycolfunc(&dc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -879,10 +866,9 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
|||||||
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT));
|
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT));
|
||||||
dc.x = x;
|
dc.x = x;
|
||||||
dc.source =
|
dc.source =
|
||||||
R_GetColumn(texturetranslation[skytexture],
|
R_GetColumn(texturetranslation[skytexture], -angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
||||||
-angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
|
||||||
|
|
||||||
colfunc2(&dc);
|
skycolfunc(&dc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1153,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
|||||||
offset = (scry*vid.width) + scrx;
|
offset = (scry*vid.width) + scrx;
|
||||||
|
|
||||||
// No idea if this works
|
// No idea if this works
|
||||||
VID_BlitLinearScreen(renderscreen + offset,
|
VID_BlitLinearScreen(vid.screens[0] + offset,
|
||||||
vid.screens[1] + (top*vid.width), // intentionally not +offset
|
vid.screens[1] + (top*vid.width), // intentionally not +offset
|
||||||
viewwidth, bottom-top,
|
viewwidth, bottom-top,
|
||||||
vid.width, vid.width);
|
vid.width, vid.width);
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ extern visplane_t *floorplane;
|
|||||||
extern visplane_t *ceilingplane;
|
extern visplane_t *ceilingplane;
|
||||||
|
|
||||||
// Visplane related.
|
// Visplane related.
|
||||||
extern INT16 *lastopening, *openings;
|
|
||||||
extern size_t maxopenings;
|
|
||||||
|
|
||||||
extern INT16 *floorclip, *ceilingclip;
|
extern INT16 *floorclip, *ceilingclip;
|
||||||
extern fixed_t *frontscale, *yslopetab;
|
extern fixed_t *frontscale, *yslopetab;
|
||||||
|
|||||||
+275
-214
@@ -26,7 +26,6 @@
|
|||||||
#include "p_local.h" // Camera...
|
#include "p_local.h" // Camera...
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
#include "console.h" // con_clipviewtop
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
@@ -78,9 +77,21 @@ static fixed_t topfrac, topstep;
|
|||||||
static fixed_t bottomfrac, bottomstep;
|
static fixed_t bottomfrac, bottomstep;
|
||||||
|
|
||||||
static lighttable_t **walllights;
|
static lighttable_t **walllights;
|
||||||
static INT16 *maskedtexturecol;
|
static fixed_t *maskedtexturecol;
|
||||||
static fixed_t *maskedtextureheight = NULL;
|
static fixed_t *maskedtextureheight = NULL;
|
||||||
|
|
||||||
|
static size_t numopenings;
|
||||||
|
static INT16 *openings, *lastopening;
|
||||||
|
|
||||||
|
static size_t texturecolumntablesize;
|
||||||
|
static fixed_t *texturecolumntable, *curtexturecolumntable;
|
||||||
|
|
||||||
|
void R_ClearSegTables(void)
|
||||||
|
{
|
||||||
|
lastopening = openings;
|
||||||
|
curtexturecolumntable = texturecolumntable;
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// R_RenderMaskedSegRange
|
// R_RenderMaskedSegRange
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -140,7 +151,18 @@ static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *colum
|
|||||||
|
|
||||||
transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
||||||
{
|
{
|
||||||
return static_cast<transnum_t>((20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1));
|
if (alpha >= FRACUNIT)
|
||||||
|
{
|
||||||
|
return static_cast<transnum_t>(0);
|
||||||
|
}
|
||||||
|
else if (alpha <= 0)
|
||||||
|
{
|
||||||
|
return NUMTRANSMAPS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return static_cast<transnum_t>((20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boolean R_OverflowTest(drawcolumndata_t* dc)
|
static inline boolean R_OverflowTest(drawcolumndata_t* dc)
|
||||||
@@ -173,7 +195,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
|||||||
|
|
||||||
ldef = curline->linedef;
|
ldef = curline->linedef;
|
||||||
|
|
||||||
range = std::max(drawseg->x2-drawseg->x1, 1);
|
range = std::max<INT32>(drawseg->x2-drawseg->x1, 1);
|
||||||
|
|
||||||
// Setup lighting based on the presence/lack-of 3D floors.
|
// Setup lighting based on the presence/lack-of 3D floors.
|
||||||
dc->numlights = 0;
|
dc->numlights = 0;
|
||||||
@@ -306,141 +328,137 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
|||||||
else
|
else
|
||||||
dc->texturemid -= (textureheight[texnum])*times;
|
dc->texturemid -= (textureheight[texnum])*times;
|
||||||
|
|
||||||
const INT16 colnum = maskedtexturecol[dc->x];
|
// Check for overflows first
|
||||||
|
if (R_OverflowTest(dc))
|
||||||
|
{
|
||||||
|
// Eh, no, go away, don't waste our time
|
||||||
|
if (dc->numlights)
|
||||||
|
{
|
||||||
|
for (i = 0; i < dc->numlights; i++)
|
||||||
|
{
|
||||||
|
rlight = &dc->lightlist[i];
|
||||||
|
rlight->height += rlight->heightstep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spryscale += rw_scalestep;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// calculate lighting
|
// calculate lighting
|
||||||
if (colnum != INT16_MAX)
|
if (dc->numlights)
|
||||||
{
|
{
|
||||||
// Check for overflows first
|
lighttable_t **xwalllights;
|
||||||
if (R_OverflowTest(dc))
|
|
||||||
|
sprbotscreen = INT32_MAX;
|
||||||
|
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc->texturemid, spryscale));
|
||||||
|
|
||||||
|
realbot = windowbottom = FixedMul(textureheight[texnum], spryscale) + sprtopscreen;
|
||||||
|
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||||
|
|
||||||
|
// draw the texture
|
||||||
|
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc->x] >> FRACBITS)) - 3);
|
||||||
|
|
||||||
|
auto set_light_vars = [&](INT32 k)
|
||||||
{
|
{
|
||||||
// Eh, no, go away, don't waste our time
|
rlight = &dc->lightlist[k];
|
||||||
if (dc->numlights)
|
|
||||||
|
lightnum = rlight->lightnum;
|
||||||
|
|
||||||
|
if (lightnum < 0)
|
||||||
|
xwalllights = scalelight[0];
|
||||||
|
else if (lightnum >= LIGHTLEVELS)
|
||||||
|
xwalllights = scalelight[LIGHTLEVELS-1];
|
||||||
|
else
|
||||||
|
xwalllights = scalelight[lightnum];
|
||||||
|
|
||||||
|
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
||||||
|
|
||||||
|
if (pindex >= MAXLIGHTSCALE)
|
||||||
|
pindex = MAXLIGHTSCALE - 1;
|
||||||
|
|
||||||
|
if (rlight->extra_colormap)
|
||||||
|
rlight->rcolormap = rlight->extra_colormap->colormap + (xwalllights[pindex] - colormaps);
|
||||||
|
else
|
||||||
|
rlight->rcolormap = xwalllights[pindex];
|
||||||
|
};
|
||||||
|
|
||||||
|
auto set_colormap_below_light = [&]
|
||||||
|
{
|
||||||
|
dc->colormap = rlight->rcolormap;
|
||||||
|
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
||||||
|
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Use the base sector's light level above the first FOF.
|
||||||
|
// You can imagine it as the sky casting its light on top of the highest FOF.
|
||||||
|
set_light_vars(0);
|
||||||
|
set_colormap_below_light();
|
||||||
|
|
||||||
|
for (i = 0; i < dc->numlights; i++)
|
||||||
|
{
|
||||||
|
if ((dc->lightlist[i].flags & FF_NOSHADE))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
set_light_vars(i);
|
||||||
|
|
||||||
|
height = rlight->height;
|
||||||
|
rlight->height += rlight->heightstep;
|
||||||
|
|
||||||
|
if (height <= windowtop)
|
||||||
{
|
{
|
||||||
for (i = 0; i < dc->numlights; i++)
|
set_colormap_below_light();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
windowbottom = height;
|
||||||
|
if (windowbottom >= realbot)
|
||||||
|
{
|
||||||
|
windowbottom = realbot;
|
||||||
|
colfunc_2s(dc, col);
|
||||||
|
for (i++; i < dc->numlights; i++)
|
||||||
{
|
{
|
||||||
rlight = &dc->lightlist[i];
|
rlight = &dc->lightlist[i];
|
||||||
rlight->height += rlight->heightstep;
|
rlight->height += rlight->heightstep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
spryscale += rw_scalestep;
|
colfunc_2s(dc, col);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dc->numlights)
|
windowtop = windowbottom + 1;
|
||||||
{
|
|
||||||
lighttable_t **xwalllights;
|
|
||||||
|
|
||||||
sprbotscreen = INT32_MAX;
|
|
||||||
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc->texturemid, spryscale));
|
|
||||||
|
|
||||||
realbot = windowbottom = FixedMul(textureheight[texnum], spryscale) + sprtopscreen;
|
|
||||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
|
||||||
|
|
||||||
// draw the texture
|
|
||||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, colnum) - 3);
|
|
||||||
|
|
||||||
auto set_light_vars = [&](INT32 k)
|
|
||||||
{
|
|
||||||
rlight = &dc->lightlist[k];
|
|
||||||
|
|
||||||
lightnum = rlight->lightnum;
|
|
||||||
|
|
||||||
if (lightnum < 0)
|
|
||||||
xwalllights = scalelight[0];
|
|
||||||
else if (lightnum >= LIGHTLEVELS)
|
|
||||||
xwalllights = scalelight[LIGHTLEVELS-1];
|
|
||||||
else
|
|
||||||
xwalllights = scalelight[lightnum];
|
|
||||||
|
|
||||||
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
|
||||||
|
|
||||||
if (pindex >= MAXLIGHTSCALE)
|
|
||||||
pindex = MAXLIGHTSCALE - 1;
|
|
||||||
|
|
||||||
if (rlight->extra_colormap)
|
|
||||||
rlight->rcolormap = rlight->extra_colormap->colormap + (xwalllights[pindex] - colormaps);
|
|
||||||
else
|
|
||||||
rlight->rcolormap = xwalllights[pindex];
|
|
||||||
};
|
|
||||||
|
|
||||||
auto set_colormap_below_light = [&]
|
|
||||||
{
|
|
||||||
dc->colormap = rlight->rcolormap;
|
|
||||||
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
|
||||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Use the base sector's light level above the first FOF.
|
|
||||||
// You can imagine it as the sky casting its light on top of the highest FOF.
|
|
||||||
set_light_vars(0);
|
|
||||||
set_colormap_below_light();
|
set_colormap_below_light();
|
||||||
|
|
||||||
for (i = 0; i < dc->numlights; i++)
|
|
||||||
{
|
|
||||||
if ((dc->lightlist[i].flags & FF_NOSHADE))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
set_light_vars(i);
|
|
||||||
|
|
||||||
height = rlight->height;
|
|
||||||
rlight->height += rlight->heightstep;
|
|
||||||
|
|
||||||
if (height <= windowtop)
|
|
||||||
{
|
|
||||||
set_colormap_below_light();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
windowbottom = height;
|
|
||||||
if (windowbottom >= realbot)
|
|
||||||
{
|
|
||||||
windowbottom = realbot;
|
|
||||||
colfunc_2s(dc, col);
|
|
||||||
for (i++; i < dc->numlights; i++)
|
|
||||||
{
|
|
||||||
rlight = &dc->lightlist[i];
|
|
||||||
rlight->height += rlight->heightstep;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
colfunc_2s(dc, col);
|
|
||||||
|
|
||||||
windowtop = windowbottom + 1;
|
|
||||||
set_colormap_below_light();
|
|
||||||
}
|
|
||||||
windowbottom = realbot;
|
|
||||||
if (windowtop < windowbottom)
|
|
||||||
colfunc_2s(dc, col);
|
|
||||||
|
|
||||||
spryscale += rw_scalestep;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
windowbottom = realbot;
|
||||||
|
if (windowtop < windowbottom)
|
||||||
|
colfunc_2s(dc, col);
|
||||||
|
|
||||||
// calculate lighting
|
spryscale += rw_scalestep;
|
||||||
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
continue;
|
||||||
|
|
||||||
if (pindex >= MAXLIGHTSCALE)
|
|
||||||
pindex = MAXLIGHTSCALE - 1;
|
|
||||||
|
|
||||||
dc->colormap = walllights[pindex];
|
|
||||||
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
|
||||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
|
||||||
|
|
||||||
if (frontsector->extra_colormap)
|
|
||||||
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
|
|
||||||
|
|
||||||
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
|
|
||||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
|
||||||
|
|
||||||
// draw the texture
|
|
||||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, colnum) - 3);
|
|
||||||
|
|
||||||
colfunc_2s(dc, col);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate lighting
|
||||||
|
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
||||||
|
|
||||||
|
if (pindex >= MAXLIGHTSCALE)
|
||||||
|
pindex = MAXLIGHTSCALE - 1;
|
||||||
|
|
||||||
|
dc->colormap = walllights[pindex];
|
||||||
|
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
||||||
|
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||||
|
|
||||||
|
if (frontsector->extra_colormap)
|
||||||
|
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
|
||||||
|
|
||||||
|
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
|
||||||
|
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||||
|
|
||||||
|
// draw the texture
|
||||||
|
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc->x] >> FRACBITS)) - 3);
|
||||||
|
|
||||||
|
colfunc_2s(dc, col);
|
||||||
|
|
||||||
spryscale += rw_scalestep;
|
spryscale += rw_scalestep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,8 +627,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
sector_t tempsec;
|
sector_t tempsec;
|
||||||
INT32 templight;
|
INT32 templight;
|
||||||
INT32 i, p;
|
INT32 i, p;
|
||||||
fixed_t bottombounds = viewheight << FRACBITS;
|
|
||||||
fixed_t topbounds = (con_clipviewtop - 1) << FRACBITS;
|
|
||||||
fixed_t offsetvalue = 0;
|
fixed_t offsetvalue = 0;
|
||||||
lightlist_t *light;
|
lightlist_t *light;
|
||||||
r_lightlist_t *rlight;
|
r_lightlist_t *rlight;
|
||||||
@@ -632,6 +648,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
|
|
||||||
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
|
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
|
||||||
|
|
||||||
|
|
||||||
// Calculate light table.
|
// Calculate light table.
|
||||||
// Use different light tables
|
// Use different light tables
|
||||||
// for horizontal / vertical / diagonal. Diagonal?
|
// for horizontal / vertical / diagonal. Diagonal?
|
||||||
@@ -674,7 +691,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
fog = true;
|
fog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
range = std::max(drawseg->x2-drawseg->x1, 1);
|
range = std::max<INT32>(drawseg->x2-drawseg->x1, 1);
|
||||||
//SoM: Moved these up here so they are available for my lightlist calculations
|
//SoM: Moved these up here so they are available for my lightlist calculations
|
||||||
rw_scalestep = drawseg->scalestep;
|
rw_scalestep = drawseg->scalestep;
|
||||||
spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep;
|
spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep;
|
||||||
@@ -899,14 +916,11 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
// draw the columns
|
// draw the columns
|
||||||
for (dc->x = x1; dc->x <= x2; dc->x++)
|
for (dc->x = x1; dc->x <= x2; dc->x++)
|
||||||
{
|
{
|
||||||
if (maskedtexturecol[dc->x] == INT16_MAX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// skew FOF walls
|
// skew FOF walls
|
||||||
if (ffloortextureslide)
|
if (ffloortextureslide)
|
||||||
{
|
{
|
||||||
if (oldx != -1)
|
if (oldx != -1)
|
||||||
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x])<<FRACBITS);
|
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x]));
|
||||||
oldx = dc->x;
|
oldx = dc->x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,7 +933,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
bottom_frac += bottom_step;
|
bottom_frac += bottom_step;
|
||||||
|
|
||||||
// SoM: If column is out of range, why bother with it??
|
// SoM: If column is out of range, why bother with it??
|
||||||
if (windowbottom < topbounds || windowtop > bottombounds)
|
if (windowbottom < 0 || windowtop > (viewheight << FRACBITS))
|
||||||
{
|
{
|
||||||
if (dc->numlights)
|
if (dc->numlights)
|
||||||
{
|
{
|
||||||
@@ -936,9 +950,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get data for the column
|
|
||||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc->x]) - 3);
|
|
||||||
|
|
||||||
if (!fog)
|
if (!fog)
|
||||||
{
|
{
|
||||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||||
@@ -949,6 +960,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
R_SetColumnFunc(BASEDRAWFUNC);
|
R_SetColumnFunc(BASEDRAWFUNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get data for the column
|
||||||
|
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc->x] >> FRACBITS)) - 3);
|
||||||
|
|
||||||
// SoM: New code does not rely on R_DrawColumnShadowed which
|
// SoM: New code does not rely on R_DrawColumnShadowed which
|
||||||
// will (hopefully) put less strain on the stack.
|
// will (hopefully) put less strain on the stack.
|
||||||
if (dc->numlights)
|
if (dc->numlights)
|
||||||
@@ -1159,13 +1173,14 @@ static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bott
|
|||||||
|
|
||||||
static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t mid, fixed_t texturecolumn, INT32 texture, boolean remap)
|
static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t mid, fixed_t texturecolumn, INT32 texture, boolean remap)
|
||||||
{
|
{
|
||||||
|
const INT32 itexturecolumn = texturecolumn >> FRACBITS;
|
||||||
dc->yl = yl;
|
dc->yl = yl;
|
||||||
dc->yh = yh;
|
dc->yh = yh;
|
||||||
dc->texturemid = mid;
|
dc->texturemid = mid;
|
||||||
dc->source = R_GetColumn(texture, texturecolumn);
|
dc->source = R_GetColumn(texture, itexturecolumn);
|
||||||
dc->texheight = textureheight[texture] >> FRACBITS;
|
dc->texheight = textureheight[texture] >> FRACBITS;
|
||||||
dc->sourcelength = dc->texheight;
|
dc->sourcelength = dc->texheight;
|
||||||
//R_SetColumnFunc(colfunctype);
|
R_SetColumnFunc(colfunctype);
|
||||||
coldrawfunc_t* colfunccopy = colfunc;
|
coldrawfunc_t* colfunccopy = colfunc;
|
||||||
drawcolumndata_t dc_copy = *dc;
|
drawcolumndata_t dc_copy = *dc;
|
||||||
if (remap)
|
if (remap)
|
||||||
@@ -1191,13 +1206,21 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
INT32 bottom;
|
INT32 bottom;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
if (midtexture)
|
||||||
|
R_CheckTextureCache(midtexture);
|
||||||
|
if (toptexture)
|
||||||
|
R_CheckTextureCache(toptexture);
|
||||||
|
if (bottomtexture)
|
||||||
|
R_CheckTextureCache(bottomtexture);
|
||||||
|
|
||||||
// Loop over width
|
// Loop over width
|
||||||
for (; rw_x < rw_stopx; rw_x++)
|
for (; rw_x < rw_stopx; rw_x++)
|
||||||
{
|
{
|
||||||
// mark floor / ceiling areas
|
// mark floor / ceiling areas
|
||||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||||
|
yh = bottomfrac>>HEIGHTBITS;
|
||||||
|
|
||||||
// no space above wall?
|
// Mark ceiling
|
||||||
top = ceilingclip[rw_x]+1;
|
top = ceilingclip[rw_x]+1;
|
||||||
|
|
||||||
// no space above wall?
|
// no space above wall?
|
||||||
@@ -1214,10 +1237,10 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yh = bottomfrac>>HEIGHTBITS;
|
// Mark floor
|
||||||
|
|
||||||
bottom = floorclip[rw_x]-1;
|
bottom = floorclip[rw_x]-1;
|
||||||
|
|
||||||
|
// no space below floor?
|
||||||
if (yh > bottom)
|
if (yh > bottom)
|
||||||
yh = bottom;
|
yh = bottom;
|
||||||
|
|
||||||
@@ -1346,7 +1369,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
// calculate texture offset
|
// calculate texture offset
|
||||||
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
|
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
|
||||||
// Mask 4095 to guarantee this index is within bounds
|
// Mask 4095 to guarantee this index is within bounds
|
||||||
texturecolumn = rw_offset-FixedMul(FINETANGENT(angle & 4095),rw_distance);
|
texturecolumn = rw_offset-FixedMul(FINETANGENT(angle & 4095), rw_distance);
|
||||||
|
|
||||||
if (oldtexturecolumn != -1)
|
if (oldtexturecolumn != -1)
|
||||||
{
|
{
|
||||||
@@ -1357,8 +1380,6 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
}
|
}
|
||||||
oldtexturecolumn = texturecolumn;
|
oldtexturecolumn = texturecolumn;
|
||||||
|
|
||||||
texturecolumn >>= FRACBITS;
|
|
||||||
|
|
||||||
// texturecolumn and lighting are independent of wall tiers
|
// texturecolumn and lighting are independent of wall tiers
|
||||||
if (segtextured)
|
if (segtextured)
|
||||||
{
|
{
|
||||||
@@ -1515,7 +1536,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
if (maskedtexture || numthicksides)
|
if (maskedtexture || numthicksides)
|
||||||
{
|
{
|
||||||
// save texturecol for backdrawing of masked mid texture
|
// save texturecol for backdrawing of masked mid texture
|
||||||
maskedtexturecol[rw_x] = (INT16)texturecolumn;
|
maskedtexturecol[rw_x] = texturecolumn;
|
||||||
|
|
||||||
if (maskedtextureheight != NULL)
|
if (maskedtextureheight != NULL)
|
||||||
{
|
{
|
||||||
@@ -1561,7 +1582,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
|
|
||||||
static void R_MarkSegBounds(void)
|
static void R_MarkSegBounds(void)
|
||||||
{
|
{
|
||||||
INT32 yl, yh;
|
INT32 yl, yh;
|
||||||
INT32 top, bottom;
|
INT32 top, bottom;
|
||||||
INT16 topclip, bottomclip;
|
INT16 topclip, bottomclip;
|
||||||
|
|
||||||
@@ -1570,8 +1591,9 @@ static void R_MarkSegBounds(void)
|
|||||||
{
|
{
|
||||||
// mark floor / ceiling areas
|
// mark floor / ceiling areas
|
||||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||||
|
yh = bottomfrac>>HEIGHTBITS;
|
||||||
|
|
||||||
// no space above wall?
|
// Mark ceiling
|
||||||
top = ceilingclip[rw_x]+1;
|
top = ceilingclip[rw_x]+1;
|
||||||
|
|
||||||
// no space above wall?
|
// no space above wall?
|
||||||
@@ -1588,10 +1610,10 @@ static void R_MarkSegBounds(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yh = bottomfrac>>HEIGHTBITS;
|
// Mark floor
|
||||||
|
|
||||||
bottom = floorclip[rw_x]-1;
|
bottom = floorclip[rw_x]-1;
|
||||||
|
|
||||||
|
// no space below floor?
|
||||||
if (yh > bottom)
|
if (yh > bottom)
|
||||||
yh = bottom;
|
yh = bottom;
|
||||||
|
|
||||||
@@ -1616,12 +1638,6 @@ static void R_MarkSegBounds(void)
|
|||||||
if (markfloor) // no bottom wall
|
if (markfloor) // no bottom wall
|
||||||
floorclip[rw_x] = bottomclip;
|
floorclip[rw_x] = bottomclip;
|
||||||
|
|
||||||
if (floorclip[rw_x] <= ceilingclip[rw_x] + 1)
|
|
||||||
{
|
|
||||||
solidcol[rw_x] = 1;
|
|
||||||
didsolidcol = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rw_scale += rw_scalestep;
|
rw_scale += rw_scalestep;
|
||||||
topfrac += topstep;
|
topfrac += topstep;
|
||||||
bottomfrac += bottomstep;
|
bottomfrac += bottomstep;
|
||||||
@@ -1663,15 +1679,87 @@ void R_AllocSegMemory(void)
|
|||||||
fixed_t *frontscale_p = frontscaletable;
|
fixed_t *frontscale_p = frontscaletable;
|
||||||
fixed_t *maskedheight_p = maskedheighttable;
|
fixed_t *maskedheight_p = maskedheighttable;
|
||||||
|
|
||||||
for (drawseg_t *ds = drawsegs; ds < lastseg; ds++)
|
for (drawseg_t *drawseg = drawsegs; drawseg < lastseg; drawseg++)
|
||||||
{
|
{
|
||||||
ds->frontscale = frontscale_p;
|
drawseg->frontscale = frontscale_p;
|
||||||
ds->maskedtextureheight = maskedheight_p;
|
drawseg->maskedtextureheight = maskedheight_p;
|
||||||
frontscale_p += viewwidth;
|
frontscale_p += viewwidth;
|
||||||
maskedheight_p += viewwidth;
|
maskedheight_p += viewwidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//SoM: Code to remove limits on openings.
|
||||||
|
static void R_AllocClippingTables(size_t range)
|
||||||
|
{
|
||||||
|
size_t pos = lastopening - openings;
|
||||||
|
size_t need = range * 2; // for both sprtopclip and sprbottomclip
|
||||||
|
|
||||||
|
if (pos + need < numopenings)
|
||||||
|
return;
|
||||||
|
|
||||||
|
INT16 *oldopenings = openings;
|
||||||
|
INT16 *oldlast = lastopening;
|
||||||
|
|
||||||
|
if (numopenings == 0)
|
||||||
|
numopenings = 16384;
|
||||||
|
|
||||||
|
numopenings += need;
|
||||||
|
openings = static_cast<INT16*>(Z_Realloc(openings, numopenings * sizeof (*openings), PU_STATIC, NULL));
|
||||||
|
lastopening = openings + pos;
|
||||||
|
|
||||||
|
if (oldopenings == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// borrowed fix from *cough* zdoom *cough*
|
||||||
|
// [RH] We also need to adjust the openings pointers that
|
||||||
|
// were already stored in drawsegs.
|
||||||
|
for (drawseg_t *drawseg = drawsegs; drawseg < ds_p; drawseg++)
|
||||||
|
{
|
||||||
|
// Check if it's in range of the openings
|
||||||
|
#define CHECK(which) \
|
||||||
|
if (which + drawseg->x1 >= oldopenings && which + drawseg->x1 <= oldlast) \
|
||||||
|
which = (which - oldopenings) + openings
|
||||||
|
CHECK(drawseg->sprtopclip);
|
||||||
|
CHECK(drawseg->sprbottomclip);
|
||||||
|
#undef CHECK
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_AllocTextureColumnTables(size_t range)
|
||||||
|
{
|
||||||
|
size_t pos = curtexturecolumntable - texturecolumntable;
|
||||||
|
|
||||||
|
// For both tables, we reserve exactly an amount of memory that's equivalent to
|
||||||
|
// how many columns the seg will take on the entire screen (think about it)
|
||||||
|
if (pos + range < texturecolumntablesize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fixed_t *oldtable = texturecolumntable;
|
||||||
|
fixed_t *oldlast = curtexturecolumntable;
|
||||||
|
|
||||||
|
if (texturecolumntablesize == 0)
|
||||||
|
texturecolumntablesize = 16384;
|
||||||
|
|
||||||
|
texturecolumntablesize += range;
|
||||||
|
texturecolumntable = static_cast<fixed_t*>(Z_Realloc(texturecolumntable, texturecolumntablesize * sizeof (*texturecolumntable), PU_STATIC, NULL));
|
||||||
|
curtexturecolumntable = texturecolumntable + pos;
|
||||||
|
|
||||||
|
if (oldtable == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (drawseg_t *drawseg = drawsegs; drawseg < ds_p; drawseg++)
|
||||||
|
{
|
||||||
|
// Check if it's in range of the tables
|
||||||
|
#define CHECK(which) \
|
||||||
|
if (which + drawseg->x1 >= oldtable && which + drawseg->x1 <= oldlast) \
|
||||||
|
which = (which - oldtable) + texturecolumntable
|
||||||
|
CHECK(drawseg->maskedtexturecol);
|
||||||
|
CHECK(drawseg->thicksidecol);
|
||||||
|
#undef CHECK
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_StoreWallRange
|
// R_StoreWallRange
|
||||||
// A wall segment will be drawn
|
// A wall segment will be drawn
|
||||||
@@ -1684,12 +1772,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
angle_t distangle, offsetangle;
|
angle_t distangle, offsetangle;
|
||||||
boolean longboi;
|
boolean longboi;
|
||||||
INT32 lightnum;
|
INT32 lightnum;
|
||||||
INT32 i, p;
|
INT32 i = 0, p;
|
||||||
lightlist_t *light;
|
lightlist_t *light;
|
||||||
r_lightlist_t *rlight;
|
r_lightlist_t *rlight;
|
||||||
INT32 range;
|
INT32 range;
|
||||||
vertex_t segleft, segright;
|
vertex_t segleft, segright;
|
||||||
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
|
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
|
||||||
|
const INT32 twosidedmidtexture = R_GetTextureNum(curline->sidedef->midtexture);
|
||||||
drawcolumndata_t dc = {};
|
drawcolumndata_t dc = {};
|
||||||
|
|
||||||
maskedtextureheight = NULL;
|
maskedtextureheight = NULL;
|
||||||
@@ -1745,41 +1834,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
ds_p->curline = curline;
|
ds_p->curline = curline;
|
||||||
rw_stopx = stop+1;
|
rw_stopx = stop+1;
|
||||||
|
|
||||||
//SoM: Code to remove limits on openings.
|
|
||||||
{
|
|
||||||
size_t pos = lastopening - openings;
|
|
||||||
size_t need = (rw_stopx - start)*4 + pos;
|
|
||||||
|
|
||||||
if (need > maxopenings)
|
|
||||||
{
|
|
||||||
drawseg_t *ds; //needed for fix from *cough* zdoom *cough*
|
|
||||||
INT16 *oldopenings = openings;
|
|
||||||
INT16 *oldlast = lastopening;
|
|
||||||
|
|
||||||
do
|
|
||||||
maxopenings = maxopenings ? maxopenings*2 : 16384;
|
|
||||||
while (need > maxopenings);
|
|
||||||
openings = static_cast<INT16*>(Z_Realloc(openings, maxopenings * sizeof (*openings), PU_STATIC, NULL));
|
|
||||||
lastopening = openings + pos;
|
|
||||||
|
|
||||||
if (oldopenings == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// borrowed fix from *cough* zdoom *cough*
|
|
||||||
// [RH] We also need to adjust the openings pointers that
|
|
||||||
// were already stored in drawsegs.
|
|
||||||
for (ds = drawsegs; ds < ds_p; ds++)
|
|
||||||
{
|
|
||||||
#define ADJUST(p) if (ds->p + ds->x1 >= oldopenings && ds->p + ds->x1 <= oldlast) ds->p = (ds->p - oldopenings) + openings;
|
|
||||||
ADJUST(maskedtexturecol);
|
|
||||||
ADJUST(sprtopclip);
|
|
||||||
ADJUST(sprbottomclip);
|
|
||||||
ADJUST(thicksidecol);
|
|
||||||
#undef ADJUST
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // end of code to remove limits on openings
|
|
||||||
|
|
||||||
// calculate scale at both ends and step
|
// calculate scale at both ends and step
|
||||||
ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]);
|
ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]);
|
||||||
|
|
||||||
@@ -1874,8 +1928,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
|
|
||||||
numbackffloors = 0;
|
numbackffloors = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAXFFLOORS; i++)
|
memset(ds_p->thicksides, 0, MAXFFLOORS * sizeof(*ds_p->thicksides));
|
||||||
ds_p->thicksides[i] = NULL;
|
|
||||||
|
|
||||||
if (numffloors)
|
if (numffloors)
|
||||||
{
|
{
|
||||||
@@ -2160,6 +2213,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
rw_toptexturemid += sidedef->rowoffset;
|
rw_toptexturemid += sidedef->rowoffset;
|
||||||
rw_bottomtexturemid += sidedef->rowoffset;
|
rw_bottomtexturemid += sidedef->rowoffset;
|
||||||
|
|
||||||
|
R_AllocTextureColumnTables(rw_stopx - start);
|
||||||
|
|
||||||
// allocate space for masked texture tables
|
// allocate space for masked texture tables
|
||||||
if (frontsector && backsector && (frontsector->tag != backsector->tag) && (backsector->ffloors || frontsector->ffloors))
|
if (frontsector && backsector && (frontsector->tag != backsector->tag) && (backsector->ffloors || frontsector->ffloors))
|
||||||
{
|
{
|
||||||
@@ -2173,15 +2228,15 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
|
|
||||||
maskedtexture = true;
|
maskedtexture = true;
|
||||||
|
|
||||||
ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x;
|
ds_p->thicksidecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||||
lastopening += rw_stopx - rw_x;
|
curtexturecolumntable += rw_stopx - rw_x;
|
||||||
|
|
||||||
lowcut = std::max(worldbottom, worldlow) + viewz;
|
lowcut = std::max(worldbottom, worldlow) + viewz;
|
||||||
highcut = std::min(worldtop, worldhigh) + viewz;
|
highcut = std::min(worldtop, worldhigh) + viewz;
|
||||||
lowcutslope = std::max(worldbottomslope, worldlowslope) + viewz;
|
lowcutslope = std::max(worldbottomslope, worldlowslope) + viewz;
|
||||||
highcutslope = std::min(worldtopslope, worldhighslope) + viewz;
|
highcutslope = std::min(worldtopslope, worldhighslope) + viewz;
|
||||||
|
|
||||||
auto check_fof_offscreen = [&](INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope)
|
auto check_fof_offscreen = [&](ffloor_t* rover, INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope)
|
||||||
{
|
{
|
||||||
return ((P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= bottom + viewz
|
return ((P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= bottom + viewz
|
||||||
&& P_GetFFloorTopZAt (rover, segright.x, segright.y) <= bottomslope + viewz)
|
&& P_GetFFloorTopZAt (rover, segright.x, segright.y) <= bottomslope + viewz)
|
||||||
@@ -2321,7 +2376,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Oy vey.
|
// Oy vey.
|
||||||
if (check_fof_offscreen(worldbottom, worldbottomslope, worldtop, worldtopslope))
|
if (check_fof_offscreen(rover, worldbottom, worldbottomslope, worldtop, worldtopslope))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ds_p->thicksides[i] = rover;
|
ds_p->thicksides[i] = rover;
|
||||||
@@ -2339,10 +2394,10 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Oy vey.
|
// Oy vey.
|
||||||
if (check_fof_offscreen(worldbottom, worldbottomslope, worldtop, worldtopslope))
|
if (check_fof_offscreen(rover, worldbottom, worldbottomslope, worldtop, worldtopslope))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (check_fof_offscreen(worldlow, worldlowslope, worldhigh, worldhighslope))
|
if (check_fof_offscreen(rover, worldlow, worldlowslope, worldhigh, worldhighslope))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ds_p->thicksides[i] = rover;
|
ds_p->thicksides[i] = rover;
|
||||||
@@ -2353,13 +2408,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
ds_p->numthicksides = numthicksides = i;
|
ds_p->numthicksides = numthicksides = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sidedef->midtexture > 0 && sidedef->midtexture < numtextures)
|
if (twosidedmidtexture)
|
||||||
{
|
{
|
||||||
// masked midtexture
|
// masked midtexture
|
||||||
|
|
||||||
if (!ds_p->thicksidecol)
|
if (!ds_p->thicksidecol)
|
||||||
{
|
{
|
||||||
ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw_x;
|
ds_p->maskedtexturecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||||
lastopening += rw_stopx - rw_x;
|
curtexturecolumntable += rw_stopx - rw_x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ds_p->maskedtexturecol = ds_p->thicksidecol;
|
ds_p->maskedtexturecol = ds_p->thicksidecol;
|
||||||
@@ -2939,18 +2995,23 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save sprite clipping info
|
// save sprite clipping info
|
||||||
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
if (maskedtexture || (ds_p->silhouette & (SIL_TOP | SIL_BOTTOM)))
|
||||||
{
|
{
|
||||||
M_Memcpy(lastopening, ceilingclip+start, 2*(rw_stopx - start));
|
R_AllocClippingTables(rw_stopx - start);
|
||||||
ds_p->sprtopclip = lastopening - start;
|
|
||||||
lastopening += rw_stopx - start;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && !ds_p->sprbottomclip)
|
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
||||||
{
|
{
|
||||||
M_Memcpy(lastopening, floorclip + start, 2*(rw_stopx-start));
|
M_Memcpy(lastopening, ceilingclip + start, 2*(rw_stopx - start));
|
||||||
ds_p->sprbottomclip = lastopening - start;
|
ds_p->sprtopclip = lastopening - start;
|
||||||
lastopening += rw_stopx - start;
|
lastopening += rw_stopx - start;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && !ds_p->sprbottomclip)
|
||||||
|
{
|
||||||
|
M_Memcpy(lastopening, floorclip + start, 2*(rw_stopx - start));
|
||||||
|
ds_p->sprbottomclip = lastopening - start;
|
||||||
|
lastopening += rw_stopx - start;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maskedtexture)
|
if (maskedtexture)
|
||||||
@@ -2958,13 +3019,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
if (!(ds_p->silhouette & SIL_TOP))
|
if (!(ds_p->silhouette & SIL_TOP))
|
||||||
{
|
{
|
||||||
ds_p->silhouette |= SIL_TOP;
|
ds_p->silhouette |= SIL_TOP;
|
||||||
ds_p->tsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MIN: INT32_MAX;
|
ds_p->tsilheight = (twosidedmidtexture) ? INT32_MIN : INT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ds_p->silhouette & SIL_BOTTOM))
|
if (!(ds_p->silhouette & SIL_BOTTOM))
|
||||||
{
|
{
|
||||||
ds_p->silhouette |= SIL_BOTTOM;
|
ds_p->silhouette |= SIL_BOTTOM;
|
||||||
ds_p->bsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MAX: INT32_MIN;
|
ds_p->bsilheight = (twosidedmidtexture) ? INT32_MAX : INT32_MIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ extern "C" {
|
|||||||
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
|
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
|
||||||
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
|
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
|
||||||
void R_StoreWallRange(INT32 start, INT32 stop);
|
void R_StoreWallRange(INT32 start, INT32 stop);
|
||||||
|
void R_ClearSegTables(void);
|
||||||
|
|
||||||
void R_AllocSegMemory(void);
|
void R_AllocSegMemory(void);
|
||||||
|
|
||||||
|
|||||||
+151
-123
@@ -33,12 +33,15 @@
|
|||||||
|
|
||||||
#include "qs22j.h"
|
#include "qs22j.h"
|
||||||
|
|
||||||
CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2];
|
CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2]; // huehuehuehuehue
|
||||||
|
|
||||||
|
#include "discord.h"
|
||||||
|
|
||||||
INT32 numskins = 0;
|
INT32 numskins = 0;
|
||||||
INT32 numallskins = 0;
|
INT32 numallskins = 0;
|
||||||
INT32 numlocalskins = 0;
|
INT32 numlocalskins = 0;
|
||||||
skin_t skins[MAXSKINS];
|
skin_t skins[MAXSKINS];
|
||||||
|
|
||||||
UINT8 skinstats[9][9][MAXSKINS];
|
UINT8 skinstats[9][9][MAXSKINS];
|
||||||
UINT8 skinstatscount[9][9] = {
|
UINT8 skinstatscount[9][9] = {
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
@@ -51,6 +54,7 @@ UINT8 skinstatscount[9][9] = {
|
|||||||
{0, 1, 0, 0, 0, 0, 0, 0, 0},
|
{0, 1, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
UINT8 skinsorted[MAXSKINS];
|
UINT8 skinsorted[MAXSKINS];
|
||||||
skin_t localskins[MAXLOCALSKINS];
|
skin_t localskins[MAXLOCALSKINS];
|
||||||
skin_t allskins[MAXSKINS+MAXLOCALSKINS];
|
skin_t allskins[MAXSKINS+MAXLOCALSKINS];
|
||||||
@@ -68,13 +72,14 @@ static void Sk_SetDefaultValue(skin_t *skin, boolean local)
|
|||||||
//
|
//
|
||||||
// set default skin values
|
// set default skin values
|
||||||
//
|
//
|
||||||
memset(skin, 0, sizeof (skin_t));
|
memset(skin, 0, sizeof(skin_t));
|
||||||
|
|
||||||
snprintf(skin->name, sizeof skin->name, "skin %u", K_GetMobjSkinNum(skin, local));
|
snprintf(skin->name, sizeof skin->name, "skin %u", K_GetMobjSkinNum(skin, local));
|
||||||
skin->name[sizeof skin->name - 1] = '\0';
|
skin->name[sizeof skin->name - 1] = '\0';
|
||||||
skin->wadnum = INT16_MAX;
|
|
||||||
strcpy(skin->sprite, "");
|
|
||||||
|
|
||||||
skin->flags = 0;
|
skin->wadnum = INT16_MAX;
|
||||||
|
|
||||||
|
strcpy(skin->sprite, "");
|
||||||
|
|
||||||
strcpy(skin->realname, "Someone");
|
strcpy(skin->realname, "Someone");
|
||||||
strcpy(skin->hudname, "???");
|
strcpy(skin->hudname, "???");
|
||||||
@@ -93,8 +98,12 @@ static void Sk_SetDefaultValue(skin_t *skin, boolean local)
|
|||||||
skin->highresscale = FRACUNIT>>1;
|
skin->highresscale = FRACUNIT>>1;
|
||||||
|
|
||||||
for (i = 0; i < sfx_skinsoundslot0; i++)
|
for (i = 0; i < sfx_skinsoundslot0; i++)
|
||||||
if (S_sfx[i].skinsound != -1)
|
{
|
||||||
skin->soundsid[S_sfx[i].skinsound] = i;
|
const INT32 skinsound = S_sfx[i].skinsound;
|
||||||
|
|
||||||
|
if (skinsound != -1)
|
||||||
|
skin->soundsid[skinsound] = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -122,6 +131,7 @@ void R_InitSkins(void)
|
|||||||
skin = &skins[0];
|
skin = &skins[0];
|
||||||
numskins = 1;
|
numskins = 1;
|
||||||
Sk_SetDefaultValue(skin, false);
|
Sk_SetDefaultValue(skin, false);
|
||||||
|
|
||||||
memset(skinstats, 0, sizeof(skinstats));
|
memset(skinstats, 0, sizeof(skinstats));
|
||||||
memset(skinsorted, 0, sizeof(skinsorted));
|
memset(skinsorted, 0, sizeof(skinsorted));
|
||||||
|
|
||||||
@@ -130,13 +140,16 @@ void R_InitSkins(void)
|
|||||||
#ifdef SKINVALUES
|
#ifdef SKINVALUES
|
||||||
skin_cons_t[0].strvalue = skins[0].name;
|
skin_cons_t[0].strvalue = skins[0].name;
|
||||||
#endif
|
#endif
|
||||||
skin->flags = 0;
|
|
||||||
strcpy(skin->realname, "Sonic");
|
strcpy(skin->realname, "Sonic");
|
||||||
strcpy(skin->hudname, "SONIC");
|
strcpy(skin->hudname, "SONIC");
|
||||||
|
|
||||||
strncpy(skin->facerank, "PLAYRANK", 9);
|
strncpy(skin->facerank, "PLAYRANK", 9);
|
||||||
strncpy(skin->facewant, "PLAYWANT", 9);
|
strncpy(skin->facewant, "PLAYWANT", 9);
|
||||||
strncpy(skin->facemmap, "PLAYMMAP", 9);
|
strncpy(skin->facemmap, "PLAYMMAP", 9);
|
||||||
|
|
||||||
|
skin->flags = 0;
|
||||||
|
|
||||||
skin->wadnum = 0; // god what have you brought to this world
|
skin->wadnum = 0; // god what have you brought to this world
|
||||||
skin->prefcolor = SKINCOLOR_BLUE;
|
skin->prefcolor = SKINCOLOR_BLUE;
|
||||||
skin->localskin = false;
|
skin->localskin = false;
|
||||||
@@ -175,9 +188,10 @@ INT32 R_SkinAvailable(const char *name)
|
|||||||
|
|
||||||
for (i = 0; i < numskins; i++)
|
for (i = 0; i < numskins; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(skins[i].name,name) == 0)
|
if (fasticmp(skins[i].name, name))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,9 +203,10 @@ INT32 R_AnySkinAvailable(const char *name)
|
|||||||
|
|
||||||
for (i = 0; i < numallskins; i++)
|
for (i = 0; i < numallskins; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(allskins[i].name,name) == 0)
|
if (fasticmp(allskins[i].name, name))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,32 +218,32 @@ INT32 R_LocalSkinAvailable(const char *name, boolean local)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < numlocalskins; i++)
|
for (i = 0; i < numlocalskins; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(localskins[i].name,name) == 0)
|
if (fasticmp(localskins[i].name, name))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return R_SkinAvailable(name);
|
return R_SkinAvailable(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// network code calls this when a 'skin change' is received
|
// network code calls this when a 'skin change' is received
|
||||||
boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
player_t *player = &players[playernum];
|
|
||||||
|
|
||||||
for (i = 0; i < numskins; i++)
|
for (i = 0; i < numskins; i++)
|
||||||
{
|
{
|
||||||
// search in the skin list
|
// search in the skin list
|
||||||
if (stricmp(skins[i].name, skinname) == 0)
|
if (fasticmp(skins[i].name, skinname))
|
||||||
{
|
{
|
||||||
SetPlayerSkinByNum(playernum, i);
|
SetPlayerSkinByNum(playernum, i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (P_IsLocalPlayer(player))
|
if (P_IsLocalPlayer(&players[playernum]))
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Skin '%s' not found.\n"), skinname);
|
CONS_Alert(CONS_WARNING, M_GetText("Skin '%s' not found.\n"), skinname);
|
||||||
else if (server || IsPlayerAdmin(consoleplayer))
|
else if (server || IsPlayerAdmin(consoleplayer))
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname);
|
CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname);
|
||||||
@@ -242,15 +257,16 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
|
|||||||
INT32 i;
|
INT32 i;
|
||||||
player_t *player = &players[playernum];
|
player_t *player = &players[playernum];
|
||||||
|
|
||||||
if (stricmp(skinname, "none"))
|
if (!fasticmp(skinname, "none"))
|
||||||
{
|
{
|
||||||
for (i = 0; i < numlocalskins; i++)
|
for (i = 0; i < numlocalskins; i++)
|
||||||
{
|
{
|
||||||
// search in the localskin list
|
// search in the localskin list
|
||||||
if (stricmp(localskins[i].name, skinname) == 0)
|
if (fasticmp(localskins[i].name, skinname))
|
||||||
{
|
{
|
||||||
player->localskin = 1 + i;
|
player->localskin = 1 + i;
|
||||||
player->skinlocal = true;
|
player->skinlocal = true;
|
||||||
|
|
||||||
if (player->mo)
|
if (player->mo)
|
||||||
{
|
{
|
||||||
player->mo->localskin = &localskins[i];
|
player->mo->localskin = &localskins[i];
|
||||||
@@ -264,10 +280,11 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
|
|||||||
for (i = 0; i < numskins; i++)
|
for (i = 0; i < numskins; i++)
|
||||||
{
|
{
|
||||||
// search in the skin list
|
// search in the skin list
|
||||||
if (stricmp(skins[i].name, skinname) == 0)
|
if (fasticmp(skins[i].name, skinname))
|
||||||
{
|
{
|
||||||
player->localskin = 1 + i;
|
player->localskin = 1 + i;
|
||||||
player->skinlocal = false;
|
player->skinlocal = false;
|
||||||
|
|
||||||
if (player->mo)
|
if (player->mo)
|
||||||
{
|
{
|
||||||
player->mo->localskin = &skins[i];
|
player->mo->localskin = &skins[i];
|
||||||
@@ -282,6 +299,7 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
|
|||||||
{
|
{
|
||||||
player->localskin = 0;
|
player->localskin = 0;
|
||||||
player->skinlocal = false;
|
player->skinlocal = false;
|
||||||
|
|
||||||
if (player->mo)
|
if (player->mo)
|
||||||
{
|
{
|
||||||
player->mo->localskin = 0;
|
player->mo->localskin = 0;
|
||||||
@@ -316,6 +334,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
|||||||
if (skinnum >= 0 && skinnum < numskins) // Make sure it exists!
|
if (skinnum >= 0 && skinnum < numskins) // Make sure it exists!
|
||||||
{
|
{
|
||||||
player->skin = skinnum;
|
player->skin = skinnum;
|
||||||
|
|
||||||
if (player->mo)
|
if (player->mo)
|
||||||
player->mo->skin = skin;
|
player->mo->skin = skin;
|
||||||
|
|
||||||
@@ -328,8 +347,14 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
|||||||
if (player->mo)
|
if (player->mo)
|
||||||
P_SetScale(player->mo, player->mo->scale);
|
P_SetScale(player->mo, player->mo->scale);
|
||||||
|
|
||||||
|
// for replays: We have changed our skin mid-game; let the game know so it can do the same in the replay!
|
||||||
demo_extradata[playernum] |= DXD_SKIN;
|
demo_extradata[playernum] |= DXD_SKIN;
|
||||||
|
|
||||||
|
#ifdef HAVE_DISCORDRPC
|
||||||
|
if (player - players == consoleplayer)
|
||||||
|
DRPC_UpdatePresence();
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,117 +377,97 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
|||||||
static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
|
static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
const char *S_SKIN = "S_SKIN";
|
|
||||||
lumpinfo_t *lump_p;
|
lumpinfo_t *lump_p;
|
||||||
|
|
||||||
// scan forward, start at <startlump>
|
// scan forward, start at <startlump>
|
||||||
if (startlump < wadfiles[wadid]->numlumps)
|
if (startlump < wadfiles[wadid]->numlumps)
|
||||||
{
|
{
|
||||||
lump_p = wadfiles[wadid]->lumpinfo + startlump;
|
lump_p = wadfiles[wadid]->lumpinfo + startlump;
|
||||||
|
|
||||||
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
|
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
|
||||||
if (memcmp(lump_p->name,S_SKIN,6)==0)
|
{
|
||||||
|
if (memcmp(lump_p->name, "S_SKIN", 6) == 0)
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return INT16_MAX; // not found
|
return INT16_MAX; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
//sort function for sorting skin names
|
//sort function for sorting skin names
|
||||||
static int skinSortFunc(const void *a, const void *b) //tbh i have no clue what the naming conventions for local functions are
|
static int skinSortFunc(const void *a, const void *b) // tbh i have no clue what the naming conventions for local functions are
|
||||||
{
|
{
|
||||||
const skin_t *in1 = &skins[*(const UINT8 *)a];
|
int diff = 0;
|
||||||
const skin_t *in2 = &skins[*(const UINT8 *)b];
|
const UINT8 val_a = *(const UINT8 *)a;
|
||||||
INT32 temp = 0;
|
const UINT8 val_b = *(const UINT8 *)b;
|
||||||
const UINT8 val_a = *((const UINT8 *)a);
|
const skin_t *in1 = &skins[val_a];
|
||||||
const UINT8 val_b = *((const UINT8 *)b);
|
const skin_t *in2 = &skins[val_b];
|
||||||
|
|
||||||
//return (strcmp(in1->realname, in2->realname) < 0) || (strcmp(in1->realname, in2->realname) ==);
|
// return (strcmp(in1->realname, in2->realname) < 0) || (strcmp(in1->realname, in2->realname) ==);
|
||||||
|
|
||||||
switch (cv_skinselectgridsort.value)
|
switch (cv_skinselectgridsort.value)
|
||||||
{
|
{
|
||||||
case SKINMENUSORT_REALNAME:
|
case SKINMENUSORT_REALNAME:
|
||||||
//CONS_Printf("Sorting by realname\n");
|
// CONS_Printf("Sorting by realname\n");
|
||||||
// check name
|
// check name
|
||||||
if ((temp = strcmp(in1->realname, in2->realname)))
|
diff = strcmp(in1->realname, in2->realname);
|
||||||
return temp;
|
if (diff != 0) return diff;
|
||||||
// sort by internal name
|
|
||||||
return strcmp(in1->name, in2->name);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SKINMENUSORT_NAME:
|
|
||||||
//CONS_Printf("Sorting by name\n");
|
|
||||||
return strcmp(in1->name, in2->name);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKINMENUSORT_SPEED:
|
case SKINMENUSORT_SPEED:
|
||||||
//CONS_Printf("Sorting by speed\n");
|
// CONS_Printf("Sorting by speed\n");
|
||||||
// check speed
|
// check speed
|
||||||
if (in1->kartspeed < in2->kartspeed)
|
diff = in1->kartspeed - in2->kartspeed;
|
||||||
return -1;
|
if (diff != 0) return diff;
|
||||||
else if (in2->kartspeed < in1->kartspeed)
|
|
||||||
return 1;
|
|
||||||
// then check weight
|
// then check weight
|
||||||
if (in1->kartweight < in2->kartweight)
|
diff = in1->kartweight - in2->kartweight;
|
||||||
return -1;
|
if (diff != 0) return diff;
|
||||||
else if (in2->kartweight < in1->kartweight)
|
|
||||||
return 1;
|
|
||||||
// then check name
|
|
||||||
if ((temp = strcmp(in1->realname, in2->realname)))
|
|
||||||
return temp;
|
|
||||||
// sort by internal name
|
|
||||||
return strcmp(in1->name, in2->name);
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
// then check name
|
||||||
|
diff = strcmp(in1->realname, in2->realname);
|
||||||
|
if (diff != 0) return diff;
|
||||||
|
|
||||||
|
break;
|
||||||
case SKINMENUSORT_WEIGHT:
|
case SKINMENUSORT_WEIGHT:
|
||||||
//CONS_Printf("Sorting by weight\n");
|
// CONS_Printf("Sorting by weight\n");
|
||||||
// check weight
|
// check weight
|
||||||
if (in1->kartweight < in2->kartweight)
|
diff = in1->kartweight - in2->kartweight;
|
||||||
return -1;
|
if (diff != 0) return diff;
|
||||||
else if (in2->kartweight < in1->kartweight)
|
|
||||||
return 1;
|
|
||||||
// then check speed
|
// then check speed
|
||||||
if (in1->kartspeed < in2->kartspeed)
|
diff = in1->kartspeed - in2->kartspeed;
|
||||||
return -1;
|
if (diff != 0) return diff;
|
||||||
else if (in2->kartspeed < in1->kartspeed)
|
|
||||||
return 1;
|
|
||||||
// then check name
|
|
||||||
if ((temp = strcmp(in1->realname, in2->realname)))
|
|
||||||
return temp;
|
|
||||||
// sort by internal name
|
|
||||||
return strcmp(in1->name, in2->name);
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
// then check name
|
||||||
|
diff = strcmp(in1->realname, in2->realname);
|
||||||
|
if (diff != 0) return diff;
|
||||||
|
|
||||||
|
break;
|
||||||
case SKINMENUSORT_PREFCOLOR:
|
case SKINMENUSORT_PREFCOLOR:
|
||||||
//CONS_Printf("Sorting by prefcolor\n");
|
// CONS_Printf("Sorting by prefcolor\n");
|
||||||
// check prefcolor
|
// check prefcolor
|
||||||
if (in1->prefcolor < in2->prefcolor)
|
diff = in1->prefcolor - in2->prefcolor;
|
||||||
return -1;
|
if (diff != 0) return diff;
|
||||||
else if (in2->prefcolor < in1->prefcolor)
|
|
||||||
return 1;
|
|
||||||
// then check name
|
// then check name
|
||||||
if ((temp = strcmp(in1->realname, in2->realname)))
|
diff = strcmp(in1->realname, in2->realname);
|
||||||
return temp;
|
if (diff != 0) return diff;
|
||||||
// sort by internal name
|
|
||||||
return strcmp(in1->name, in2->name);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKINMENUSORT_ID:
|
case SKINMENUSORT_ID:
|
||||||
//CONS_Printf("Sorting by id\n");
|
// CONS_Printf("Sorting by id\n");
|
||||||
//how do i do by ID?????
|
// how do i do by ID?????
|
||||||
//wait why dont i just convert the inputs to UINT32s
|
// wait why dont i just convert the inputs to UINT32s
|
||||||
//please tell me im allowed to define variables in here since its a block
|
// please tell me im allowed to define variables in here since its a block
|
||||||
|
return (int)val_a - (int)val_b;
|
||||||
if (val_a == val_b)
|
case SKINMENUSORT_NAME:
|
||||||
return 0;
|
|
||||||
else if (val_a < val_b)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return strcmp(in1->name, in2->name);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//im scared this somehow will sometimes end up here so im gonna add this here just to be safe
|
|
||||||
|
// im scared this somehow will sometimes end up here so im gonna add this here just to be safe
|
||||||
|
// now it will often end up here >:3
|
||||||
return strcmp(in1->name, in2->name);
|
return strcmp(in1->name, in2->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,8 +528,9 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
Sk_SetDefaultValue(skin, local);
|
Sk_SetDefaultValue(skin, local);
|
||||||
skin->wadnum = wadnum;
|
skin->wadnum = wadnum;
|
||||||
hudname = realname = false;
|
hudname = realname = false;
|
||||||
|
|
||||||
// parse
|
// parse
|
||||||
stoken = strtok (buf2, "\r\n= ");
|
stoken = strtok(buf2, "\r\n= ");
|
||||||
while (stoken)
|
while (stoken)
|
||||||
{
|
{
|
||||||
if ((stoken[0] == '/' && stoken[1] == '/')
|
if ((stoken[0] == '/' && stoken[1] == '/')
|
||||||
@@ -540,7 +546,7 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
if (!value)
|
if (!value)
|
||||||
I_Error("R_AddSkins: syntax error in S_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
|
I_Error("R_AddSkins: syntax error in S_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
|
||||||
|
|
||||||
if (!stricmp(stoken, "name"))
|
if (fasticmp(stoken, "name"))
|
||||||
{
|
{
|
||||||
// the skin name must uniquely identify a single skin
|
// the skin name must uniquely identify a single skin
|
||||||
// I'm lazy so if name is already used I leave the 'skin x'
|
// I'm lazy so if name is already used I leave the 'skin x'
|
||||||
@@ -554,18 +560,18 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
// using the default skin name's number set above
|
// using the default skin name's number set above
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const size_t stringspace =
|
const size_t stringspace = strlen(value) + sizeof lnumskins + 1;
|
||||||
strlen(value) + sizeof lnumskins + 1;
|
|
||||||
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
|
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
|
||||||
snprintf(value2, stringspace,
|
|
||||||
"%s%d", value, lnumskins);
|
snprintf(value2, stringspace, "%s%d", value, lnumskins);
|
||||||
value2[stringspace - 1] = '\0';
|
value2[stringspace - 1] = '\0';
|
||||||
|
|
||||||
if (R_LocalSkinAvailable(value2, local) == -1)
|
if (R_LocalSkinAvailable(value2, local) == -1)
|
||||||
{
|
{
|
||||||
STRBUFCPY(skin->name,
|
STRBUFCPY(skin->name, value2);
|
||||||
value2);
|
|
||||||
strlwr(skin->name);
|
strlwr(skin->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(value2);
|
Z_Free(value2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,115 +587,134 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
{
|
{
|
||||||
STRBUFCPY(skin->hudname, skin->name);
|
STRBUFCPY(skin->hudname, skin->name);
|
||||||
strupr(skin->hudname);
|
strupr(skin->hudname);
|
||||||
|
|
||||||
for (value = skin->hudname; *value; value++)
|
for (value = skin->hudname; *value; value++)
|
||||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "realname"))
|
else if (fasticmp(stoken, "realname"))
|
||||||
{ // Display name (eg. "Knuckles")
|
{ // Display name (eg. "Knuckles")
|
||||||
realname = true;
|
realname = true;
|
||||||
STRBUFCPY(skin->realname, value);
|
STRBUFCPY(skin->realname, value);
|
||||||
|
|
||||||
for (value = skin->realname; *value; value++)
|
for (value = skin->realname; *value; value++)
|
||||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||||
|
|
||||||
if (!hudname)
|
if (!hudname)
|
||||||
STRBUFCPY(skin->hudname, skin->realname);
|
STRBUFCPY(skin->hudname, skin->realname);
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "hudname"))
|
else if (fasticmp(stoken, "hudname"))
|
||||||
{ // Life icon name (eg. "K.T.E")
|
{ // Life icon name (eg. "K.T.E")
|
||||||
hudname = true;
|
hudname = true;
|
||||||
STRBUFCPY(skin->hudname, value);
|
STRBUFCPY(skin->hudname, value);
|
||||||
|
|
||||||
for (value = skin->hudname; *value; value++)
|
for (value = skin->hudname; *value; value++)
|
||||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||||
|
|
||||||
if (!realname)
|
if (!realname)
|
||||||
STRBUFCPY(skin->realname, skin->hudname);
|
STRBUFCPY(skin->realname, skin->hudname);
|
||||||
}
|
}
|
||||||
|
else if (fasticmp(stoken, "sprite"))
|
||||||
else if (!stricmp(stoken, "sprite"))
|
|
||||||
{
|
{
|
||||||
strupr(value);
|
strupr(value);
|
||||||
memcpy(skin->sprite, value, sizeof skin->sprite);
|
memcpy(skin->sprite, value, sizeof skin->sprite);
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "facerank"))
|
else if (fasticmp(stoken, "facerank"))
|
||||||
{
|
{
|
||||||
strupr(value);
|
strupr(value);
|
||||||
memcpy(skin->facerank, value, sizeof(skin->facerank)-1);
|
memcpy(skin->facerank, value, sizeof(skin->facerank)-1);
|
||||||
skin->facerank[sizeof(skin->facerank)-1] = '\0';
|
skin->facerank[sizeof(skin->facerank)-1] = '\0';
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "facewant"))
|
else if (fasticmp(stoken, "facewant"))
|
||||||
{
|
{
|
||||||
strupr(value);
|
strupr(value);
|
||||||
memcpy(skin->facewant, value, sizeof(skin->facewant)-1);
|
memcpy(skin->facewant, value, sizeof(skin->facewant)-1);
|
||||||
skin->facewant[sizeof(skin->facewant)-1] = '\0';
|
skin->facewant[sizeof(skin->facewant)-1] = '\0';
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "facemmap"))
|
else if (fasticmp(stoken, "facemmap"))
|
||||||
{
|
{
|
||||||
strupr(value);
|
strupr(value);
|
||||||
strncpy(skin->facemmap, value, sizeof(skin->facemmap)-1);
|
strncpy(skin->facemmap, value, sizeof(skin->facemmap)-1);
|
||||||
skin->facemmap[sizeof(skin->facemmap)-1] = '\0';
|
skin->facemmap[sizeof(skin->facemmap)-1] = '\0';
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "flags")) // character type identification
|
else if (fasticmp(stoken, "flags")) // character type identification
|
||||||
{
|
{
|
||||||
skin->flags = get_number(value);
|
skin->flags = get_number(value);
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "kartspeed"))
|
else if (fasticmp(stoken, "kartspeed"))
|
||||||
{
|
{
|
||||||
skin->kartspeed = atoi(value);
|
skin->kartspeed = atoi(value);
|
||||||
|
|
||||||
if (skin->kartspeed < 1)
|
if (skin->kartspeed < 1)
|
||||||
skin->kartspeed = 1;
|
skin->kartspeed = 1;
|
||||||
if (skin->kartspeed > 9)
|
if (skin->kartspeed > 9)
|
||||||
skin->kartspeed = 9;
|
skin->kartspeed = 9;
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "kartweight"))
|
else if (fasticmp(stoken, "kartweight"))
|
||||||
{
|
{
|
||||||
skin->kartweight = atoi(value);
|
skin->kartweight = atoi(value);
|
||||||
|
|
||||||
if (skin->kartweight < 1)
|
if (skin->kartweight < 1)
|
||||||
skin->kartweight = 1;
|
skin->kartweight = 1;
|
||||||
if (skin->kartweight > 9)
|
if (skin->kartweight > 9)
|
||||||
skin->kartweight = 9;
|
skin->kartweight = 9;
|
||||||
}
|
}
|
||||||
// custom translation table
|
// custom translation table
|
||||||
else if (!stricmp(stoken, "startcolor"))
|
else if (fasticmp(stoken, "startcolor"))
|
||||||
|
{
|
||||||
skin->starttranscolor = atoi(value);
|
skin->starttranscolor = atoi(value);
|
||||||
else if (!stricmp(stoken, "prefcolor"))
|
}
|
||||||
|
else if (fasticmp(stoken, "prefcolor"))
|
||||||
|
{
|
||||||
skin->prefcolor = K_GetKartColorByName(value);
|
skin->prefcolor = K_GetKartColorByName(value);
|
||||||
else if (!stricmp(stoken, "highresscale"))
|
}
|
||||||
|
else if (fasticmp(stoken, "highresscale"))
|
||||||
|
{
|
||||||
skin->highresscale = FLOAT_TO_FIXED(atof(value));
|
skin->highresscale = FLOAT_TO_FIXED(atof(value));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INT32 found = false;
|
INT32 found = false;
|
||||||
sfxenum_t i;
|
sfxenum_t i;
|
||||||
|
|
||||||
// copy name of sounds that are remapped
|
// copy name of sounds that are remapped
|
||||||
// for this skin
|
// for this skin
|
||||||
for (i = 0; i < sfx_skinsoundslot0; i++)
|
for (i = 0; i < sfx_skinsoundslot0; i++)
|
||||||
{
|
{
|
||||||
if (!S_sfx[i].name)
|
const sfxinfo_t *sfx = &S_sfx[i];
|
||||||
|
|
||||||
|
if (!sfx->name)
|
||||||
continue;
|
continue;
|
||||||
if (S_sfx[i].skinsound != -1
|
|
||||||
&& !stricmp(S_sfx[i].name,
|
if (sfx->skinsound != -1
|
||||||
stoken + 2))
|
&& fasticmp(sfx->name, stoken + 2))
|
||||||
{
|
{
|
||||||
skin->soundsid[S_sfx[i].skinsound] =
|
skin->soundsid[sfx->skinsound] = S_AddSoundFx(value+2, sfx->singularity, sfx->pitch, true);
|
||||||
S_AddSoundFx(value+2, S_sfx[i].singularity, S_sfx[i].pitch, true);
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump# %d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
|
CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump# %d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
stoken = strtok(NULL, "\r\n= ");
|
stoken = strtok(NULL, "\r\n= ");
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf2);
|
free(buf2);
|
||||||
|
|
||||||
lump++; // if no sprite defined use spirte just after this one
|
lump++; // if no sprite defined use spirte just after this one
|
||||||
|
|
||||||
if (skin->sprite[0] == '\0')
|
if (skin->sprite[0] == '\0')
|
||||||
{
|
{
|
||||||
const char *csprname = W_CheckNameForNumPwad(wadnum, lump);
|
const char *csprname = W_CheckNameForNumPwad(wadnum, lump);
|
||||||
|
|
||||||
// skip to end of this skin's frames
|
// skip to end of this skin's frames
|
||||||
lastlump = lump;
|
lastlump = lump;
|
||||||
|
|
||||||
while (W_CheckNameForNumPwad(wadnum, lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump), csprname,4)==0)
|
while (W_CheckNameForNumPwad(wadnum, lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump), csprname,4)==0)
|
||||||
lastlump++;
|
lastlump++;
|
||||||
|
|
||||||
// allocate (or replace) sprite frames, and set spritedef
|
// allocate (or replace) sprite frames, and set spritedef
|
||||||
R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump);
|
R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump);
|
||||||
}
|
}
|
||||||
@@ -699,12 +724,15 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
size_t name;
|
size_t name;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
const char *sprname = skin->sprite;
|
const char *sprname = skin->sprite;
|
||||||
for (name = 0;sprnames[name][0] != '\0';name++)
|
|
||||||
|
for (name = 0; sprnames[name][0] != '\0'; name++)
|
||||||
|
{
|
||||||
if (strncmp(sprnames[name], sprname, 4) == 0)
|
if (strncmp(sprnames[name], sprname, 4) == 0)
|
||||||
{
|
{
|
||||||
found = true;
|
|
||||||
skin->spritedef = sprites[name];
|
skin->spritedef = sprites[name];
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// not found so make a new one
|
// not found so make a new one
|
||||||
// go through the entire current wad looking for our sprite
|
// go through the entire current wad looking for our sprite
|
||||||
@@ -718,7 +746,7 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
while ((lname = W_CheckNameForNumPwad(wadnum, localllump)))
|
while ((lname = W_CheckNameForNumPwad(wadnum, localllump)))
|
||||||
{
|
{
|
||||||
// If this is a valid sprite...
|
// If this is a valid sprite...
|
||||||
if (!memcmp(lname, sprname,4) && lname[4] && lname[5] && lname[5] >= '0' && lname[5] <= '8')
|
if (!memcmp(lname, sprname, 4) && lname[4] && lname[5] && lname[5] >= '0' && lname[5] <= '8')
|
||||||
{
|
{
|
||||||
if (lstart == UINT16_MAX)
|
if (lstart == UINT16_MAX)
|
||||||
lstart = localllump;
|
lstart = localllump;
|
||||||
@@ -733,6 +761,7 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
}
|
}
|
||||||
// If not already set do nothing
|
// If not already set do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
++localllump;
|
++localllump;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -752,7 +781,6 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
|||||||
(local ? localskin_cons_t : skin_cons_t)[lnumskins].value = lnumskins;
|
(local ? localskin_cons_t : skin_cons_t)[lnumskins].value = lnumskins;
|
||||||
(local ? localskin_cons_t : skin_cons_t)[lnumskins].strvalue = skin->name;
|
(local ? localskin_cons_t : skin_cons_t)[lnumskins].strvalue = skin->name;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!local)
|
if (!local)
|
||||||
{
|
{
|
||||||
// Update the forceskin possiblevalues
|
// Update the forceskin possiblevalues
|
||||||
|
|||||||
+25
-33
@@ -43,13 +43,6 @@
|
|||||||
#define MINZ (FRACUNIT*16)
|
#define MINZ (FRACUNIT*16)
|
||||||
#define BASEYCENTER (BASEVIDHEIGHT/2)
|
#define BASEYCENTER (BASEVIDHEIGHT/2)
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
INT32 x1, x2;
|
|
||||||
INT32 column;
|
|
||||||
INT32 topclip, bottomclip;
|
|
||||||
} maskdraw_t;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sprite rotation 0 is facing the viewer,
|
// Sprite rotation 0 is facing the viewer,
|
||||||
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
||||||
@@ -60,8 +53,8 @@ typedef struct
|
|||||||
static lighttable_t **spritelights;
|
static lighttable_t **spritelights;
|
||||||
|
|
||||||
// constant arrays used for psprite clipping and initializing clipping
|
// constant arrays used for psprite clipping and initializing clipping
|
||||||
INT16 *negonearray;
|
INT16 *negonearray = NULL;
|
||||||
INT16 *screenheightarray;
|
INT16 *screenheightarray = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// INITIALIZATION FUNCTIONS
|
// INITIALIZATION FUNCTIONS
|
||||||
@@ -94,13 +87,6 @@ static drawseg_xrange_item_t *drawsegs_xrange;
|
|||||||
static size_t drawsegs_xrange_size = 0;
|
static size_t drawsegs_xrange_size = 0;
|
||||||
static INT32 drawsegs_xrange_count = 0;
|
static INT32 drawsegs_xrange_count = 0;
|
||||||
|
|
||||||
INT32 R_ThingLightLevel(mobj_t* thing)
|
|
||||||
{
|
|
||||||
INT32 lightlevel = thing->lightlevel;
|
|
||||||
|
|
||||||
return lightlevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sprite rotation 0 is facing the viewer,
|
// Sprite rotation 0 is facing the viewer,
|
||||||
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
||||||
@@ -312,7 +298,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
|||||||
|
|
||||||
// store sprite info in lookup tables
|
// store sprite info in lookup tables
|
||||||
//FIXME : numspritelumps do not duplicate sprite replacements
|
//FIXME : numspritelumps do not duplicate sprite replacements
|
||||||
W_ReadLumpHeaderPwad(wadnum, l, &patch, (sizeof(INT16) *4), 0);
|
W_ReadLumpHeaderPwad(wadnum, l, &patch, PNG_HEADER_SIZE, 0);
|
||||||
spritecachedinfo[numspritelumps].width = (INT32)(SHORT(patch.width))<<FRACBITS;
|
spritecachedinfo[numspritelumps].width = (INT32)(SHORT(patch.width))<<FRACBITS;
|
||||||
spritecachedinfo[numspritelumps].offset = (INT32)(SHORT(patch.leftoffset))<<FRACBITS;
|
spritecachedinfo[numspritelumps].offset = (INT32)(SHORT(patch.leftoffset))<<FRACBITS;
|
||||||
spritecachedinfo[numspritelumps].topoffset = (INT32)(SHORT(patch.topoffset))<<FRACBITS;
|
spritecachedinfo[numspritelumps].topoffset = (INT32)(SHORT(patch.topoffset))<<FRACBITS;
|
||||||
@@ -546,8 +532,8 @@ void R_ClearSprites(void)
|
|||||||
visspritecount = numvisiblesprites = clippedvissprites = 0;
|
visspritecount = numvisiblesprites = clippedvissprites = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT16 *vissprite_clipbot[MAXVISSPRITES >> VISSPRITECHUNKBITS];
|
static INT16 *vissprite_clipbot[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {0};
|
||||||
static INT16 *vissprite_cliptop[MAXVISSPRITES >> VISSPRITECHUNKBITS];
|
static INT16 *vissprite_cliptop[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {0};
|
||||||
|
|
||||||
static void R_AllocVisSpriteChunkMemory(UINT32 chunk)
|
static void R_AllocVisSpriteChunkMemory(UINT32 chunk)
|
||||||
{
|
{
|
||||||
@@ -581,16 +567,16 @@ static vissprite_t overflowsprite;
|
|||||||
|
|
||||||
static vissprite_t *R_GetVisSprite(UINT32 num)
|
static vissprite_t *R_GetVisSprite(UINT32 num)
|
||||||
{
|
{
|
||||||
UINT32 chunk = num >> VISSPRITECHUNKBITS;
|
UINT32 chunk = num >> VISSPRITECHUNKBITS;
|
||||||
|
|
||||||
// Allocate chunk if necessary
|
// Allocate chunk if necessary
|
||||||
if (!visspritechunks[chunk])
|
if (!visspritechunks[chunk])
|
||||||
{
|
{
|
||||||
Z_Malloc(sizeof(vissprite_t) * VISSPRITESPERCHUNK, PU_LEVEL, &visspritechunks[chunk]);
|
Z_Malloc(sizeof(vissprite_t) * VISSPRITESPERCHUNK, PU_LEVEL, &visspritechunks[chunk]);
|
||||||
R_AllocVisSpriteChunkMemory(chunk);
|
R_AllocVisSpriteChunkMemory(chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
return visspritechunks[chunk] + (num & VISSPRITEINDEXMASK);
|
return visspritechunks[chunk] + (num & VISSPRITEINDEXMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static vissprite_t *R_NewVisSprite(void)
|
static vissprite_t *R_NewVisSprite(void)
|
||||||
@@ -607,8 +593,8 @@ static vissprite_t *R_NewVisSprite(void)
|
|||||||
// Masked means: partly transparent, i.e. stored
|
// Masked means: partly transparent, i.e. stored
|
||||||
// in posts/runs of opaque pixels.
|
// in posts/runs of opaque pixels.
|
||||||
//
|
//
|
||||||
INT16 *mfloorclip;
|
INT16 *mfloorclip = NULL;
|
||||||
INT16 *mceilingclip;
|
INT16 *mceilingclip = NULL;
|
||||||
|
|
||||||
fixed_t spryscale = 0, sprtopscreen = 0, sprbotscreen = 0;
|
fixed_t spryscale = 0, sprtopscreen = 0, sprbotscreen = 0;
|
||||||
fixed_t windowtop = 0, windowbottom = 0;
|
fixed_t windowtop = 0, windowbottom = 0;
|
||||||
@@ -737,7 +723,6 @@ static void R_DrawFlippedMaskedColumn(drawcolumndata_t* dc, column_t *column)
|
|||||||
dc->texturemid = basetexturemid;
|
dc->texturemid = basetexturemid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Based off of R_GetLinedefTransTable
|
// Based off of R_GetLinedefTransTable
|
||||||
transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap)
|
transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap)
|
||||||
{
|
{
|
||||||
@@ -2249,11 +2234,13 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
|||||||
}
|
}
|
||||||
ds->curline->polyseg->visplane = NULL;
|
ds->curline->polyseg->visplane = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds->maskedtexturecol)
|
if (ds->maskedtexturecol)
|
||||||
{
|
{
|
||||||
entry = R_CreateDrawNode(head);
|
entry = R_CreateDrawNode(head);
|
||||||
entry->seg = ds;
|
entry->seg = ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds->numffloorplanes)
|
if (ds->numffloorplanes)
|
||||||
{
|
{
|
||||||
for (i = 0; i < ds->numffloorplanes; i++)
|
for (i = 0; i < ds->numffloorplanes; i++)
|
||||||
@@ -2523,8 +2510,6 @@ void R_InitDrawNodes(void)
|
|||||||
// R_DrawSprite
|
// R_DrawSprite
|
||||||
//
|
//
|
||||||
//Fab : 26-04-98:
|
//Fab : 26-04-98:
|
||||||
// NOTE : uses con_clipviewtop, so that when console is on,
|
|
||||||
// don't draw the part of sprites hidden under the console
|
|
||||||
static void R_DrawSprite(vissprite_t *spr)
|
static void R_DrawSprite(vissprite_t *spr)
|
||||||
{
|
{
|
||||||
mfloorclip = spr->clipbot;
|
mfloorclip = spr->clipbot;
|
||||||
@@ -2824,6 +2809,7 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
|
|||||||
|
|
||||||
if (drawsegs_xrange_size < maxdrawsegs)
|
if (drawsegs_xrange_size < maxdrawsegs)
|
||||||
{
|
{
|
||||||
|
// haleyjd: fix reallocation to track 2x size
|
||||||
drawsegs_xrange_size = 2 * maxdrawsegs;
|
drawsegs_xrange_size = 2 * maxdrawsegs;
|
||||||
|
|
||||||
for (i = 0; i < DS_RANGES_COUNT; i++)
|
for (i = 0; i < DS_RANGES_COUNT; i++)
|
||||||
@@ -2863,6 +2849,9 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// haleyjd: terminate with a nullptr user for faster loop - adds ~3 FPS
|
||||||
|
drawsegs_xranges[0].items[drawsegs_xranges[0].count].user = nullptr;
|
||||||
|
|
||||||
for (; clippedvissprites < visspritecount; clippedvissprites++)
|
for (; clippedvissprites < visspritecount; clippedvissprites++)
|
||||||
{
|
{
|
||||||
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
|
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
|
||||||
@@ -3028,7 +3017,7 @@ static void R_DrawMaskedList(drawnode_t* head)
|
|||||||
else if (r2->seg && r2->seg->maskedtexturecol != NULL)
|
else if (r2->seg && r2->seg->maskedtexturecol != NULL)
|
||||||
{
|
{
|
||||||
next = r2->prev;
|
next = r2->prev;
|
||||||
R_RenderMaskedSegRange( r2->seg, r2->seg->x1, r2->seg->x2);
|
R_RenderMaskedSegRange(r2->seg, r2->seg->x1, r2->seg->x2);
|
||||||
r2->seg->maskedtexturecol = NULL;
|
r2->seg->maskedtexturecol = NULL;
|
||||||
R_DoneWithNode(r2);
|
R_DoneWithNode(r2);
|
||||||
r2 = next;
|
r2 = next;
|
||||||
@@ -3067,6 +3056,9 @@ void R_DrawMasked(maskcount_t* masks, INT32 nummasks)
|
|||||||
|
|
||||||
heads = static_cast<drawnode_t*>(calloc(nummasks, sizeof(drawnode_t)));
|
heads = static_cast<drawnode_t*>(calloc(nummasks, sizeof(drawnode_t)));
|
||||||
|
|
||||||
|
if (!heads)
|
||||||
|
I_Error("R_DrawMasked: No more free memory\n");
|
||||||
|
|
||||||
for (i = 0; i < nummasks; i++)
|
for (i = 0; i < nummasks; i++)
|
||||||
{
|
{
|
||||||
heads[i].next = heads[i].prev = &heads[i];
|
heads[i].next = heads[i].prev = &heads[i];
|
||||||
|
|||||||
+8
-5
@@ -23,10 +23,10 @@ extern "C" {
|
|||||||
|
|
||||||
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
|
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
|
||||||
// Fab: this is a hack : should allocate the lookup tables per sprite
|
// Fab: this is a hack : should allocate the lookup tables per sprite
|
||||||
#if defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) || defined(__arm64__) // only for 64bit (idk how else to proper check lmao)
|
#if __SIZEOF_POINTER__ < 8
|
||||||
#define MAXVISSPRITES 4096
|
|
||||||
#else
|
|
||||||
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
|
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
|
||||||
|
#else
|
||||||
|
#define MAXVISSPRITES 4096 // only for 64bit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
|
#define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
|
||||||
@@ -63,7 +63,10 @@ extern fixed_t windowtop;
|
|||||||
extern fixed_t windowbottom;
|
extern fixed_t windowbottom;
|
||||||
extern INT32 lengthcol;
|
extern INT32 lengthcol;
|
||||||
|
|
||||||
INT32 R_ThingLightLevel(mobj_t *thing);
|
FUNCINLINE static ATTRINLINE INT32 R_ThingLightLevel(mobj_t* thing)
|
||||||
|
{
|
||||||
|
return (INT32)thing->lightlevel;
|
||||||
|
}
|
||||||
fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
|
fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
|
||||||
|
|
||||||
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
|
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
|
||||||
@@ -83,7 +86,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
size_t drawsegs[2];
|
size_t drawsegs[2];
|
||||||
size_t vissprites[2];
|
size_t vissprites[2];
|
||||||
fixed_t viewx, viewy, viewz; /**< View z stored at the time of the BSP traversal for the view/portal. Masked sorting/drawing needs it. */
|
fixed_t viewx, viewy, viewz; /**< View z stored at the time of the BSP traversal for the view/portal. Masked sorting/drawing needs it. */
|
||||||
sector_t* viewsector;
|
sector_t* viewsector;
|
||||||
} maskcount_t;
|
} maskcount_t;
|
||||||
|
|
||||||
|
|||||||
+23
-18
@@ -1095,9 +1095,12 @@ void S_StartSoundName(void *mo, const char *soundname)
|
|||||||
// Search existing sounds...
|
// Search existing sounds...
|
||||||
for (i = sfx_None + 1; i < NUMSFX; i++)
|
for (i = sfx_None + 1; i < NUMSFX; i++)
|
||||||
{
|
{
|
||||||
if (!S_sfx[i].name)
|
const sfxinfo_t *sfx = &S_sfx[i];
|
||||||
|
|
||||||
|
if (!sfx->name)
|
||||||
continue;
|
continue;
|
||||||
if (!stricmp(S_sfx[i].name, soundname))
|
|
||||||
|
if (fasticmp(sfx->name, soundname))
|
||||||
{
|
{
|
||||||
soundnum = i;
|
soundnum = i;
|
||||||
break;
|
break;
|
||||||
@@ -1110,6 +1113,7 @@ void S_StartSoundName(void *mo, const char *soundname)
|
|||||||
{
|
{
|
||||||
if (newsounds[i] == 0)
|
if (newsounds[i] == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!S_IdPlaying(newsounds[i]))
|
if (!S_IdPlaying(newsounds[i]))
|
||||||
{
|
{
|
||||||
S_RemoveSoundFx(newsounds[i]);
|
S_RemoveSoundFx(newsounds[i]);
|
||||||
@@ -1266,7 +1270,7 @@ ReadMusicDefFields (UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
|
|||||||
char *value;
|
char *value;
|
||||||
char *textline;
|
char *textline;
|
||||||
|
|
||||||
if (!stricmp(stoken, "lump"))
|
if (fasticmp(stoken, "lump"))
|
||||||
{
|
{
|
||||||
value = strtok(NULL, " ");
|
value = strtok(NULL, " ");
|
||||||
|
|
||||||
@@ -1341,24 +1345,24 @@ skip_lump:
|
|||||||
for (textline = def->field; *textline; textline++)\
|
for (textline = def->field; *textline; textline++)\
|
||||||
if (*textline == '_') *textline = ' ';
|
if (*textline == '_') *textline = ' ';
|
||||||
|
|
||||||
if (!stricmp(stoken, "usage"))
|
if (fasticmp(stoken, "usage"))
|
||||||
{
|
{
|
||||||
ADDDEF(usage);
|
ADDDEF(usage);
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "source"))
|
else if (fasticmp(stoken, "source"))
|
||||||
{
|
{
|
||||||
ADDDEF(source);
|
ADDDEF(source);
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "title"))
|
else if (fasticmp(stoken, "title"))
|
||||||
{
|
{
|
||||||
def->use_info = true;
|
def->use_info = true;
|
||||||
ADDDEF(title);
|
ADDDEF(title);
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "alttitle"))
|
else if (fasticmp(stoken, "alttitle"))
|
||||||
{
|
{
|
||||||
ADDDEF(alttitle);
|
ADDDEF(alttitle);
|
||||||
}
|
}
|
||||||
else if (!stricmp(stoken, "authors"))
|
else if (fasticmp(stoken, "authors"))
|
||||||
{
|
{
|
||||||
ADDDEF(authors);
|
ADDDEF(authors);
|
||||||
}
|
}
|
||||||
@@ -1479,7 +1483,8 @@ musicdef_t *S_FindMusicCredit(const char *musname)
|
|||||||
|
|
||||||
if (hash != def->hash)
|
if (hash != def->hash)
|
||||||
continue;
|
continue;
|
||||||
if (stricmp(def->name, musname))
|
|
||||||
|
if (!fasticmp(def->name, musname))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
@@ -1828,7 +1833,7 @@ void S_StopMusic(void)
|
|||||||
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mapmusic.resume = (cv_birdmusic.value && (strcasecmp(music.name, mapmusic.name) == 0)) ? I_GetSongPosition() : 0;
|
mapmusic.resume = (cv_birdmusic.value && fasticmp(music.name, mapmusic.name)) ? I_GetSongPosition() : 0;
|
||||||
|
|
||||||
S_SetKeepMusResume();
|
S_SetKeepMusResume();
|
||||||
|
|
||||||
@@ -1934,7 +1939,7 @@ static const char *musicexception_list[] = {
|
|||||||
// check if the current music is smth we dont want to keep (vote music, etc)
|
// check if the current music is smth we dont want to keep (vote music, etc)
|
||||||
static boolean S_CheckMusicException(void)
|
static boolean S_CheckMusicException(void)
|
||||||
{
|
{
|
||||||
if (stricmp(music.name, mapmusic.name))
|
if (!fasticmp(music.name, mapmusic.name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// dumb hack but dont keepmusic music that is supposed to reset
|
// dumb hack but dont keepmusic music that is supposed to reset
|
||||||
@@ -1944,7 +1949,7 @@ static boolean S_CheckMusicException(void)
|
|||||||
// in case somehow the mapmusic was replaced with smth we dont want to keep
|
// in case somehow the mapmusic was replaced with smth we dont want to keep
|
||||||
for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++)
|
for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++)
|
||||||
{
|
{
|
||||||
if (!stricmp(music.name, musicexception_list[i]) || !stricmp(checkmusic, musicexception_list[i]))
|
if (fasticmp(music.name, musicexception_list[i]) || fasticmp(checkmusic, musicexception_list[i]))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1964,7 +1969,7 @@ static void S_SetKeepMusResume(void)
|
|||||||
{
|
{
|
||||||
keepmusic.resume = 0;
|
keepmusic.resume = 0;
|
||||||
|
|
||||||
if (strcasecmp(music.name, mapmusic.name) == 0)
|
if (fasticmp(music.name, mapmusic.name))
|
||||||
{
|
{
|
||||||
keepmusic.resume = I_GetSongPosition();
|
keepmusic.resume = I_GetSongPosition();
|
||||||
}
|
}
|
||||||
@@ -2030,12 +2035,12 @@ static boolean S_SkipIntroMusic(void)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check if menu music is playing, otherwise it may continue playing
|
// check if menu music is playing, otherwise it may continue playing
|
||||||
if (!stricmp(music.name, "titles"))
|
if (fasticmp(music.name, "titles"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
|
char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
|
||||||
|
|
||||||
if (maptitle && !stricmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz...
|
if (maptitle && fasticmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz...
|
||||||
{
|
{
|
||||||
Z_Free(maptitle);
|
Z_Free(maptitle);
|
||||||
return false;
|
return false;
|
||||||
@@ -2148,19 +2153,19 @@ static void Command_Tunes_f(void)
|
|||||||
tunenum = (UINT16)atoi(tunearg);
|
tunenum = (UINT16)atoi(tunearg);
|
||||||
track = 0;
|
track = 0;
|
||||||
|
|
||||||
if (!strcasecmp(tunearg, "-show"))
|
if (fasticmp(tunearg, "-show"))
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
|
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
|
||||||
mapmusic.name, (mapmusic.flags & MUSIC_TRACKMASK));
|
mapmusic.name, (mapmusic.flags & MUSIC_TRACKMASK));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(tunearg, "-none"))
|
if (fasticmp(tunearg, "-none"))
|
||||||
{
|
{
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(tunearg, "-default"))
|
else if (fasticmp(tunearg, "-default"))
|
||||||
{
|
{
|
||||||
tunearg = mapheaderinfo[gamemap-1]->musname;
|
tunearg = mapheaderinfo[gamemap-1]->musname;
|
||||||
track = mapheaderinfo[gamemap-1]->mustrack;
|
track = mapheaderinfo[gamemap-1]->mustrack;
|
||||||
|
|||||||
Loaded 100 of 116 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user