Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44ecb677ad | ||
|
|
3e99f4d142 | ||
|
|
a9d0e2154b | ||
|
|
16a0953d1d | ||
|
|
737ae08355 | ||
|
|
6d83a7e187 | ||
|
|
56df9b6af3 | ||
|
|
7f2435d821 | ||
|
|
b180f29fd9 | ||
|
|
32c85f96a4 | ||
|
|
ec83c60320 | ||
|
|
fb4a912dba | ||
|
|
123b2aa60b | ||
|
|
bd82a8db29 | ||
|
|
6f71fc17c2 | ||
|
|
d8c3e9f41c | ||
|
|
e10345b4de | ||
|
|
2ab66b113c | ||
|
|
f64263cf6f | ||
|
|
55c72f32da | ||
|
|
53bc12baad | ||
|
|
b391e763bc | ||
|
|
2bae0bdb0f | ||
|
|
d42df54901 | ||
|
|
e6256d448f | ||
|
|
ad1a980eb1 | ||
|
|
1b50858fa6 | ||
|
|
3276bbb7b6 | ||
|
|
dc00fa3429 | ||
|
|
dc9276b73c | ||
|
|
271d70d6f3 | ||
|
|
e52a6c430b | ||
|
|
d77d25acf8 | ||
|
|
9898809f0a | ||
|
|
48768aa13c | ||
|
|
b1c01a763f | ||
|
|
d9bcd6007c | ||
|
|
d1b478b3b1 | ||
|
|
14b421f533 | ||
|
|
7310a8e4df | ||
|
|
c1c3a7dc78 | ||
|
|
ff10b77414 | ||
|
|
4667c332b4 | ||
|
|
4a9f6b6a22 | ||
|
|
f1d78243d0 | ||
|
|
6e41c8a2a0 | ||
|
|
9c5955feb0 | ||
|
|
0764b180f7 | ||
|
|
b883e4e4fe | ||
|
|
f78688b684 | ||
|
|
097cd5e2ca | ||
|
|
cd4836ae99 | ||
|
|
f0acf179c2 | ||
|
|
836ad12c40 | ||
|
|
a147fa3100 | ||
|
|
4f0cf44e78 | ||
|
|
2417647110 | ||
|
|
982cd7bde2 | ||
|
|
d6bd289fcf | ||
|
|
a68a05a838 | ||
|
|
95504547df | ||
|
|
ceb2a70664 | ||
|
|
8593a1975c | ||
|
|
ba44e61733 | ||
|
|
845652cbfe | ||
|
|
ceafa06efc | ||
|
|
e6f487474b | ||
|
|
d8461bb44f | ||
|
|
e25d366728 | ||
|
|
2abf0b98ac | ||
|
|
0f087d13bb | ||
|
|
2e914c61d1 | ||
|
|
3f599d5a28 | ||
|
|
6ef1f73d4d | ||
|
|
38b84baf9d | ||
|
|
fae50c0e19 | ||
|
|
50f7e2084c | ||
|
|
67cc5402cf | ||
|
|
2259d4f309 | ||
|
|
f8d903e7d2 | ||
|
|
805cde8ae8 | ||
|
|
b23906e327 | ||
|
|
2052afdb66 | ||
|
|
d9c7a40d4a | ||
|
|
e749346f0c | ||
|
|
45629386bb | ||
|
|
ffec9d64d5 | ||
|
|
3e9f17af86 | ||
|
|
03ff2fc007 | ||
|
|
4492c00840 | ||
|
|
e15319ac9b | ||
|
|
fa012aefe1 | ||
|
|
e681d2d24d | ||
|
|
76e54762d8 | ||
|
|
3b7d517be2 | ||
|
|
f4da64e3fa | ||
|
|
384acf8e31 | ||
|
|
a423451383 | ||
|
|
66cfceedaf | ||
|
|
fe9107fa9d | ||
|
|
e4f2db54e7 | ||
|
|
2f5fe01ae0 | ||
|
|
1bb7bd0abc | ||
|
|
a84ec88bc3 | ||
|
|
4a2e78081a | ||
|
|
d09d2cb445 | ||
|
|
1faa585e83 | ||
|
|
7479c82691 | ||
|
|
cfab2236da | ||
|
|
d2ee344b22 | ||
|
|
b22737223e | ||
|
|
578158c060 | ||
|
|
8eda0f78f7 | ||
|
|
2c2c82dc1a | ||
|
|
d8c9522ec9 | ||
|
|
492aef2165 | ||
|
|
fc0409e967 | ||
|
|
8a89b57e48 | ||
|
|
0f6b9ba181 | ||
|
|
8f1b4004c9 | ||
|
|
bee5250940 | ||
|
|
c61a2e6ba2 | ||
|
|
d293bb9672 | ||
|
|
a61b028e97 | ||
|
|
e29bdd09c5 | ||
|
|
74b082760d | ||
|
|
4460fa608b | ||
|
|
949192c570 | ||
|
|
4fa0ca2304 | ||
|
|
d9d2f043fa | ||
|
|
1ea51f29c5 | ||
|
|
efc4a513ce | ||
|
|
b13793b2a4 | ||
|
|
b4570cbdaa | ||
|
|
f2dc344bf8 | ||
|
|
c0654448f0 | ||
|
|
2bf3912633 | ||
|
|
4d71fb8409 | ||
|
|
8543a099f4 | ||
|
|
9c6ec02b18 | ||
|
|
bb9118ee32 | ||
|
|
68cb96ab97 | ||
|
|
1847aac223 | ||
|
|
14be968089 | ||
|
|
9f678263d0 | ||
|
|
cb0667921e | ||
|
|
52ab27a825 | ||
|
|
38b89093fa | ||
|
|
224ce007e1 | ||
|
|
2800685cfc | ||
|
|
0241d7fe00 | ||
|
|
5d8bb3223f | ||
|
|
5e1f943a38 | ||
|
|
fca7b4a837 | ||
|
|
02ce2ff5ec | ||
|
|
d2bab80b29 | ||
|
|
667a8bb166 | ||
|
|
76a18d001f | ||
|
|
78ab90c1a6 | ||
|
|
45b9aeb85a | ||
|
|
d580306b8a | ||
|
|
102e944fd5 | ||
|
|
3748896ebc | ||
|
|
79988dea3d | ||
|
|
4409a5848f | ||
|
|
07c13636fc | ||
|
|
51cc706b1e | ||
|
|
54bd31c80a | ||
|
|
61534d7356 | ||
|
|
9bd4a933cf | ||
|
|
e233635783 | ||
|
|
da24ba20c7 | ||
|
|
74bdabc636 | ||
|
|
4b129314d3 | ||
|
|
3a55972997 | ||
|
|
6e04e4171e | ||
|
|
cccfaaabfd | ||
|
|
eadbe9c2e5 | ||
|
|
9bbabcee06 | ||
|
|
7ca6fa6772 | ||
|
|
6317e9c510 | ||
|
|
0a80985771 | ||
|
|
548d52cc60 | ||
|
|
11c6c69a00 | ||
|
|
08025d2da3 | ||
|
|
4169e7bd71 | ||
|
|
bfb7a6b08d | ||
|
|
58abb0d4c3 | ||
|
|
9658279cb1 | ||
|
|
83bb908ff0 | ||
|
|
515c18c855 | ||
|
|
6f4e387061 | ||
|
|
33ef566fd2 | ||
|
|
eeecd954e2 | ||
|
|
ccb804a4ed | ||
|
|
a21029ee9e | ||
|
|
7393eb728c | ||
|
|
1e715f8cd7 | ||
|
|
7aadc77a69 | ||
|
|
27e1406e6d | ||
|
|
796204d376 | ||
|
|
acabd1a03e | ||
|
|
c08aae2622 | ||
|
|
3eba512ad4 | ||
|
|
c99115d552 | ||
|
|
bf6c682cc1 | ||
|
|
dc2f0b5707 | ||
|
|
58de672915 | ||
|
|
9488d98cfd | ||
|
|
906b8165d3 | ||
|
|
16b5037486 | ||
|
|
74c8325987 | ||
|
|
e30efbfe6c | ||
|
|
5d4bb0f5ce | ||
|
|
e63777c7d6 | ||
|
|
a34ca05bff | ||
|
|
bcec8b98f7 | ||
|
|
af9ffc1f6f | ||
|
|
18816453f4 | ||
|
|
1eb8a75058 | ||
|
|
5abf42fe75 | ||
|
|
1306a233b8 | ||
|
|
46f8c6b7a5 | ||
|
|
face5cf447 | ||
|
|
603267b753 | ||
|
|
7cf3113d67 | ||
|
|
397fa962b1 | ||
|
|
d2637ab71f | ||
|
|
a6e020adeb | ||
|
|
d50dcac0c0 | ||
|
|
dd6bc23a8e | ||
|
|
71575f5cf8 | ||
|
|
9899747a7f | ||
|
|
d2a415380d | ||
|
|
dd7ffd7dfe | ||
|
|
770f9af5e1 | ||
|
|
c2ab5be8b8 | ||
|
|
b8ae656968 | ||
|
|
553b61e1f5 | ||
|
|
fa3dcdb24f | ||
|
|
311258dda0 | ||
|
|
a0f8816de7 | ||
|
|
c546b6225c | ||
|
|
f6c6621af8 | ||
|
|
5a0fb59b26 | ||
|
|
07c52e6af5 | ||
|
|
405c566038 | ||
|
|
78780799ea | ||
|
|
82b9457aa7 | ||
|
|
4e6abb39dd |
No files matched your search
+21
-6
@@ -246,13 +246,25 @@ debug_opts=-DNDEBUG
|
|||||||
opts+=-O3
|
opts+=-O3
|
||||||
ifdef USELTO
|
ifdef USELTO
|
||||||
# compile with LTO
|
# compile with LTO
|
||||||
|
ifdef MINGW
|
||||||
|
opts+=-flto=auto -g
|
||||||
|
libs+=-flto=auto -g
|
||||||
|
else
|
||||||
opts+=-flto=auto
|
opts+=-flto=auto
|
||||||
libs+=-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
|
||||||
|
libs+=-fsanitize=address
|
||||||
|
endif
|
||||||
opts+=-fsanitize=address
|
opts+=-fsanitize=address
|
||||||
libs+=-fsanitize=address
|
libs+=-fsanitize=address
|
||||||
endif
|
endif
|
||||||
@@ -262,8 +274,11 @@ opts+=$(debug_opts)
|
|||||||
|
|
||||||
opts+=$(foreach v,$(passthru_opts),$(if $($(v)),-D$(v)))
|
opts+=$(foreach v,$(passthru_opts),$(if $($(v)),-D$(v)))
|
||||||
|
|
||||||
opts+=$(WFLAGS) $(CPPFLAGS) $(CFLAGS)
|
CXXFLAGS+=-std=c++17 # force c17 for c++ since most vpss run older ubuntu versions with old compilers
|
||||||
cxxopts:=$(opts) $(CXXFLAGS) -std=c++17
|
|
||||||
|
opts+=$(WFLAGS) $(CFLAGS)
|
||||||
|
cxxopts:=$(opts) $(CXXFLAGS)
|
||||||
|
opts+=$(CWFLAGS) # warning flags that shouldnt be passed to c++ compiler
|
||||||
|
|
||||||
libs+=$(LDFLAGS) -lstdc++ -lpthread
|
libs+=$(LDFLAGS) -lstdc++ -lpthread
|
||||||
asflags:=$(ASFLAGS) -x assembler-with-cpp
|
asflags:=$(ASFLAGS) -x assembler-with-cpp
|
||||||
@@ -375,12 +390,12 @@ ifdef Echo_name
|
|||||||
@printf '%-20.20s\r' $$<
|
@printf '%-20.20s\r' $$<
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
$(.)$(cc) -MM -MF $$@ -MT $(objdir)/$$*.o $(2) $$<
|
$(.)$(2) -MM -MF $$@ -MT $(objdir)/$$*.o $(3) $$<
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call _recipe,c))
|
$(eval $(call _recipe,c,$(cc)))
|
||||||
$(eval $(call _recipe,cpp))
|
$(eval $(call _recipe,cpp,$(cxx)))
|
||||||
$(eval $(call _recipe,s,$(asflags)))
|
$(eval $(call _recipe,s,$(cc),$(asflags)))
|
||||||
|
|
||||||
# compiling recipe template
|
# compiling recipe template
|
||||||
# 1: target file suffix
|
# 1: target file suffix
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ passthru_opts+=\
|
|||||||
NOHW NOMD5 NOPOSTPROCESSING\
|
NOHW NOMD5 NOPOSTPROCESSING\
|
||||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
||||||
HAVE_MINIUPNPC\
|
HAVE_MINIUPNPC\
|
||||||
HAVE_DISCORDRPC DEVELOP\
|
HAVE_DISCORDRPC DEVELOP
|
||||||
NOBLUAJIT
|
|
||||||
|
|
||||||
# build with debugging information
|
# build with debugging information
|
||||||
ifdef DEBUGMODE
|
ifdef DEBUGMODE
|
||||||
@@ -98,7 +97,7 @@ opts+=-DHAVE_VALGRIND
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
default_packages:=\
|
default_packages:=\
|
||||||
GME/libgme/LIBGME\
|
LIBGME/libgme/LIBGME\
|
||||||
OPENMPT/libopenmpt/LIBOPENMPT\
|
OPENMPT/libopenmpt/LIBOPENMPT\
|
||||||
ZLIB/zlib\
|
ZLIB/zlib\
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
|
|||||||
CXXFLAGS+= -Wno-aggregate-return
|
CXXFLAGS+= -Wno-aggregate-return
|
||||||
|
|
||||||
# -W -Wno-unused
|
# -W -Wno-unused
|
||||||
|
|
||||||
ifdef GCC150
|
|
||||||
opts+=-std=gnu17
|
|
||||||
endif
|
|
||||||
WFLAGS:=-Wall -Wno-trigraphs
|
WFLAGS:=-Wall -Wno-trigraphs
|
||||||
ifndef GCC295
|
ifndef GCC295
|
||||||
#WFLAGS+=-Wno-packed
|
#WFLAGS+=-Wno-packed
|
||||||
@@ -45,7 +41,8 @@ ifdef GCC41
|
|||||||
WFLAGS+=-Wshadow
|
WFLAGS+=-Wshadow
|
||||||
endif
|
endif
|
||||||
#WFLAGS+=-Wlarger-than-%len%
|
#WFLAGS+=-Wlarger-than-%len%
|
||||||
WFLAGS+=-Wpointer-arith -Wbad-function-cast
|
WFLAGS+=-Wpointer-arith
|
||||||
|
CWFLAGS+=-Wbad-function-cast
|
||||||
ifdef GCC45
|
ifdef GCC45
|
||||||
#WFLAGS+=-Wc++-compat
|
#WFLAGS+=-Wc++-compat
|
||||||
endif
|
endif
|
||||||
@@ -75,9 +72,10 @@ endif
|
|||||||
endif
|
endif
|
||||||
#WFLAGS+=-Wstrict-prototypes
|
#WFLAGS+=-Wstrict-prototypes
|
||||||
ifdef GCC40
|
ifdef GCC40
|
||||||
WFLAGS+=-Wold-style-definition
|
CWFLAGS+=-Wold-style-definition
|
||||||
endif
|
endif
|
||||||
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
|
WFLAGS+=-Wmissing-declarations
|
||||||
|
CWFLAGS+=-Wmissing-prototypes
|
||||||
ifdef GCC40
|
ifdef GCC40
|
||||||
WFLAGS+=-Wmissing-field-initializers
|
WFLAGS+=-Wmissing-field-initializers
|
||||||
endif
|
endif
|
||||||
@@ -88,7 +86,7 @@ endif
|
|||||||
#WFLAGS+=-Wpacked
|
#WFLAGS+=-Wpacked
|
||||||
#WFLAGS+=-Wpadded
|
#WFLAGS+=-Wpadded
|
||||||
#WFLAGS+=-Wredundant-decls
|
#WFLAGS+=-Wredundant-decls
|
||||||
WFLAGS+=-Wnested-externs
|
CWFLAGS+=-Wnested-externs
|
||||||
#WFLAGS+=-Wunreachable-code
|
#WFLAGS+=-Wunreachable-code
|
||||||
WFLAGS+=-Winline
|
WFLAGS+=-Winline
|
||||||
ifdef DEBUGMODE
|
ifdef DEBUGMODE
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ $(eval $(call _set,LIBGME))
|
|||||||
|
|
||||||
lib:=../libs/libopenmpt
|
lib:=../libs/libopenmpt
|
||||||
LIBOPENMPT_opts:=-I$(lib)/inc
|
LIBOPENMPT_opts:=-I$(lib)/inc
|
||||||
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86)/mingw -lopenmpt
|
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86) -lopenmpt
|
||||||
$(eval $(call _set,LIBOPENMPT))
|
$(eval $(call _set,LIBOPENMPT))
|
||||||
|
|
||||||
lib:=../libs/SDL2_mixer/$(mingw)
|
lib:=../libs/SDL2_mixer/$(mingw)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ m_cond.c
|
|||||||
m_fixed.c
|
m_fixed.c
|
||||||
m_menu.c
|
m_menu.c
|
||||||
m_textinput.c
|
m_textinput.c
|
||||||
|
m_emotes.cpp
|
||||||
m_misc.c
|
m_misc.c
|
||||||
m_perfstats.c
|
m_perfstats.c
|
||||||
m_queue.c
|
m_queue.c
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ static void AM_initVariables(void)
|
|||||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
AM_changeWindowLoc();
|
AM_changeWindowLoc();
|
||||||
|
|
||||||
// for saving & restoring
|
// for saving & restoring
|
||||||
|
|||||||
+21
-1
@@ -36,6 +36,26 @@ LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
|
|||||||
/* extra error code for `luaL_load' */
|
/* extra error code for `luaL_load' */
|
||||||
#define LUA_ERRFILE (LUA_ERRERR+1)
|
#define LUA_ERRFILE (LUA_ERRERR+1)
|
||||||
|
|
||||||
|
/* Compiler-specific attributes and other macros */
|
||||||
|
|
||||||
|
#ifdef __GNUC__ // __attribute__ ((X))
|
||||||
|
|
||||||
|
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__) // MinGW, >= GCC 4.1
|
||||||
|
#if 0 //defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0
|
||||||
|
#define FUNCREPORT __attribute__ ((format(gnu_printf, 2, 3)))
|
||||||
|
#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
|
||||||
|
#define FUNCREPORT __attribute__ ((format(ms_printf, 2, 3)))
|
||||||
|
#else
|
||||||
|
#define FUNCREPORT __attribute__ ((format(printf, 2, 3)))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define FUNCREPORT __attribute__ ((format(printf, 2, 3)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FUNCREPORT
|
||||||
|
#define FUNCREPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct luaL_Reg {
|
typedef struct luaL_Reg {
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -70,7 +90,7 @@ LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
|
|||||||
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
|
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
|
||||||
|
|
||||||
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
|
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
|
||||||
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
|
LUALIB_API FUNCREPORT int (luaL_error) (lua_State *L, const char *fmt, ...);
|
||||||
|
|
||||||
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
|
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
|
||||||
const char *const lst[]);
|
const char *const lst[]);
|
||||||
|
|||||||
+7
-44
@@ -222,6 +222,7 @@ struct textcmdbuf_s
|
|||||||
|
|
||||||
static textcmdbuf_t *textcmdbuf[MAXSPLITSCREENPLAYERS] = {NULL};
|
static textcmdbuf_t *textcmdbuf[MAXSPLITSCREENPLAYERS] = {NULL};
|
||||||
|
|
||||||
|
static ticcmd_t playercmds[MAXPLAYERS];
|
||||||
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
|
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
|
||||||
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
|
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
|
||||||
|
|
||||||
@@ -5320,14 +5321,8 @@ static void PT_ClientCmd(INT32 netconsole, SINT8 node)
|
|||||||
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS)
|
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
|
// store it in an internal buffer so the last packet takes precedence, which minimizes input lag
|
||||||
tic_t faketic = maketic;
|
G_MoveTiccmd(&playercmds[netconsole], &netbuffer->u.clientpak.cmd, 1);
|
||||||
if ((!!(netcmds[maketic % BACKUPTICS][netconsole].angleturn & TICCMD_RECEIVED))
|
|
||||||
&& (maketic - firstticstosend < BACKUPTICS - 1))
|
|
||||||
faketic++;
|
|
||||||
|
|
||||||
// Copy ticcmd
|
|
||||||
G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][netconsole], &netbuffer->u.clientpak.cmd, 1);
|
|
||||||
|
|
||||||
// Check ticcmd for "speed hacks"
|
// Check ticcmd for "speed hacks"
|
||||||
if (CheckForSpeedHacks((UINT8)netconsole))
|
if (CheckForSpeedHacks((UINT8)netconsole))
|
||||||
@@ -5339,8 +5334,7 @@ static void PT_ClientCmd(INT32 netconsole, SINT8 node)
|
|||||||
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
||||||
&& (nodetoplayer2[node] >= 0))
|
&& (nodetoplayer2[node] >= 0))
|
||||||
{
|
{
|
||||||
G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][(UINT8)nodetoplayer2[node]],
|
G_MoveTiccmd(&playercmds[(UINT8)nodetoplayer2[node]], &netbuffer->u.client2pak.cmd2, 1);
|
||||||
&netbuffer->u.client2pak.cmd2, 1);
|
|
||||||
|
|
||||||
if (CheckForSpeedHacks((UINT8)nodetoplayer2[node]))
|
if (CheckForSpeedHacks((UINT8)nodetoplayer2[node]))
|
||||||
return;
|
return;
|
||||||
@@ -5350,8 +5344,7 @@ static void PT_ClientCmd(INT32 netconsole, SINT8 node)
|
|||||||
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
||||||
&& (nodetoplayer3[node] >= 0))
|
&& (nodetoplayer3[node] >= 0))
|
||||||
{
|
{
|
||||||
G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][(UINT8)nodetoplayer3[node]],
|
G_MoveTiccmd(&playercmds[(UINT8)nodetoplayer3[node]], &netbuffer->u.client3pak.cmd3, 1);
|
||||||
&netbuffer->u.client3pak.cmd3, 1);
|
|
||||||
|
|
||||||
if (CheckForSpeedHacks((UINT8)nodetoplayer3[node]))
|
if (CheckForSpeedHacks((UINT8)nodetoplayer3[node]))
|
||||||
return;
|
return;
|
||||||
@@ -5360,8 +5353,7 @@ static void PT_ClientCmd(INT32 netconsole, SINT8 node)
|
|||||||
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
|
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
|
||||||
&& (nodetoplayer4[node] >= 0))
|
&& (nodetoplayer4[node] >= 0))
|
||||||
{
|
{
|
||||||
G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][(UINT8)nodetoplayer4[node]],
|
G_MoveTiccmd(&playercmds[(UINT8)nodetoplayer4[node]], &netbuffer->u.client4pak.cmd4, 1);
|
||||||
&netbuffer->u.client4pak.cmd4, 1);
|
|
||||||
|
|
||||||
if (CheckForSpeedHacks((UINT8)nodetoplayer4[node]))
|
if (CheckForSpeedHacks((UINT8)nodetoplayer4[node]))
|
||||||
return;
|
return;
|
||||||
@@ -6432,36 +6424,7 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
|
|||||||
// create missed tic
|
// create missed tic
|
||||||
static void SV_Maketic(void)
|
static void SV_Maketic(void)
|
||||||
{
|
{
|
||||||
INT32 j;
|
G_MoveTiccmd(netcmds[maketic % BACKUPTICS], playercmds, MAXPLAYERS);
|
||||||
|
|
||||||
for (j = 0; j < MAXNETNODES; j++)
|
|
||||||
{
|
|
||||||
if (!playerpernode[j])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
INT32 player = nodetoplayer[j];
|
|
||||||
if ((netcmds[maketic%BACKUPTICS][player].angleturn & TICCMD_RECEIVED) == 0)
|
|
||||||
{ // we didn't receive this tic
|
|
||||||
INT32 i;
|
|
||||||
|
|
||||||
DEBFILE(va("MISS tic%4d for node %d\n", maketic, j));
|
|
||||||
#if defined(PARANOIA) && 0
|
|
||||||
CONS_Debug(DBG_NETPLAY, "Client Misstic %d\n", maketic);
|
|
||||||
#endif
|
|
||||||
// copy the old tic
|
|
||||||
for (i = 0; i < playerpernode[j]; i++)
|
|
||||||
{
|
|
||||||
if (i == 0) player = nodetoplayer[j];
|
|
||||||
else if (i == 1) player = nodetoplayer2[j];
|
|
||||||
else if (i == 2) player = nodetoplayer3[j];
|
|
||||||
else if (i == 3) player = nodetoplayer4[j];
|
|
||||||
netcmds[maketic%BACKUPTICS][player] = netcmds[(maketic-1)%BACKUPTICS][player];
|
|
||||||
netcmds[maketic%BACKUPTICS][player].angleturn &= ~TICCMD_RECEIVED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// all tic are now proceed make the next
|
|
||||||
maketic++;
|
maketic++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -40,6 +40,7 @@
|
|||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "g_input.h"
|
#include "g_input.h"
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
|
#include "m_emotes.h"
|
||||||
#include "i_sound.h"
|
#include "i_sound.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "i_time.h"
|
#include "i_time.h"
|
||||||
@@ -898,14 +899,13 @@ void D_SRB2Loop(void)
|
|||||||
rendertimefrac_unpaused = FRACUNIT;
|
rendertimefrac_unpaused = FRACUNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (interp || doDisplay)
|
if (interp || doDisplay)
|
||||||
{
|
{
|
||||||
if (!frameskip)
|
if (!frameskip)
|
||||||
{
|
{
|
||||||
ranwipe = D_Display();
|
ranwipe = D_Display();
|
||||||
}
|
}
|
||||||
else if (frameskip)
|
else if (!dedicated)
|
||||||
{
|
{
|
||||||
// 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
|
||||||
@@ -928,7 +928,7 @@ void D_SRB2Loop(void)
|
|||||||
// consoleplayer -> displayplayers (hear sounds from viewpoint)
|
// consoleplayer -> displayplayers (hear sounds from viewpoint)
|
||||||
S_UpdateSounds(); // move positional sounds
|
S_UpdateSounds(); // move positional sounds
|
||||||
|
|
||||||
LUA_Step();
|
//LUA_Step();
|
||||||
|
|
||||||
#ifdef HAVE_DISCORDRPC
|
#ifdef HAVE_DISCORDRPC
|
||||||
if (!dedicated && renderisnewtic)
|
if (!dedicated && renderisnewtic)
|
||||||
@@ -2037,6 +2037,8 @@ void D_SRB2Main(void)
|
|||||||
|
|
||||||
S_InitMusicDefs();
|
S_InitMusicDefs();
|
||||||
|
|
||||||
|
M_InitEmotes();
|
||||||
|
|
||||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||||
ST_Init();
|
ST_Init();
|
||||||
|
|
||||||
|
|||||||
+9
-2
@@ -21,6 +21,7 @@
|
|||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
|
#include "m_emotes.h"
|
||||||
#include "g_input.h"
|
#include "g_input.h"
|
||||||
#include "m_menu.h"
|
#include "m_menu.h"
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
@@ -912,6 +913,8 @@ void D_RegisterClientCommands(void)
|
|||||||
|
|
||||||
CV_RegisterVar(&cv_keyboardlayout);
|
CV_RegisterVar(&cv_keyboardlayout);
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_emotes);
|
||||||
|
|
||||||
// time attack ghost options are also saved to config
|
// time attack ghost options are also saved to config
|
||||||
CV_RegisterVar(&cv_ghost_besttime);
|
CV_RegisterVar(&cv_ghost_besttime);
|
||||||
CV_RegisterVar(&cv_ghost_bestlap);
|
CV_RegisterVar(&cv_ghost_bestlap);
|
||||||
@@ -2110,14 +2113,18 @@ INT32 D_LookupPlayer(const char *s)
|
|||||||
static INT32 FindPlayerByPlace(INT32 place)
|
static INT32 FindPlayerByPlace(INT32 place)
|
||||||
{
|
{
|
||||||
INT32 playernum;
|
INT32 playernum;
|
||||||
|
|
||||||
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
||||||
if (playeringame[playernum])
|
|
||||||
{
|
{
|
||||||
|
if (!playeringame[playernum])
|
||||||
|
continue;
|
||||||
|
|
||||||
if (players[playernum].kartstuff[k_position] == place)
|
if (players[playernum].kartstuff[k_position] == place)
|
||||||
{
|
{
|
||||||
return playernum;
|
return playernum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5674,7 +5681,7 @@ static void Command_Archivetest_f(void)
|
|||||||
// assign mobjnum
|
// assign mobjnum
|
||||||
i = 1;
|
i = 1;
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
if (th->function == (actionf_p1)P_MobjThinker)
|
||||||
((mobj_t *)th)->mobjnum = i++;
|
((mobj_t *)th)->mobjnum = i++;
|
||||||
|
|
||||||
// allocate buffer
|
// allocate buffer
|
||||||
|
|||||||
+1
-8
@@ -28,18 +28,11 @@
|
|||||||
// To compile this as "ANSI C with classes" we will need to handle the various
|
// To compile this as "ANSI C with classes" we will need to handle the various
|
||||||
// action functions cleanly.
|
// action functions cleanly.
|
||||||
//
|
//
|
||||||
typedef void (*actionf_v)();
|
|
||||||
typedef void (*actionf_p1)(void *);
|
typedef void (*actionf_p1)(void *);
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
actionf_v acv;
|
|
||||||
actionf_p1 acp1;
|
|
||||||
} actionf_t;
|
|
||||||
|
|
||||||
// Historically, "think_t" is yet another function pointer to a routine
|
// Historically, "think_t" is yet another function pointer to a routine
|
||||||
// to handle an actor.
|
// to handle an actor.
|
||||||
typedef actionf_t think_t;
|
typedef actionf_p1 think_t;
|
||||||
|
|
||||||
// Doubly linked list of actors.
|
// Doubly linked list of actors.
|
||||||
typedef struct thinker_s
|
typedef struct thinker_s
|
||||||
|
|||||||
@@ -152,3 +152,8 @@ boolean I_UseNativeKeyboard(void)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I_SetBorderlessWindow(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
+217
-217
@@ -1416,211 +1416,211 @@ static void readhuditem(MYFILE *f, INT32 num)
|
|||||||
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONNUM ENUM IN INFO.H
|
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONNUM ENUM IN INFO.H
|
||||||
actionpointer_t actionpointers[] =
|
actionpointer_t actionpointers[] =
|
||||||
{
|
{
|
||||||
{{A_Explode}, "A_EXPLODE"},
|
{A_Explode, "A_EXPLODE"},
|
||||||
{{A_Pain}, "A_PAIN"},
|
{A_Pain, "A_PAIN"},
|
||||||
{{A_Fall}, "A_FALL"},
|
{A_Fall, "A_FALL"},
|
||||||
{{A_MonitorPop}, "A_MONITORPOP"},
|
{A_MonitorPop, "A_MONITORPOP"},
|
||||||
{{A_Look}, "A_LOOK"},
|
{A_Look, "A_LOOK"},
|
||||||
{{A_Chase}, "A_CHASE"},
|
{A_Chase, "A_CHASE"},
|
||||||
{{A_FaceStabChase}, "A_FACESTABCHASE"},
|
{A_FaceStabChase, "A_FACESTABCHASE"},
|
||||||
{{A_FaceTarget}, "A_FACETARGET"},
|
{A_FaceTarget, "A_FACETARGET"},
|
||||||
{{A_FaceTracer}, "A_FACETRACER"},
|
{A_FaceTracer, "A_FACETRACER"},
|
||||||
{{A_Scream}, "A_SCREAM"},
|
{A_Scream, "A_SCREAM"},
|
||||||
{{A_BossDeath}, "A_BOSSDEATH"},
|
{A_BossDeath, "A_BOSSDEATH"},
|
||||||
{{A_CustomPower}, "A_CUSTOMPOWER"},
|
{A_CustomPower, "A_CUSTOMPOWER"},
|
||||||
{{A_GiveWeapon}, "A_GIVEWEAPON"},
|
{A_GiveWeapon, "A_GIVEWEAPON"},
|
||||||
{{A_RingShield}, "A_RINGSHIELD"},
|
{A_RingShield, "A_RINGSHIELD"},
|
||||||
{{A_RingBox}, "A_RINGBOX"},
|
{A_RingBox, "A_RINGBOX"},
|
||||||
{{A_Invincibility}, "A_INVINCIBILITY"},
|
{A_Invincibility, "A_INVINCIBILITY"},
|
||||||
{{A_SuperSneakers}, "A_SUPERSNEAKERS"},
|
{A_SuperSneakers, "A_SUPERSNEAKERS"},
|
||||||
{{A_BunnyHop}, "A_BUNNYHOP"},
|
{A_BunnyHop, "A_BUNNYHOP"},
|
||||||
{{A_BubbleSpawn}, "A_BUBBLESPAWN"},
|
{A_BubbleSpawn, "A_BUBBLESPAWN"},
|
||||||
{{A_FanBubbleSpawn}, "A_FANBUBBLESPAWN"},
|
{A_FanBubbleSpawn, "A_FANBUBBLESPAWN"},
|
||||||
{{A_BubbleRise}, "A_BUBBLERISE"},
|
{A_BubbleRise, "A_BUBBLERISE"},
|
||||||
{{A_BubbleCheck}, "A_BUBBLECHECK"},
|
{A_BubbleCheck, "A_BUBBLECHECK"},
|
||||||
{{A_AwardScore}, "A_AWARDSCORE"},
|
{A_AwardScore, "A_AWARDSCORE"},
|
||||||
{{A_ExtraLife}, "A_EXTRALIFE"},
|
{A_ExtraLife, "A_EXTRALIFE"},
|
||||||
{{A_BombShield}, "A_BOMBSHIELD"},
|
{A_BombShield, "A_BOMBSHIELD"},
|
||||||
{{A_JumpShield}, "A_JUMPSHIELD"},
|
{A_JumpShield, "A_JUMPSHIELD"},
|
||||||
{{A_WaterShield}, "A_WATERSHIELD"},
|
{A_WaterShield, "A_WATERSHIELD"},
|
||||||
{{A_ForceShield}, "A_FORCESHIELD"},
|
{A_ForceShield, "A_FORCESHIELD"},
|
||||||
{{A_PityShield}, "A_PITYSHIELD"},
|
{A_PityShield, "A_PITYSHIELD"},
|
||||||
{{A_GravityBox}, "A_GRAVITYBOX"},
|
{A_GravityBox, "A_GRAVITYBOX"},
|
||||||
{{A_ScoreRise}, "A_SCORERISE"},
|
{A_ScoreRise, "A_SCORERISE"},
|
||||||
{{A_ParticleSpawn}, "A_PARTICLESPAWN"},
|
{A_ParticleSpawn, "A_PARTICLESPAWN"},
|
||||||
{{A_AttractChase}, "A_ATTRACTCHASE"},
|
{A_AttractChase, "A_ATTRACTCHASE"},
|
||||||
{{A_DropMine}, "A_DROPMINE"},
|
{A_DropMine, "A_DROPMINE"},
|
||||||
{{A_FishJump}, "A_FISHJUMP"},
|
{A_FishJump, "A_FISHJUMP"},
|
||||||
{{A_ThrownRing}, "A_THROWNRING"},
|
{A_ThrownRing, "A_THROWNRING"},
|
||||||
{{A_GrenadeRing}, "A_GRENADERING"}, // SRB2kart
|
{A_GrenadeRing, "A_GRENADERING"}, // SRB2kart
|
||||||
{{A_SetSolidSteam}, "A_SETSOLIDSTEAM"},
|
{A_SetSolidSteam, "A_SETSOLIDSTEAM"},
|
||||||
{{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"},
|
{A_UnsetSolidSteam, "A_UNSETSOLIDSTEAM"},
|
||||||
{{A_SignPlayer}, "A_SIGNPLAYER"},
|
{A_SignPlayer, "A_SIGNPLAYER"},
|
||||||
{{A_OverlayThink}, "A_OVERLAYTHINK"},
|
{A_OverlayThink, "A_OVERLAYTHINK"},
|
||||||
{{A_JetChase}, "A_JETCHASE"},
|
{A_JetChase, "A_JETCHASE"},
|
||||||
{{A_JetbThink}, "A_JETBTHINK"},
|
{A_JetbThink, "A_JETBTHINK"},
|
||||||
{{A_JetgThink}, "A_JETGTHINK"},
|
{A_JetgThink, "A_JETGTHINK"},
|
||||||
{{A_JetgShoot}, "A_JETGSHOOT"},
|
{A_JetgShoot, "A_JETGSHOOT"},
|
||||||
{{A_ShootBullet}, "A_SHOOTBULLET"},
|
{A_ShootBullet, "A_SHOOTBULLET"},
|
||||||
{{A_MinusDigging}, "A_MINUSDIGGING"},
|
{A_MinusDigging, "A_MINUSDIGGING"},
|
||||||
{{A_MinusPopup}, "A_MINUSPOPUP"},
|
{A_MinusPopup, "A_MINUSPOPUP"},
|
||||||
{{A_MinusCheck}, "A_MINUSCHECK"},
|
{A_MinusCheck, "A_MINUSCHECK"},
|
||||||
{{A_ChickenCheck}, "A_CHICKENCHECK"},
|
{A_ChickenCheck, "A_CHICKENCHECK"},
|
||||||
{{A_MouseThink}, "A_MOUSETHINK"},
|
{A_MouseThink, "A_MOUSETHINK"},
|
||||||
{{A_DetonChase}, "A_DETONCHASE"},
|
{A_DetonChase, "A_DETONCHASE"},
|
||||||
{{A_CapeChase}, "A_CAPECHASE"},
|
{A_CapeChase, "A_CAPECHASE"},
|
||||||
{{A_RotateSpikeBall}, "A_ROTATESPIKEBALL"},
|
{A_RotateSpikeBall, "A_ROTATESPIKEBALL"},
|
||||||
{{A_SlingAppear}, "A_SLINGAPPEAR"},
|
{A_SlingAppear, "A_SLINGAPPEAR"},
|
||||||
{{A_MaceRotate}, "A_MACEROTATE"},
|
{A_MaceRotate, "A_MACEROTATE"},
|
||||||
{{A_UnidusBall}, "A_UNIDUSBALL"},
|
{A_UnidusBall, "A_UNIDUSBALL"},
|
||||||
{{A_RockSpawn}, "A_ROCKSPAWN"},
|
{A_RockSpawn, "A_ROCKSPAWN"},
|
||||||
{{A_SetFuse}, "A_SETFUSE"},
|
{A_SetFuse, "A_SETFUSE"},
|
||||||
{{A_CrawlaCommanderThink}, "A_CRAWLACOMMANDERTHINK"},
|
{A_CrawlaCommanderThink, "A_CRAWLACOMMANDERTHINK"},
|
||||||
{{A_SmokeTrailer}, "A_SMOKETRAILER"},
|
{A_SmokeTrailer, "A_SMOKETRAILER"},
|
||||||
{{A_RingExplode}, "A_RINGEXPLODE"},
|
{A_RingExplode, "A_RINGEXPLODE"},
|
||||||
{{A_OldRingExplode}, "A_OLDRINGEXPLODE"},
|
{A_OldRingExplode, "A_OLDRINGEXPLODE"},
|
||||||
{{A_MixUp}, "A_MIXUP"},
|
{A_MixUp, "A_MIXUP"},
|
||||||
{{A_RecyclePowers}, "A_RECYCLEPOWERS"},
|
{A_RecyclePowers, "A_RECYCLEPOWERS"},
|
||||||
{{A_Boss1Chase}, "A_BOSS1CHASE"},
|
{A_Boss1Chase, "A_BOSS1CHASE"},
|
||||||
{{A_FocusTarget}, "A_FOCUSTARGET"},
|
{A_FocusTarget, "A_FOCUSTARGET"},
|
||||||
{{A_Boss2Chase}, "A_BOSS2CHASE"},
|
{A_Boss2Chase, "A_BOSS2CHASE"},
|
||||||
{{A_Boss2Pogo}, "A_BOSS2POGO"},
|
{A_Boss2Pogo, "A_BOSS2POGO"},
|
||||||
{{A_BossZoom}, "A_BOSSZOOM"},
|
{A_BossZoom, "A_BOSSZOOM"},
|
||||||
{{A_BossScream}, "A_BOSSSCREAM"},
|
{A_BossScream, "A_BOSSSCREAM"},
|
||||||
{{A_Boss2TakeDamage}, "A_BOSS2TAKEDAMAGE"},
|
{A_Boss2TakeDamage, "A_BOSS2TAKEDAMAGE"},
|
||||||
{{A_Boss7Chase}, "A_BOSS7CHASE"},
|
{A_Boss7Chase, "A_BOSS7CHASE"},
|
||||||
{{A_GoopSplat}, "A_GOOPSPLAT"},
|
{A_GoopSplat, "A_GOOPSPLAT"},
|
||||||
{{A_Boss2PogoSFX}, "A_BOSS2POGOSFX"},
|
{A_Boss2PogoSFX, "A_BOSS2POGOSFX"},
|
||||||
{{A_Boss2PogoTarget}, "A_BOSS2POGOTARGET"},
|
{A_Boss2PogoTarget, "A_BOSS2POGOTARGET"},
|
||||||
{{A_BossJetFume}, "A_BOSSJETFUME"},
|
{A_BossJetFume, "A_BOSSJETFUME"},
|
||||||
{{A_EggmanBox}, "A_EGGMANBOX"},
|
{A_EggmanBox, "A_EGGMANBOX"},
|
||||||
{{A_TurretFire}, "A_TURRETFIRE"},
|
{A_TurretFire, "A_TURRETFIRE"},
|
||||||
{{A_SuperTurretFire}, "A_SUPERTURRETFIRE"},
|
{A_SuperTurretFire, "A_SUPERTURRETFIRE"},
|
||||||
{{A_TurretStop}, "A_TURRETSTOP"},
|
{A_TurretStop, "A_TURRETSTOP"},
|
||||||
{{A_JetJawRoam}, "A_JETJAWROAM"},
|
{A_JetJawRoam, "A_JETJAWROAM"},
|
||||||
{{A_JetJawChomp}, "A_JETJAWCHOMP"},
|
{A_JetJawChomp, "A_JETJAWCHOMP"},
|
||||||
{{A_PointyThink}, "A_POINTYTHINK"},
|
{A_PointyThink, "A_POINTYTHINK"},
|
||||||
{{A_CheckBuddy}, "A_CHECKBUDDY"},
|
{A_CheckBuddy, "A_CHECKBUDDY"},
|
||||||
{{A_HoodThink}, "A_HOODTHINK"},
|
{A_HoodThink, "A_HOODTHINK"},
|
||||||
{{A_ArrowCheck}, "A_ARROWCHECK"},
|
{A_ArrowCheck, "A_ARROWCHECK"},
|
||||||
{{A_SnailerThink}, "A_SNAILERTHINK"},
|
{A_SnailerThink, "A_SNAILERTHINK"},
|
||||||
{{A_SharpChase}, "A_SHARPCHASE"},
|
{A_SharpChase, "A_SHARPCHASE"},
|
||||||
{{A_SharpSpin}, "A_SHARPSPIN"},
|
{A_SharpSpin, "A_SHARPSPIN"},
|
||||||
{{A_VultureVtol}, "A_VULTUREVTOL"},
|
{A_VultureVtol, "A_VULTUREVTOL"},
|
||||||
{{A_VultureCheck}, "A_VULTURECHECK"},
|
{A_VultureCheck, "A_VULTURECHECK"},
|
||||||
{{A_SkimChase}, "A_SKIMCHASE"},
|
{A_SkimChase, "A_SKIMCHASE"},
|
||||||
{{A_1upThinker}, "A_1UPTHINKER"},
|
{A_1upThinker, "A_1UPTHINKER"},
|
||||||
{{A_SkullAttack}, "A_SKULLATTACK"},
|
{A_SkullAttack, "A_SKULLATTACK"},
|
||||||
{{A_LobShot}, "A_LOBSHOT"},
|
{A_LobShot, "A_LOBSHOT"},
|
||||||
{{A_FireShot}, "A_FIRESHOT"},
|
{A_FireShot, "A_FIRESHOT"},
|
||||||
{{A_SuperFireShot}, "A_SUPERFIRESHOT"},
|
{A_SuperFireShot, "A_SUPERFIRESHOT"},
|
||||||
{{A_BossFireShot}, "A_BOSSFIRESHOT"},
|
{A_BossFireShot, "A_BOSSFIRESHOT"},
|
||||||
{{A_Boss7FireMissiles}, "A_BOSS7FIREMISSILES"},
|
{A_Boss7FireMissiles, "A_BOSS7FIREMISSILES"},
|
||||||
{{A_Boss1Laser}, "A_BOSS1LASER"},
|
{A_Boss1Laser, "A_BOSS1LASER"},
|
||||||
{{A_Boss4Reverse}, "A_BOSS4REVERSE"},
|
{A_Boss4Reverse, "A_BOSS4REVERSE"},
|
||||||
{{A_Boss4SpeedUp}, "A_BOSS4SPEEDUP"},
|
{A_Boss4SpeedUp, "A_BOSS4SPEEDUP"},
|
||||||
{{A_Boss4Raise}, "A_BOSS4RAISE"},
|
{A_Boss4Raise, "A_BOSS4RAISE"},
|
||||||
{{A_SparkFollow}, "A_SPARKFOLLOW"},
|
{A_SparkFollow, "A_SPARKFOLLOW"},
|
||||||
{{A_BuzzFly}, "A_BUZZFLY"},
|
{A_BuzzFly, "A_BUZZFLY"},
|
||||||
{{A_GuardChase}, "A_GUARDCHASE"},
|
{A_GuardChase, "A_GUARDCHASE"},
|
||||||
{{A_EggShield}, "A_EGGSHIELD"},
|
{A_EggShield, "A_EGGSHIELD"},
|
||||||
{{A_SetReactionTime}, "A_SETREACTIONTIME"},
|
{A_SetReactionTime, "A_SETREACTIONTIME"},
|
||||||
{{A_Boss1Spikeballs}, "A_BOSS1SPIKEBALLS"},
|
{A_Boss1Spikeballs, "A_BOSS1SPIKEBALLS"},
|
||||||
{{A_Boss3TakeDamage}, "A_BOSS3TAKEDAMAGE"},
|
{A_Boss3TakeDamage, "A_BOSS3TAKEDAMAGE"},
|
||||||
{{A_Boss3Path}, "A_BOSS3PATH"},
|
{A_Boss3Path, "A_BOSS3PATH"},
|
||||||
{{A_LinedefExecute}, "A_LINEDEFEXECUTE"},
|
{A_LinedefExecute, "A_LINEDEFEXECUTE"},
|
||||||
{{A_PlaySeeSound}, "A_PLAYSEESOUND"},
|
{A_PlaySeeSound, "A_PLAYSEESOUND"},
|
||||||
{{A_PlayAttackSound}, "A_PLAYATTACKSOUND"},
|
{A_PlayAttackSound, "A_PLAYATTACKSOUND"},
|
||||||
{{A_PlayActiveSound}, "A_PLAYACTIVESOUND"},
|
{A_PlayActiveSound, "A_PLAYACTIVESOUND"},
|
||||||
{{A_SpawnObjectAbsolute}, "A_SPAWNOBJECTABSOLUTE"},
|
{A_SpawnObjectAbsolute, "A_SPAWNOBJECTABSOLUTE"},
|
||||||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
{A_SpawnObjectRelative, "A_SPAWNOBJECTRELATIVE"},
|
||||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
{A_ChangeAngleRelative, "A_CHANGEANGLERELATIVE"},
|
||||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
{A_ChangeAngleAbsolute, "A_CHANGEANGLEABSOLUTE"},
|
||||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
{A_PlaySound, "A_PLAYSOUND"},
|
||||||
{{A_FindTarget}, "A_FINDTARGET"},
|
{A_FindTarget, "A_FINDTARGET"},
|
||||||
{{A_FindTracer}, "A_FINDTRACER"},
|
{A_FindTracer, "A_FINDTRACER"},
|
||||||
{{A_SetTics}, "A_SETTICS"},
|
{A_SetTics, "A_SETTICS"},
|
||||||
{{A_SetRandomTics}, "A_SETRANDOMTICS"},
|
{A_SetRandomTics, "A_SETRANDOMTICS"},
|
||||||
{{A_ChangeColorRelative}, "A_CHANGECOLORRELATIVE"},
|
{A_ChangeColorRelative, "A_CHANGECOLORRELATIVE"},
|
||||||
{{A_ChangeColorAbsolute}, "A_CHANGECOLORABSOLUTE"},
|
{A_ChangeColorAbsolute, "A_CHANGECOLORABSOLUTE"},
|
||||||
{{A_MoveRelative}, "A_MOVERELATIVE"},
|
{A_MoveRelative, "A_MOVERELATIVE"},
|
||||||
{{A_MoveAbsolute}, "A_MOVEABSOLUTE"},
|
{A_MoveAbsolute, "A_MOVEABSOLUTE"},
|
||||||
{{A_Thrust}, "A_THRUST"},
|
{A_Thrust, "A_THRUST"},
|
||||||
{{A_ZThrust}, "A_ZTHRUST"},
|
{A_ZThrust, "A_ZTHRUST"},
|
||||||
{{A_SetTargetsTarget}, "A_SETTARGETSTARGET"},
|
{A_SetTargetsTarget, "A_SETTARGETSTARGET"},
|
||||||
{{A_SetObjectFlags}, "A_SETOBJECTFLAGS"},
|
{A_SetObjectFlags, "A_SETOBJECTFLAGS"},
|
||||||
{{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"},
|
{A_SetObjectFlags2, "A_SETOBJECTFLAGS2"},
|
||||||
{{A_RandomState}, "A_RANDOMSTATE"},
|
{A_RandomState, "A_RANDOMSTATE"},
|
||||||
{{A_RandomStateRange}, "A_RANDOMSTATERANGE"},
|
{A_RandomStateRange, "A_RANDOMSTATERANGE"},
|
||||||
{{A_DualAction}, "A_DUALACTION"},
|
{A_DualAction, "A_DUALACTION"},
|
||||||
{{A_RemoteAction}, "A_REMOTEACTION"},
|
{A_RemoteAction, "A_REMOTEACTION"},
|
||||||
{{A_ToggleFlameJet}, "A_TOGGLEFLAMEJET"},
|
{A_ToggleFlameJet, "A_TOGGLEFLAMEJET"},
|
||||||
{{A_ItemPop}, "A_ITEMPOP"}, // SRB2kart
|
{A_ItemPop, "A_ITEMPOP"}, // SRB2kart
|
||||||
{{A_JawzChase}, "A_JAWZCHASE"}, // SRB2kart
|
{A_JawzChase, "A_JAWZCHASE"}, // SRB2kart
|
||||||
{{A_JawzExplode}, "A_JAWZEXPLODE"}, // SRB2kart
|
{A_JawzExplode, "A_JAWZEXPLODE"}, // SRB2kart
|
||||||
{{A_SPBChase}, "A_SPBCHASE"}, // SRB2kart
|
{A_SPBChase, "A_SPBCHASE"}, // SRB2kart
|
||||||
{{A_MineExplode}, "A_MINEEXPLODE"}, // SRB2kart
|
{A_MineExplode, "A_MINEEXPLODE"}, // SRB2kart
|
||||||
{{A_BallhogExplode}, "A_BALLHOGEXPLODE"}, // SRB2kart
|
{A_BallhogExplode, "A_BALLHOGEXPLODE"}, // SRB2kart
|
||||||
{{A_LightningFollowPlayer},"A_LIGHTNINGFOLLOWPLAYER"}, //SRB2kart
|
{A_LightningFollowPlayer,"A_LIGHTNINGFOLLOWPLAYER"}, //SRB2kart
|
||||||
{{A_FZBoomFlash}, "A_FZBOOMFLASH"}, //SRB2kart
|
{A_FZBoomFlash, "A_FZBOOMFLASH"}, //SRB2kart
|
||||||
{{A_FZBoomSmoke}, "A_FZBOOMSMOKE"}, //SRB2kart
|
{A_FZBoomSmoke, "A_FZBOOMSMOKE"}, //SRB2kart
|
||||||
{{A_RandomShadowFrame}, "A_RANDOMSHADOWFRAME"}, //SRB2kart
|
{A_RandomShadowFrame, "A_RANDOMSHADOWFRAME"}, //SRB2kart
|
||||||
{{A_RoamingShadowThinker}, "A_ROAMINGSHADOWTHINKER"}, //SRB2kart
|
{A_RoamingShadowThinker, "A_ROAMINGSHADOWTHINKER"}, //SRB2kart
|
||||||
{{A_MayonakaArrow}, "A_MAYONAKAARROW"}, //SRB2kart
|
{A_MayonakaArrow, "A_MAYONAKAARROW"}, //SRB2kart
|
||||||
{{A_ReaperThinker}, "A_REAPERTHINKER"}, //SRB2kart
|
{A_ReaperThinker, "A_REAPERTHINKER"}, //SRB2kart
|
||||||
{{A_MementosTPParticles}, "A_MEMENTOSTPPARTICLES"}, //SRB2kart
|
{A_MementosTPParticles, "A_MEMENTOSTPPARTICLES"}, //SRB2kart
|
||||||
{{A_FlameParticle}, "A_FLAMEPARTICLE"}, // SRB2kart
|
{A_FlameParticle, "A_FLAMEPARTICLE"}, // SRB2kart
|
||||||
{{A_OrbitNights}, "A_ORBITNIGHTS"},
|
{A_OrbitNights, "A_ORBITNIGHTS"},
|
||||||
{{A_GhostMe}, "A_GHOSTME"},
|
{A_GhostMe, "A_GHOSTME"},
|
||||||
{{A_SetObjectState}, "A_SETOBJECTSTATE"},
|
{A_SetObjectState, "A_SETOBJECTSTATE"},
|
||||||
{{A_SetObjectTypeState}, "A_SETOBJECTTYPESTATE"},
|
{A_SetObjectTypeState, "A_SETOBJECTTYPESTATE"},
|
||||||
{{A_KnockBack}, "A_KNOCKBACK"},
|
{A_KnockBack, "A_KNOCKBACK"},
|
||||||
{{A_PushAway}, "A_PUSHAWAY"},
|
{A_PushAway, "A_PUSHAWAY"},
|
||||||
{{A_RingDrain}, "A_RINGDRAIN"},
|
{A_RingDrain, "A_RINGDRAIN"},
|
||||||
{{A_SplitShot}, "A_SPLITSHOT"},
|
{A_SplitShot, "A_SPLITSHOT"},
|
||||||
{{A_MissileSplit}, "A_MISSILESPLIT"},
|
{A_MissileSplit, "A_MISSILESPLIT"},
|
||||||
{{A_MultiShot}, "A_MULTISHOT"},
|
{A_MultiShot, "A_MULTISHOT"},
|
||||||
{{A_InstaLoop}, "A_INSTALOOP"},
|
{A_InstaLoop, "A_INSTALOOP"},
|
||||||
{{A_Custom3DRotate}, "A_CUSTOM3DROTATE"},
|
{A_Custom3DRotate, "A_CUSTOM3DROTATE"},
|
||||||
{{A_SearchForPlayers}, "A_SEARCHFORPLAYERS"},
|
{A_SearchForPlayers, "A_SEARCHFORPLAYERS"},
|
||||||
{{A_CheckRandom}, "A_CHECKRANDOM"},
|
{A_CheckRandom, "A_CHECKRANDOM"},
|
||||||
{{A_CheckTargetRings}, "A_CHECKTARGETRINGS"},
|
{A_CheckTargetRings, "A_CHECKTARGETRINGS"},
|
||||||
{{A_CheckRings}, "A_CHECKRINGS"},
|
{A_CheckRings, "A_CHECKRINGS"},
|
||||||
{{A_CheckTotalRings}, "A_CHECKTOTALRINGS"},
|
{A_CheckTotalRings, "A_CHECKTOTALRINGS"},
|
||||||
{{A_CheckHealth}, "A_CHECKHEALTH"},
|
{A_CheckHealth, "A_CHECKHEALTH"},
|
||||||
{{A_CheckRange}, "A_CHECKRANGE"},
|
{A_CheckRange, "A_CHECKRANGE"},
|
||||||
{{A_CheckHeight}, "A_CHECKHEIGHT"},
|
{A_CheckHeight, "A_CHECKHEIGHT"},
|
||||||
{{A_CheckTrueRange}, "A_CHECKTRUERANGE"},
|
{A_CheckTrueRange, "A_CHECKTRUERANGE"},
|
||||||
{{A_CheckThingCount}, "A_CHECKTHINGCOUNT"},
|
{A_CheckThingCount, "A_CHECKTHINGCOUNT"},
|
||||||
{{A_CheckAmbush}, "A_CHECKAMBUSH"},
|
{A_CheckAmbush, "A_CHECKAMBUSH"},
|
||||||
{{A_CheckCustomValue}, "A_CHECKCUSTOMVALUE"},
|
{A_CheckCustomValue, "A_CHECKCUSTOMVALUE"},
|
||||||
{{A_CheckCusValMemo}, "A_CHECKCUSVALMEMO"},
|
{A_CheckCusValMemo, "A_CHECKCUSVALMEMO"},
|
||||||
{{A_SetCustomValue}, "A_SETCUSTOMVALUE"},
|
{A_SetCustomValue, "A_SETCUSTOMVALUE"},
|
||||||
{{A_UseCusValMemo}, "A_USECUSVALMEMO"},
|
{A_UseCusValMemo, "A_USECUSVALMEMO"},
|
||||||
{{A_RelayCustomValue}, "A_RELAYCUSTOMVALUE"},
|
{A_RelayCustomValue, "A_RELAYCUSTOMVALUE"},
|
||||||
{{A_CusValAction}, "A_CUSVALACTION"},
|
{A_CusValAction, "A_CUSVALACTION"},
|
||||||
{{A_ForceStop}, "A_FORCESTOP"},
|
{A_ForceStop, "A_FORCESTOP"},
|
||||||
{{A_ForceWin}, "A_FORCEWIN"},
|
{A_ForceWin, "A_FORCEWIN"},
|
||||||
{{A_SpikeRetract}, "A_SPIKERETRACT"},
|
{A_SpikeRetract, "A_SPIKERETRACT"},
|
||||||
{{A_InfoState}, "A_INFOSTATE"},
|
{A_InfoState, "A_INFOSTATE"},
|
||||||
{{A_Repeat}, "A_REPEAT"},
|
{A_Repeat, "A_REPEAT"},
|
||||||
{{A_SetScale}, "A_SETSCALE"},
|
{A_SetScale, "A_SETSCALE"},
|
||||||
{{A_RemoteDamage}, "A_REMOTEDAMAGE"},
|
{A_RemoteDamage, "A_REMOTEDAMAGE"},
|
||||||
{{A_HomingChase}, "A_HOMINGCHASE"},
|
{A_HomingChase, "A_HOMINGCHASE"},
|
||||||
{{A_TrapShot}, "A_TRAPSHOT"},
|
{A_TrapShot, "A_TRAPSHOT"},
|
||||||
{{A_VileTarget}, "A_VILETARGET"},
|
{A_VileTarget, "A_VILETARGET"},
|
||||||
{{A_VileAttack}, "A_VILEATTACK"},
|
{A_VileAttack, "A_VILEATTACK"},
|
||||||
{{A_VileFire}, "A_VILEFIRE"},
|
{A_VileFire, "A_VILEFIRE"},
|
||||||
{{A_BrakChase}, "A_BRAKCHASE"},
|
{A_BrakChase, "A_BRAKCHASE"},
|
||||||
{{A_BrakFireShot}, "A_BRAKFIRESHOT"},
|
{A_BrakFireShot, "A_BRAKFIRESHOT"},
|
||||||
{{A_BrakLobShot}, "A_BRAKLOBSHOT"},
|
{A_BrakLobShot, "A_BRAKLOBSHOT"},
|
||||||
{{A_NapalmScatter}, "A_NAPALMSCATTER"},
|
{A_NapalmScatter, "A_NAPALMSCATTER"},
|
||||||
{{A_SpawnFreshCopy}, "A_SPAWNFRESHCOPY"},
|
{A_SpawnFreshCopy, "A_SPAWNFRESHCOPY"},
|
||||||
|
|
||||||
{{NULL}, "NONE"},
|
{NULL, "NONE"},
|
||||||
|
|
||||||
// This NULL entry must be the last in the list
|
// This NULL entry must be the last in the list
|
||||||
{{NULL}, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void readframe(MYFILE *f, INT32 num)
|
static void readframe(MYFILE *f, INT32 num)
|
||||||
@@ -1702,7 +1702,7 @@ static void readframe(MYFILE *f, INT32 num)
|
|||||||
|
|
||||||
for (z = 0; actionpointers[z].name; z++)
|
for (z = 0; actionpointers[z].name; z++)
|
||||||
{
|
{
|
||||||
if (actionpointers[z].action.acv == states[num].action.acv)
|
if (actionpointers[z].action == states[num].action)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1711,17 +1711,17 @@ static void readframe(MYFILE *f, INT32 num)
|
|||||||
z = 0;
|
z = 0;
|
||||||
found = LUA_SetLuaAction(&states[num], actiontocompare);
|
found = LUA_SetLuaAction(&states[num], actiontocompare);
|
||||||
if (!found)
|
if (!found)
|
||||||
while (actionpointers[z].name)
|
|
||||||
{
|
{
|
||||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
while (actionpointers[z].name)
|
||||||
{
|
{
|
||||||
states[num].action = actionpointers[z].action;
|
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||||
states[num].action.acv = actionpointers[z].action.acv; // assign
|
{
|
||||||
states[num].action.acp1 = actionpointers[z].action.acp1;
|
states[num].action = actionpointers[z].action;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
z++;
|
||||||
}
|
}
|
||||||
z++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
@@ -8524,13 +8524,13 @@ static inline int lib_freeslot(lua_State *L)
|
|||||||
// Arguments: mobj_t actor, int var1, int var2
|
// Arguments: mobj_t actor, int var1, int var2
|
||||||
static inline int lib_action(lua_State *L)
|
static inline int lib_action(lua_State *L)
|
||||||
{
|
{
|
||||||
actionf_t *action = lua_touserdata(L,lua_upvalueindex(1));
|
actionf_p1 *action = lua_touserdata(L,lua_upvalueindex(1));
|
||||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L,1,META_MOBJ));
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L,1,META_MOBJ));
|
||||||
var1 = (INT32)luaL_optinteger(L,2,0);
|
var1 = (INT32)luaL_optinteger(L,2,0);
|
||||||
var2 = (INT32)luaL_optinteger(L,3,0);
|
var2 = (INT32)luaL_optinteger(L,3,0);
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
action->acp1(actor);
|
(*action)(actor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9344,13 +9344,15 @@ int LUA_SOCLib(lua_State *L)
|
|||||||
|
|
||||||
const char *LUA_GetActionName(void *action)
|
const char *LUA_GetActionName(void *action)
|
||||||
{
|
{
|
||||||
actionf_t *act = (actionf_t *)action;
|
actionf_p1 *act = (actionf_p1 *)action;
|
||||||
size_t z;
|
size_t z;
|
||||||
|
|
||||||
for (z = 0; actionpointers[z].name; z++)
|
for (z = 0; actionpointers[z].name; z++)
|
||||||
{
|
{
|
||||||
if (actionpointers[z].action.acv == act->acv)
|
if (actionpointers[z].action == *act)
|
||||||
return actionpointers[z].name;
|
return actionpointers[z].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9363,8 +9365,6 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
|
|||||||
if (fasticmp(actiontocompare, actionpointers[z].name))
|
if (fasticmp(actiontocompare, actionpointers[z].name))
|
||||||
{
|
{
|
||||||
st->action = actionpointers[z].action;
|
st->action = actionpointers[z].action;
|
||||||
st->action.acv = actionpointers[z].action.acv; // assign
|
|
||||||
st->action.acp1 = actionpointers[z].action.acp1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -70,7 +70,11 @@ extern "C" {
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
|
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <cmath>
|
||||||
|
#else
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -111,8 +115,8 @@ extern char logfilename[1024];
|
|||||||
#else
|
#else
|
||||||
#define VERSION 1 // Game version
|
#define VERSION 1 // Game version
|
||||||
#define SUBVERSION 6 // more precise version number
|
#define SUBVERSION 6 // more precise version number
|
||||||
#define VERSIONSTRING "Saturn v8.2"
|
#define VERSIONSTRING "Saturn v8.3"
|
||||||
#define VERSIONSTRINGW L"Saturn v8.2"
|
#define VERSIONSTRINGW L"Saturn v8.3"
|
||||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||||
// AND appveyor.yml, for the build bots!
|
// AND appveyor.yml, for the build bots!
|
||||||
|
|||||||
+11
-10
@@ -365,8 +365,8 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
char searchpath[1024];
|
char searchpath[1024];
|
||||||
size_t *searchpathindex;
|
size_t *searchpathindex;
|
||||||
|
|
||||||
dirhandle = (DIR**) malloc(maxsearchdepth * sizeof (DIR*));
|
dirhandle = (DIR**) malloc(maxsearchdepth * sizeof(DIR*));
|
||||||
searchpathindex = (size_t *) malloc(maxsearchdepth * sizeof (size_t));
|
searchpathindex = (size_t *) malloc(maxsearchdepth * sizeof(size_t));
|
||||||
|
|
||||||
strcpy(searchpath,startpath);
|
strcpy(searchpath,startpath);
|
||||||
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
||||||
@@ -410,14 +410,14 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
}
|
}
|
||||||
|
|
||||||
// okay, now we actually want searchpath to incorporate d_name
|
// okay, now we actually want searchpath to incorporate d_name
|
||||||
strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
|
strcpy(&searchpath[searchpathindex[depthleft]], dent->d_name);
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__)
|
#if defined(__linux__) || defined(__FreeBSD__)
|
||||||
if (dent->d_type == DT_UNKNOWN && lstat(searchpath,&fsstat) == 0)
|
if (dent->d_type == DT_UNKNOWN && lstat(searchpath, &fsstat) == 0)
|
||||||
{
|
{
|
||||||
if (S_ISDIR(fsstat.st_mode))
|
if (S_ISDIR(fsstat.st_mode))
|
||||||
dent->d_type = DT_DIR;
|
dent->d_type = DT_DIR;
|
||||||
else if (S_ISLNK(fsstat.st_mode))
|
else if (S_ISLNK(fsstat.st_mode))
|
||||||
dent->d_type = DT_LNK;
|
dent->d_type = DT_LNK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,11 +439,12 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
{
|
{
|
||||||
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
||||||
dirhandle[depthleft] = opendir(searchpath);
|
dirhandle[depthleft] = opendir(searchpath);
|
||||||
|
|
||||||
if (!dirhandle[depthleft])
|
if (!dirhandle[depthleft])
|
||||||
{
|
{
|
||||||
// can't open it... maybe no read-permissions
|
// can't open it... maybe no read-permissions
|
||||||
// go back to previous dir
|
// go back to previous dir
|
||||||
depthleft++;
|
depthleft++;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
||||||
@@ -455,9 +456,9 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
{
|
{
|
||||||
case FS_FOUND:
|
case FS_FOUND:
|
||||||
if (completepath)
|
if (completepath)
|
||||||
strcpy(filename,searchpath);
|
strcpy(filename, searchpath);
|
||||||
else
|
else
|
||||||
strcpy(filename,dent->d_name);
|
strcpy(filename, dent->d_name);
|
||||||
retval = FS_FOUND;
|
retval = FS_FOUND;
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+2
-2
@@ -1051,7 +1051,7 @@ void G_ConsGhostTic(INT32 playernum)
|
|||||||
mobj = NULL;
|
mobj = NULL;
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
mobj = (mobj_t *)th;
|
mobj = (mobj_t *)th;
|
||||||
if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z)
|
if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z)
|
||||||
@@ -3701,7 +3701,7 @@ void G_DoPlayMetal(void)
|
|||||||
// find metal sonic
|
// find metal sonic
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo = (mobj_t *)th;
|
mo = (mobj_t *)th;
|
||||||
|
|||||||
+2
-2
@@ -109,7 +109,7 @@ boolean addedtogame;
|
|||||||
player_t players[MAXPLAYERS];
|
player_t players[MAXPLAYERS];
|
||||||
|
|
||||||
INT32 consoleplayer; // player taking events and displaying
|
INT32 consoleplayer; // player taking events and displaying
|
||||||
INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed
|
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {0}; // view being displayed
|
||||||
|
|
||||||
tic_t gametic;
|
tic_t gametic;
|
||||||
tic_t levelstarttic; // gametic at level start
|
tic_t levelstarttic; // gametic at level start
|
||||||
@@ -2562,7 +2562,7 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
|
|||||||
// scan all thinkers
|
// scan all thinkers
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ extern "C" {
|
|||||||
#include "hw_data.h"
|
#include "hw_data.h"
|
||||||
#include "hw_gl.h"
|
#include "hw_gl.h"
|
||||||
|
|
||||||
extern boolean currently_batching;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
|
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
|
||||||
|
|||||||
+208
-136
@@ -48,14 +48,20 @@ typedef struct
|
|||||||
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
|
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
|
||||||
boolean gl_maphasportals = false;
|
boolean gl_maphasportals = false;
|
||||||
|
|
||||||
|
// Determine on mapload if current map has any Horizonlines present
|
||||||
|
// so we can avoid rather hot checks in HWR_Subsector
|
||||||
|
boolean gl_maphashorizonlines = false;
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// FLOOR & CEILING CONVEX POLYS GENERATION
|
// FLOOR & CEILING CONVEX POLYS GENERATION
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
//debug counters
|
//debug counters
|
||||||
|
#ifdef DEBUG_HWBSP
|
||||||
static INT32 nobackpoly = 0;
|
static INT32 nobackpoly = 0;
|
||||||
static INT32 skipcut = 0;
|
static INT32 skipcut = 0;
|
||||||
static INT32 totalsubsecpolys = 0;
|
static INT32 totalsubsecpolys = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Polygon fast alloc / free
|
// Polygon fast alloc / free
|
||||||
@@ -96,8 +102,8 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
|||||||
double frac;
|
double frac;
|
||||||
double num;
|
double num;
|
||||||
double den;
|
double den;
|
||||||
double v1x,v1y,v1dx,v1dy;
|
double v1x, v1y, v1dx, v1dy;
|
||||||
double v2x,v2y,v2dx,v2dy;
|
double v2x, v2y, v2dx, v2dy;
|
||||||
|
|
||||||
// a segment of a polygon
|
// a segment of a polygon
|
||||||
v1x = v1->x;
|
v1x = v1->x;
|
||||||
@@ -112,6 +118,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
|||||||
v2dy = bsp->dy;
|
v2dy = bsp->dy;
|
||||||
|
|
||||||
den = v2dy*v1dx - v2dx*v1dy;
|
den = v2dy*v1dx - v2dx*v1dy;
|
||||||
|
|
||||||
if (fabsf((float)den) < 1.0E-36f) // avoid checking exactly for 0.0
|
if (fabsf((float)den) < 1.0E-36f) // avoid checking exactly for 0.0
|
||||||
return NULL; // parallel
|
return NULL; // parallel
|
||||||
|
|
||||||
@@ -119,6 +126,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
|||||||
// (do not accept hit with the extensions)
|
// (do not accept hit with the extensions)
|
||||||
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
||||||
frac = num / den;
|
frac = num / den;
|
||||||
|
|
||||||
if (frac < 0.0l || frac > 1.0l)
|
if (frac < 0.0l || frac > 1.0l)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -128,7 +136,6 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
|||||||
frac = num / den;
|
frac = num / den;
|
||||||
bspfrac = (float)frac;
|
bspfrac = (float)frac;
|
||||||
|
|
||||||
|
|
||||||
// find the interception point along the partition line
|
// find the interception point along the partition line
|
||||||
pt.x = (float)(v2x + v2dx*frac);
|
pt.x = (float)(v2x + v2dx*frac);
|
||||||
pt.y = (float)(v2y + v2dy*frac);
|
pt.y = (float)(v2y + v2dy*frac);
|
||||||
@@ -136,37 +143,18 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
|||||||
return &pt;
|
return &pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DIVLINE_VERTEX_DIFF 0.45f
|
||||||
|
|
||||||
// if two vertice coords have a x and/or y difference
|
// if two vertice coords have a x and/or y difference
|
||||||
// of less or equal than 1 FRACUNIT, they are considered the same
|
// of less or equal than 1 FRACUNIT, they are considered the same
|
||||||
// point. Note: hardcoded value, 1.0f could be anything else.
|
// point. Note: hardcoded value, 1.0f could be anything else.
|
||||||
static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
|
static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
|
||||||
{
|
{
|
||||||
#if 0
|
if (fabsf( p2->x - p1->x ) > DIVLINE_VERTEX_DIFF)
|
||||||
float diff;
|
|
||||||
diff = p2->x - p1->x;
|
|
||||||
if (diff < -1.5f || diff > 1.5f)
|
|
||||||
return false;
|
return false;
|
||||||
diff = p2->y - p1->y;
|
if (fabsf( p2->y - p1->y ) > DIVLINE_VERTEX_DIFF)
|
||||||
if (diff < -1.5f || diff > 1.5f)
|
|
||||||
return false;
|
return false;
|
||||||
#elif 0
|
|
||||||
if (p1->x != p2->x)
|
|
||||||
return false;
|
|
||||||
if (p1->y != p2->y)
|
|
||||||
return false;
|
|
||||||
#elif 0
|
|
||||||
if (fabsf( p2->x - p1->x ) > 1.0E-36f )
|
|
||||||
return false;
|
|
||||||
if (fabsf( p2->y - p1->y ) > 1.0E-36f )
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
#define DIVLINE_VERTEX_DIFF 0.45f
|
|
||||||
static const float ep = DIVLINE_VERTEX_DIFF;
|
|
||||||
if (fabsf( p2->x - p1->x ) > ep )
|
|
||||||
return false;
|
|
||||||
if (fabsf( p2->y - p1->y ) > ep )
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
// p1 and p2 are considered the same vertex
|
// p1 and p2 are considered the same vertex
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -182,22 +170,23 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
|||||||
poly_t **frontpoly, //return one poly here
|
poly_t **frontpoly, //return one poly here
|
||||||
poly_t **backpoly) //return the other here
|
poly_t **backpoly) //return the other here
|
||||||
{
|
{
|
||||||
INT32 i,j;
|
INT32 i, j;
|
||||||
polyvertex_t *pv;
|
polyvertex_t *pv;
|
||||||
|
|
||||||
INT32 ps = -1,pe = -1;
|
INT32 ps = -1, pe = -1;
|
||||||
INT32 nptfront,nptback;
|
INT32 nptfront, nptback;
|
||||||
polyvertex_t vs = {0,0,0};
|
polyvertex_t vs = {0,0,0};
|
||||||
polyvertex_t ve = {0,0,0};
|
polyvertex_t ve = {0,0,0};
|
||||||
polyvertex_t lastpv = {0,0,0};
|
polyvertex_t lastpv = {0,0,0};
|
||||||
float fracs = 0.0f,frace = 0.0f; //used to tell which poly is on
|
float fracs = 0.0f, frace = 0.0f; //used to tell which poly is on
|
||||||
// the front side of the bsp partition line
|
// the front side of the bsp partition line
|
||||||
INT32 psonline = 0, peonline = 0;
|
INT32 psonline = 0, peonline = 0;
|
||||||
|
|
||||||
for (i = 0; i < poly->numpts; i++)
|
for (i = 0; i < poly->numpts; i++)
|
||||||
{
|
{
|
||||||
j = i + 1;
|
j = i + 1;
|
||||||
if (j == poly->numpts) j = 0;
|
if (j == poly->numpts)
|
||||||
|
j = 0;
|
||||||
|
|
||||||
// start & end points
|
// start & end points
|
||||||
pv = fracdivline(bsp, &poly->pts[i], &poly->pts[j]);
|
pv = fracdivline(bsp, &poly->pts[i], &poly->pts[j]);
|
||||||
@@ -284,7 +273,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pe <= ps)
|
if (UNLIKELY(pe <= ps))
|
||||||
I_Error("SplitPoly: invalid splitting line (%d %d)", ps, pe);
|
I_Error("SplitPoly: invalid splitting line (%d %d)", ps, pe);
|
||||||
|
|
||||||
// number of points on each side, _not_ counting those
|
// number of points on each side, _not_ counting those
|
||||||
@@ -296,6 +285,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
|||||||
*backpoly = HWR_AllocPoly(2 + nptback);
|
*backpoly = HWR_AllocPoly(2 + nptback);
|
||||||
else
|
else
|
||||||
*backpoly = NULL;
|
*backpoly = NULL;
|
||||||
|
|
||||||
if (nptfront > 0)
|
if (nptfront > 0)
|
||||||
*frontpoly = HWR_AllocPoly(2 + nptfront);
|
*frontpoly = HWR_AllocPoly(2 + nptfront);
|
||||||
else
|
else
|
||||||
@@ -308,10 +298,12 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
|||||||
*pv++ = vs;
|
*pv++ = vs;
|
||||||
*pv++ = ve;
|
*pv++ = ve;
|
||||||
i = pe;
|
i = pe;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (++i == poly->numpts)
|
if (++i == poly->numpts)
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
*pv++ = poly->pts[i];
|
*pv++ = poly->pts[i];
|
||||||
} while (i != ps && --nptfront);
|
} while (i != ps && --nptfront);
|
||||||
}
|
}
|
||||||
@@ -323,10 +315,12 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
|||||||
*pv++ = ve;
|
*pv++ = ve;
|
||||||
*pv++ = vs;
|
*pv++ = vs;
|
||||||
i = ps;
|
i = ps;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (++i == poly->numpts)
|
if (++i == poly->numpts)
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
*pv++ = poly->pts[i];
|
*pv++ = poly->pts[i];
|
||||||
} while (i != pe && --nptback);
|
} while (i != pe && --nptback);
|
||||||
}
|
}
|
||||||
@@ -353,36 +347,48 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
|||||||
static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||||
{
|
{
|
||||||
INT32 i, j;
|
INT32 i, j;
|
||||||
|
|
||||||
polyvertex_t *pv;
|
polyvertex_t *pv;
|
||||||
|
|
||||||
INT32 nump = 0, ps, pe;
|
INT32 nump = 0, ps, pe;
|
||||||
polyvertex_t vs = {0, 0, 0}, ve = {0, 0, 0},
|
polyvertex_t vs = {0, 0, 0}, ve = {0, 0, 0},
|
||||||
p1 = {0, 0, 0}, p2 = {0, 0, 0};
|
p1 = {0, 0, 0}, p2 = {0, 0, 0};
|
||||||
float fracs = 0.0f;
|
float fracs = 0.0f;
|
||||||
|
|
||||||
fdivline_t cutseg; // x, y, dx, dy as start of node_t struct
|
fdivline_t cutseg; // x, y, dx, dy as start of node_t struct
|
||||||
|
|
||||||
poly_t *temppoly;
|
poly_t *temppoly;
|
||||||
|
|
||||||
// for each seg of the subsector
|
// for each seg of the subsector
|
||||||
for (; count--; lseg++)
|
for (; count--; lseg++)
|
||||||
{
|
{
|
||||||
//x,y,dx,dy (like a divline)
|
// x, y, dx, dy (like a divline)
|
||||||
const line_t *line = lseg->linedef;
|
const line_t *line = lseg->linedef;
|
||||||
|
|
||||||
// portal check
|
// portal check
|
||||||
if (!gl_maphasportals && line->special == PORTALSPECIAL && lseg->side == 0)
|
if (UNLIKELY(!gl_maphasportals && line->special == PORTALSPECIAL && lseg->side == 0))
|
||||||
{
|
{
|
||||||
// Find the other side!
|
// Find the other side!
|
||||||
INT32 line2 = P_FindSpecialLineFromTag(PORTALSPECIAL, line->tag, -1);
|
INT32 line2 = P_FindSpecialLineFromTag(PORTALSPECIAL, line->tag, -1);
|
||||||
|
|
||||||
if (line == &lines[line2])
|
if (line == &lines[line2])
|
||||||
line2 = P_FindSpecialLineFromTag(PORTALSPECIAL, line->tag, line2);
|
line2 = P_FindSpecialLineFromTag(PORTALSPECIAL, line->tag, line2);
|
||||||
|
|
||||||
if (line2 >= 0) // found it!
|
if (line2 >= 0) // found it!
|
||||||
gl_maphasportals = 1;
|
gl_maphasportals = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gl_maphashorizonlines && line->special == HORIZONSPECIAL)
|
||||||
|
gl_maphashorizonlines = true;
|
||||||
|
|
||||||
|
if (line->sidenum[1] != 0xffff)
|
||||||
|
{
|
||||||
|
if (sides[line->sidenum[0]].sector == sides[line->sidenum[1]].sector)
|
||||||
|
{
|
||||||
|
// Segs that are self-ref linedef do not cutout the subsector.
|
||||||
|
#ifdef DEBUG_HWBSP
|
||||||
|
CONS_Debug(DBG_RENDER, "CutOutSubsecPoly: self ref line %i\n", line - lines);
|
||||||
|
#endif
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
|
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
|
||||||
p1.y = FIXED_TO_FLOAT(lseg->side ? line->v2->y : line->v1->y);
|
p1.y = FIXED_TO_FLOAT(lseg->side ? line->v2->y : line->v1->y);
|
||||||
p2.x = FIXED_TO_FLOAT(lseg->side ? line->v1->x : line->v2->x);
|
p2.x = FIXED_TO_FLOAT(lseg->side ? line->v1->x : line->v2->x);
|
||||||
@@ -396,6 +402,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
|||||||
// see if it cuts the convex poly
|
// see if it cuts the convex poly
|
||||||
ps = -1;
|
ps = -1;
|
||||||
pe = -1;
|
pe = -1;
|
||||||
|
|
||||||
for (i = 0; i < poly->numpts; i++)
|
for (i = 0; i < poly->numpts; i++)
|
||||||
{
|
{
|
||||||
j = i + 1;
|
j = i + 1;
|
||||||
@@ -438,6 +445,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
|||||||
ve = vs;
|
ve = vs;
|
||||||
vs = *pv;
|
vs = *pv;
|
||||||
}
|
}
|
||||||
|
|
||||||
//found 2nd point
|
//found 2nd point
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -451,25 +459,32 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
|||||||
{
|
{
|
||||||
// generate FRONT poly
|
// generate FRONT poly
|
||||||
temppoly = HWR_AllocPoly(nump);
|
temppoly = HWR_AllocPoly(nump);
|
||||||
|
|
||||||
pv = temppoly->pts;
|
pv = temppoly->pts;
|
||||||
*pv++ = vs;
|
*pv++ = vs;
|
||||||
*pv++ = ve;
|
*pv++ = ve;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (++ps == poly->numpts)
|
if (++ps == poly->numpts)
|
||||||
ps = 0;
|
ps = 0;
|
||||||
*pv++ = poly->pts[ps];
|
*pv++ = poly->pts[ps];
|
||||||
} while (ps != pe);
|
} while (ps != pe);
|
||||||
|
|
||||||
HWR_FreePoly(poly);
|
HWR_FreePoly(poly);
|
||||||
poly = temppoly;
|
poly = temppoly;
|
||||||
}
|
}
|
||||||
//hmmm... maybe we should NOT accept this, but this happens
|
#ifdef DEBUG_HWBSP
|
||||||
|
// hmmm... maybe we should NOT accept this, but this happens
|
||||||
// only when the cut is not needed it seems (when the cut
|
// only when the cut is not needed it seems (when the cut
|
||||||
// line is aligned to one of the borders of the poly, and
|
// line is aligned to one of the borders of the poly, and
|
||||||
// only some times..)
|
// only some times..)
|
||||||
else
|
else
|
||||||
|
{
|
||||||
skipcut++;
|
skipcut++;
|
||||||
// I_Error("CutOutPoly: only one point for split line (%d %d) %d", ps, pe, debugpos);
|
I_Error("CutOutPoly: only one point for split line (%d %d) %d", ps, pe, debugpos);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return poly;
|
return poly;
|
||||||
@@ -492,8 +507,10 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
|
|||||||
|
|
||||||
if (poly)
|
if (poly)
|
||||||
{
|
{
|
||||||
poly = CutOutSubsecPoly (lseg,count,poly);
|
poly = CutOutSubsecPoly(lseg,count,poly);
|
||||||
|
#ifdef DEBUG_HWBSP
|
||||||
totalsubsecpolys++;
|
totalsubsecpolys++;
|
||||||
|
#endif
|
||||||
//extra data for this subsector
|
//extra data for this subsector
|
||||||
extrasubsectors[num].planepoly = poly;
|
extrasubsectors[num].planepoly = poly;
|
||||||
}
|
}
|
||||||
@@ -503,8 +520,8 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
|
|||||||
// search for the segs source of this divline
|
// search for the segs source of this divline
|
||||||
static inline void SearchDivline(node_t *bsp, fdivline_t *divline)
|
static inline void SearchDivline(node_t *bsp, fdivline_t *divline)
|
||||||
{
|
{
|
||||||
divline->x = FIXED_TO_FLOAT(bsp->x);
|
divline->x = FIXED_TO_FLOAT(bsp->x);
|
||||||
divline->y = FIXED_TO_FLOAT(bsp->y);
|
divline->y = FIXED_TO_FLOAT(bsp->y);
|
||||||
divline->dx = FIXED_TO_FLOAT(bsp->dx);
|
divline->dx = FIXED_TO_FLOAT(bsp->dx);
|
||||||
divline->dy = FIXED_TO_FLOAT(bsp->dy);
|
divline->dy = FIXED_TO_FLOAT(bsp->dy);
|
||||||
}
|
}
|
||||||
@@ -562,10 +579,12 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
|||||||
if (poly && poly->numpts > 2)
|
if (poly && poly->numpts > 2)
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_RENDER, "Adding a new subsector\n");
|
CONS_Debug(DBG_RENDER, "Adding a new subsector\n");
|
||||||
if (addsubsector == numsubsectors + NEWSUBSECTORS)
|
|
||||||
|
if (UNLIKELY(addsubsector == numsubsectors + NEWSUBSECTORS))
|
||||||
I_Error("WalkBSPNode: not enough addsubsectors\n");
|
I_Error("WalkBSPNode: not enough addsubsectors\n");
|
||||||
else if (addsubsector > 0x7fff)
|
else if (UNLIKELY(addsubsector > 0x7fff))
|
||||||
I_Error("WalkBSPNode: addsubsector > 0x7fff\n");
|
I_Error("WalkBSPNode: addsubsector > 0x7fff\n");
|
||||||
|
|
||||||
*leafnode = (UINT16)((UINT16)addsubsector | NF_SUBSECTOR);
|
*leafnode = (UINT16)((UINT16)addsubsector | NF_SUBSECTOR);
|
||||||
extrasubsectors[addsubsector].planepoly = poly;
|
extrasubsectors[addsubsector].planepoly = poly;
|
||||||
addsubsector++;
|
addsubsector++;
|
||||||
@@ -587,6 +606,7 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
M_ClearBox(bbox);
|
M_ClearBox(bbox);
|
||||||
poly = extrasubsectors[bspnum & ~NF_SUBSECTOR].planepoly;
|
poly = extrasubsectors[bspnum & ~NF_SUBSECTOR].planepoly;
|
||||||
|
|
||||||
@@ -601,12 +621,14 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
|||||||
SplitPoly(&fdivline, poly, &frontpoly, &backpoly);
|
SplitPoly(&fdivline, poly, &frontpoly, &backpoly);
|
||||||
poly = NULL;
|
poly = NULL;
|
||||||
|
|
||||||
|
#ifdef DEBUG_HWBSP
|
||||||
//debug
|
//debug
|
||||||
if (!backpoly)
|
if (!backpoly)
|
||||||
nobackpoly++;
|
nobackpoly++;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Recursively divide front space.
|
// Recursively divide front space.
|
||||||
if (frontpoly)
|
if (LIKELY(frontpoly))
|
||||||
{
|
{
|
||||||
WalkBSPNode(bsp->children[0], frontpoly, &bsp->children[0],bsp->bbox[0]);
|
WalkBSPNode(bsp->children[0], frontpoly, &bsp->children[0],bsp->bbox[0]);
|
||||||
|
|
||||||
@@ -641,53 +663,79 @@ void HWR_FreeExtraSubsectors(void)
|
|||||||
#define MAXDIST 1.5f
|
#define MAXDIST 1.5f
|
||||||
// BP: can't move vertex: DON'T change polygon geometry! (convex)
|
// BP: can't move vertex: DON'T change polygon geometry! (convex)
|
||||||
//#define MOVEVERTEX
|
//#define MOVEVERTEX
|
||||||
static boolean PointInSeg(polyvertex_t *a,polyvertex_t *v1,polyvertex_t *v2)
|
|
||||||
|
// Is vertex va within the seg v1, v2
|
||||||
|
static boolean PointInSeg(polyvertex_t *va,polyvertex_t *v1,polyvertex_t *v2)
|
||||||
{
|
{
|
||||||
register float ax,ay,bx,by,cx,cy,d,norm;
|
register float ax, ay, bx, by, cx, cy, d, norm;
|
||||||
register polyvertex_t *p;
|
|
||||||
|
|
||||||
// check bbox of the seg first
|
// check bbox of the seg first (without altering v1, v2)
|
||||||
if (v1->x > v2->x)
|
if (v2->x > v1->x)
|
||||||
{
|
{
|
||||||
p = v1;
|
// check if x within seg box v1..v2
|
||||||
v1 = v2;
|
if ((va->x + MAXDIST) < v1->x) return false;
|
||||||
v2 = p;
|
if ((va->x - MAXDIST) > v2->x) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// check if x within seg box v2..v1
|
||||||
|
if ((va->x + MAXDIST) < v2->x) return false;
|
||||||
|
if ((va->x - MAXDIST) > v1->x) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->x < v1->x-MAXDIST || a->x > v2->x+MAXDIST)
|
if (v2->y > v1->y)
|
||||||
return false;
|
|
||||||
|
|
||||||
if (v1->y > v2->y)
|
|
||||||
{
|
{
|
||||||
p = v1;
|
// check if x within seg box v1..v2
|
||||||
v1 = v2;
|
if ((va->y + MAXDIST) < v1->y) return false;
|
||||||
v2 = p;
|
if ((va->y - MAXDIST) > v2->y) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// check if x within seg box v2..v1
|
||||||
|
if ((va->y + MAXDIST) < v2->y) return false;
|
||||||
|
if ((va->y - MAXDIST) > v1->y) return false;
|
||||||
}
|
}
|
||||||
if (a->y < v1->y-MAXDIST || a->y > v2->y+MAXDIST)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// v1 = origine
|
// v1 = origin
|
||||||
ax= v2->x-v1->x;
|
ax = v2->x-v1->x;
|
||||||
ay= v2->y-v1->y;
|
ay = v2->y-v1->y;
|
||||||
norm = hypotf(ax, ay);
|
norm = hypotf(ax, ay); // length of seg
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
if (norm != 0) // yes, this can be exactly 0
|
if (norm != 0) // yes, this can be exactly 0
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
{
|
{
|
||||||
ax /= norm;
|
ax /= norm;
|
||||||
ay /= norm;
|
ay /= norm; // unit vector along seg, v1->v2
|
||||||
}
|
}
|
||||||
bx = a->x-v1->x;
|
|
||||||
by = a->y-v1->y;
|
bx = va->x - v1->x;
|
||||||
//d = a.b
|
by = va->y - v1->y; // vector v1->va
|
||||||
d =ax*bx+ay*by;
|
|
||||||
|
// d = (a DOT b), (product of lengths * cosine( angle ))
|
||||||
|
d = ax*bx+ay*by;
|
||||||
|
|
||||||
// bound of the seg
|
// bound of the seg
|
||||||
if (d < 0 || d > norm)
|
if (d < 0 || d > norm)
|
||||||
|
{
|
||||||
|
// Also excludes some va within MAXDIST of v1 or v2
|
||||||
return false;
|
return false;
|
||||||
//c = d.1a-b
|
}
|
||||||
|
|
||||||
|
// Cross product.
|
||||||
|
if (((by * ax) - (bx * ay)) <= 0)
|
||||||
|
{
|
||||||
|
// The vertex is to the rightside of the seg, so adding
|
||||||
|
// it to the polygon would worsen the crack.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// measure the error in vector bx,by as difference squared sum
|
||||||
|
//c= (d * unit_vector_seg) - b
|
||||||
cx = ax*d-bx;
|
cx = ax*d-bx;
|
||||||
cy = ay*d-by;
|
cy = ay*d-by;
|
||||||
|
|
||||||
#ifdef MOVEVERTEX
|
#ifdef MOVEVERTEX
|
||||||
if (cx*cx+cy*cy <= MAXDIST*MAXDIST)
|
if (cx*cx+cy*cy <= MAXDIST*MAXDIST)
|
||||||
{
|
{
|
||||||
@@ -708,7 +756,7 @@ static INT32 numsplitpoly;
|
|||||||
static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
|
static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
|
||||||
{
|
{
|
||||||
poly_t *q;
|
poly_t *q;
|
||||||
INT32 j,k;
|
INT32 j,k;
|
||||||
|
|
||||||
if (bspnum & NF_SUBSECTOR)
|
if (bspnum & NF_SUBSECTOR)
|
||||||
{
|
{
|
||||||
@@ -716,47 +764,55 @@ static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
|
|||||||
{
|
{
|
||||||
bspnum &= ~NF_SUBSECTOR;
|
bspnum &= ~NF_SUBSECTOR;
|
||||||
q = extrasubsectors[bspnum].planepoly;
|
q = extrasubsectors[bspnum].planepoly;
|
||||||
|
|
||||||
if (poly == q || !q)
|
if (poly == q || !q)
|
||||||
return;
|
return;
|
||||||
for (j = 0; j < q->numpts; j++)
|
|
||||||
|
const INT32 numpts = q->numpts;
|
||||||
|
|
||||||
|
for (j = 0; j < numpts; j++)
|
||||||
{
|
{
|
||||||
k = j+1;
|
k = j+1;
|
||||||
if (k == q->numpts) k = 0;
|
if (k == numpts)
|
||||||
|
k = 0;
|
||||||
|
|
||||||
if (!SameVertice(p, &q->pts[j])
|
if (!SameVertice(p, &q->pts[j])
|
||||||
&& !SameVertice(p, &q->pts[k])
|
&& !SameVertice(p, &q->pts[k])
|
||||||
&& PointInSeg(p, &q->pts[j],
|
&& PointInSeg(p, &q->pts[j], &q->pts[k]))
|
||||||
&q->pts[k]))
|
|
||||||
{
|
{
|
||||||
poly_t *newpoly = HWR_AllocPoly(q->numpts+1);
|
poly_t *newpoly = HWR_AllocPoly(numpts+1);
|
||||||
INT32 n;
|
INT32 n;
|
||||||
|
|
||||||
for (n = 0; n <= j; n++)
|
for (n = 0; n <= j; n++)
|
||||||
newpoly->pts[n] = q->pts[n];
|
newpoly->pts[n] = q->pts[n];
|
||||||
|
|
||||||
newpoly->pts[k] = *p;
|
newpoly->pts[k] = *p;
|
||||||
|
|
||||||
for (n = k+1; n < newpoly->numpts; n++)
|
for (n = k+1; n < newpoly->numpts; n++)
|
||||||
newpoly->pts[n] = q->pts[n-1];
|
newpoly->pts[n] = q->pts[n-1];
|
||||||
|
|
||||||
numsplitpoly++;
|
numsplitpoly++;
|
||||||
extrasubsectors[bspnum].planepoly =
|
extrasubsectors[bspnum].planepoly = newpoly;
|
||||||
newpoly;
|
|
||||||
HWR_FreePoly(q);
|
HWR_FreePoly(q);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXBOTTOM])-MAXDIST <= p->y) &&
|
if ((FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXBOTTOM])-MAXDIST <= p->y) &&
|
||||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXTOP ])+MAXDIST >= p->y) &&
|
(FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXTOP ])+MAXDIST >= p->y) &&
|
||||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXLEFT ])-MAXDIST <= p->x) &&
|
(FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXLEFT ])-MAXDIST <= p->x) &&
|
||||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXRIGHT ])+MAXDIST >= p->x))
|
(FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXRIGHT ])+MAXDIST >= p->x))
|
||||||
SearchSegInBSP(nodes[bspnum].children[0],p,poly);
|
SearchSegInBSP(nodes[bspnum].children[0], p, poly);
|
||||||
|
|
||||||
if ((FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXBOTTOM])-MAXDIST <= p->y) &&
|
if ((FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXBOTTOM])-MAXDIST <= p->y) &&
|
||||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXTOP ])+MAXDIST >= p->y) &&
|
(FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXTOP ])+MAXDIST >= p->y) &&
|
||||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXLEFT ])-MAXDIST <= p->x) &&
|
(FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXLEFT ])-MAXDIST <= p->x) &&
|
||||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXRIGHT ])+MAXDIST >= p->x))
|
(FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXRIGHT ])+MAXDIST >= p->x))
|
||||||
SearchSegInBSP(nodes[bspnum].children[1],p,poly);
|
SearchSegInBSP(nodes[bspnum].children[1], p, poly);
|
||||||
}
|
}
|
||||||
|
|
||||||
// search for T-intersection problem
|
// search for T-intersection problem
|
||||||
@@ -780,13 +836,18 @@ static INT32 SolveTProblem(void)
|
|||||||
for (l = 0; l < addsubsector; l++)
|
for (l = 0; l < addsubsector; l++)
|
||||||
{
|
{
|
||||||
p = extrasubsectors[l].planepoly;
|
p = extrasubsectors[l].planepoly;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (i = 0; i < p->numpts; i++)
|
for (i = 0; i < p->numpts; i++)
|
||||||
SearchSegInBSP((INT32)numnodes-1, &p->pts[i], p);
|
SearchSegInBSP((INT32)numnodes-1, &p->pts[i], p);
|
||||||
}
|
}
|
||||||
//CONS_Debug(DBG_RENDER, "numsplitpoly %d\n", numsplitpoly);
|
|
||||||
|
#ifdef DEBUG_HWBSP
|
||||||
|
CONS_Debug(DBG_RENDER, "numsplitpoly %d\n", numsplitpoly);
|
||||||
|
#endif
|
||||||
|
|
||||||
return numsplitpoly;
|
return numsplitpoly;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -826,29 +887,31 @@ static void AdjustSegs(void)
|
|||||||
if (lseg->polyseg)
|
if (lseg->polyseg)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (p) {
|
for (j = 0; j < p->numpts; j++)
|
||||||
for (j = 0; j < p->numpts; j++)
|
{
|
||||||
|
distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
|
||||||
|
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
|
||||||
|
distv1 = distv1*distv1+tmp*tmp;
|
||||||
|
|
||||||
|
if (distv1 <= nearv1)
|
||||||
{
|
{
|
||||||
distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
|
v1found = j;
|
||||||
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
|
nearv1 = distv1;
|
||||||
distv1 = distv1*distv1+tmp*tmp;
|
}
|
||||||
if (distv1 <= nearv1)
|
|
||||||
{
|
// the same with v2
|
||||||
v1found = j;
|
distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
|
||||||
nearv1 = distv1;
|
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
|
||||||
}
|
distv2 = distv2*distv2+tmp*tmp;
|
||||||
// the same with v2
|
|
||||||
distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
|
if (distv2 <= nearv2)
|
||||||
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
|
{
|
||||||
distv2 = distv2*distv2+tmp*tmp;
|
v2found = j;
|
||||||
if (distv2 <= nearv2)
|
nearv2 = distv2;
|
||||||
{
|
|
||||||
v2found = j;
|
|
||||||
nearv2 = distv2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p && nearv1 <= NEARDIST*NEARDIST)
|
|
||||||
|
if (nearv1 <= NEARDIST*NEARDIST)
|
||||||
// share vertice with segs
|
// share vertice with segs
|
||||||
lseg->pv1 = &(p->pts[v1found]);
|
lseg->pv1 = &(p->pts[v1found]);
|
||||||
else
|
else
|
||||||
@@ -863,7 +926,8 @@ static void AdjustSegs(void)
|
|||||||
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
|
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
|
||||||
lseg->pv1 = pv;
|
lseg->pv1 = pv;
|
||||||
}
|
}
|
||||||
if (p && nearv2 <= NEARDIST*NEARDIST)
|
|
||||||
|
if (nearv2 <= NEARDIST*NEARDIST)
|
||||||
lseg->pv2 = &(p->pts[v2found]);
|
lseg->pv2 = &(p->pts[v2found]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -876,11 +940,15 @@ static void AdjustSegs(void)
|
|||||||
// recompute length
|
// recompute length
|
||||||
{
|
{
|
||||||
float x,y;
|
float x,y;
|
||||||
x = ((polyvertex_t *)lseg->pv2)->x - ((polyvertex_t *)lseg->pv1)->x
|
|
||||||
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
const polyvertex_t *pv1 = (polyvertex_t *)lseg->pv1;
|
||||||
y = ((polyvertex_t *)lseg->pv2)->y - ((polyvertex_t *)lseg->pv1)->y
|
const polyvertex_t *pv2 = (polyvertex_t *)lseg->pv2;
|
||||||
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
|
||||||
lseg->flength = (float)hypot(x, y);
|
x = pv2->x - pv1->x + 0.5f;
|
||||||
|
y = pv2->y - pv1->y + 0.5f;
|
||||||
|
|
||||||
|
lseg->flength = hypotf(x, y);
|
||||||
|
|
||||||
// BP: debug see this kind of segs
|
// BP: debug see this kind of segs
|
||||||
//if (nearv2 > NEARDIST*NEARDIST || nearv1 > NEARDIST*NEARDIST)
|
//if (nearv2 > NEARDIST*NEARDIST || nearv1 > NEARDIST*NEARDIST)
|
||||||
// lseg->length = 1;
|
// lseg->length = 1;
|
||||||
@@ -906,29 +974,29 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
|||||||
I_FinishUpdate(); // page flip or blit buffer
|
I_FinishUpdate(); // page flip or blit buffer
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// reset the portal flag
|
// reset the portal and horizonline flag
|
||||||
gl_maphasportals = 0;
|
gl_maphasportals = gl_maphashorizonlines = 0;
|
||||||
|
|
||||||
// find min/max boundaries of map
|
// find min/max boundaries of map
|
||||||
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
|
#ifdef DEBUG_HWBSP
|
||||||
|
CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
|
||||||
|
#endif
|
||||||
M_ClearBox(rootbbox);
|
M_ClearBox(rootbbox);
|
||||||
for (i = 0;i < numvertexes; i++)
|
for (i = 0;i < numvertexes; i++)
|
||||||
M_AddToBox(rootbbox, vertexes[i].x, vertexes[i].y);
|
M_AddToBox(rootbbox, vertexes[i].x, vertexes[i].y);
|
||||||
|
|
||||||
//CONS_Debug(DBG_RENDER, "Generating subsector polygons... %d subsectors\n", numsubsectors);
|
#ifdef DEBUG_HWBSP
|
||||||
|
CONS_Debug(DBG_RENDER, "Generating subsector polygons... %d subsectors\n", numsubsectors);
|
||||||
|
#endif
|
||||||
|
|
||||||
HWR_FreeExtraSubsectors();
|
HWR_FreeExtraSubsectors();
|
||||||
|
|
||||||
// allocate extra data for each subsector present in map
|
// allocate extra data for each subsector present in map
|
||||||
totsubsectors = numsubsectors + NEWSUBSECTORS;
|
totsubsectors = numsubsectors + NEWSUBSECTORS;
|
||||||
extrasubsectors = calloc(totsubsectors, sizeof (*extrasubsectors));
|
extrasubsectors = calloc(totsubsectors, sizeof (*extrasubsectors));
|
||||||
if (extrasubsectors == NULL)
|
if (UNLIKELY(extrasubsectors == NULL))
|
||||||
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
|
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
|
||||||
|
|
||||||
// allocate table for back to front drawing of subsectors
|
|
||||||
/*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
|
|
||||||
if (!gl_drawsubsectors)
|
|
||||||
I_Error("couldn't malloc gl_drawsubsectors\n");*/
|
|
||||||
|
|
||||||
// number of the first new subsector that might be added
|
// number of the first new subsector that might be added
|
||||||
addsubsector = numsubsectors;
|
addsubsector = numsubsectors;
|
||||||
|
|
||||||
@@ -952,17 +1020,21 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
|||||||
WalkBSPNode(bspnum, rootp, NULL,rootbbox);
|
WalkBSPNode(bspnum, rootp, NULL,rootbbox);
|
||||||
|
|
||||||
i = SolveTProblem();
|
i = SolveTProblem();
|
||||||
//CONS_Debug(DBG_RENDER, "%d point divides a polygon line\n",i);
|
#ifdef DEBUG_HWBSP
|
||||||
|
CONS_Debug(DBG_RENDER, "%d point divides a polygon line\n",i);
|
||||||
|
#endif
|
||||||
AdjustSegs();
|
AdjustSegs();
|
||||||
|
|
||||||
|
#ifdef DEBUG_HWBSP
|
||||||
//debug debug..
|
//debug debug..
|
||||||
//if (nobackpoly)
|
if (nobackpoly)
|
||||||
// CONS_Debug(DBG_RENDER, "no back polygon %u times\n",nobackpoly);
|
CONS_Debug(DBG_RENDER, "no back polygon %u times\n",nobackpoly);
|
||||||
//"(should happen only with the deep water trick)"
|
//"(should happen only with the deep water trick)"
|
||||||
//if (skipcut)
|
if (skipcut)
|
||||||
// CONS_Debug(DBG_RENDER, "%u cuts were skipped because of only one point\n",skipcut);
|
CONS_Debug(DBG_RENDER, "%u cuts were skipped because of only one point\n",skipcut);
|
||||||
|
|
||||||
//CONS_Debug(DBG_RENDER, "done: %u total subsector convex polygons\n", totalsubsecpolys);
|
CONS_Debug(DBG_RENDER, "done: %u total subsector convex polygons\n", totalsubsecpolys);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //HWRENDER
|
#endif //HWRENDER
|
||||||
@@ -38,12 +38,6 @@ INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
|
|||||||
|
|
||||||
RGBA_t mapPalette[256] = {0}; // the palette for the currently loaded level or menu etc.
|
RGBA_t mapPalette[256] = {0}; // the palette for the currently loaded level or menu etc.
|
||||||
|
|
||||||
// Returns a pointer to the palette which should be used for caching textures.
|
|
||||||
RGBA_t *HWR_GetTexturePalette(void)
|
|
||||||
{
|
|
||||||
return HWR_ShouldUsePaletteRendering() ? mapPalette : pLocalPalette;
|
|
||||||
}
|
|
||||||
|
|
||||||
static INT32 format2bpp(GLTextureFormat_t format)
|
static INT32 format2bpp(GLTextureFormat_t format)
|
||||||
{
|
{
|
||||||
switch (format)
|
switch (format)
|
||||||
@@ -792,7 +786,7 @@ static void HWR_PrecacheLevelSprites(void)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo = (mobj_t *)th;
|
mo = (mobj_t *)th;
|
||||||
|
|||||||
+18
-6
@@ -610,7 +610,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||||||
}
|
}
|
||||||
else // Do TRANSMAP** fade.
|
else // Do TRANSMAP** fade.
|
||||||
{
|
{
|
||||||
RGBA_t *palette = HWR_GetTexturePalette();
|
const RGBA_t *palette = HWR_GetTexturePalette();
|
||||||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||||
|
|
||||||
if (HWR_ShouldUsePaletteRendering())
|
if (HWR_ShouldUsePaletteRendering())
|
||||||
@@ -794,7 +794,7 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
|||||||
{
|
{
|
||||||
F2DCoord v1, v2;
|
F2DCoord v1, v2;
|
||||||
RGBA_t color_rgba;
|
RGBA_t color_rgba;
|
||||||
RGBA_t *palette = HWR_GetTexturePalette();
|
const RGBA_t *palette = HWR_GetTexturePalette();
|
||||||
|
|
||||||
color_rgba = palette[color&0xFF];
|
color_rgba = palette[color&0xFF];
|
||||||
|
|
||||||
@@ -815,7 +815,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
|||||||
FOutVector v[4];
|
FOutVector v[4];
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
float fx, fy, fw, fh, fwait = 0;
|
float fx, fy, fw, fh, fwait = 0;
|
||||||
RGBA_t *palette = HWR_GetTexturePalette();
|
RGBA_t *palette;
|
||||||
|
|
||||||
if (wh < 0)
|
if (wh < 0)
|
||||||
return; // consistency w/ software
|
return; // consistency w/ software
|
||||||
@@ -860,11 +860,13 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, 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;
|
||||||
@@ -873,11 +875,13 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
|||||||
|
|
||||||
if (fw <= 0 || fh <= 0)
|
if (fw <= 0 || fh <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fx + fw > vid.width)
|
if (fx + fw > vid.width)
|
||||||
{
|
{
|
||||||
fwait = fw - (fvw- fx);
|
fwait = fw - (fvw- fx);
|
||||||
fw = fvw - fx;
|
fw = fvw - fx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fy + fh > vid.height)
|
if (fy + fh > vid.height)
|
||||||
fh = fvh - fy;
|
fh = fvh - fy;
|
||||||
|
|
||||||
@@ -899,6 +903,8 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
|||||||
v[0].t = v[1].t = 0.0f;
|
v[0].t = v[1].t = 0.0f;
|
||||||
v[2].t = v[3].t = 1.0f;
|
v[2].t = v[3].t = 1.0f;
|
||||||
|
|
||||||
|
palette = HWR_GetTexturePalette();
|
||||||
|
|
||||||
Surf.PolyColor = palette[color&0xFF];
|
Surf.PolyColor = palette[color&0xFF];
|
||||||
|
|
||||||
GL_DrawPolygon(&Surf, v, 4,
|
GL_DrawPolygon(&Surf, v, 4,
|
||||||
@@ -913,7 +919,6 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||||||
FOutVector v[4];
|
FOutVector v[4];
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
float fx, fy, fw, fh;
|
float fx, fy, fw, fh;
|
||||||
RGBA_t *palette = HWR_GetTexturePalette();
|
|
||||||
|
|
||||||
if (w < 0 || h < 0)
|
if (w < 0 || h < 0)
|
||||||
return; // consistency w/ software
|
return; // consistency w/ software
|
||||||
@@ -937,6 +942,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||||||
|
|
||||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||||
{
|
{
|
||||||
|
RGBA_t *palette = HWR_GetTexturePalette();
|
||||||
RGBA_t rgbaColour = palette[color&0xFF];
|
RGBA_t rgbaColour = palette[color&0xFF];
|
||||||
FRGBAFloat clearColour;
|
FRGBAFloat clearColour;
|
||||||
clearColour.red = (float)rgbaColour.s.red / 255;
|
clearColour.red = (float)rgbaColour.s.red / 255;
|
||||||
@@ -967,6 +973,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||||||
else if (!(options & V_SNAPTOTOP))
|
else if (!(options & V_SNAPTOTOP))
|
||||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
|
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options & V_SPLITSCREEN)
|
if (options & V_SPLITSCREEN)
|
||||||
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
|
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
|
||||||
if (options & V_HORZSCREEN)
|
if (options & V_HORZSCREEN)
|
||||||
@@ -976,11 +983,13 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||||||
|
|
||||||
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;
|
||||||
@@ -989,8 +998,10 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||||||
|
|
||||||
if (fw <= 0 || fh <= 0)
|
if (fw <= 0 || fh <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -1026,12 +1037,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||||||
FOutVector v[4];
|
FOutVector v[4];
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
float fx, fy, fw, fh;
|
float fx, fy, fw, fh;
|
||||||
UINT8 alphalevel = ((color & V_ALPHAMASK) >> V_ALPHASHIFT);
|
|
||||||
RGBA_t *palette = HWR_GetTexturePalette();
|
|
||||||
|
|
||||||
if (w < 0 || h < 0)
|
if (w < 0 || h < 0)
|
||||||
return; // consistency w/ software
|
return; // consistency w/ software
|
||||||
|
|
||||||
|
const UINT8 alphalevel = ((color & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||||
|
const RGBA_t *palette = HWR_GetTexturePalette();
|
||||||
|
|
||||||
// 3--2
|
// 3--2
|
||||||
// | /|
|
// | /|
|
||||||
// |/ |
|
// |/ |
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ void HWR_FreeExtraSubsectors(void);
|
|||||||
// --------
|
// --------
|
||||||
// hw_cache.c
|
// hw_cache.c
|
||||||
// --------
|
// --------
|
||||||
|
|
||||||
|
extern RGBA_t mapPalette[256];
|
||||||
|
|
||||||
void HWR_InitMapTextures(void);
|
void HWR_InitMapTextures(void);
|
||||||
void HWR_LoadMapTextures(size_t pnumtextures);
|
void HWR_LoadMapTextures(size_t pnumtextures);
|
||||||
void HWR_FreeMapTextures(void);
|
void HWR_FreeMapTextures(void);
|
||||||
@@ -85,7 +88,6 @@ void HWR_ClearAllTextures(void);
|
|||||||
void HWR_FreeColormapCache(void);
|
void HWR_FreeColormapCache(void);
|
||||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||||
|
|
||||||
RGBA_t *HWR_GetTexturePalette(void);
|
|
||||||
void HWR_SetPalette(RGBA_t *palette);
|
void HWR_SetPalette(RGBA_t *palette);
|
||||||
void HWR_SetMapPalette(void);
|
void HWR_SetMapPalette(void);
|
||||||
UINT32 HWR_CreateLightTable(UINT8 *lighttable);
|
UINT32 HWR_CreateLightTable(UINT8 *lighttable);
|
||||||
|
|||||||
+60
-77
@@ -14,8 +14,6 @@
|
|||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#define _USE_MATH_DEFINES
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include "../doomstat.h"
|
#include "../doomstat.h"
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
@@ -99,8 +97,6 @@ line_t *gl_linedef;
|
|||||||
sector_t *gl_frontsector;
|
sector_t *gl_frontsector;
|
||||||
sector_t *gl_backsector;
|
sector_t *gl_backsector;
|
||||||
|
|
||||||
static boolean gl_maphashorizonlines = false;
|
|
||||||
|
|
||||||
// values for the far clipping plane
|
// values for the far clipping plane
|
||||||
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
|
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
|
||||||
// values for bsp culling
|
// values for bsp culling
|
||||||
@@ -132,7 +128,17 @@ static void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, b
|
|||||||
static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||||
static void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
static void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
||||||
|
|
||||||
static void HWR_AddSprites(sector_t *sec);
|
namespace
|
||||||
|
{
|
||||||
|
enum class AddSpritesType
|
||||||
|
{
|
||||||
|
kNoLimitDist,
|
||||||
|
kLimitDist,
|
||||||
|
};
|
||||||
|
|
||||||
|
template<AddSpritesType> static void HWR_AddSprites(sector_t *);
|
||||||
|
}
|
||||||
|
|
||||||
static void HWR_ProjectSprite(mobj_t *thing);
|
static void HWR_ProjectSprite(mobj_t *thing);
|
||||||
static void HWR_AddPrecipitationSprites(void);
|
static void HWR_AddPrecipitationSprites(void);
|
||||||
static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||||
@@ -174,7 +180,6 @@ static void CV_glpalettedepth_OnChange(void);
|
|||||||
static CV_PossibleValue_t glscreentextures_cons_t[] = {{0, "Off"}, {1, "Wipes Only"}, {2, "All"}, {0, NULL}};
|
static CV_PossibleValue_t glscreentextures_cons_t[] = {{0, "Off"}, {1, "Wipes Only"}, {2, "All"}, {0, NULL}};
|
||||||
static CV_PossibleValue_t glfakecontrast_cons_t[] = {{0, "Off"}, {1, "Standard"}, {2, "Smooth"}, {0, NULL}};
|
static CV_PossibleValue_t glfakecontrast_cons_t[] = {{0, "Off"}, {1, "Standard"}, {2, "Smooth"}, {0, NULL}};
|
||||||
static CV_PossibleValue_t glshaders_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Ignore custom shaders"}, {0, NULL}};
|
static CV_PossibleValue_t glshaders_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Ignore custom shaders"}, {0, NULL}};
|
||||||
static CV_PossibleValue_t secbright_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NULL}};
|
|
||||||
|
|
||||||
static CV_PossibleValue_t glfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"},
|
static CV_PossibleValue_t glfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"},
|
||||||
{HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"},
|
{HWD_SET_TEXTUREFILTER_BILINEAR, "Bilinear"}, {HWD_SET_TEXTUREFILTER_TRILINEAR, "Trilinear"},
|
||||||
@@ -219,7 +224,6 @@ consvar_t cv_glslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NU
|
|||||||
consvar_t cv_glshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, glshaders_cons_t, CV_glshaders_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_glshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, glshaders_cons_t, CV_glshaders_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
consvar_t cv_gllightdither = {"gr_lightdithering", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_gllightdithering_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_gllightdither = {"gr_lightdithering", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_gllightdithering_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_glsecbright = {"secbright", "0", CV_SAVE, secbright_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
consvar_t cv_glfiltermode = {"gr_filtermode", "Nearest", CV_CALL|CV_SAVE, glfiltermode_cons_t, CV_filtermode_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_glfiltermode = {"gr_filtermode", "Nearest", CV_CALL|CV_SAVE, glfiltermode_cons_t, CV_filtermode_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_glanisotropicmode = {"gr_anisotropicmode", "1", CV_CALL|CV_SAVE, glanisotropicmode_cons_t, CV_anisotropic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_glanisotropicmode = {"gr_anisotropicmode", "1", CV_CALL|CV_SAVE, glanisotropicmode_cons_t, CV_anisotropic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
@@ -409,6 +413,9 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
|||||||
tint_color.rgba = (colormap != NULL) ? (UINT32)colormap->rgba : GL_DEFAULTMIX;
|
tint_color.rgba = (colormap != NULL) ? (UINT32)colormap->rgba : GL_DEFAULTMIX;
|
||||||
fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : GL_DEFAULTFOG;
|
fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : GL_DEFAULTFOG;
|
||||||
|
|
||||||
|
// Clamp the light level, since it can sometimes go out of the 0-255 range from animations
|
||||||
|
light_level = CLAMP(SOFTLIGHT(light_level), cv_secbright.value, 255);
|
||||||
|
|
||||||
// Crappy backup coloring if you can't do shaders
|
// Crappy backup coloring if you can't do shaders
|
||||||
if (!HWR_UseShader())
|
if (!HWR_UseShader())
|
||||||
{
|
{
|
||||||
@@ -446,9 +453,6 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
|||||||
poly_color.s.blue = (UINT8)blue;
|
poly_color.s.blue = (UINT8)blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp the light level, since it can sometimes go out of the 0-255 range from animations
|
|
||||||
light_level = CLAMP(SOFTLIGHT(light_level), cv_glsecbright.value, 255);
|
|
||||||
|
|
||||||
// in palette rendering mode, this is not needed since it properly takes the changes to the palette itself
|
// in palette rendering mode, this is not needed since it properly takes the changes to the palette itself
|
||||||
if (!HWR_ShouldUsePaletteRendering())
|
if (!HWR_ShouldUsePaletteRendering())
|
||||||
{
|
{
|
||||||
@@ -704,7 +708,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||||||
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++)
|
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++)
|
||||||
SETUP3DVERT(v3d, pv->x, pv->y);
|
SETUP3DVERT(v3d, pv->x, pv->y);
|
||||||
|
|
||||||
lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL));
|
if (slope)
|
||||||
|
lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL));
|
||||||
|
|
||||||
HWR_Lighting(&Surf, lightlevel, planecolormap, P_SectorUsesDirectionalLighting(gl_frontsector));
|
HWR_Lighting(&Surf, lightlevel, planecolormap, P_SectorUsesDirectionalLighting(gl_frontsector));
|
||||||
|
|
||||||
@@ -3026,7 +3031,7 @@ static void HWR_Subsector(size_t num)
|
|||||||
// rendering heights for bottom and top planes
|
// rendering heights for bottom and top planes
|
||||||
// yes there were functions for this stuff, no idea why it wasnt used but bleh
|
// yes there were functions for this stuff, no idea why it wasnt used but bleh
|
||||||
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
|
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
|
||||||
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
|
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
|
||||||
|
|
||||||
if (gl_frontsector->cullheight)
|
if (gl_frontsector->cullheight)
|
||||||
{
|
{
|
||||||
@@ -3166,7 +3171,10 @@ doaddline:
|
|||||||
{
|
{
|
||||||
// draw sprites first, coz they are clipped to the solidsegs of
|
// draw sprites first, coz they are clipped to the solidsegs of
|
||||||
// subsectors more 'in front'
|
// subsectors more 'in front'
|
||||||
HWR_AddSprites(gl_frontsector);
|
if (cv_drawdist.value || current_bsp_culling_distance)
|
||||||
|
HWR_AddSprites<AddSpritesType::kLimitDist>(gl_frontsector);
|
||||||
|
else
|
||||||
|
HWR_AddSprites<AddSpritesType::kNoLimitDist>(gl_frontsector);
|
||||||
|
|
||||||
//Hurdler: at this point validcount must be the same, but is not because
|
//Hurdler: at this point validcount must be the same, but is not because
|
||||||
// gl_frontsector doesn't point anymore to sub->sector due to
|
// gl_frontsector doesn't point anymore to sub->sector due to
|
||||||
@@ -3522,7 +3530,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
|||||||
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
||||||
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip, const boolean papersprite)
|
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip, const boolean papersprite)
|
||||||
{
|
{
|
||||||
if (!cv_glspritebillboarding.value || !spr || !spr->mobj || !wallVerts || papersprite)
|
if (!cv_glspritebillboarding.value || papersprite)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3762,7 +3770,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!lightset)
|
if (!lightset)
|
||||||
lightlevel = static_cast<INT32>(CLAMP(*list[i-1].lightlevel, 0, 255));
|
lightlevel = static_cast<INT32>(*list[i-1].lightlevel);
|
||||||
|
|
||||||
colormap = list[i-1].extra_colormap;
|
colormap = list[i-1].extra_colormap;
|
||||||
break;
|
break;
|
||||||
@@ -3781,7 +3789,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
|||||||
{
|
{
|
||||||
if (!lightset)
|
if (!lightset)
|
||||||
{
|
{
|
||||||
lightlevel = static_cast<INT32>(CLAMP(*list[i].lightlevel, 0, 255));
|
lightlevel = static_cast<INT32>(*list[i].lightlevel);
|
||||||
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
|
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3988,7 +3996,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
|||||||
|
|
||||||
if (!lightset)
|
if (!lightset)
|
||||||
{
|
{
|
||||||
lightlevel = static_cast<INT32>(CLAMP(sector->lightlevel, 0, 255));
|
lightlevel = static_cast<INT32>(sector->lightlevel);
|
||||||
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
|
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4089,7 +4097,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
|||||||
|
|
||||||
// colormap test
|
// colormap test
|
||||||
sector_t *sector = sprmo->subsector->sector;
|
sector_t *sector = sprmo->subsector->sector;
|
||||||
UINT8 lightlevel = 255;
|
INT32 lightlevel = 255;
|
||||||
extracolormap_t *colormap = sector->extra_colormap;
|
extracolormap_t *colormap = sector->extra_colormap;
|
||||||
|
|
||||||
if (sector->numlights)
|
if (sector->numlights)
|
||||||
@@ -4099,7 +4107,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
|||||||
light = R_GetPlaneLight(sector, sprmo->z + sprmo->height, false); // Always use the light at the top instead of whatever I was doing before
|
light = R_GetPlaneLight(sector, sprmo->z + sprmo->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||||
|
|
||||||
if (!(sprmo->frame & FF_FULLBRIGHT))
|
if (!(sprmo->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = static_cast<UINT8>(CLAMP(*sector->lightlist[light].lightlevel, 0, 255));
|
lightlevel = static_cast<INT32>(*sector->lightlist[light].lightlevel);
|
||||||
|
|
||||||
if (sector->lightlist[light].extra_colormap)
|
if (sector->lightlist[light].extra_colormap)
|
||||||
colormap = sector->lightlist[light].extra_colormap;
|
colormap = sector->lightlist[light].extra_colormap;
|
||||||
@@ -4107,7 +4115,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(sprmo->frame & FF_FULLBRIGHT))
|
if (!(sprmo->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = static_cast<UINT8>(CLAMP(sector->lightlevel, 0, 255));
|
lightlevel = static_cast<INT32>(sector->lightlevel);
|
||||||
|
|
||||||
if (sector->extra_colormap)
|
if (sector->extra_colormap)
|
||||||
colormap = sector->extra_colormap;
|
colormap = sector->extra_colormap;
|
||||||
@@ -4528,6 +4536,10 @@ static void HWR_DrawSprites(void)
|
|||||||
// HWR_AddSprites
|
// HWR_AddSprites
|
||||||
// During BSP traversal, this adds sprites by sector.
|
// During BSP traversal, this adds sprites by sector.
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
template <AddSpritesType Type>
|
||||||
static void HWR_AddSprites(sector_t *sec)
|
static void HWR_AddSprites(sector_t *sec)
|
||||||
{
|
{
|
||||||
mobj_t *thing;
|
mobj_t *thing;
|
||||||
@@ -4543,22 +4555,29 @@ static void HWR_AddSprites(sector_t *sec)
|
|||||||
// Well, now it will be done.
|
// Well, now it will be done.
|
||||||
sec->validcount = validcount;
|
sec->validcount = validcount;
|
||||||
|
|
||||||
limit_dist = cv_drawdist.value;
|
if constexpr (Type == AddSpritesType::kLimitDist)
|
||||||
|
|
||||||
if (current_bsp_culling_distance)
|
|
||||||
{
|
{
|
||||||
// Use the smaller setting
|
limit_dist = cv_drawdist.value;
|
||||||
if (limit_dist)
|
|
||||||
limit_dist = std::min(current_bsp_culling_distance/mapobjectscale, limit_dist);
|
if (current_bsp_culling_distance)
|
||||||
else
|
{
|
||||||
limit_dist = current_bsp_culling_distance/mapobjectscale;
|
// Use the smaller setting
|
||||||
|
if (limit_dist)
|
||||||
|
limit_dist = std::min(current_bsp_culling_distance/mapobjectscale, limit_dist);
|
||||||
|
else
|
||||||
|
limit_dist = current_bsp_culling_distance/mapobjectscale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle all things in sector.
|
// Handle all things in sector.
|
||||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||||
{
|
{
|
||||||
if (!R_ThingWithinDist(thing, limit_dist))
|
// reduce branching in this rather tight loop
|
||||||
continue;
|
if constexpr (Type == AddSpritesType::kLimitDist)
|
||||||
|
{
|
||||||
|
if (!R_ThingWithinDist(thing, limit_dist))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!R_ThingVisible(thing))
|
if (!R_ThingVisible(thing))
|
||||||
continue;
|
continue;
|
||||||
@@ -4566,6 +4585,7 @@ static void HWR_AddSprites(sector_t *sec)
|
|||||||
HWR_ProjectSprite(thing);
|
HWR_ProjectSprite(thing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// HWR_AddPrecipitationSprites
|
// HWR_AddPrecipitationSprites
|
||||||
@@ -4949,24 +4969,24 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||||||
vis->mobj = thing;
|
vis->mobj = thing;
|
||||||
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
|
if (UNLIKELY((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1))) // Bosses "flash"
|
||||||
{
|
{
|
||||||
if (vis->mobj->type == MT_CYBRAKDEMON)
|
if (vis->mobj->type == MT_CYBRAKDEMON)
|
||||||
vis->colormap = static_cast<UINT8*>(R_GetTranslationColormap(TC_ALLWHITE, SKINCOLOR_NONE, GTC_CACHE));
|
vis->colormap = R_GetTranslationColormap(TC_ALLWHITE, SKINCOLOR_NONE, GTC_CACHE);
|
||||||
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
||||||
vis->colormap = static_cast<UINT8*>(R_GetTranslationColormap(TC_METALSONIC, SKINCOLOR_NONE, GTC_CACHE));
|
vis->colormap = R_GetTranslationColormap(TC_METALSONIC, SKINCOLOR_NONE, GTC_CACHE);
|
||||||
else
|
else
|
||||||
vis->colormap = static_cast<UINT8*>(R_GetTranslationColormap(TC_BOSS, SKINCOLOR_NONE, GTC_CACHE));
|
vis->colormap = R_GetTranslationColormap(TC_BOSS, SKINCOLOR_NONE, GTC_CACHE);
|
||||||
}
|
}
|
||||||
else if (thing->color)
|
else if (thing->color)
|
||||||
{
|
{
|
||||||
// New colormap stuff for skins Tails 06-07-2002
|
// New colormap stuff for skins Tails 06-07-2002
|
||||||
if (thing->colorized)
|
if (thing->colorized)
|
||||||
vis->colormap = static_cast<UINT8*>(R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolors_t>(thing->color), GTC_CACHE));
|
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolors_t>(thing->color), GTC_CACHE);
|
||||||
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
||||||
vis->colormap = static_cast<UINT8*>(R_GetLocalTranslationColormap(static_cast<skin_t*>(thing->skin), static_cast<skin_t*>(thing->localskin), static_cast<skincolors_t>(thing->color), GTC_CACHE, thing->skinlocal));
|
vis->colormap = R_GetLocalTranslationColormap(static_cast<skin_t*>(thing->skin), static_cast<skin_t*>(thing->localskin), static_cast<skincolors_t>(thing->color), GTC_CACHE, thing->skinlocal);
|
||||||
else
|
else
|
||||||
vis->colormap = static_cast<UINT8*>(R_GetTranslationColormap(TC_DEFAULT, static_cast<skincolors_t>(thing->color), GTC_CACHE));
|
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, static_cast<skincolors_t>(thing->color), GTC_CACHE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -5725,42 +5745,7 @@ void HWR_RenderPlayerView(void)
|
|||||||
HWR_RenderFrame(player, false);
|
HWR_RenderFrame(player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine on mapload if current map has any Horizonlines present
|
void HWR_LoadLevel(void)
|
||||||
// so we can avoid rather hot checks in HWR_Subsector
|
|
||||||
static void HWR_CheckForHorizonLines(void)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
INT32 h;
|
|
||||||
|
|
||||||
gl_maphashorizonlines = false;
|
|
||||||
|
|
||||||
if (!cv_glhorizonlines.value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < numsubsectors; i++)
|
|
||||||
{
|
|
||||||
subsector_t *subsec = &subsectors[i];
|
|
||||||
|
|
||||||
// sector checked already?
|
|
||||||
if (subsec->validcount == validcount)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
subsec->validcount = validcount;
|
|
||||||
|
|
||||||
seg_t *line = &segs[subsec->firstline];
|
|
||||||
|
|
||||||
for (h = 0; h < subsec->numlines; h++, line++)
|
|
||||||
{
|
|
||||||
if (line->linedef->special != HORIZONSPECIAL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
gl_maphashorizonlines = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HWR_LoadLevel(boolean reloadinggamestate)
|
|
||||||
{
|
{
|
||||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||||
|
|
||||||
@@ -5768,9 +5753,6 @@ void HWR_LoadLevel(boolean reloadinggamestate)
|
|||||||
HWR_ClearSkyDome();
|
HWR_ClearSkyDome();
|
||||||
HWR_BuildSkyDome();
|
HWR_BuildSkyDome();
|
||||||
|
|
||||||
if (!reloadinggamestate)
|
|
||||||
HWR_CheckForHorizonLines();
|
|
||||||
|
|
||||||
if (HWR_ShouldUsePaletteRendering())
|
if (HWR_ShouldUsePaletteRendering())
|
||||||
HWR_SetMapPalette();
|
HWR_SetMapPalette();
|
||||||
}
|
}
|
||||||
@@ -5844,7 +5826,6 @@ void HWR_AddCommands(void)
|
|||||||
CV_RegisterVar(&cv_glshaders);
|
CV_RegisterVar(&cv_glshaders);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_gllightdither);
|
CV_RegisterVar(&cv_gllightdither);
|
||||||
CV_RegisterVar(&cv_glsecbright);
|
|
||||||
|
|
||||||
CV_RegisterVar(&cv_glfiltermode);
|
CV_RegisterVar(&cv_glfiltermode);
|
||||||
CV_RegisterVar(&cv_glanisotropicmode);
|
CV_RegisterVar(&cv_glanisotropicmode);
|
||||||
@@ -6040,6 +6021,8 @@ static void HWR_DoPostProcessor(player_t *player)
|
|||||||
|
|
||||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||||
|
|
||||||
|
V_CubeApply(&Surf.PolyColor.s.red, &Surf.PolyColor.s.green, &Surf.PolyColor.s.blue);
|
||||||
|
|
||||||
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
|||||||
// hw_bsp.c
|
// hw_bsp.c
|
||||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||||
extern boolean gl_maphasportals;
|
extern boolean gl_maphasportals;
|
||||||
|
extern boolean gl_maphashorizonlines;
|
||||||
|
|
||||||
// Console variables
|
// Console variables
|
||||||
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
|
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
|
||||||
@@ -198,7 +199,6 @@ extern consvar_t cv_glslopecontrast;
|
|||||||
extern consvar_t cv_glshaders;
|
extern consvar_t cv_glshaders;
|
||||||
|
|
||||||
extern consvar_t cv_gllightdither;
|
extern consvar_t cv_gllightdither;
|
||||||
extern consvar_t cv_glsecbright;
|
|
||||||
|
|
||||||
extern consvar_t cv_glfiltermode;
|
extern consvar_t cv_glfiltermode;
|
||||||
extern consvar_t cv_glanisotropicmode;
|
extern consvar_t cv_glanisotropicmode;
|
||||||
@@ -233,6 +233,12 @@ FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
|
|||||||
return (cv_glflashpal.value && HWR_ShouldUsePaletteRendering());
|
return (cv_glflashpal.value && HWR_ShouldUsePaletteRendering());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a pointer to the palette which should be used for caching textures.
|
||||||
|
FUNCINLINE static ATTRINLINE RGBA_t *HWR_GetTexturePalette(void)
|
||||||
|
{
|
||||||
|
return HWR_ShouldUsePaletteRendering() ? mapPalette : pLocalPalette;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}// extern "C"
|
}// extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -695,6 +695,7 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
|||||||
UINT16 w = gpatch->width, h = gpatch->height;
|
UINT16 w = gpatch->width, h = gpatch->height;
|
||||||
UINT32 size = w*h;
|
UINT32 size = w*h;
|
||||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||||
|
RGBA_t *palette = HWR_GetTexturePalette();
|
||||||
UINT8 translation[17]; // First the color index
|
UINT8 translation[17]; // First the color index
|
||||||
UINT8 cutoff[17]; // Brightness cutoff before using the next color
|
UINT8 cutoff[17]; // Brightness cutoff before using the next color
|
||||||
UINT8 translen = 0;
|
UINT8 translen = 0;
|
||||||
@@ -702,7 +703,7 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
|||||||
UINT8 colorbrightnesses[17];
|
UINT8 colorbrightnesses[17];
|
||||||
UINT8 color_match_lookup[256]; // optimization attempt
|
UINT8 color_match_lookup[256]; // optimization attempt
|
||||||
|
|
||||||
blendcolor = V_GetColor(0); // initialize
|
blendcolor = palette[0]; // initialize
|
||||||
memset(translation, 0, sizeof(translation));
|
memset(translation, 0, sizeof(translation));
|
||||||
memset(cutoff, 0, sizeof(cutoff));
|
memset(cutoff, 0, sizeof(cutoff));
|
||||||
|
|
||||||
@@ -781,7 +782,7 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
|||||||
|
|
||||||
for (i = 0; i < translen; i++) // moved from inside the loop to here
|
for (i = 0; i < translen; i++) // moved from inside the loop to here
|
||||||
{
|
{
|
||||||
RGBA_t tempc = V_GetColor(translation[i]);
|
RGBA_t tempc = palette[translation[i]];
|
||||||
SETBRIGHTNESS(colorbrightnesses[i], tempc.s.red, tempc.s.green, tempc.s.blue); // store brightnesses for comparison
|
SETBRIGHTNESS(colorbrightnesses[i], tempc.s.red, tempc.s.green, tempc.s.blue); // store brightnesses for comparison
|
||||||
}
|
}
|
||||||
// generate lookup table for color brightness matching
|
// generate lookup table for color brightness matching
|
||||||
@@ -958,11 +959,11 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
|||||||
mul = cutoff[firsti] - brightness;
|
mul = cutoff[firsti] - brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
blendcolor = V_GetColor(translation[firsti]);
|
blendcolor = palette[translation[firsti]];
|
||||||
|
|
||||||
if (mul > 0) // If it's 0, then we only need the first color.
|
if (mul > 0) // If it's 0, then we only need the first color.
|
||||||
{
|
{
|
||||||
nextcolor = V_GetColor(translation[secondi]);
|
nextcolor = palette[translation[secondi]];
|
||||||
|
|
||||||
// Find difference between points
|
// Find difference between points
|
||||||
r = (INT32)(nextcolor.s.red - blendcolor.s.red);
|
r = (INT32)(nextcolor.s.red - blendcolor.s.red);
|
||||||
@@ -1150,7 +1151,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
|||||||
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
|
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||||
|
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
lightlevel = *sector->lightlist[light].lightlevel;
|
||||||
|
|
||||||
if (sector->lightlist[light].extra_colormap)
|
if (sector->lightlist[light].extra_colormap)
|
||||||
colormap = sector->lightlist[light].extra_colormap;
|
colormap = sector->lightlist[light].extra_colormap;
|
||||||
@@ -1158,7 +1159,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
|
lightlevel = sector->lightlevel;
|
||||||
|
|
||||||
if (sector->extra_colormap)
|
if (sector->extra_colormap)
|
||||||
colormap = sector->extra_colormap;
|
colormap = sector->extra_colormap;
|
||||||
|
|||||||
@@ -2031,8 +2031,7 @@ void GL_SetTexture(GLMipmap_t *pTexInfo)
|
|||||||
{
|
{
|
||||||
if (pTexInfo->downloaded != tex_downloaded)
|
if (pTexInfo->downloaded != tex_downloaded)
|
||||||
{
|
{
|
||||||
if (!currently_batching)
|
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
|
||||||
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
|
|
||||||
tex_downloaded = pTexInfo->downloaded;
|
tex_downloaded = pTexInfo->downloaded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -110,13 +110,21 @@ HMS_on_read (char *s, size_t _1, size_t n, void *userdata)
|
|||||||
|
|
||||||
buffer = userdata;
|
buffer = userdata;
|
||||||
|
|
||||||
if (n >= (size_t)( buffer->end - buffer->needle ))
|
while (n >= (size_t)( buffer->end - buffer->needle ))
|
||||||
{
|
{
|
||||||
/* resize to next multiple of buffer size */
|
/* resize to next multiple of buffer size */
|
||||||
blocks = ( n / DEFAULT_BUFFER_SIZE + 1 );
|
blocks = ( n / DEFAULT_BUFFER_SIZE + 1 );
|
||||||
buffer->end += ( blocks * DEFAULT_BUFFER_SIZE );
|
buffer->end += ( blocks * DEFAULT_BUFFER_SIZE );
|
||||||
|
|
||||||
buffer->buffer = realloc(buffer->buffer, buffer->end);
|
void *tmp = realloc(buffer->buffer, buffer->end);
|
||||||
|
if (tmp == NULL)
|
||||||
|
{
|
||||||
|
// not enough memory to read it, bail
|
||||||
|
free(buffer->buffer);
|
||||||
|
buffer->buffer = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
buffer->buffer = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&buffer->buffer[buffer->needle], s, n);
|
memcpy(&buffer->buffer[buffer->needle], s, n);
|
||||||
|
|||||||
+100
-16
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "m_menu.h" // gametype_cons_t
|
#include "m_menu.h" // gametype_cons_t
|
||||||
#include "m_cond.h" // emblems
|
#include "m_cond.h" // emblems
|
||||||
|
#include "m_emotes.h"
|
||||||
|
|
||||||
#include "d_clisrv.h"
|
#include "d_clisrv.h"
|
||||||
|
|
||||||
@@ -94,6 +95,9 @@ static textinput_t w_chat;
|
|||||||
static boolean headsupactive = false;
|
static boolean headsupactive = false;
|
||||||
boolean hu_showscores; // draw rankings
|
boolean hu_showscores; // draw rankings
|
||||||
static char hu_tick;
|
static char hu_tick;
|
||||||
|
static tic_t hu_emoteanim = 0;
|
||||||
|
#define MAXEMOTESUGGESTIONS 8
|
||||||
|
static emote_t *emote_suggestions[MAXEMOTESUGGESTIONS] = {0};
|
||||||
|
|
||||||
static huddrawlist_h luahuddrawlist_scores;
|
static huddrawlist_h luahuddrawlist_scores;
|
||||||
|
|
||||||
@@ -1106,6 +1110,7 @@ void HU_Ticker(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
hu_tick++;
|
hu_tick++;
|
||||||
|
hu_emoteanim++;
|
||||||
hu_tick &= 7; // currently only to blink chat input cursor
|
hu_tick &= 7; // currently only to blink chat input cursor
|
||||||
|
|
||||||
if (PLAYER1INPUTDOWN(gc_scores))
|
if (PLAYER1INPUTDOWN(gc_scores))
|
||||||
@@ -1399,7 +1404,7 @@ boolean HU_Responder(event_t *ev)
|
|||||||
&& ev->data1 != gamecontrol[0][gc_talkkey][1]))
|
&& ev->data1 != gamecontrol[0][gc_talkkey][1]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
M_TextInputHandle(&w_chat, c);
|
M_TextInputHandleEmotes(&w_chat, c, emote_suggestions, MAXEMOTESUGGESTIONS);
|
||||||
|
|
||||||
if (c == KEY_ENTER)
|
if (c == KEY_ENTER)
|
||||||
{
|
{
|
||||||
@@ -1439,6 +1444,8 @@ boolean HU_Responder(event_t *ev)
|
|||||||
|
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
|
|
||||||
|
#define HU_DrawEmote(x, y, emote, flags) M_DrawEmote((x), (y), (emote), hu_emoteanim, (flags))
|
||||||
|
|
||||||
// Precompile a wordwrapped string to any given width.
|
// Precompile a wordwrapped string to any given width.
|
||||||
// This is a muuuch better method than V_WORDWRAP.
|
// This is a muuuch better method than V_WORDWRAP.
|
||||||
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
|
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
|
||||||
@@ -1450,6 +1457,8 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||||||
size_t slen;
|
size_t slen;
|
||||||
char *newstring = Z_StrDup(string);
|
char *newstring = Z_StrDup(string);
|
||||||
INT32 spacewidth = (vid.width < 640) ? 8 : 4, charwidth = (vid.width < 640) ? 8 : 4;
|
INT32 spacewidth = (vid.width < 640) ? 8 : 4, charwidth = (vid.width < 640) ? 8 : 4;
|
||||||
|
emote_t *emote = NULL;
|
||||||
|
int emotelen = 0;
|
||||||
|
|
||||||
slen = strlen(string);
|
slen = strlen(string);
|
||||||
x = 0;
|
x = 0;
|
||||||
@@ -1471,7 +1480,12 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||||||
c = toupper(c);
|
c = toupper(c);
|
||||||
c -= HU_FONTSTART;
|
c -= HU_FONTSTART;
|
||||||
|
|
||||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
if ((emote = M_VerifyEmote(string+i, &emotelen)))
|
||||||
|
{
|
||||||
|
chw = EMOTEWIDTH;
|
||||||
|
i += emotelen-1; // Will be incremented on next loop iteration, hence -1
|
||||||
|
}
|
||||||
|
else if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
||||||
{
|
{
|
||||||
chw = spacewidth;
|
chw = spacewidth;
|
||||||
lastusablespace = i;
|
lastusablespace = i;
|
||||||
@@ -1493,7 +1507,6 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||||||
return newstring;
|
return newstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 30/7/18: chaty is now the distance at which the lowest point of the chat will be drawn if that makes any sense.
|
// 30/7/18: chaty is now the distance at which the lowest point of the chat will be drawn if that makes any sense.
|
||||||
|
|
||||||
INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh
|
INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh
|
||||||
@@ -1526,6 +1539,8 @@ static void HU_drawMiniChat(void)
|
|||||||
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;
|
||||||
INT32 linescount = 0;
|
INT32 linescount = 0;
|
||||||
|
emote_t *emote = NULL;
|
||||||
|
int emotelen = 0;
|
||||||
|
|
||||||
while(msg[j]) // iterate through msg
|
while(msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
@@ -1550,6 +1565,11 @@ static void HU_drawMiniChat(void)
|
|||||||
|
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
else if ((emote = M_VerifyEmote(msg+j, &emotelen)))
|
||||||
|
{
|
||||||
|
dx += EMOTEWIDTH - charwidth;
|
||||||
|
j += emotelen;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j++;
|
j++;
|
||||||
@@ -1595,6 +1615,8 @@ static void HU_drawMiniChat(void)
|
|||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
|
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
|
||||||
UINT8 *colormap = NULL;
|
UINT8 *colormap = NULL;
|
||||||
|
emote_t *emote = NULL;
|
||||||
|
int emotelen = 0;
|
||||||
|
|
||||||
while(msg[j]) // iterate through msg
|
while(msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
@@ -1621,6 +1643,16 @@ static void HU_drawMiniChat(void)
|
|||||||
|
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
else if ((emote = M_VerifyEmote(msg+j, &emotelen)))
|
||||||
|
{
|
||||||
|
if (cv_chatbacktint.value) // on request of wolfy
|
||||||
|
V_DrawFillConsoleMap(x + dx + 2, y+dy, EMOTEWIDTH, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||||
|
|
||||||
|
HU_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag);
|
||||||
|
dx += EMOTEWIDTH - charwidth;
|
||||||
|
|
||||||
|
j += emotelen;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cv_chatbacktint.value) // on request of wolfy
|
if (cv_chatbacktint.value) // on request of wolfy
|
||||||
@@ -1698,6 +1730,9 @@ static void HU_drawChatLog(INT32 offset)
|
|||||||
INT32 j = 0;
|
INT32 j = 0;
|
||||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
|
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
|
||||||
UINT8 *colormap = NULL;
|
UINT8 *colormap = NULL;
|
||||||
|
emote_t *emote = NULL;
|
||||||
|
int emotelen = 0;
|
||||||
|
|
||||||
while(msg[j]) // iterate through msg
|
while(msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
if (msg[j] < HU_FONTSTART) // don't draw
|
if (msg[j] < HU_FONTSTART) // don't draw
|
||||||
@@ -1719,6 +1754,15 @@ static void HU_drawChatLog(INT32 offset)
|
|||||||
|
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
else if ((emote = M_VerifyEmote(msg+j, &emotelen)))
|
||||||
|
{
|
||||||
|
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
||||||
|
{
|
||||||
|
HU_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||||
|
dx += EMOTEWIDTH - charwidth;
|
||||||
|
}
|
||||||
|
j += emotelen;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
||||||
@@ -1844,7 +1888,7 @@ static void HU_DrawChat(void)
|
|||||||
typelines = 1;
|
typelines = 1;
|
||||||
|
|
||||||
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
|
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
|
||||||
V_DrawChatCharacter(chatx+2+c+charwidth*w_chat.cursor, y+1, '_'|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
V_DrawChatCharacter(chatx+2+c, y+1, '_'|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||||
|
|
||||||
if (w_chat.select != w_chat.cursor)
|
if (w_chat.select != w_chat.cursor)
|
||||||
{
|
{
|
||||||
@@ -1855,30 +1899,40 @@ static void HU_DrawChat(void)
|
|||||||
while (w_chat_buf[i])
|
while (w_chat_buf[i])
|
||||||
{
|
{
|
||||||
boolean skippedline = false;
|
boolean skippedline = false;
|
||||||
if (w_chat.cursor == (i+1))
|
emote_t *emote = NULL;
|
||||||
|
int emotelen = 0;
|
||||||
|
int drawwidth = charwidth; // if we've drawn emote, selection needs to account for that
|
||||||
|
|
||||||
|
if ((emote = M_VerifyEmote(w_chat_buf+i, &emotelen)))
|
||||||
|
{
|
||||||
|
HU_DrawEmote(chatx + c + 2, y-1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT|t);
|
||||||
|
c += EMOTEWIDTH - charwidth;
|
||||||
|
i += emotelen-1;
|
||||||
|
drawwidth = EMOTEWIDTH;
|
||||||
|
}
|
||||||
|
else if (w_chat_buf[i] >= HU_FONTSTART) //Hurdler: isn't it better like that?
|
||||||
|
V_DrawChatCharacter(chatx + c + 2, y, w_chat_buf[i] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
|
||||||
|
|
||||||
|
// Draw selection
|
||||||
|
if (i >= select_start && i < select_end)
|
||||||
|
V_DrawFill(chatx + c + 2 - (drawwidth-charwidth), y-1, drawwidth, charheight, 103|V_TRANSLUCENT|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t);
|
||||||
|
|
||||||
|
++i;
|
||||||
|
|
||||||
|
if (w_chat.cursor == i)
|
||||||
{
|
{
|
||||||
INT32 cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
|
INT32 cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
|
||||||
INT32 cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
|
INT32 cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
|
||||||
if (hu_tick < 4)
|
if (hu_tick < 4)
|
||||||
V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||||
|
|
||||||
if (cursorx == chatx+1 && saylen == i) // a weirdo hack
|
if (cursorx == chatx+1 && saylen == i-1) // a weirdo hack
|
||||||
{
|
{
|
||||||
typelines += 1;
|
typelines += 1;
|
||||||
skippedline = true;
|
skippedline = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hurdler: isn't it better like that?
|
|
||||||
if (w_chat_buf[i] >= HU_FONTSTART)
|
|
||||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat_buf[i] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
|
|
||||||
|
|
||||||
// Draw selection
|
|
||||||
if (i >= select_start && i < select_end)
|
|
||||||
V_DrawFill(chatx + c + 2, y-1, charwidth, charheight, 103|V_TRANSLUCENT|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t);
|
|
||||||
|
|
||||||
++i;
|
|
||||||
|
|
||||||
c += charwidth;
|
c += charwidth;
|
||||||
if (c > boxw-(charwidth*2) && !skippedline)
|
if (c > boxw-(charwidth*2) && !skippedline)
|
||||||
{
|
{
|
||||||
@@ -1888,6 +1942,36 @@ static void HU_DrawChat(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emote_suggestions[0])
|
||||||
|
{
|
||||||
|
// A bit of copy-paste from /pm code :p
|
||||||
|
INT32 suggesty = chaty - charheight - 1;
|
||||||
|
size_t longest_suggestion_length = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < MAXEMOTESUGGESTIONS && emote_suggestions[i]; ++i)
|
||||||
|
{
|
||||||
|
longest_suggestion_length = max(longest_suggestion_length, strlen(emote_suggestions[i]->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NETSPLITSCREEN
|
||||||
|
if (splitscreen)
|
||||||
|
{
|
||||||
|
suggesty -= BASEVIDHEIGHT/2;
|
||||||
|
if (splitscreen > 1)
|
||||||
|
suggesty += 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
suggesty -= (cv_kartspeedometer.value ? 16 : 0);
|
||||||
|
|
||||||
|
for (i = 0; i < MAXEMOTESUGGESTIONS && emote_suggestions[i]; ++i)
|
||||||
|
{
|
||||||
|
V_DrawFillConsoleMap(chatx + boxw + 2, suggesty - (7*i), (longest_suggestion_length+2)*4 + EMOTEWIDTH, 6, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||||
|
V_DrawSmallString(chatx + boxw + 4 + EMOTEWIDTH, suggesty - (7*i), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", emote_suggestions[i]->name));
|
||||||
|
HU_DrawEmote(chatx + boxw + 2, suggesty - i*7, emote_suggestions[i], V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handle /pm list. It's messy, horrible and I don't care.
|
// handle /pm list. It's messy, horrible and I don't care.
|
||||||
if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-3
@@ -43,8 +43,9 @@ extern UINT8 sound_started;
|
|||||||
|
|
||||||
/** \brief info of samplerate
|
/** \brief info of samplerate
|
||||||
*/
|
*/
|
||||||
|
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||||
extern consvar_t cv_samplerate;
|
extern consvar_t cv_samplerate;
|
||||||
//extern consvar_t cv_rndsoundpitch;
|
#endif
|
||||||
|
|
||||||
/** \brief The I_GetSfx function
|
/** \brief The I_GetSfx function
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ void I_ShutdownSound(void);
|
|||||||
|
|
||||||
\return sfx handle
|
\return sfx handle
|
||||||
*/
|
*/
|
||||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel);
|
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, INT32 channel);
|
||||||
|
|
||||||
/** \brief Stops a sound channel.
|
/** \brief Stops a sound channel.
|
||||||
|
|
||||||
@@ -114,7 +115,7 @@ boolean I_SoundIsPlaying(INT32 handle);
|
|||||||
|
|
||||||
\return void
|
\return void
|
||||||
*/
|
*/
|
||||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch);
|
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep);
|
||||||
|
|
||||||
/** \brief The I_SetSfxVolume function
|
/** \brief The I_SetSfxVolume function
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,8 @@ boolean I_UseNativeKeyboard(void);
|
|||||||
|
|
||||||
boolean I_CheckNativeRes(void);
|
boolean I_CheckNativeRes(void);
|
||||||
|
|
||||||
|
void I_SetBorderlessWindow(void);
|
||||||
|
|
||||||
#ifdef USE_FBO_OGL
|
#ifdef USE_FBO_OGL
|
||||||
|
|
||||||
void RefreshOGLSDLSurface(void);
|
void RefreshOGLSDLSurface(void);
|
||||||
|
|||||||
+2660
-2717
File diff suppressed because it is too large.
Load diff
+202
-205
@@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
actionf_t action; ///< Function pointer corresponding to the actual action.
|
actionf_p1 action; ///< Function pointer corresponding to the actual action.
|
||||||
const char *name; ///< Name of the action in ALL CAPS.
|
const char *name; ///< Name of the action in ALL CAPS.
|
||||||
} actionpointer_t;
|
} actionpointer_t;
|
||||||
|
|
||||||
@@ -246,209 +246,206 @@ struct mobj_s;
|
|||||||
|
|
||||||
// IMPORTANT NOTE: If you add/remove from this list of action
|
// IMPORTANT NOTE: If you add/remove from this list of action
|
||||||
// functions, don't forget to update them in dehacked.c!
|
// functions, don't forget to update them in dehacked.c!
|
||||||
void A_Explode(struct mobj_s *actor);
|
void A_Explode(void *actor);
|
||||||
void A_Pain(struct mobj_s *actor);
|
void A_Pain(void *actor);
|
||||||
void A_Fall(struct mobj_s *actor);
|
void A_Fall(void *actor);
|
||||||
void A_MonitorPop(struct mobj_s *actor);
|
void A_MonitorPop(void *actor);
|
||||||
void A_Look(struct mobj_s *actor);
|
void A_Look(void *actor);
|
||||||
void A_Chase(struct mobj_s *actor);
|
void A_Chase(void *actor);
|
||||||
void A_FaceStabChase(struct mobj_s *actor);
|
void A_FaceStabChase(void *actor);
|
||||||
void A_FaceTarget(struct mobj_s *actor);
|
void A_FaceTarget(void *actor);
|
||||||
void A_FaceTracer(struct mobj_s *actor);
|
void A_FaceTracer(void *actor);
|
||||||
void A_Scream(struct mobj_s *actor);
|
void A_Scream(void *actor);
|
||||||
void A_BossDeath(struct mobj_s *actor);
|
void A_BossDeath(void *actor);
|
||||||
void A_CustomPower(struct mobj_s *actor); // Use this for a custom power
|
void A_CustomPower(void *actor); // Use this for a custom power
|
||||||
void A_GiveWeapon(struct mobj_s *actor); // Gives the player weapon(s)
|
void A_GiveWeapon(void *actor); // Gives the player weapon(s)
|
||||||
void A_JumpShield(struct mobj_s *actor); // Obtained Jump Shield
|
void A_JumpShield(void *actor); // Obtained Jump Shield
|
||||||
void A_RingShield(struct mobj_s *actor); // Obtained Ring Shield
|
void A_RingShield(void *actor); // Obtained Ring Shield
|
||||||
void A_RingBox(struct mobj_s *actor); // Obtained Ring Box Tails
|
void A_RingBox(void *actor); // Obtained Ring Box Tails
|
||||||
void A_Invincibility(struct mobj_s *actor); // Obtained Invincibility Box
|
void A_Invincibility(void *actor); // Obtained Invincibility Box
|
||||||
void A_SuperSneakers(struct mobj_s *actor); // Obtained Super Sneakers Box
|
void A_SuperSneakers(void *actor); // Obtained Super Sneakers Box
|
||||||
void A_BunnyHop(struct mobj_s *actor); // have bunny hop tails
|
void A_BunnyHop(void *actor); // have bunny hop tails
|
||||||
void A_BubbleSpawn(struct mobj_s *actor); // Randomly spawn bubbles
|
void A_BubbleSpawn(void *actor); // Randomly spawn bubbles
|
||||||
void A_FanBubbleSpawn(struct mobj_s *actor);
|
void A_FanBubbleSpawn(void *actor);
|
||||||
void A_BubbleRise(struct mobj_s *actor); // Bubbles float to surface
|
void A_BubbleRise(void *actor); // Bubbles float to surface
|
||||||
void A_BubbleCheck(struct mobj_s *actor); // Don't draw if not underwater
|
void A_BubbleCheck(void *actor); // Don't draw if not underwater
|
||||||
void A_AwardScore(struct mobj_s *actor);
|
void A_AwardScore(void *actor);
|
||||||
void A_ExtraLife(struct mobj_s *actor); // Extra Life
|
void A_ExtraLife(void *actor); // Extra Life
|
||||||
void A_BombShield(struct mobj_s *actor); // Obtained Bomb Shield
|
void A_BombShield(void *actor); // Obtained Bomb Shield
|
||||||
void A_WaterShield(struct mobj_s *actor); // Obtained Water Shield
|
void A_WaterShield(void *actor); // Obtained Water Shield
|
||||||
void A_ForceShield(struct mobj_s *actor); // Obtained Force Shield
|
void A_ForceShield(void *actor); // Obtained Force Shield
|
||||||
void A_PityShield(struct mobj_s *actor); // Obtained Pity Shield. We're... sorry.
|
void A_PityShield(void *actor); // Obtained Pity Shield. We're... sorry.
|
||||||
void A_GravityBox(struct mobj_s *actor);
|
void A_GravityBox(void *actor);
|
||||||
void A_ScoreRise(struct mobj_s *actor); // Rise the score logo
|
void A_ScoreRise(void *actor); // Rise the score logo
|
||||||
void A_ParticleSpawn(struct mobj_s *actor);
|
void A_ParticleSpawn(void *actor);
|
||||||
void A_AttractChase(struct mobj_s *actor); // Ring Chase
|
void A_AttractChase(void *actor); // Ring Chase
|
||||||
void A_DropMine(struct mobj_s *actor); // Drop Mine from Skim or Jetty-Syn Bomber
|
void A_DropMine(void *actor); // Drop Mine from Skim or Jetty-Syn Bomber
|
||||||
void A_FishJump(struct mobj_s *actor); // Fish Jump
|
void A_FishJump(void *actor); // Fish Jump
|
||||||
void A_ThrownRing(struct mobj_s *actor); // Sparkle trail for red ring
|
void A_ThrownRing(void *actor); // Sparkle trail for red ring
|
||||||
void A_GrenadeRing(struct mobj_s *actor); // SRB2kart
|
void A_GrenadeRing(void *actor); // SRB2kart
|
||||||
void A_SetSolidSteam(struct mobj_s *actor);
|
void A_SetSolidSteam(void *actor);
|
||||||
void A_UnsetSolidSteam(struct mobj_s *actor);
|
void A_UnsetSolidSteam(void *actor);
|
||||||
void A_SignPlayer(struct mobj_s *actor);
|
void A_SignPlayer(void *actor);
|
||||||
void A_OverlayThink(struct mobj_s *actor);
|
void A_OverlayThink(void *actor);
|
||||||
void A_JetChase(struct mobj_s *actor);
|
void A_JetChase(void *actor);
|
||||||
void A_JetbThink(struct mobj_s *actor); // Jetty-Syn Bomber Thinker
|
void A_JetbThink(void *actor); // Jetty-Syn Bomber Thinker
|
||||||
void A_JetgThink(struct mobj_s *actor); // Jetty-Syn Gunner Thinker
|
void A_JetgThink(void *actor); // Jetty-Syn Gunner Thinker
|
||||||
void A_JetgShoot(struct mobj_s *actor); // Jetty-Syn Shoot Function
|
void A_JetgShoot(void *actor); // Jetty-Syn Shoot Function
|
||||||
void A_ShootBullet(struct mobj_s *actor); // JetgShoot without reactiontime setting
|
void A_ShootBullet(void *actor); // JetgShoot without reactiontime setting
|
||||||
void A_MinusDigging(struct mobj_s *actor);
|
void A_MinusDigging(void *actor);
|
||||||
void A_MinusPopup(struct mobj_s *actor);
|
void A_MinusPopup(void *actor);
|
||||||
void A_MinusCheck(struct mobj_s *actor);
|
void A_MinusCheck(void *actor);
|
||||||
void A_ChickenCheck(struct mobj_s *actor);
|
void A_ChickenCheck(void *actor);
|
||||||
void A_MouseThink(struct mobj_s *actor); // Mouse Thinker
|
void A_MouseThink(void *actor); // Mouse Thinker
|
||||||
void A_DetonChase(struct mobj_s *actor); // Deton Chaser
|
void A_DetonChase(void *actor); // Deton Chaser
|
||||||
void A_CapeChase(struct mobj_s *actor); // Fake little Super Sonic cape
|
void A_CapeChase(void *actor); // Fake little Super Sonic cape
|
||||||
void A_RotateSpikeBall(struct mobj_s *actor); // Spike ball rotation
|
void A_RotateSpikeBall(void *actor); // Spike ball rotation
|
||||||
void A_SlingAppear(struct mobj_s *actor);
|
void A_SlingAppear(void *actor);
|
||||||
void A_MaceRotate(struct mobj_s *actor);
|
void A_MaceRotate(void *actor);
|
||||||
void A_UnidusBall(struct mobj_s *actor);
|
void A_UnidusBall(void *actor);
|
||||||
void A_RockSpawn(struct mobj_s *actor);
|
void A_RockSpawn(void *actor);
|
||||||
void A_SetFuse(struct mobj_s *actor);
|
void A_SetFuse(void *actor);
|
||||||
void A_CrawlaCommanderThink(struct mobj_s *actor); // Crawla Commander
|
void A_CrawlaCommanderThink(void *actor); // Crawla Commander
|
||||||
void A_SmokeTrailer(struct mobj_s *actor);
|
void A_SmokeTrailer(void *actor);
|
||||||
void A_RingExplode(struct mobj_s *actor);
|
void A_RingExplode(void *actor);
|
||||||
void A_OldRingExplode(struct mobj_s *actor);
|
void A_OldRingExplode(void *actor);
|
||||||
void A_MixUp(struct mobj_s *actor);
|
void A_MixUp(void *actor);
|
||||||
void A_RecyclePowers(struct mobj_s *actor);
|
void A_RecyclePowers(void *actor);
|
||||||
void A_BossScream(struct mobj_s *actor);
|
void A_BossScream(void *actor);
|
||||||
void A_Boss2TakeDamage(struct mobj_s *actor);
|
void A_Boss2TakeDamage(void *actor);
|
||||||
void A_GoopSplat(struct mobj_s *actor);
|
void A_GoopSplat(void *actor);
|
||||||
void A_Boss2PogoSFX(struct mobj_s *actor);
|
void A_Boss2PogoSFX(void *actor);
|
||||||
void A_Boss2PogoTarget(struct mobj_s *actor);
|
void A_Boss2PogoTarget(void *actor);
|
||||||
void A_EggmanBox(struct mobj_s *actor);
|
void A_EggmanBox(void *actor);
|
||||||
void A_TurretFire(struct mobj_s *actor);
|
void A_TurretFire(void *actor);
|
||||||
void A_SuperTurretFire(struct mobj_s *actor);
|
void A_SuperTurretFire(void *actor);
|
||||||
void A_TurretStop(struct mobj_s *actor);
|
void A_TurretStop(void *actor);
|
||||||
void A_JetJawRoam(struct mobj_s *actor);
|
void A_JetJawRoam(void *actor);
|
||||||
void A_JetJawChomp(struct mobj_s *actor);
|
void A_JetJawChomp(void *actor);
|
||||||
void A_PointyThink(struct mobj_s *actor);
|
void A_PointyThink(void *actor);
|
||||||
void A_CheckBuddy(struct mobj_s *actor);
|
void A_CheckBuddy(void *actor);
|
||||||
void A_HoodThink(struct mobj_s *actor);
|
void A_HoodThink(void *actor);
|
||||||
void A_ArrowCheck(struct mobj_s *actor);
|
void A_ArrowCheck(void *actor);
|
||||||
void A_SnailerThink(struct mobj_s *actor);
|
void A_SnailerThink(void *actor);
|
||||||
void A_SharpChase(struct mobj_s *actor);
|
void A_SharpChase(void *actor);
|
||||||
void A_SharpSpin(struct mobj_s *actor);
|
void A_SharpSpin(void *actor);
|
||||||
void A_VultureVtol(struct mobj_s *actor);
|
void A_VultureVtol(void *actor);
|
||||||
void A_VultureCheck(struct mobj_s *actor);
|
void A_VultureCheck(void *actor);
|
||||||
void A_SkimChase(struct mobj_s *actor);
|
void A_SkimChase(void *actor);
|
||||||
void A_SkullAttack(struct mobj_s *actor);
|
void A_SkullAttack(void *actor);
|
||||||
void A_LobShot(struct mobj_s *actor);
|
void A_LobShot(void *actor);
|
||||||
void A_FireShot(struct mobj_s *actor);
|
void A_FireShot(void *actor);
|
||||||
void A_SuperFireShot(struct mobj_s *actor);
|
void A_SuperFireShot(void *actor);
|
||||||
void A_BossFireShot(struct mobj_s *actor);
|
void A_BossFireShot(void *actor);
|
||||||
void A_Boss7FireMissiles(struct mobj_s *actor);
|
void A_Boss7FireMissiles(void *actor);
|
||||||
void A_Boss1Laser(struct mobj_s *actor);
|
void A_Boss1Laser(void *actor);
|
||||||
void A_FocusTarget(struct mobj_s *actor);
|
void A_FocusTarget(void *actor);
|
||||||
void A_Boss4Reverse(struct mobj_s *actor);
|
void A_Boss4Reverse(void *actor);
|
||||||
void A_Boss4SpeedUp(struct mobj_s *actor);
|
void A_Boss4SpeedUp(void *actor);
|
||||||
void A_Boss4Raise(struct mobj_s *actor);
|
void A_Boss4Raise(void *actor);
|
||||||
void A_SparkFollow(struct mobj_s *actor);
|
void A_SparkFollow(void *actor);
|
||||||
void A_BuzzFly(struct mobj_s *actor);
|
void A_BuzzFly(void *actor);
|
||||||
void A_GuardChase(struct mobj_s *actor);
|
void A_GuardChase(void *actor);
|
||||||
void A_EggShield(struct mobj_s *actor);
|
void A_EggShield(void *actor);
|
||||||
void A_SetReactionTime(struct mobj_s *actor);
|
void A_SetReactionTime(void *actor);
|
||||||
void A_Boss1Spikeballs(struct mobj_s *actor);
|
void A_Boss1Spikeballs(void *actor);
|
||||||
void A_Boss3TakeDamage(struct mobj_s *actor);
|
void A_Boss3TakeDamage(void *actor);
|
||||||
void A_Boss3Path(struct mobj_s *actor);
|
void A_Boss3Path(void *actor);
|
||||||
void A_LinedefExecute(struct mobj_s *actor);
|
void A_LinedefExecute(void *actor);
|
||||||
void A_PlaySeeSound(struct mobj_s *actor);
|
void A_PlaySeeSound(void *actor);
|
||||||
void A_PlayAttackSound(struct mobj_s *actor);
|
void A_PlayAttackSound(void *actor);
|
||||||
void A_PlayActiveSound(struct mobj_s *actor);
|
void A_PlayActiveSound(void *actor);
|
||||||
void A_1upThinker(struct mobj_s *actor);
|
void A_1upThinker(void *actor);
|
||||||
void A_BossZoom(struct mobj_s *actor); //Unused
|
void A_BossZoom(void *actor); //Unused
|
||||||
void A_Boss1Chase(struct mobj_s *actor);
|
void A_Boss1Chase(void *actor);
|
||||||
void A_Boss2Chase(struct mobj_s *actor);
|
void A_Boss2Chase(void *actor);
|
||||||
void A_Boss2Pogo(struct mobj_s *actor);
|
void A_Boss2Pogo(void *actor);
|
||||||
void A_Boss7Chase(struct mobj_s *actor);
|
void A_Boss7Chase(void *actor);
|
||||||
void A_BossJetFume(struct mobj_s *actor);
|
void A_BossJetFume(void *actor);
|
||||||
void A_SpawnObjectAbsolute(struct mobj_s *actor);
|
void A_SpawnObjectAbsolute(void *actor);
|
||||||
void A_SpawnObjectRelative(struct mobj_s *actor);
|
void A_SpawnObjectRelative(void *actor);
|
||||||
void A_ChangeAngleRelative(struct mobj_s *actor);
|
void A_ChangeAngleRelative(void *actor);
|
||||||
void A_ChangeAngleAbsolute(struct mobj_s *actor);
|
void A_ChangeAngleAbsolute(void *actor);
|
||||||
void A_RollAngle(struct mobj_s *actor);
|
void A_PlaySound(void *actor);
|
||||||
void A_ChangeRollAngleRelative(struct mobj_s *actor);
|
void A_FindTarget(void *actor);
|
||||||
void A_ChangeRollAngleAbsolute(struct mobj_s *actor);
|
void A_FindTracer(void *actor);
|
||||||
void A_PlaySound(struct mobj_s *actor);
|
void A_SetTics(void *actor);
|
||||||
void A_FindTarget(struct mobj_s *actor);
|
void A_SetRandomTics(void *actor);
|
||||||
void A_FindTracer(struct mobj_s *actor);
|
void A_ChangeColorRelative(void *actor);
|
||||||
void A_SetTics(struct mobj_s *actor);
|
void A_ChangeColorAbsolute(void *actor);
|
||||||
void A_SetRandomTics(struct mobj_s *actor);
|
void A_MoveRelative(void *actor);
|
||||||
void A_ChangeColorRelative(struct mobj_s *actor);
|
void A_MoveAbsolute(void *actor);
|
||||||
void A_ChangeColorAbsolute(struct mobj_s *actor);
|
void A_Thrust(void *actor);
|
||||||
void A_MoveRelative(struct mobj_s *actor);
|
void A_ZThrust(void *actor);
|
||||||
void A_MoveAbsolute(struct mobj_s *actor);
|
void A_SetTargetsTarget(void *actor);
|
||||||
void A_Thrust(struct mobj_s *actor);
|
void A_SetObjectFlags(void *actor);
|
||||||
void A_ZThrust(struct mobj_s *actor);
|
void A_SetObjectFlags2(void *actor);
|
||||||
void A_SetTargetsTarget(struct mobj_s *actor);
|
void A_RandomState(void *actor);
|
||||||
void A_SetObjectFlags(struct mobj_s *actor);
|
void A_RandomStateRange(void *actor);
|
||||||
void A_SetObjectFlags2(struct mobj_s *actor);
|
void A_DualAction(void *actor);
|
||||||
void A_RandomState(struct mobj_s *actor);
|
void A_RemoteAction(void *actor);
|
||||||
void A_RandomStateRange(struct mobj_s *actor);
|
void A_ToggleFlameJet(void *actor);
|
||||||
void A_DualAction(struct mobj_s *actor);
|
void A_ItemPop(void *actor); // SRB2kart
|
||||||
void A_RemoteAction(struct mobj_s *actor);
|
void A_JawzChase(void *actor); // SRB2kart
|
||||||
void A_ToggleFlameJet(struct mobj_s *actor);
|
void A_JawzExplode(void *actor); // SRB2kart
|
||||||
void A_ItemPop(struct mobj_s *actor); // SRB2kart
|
void A_SPBChase(void *actor); // SRB2kart
|
||||||
void A_JawzChase(struct mobj_s *actor); // SRB2kart
|
void A_MineExplode(void *actor); // SRB2kart
|
||||||
void A_JawzExplode(struct mobj_s *actor); // SRB2kart
|
void A_BallhogExplode(void *actor); // SRB2kart
|
||||||
void A_SPBChase(struct mobj_s *actor); // SRB2kart
|
void A_LightningFollowPlayer(void *actor); // SRB2kart: Lightning shield effect player chasing
|
||||||
void A_MineExplode(struct mobj_s *actor); // SRB2kart
|
void A_FZBoomFlash(void *actor); // SRB2kart
|
||||||
void A_BallhogExplode(struct mobj_s *actor); // SRB2kart
|
void A_FZBoomSmoke(void *actor); // SRB2kart
|
||||||
void A_LightningFollowPlayer(struct mobj_s *actor); // SRB2kart: Lightning shield effect player chasing
|
void A_RandomShadowFrame(void *actor); //SRB2kart: Shadow spawner frame randomizer
|
||||||
void A_FZBoomFlash(struct mobj_s *actor); // SRB2kart
|
void A_RoamingShadowThinker(void *actor); // SRB2kart: Roaming Shadow moving + attacking players.
|
||||||
void A_FZBoomSmoke(struct mobj_s *actor); // SRB2kart
|
void A_MayonakaArrow(void *actor); //SRB2kart: midnight channel arrow sign
|
||||||
void A_RandomShadowFrame(struct mobj_s *actor); //SRB2kart: Shadow spawner frame randomizer
|
void A_ReaperThinker(void *actor); //SRB2kart: mementos reaper
|
||||||
void A_RoamingShadowThinker(struct mobj_s *actor); // SRB2kart: Roaming Shadow moving + attacking players.
|
void A_MementosTPParticles(void *actor); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
|
||||||
void A_MayonakaArrow(struct mobj_s *actor); //SRB2kart: midnight channel arrow sign
|
void A_FlameParticle(void *actor); // SRB2kart
|
||||||
void A_ReaperThinker(struct mobj_s *actor); //SRB2kart: mementos reaper
|
void A_OrbitNights(void *actor);
|
||||||
void A_MementosTPParticles(struct mobj_s *actor); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
|
void A_GhostMe(void *actor);
|
||||||
void A_FlameParticle(struct mobj_s *actor); // SRB2kart
|
void A_SetObjectState(void *actor);
|
||||||
void A_OrbitNights(struct mobj_s *actor);
|
void A_SetObjectTypeState(void *actor);
|
||||||
void A_GhostMe(struct mobj_s *actor);
|
void A_KnockBack(void *actor);
|
||||||
void A_SetObjectState(struct mobj_s *actor);
|
void A_PushAway(void *actor);
|
||||||
void A_SetObjectTypeState(struct mobj_s *actor);
|
void A_RingDrain(void *actor);
|
||||||
void A_KnockBack(struct mobj_s *actor);
|
void A_SplitShot(void *actor);
|
||||||
void A_PushAway(struct mobj_s *actor);
|
void A_MissileSplit(void *actor);
|
||||||
void A_RingDrain(struct mobj_s *actor);
|
void A_MultiShot(void *actor);
|
||||||
void A_SplitShot(struct mobj_s *actor);
|
void A_InstaLoop(void *actor);
|
||||||
void A_MissileSplit(struct mobj_s *actor);
|
void A_Custom3DRotate(void *actor);
|
||||||
void A_MultiShot(struct mobj_s *actor);
|
void A_SearchForPlayers(void *actor);
|
||||||
void A_InstaLoop(struct mobj_s *actor);
|
void A_CheckRandom(void *actor);
|
||||||
void A_Custom3DRotate(struct mobj_s *actor);
|
void A_CheckTargetRings(void *actor);
|
||||||
void A_SearchForPlayers(struct mobj_s *actor);
|
void A_CheckRings(void *actor);
|
||||||
void A_CheckRandom(struct mobj_s *actor);
|
void A_CheckTotalRings(void *actor);
|
||||||
void A_CheckTargetRings(struct mobj_s *actor);
|
void A_CheckHealth(void *actor);
|
||||||
void A_CheckRings(struct mobj_s *actor);
|
void A_CheckRange(void *actor);
|
||||||
void A_CheckTotalRings(struct mobj_s *actor);
|
void A_CheckHeight(void *actor);
|
||||||
void A_CheckHealth(struct mobj_s *actor);
|
void A_CheckTrueRange(void *actor);
|
||||||
void A_CheckRange(struct mobj_s *actor);
|
void A_CheckThingCount(void *actor);
|
||||||
void A_CheckHeight(struct mobj_s *actor);
|
void A_CheckAmbush(void *actor);
|
||||||
void A_CheckTrueRange(struct mobj_s *actor);
|
void A_CheckCustomValue(void *actor);
|
||||||
void A_CheckThingCount(struct mobj_s *actor);
|
void A_CheckCusValMemo(void *actor);
|
||||||
void A_CheckAmbush(struct mobj_s *actor);
|
void A_SetCustomValue(void *actor);
|
||||||
void A_CheckCustomValue(struct mobj_s *actor);
|
void A_UseCusValMemo(void *actor);
|
||||||
void A_CheckCusValMemo(struct mobj_s *actor);
|
void A_RelayCustomValue(void *actor);
|
||||||
void A_SetCustomValue(struct mobj_s *actor);
|
void A_CusValAction(void *actor);
|
||||||
void A_UseCusValMemo(struct mobj_s *actor);
|
void A_ForceStop(void *actor);
|
||||||
void A_RelayCustomValue(struct mobj_s *actor);
|
void A_ForceWin(void *actor);
|
||||||
void A_CusValAction(struct mobj_s *actor);
|
void A_SpikeRetract(void *actor);
|
||||||
void A_ForceStop(struct mobj_s *actor);
|
void A_InfoState(void *actor);
|
||||||
void A_ForceWin(struct mobj_s *actor);
|
void A_Repeat(void *actor);
|
||||||
void A_SpikeRetract(struct mobj_s *actor);
|
void A_SetScale(void *actor);
|
||||||
void A_InfoState(struct mobj_s *actor);
|
void A_RemoteDamage(void *actor);
|
||||||
void A_Repeat(struct mobj_s *actor);
|
void A_HomingChase(void *actor);
|
||||||
void A_SetScale(struct mobj_s *actor);
|
void A_TrapShot(void *actor);
|
||||||
void A_RemoteDamage(struct mobj_s *actor);
|
void A_VileTarget(void *actor);
|
||||||
void A_HomingChase(struct mobj_s *actor);
|
void A_VileAttack(void *actor);
|
||||||
void A_TrapShot(struct mobj_s *actor);
|
void A_VileFire(void *actor);
|
||||||
void A_VileTarget(struct mobj_s *actor);
|
void A_BrakChase(void *actor);
|
||||||
void A_VileAttack(struct mobj_s *actor);
|
void A_BrakFireShot(void *actor);
|
||||||
void A_VileFire(struct mobj_s *actor);
|
void A_BrakLobShot(void *actor);
|
||||||
void A_BrakChase(struct mobj_s *actor);
|
void A_NapalmScatter(void *actor);
|
||||||
void A_BrakFireShot(struct mobj_s *actor);
|
void A_SpawnFreshCopy(void *actor);
|
||||||
void A_BrakLobShot(struct mobj_s *actor);
|
|
||||||
void A_NapalmScatter(struct mobj_s *actor);
|
|
||||||
void A_SpawnFreshCopy(struct mobj_s *actor);
|
|
||||||
|
|
||||||
extern boolean actionsoverridden[NUMACTIONS];
|
extern boolean actionsoverridden[NUMACTIONS];
|
||||||
|
|
||||||
@@ -4312,7 +4309,7 @@ typedef struct
|
|||||||
spritenum_t sprite;
|
spritenum_t sprite;
|
||||||
UINT32 frame; // we use the upper 16 bits for translucency and other shade effects
|
UINT32 frame; // we use the upper 16 bits for translucency and other shade effects
|
||||||
INT32 tics;
|
INT32 tics;
|
||||||
actionf_t action;
|
actionf_p1 action;
|
||||||
INT32 var1;
|
INT32 var1;
|
||||||
INT32 var2;
|
INT32 var2;
|
||||||
statenum_t nextstate;
|
statenum_t nextstate;
|
||||||
|
|||||||
+25
-36
@@ -1315,14 +1315,6 @@ static void K_drawKartStats(void)
|
|||||||
|
|
||||||
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
||||||
|
|
||||||
UINT8 splitnum = 0;
|
|
||||||
|
|
||||||
for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum)
|
|
||||||
{
|
|
||||||
if (stplyrnum == splitnum)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LUA_HudEnabled(hud_statdisplay))
|
if (!LUA_HudEnabled(hud_statdisplay))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1362,7 +1354,7 @@ static void K_drawKartStats(void)
|
|||||||
|
|
||||||
// If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping
|
// If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping
|
||||||
// to bottom
|
// to bottom
|
||||||
if (splitnum == 0)
|
if (stplyrnum == 0)
|
||||||
{
|
{
|
||||||
y /= 2;
|
y /= 2;
|
||||||
flags = V_SNAPTOLEFT;
|
flags = V_SNAPTOLEFT;
|
||||||
@@ -1375,28 +1367,28 @@ static void K_drawKartStats(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (splitnum == 0 || splitnum == 2) // If we are P1 or P3...
|
if (stplyrnum == 0 || stplyrnum == 2) // If we are P1 or P3...
|
||||||
{
|
{
|
||||||
// ye i just align it to position number lol
|
// ye i just align it to position number lol
|
||||||
x = POSI_X + 19;
|
x = POSI_X + 19;
|
||||||
y = POSI_Y - 6;
|
y = POSI_Y - 6;
|
||||||
flags = V_SNAPTOLEFT|((splitnum == 2) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
flags = V_SNAPTOLEFT|((stplyrnum == 2) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
||||||
}
|
}
|
||||||
else // else, that means we're P2 or P4.
|
else // else, that means we're P2 or P4.
|
||||||
{
|
{
|
||||||
x = POSI2_X - 75;
|
x = POSI2_X - 75;
|
||||||
y = POSI2_Y - 6;
|
y = POSI2_Y - 6;
|
||||||
flags = V_SNAPTORIGHT|((splitnum == 3) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
flags = V_SNAPTORIGHT|((stplyrnum == 3) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flags |= V_HUDTRANS;
|
flags |= V_HUDTRANS;
|
||||||
|
|
||||||
skin_t *fakeskin;
|
|
||||||
fakeskin = K_GetPlayerSkin(stplyr);
|
|
||||||
|
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
{
|
{
|
||||||
|
skin_t *fakeskin;
|
||||||
|
fakeskin = K_GetPlayerSkin(stplyr);
|
||||||
|
|
||||||
// Skin name
|
// Skin name
|
||||||
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
|
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
|
||||||
{
|
{
|
||||||
@@ -1812,6 +1804,7 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||||||
if (!mode)
|
if (!mode)
|
||||||
{
|
{
|
||||||
splitflags = V_HUDTRANS|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT);
|
splitflags = V_HUDTRANS|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT);
|
||||||
|
|
||||||
if (cv_timelimit.value && timelimitintics > 0)
|
if (cv_timelimit.value && timelimitintics > 0)
|
||||||
{
|
{
|
||||||
if (drawtime >= timelimitintics)
|
if (drawtime >= timelimitintics)
|
||||||
@@ -2175,9 +2168,7 @@ static boolean K_drawKartPositionFaces(void)
|
|||||||
|
|
||||||
if (!playeringame[rankplayer[i]])
|
if (!playeringame[rankplayer[i]])
|
||||||
continue;
|
continue;
|
||||||
if (player->spectator)
|
if (player->spectator || !player->mo)
|
||||||
continue;
|
|
||||||
if (!player->mo)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const UINT8 mocolor = player->mo->color;
|
const UINT8 mocolor = player->mo->color;
|
||||||
@@ -2186,9 +2177,10 @@ static boolean K_drawKartPositionFaces(void)
|
|||||||
|
|
||||||
if (mocolor)
|
if (mocolor)
|
||||||
{
|
{
|
||||||
colormap = R_GetTranslationColormap(player->skin, mocolor, GTC_CACHE);
|
|
||||||
if (player->mo->colorized)
|
if (player->mo->colorized)
|
||||||
colormap = R_GetTranslationColormap(TC_RAINBOW, mocolor, GTC_CACHE);
|
colormap = R_GetTranslationColormap(TC_RAINBOW, mocolor, GTC_CACHE);
|
||||||
|
else
|
||||||
|
colormap = R_GetTranslationColormap(player->skin, mocolor, GTC_CACHE);
|
||||||
|
|
||||||
if (K_UseHighResPortraits())
|
if (K_UseHighResPortraits())
|
||||||
V_DrawSmallMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceWant(player), colormap);
|
V_DrawSmallMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceWant(player), colormap);
|
||||||
@@ -2217,8 +2209,10 @@ static boolean K_drawKartPositionFaces(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
INT32 pos = player->kartstuff[k_position];
|
INT32 pos = player->kartstuff[k_position];
|
||||||
|
|
||||||
if (pos < 0 || pos > MAXPLAYERS)
|
if (pos < 0 || pos > MAXPLAYERS)
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
// Draws the little number over the face
|
// Draws the little number over the face
|
||||||
V_DrawScaledPatch(FACE_X-5, Y+10, V_HUDTRANS|V_SNAPTOLEFT, kp_facenum[pos]);
|
V_DrawScaledPatch(FACE_X-5, Y+10, V_HUDTRANS|V_SNAPTOLEFT, kp_facenum[pos]);
|
||||||
}
|
}
|
||||||
@@ -2244,6 +2238,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||||||
//I_Assert(scorelines <= 9); -- not today bitch, kart fixed it up
|
//I_Assert(scorelines <= 9); -- not today bitch, kart fixed it up
|
||||||
|
|
||||||
V_DrawFill(1-duptweak, 26, dupadjust-2, 1, 0); // Draw a horizontal line because it looks nice!
|
V_DrawFill(1-duptweak, 26, dupadjust-2, 1, 0); // Draw a horizontal line because it looks nice!
|
||||||
|
|
||||||
if (scorelines > 8)
|
if (scorelines > 8)
|
||||||
{
|
{
|
||||||
V_DrawFill(160, 26, 1, 147, 0); // Draw a vertical line to separate the two sides.
|
V_DrawFill(160, 26, 1, 147, 0); // Draw a vertical line to separate the two sides.
|
||||||
@@ -3168,7 +3163,7 @@ static void K_drawDriftGauge(void)
|
|||||||
SKINCOLOR_SALMON,
|
SKINCOLOR_SALMON,
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 driftrainbow[18] = {
|
static const UINT8 driftrainbow[18] = {
|
||||||
0, 31, 47, 63, 79, 95, 111, 119, 127, 143, 159, 175, 183, 191, 199, 207, 223, 247
|
0, 31, 47, 63, 79, 95, 111, 119, 127, 143, 159, 175, 183, 191, 199, 207, 223, 247
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3274,7 +3269,6 @@ skipcrap:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// right, also draw a cool number
|
// right, also draw a cool number
|
||||||
//SG_DrawPaddedNum(v, basex + (dup*32), basey, driftcharge*100 / driftval, 3, "PINGN", V_NOSCALESTART|V_OFFSET|drifttrans, cmap)
|
|
||||||
if (cv_driftgaugestyle.value == 3)
|
if (cv_driftgaugestyle.value == 3)
|
||||||
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
|
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
|
||||||
else
|
else
|
||||||
@@ -3283,10 +3277,10 @@ skipcrap:
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
|
|
||||||
|
|
||||||
if (driftcharge >= driftval*4)
|
if (driftcharge >= driftval*4)
|
||||||
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
|
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
|
||||||
|
else
|
||||||
|
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
|
||||||
|
|
||||||
V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
|
V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
|
||||||
}
|
}
|
||||||
@@ -3305,6 +3299,7 @@ static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fix
|
|||||||
range *= gamespeed+1;
|
range *= gamespeed+1;
|
||||||
|
|
||||||
dist = abs(R_PointToDist2(px, py, mx, my));
|
dist = abs(R_PointToDist2(px, py, mx, my));
|
||||||
|
|
||||||
if (dist > range)
|
if (dist > range)
|
||||||
return -BASEVIDWIDTH;
|
return -BASEVIDWIDTH;
|
||||||
|
|
||||||
@@ -3404,17 +3399,14 @@ static void K_drawKartPlayerCheck(void)
|
|||||||
UINT8 *colormap;
|
UINT8 *colormap;
|
||||||
INT32 x;
|
INT32 x;
|
||||||
|
|
||||||
const INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM);
|
if (!stplyr->mo || stplyr->spectator || stplyr->awayviewtics)
|
||||||
|
|
||||||
if (!stplyr->mo || stplyr->spectator)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (stplyr->awayviewtics)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (camspin[0])
|
if (camspin[0])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM);
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
UINT8 pnum = 0;
|
UINT8 pnum = 0;
|
||||||
@@ -3532,7 +3524,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
|||||||
skin = K_GetMobjSkin(mo);
|
skin = K_GetMobjSkin(mo);
|
||||||
minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)];
|
minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)];
|
||||||
|
|
||||||
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x);
|
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x);
|
||||||
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y);
|
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y);
|
||||||
|
|
||||||
if (encoremode)
|
if (encoremode)
|
||||||
@@ -3965,7 +3957,7 @@ static void K_drawBattleFullscreen(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netgame && !stplyr->spectator && timeinmap > 113) // FREE PLAY?
|
if (netgame && cv_showfreeplay.value && !stplyr->spectator && timeinmap > 113) // FREE PLAY?
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
@@ -4386,10 +4378,6 @@ static void K_drawLapStartAnim(void)
|
|||||||
void K_drawKartFreePlay(UINT32 flashtime)
|
void K_drawKartFreePlay(UINT32 flashtime)
|
||||||
{
|
{
|
||||||
// no splitscreen support because it's not FREE PLAY if you have more than one player in-game
|
// no splitscreen support because it's not FREE PLAY if you have more than one player in-game
|
||||||
|
|
||||||
if (!cv_showfreeplay.value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((flashtime % TICRATE) < TICRATE/2)
|
if ((flashtime % TICRATE) < TICRATE/2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -4503,6 +4491,7 @@ static void K_drawCheckpointDebugger(void)
|
|||||||
V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Can finish)", stplyr->starpostnum, numstarposts));
|
V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Can finish)", stplyr->starpostnum, numstarposts));
|
||||||
else
|
else
|
||||||
V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, ((numstarposts/2) + stplyr->starpostnum)));
|
V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, ((numstarposts/2) + stplyr->starpostnum)));
|
||||||
|
|
||||||
V_DrawString(8, 192, 0, va("Waypoint dist: Prev %d, Next %d", stplyr->kartstuff[k_prevcheck], stplyr->kartstuff[k_nextcheck]));
|
V_DrawString(8, 192, 0, va("Waypoint dist: Prev %d, Next %d", stplyr->kartstuff[k_prevcheck], stplyr->kartstuff[k_nextcheck]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4765,7 +4754,7 @@ void K_drawKartHUD(void)
|
|||||||
V_DrawScaledPatch(BASEVIDWIDTH/2 - (kp_yougotem->width/2), 32, V_HUDTRANS, kp_yougotem);
|
V_DrawScaledPatch(BASEVIDWIDTH/2 - (kp_yougotem->width/2), 32, V_HUDTRANS, kp_yougotem);
|
||||||
|
|
||||||
// Draw FREE PLAY.
|
// Draw FREE PLAY.
|
||||||
if (isfreeplay && !stplyr->spectator && timeinmap > 113)
|
if (isfreeplay && cv_showfreeplay.value && !stplyr->spectator && timeinmap > 113)
|
||||||
{
|
{
|
||||||
if (LUA_HudEnabled(hud_freeplay))
|
if (LUA_HudEnabled(hud_freeplay))
|
||||||
K_drawKartFreePlay(leveltime);
|
K_drawKartFreePlay(leveltime);
|
||||||
|
|||||||
+115
-63
@@ -522,6 +522,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
|||||||
dest_colormap[i] = (UINT8)i;
|
dest_colormap[i] = (UINT8)i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = V_GetColor(i);
|
color = V_GetColor(i);
|
||||||
SETBRIGHTNESS(brightness, color.s.red, color.s.green, color.s.blue);
|
SETBRIGHTNESS(brightness, color.s.red, color.s.green, color.s.blue);
|
||||||
brightdif = 256;
|
brightdif = 256;
|
||||||
@@ -550,26 +551,41 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
|||||||
*/
|
*/
|
||||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local)
|
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i, starttranscolor;
|
||||||
INT32 starttranscolor;
|
|
||||||
|
|
||||||
// Handle a couple of simple special cases
|
// Handle a couple of simple special cases
|
||||||
if (skinnum == TC_BOSS
|
if (skinnum < TC_DEFAULT)
|
||||||
|| skinnum == TC_ALLWHITE
|
|
||||||
|| skinnum == TC_METALSONIC
|
|
||||||
|| skinnum == TC_BLINK
|
|
||||||
|| color == SKINCOLOR_NONE)
|
|
||||||
{
|
{
|
||||||
for (i = 0; i < NUM_PALETTE_ENTRIES; i++)
|
switch (skinnum)
|
||||||
{
|
{
|
||||||
if (skinnum == TC_ALLWHITE)
|
case TC_ALLWHITE:
|
||||||
dest_colormap[i] = 0;
|
memset(dest_colormap, 0, NUM_PALETTE_ENTRIES * sizeof(UINT8));
|
||||||
else if (skinnum == TC_BLINK)
|
return;
|
||||||
dest_colormap[i] = colortranslations[color][3];
|
case TC_RAINBOW:
|
||||||
else
|
if (color >= MAXTRANSLATIONS)
|
||||||
dest_colormap[i] = (UINT8)i;
|
I_Error("Invalid skin color #%hu.", (UINT16)color);
|
||||||
|
if (color != SKINCOLOR_NONE)
|
||||||
|
{
|
||||||
|
K_RainbowColormap(dest_colormap, color);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TC_BLINK:
|
||||||
|
if (color >= MAXTRANSLATIONS)
|
||||||
|
I_Error("Invalid skin color #%hu.", (UINT16)color);
|
||||||
|
if (color != SKINCOLOR_NONE)
|
||||||
|
{
|
||||||
|
memset(dest_colormap, colortranslations[color][3], NUM_PALETTE_ENTRIES * sizeof(UINT8));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_PALETTE_ENTRIES; i++)
|
||||||
|
dest_colormap[i] = (UINT8)i;
|
||||||
|
|
||||||
// White!
|
// White!
|
||||||
if (skinnum == TC_BOSS)
|
if (skinnum == TC_BOSS)
|
||||||
dest_colormap[31] = 0;
|
dest_colormap[31] = 0;
|
||||||
@@ -578,14 +594,25 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (skinnum == TC_RAINBOW)
|
else if (color == SKINCOLOR_NONE)
|
||||||
{
|
{
|
||||||
K_RainbowColormap(dest_colormap, color);
|
for (i = 0; i < NUM_PALETTE_ENTRIES; i++)
|
||||||
|
dest_colormap[i] = (UINT8)i;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (color >= MAXTRANSLATIONS)
|
||||||
|
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)
|
||||||
|
I_Error("Invalid startcolor #%d.", starttranscolor);
|
||||||
|
|
||||||
// Fill in the entries of the palette that are fixed
|
// Fill in the entries of the palette that are fixed
|
||||||
for (i = 0; i < starttranscolor; i++)
|
for (i = 0; i < starttranscolor; i++)
|
||||||
dest_colormap[i] = (UINT8)i;
|
dest_colormap[i] = (UINT8)i;
|
||||||
@@ -1585,7 +1612,7 @@ static UINT8 K_CheckOffroadCollide(mobj_t *mo)
|
|||||||
|
|
||||||
// we will do essentially the same checks as above instead of bothering with top/bottom height of the FOF.
|
// we will do essentially the same checks as above instead of bothering with top/bottom height of the FOF.
|
||||||
// Reminder that an FOF's floor is its bottom, silly!
|
// Reminder that an FOF's floor is its bottom, silly!
|
||||||
if ( ((s2->flags & SF_FLIPSPECIAL_FLOOR) && mo->z == cel) // "floor" check
|
if ( ((s2->flags & SF_FLIPSPECIAL_FLOOR) && mo->z == cel) // "floor" check
|
||||||
|| ((s2->flags & SF_FLIPSPECIAL_CEILING) && (mo->z + mo->height) == flr) ) // "ceiling" check.
|
|| ((s2->flags & SF_FLIPSPECIAL_CEILING) && (mo->z + mo->height) == flr) ) // "ceiling" check.
|
||||||
|
|
||||||
for (i = 2; i < 5; i++) // check for sector special
|
for (i = 2; i < 5; i++) // check for sector special
|
||||||
@@ -1669,10 +1696,10 @@ static void K_SpawnDashDustRelease(player_t *player)
|
|||||||
I_Assert(player->mo != NULL);
|
I_Assert(player->mo != NULL);
|
||||||
I_Assert(!P_MobjWasRemoved(player->mo));
|
I_Assert(!P_MobjWasRemoved(player->mo));
|
||||||
|
|
||||||
if (!P_IsObjectOnGround(player->mo))
|
if (!player->speed && !player->kartstuff[k_startboost])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!player->speed && !player->kartstuff[k_startboost])
|
if (!P_IsObjectOnGround(player->mo))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
travelangle = player->mo->angle;
|
travelangle = player->mo->angle;
|
||||||
@@ -1902,11 +1929,11 @@ static void K_PlayGenericCombatSound(mobj_t *source, mobj_t *other, sfxenum_t sf
|
|||||||
|
|
||||||
boolean alwaysHear = false;
|
boolean alwaysHear = false;
|
||||||
|
|
||||||
if (other != NULL && P_MobjWasRemoved(other) == false && other->player != NULL)
|
if (cv_kartvoices.value && !P_MobjWasRemoved(other) && other->player != NULL)
|
||||||
|
{
|
||||||
alwaysHear = P_IsDisplayPlayer(other->player);
|
alwaysHear = P_IsDisplayPlayer(other->player);
|
||||||
|
|
||||||
if (cv_kartvoices.value)
|
|
||||||
S_StartSound(alwaysHear ? NULL : source, skin->soundsid[S_sfx[sfx_id].skinsound]);
|
S_StartSound(alwaysHear ? NULL : source, skin->soundsid[S_sfx[sfx_id].skinsound]);
|
||||||
|
}
|
||||||
|
|
||||||
K_RegularVoiceTimers(source->player);
|
K_RegularVoiceTimers(source->player);
|
||||||
}
|
}
|
||||||
@@ -1928,7 +1955,7 @@ void K_PlayAttackTaunt(mobj_t *source)
|
|||||||
void K_PlayBoostTaunt(mobj_t *source)
|
void K_PlayBoostTaunt(mobj_t *source)
|
||||||
{
|
{
|
||||||
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
||||||
boolean tasteful = (!source->player || !source->player->kartstuff[k_tauntvoices]);
|
const boolean tasteful = (!source->player || !source->player->kartstuff[k_tauntvoices]);
|
||||||
|
|
||||||
if (cv_kartvoices.value && (tasteful || cv_kartvoices.value == 2))
|
if (cv_kartvoices.value && (tasteful || cv_kartvoices.value == 2))
|
||||||
S_StartSound(source, sfx_kbost1+pick);
|
S_StartSound(source, sfx_kbost1+pick);
|
||||||
@@ -1941,8 +1968,6 @@ void K_PlayBoostTaunt(mobj_t *source)
|
|||||||
|
|
||||||
void K_PlayOvertakeSound(mobj_t *source)
|
void K_PlayOvertakeSound(mobj_t *source)
|
||||||
{
|
{
|
||||||
boolean tasteful = (!source->player || !source->player->kartstuff[k_voices]);
|
|
||||||
|
|
||||||
if (!G_RaceGametype()) // Only in race
|
if (!G_RaceGametype()) // Only in race
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1950,6 +1975,8 @@ void K_PlayOvertakeSound(mobj_t *source)
|
|||||||
if (leveltime < starttime+(10*TICRATE))
|
if (leveltime < starttime+(10*TICRATE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const boolean tasteful = (!source->player || !source->player->kartstuff[k_voices]);
|
||||||
|
|
||||||
if (cv_kartvoices.value && (tasteful || cv_kartvoices.value == 2))
|
if (cv_kartvoices.value && (tasteful || cv_kartvoices.value == 2))
|
||||||
S_StartSound(source, sfx_kslow);
|
S_StartSound(source, sfx_kslow);
|
||||||
|
|
||||||
@@ -2185,6 +2212,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower)
|
|||||||
|
|
||||||
if (doboostpower)
|
if (doboostpower)
|
||||||
return FixedMul(finalspeed, player->kartstuff[k_boostpower]+player->kartstuff[k_speedboost]);
|
return FixedMul(finalspeed, player->kartstuff[k_boostpower]+player->kartstuff[k_speedboost]);
|
||||||
|
|
||||||
return finalspeed;
|
return finalspeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2221,10 +2249,14 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove
|
|||||||
{
|
{
|
||||||
fixed_t accelmax = 4000;
|
fixed_t accelmax = 4000;
|
||||||
fixed_t newspeed, oldspeed, finalspeed;
|
fixed_t newspeed, oldspeed, finalspeed;
|
||||||
fixed_t p_speed = K_GetKartSpeed(player, true);
|
fixed_t p_speed, p_accel;
|
||||||
fixed_t p_accel = K_GetKartAccel(player);
|
|
||||||
|
|
||||||
if (!onground) return 0; // If the player isn't on the ground, there is no change in speed
|
// If the player isn't on the ground, there is no change in speed
|
||||||
|
if (!onground)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
p_speed = K_GetKartSpeed(player, true);
|
||||||
|
p_accel = K_GetKartAccel(player);
|
||||||
|
|
||||||
// ACCELCODE!!!1!11!
|
// ACCELCODE!!!1!11!
|
||||||
oldspeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale);
|
oldspeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale);
|
||||||
@@ -2328,6 +2360,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
|||||||
|
|
||||||
if (P_MobjWasRemoved(player->mo))
|
if (P_MobjWasRemoved(player->mo))
|
||||||
return; // mobj was removed (in theory that shouldn't happen)
|
return; // mobj was removed (in theory that shouldn't happen)
|
||||||
|
|
||||||
if (shouldForce == 1)
|
if (shouldForce == 1)
|
||||||
force = true;
|
force = true;
|
||||||
else if (shouldForce == 2)
|
else if (shouldForce == 2)
|
||||||
@@ -2440,7 +2473,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
|||||||
|
|
||||||
static void K_RemoveGrowShrink(player_t *player)
|
static void K_RemoveGrowShrink(player_t *player)
|
||||||
{
|
{
|
||||||
if (player->mo && !P_MobjWasRemoved(player->mo))
|
if (!P_MobjWasRemoved(player->mo))
|
||||||
{
|
{
|
||||||
if (player->kartstuff[k_growshrinktimer] > 0) // Play Shrink noise
|
if (player->kartstuff[k_growshrinktimer] > 0) // Play Shrink noise
|
||||||
S_StartSound(player->mo, sfx_kc59);
|
S_StartSound(player->mo, sfx_kc59);
|
||||||
@@ -2468,8 +2501,10 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
|||||||
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
|
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
|
||||||
boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what.
|
boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what.
|
||||||
UINT8 shouldForce = LUA_HookShouldSquish(player, inflictor, source);
|
UINT8 shouldForce = LUA_HookShouldSquish(player, inflictor, source);
|
||||||
|
|
||||||
if (P_MobjWasRemoved(player->mo))
|
if (P_MobjWasRemoved(player->mo))
|
||||||
return; // mobj was removed (in theory that shouldn't happen)
|
return; // mobj was removed (in theory that shouldn't happen)
|
||||||
|
|
||||||
if (shouldForce == 1)
|
if (shouldForce == 1)
|
||||||
force = true;
|
force = true;
|
||||||
else if (shouldForce == 2)
|
else if (shouldForce == 2)
|
||||||
@@ -2582,6 +2617,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
|||||||
|
|
||||||
if (P_MobjWasRemoved(player->mo))
|
if (P_MobjWasRemoved(player->mo))
|
||||||
return; // mobj was removed (in theory that shouldn't happen)
|
return; // mobj was removed (in theory that shouldn't happen)
|
||||||
|
|
||||||
if (shouldForce == 1)
|
if (shouldForce == 1)
|
||||||
force = true;
|
force = true;
|
||||||
else if (shouldForce == 2)
|
else if (shouldForce == 2)
|
||||||
@@ -2667,6 +2703,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
|||||||
player->powers[pw_flashing] = K_GetKartFlashing(player);
|
player->powers[pw_flashing] = K_GetKartFlashing(player);
|
||||||
|
|
||||||
upgoer = (18*mapobjectscale*P_MobjFlip(player->mo));
|
upgoer = (18*mapobjectscale*P_MobjFlip(player->mo));
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_UNDERWATER)
|
if (player->mo->eflags & MFE_UNDERWATER)
|
||||||
upgoer = (117 * upgoer) / 200;
|
upgoer = (117 * upgoer) / 200;
|
||||||
|
|
||||||
@@ -2853,7 +2890,7 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
|
|||||||
mobj->momy = FixedMul(FixedDiv(mobjy - y, dist), FixedDiv(dist, 6*FRACUNIT));
|
mobj->momy = FixedMul(FixedDiv(mobjy - y, dist), FixedDiv(dist, 6*FRACUNIT));
|
||||||
mobj->momz = FixedMul(FixedDiv(mobjz - z, dist), FixedDiv(dist, 6*FRACUNIT));
|
mobj->momz = FixedMul(FixedDiv(mobjz - z, dist), FixedDiv(dist, 6*FRACUNIT));
|
||||||
|
|
||||||
if (source && !P_MobjWasRemoved(source))
|
if (!P_MobjWasRemoved(source))
|
||||||
P_SetTarget(&mobj->target, source);
|
P_SetTarget(&mobj->target, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3084,7 +3121,7 @@ static void K_SpawnDriftSparks(player_t *player)
|
|||||||
const boolean onground = P_IsObjectOnGround(player->mo);
|
const boolean onground = P_IsObjectOnGround(player->mo);
|
||||||
|
|
||||||
// kinda sketchy
|
// kinda sketchy
|
||||||
if (!cv_airsparks.value && onground)
|
if (!cv_airsparks.value && !onground)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!player->kartstuff[k_drift] || player->kartstuff[k_driftcharge] < K_GetKartDriftSparkValue(player))
|
if (!player->kartstuff[k_drift] || player->kartstuff[k_driftcharge] < K_GetKartDriftSparkValue(player))
|
||||||
@@ -3539,11 +3576,14 @@ void K_SpawnSparkleTrail(mobj_t *mo)
|
|||||||
fixed_t newz = mo->z + mo->momz + (P_RandomRange(0, mo->height>>FRACBITS)<<FRACBITS);
|
fixed_t newz = mo->z + mo->momz + (P_RandomRange(0, mo->height>>FRACBITS)<<FRACBITS);
|
||||||
|
|
||||||
sparkle = P_SpawnMobj(newx, newy, newz, MT_SPARKLETRAIL);
|
sparkle = P_SpawnMobj(newx, newy, newz, MT_SPARKLETRAIL);
|
||||||
|
|
||||||
K_FlipFromObject(sparkle, mo);
|
K_FlipFromObject(sparkle, mo);
|
||||||
|
|
||||||
P_SetTarget(&sparkle->target, mo);
|
P_SetTarget(&sparkle->target, mo);
|
||||||
|
|
||||||
sparkle->destscale = mo->destscale;
|
sparkle->destscale = mo->destscale;
|
||||||
P_SetScale(sparkle, mo->scale);
|
P_SetScale(sparkle, mo->scale);
|
||||||
|
|
||||||
sparkle->color = mo->color;
|
sparkle->color = mo->color;
|
||||||
|
|
||||||
if (cv_playerblendeffects.value && mo->player && K_SpeedLinesShouldBlend(mo->player))
|
if (cv_playerblendeffects.value && mo->player && K_SpeedLinesShouldBlend(mo->player))
|
||||||
@@ -3602,7 +3642,6 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent)
|
|||||||
void K_DriftDustHandling(mobj_t *spawner)
|
void K_DriftDustHandling(mobj_t *spawner)
|
||||||
{
|
{
|
||||||
angle_t anglediff;
|
angle_t anglediff;
|
||||||
const INT16 spawnrange = spawner->radius>>FRACBITS;
|
|
||||||
|
|
||||||
if (!P_IsObjectOnGround(spawner) || leveltime % 2 != 0)
|
if (!P_IsObjectOnGround(spawner) || leveltime % 2 != 0)
|
||||||
return;
|
return;
|
||||||
@@ -3639,6 +3678,8 @@ void K_DriftDustHandling(mobj_t *spawner)
|
|||||||
if (anglediff > ANGLE_180)
|
if (anglediff > ANGLE_180)
|
||||||
anglediff = InvAngle(anglediff);
|
anglediff = InvAngle(anglediff);
|
||||||
|
|
||||||
|
const INT16 spawnrange = spawner->radius>>FRACBITS;
|
||||||
|
|
||||||
if (anglediff > ANG10*4) // Trying to turn further than 40 degrees
|
if (anglediff > ANG10*4) // Trying to turn further than 40 degrees
|
||||||
{
|
{
|
||||||
fixed_t spawnx = P_RandomRange(-spawnrange, spawnrange)<<FRACBITS;
|
fixed_t spawnx = P_RandomRange(-spawnrange, spawnrange)<<FRACBITS;
|
||||||
@@ -3666,7 +3707,7 @@ static mobj_t *K_FindLastTrailMobj(player_t *player)
|
|||||||
if (!player || !(trail = player->mo) || !player->mo->hnext || !player->mo->hnext->health)
|
if (!player || !(trail = player->mo) || !player->mo->hnext || !player->mo->hnext->health)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (trail->hnext && !P_MobjWasRemoved(trail->hnext) && trail->hnext->health)
|
while (!P_MobjWasRemoved(trail->hnext) && trail->hnext->health)
|
||||||
{
|
{
|
||||||
trail = trail->hnext;
|
trail = trail->hnext;
|
||||||
}
|
}
|
||||||
@@ -3898,12 +3939,11 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
|
|||||||
|
|
||||||
void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
||||||
{
|
{
|
||||||
angle_t fa = R_PointToAngle2(0, 0, punter->momx, punter->momy) >> ANGLETOFINESHIFT;
|
angle_t fa;
|
||||||
fixed_t z = 30*mapobjectscale + punter->momz;
|
fixed_t z, spd;
|
||||||
fixed_t spd;
|
|
||||||
mobj_t *mine;
|
mobj_t *mine;
|
||||||
|
|
||||||
if (!thismine || P_MobjWasRemoved(thismine))
|
if (P_MobjWasRemoved(thismine))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//This guarantees you hit a mine being dragged
|
//This guarantees you hit a mine being dragged
|
||||||
@@ -3932,9 +3972,12 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
|||||||
else
|
else
|
||||||
mine = thismine;
|
mine = thismine;
|
||||||
|
|
||||||
if (!mine || P_MobjWasRemoved(mine))
|
if (P_MobjWasRemoved(mine))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
fa = R_PointToAngle2(0, 0, punter->momx, punter->momy) >> ANGLETOFINESHIFT;
|
||||||
|
z = 30*mapobjectscale + punter->momz;
|
||||||
|
|
||||||
spd = K_GetProjectileSpeed();
|
spd = K_GetProjectileSpeed();
|
||||||
|
|
||||||
mine->flags |= MF_NOCLIPTHING;
|
mine->flags |= MF_NOCLIPTHING;
|
||||||
@@ -4099,7 +4142,8 @@ void K_DoSneaker(player_t *player, INT32 type)
|
|||||||
if (player->mo->hnext)
|
if (player->mo->hnext)
|
||||||
{
|
{
|
||||||
mobj_t *cur = player->mo->hnext;
|
mobj_t *cur = player->mo->hnext;
|
||||||
while (cur && !P_MobjWasRemoved(cur))
|
|
||||||
|
while (!P_MobjWasRemoved(cur))
|
||||||
{
|
{
|
||||||
if (!cur->tracer)
|
if (!cur->tracer)
|
||||||
{
|
{
|
||||||
@@ -4145,8 +4189,10 @@ static void K_DoShrink(player_t *user)
|
|||||||
{
|
{
|
||||||
if (!playeringame[i] || players[i].spectator || !players[i].mo)
|
if (!playeringame[i] || players[i].spectator || !players[i].mo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (&players[i] == user)
|
if (&players[i] == user)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (players[i].kartstuff[k_position] < user->kartstuff[k_position])
|
if (players[i].kartstuff[k_position] < user->kartstuff[k_position])
|
||||||
{
|
{
|
||||||
//P_FlashPal(&players[i], PAL_NUKE, 10);
|
//P_FlashPal(&players[i], PAL_NUKE, 10);
|
||||||
@@ -4163,7 +4209,7 @@ static void K_DoShrink(player_t *user)
|
|||||||
K_DropItems(&players[i]);
|
K_DropItems(&players[i]);
|
||||||
players[i].kartstuff[k_growshrinktimer] = -(20*TICRATE);
|
players[i].kartstuff[k_growshrinktimer] = -(20*TICRATE);
|
||||||
|
|
||||||
if (players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
if (!P_MobjWasRemoved(players[i].mo))
|
||||||
{
|
{
|
||||||
players[i].mo->scalespeed = mapobjectscale/TICRATE;
|
players[i].mo->scalespeed = mapobjectscale/TICRATE;
|
||||||
players[i].mo->destscale = (6*mapobjectscale)/8;
|
players[i].mo->destscale = (6*mapobjectscale)/8;
|
||||||
@@ -4293,7 +4339,7 @@ void K_DropHnextList(player_t *player)
|
|||||||
mobjtype_t type;
|
mobjtype_t type;
|
||||||
boolean orbit, ponground, dropall = true;
|
boolean orbit, ponground, dropall = true;
|
||||||
|
|
||||||
if (!work || P_MobjWasRemoved(work))
|
if (P_MobjWasRemoved(work))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
flip = P_MobjFlip(player->mo);
|
flip = P_MobjFlip(player->mo);
|
||||||
@@ -4432,7 +4478,7 @@ void K_DropItems(player_t *player)
|
|||||||
|
|
||||||
K_DropHnextList(player);
|
K_DropHnextList(player);
|
||||||
|
|
||||||
if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount])
|
if (!P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount])
|
||||||
{
|
{
|
||||||
mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM);
|
mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM);
|
||||||
P_SetScale(drop, drop->scale>>4);
|
P_SetScale(drop, drop->scale>>4);
|
||||||
@@ -4461,7 +4507,7 @@ void K_DropRocketSneaker(player_t *player)
|
|||||||
fixed_t flingangle;
|
fixed_t flingangle;
|
||||||
boolean leftshoe = true; //left shoe is first
|
boolean leftshoe = true; //left shoe is first
|
||||||
|
|
||||||
if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext)))
|
if (!(!P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe))
|
while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe))
|
||||||
@@ -4500,7 +4546,7 @@ void K_DropRocketSneaker(player_t *player)
|
|||||||
|
|
||||||
void K_DropKitchenSink(player_t *player)
|
void K_DropKitchenSink(player_t *player)
|
||||||
{
|
{
|
||||||
if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext)))
|
if (!(!P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (player->mo->hnext->type != MT_SINK_SHIELD)
|
if (player->mo->hnext->type != MT_SINK_SHIELD)
|
||||||
@@ -4517,13 +4563,13 @@ void K_RepairOrbitChain(mobj_t *orbit)
|
|||||||
mobj_t *cachenext = orbit->hnext;
|
mobj_t *cachenext = orbit->hnext;
|
||||||
|
|
||||||
// First, repair the chain
|
// First, repair the chain
|
||||||
if (orbit->hnext && orbit->hnext->health && !P_MobjWasRemoved(orbit->hnext))
|
if (!P_MobjWasRemoved(orbit->hnext) && orbit->hnext->health)
|
||||||
{
|
{
|
||||||
P_SetTarget(&orbit->hnext->hprev, orbit->hprev);
|
P_SetTarget(&orbit->hnext->hprev, orbit->hprev);
|
||||||
P_SetTarget(&orbit->hnext, NULL);
|
P_SetTarget(&orbit->hnext, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orbit->hprev && orbit->hprev->health && !P_MobjWasRemoved(orbit->hprev))
|
if (!P_MobjWasRemoved(orbit->hprev) && orbit->hprev->health)
|
||||||
{
|
{
|
||||||
P_SetTarget(&orbit->hprev->hnext, cachenext);
|
P_SetTarget(&orbit->hprev->hnext, cachenext);
|
||||||
P_SetTarget(&orbit->hprev, NULL);
|
P_SetTarget(&orbit->hprev, NULL);
|
||||||
@@ -4538,7 +4584,7 @@ void K_RepairOrbitChain(mobj_t *orbit)
|
|||||||
mobj_t *cur = orbit->target->hnext;
|
mobj_t *cur = orbit->target->hnext;
|
||||||
mobj_t *prev = NULL;
|
mobj_t *prev = NULL;
|
||||||
|
|
||||||
while (cur && !P_MobjWasRemoved(cur))
|
while (!P_MobjWasRemoved(cur))
|
||||||
{
|
{
|
||||||
prev = cur;
|
prev = cur;
|
||||||
cur = cur->hnext;
|
cur = cur->hnext;
|
||||||
@@ -4738,7 +4784,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||||||
|
|
||||||
player->kartstuff[k_bananadrag] = 0; // Just to make sure
|
player->kartstuff[k_bananadrag] = 0; // Just to make sure
|
||||||
|
|
||||||
while (cur && !P_MobjWasRemoved(cur))
|
while (!P_MobjWasRemoved(cur))
|
||||||
{
|
{
|
||||||
const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); // mobj's distance from its Target, or Radius.
|
const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); // mobj's distance from its Target, or Radius.
|
||||||
fixed_t z;
|
fixed_t z;
|
||||||
@@ -4816,7 +4862,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||||||
if (P_IsObjectOnGround(player->mo) && player->speed > 0)
|
if (P_IsObjectOnGround(player->mo) && player->speed > 0)
|
||||||
player->kartstuff[k_bananadrag]++;
|
player->kartstuff[k_bananadrag]++;
|
||||||
|
|
||||||
while (cur && !P_MobjWasRemoved(cur))
|
while (!P_MobjWasRemoved(cur))
|
||||||
{
|
{
|
||||||
const fixed_t radius = FixedHypot(targ->radius, targ->radius) + FixedHypot(cur->radius, cur->radius);
|
const fixed_t radius = FixedHypot(targ->radius, targ->radius) + FixedHypot(cur->radius, cur->radius);
|
||||||
angle_t ang;
|
angle_t ang;
|
||||||
@@ -4844,7 +4890,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||||||
else
|
else
|
||||||
dist = cur->extravalue1/2;
|
dist = cur->extravalue1/2;
|
||||||
|
|
||||||
if (!targ || P_MobjWasRemoved(targ))
|
if (P_MobjWasRemoved(targ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Shrink your items if the player shrunk too.
|
// Shrink your items if the player shrunk too.
|
||||||
@@ -4902,7 +4948,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||||||
mobj_t *cur = player->mo->hnext;
|
mobj_t *cur = player->mo->hnext;
|
||||||
INT32 num = 0;
|
INT32 num = 0;
|
||||||
|
|
||||||
while (cur && !P_MobjWasRemoved(cur))
|
while (!P_MobjWasRemoved(cur))
|
||||||
{
|
{
|
||||||
const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius);
|
const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius);
|
||||||
boolean vibrate = ((leveltime & 1) && !cur->tracer);
|
boolean vibrate = ((leveltime & 1) && !cur->tracer);
|
||||||
@@ -4967,7 +5013,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur->tracer && !P_MobjWasRemoved(cur->tracer))
|
if (!P_MobjWasRemoved(cur->tracer))
|
||||||
{
|
{
|
||||||
fixed_t diffx, diffy, diffz;
|
fixed_t diffx, diffy, diffz;
|
||||||
|
|
||||||
@@ -5031,6 +5077,7 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
|
|||||||
|
|
||||||
// Find the angle, see who's got the best.
|
// Find the angle, see who's got the best.
|
||||||
thisang = actor->angle - R_PointToAngle2(actor->x, actor->y, player->mo->x, player->mo->y);
|
thisang = actor->angle - R_PointToAngle2(actor->x, actor->y, player->mo->x, player->mo->y);
|
||||||
|
|
||||||
if (thisang > ANGLE_180)
|
if (thisang > ANGLE_180)
|
||||||
thisang = InvAngle(thisang);
|
thisang = InvAngle(thisang);
|
||||||
|
|
||||||
@@ -5227,10 +5274,11 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
|||||||
static void K_UpdateInvincibilitySounds(player_t *player)
|
static void K_UpdateInvincibilitySounds(player_t *player)
|
||||||
{
|
{
|
||||||
INT32 sfxnum = sfx_None;
|
INT32 sfxnum = sfx_None;
|
||||||
const boolean localplayer = P_IsLocalPlayer(player);
|
|
||||||
|
|
||||||
if (player->mo->health > 0)
|
if (player->mo->health > 0)
|
||||||
{
|
{
|
||||||
|
const boolean localplayer = P_IsLocalPlayer(player);
|
||||||
|
|
||||||
if (player->kartstuff[k_growshrinktimer] > 0 && (!localplayer || cv_growmusic.value == 2)) // Prioritize Grow
|
if (player->kartstuff[k_growshrinktimer] > 0 && (!localplayer || cv_growmusic.value == 2)) // Prioritize Grow
|
||||||
sfxnum = cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow;
|
sfxnum = cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow;
|
||||||
else if (player->kartstuff[k_invincibilitytimer] > 0 && (!localplayer || cv_supermusic.value == 2))
|
else if (player->kartstuff[k_invincibilitytimer] > 0 && (!localplayer || cv_supermusic.value == 2))
|
||||||
@@ -5708,7 +5756,7 @@ void K_KartPlayerAfterThink(player_t *player)
|
|||||||
else
|
else
|
||||||
targ = K_FindJawzTarget(player->mo, player);
|
targ = K_FindJawzTarget(player->mo, player);
|
||||||
|
|
||||||
if (!targ || !targ->mo || P_MobjWasRemoved(targ->mo))
|
if (!targ || P_MobjWasRemoved(targ->mo))
|
||||||
{
|
{
|
||||||
player->kartstuff[k_lastjawztarget] = -1;
|
player->kartstuff[k_lastjawztarget] = -1;
|
||||||
player->kartstuff[k_jawztargetdelay] = 0;
|
player->kartstuff[k_jawztargetdelay] = 0;
|
||||||
@@ -5770,7 +5818,7 @@ boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y)
|
|||||||
static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
||||||
{
|
{
|
||||||
INT16 basedrift, driftangle;
|
INT16 basedrift, driftangle;
|
||||||
fixed_t driftweight = player->kartweight*14; // 12
|
fixed_t driftweight;
|
||||||
|
|
||||||
// If they aren't drifting or on the ground this doesn't apply
|
// If they aren't drifting or on the ground this doesn't apply
|
||||||
if (player->kartstuff[k_drift] == 0 || !P_IsObjectOnGround(player->mo))
|
if (player->kartstuff[k_drift] == 0 || !P_IsObjectOnGround(player->mo))
|
||||||
@@ -5781,6 +5829,8 @@ static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
|||||||
return -266*player->kartstuff[k_drift]; // Drift has ended and we are tweaking their angle back a bit
|
return -266*player->kartstuff[k_drift]; // Drift has ended and we are tweaking their angle back a bit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
driftweight = player->kartweight*14; // 12
|
||||||
|
|
||||||
//basedrift = 90*player->kartstuff[k_drift]; // 450
|
//basedrift = 90*player->kartstuff[k_drift]; // 450
|
||||||
//basedrift = 93*player->kartstuff[k_drift] - driftweight*3*player->kartstuff[k_drift]/10; // 447 - 303
|
//basedrift = 93*player->kartstuff[k_drift] - driftweight*3*player->kartstuff[k_drift]/10; // 447 - 303
|
||||||
basedrift = 83*player->kartstuff[k_drift] - (driftweight - 14)*player->kartstuff[k_drift]/5; // 415 - 303
|
basedrift = 83*player->kartstuff[k_drift] - (driftweight - 14)*player->kartstuff[k_drift]/5; // 415 - 303
|
||||||
@@ -5791,6 +5841,9 @@ static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
|||||||
|
|
||||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
||||||
{
|
{
|
||||||
|
fixed_t p_topspeed, p_curspeed, p_maxspeed;
|
||||||
|
fixed_t adjustangle;
|
||||||
|
|
||||||
if (player->spectator)
|
if (player->spectator)
|
||||||
return turnvalue;
|
return turnvalue;
|
||||||
|
|
||||||
@@ -5809,10 +5862,10 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
|||||||
return turnvalue;
|
return turnvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t p_topspeed = K_GetKartSpeed(player, false);
|
p_topspeed = K_GetKartSpeed(player, false);
|
||||||
fixed_t p_curspeed = min(player->speed, p_topspeed * 2);
|
p_curspeed = min(player->speed, p_topspeed * 2);
|
||||||
fixed_t p_maxspeed = p_topspeed * 3;
|
p_maxspeed = p_topspeed * 3;
|
||||||
fixed_t adjustangle = FixedDiv((p_maxspeed>>16) - (p_curspeed>>16), (p_maxspeed>>16) + player->kartweight);
|
adjustangle = FixedDiv((p_maxspeed>>16) - (p_curspeed>>16), (p_maxspeed>>16) + player->kartweight);
|
||||||
|
|
||||||
turnvalue = FixedMul(turnvalue, adjustangle); // Weight has a small effect on turning
|
turnvalue = FixedMul(turnvalue, adjustangle); // Weight has a small effect on turning
|
||||||
|
|
||||||
@@ -6214,7 +6267,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||||||
|
|
||||||
K_KartUpdatePosition(player);
|
K_KartUpdatePosition(player);
|
||||||
|
|
||||||
if (!player->exiting)
|
if (LIKELY(!player->exiting))
|
||||||
{
|
{
|
||||||
if (player->kartstuff[k_oldposition] < player->kartstuff[k_position]) // But first, if you lost a place,
|
if (player->kartstuff[k_oldposition] < player->kartstuff[k_position]) // But first, if you lost a place,
|
||||||
{
|
{
|
||||||
@@ -6794,10 +6847,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||||||
|
|
||||||
K_KartDrift(player, onground);
|
K_KartDrift(player, onground);
|
||||||
|
|
||||||
if ((!player->kartstuff[k_aizdriftstrat]) || (!P_IsObjectOnGround(player->mo)) || (player->kartstuff[k_drift]))
|
if (player->sliproll && ((!player->kartstuff[k_aizdriftstrat]) || (!P_IsObjectOnGround(player->mo)) || (player->kartstuff[k_drift])))
|
||||||
{
|
{
|
||||||
if (player->sliproll && (player->sliproll > 0))
|
player->sliproll -= (4*ANG1);
|
||||||
player->sliproll -= (4*ANG1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// funneh Saturn sprite stuff
|
// funneh Saturn sprite stuff
|
||||||
|
|||||||
+12
-6
@@ -393,6 +393,16 @@ FUNCINLINE static ATTRINLINE boolean prepare_string_hook
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean prepare_hud_hook
|
||||||
|
(
|
||||||
|
Hook_State * hook,
|
||||||
|
int hook_type
|
||||||
|
){
|
||||||
|
return init_hook_type(hook, 0,
|
||||||
|
hook_type, 0, NULL,
|
||||||
|
hudHookIds[hook_type].numHooks);
|
||||||
|
}
|
||||||
|
|
||||||
FUNCINLINE static ATTRINLINE void init_hook_call
|
FUNCINLINE static ATTRINLINE void init_hook_call
|
||||||
(
|
(
|
||||||
Hook_State * hook,
|
Hook_State * hook,
|
||||||
@@ -663,20 +673,16 @@ int LUA_HookTiccmd(player_t *player, ticcmd_t *cmd, int hook_type)
|
|||||||
|
|
||||||
void LUA_HookHUD(int hook_type, huddrawlist_h list)
|
void LUA_HookHUD(int hook_type, huddrawlist_h list)
|
||||||
{
|
{
|
||||||
const hook_t * map = &hudHookIds[hook_type];
|
|
||||||
Hook_State hook;
|
Hook_State hook;
|
||||||
if (map->numHooks > 0)
|
if (prepare_hud_hook(&hook, hook_type))
|
||||||
{
|
{
|
||||||
start_hook_stack();
|
|
||||||
begin_hook_values(&hook);
|
|
||||||
|
|
||||||
LUA_SetHudHook(hook_type, list);
|
LUA_SetHudHook(hook_type, list);
|
||||||
|
|
||||||
hud_running = true; // local hook
|
hud_running = true; // local hook
|
||||||
hud_interpcounter = 0;
|
hud_interpcounter = 0;
|
||||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||||
init_hook_call(&hook, 1, res_hud);
|
init_hook_call(&hook, 1, res_hud);
|
||||||
call_mapped(&hook, map);
|
call_mapped(&hook, &hudHookIds[hook_type]);
|
||||||
lua_settop(gL, 0); // destroy le stack!! >:3
|
lua_settop(gL, 0); // destroy le stack!! >:3
|
||||||
hud_running = false;
|
hud_running = false;
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -181,7 +181,7 @@ static int lib_setState(lua_State *L)
|
|||||||
switch(lua_type(L, 3))
|
switch(lua_type(L, 3))
|
||||||
{
|
{
|
||||||
case LUA_TNIL: // Null? Set the action to nothing, then.
|
case LUA_TNIL: // Null? Set the action to nothing, then.
|
||||||
state->action.acp1 = NULL;
|
state->action = NULL;
|
||||||
break;
|
break;
|
||||||
case LUA_TSTRING: // It's a string, expect the name of a built-in action
|
case LUA_TSTRING: // It's a string, expect the name of a built-in action
|
||||||
LUA_SetActionByName(state, lua_tostring(L, 3));
|
LUA_SetActionByName(state, lua_tostring(L, 3));
|
||||||
@@ -193,7 +193,7 @@ static int lib_setState(lua_State *L)
|
|||||||
lua_pushvalue(L, 3); // Bring it to the top of the stack
|
lua_pushvalue(L, 3); // Bring it to the top of the stack
|
||||||
lua_rawset(L, -3); // Set it in the registry
|
lua_rawset(L, -3); // Set it in the registry
|
||||||
lua_pop(L, 1); // pop LREG_STATEACTION
|
lua_pop(L, 1); // pop LREG_STATEACTION
|
||||||
state->action.acp1 = (actionf_p1)A_Lua; // Set the action for the userdata.
|
state->action = (actionf_p1)A_Lua; // Set the action for the userdata.
|
||||||
break;
|
break;
|
||||||
default: // ?!
|
default: // ?!
|
||||||
return luaL_typerror(L, 3, "function");
|
return luaL_typerror(L, 3, "function");
|
||||||
@@ -251,7 +251,7 @@ boolean LUA_SetLuaAction(void *stv, const char *action)
|
|||||||
lua_pop(gL, 1); // pop LREG_STATEACTION
|
lua_pop(gL, 1); // pop LREG_STATEACTION
|
||||||
|
|
||||||
lua_pop(gL, 2); // pop the function and LREG_ACTIONS
|
lua_pop(gL, 2); // pop the function and LREG_ACTIONS
|
||||||
st->action.acp1 = (actionf_p1)A_Lua; // Set the action for the userdata.
|
st->action = (actionf_p1)A_Lua; // Set the action for the userdata.
|
||||||
return true; // action successfully set.
|
return true; // action successfully set.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,9 +350,9 @@ static int state_get(lua_State *L)
|
|||||||
case state_action:
|
case state_action:
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
if (!st->action.acp1) // Action is NULL.
|
if (!st->action) // Action is NULL.
|
||||||
return 0; // return nil.
|
return 0; // return nil.
|
||||||
if (st->action.acp1 == (actionf_p1)A_Lua) { // This is a Lua function?
|
if (st->action == (actionf_p1)A_Lua) { // This is a Lua function?
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_STATEACTION);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_STATEACTION);
|
||||||
I_Assert(lua_istable(L, -1));
|
I_Assert(lua_istable(L, -1));
|
||||||
lua_pushlightuserdata(L, st); // Push the state pointer and
|
lua_pushlightuserdata(L, st); // Push the state pointer and
|
||||||
@@ -428,7 +428,7 @@ static int state_set(lua_State *L)
|
|||||||
switch(lua_type(L, 3))
|
switch(lua_type(L, 3))
|
||||||
{
|
{
|
||||||
case LUA_TNIL: // Null? Set the action to nothing, then.
|
case LUA_TNIL: // Null? Set the action to nothing, then.
|
||||||
st->action.acp1 = NULL;
|
st->action = NULL;
|
||||||
break;
|
break;
|
||||||
case LUA_TSTRING: // It's a string, expect the name of a built-in action
|
case LUA_TSTRING: // It's a string, expect the name of a built-in action
|
||||||
LUA_SetActionByName(st, lua_tostring(L, 3));
|
LUA_SetActionByName(st, lua_tostring(L, 3));
|
||||||
@@ -440,7 +440,7 @@ static int state_set(lua_State *L)
|
|||||||
lua_pushvalue(L, 3); // Bring it to the top of the stack
|
lua_pushvalue(L, 3); // Bring it to the top of the stack
|
||||||
lua_rawset(L, -3); // Set it in the registry
|
lua_rawset(L, -3); // Set it in the registry
|
||||||
lua_pop(L, 1); // pop LREG_STATEACTION
|
lua_pop(L, 1); // pop LREG_STATEACTION
|
||||||
st->action.acp1 = (actionf_p1)A_Lua; // Set the action for the userdata.
|
st->action = (actionf_p1)A_Lua; // Set the action for the userdata.
|
||||||
break;
|
break;
|
||||||
default: // ?!
|
default: // ?!
|
||||||
return luaL_typerror(L, 3, "function");
|
return luaL_typerror(L, 3, "function");
|
||||||
|
|||||||
+1
-1
@@ -227,4 +227,4 @@ int LUA_MathLib(lua_State *L)
|
|||||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||||
luaL_register(L, NULL, lib);
|
luaL_register(L, NULL, lib);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
+11
-8
@@ -1189,7 +1189,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_Step(void)
|
/*void LUA_Step(void)
|
||||||
{
|
{
|
||||||
if (!gL)
|
if (!gL)
|
||||||
return;
|
return;
|
||||||
@@ -1200,7 +1200,7 @@ void LUA_Step(void)
|
|||||||
lua_settop(gL, 0);
|
lua_settop(gL, 0);
|
||||||
lua_gc(gL, LUA_GCSTEP, 1);
|
lua_gc(gL, LUA_GCSTEP, 1);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void LUA_Archive(savebuffer_t *save, boolean network)
|
void LUA_Archive(savebuffer_t *save, boolean network)
|
||||||
{
|
{
|
||||||
@@ -1212,7 +1212,7 @@ void LUA_Archive(savebuffer_t *save, boolean network)
|
|||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (!playeringame[i] && i > 0) // NEVER skip player 0, this is for dedi servs.
|
if (!playeringame[i] && i > 0) // NEVER skip player 0, this is for dedi servs.
|
||||||
continue;
|
continue;
|
||||||
// all players in game will be archived, even if they just add a 0.
|
// all players in game will be archived, even if they just add a 0.
|
||||||
ArchiveExtVars(&save->p, &players[i], "player");
|
ArchiveExtVars(&save->p, &players[i], "player");
|
||||||
@@ -1224,7 +1224,7 @@ void LUA_Archive(savebuffer_t *save, boolean network)
|
|||||||
{
|
{
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// archive function will determine when to skip mobjs,
|
// archive function will determine when to skip mobjs,
|
||||||
@@ -1264,15 +1264,18 @@ void LUA_UnArchive(savebuffer_t *save, boolean network)
|
|||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
mobjnum = READUINT32(save->p); // read a mobjnum
|
mobjnum = READUINT32(save->p); // read a mobjnum
|
||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
|
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
|
||||||
UnArchiveExtVars(&save->p, th, network); // apply variables
|
continue;
|
||||||
|
UnArchiveExtVars(&save->p, th, network); // apply variables
|
||||||
}
|
}
|
||||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
|
||||||
|
} while (mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||||
|
|
||||||
LUA_HookNetArchive(NetUnArchive, save); // call the NetArchive hook in unarchive mode
|
LUA_HookNetArchive(NetUnArchive, save); // call the NetArchive hook in unarchive mode
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-4
@@ -10,6 +10,9 @@
|
|||||||
/// \file lua_script.h
|
/// \file lua_script.h
|
||||||
/// \brief Lua scripting basics
|
/// \brief Lua scripting basics
|
||||||
|
|
||||||
|
#ifndef LUA_SCRIPT_H
|
||||||
|
#define LUA_SCRIPT_H
|
||||||
|
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
@@ -55,7 +58,7 @@ void LUA_InvalidateUserdata(void *data);
|
|||||||
void LUA_InvalidateLevel(void);
|
void LUA_InvalidateLevel(void);
|
||||||
void LUA_InvalidateMapthings(void);
|
void LUA_InvalidateMapthings(void);
|
||||||
void LUA_InvalidatePlayer(player_t *player);
|
void LUA_InvalidatePlayer(player_t *player);
|
||||||
void LUA_Step(void);
|
//void LUA_Step(void);
|
||||||
void LUA_Archive(savebuffer_t *save, boolean network);
|
void LUA_Archive(savebuffer_t *save, boolean network);
|
||||||
void LUA_UnArchive(savebuffer_t *save, boolean network);
|
void LUA_UnArchive(savebuffer_t *save, boolean network);
|
||||||
|
|
||||||
@@ -75,7 +78,7 @@ void COM_Lua_f(void);
|
|||||||
#define LUA_Deprecated(L,this_func,use_instead)\
|
#define LUA_Deprecated(L,this_func,use_instead)\
|
||||||
{\
|
{\
|
||||||
static UINT8 seen = 0;\
|
static UINT8 seen = 0;\
|
||||||
if (!seen) {\
|
if (UNLIKELY(!seen)) {\
|
||||||
seen = 1;\
|
seen = 1;\
|
||||||
CONS_Alert(CONS_WARNING,"\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead);\
|
CONS_Alert(CONS_WARNING,"\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead);\
|
||||||
}\
|
}\
|
||||||
@@ -84,7 +87,7 @@ void COM_Lua_f(void);
|
|||||||
#define LUA_LogDeprecated(L,this_func,use_instead)\
|
#define LUA_LogDeprecated(L,this_func,use_instead)\
|
||||||
{\
|
{\
|
||||||
static UINT8 seen = 0;\
|
static UINT8 seen = 0;\
|
||||||
if (!seen) {\
|
if (UNLIKELY(!seen)) {\
|
||||||
seen = 1;\
|
seen = 1;\
|
||||||
CON_LogMessage(va("\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead));\
|
CON_LogMessage(va("\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead));\
|
||||||
}\
|
}\
|
||||||
@@ -95,8 +98,10 @@ void COM_Lua_f(void);
|
|||||||
#define LUA_UsageWarning(L, warningmsg)\
|
#define LUA_UsageWarning(L, warningmsg)\
|
||||||
{\
|
{\
|
||||||
static UINT8 seen = 0;\
|
static UINT8 seen = 0;\
|
||||||
if (!seen) {\
|
if (UNLIKELY(!seen)) {\
|
||||||
seen = 1;\
|
seen = 1;\
|
||||||
CONS_Alert(CONS_WARNING,"%s\n", warningmsg);\
|
CONS_Alert(CONS_WARNING,"%s\n", warningmsg);\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif/*LUA_SCRIPT_H*/
|
||||||
@@ -32,7 +32,7 @@ struct iterationState {
|
|||||||
int next;
|
int next;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int iterationState_gc(lua_State *L)
|
FUNCINLINE static ATTRINLINE int iterationState_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
struct iterationState *it = luaL_checkudata(L, -1, META_ITERATIONSTATE);
|
struct iterationState *it = luaL_checkudata(L, -1, META_ITERATIONSTATE);
|
||||||
if (it->next != LUA_REFNIL)
|
if (it->next != LUA_REFNIL)
|
||||||
@@ -44,7 +44,7 @@ static int iterationState_gc(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define push_thinker(th) {\
|
#define push_thinker(th) {\
|
||||||
if ((th)->function.acp1 == (actionf_p1)P_MobjThinker) \
|
if ((th)->function == (actionf_p1)P_MobjThinker) \
|
||||||
LUA_PushUserdata(L, (th), META_MOBJ); \
|
LUA_PushUserdata(L, (th), META_MOBJ); \
|
||||||
else \
|
else \
|
||||||
lua_pushlightuserdata(L, (th)); \
|
lua_pushlightuserdata(L, (th)); \
|
||||||
@@ -88,7 +88,7 @@ static int lib_iterateThinkers(lua_State *L)
|
|||||||
return luaL_error(L, "next thinker invalidated during iteration");
|
return luaL_error(L, "next thinker invalidated during iteration");
|
||||||
|
|
||||||
for (; next != &thinkercap; next = next->next)
|
for (; next != &thinkercap; next = next->next)
|
||||||
if (!it->filter || next->function.acp1 == it->filter)
|
if (!it->filter || next->function == it->filter)
|
||||||
{
|
{
|
||||||
push_thinker(next);
|
push_thinker(next);
|
||||||
if (next->next != &thinkercap)
|
if (next->next != &thinkercap)
|
||||||
@@ -130,4 +130,4 @@ int LUA_ThinkerLib(lua_State *L)
|
|||||||
lua_setfield(L, -2, "iterate");
|
lua_setfield(L, -2, "iterate");
|
||||||
lua_setglobal(L, "thinkers");
|
lua_setglobal(L, "thinkers");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
+51
-34
@@ -20,17 +20,17 @@
|
|||||||
|
|
||||||
typedef struct aatree_node_s
|
typedef struct aatree_node_s
|
||||||
{
|
{
|
||||||
INT32 level;
|
INT32 key;
|
||||||
INT32 key;
|
INT32 depth;
|
||||||
void* value;
|
void *value;
|
||||||
|
|
||||||
struct aatree_node_s *left, *right;
|
struct aatree_node_s *left, *right;
|
||||||
} aatree_node_t;
|
} aatree_node_t;
|
||||||
|
|
||||||
struct aatree_s
|
struct aatree_s
|
||||||
{
|
{
|
||||||
aatree_node_t *root;
|
aatree_node_t *root;
|
||||||
UINT32 flags;
|
UINT32 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
aatree_t *M_AATreeAlloc(UINT32 flags)
|
aatree_t *M_AATreeAlloc(UINT32 flags)
|
||||||
@@ -56,40 +56,48 @@ void M_AATreeFree(aatree_t *aatree)
|
|||||||
Z_Free(aatree);
|
Z_Free(aatree);
|
||||||
}
|
}
|
||||||
|
|
||||||
static aatree_node_t *M_AATreeSkew(aatree_node_t *node)
|
static aatree_node_t *M_AATreeRotateRight(aatree_node_t *node)
|
||||||
{
|
{
|
||||||
if (node && node->left && node->left->level == node->level)
|
aatree_node_t *newnode = node->left;
|
||||||
{
|
aatree_node_t *tmp = newnode->right;
|
||||||
// Not allowed: horizontal left-link. Reverse the
|
newnode->right = node;
|
||||||
// horizontal link and hook the orphan back in.
|
node->left = tmp;
|
||||||
aatree_node_t *oldleft = node->left;
|
return newnode;
|
||||||
node->left = oldleft->right;
|
|
||||||
oldleft->right = node;
|
|
||||||
|
|
||||||
return oldleft;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No change needed.
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static aatree_node_t *M_AATreeSplit(aatree_node_t *node)
|
static aatree_node_t *M_AATreeRotateLeft(aatree_node_t *node)
|
||||||
{
|
{
|
||||||
if (node && node->right && node->right->right && node->level == node->right->right->level)
|
aatree_node_t *newnode = node->right;
|
||||||
|
aatree_node_t *tmp = newnode->left;
|
||||||
|
newnode->left = node;
|
||||||
|
node->right = tmp;
|
||||||
|
return newnode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static aatree_node_t *M_AATreeRebalance(aatree_node_t *node)
|
||||||
|
{
|
||||||
|
INT32 balance;
|
||||||
|
if (node->left == NULL && node->right == NULL)
|
||||||
|
return node;
|
||||||
|
if (node->left == NULL)
|
||||||
|
balance = -node->right->depth;
|
||||||
|
else if (node->right == NULL)
|
||||||
|
balance = node->left->depth;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Not allowed: two consecutive horizontal right-links.
|
I_Assert(node->left->key < node->right->key);
|
||||||
// The middle one becomes the new root at this point,
|
balance = node->left->depth - node->right->depth;
|
||||||
// with suitable adjustments below.
|
}
|
||||||
|
|
||||||
aatree_node_t *oldright = node->right;
|
if (balance > 1)
|
||||||
node->right = oldright->left;
|
{
|
||||||
oldright->left = node;
|
return M_AATreeRotateRight(node);
|
||||||
oldright->level++;
|
}
|
||||||
|
else if (balance < -1)
|
||||||
return oldright;
|
{
|
||||||
|
return M_AATreeRotateLeft(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No change needed.
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +107,11 @@ static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32
|
|||||||
{
|
{
|
||||||
// Nothing here, so just add where we are
|
// Nothing here, so just add where we are
|
||||||
node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
|
node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
|
||||||
node->level = 1;
|
|
||||||
node->key = key;
|
node->key = key;
|
||||||
if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
|
if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
|
||||||
else node->value = value;
|
else node->value = value;
|
||||||
node->left = node->right = NULL;
|
node->left = node->right = NULL;
|
||||||
|
node->depth = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -117,8 +125,17 @@ static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32
|
|||||||
else node->value = value;
|
else node->value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = M_AATreeSkew(node);
|
node = M_AATreeRebalance(node);
|
||||||
node = M_AATreeSplit(node);
|
if (node->left == NULL && node->right == NULL)
|
||||||
|
node->depth = 1;
|
||||||
|
else if (node->left == NULL)
|
||||||
|
node->depth = node->right->depth + 1;
|
||||||
|
else if (node->right == NULL)
|
||||||
|
node->depth = node->left->depth + 1;
|
||||||
|
else if (node->left->depth > node->right->depth)
|
||||||
|
node->depth = node->left->depth + 1;
|
||||||
|
else
|
||||||
|
node->depth = node->right->depth + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
+1
-1
@@ -732,7 +732,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo = (mobj_t *)th;
|
mo = (mobj_t *)th;
|
||||||
|
|||||||
@@ -0,0 +1,262 @@
|
|||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "m_emotes.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "w_wad.h"
|
||||||
|
#include "z_zone.h"
|
||||||
|
#include "hu_stuff.h"
|
||||||
|
#include "v_video.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
consvar_t cv_emotes = {"emotes", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};;
|
||||||
|
|
||||||
|
static std::map<std::string, emote_t> emotes;
|
||||||
|
|
||||||
|
// TODO - Would be really nice to generalize soc-like file parsing and not reimplement it 100 times :)))))
|
||||||
|
void M_LoadEmotes(UINT16 wadnum)
|
||||||
|
{
|
||||||
|
UINT16 lumpnum = W_CheckNumForNamePwad("EMOTES", wadnum, 0);
|
||||||
|
|
||||||
|
if (lumpnum == INT16_MAX)
|
||||||
|
return;
|
||||||
|
|
||||||
|
char *lump = static_cast<char*>(W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE));
|
||||||
|
size_t size = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
|
|
||||||
|
std::istringstream file(std::string(lump, size));
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
emote_t *emote = nullptr;
|
||||||
|
std::string emote_name;
|
||||||
|
|
||||||
|
// Just smol lambda to remove all the trailing chars we might not want
|
||||||
|
auto trim = [](std::string &str) {
|
||||||
|
str.erase(0, str.find_first_not_of(" \t\n\r\f\v"));
|
||||||
|
str.erase(str.find_last_not_of(" \t\n\r\f\v")+1);
|
||||||
|
};
|
||||||
|
|
||||||
|
int numemotes = 0;
|
||||||
|
int linenum = 0;
|
||||||
|
|
||||||
|
while (std::getline(file, line))
|
||||||
|
{
|
||||||
|
++linenum;
|
||||||
|
|
||||||
|
trim(line);
|
||||||
|
|
||||||
|
if (line.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
size_t split = line.find('=');
|
||||||
|
|
||||||
|
// Didn't find the =, means we're about to parse `Emote <name>`
|
||||||
|
if (split == line.npos)
|
||||||
|
{
|
||||||
|
split = line.find(' ');
|
||||||
|
|
||||||
|
if (split == line.npos)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: Unrecognized line. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strnicmp(line.c_str(), "emote", 5))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: 'Emote' expected. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
emote_name = line.substr(split+1);
|
||||||
|
|
||||||
|
if (emote_name.find_first_of(" \t\n\r\f\v:") != emote_name.npos)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: Emote name cannot contain spaces or ':' symbols. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
emote_name = emote_name.substr(0, MAXEMOTENAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
emote = &emotes[emote_name];
|
||||||
|
strlcpy(emote->name, emote_name.c_str(), MAXEMOTENAME);
|
||||||
|
|
||||||
|
emote->timeperframe = 1;
|
||||||
|
emote->numframes = 0;
|
||||||
|
std::memset(emote->frames, 0, sizeof(emote->frames));
|
||||||
|
|
||||||
|
++numemotes;
|
||||||
|
}
|
||||||
|
else if (emote)
|
||||||
|
{
|
||||||
|
std::string field = line.substr(0, split);
|
||||||
|
std::string value = line.substr(split+1);
|
||||||
|
|
||||||
|
trim(field);
|
||||||
|
trim(value);
|
||||||
|
|
||||||
|
if (stricmp(field.c_str(), "frames") == 0)
|
||||||
|
{
|
||||||
|
UINT8 numframes = 0;
|
||||||
|
|
||||||
|
auto copy_frame = [&] {
|
||||||
|
if (numframes == MAXEMOTEFRAMES)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: Too many frames. (file %s, line %d)", wadfiles[wadnum]->filename, linenum);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t list_split = value.find(',');
|
||||||
|
std::string framelumpname = value.substr(0, list_split);
|
||||||
|
trim(framelumpname);
|
||||||
|
|
||||||
|
if (list_split == value.npos)
|
||||||
|
value = "";
|
||||||
|
else
|
||||||
|
value = value.substr(list_split+1, value.npos);
|
||||||
|
|
||||||
|
// End of list of frames
|
||||||
|
if (framelumpname.size() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (framelumpname.size() > 8)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::strncpy(emote->frames[numframes], framelumpname.c_str(), framelumpname.size()+1);
|
||||||
|
|
||||||
|
++numframes;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
while (copy_frame()) {}
|
||||||
|
|
||||||
|
if (numframes == 0)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: Expected list of frames. (file %s, line %d)", wadfiles[wadnum]->filename, linenum);
|
||||||
|
}
|
||||||
|
|
||||||
|
emote->numframes = numframes;
|
||||||
|
}
|
||||||
|
else if (stricmp(field.c_str(), "timeperframe") == 0)
|
||||||
|
{
|
||||||
|
emote->timeperframe = std::stoi(value);
|
||||||
|
|
||||||
|
if (emote->timeperframe <= 0)
|
||||||
|
{
|
||||||
|
emote->timeperframe = 1;
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: Bad value for 'timeperframe'. (file %s, line %d)", wadfiles[wadnum]->filename, linenum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: Unrecognized field '%s'. (file %s, line %d)", field.c_str(), wadfiles[wadnum]->filename, linenum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "EMOTES: Unrecognized line. (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CONS_Printf("Added %d emotes\n", numemotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void M_InitEmotes(void)
|
||||||
|
{
|
||||||
|
UINT16 i;
|
||||||
|
for (i = 0; i < numwadfiles; i++)
|
||||||
|
M_LoadEmotes(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
emote_t *M_FindEmote(const char *name, int len, int skip)
|
||||||
|
{
|
||||||
|
if (!cv_emotes.value)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
char query[MAXEMOTENAME+1] = {0};
|
||||||
|
std::strncpy(query, name, std::min(len, MAXEMOTENAME));
|
||||||
|
|
||||||
|
for (auto &pair: emotes)
|
||||||
|
{
|
||||||
|
if (pair.first.rfind(query, 0, std::min(len, MAXEMOTENAME)) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (skip > 0)
|
||||||
|
{
|
||||||
|
--skip;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &pair.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
emote_t *M_VerifyEmote(const char *name, int *emotelen)
|
||||||
|
{
|
||||||
|
if (*name != ':')
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (!cv_emotes.value)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
const char *p = name+1; // skip ':'
|
||||||
|
emote_t *match = nullptr;
|
||||||
|
|
||||||
|
while (*p && (p - name) < MAXEMOTENAME)
|
||||||
|
{
|
||||||
|
if (*p == ':')
|
||||||
|
{
|
||||||
|
std::string checkname = std::string(name+1, (p-name)-1);
|
||||||
|
auto it = emotes.find(checkname);
|
||||||
|
|
||||||
|
if (it != emotes.end())
|
||||||
|
match = &it->second;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match && emotelen)
|
||||||
|
*emotelen = p-name+1;
|
||||||
|
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
|
||||||
|
void M_DrawEmote(INT32 x, INT32 y, emote_t *emote, tic_t anim, INT32 flags)
|
||||||
|
{
|
||||||
|
if (emote->numframes == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char *lumpname = emote->frames[(anim/emote->timeperframe) % emote->numframes];
|
||||||
|
patch_t *emotepatch = (patch_t*)W_CachePatchName(lumpname, PU_CACHE);
|
||||||
|
|
||||||
|
const int CHARHEIGHT = 6;
|
||||||
|
|
||||||
|
fixed_t scale = FRACUNIT;
|
||||||
|
|
||||||
|
x *= FRACUNIT;
|
||||||
|
y *= FRACUNIT;
|
||||||
|
|
||||||
|
if (emotepatch->width > EMOTEWIDTH)
|
||||||
|
scale = (FRACUNIT/emotepatch->width)*EMOTEWIDTH;
|
||||||
|
else if (emotepatch->width < EMOTEWIDTH)
|
||||||
|
x += (EMOTEWIDTH-emotepatch->width)*FRACUNIT/2;
|
||||||
|
|
||||||
|
y -= (scale*emotepatch->height-CHARHEIGHT*FRACUNIT)/2;
|
||||||
|
|
||||||
|
V_DrawFixedPatch(x, y, scale, flags, emotepatch, NULL);
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#ifndef __M_EMOTES__
|
||||||
|
#define __M_EMOTES__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "doomdef.h"
|
||||||
|
#include "command.h"
|
||||||
|
|
||||||
|
extern consvar_t cv_emotes;
|
||||||
|
|
||||||
|
#define MAXEMOTENAME 32
|
||||||
|
#define MAXEMOTEFRAMES 32
|
||||||
|
#define EMOTEWIDTH 6
|
||||||
|
|
||||||
|
typedef struct emote_s {
|
||||||
|
char name[MAXEMOTENAME+1];
|
||||||
|
char frames[MAXEMOTEFRAMES][9];
|
||||||
|
UINT8 numframes;
|
||||||
|
tic_t timeperframe;
|
||||||
|
} emote_t;
|
||||||
|
|
||||||
|
// Reads and adds emotes from EMOTES lump, with syntax similar to soc
|
||||||
|
void M_LoadEmotes(UINT16 wadnum);
|
||||||
|
|
||||||
|
// Load emotes from all base wads
|
||||||
|
void M_InitEmotes(void);
|
||||||
|
|
||||||
|
// Finds first matching emote, ignoring first few matches
|
||||||
|
emote_t *M_FindEmote(const char *name, int len, int skips);
|
||||||
|
|
||||||
|
// If first character is not ':', instantly returns null
|
||||||
|
// Starts from ':' character, goes until it finds ':' or end of string
|
||||||
|
// If end of string is found, or closing ':' is found but resulting emote name doesn't exist,
|
||||||
|
// it returns null, otherwise it returns emote and stores into *emotelen how much characters
|
||||||
|
// needs to be skipped to get past emote name
|
||||||
|
emote_t *M_VerifyEmote(const char *name, int *emotelen);
|
||||||
|
|
||||||
|
// Draw the emote, anim should be some kind of timer ticking every game tic
|
||||||
|
// for animated emotes
|
||||||
|
void M_DrawEmote(INT32 x, INT32 y, emote_t *emote, tic_t anim, INT32 flags);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __M_EMOTES__
|
||||||
+292
-3597
File diff suppressed because it is too large.
Load diff
+2946
File diff suppressed because it is too large.
Load diff
@@ -2294,6 +2294,50 @@ void M_MkdirEach(const char *path, int start, int mode)
|
|||||||
M_MkdirEachUntil(path, start, -1, mode);
|
M_MkdirEachUntil(path, start, -1, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hashes some message using FNV-1a
|
||||||
|
#define FNV1A_OFFSET_BASIS 0x811C9DC5
|
||||||
|
#define FNV1A_PRIME 0x01000193
|
||||||
|
|
||||||
|
UINT32 FNV1a_Hash(const char *message, size_t size)
|
||||||
|
{
|
||||||
|
UINT32 hash = FNV1A_OFFSET_BASIS;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
hash ^= message[i];
|
||||||
|
hash *= FNV1A_PRIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 FNV1a_HashString(const char *message)
|
||||||
|
{
|
||||||
|
UINT32 hash = FNV1A_OFFSET_BASIS;
|
||||||
|
|
||||||
|
while (*message)
|
||||||
|
{
|
||||||
|
hash ^= *message;
|
||||||
|
hash *= FNV1A_PRIME;
|
||||||
|
message++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 FNV1a_HashLowercaseString(const char *message)
|
||||||
|
{
|
||||||
|
UINT32 hash = FNV1A_OFFSET_BASIS;
|
||||||
|
|
||||||
|
while (*message)
|
||||||
|
{
|
||||||
|
hash ^= tolower(*message);
|
||||||
|
hash *= FNV1A_PRIME;
|
||||||
|
message++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ const char * M_Ftrim (double);
|
|||||||
// counting bits, for weapon ammo code, usually
|
// counting bits, for weapon ammo code, usually
|
||||||
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
|
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
|
||||||
|
|
||||||
|
// Hashes some message using FNV-1a
|
||||||
|
UINT32 FNV1a_Hash(const char *message, size_t size);
|
||||||
|
UINT32 FNV1a_HashString(const char *message);
|
||||||
|
UINT32 FNV1a_HashLowercaseString(const char *message);
|
||||||
|
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
extern char configfile[MAX_WADPATH];
|
extern char configfile[MAX_WADPATH];
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -590,9 +590,9 @@ static void PS_CountThinkers(void)
|
|||||||
{
|
{
|
||||||
ps_thinkercount.value.i++;
|
ps_thinkercount.value.i++;
|
||||||
|
|
||||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
if (thinker->function == (actionf_p1)P_RemoveThinkerDelayed)
|
||||||
ps_removecount.value.i++;
|
ps_removecount.value.i++;
|
||||||
else if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
else if (thinker->function == (actionf_p1)P_MobjThinker)
|
||||||
{
|
{
|
||||||
mobj_t *mobj = (mobj_t*)thinker;
|
mobj_t *mobj = (mobj_t*)thinker;
|
||||||
ps_mobjcount.value.i++;
|
ps_mobjcount.value.i++;
|
||||||
@@ -609,7 +609,7 @@ static void PS_CountThinkers(void)
|
|||||||
|
|
||||||
for (thinker = precipcap.next; thinker != &precipcap; thinker = thinker->next)
|
for (thinker = precipcap.next; thinker != &precipcap; thinker = thinker->next)
|
||||||
{
|
{
|
||||||
if (thinker->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
if (thinker->function != (actionf_p1)P_NullPrecipThinker)
|
||||||
continue; // not a precipmobj thinker
|
continue; // not a precipmobj thinker
|
||||||
|
|
||||||
ps_precipcount.value.i++;
|
ps_precipcount.value.i++;
|
||||||
@@ -620,7 +620,7 @@ static void PS_CountThinkers(void)
|
|||||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||||
{
|
{
|
||||||
ps_thinkercount.value.i++;
|
ps_thinkercount.value.i++;
|
||||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
if (thinker->function == (actionf_p1)P_RemoveThinkerDelayed)
|
||||||
ps_removecount.value.i++;
|
ps_removecount.value.i++;
|
||||||
else if (i == THINK_POLYOBJ)
|
else if (i == THINK_POLYOBJ)
|
||||||
ps_polythcount.value.i++;
|
ps_polythcount.value.i++;
|
||||||
@@ -628,7 +628,7 @@ static void PS_CountThinkers(void)
|
|||||||
ps_mainthcount.value.i++;
|
ps_mainthcount.value.i++;
|
||||||
else if (i == THINK_MOBJ)
|
else if (i == THINK_MOBJ)
|
||||||
{
|
{
|
||||||
if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
if (thinker->function == (actionf_p1)P_MobjThinker)
|
||||||
{
|
{
|
||||||
mobj_t *mobj = (mobj_t*)thinker;
|
mobj_t *mobj = (mobj_t*)thinker;
|
||||||
ps_mobjcount.value.i++;
|
ps_mobjcount.value.i++;
|
||||||
@@ -739,7 +739,7 @@ static void PS_DrawDescriptorHeader(void)
|
|||||||
int samples_left = max(ps_frame_samples_left, ps_tick_samples_left);
|
int samples_left = max(ps_frame_samples_left, ps_tick_samples_left);
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (cv_perfstats.value >= 3)
|
if (cv_perfstats.value >= 3)
|
||||||
{
|
{
|
||||||
x = 2;
|
x = 2;
|
||||||
y = 0;
|
y = 0;
|
||||||
@@ -892,7 +892,7 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
|
|||||||
|
|
||||||
PS_DrawDescriptorHeader();
|
PS_DrawDescriptorHeader();
|
||||||
|
|
||||||
for (i = 0; i < hook_length; i++)
|
for (i = 0; i < hook_length; i++)
|
||||||
{
|
{
|
||||||
#define NEXT_ROW() y += HEIGHT;
|
#define NEXT_ROW() y += HEIGHT;
|
||||||
|
|
||||||
@@ -1010,7 +1010,7 @@ void M_DrawPerfStats(void)
|
|||||||
// tics when frame skips happen
|
// tics when frame skips happen
|
||||||
PS_DrawGameLogicStats();
|
PS_DrawGameLogicStats();
|
||||||
}
|
}
|
||||||
else if (cv_perfstats.value >= 3) // lua thinkframe
|
else if (cv_perfstats.value >= 3) // lua thinkframe
|
||||||
{
|
{
|
||||||
if (!PS_IsLevelActive())
|
if (!PS_IsLevelActive())
|
||||||
return;
|
return;
|
||||||
|
|||||||
+169
-5
@@ -130,6 +130,82 @@ static void M_TextInputPaste(textinput_t *input)
|
|||||||
M_TextInputAddString(input, paste);
|
M_TextInputAddString(input, paste);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void M_TextInputLeft(textinput_t *input, boolean emotes)
|
||||||
|
{
|
||||||
|
// Just do it simple way if possible
|
||||||
|
if (!emotes || input->cursor < 2 || input->buffer[input->cursor-1] != ':')
|
||||||
|
{
|
||||||
|
if (input->cursor != 0)
|
||||||
|
--input->cursor;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise we need to check if we have to skip emote
|
||||||
|
size_t start = input->cursor-2;
|
||||||
|
|
||||||
|
while (input->buffer[start] != ':')
|
||||||
|
{
|
||||||
|
// We reached start of string and didn't find ':' symbol, thats definitely not an emote
|
||||||
|
// so just do it simple way
|
||||||
|
if (start == 0)
|
||||||
|
{
|
||||||
|
M_TextInputLeft(input, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
--start;
|
||||||
|
}
|
||||||
|
|
||||||
|
int emotelen = 0;
|
||||||
|
if (M_VerifyEmote(input->buffer+start, &emotelen))
|
||||||
|
input->cursor -= emotelen; // also skip the :
|
||||||
|
else
|
||||||
|
M_TextInputLeft(input, false); // Not a valid emote, do the simple thing
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M_TextInputRight(textinput_t *input, boolean emotes)
|
||||||
|
{
|
||||||
|
// Just do it simple way if possible
|
||||||
|
if (!emotes || input->cursor == input->length || input->buffer[input->cursor] != ':')
|
||||||
|
{
|
||||||
|
if (input->cursor < input->length)
|
||||||
|
++input->cursor;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int emotelen = 0;
|
||||||
|
if (M_VerifyEmote(input->buffer+input->cursor, &emotelen))
|
||||||
|
input->cursor += emotelen; // Also skip the :
|
||||||
|
else
|
||||||
|
M_TextInputRight(input, false); // Not a valid emote, do the simple thing
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we're inside a valid emote
|
||||||
|
static boolean M_TextInputCheckEmote(textinput_t *input)
|
||||||
|
{
|
||||||
|
int start = input->cursor;
|
||||||
|
|
||||||
|
// Definitely not an emote
|
||||||
|
if (start == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Might be closing :, need to skip it just in case
|
||||||
|
if (input->buffer[start] == ':')
|
||||||
|
--start;
|
||||||
|
|
||||||
|
while (input->buffer[start] != ':')
|
||||||
|
{
|
||||||
|
// No ':' found, definitely not inside emote
|
||||||
|
if (start == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
--start;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Found what may be emote start, now we can check
|
||||||
|
return M_VerifyEmote(input->buffer+start, NULL) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
|
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
|
||||||
{
|
{
|
||||||
input->buffer = buffer;
|
input->buffer = buffer;
|
||||||
@@ -156,7 +232,7 @@ void M_TextInputSetString(textinput_t *input, const char *c)
|
|||||||
input->cursor = input->select = input->length = strlen(c);
|
input->cursor = input->select = input->length = strlen(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emotes)
|
||||||
{
|
{
|
||||||
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|
||||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||||
@@ -241,16 +317,14 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
|||||||
|
|
||||||
if (key == KEY_LEFTARROW)
|
if (key == KEY_LEFTARROW)
|
||||||
{
|
{
|
||||||
if (input->cursor != 0)
|
M_TextInputLeft(input, emotes);
|
||||||
--input->cursor;
|
|
||||||
if (!shiftdown)
|
if (!shiftdown)
|
||||||
input->select = input->cursor;
|
input->select = input->cursor;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (key == KEY_RIGHTARROW)
|
else if (key == KEY_RIGHTARROW)
|
||||||
{
|
{
|
||||||
if (input->cursor < input->length)
|
M_TextInputRight(input, emotes);
|
||||||
++input->cursor;
|
|
||||||
if (!shiftdown)
|
if (!shiftdown)
|
||||||
input->select = input->cursor;
|
input->select = input->cursor;
|
||||||
return true;
|
return true;
|
||||||
@@ -320,6 +394,96 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Just an alias, more or less
|
||||||
|
boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
||||||
|
{
|
||||||
|
return M_TextInputHandleBase(input, key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean M_TextInputHandleEmotes(textinput_t *input, INT32 key, emote_t *suggestions[], int maxsuggestions)
|
||||||
|
{
|
||||||
|
boolean ret = M_TextInputHandleBase(input, key, true);
|
||||||
|
|
||||||
|
// After this handled key we ended up inside an emote, lets fix that
|
||||||
|
if (M_TextInputCheckEmote(input))
|
||||||
|
M_TextInputToWordEnd(input, !shiftdown);
|
||||||
|
|
||||||
|
// Always clear the first entry
|
||||||
|
suggestions[0] = NULL;
|
||||||
|
|
||||||
|
// For autocomplete
|
||||||
|
int emotestart = 0;
|
||||||
|
|
||||||
|
// Try find suggestions for emote names
|
||||||
|
for (int i = input->cursor-1; i >= 0 && input->cursor-i <= MAXEMOTENAME; --i)
|
||||||
|
{
|
||||||
|
// Space can't be part of emote name
|
||||||
|
if (isspace(input->buffer[i]))
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Found a :, try suggest emotes
|
||||||
|
if (input->buffer[i] == ':')
|
||||||
|
{
|
||||||
|
emotestart = i+1;
|
||||||
|
// ...But only if we typed at least something
|
||||||
|
if ((int)input->cursor-(i-1) < 3)
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (int skip = 0; skip < maxsuggestions; ++skip)
|
||||||
|
{
|
||||||
|
suggestions[skip] = M_FindEmote(input->buffer+i+1, input->cursor-i-1, skip);
|
||||||
|
|
||||||
|
// No more suggestions
|
||||||
|
if (!suggestions[skip])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In any case, we found what we wanted, can exit the loop now
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we suggest emotes, try autocomplete
|
||||||
|
if (key == '\t' && suggestions[0])
|
||||||
|
{
|
||||||
|
int pos = (input->cursor-emotestart);
|
||||||
|
boolean autocomplete = true;
|
||||||
|
|
||||||
|
while (autocomplete)
|
||||||
|
{
|
||||||
|
// Check if current character matches for all suggestions
|
||||||
|
char c = suggestions[0]->name[pos];
|
||||||
|
|
||||||
|
// End of string reached
|
||||||
|
if (!c)
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (int i = 1; i < maxsuggestions && suggestions[i]; ++i)
|
||||||
|
{
|
||||||
|
if (suggestions[i]->name[pos] != c)
|
||||||
|
{
|
||||||
|
autocomplete = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++pos;
|
||||||
|
|
||||||
|
if (autocomplete)
|
||||||
|
M_TextInputAddChar(input, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This was the only suggestion, finish autocomplete with a ':' and clear suggestions
|
||||||
|
if (maxsuggestions == 1 || !suggestions[1])
|
||||||
|
{
|
||||||
|
M_TextInputAddChar(input, ':');
|
||||||
|
suggestions[0] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void M_DrawTextInputScroll(INT32 x, INT32 y, textinput_t *input, INT32 flags, INT32 MAXINPUTWIDTH)
|
void M_DrawTextInputScroll(INT32 x, INT32 y, textinput_t *input, INT32 flags, INT32 MAXINPUTWIDTH)
|
||||||
{
|
{
|
||||||
if (renderisnewtic)
|
if (renderisnewtic)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define __M_TEXTINPUT__
|
#define __M_TEXTINPUT__
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
#include "m_emotes.h" // M_VerifyEmote, M_FindEmote
|
||||||
|
|
||||||
typedef struct textinput_s {
|
typedef struct textinput_s {
|
||||||
size_t cursor;
|
size_t cursor;
|
||||||
@@ -22,6 +23,10 @@ void M_TextInputSetString(textinput_t *input, const char *c);
|
|||||||
|
|
||||||
boolean M_TextInputHandle(textinput_t *input, INT32 key);
|
boolean M_TextInputHandle(textinput_t *input, INT32 key);
|
||||||
|
|
||||||
|
// Does everything same as M_TextInputHandle, but also handles emotes in input string
|
||||||
|
// If currently typing something that looks like an existing emote, return suggestions for it
|
||||||
|
boolean M_TextInputHandleEmotes(textinput_t *input, INT32 key, emote_t *suggestions[], int maxsuggestions);
|
||||||
|
|
||||||
#define M_DrawTextInput(x, y, input, flags) M_DrawTextInputScroll((x), (y), (input), (flags), ((input)->buffer_size-1)*8)
|
#define M_DrawTextInput(x, y, input, flags) M_DrawTextInputScroll((x), (y), (input), (flags), ((input)->buffer_size-1)*8)
|
||||||
void M_DrawTextInputScroll(INT32 x, INT32 y, textinput_t *input, INT32 flags, INT32 MAXINPUTWIDTH);
|
void M_DrawTextInputScroll(INT32 x, INT32 y, textinput_t *input, INT32 flags, INT32 MAXINPUTWIDTH);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -412,7 +412,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
|
|||||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&ceiling->thinker);
|
P_AddThinker(&ceiling->thinker);
|
||||||
sec->ceilingdata = ceiling;
|
sec->ceilingdata = ceiling;
|
||||||
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
|
ceiling->thinker.function = (actionf_p1)T_MoveCeiling;
|
||||||
ceiling->sector = sec;
|
ceiling->sector = sec;
|
||||||
ceiling->crush = false;
|
ceiling->crush = false;
|
||||||
ceiling->sourceline = (INT32)(line-lines);
|
ceiling->sourceline = (INT32)(line-lines);
|
||||||
@@ -635,7 +635,7 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
|
|||||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&ceiling->thinker);
|
P_AddThinker(&ceiling->thinker);
|
||||||
sec->ceilingdata = ceiling;
|
sec->ceilingdata = ceiling;
|
||||||
ceiling->thinker.function.acp1 = (actionf_p1)T_CrushCeiling;
|
ceiling->thinker.function = (actionf_p1)T_CrushCeiling;
|
||||||
ceiling->sector = sec;
|
ceiling->sector = sec;
|
||||||
ceiling->crush = true;
|
ceiling->crush = true;
|
||||||
ceiling->sourceline = (INT32)(line-lines);
|
ceiling->sourceline = (INT32)(line-lines);
|
||||||
|
|||||||
+1010
-886
File diff suppressed because it is too large.
Load diff
+7
-7
@@ -2483,7 +2483,7 @@ void T_CameraScanner(elevator_t *elevator)
|
|||||||
|
|
||||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
if (!players[displayplayers[i]].mo || P_MobjWasRemoved(players[displayplayers[i]].mo))
|
if (P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (players[displayplayers[i]].mo->subsector->sector == elevator->actionsector)
|
if (players[displayplayers[i]].mo->subsector->sector == elevator->actionsector)
|
||||||
@@ -2545,7 +2545,7 @@ INT32 EV_DoFloor(line_t *line, floor_e floortype)
|
|||||||
sec->floordata = dofloor;
|
sec->floordata = dofloor;
|
||||||
|
|
||||||
// set up some generic aspects of the floormove_t
|
// set up some generic aspects of the floormove_t
|
||||||
dofloor->thinker.function.acp1 = (actionf_p1)T_MoveFloor;
|
dofloor->thinker.function = (actionf_p1)T_MoveFloor;
|
||||||
dofloor->type = floortype;
|
dofloor->type = floortype;
|
||||||
dofloor->crush = false; // default: types that crush will change this
|
dofloor->crush = false; // default: types that crush will change this
|
||||||
dofloor->sector = sec;
|
dofloor->sector = sec;
|
||||||
@@ -2766,7 +2766,7 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
|
|||||||
P_AddThinker(&elevator->thinker);
|
P_AddThinker(&elevator->thinker);
|
||||||
sec->floordata = elevator;
|
sec->floordata = elevator;
|
||||||
sec->ceilingdata = elevator;
|
sec->ceilingdata = elevator;
|
||||||
elevator->thinker.function.acp1 = (actionf_p1)T_MoveElevator;
|
elevator->thinker.function = (actionf_p1)T_MoveElevator;
|
||||||
elevator->type = elevtype;
|
elevator->type = elevtype;
|
||||||
elevator->sourceline = line;
|
elevator->sourceline = line;
|
||||||
elevator->distance = 1; // Always crush unless otherwise
|
elevator->distance = 1; // Always crush unless otherwise
|
||||||
@@ -2954,7 +2954,7 @@ INT32 EV_BounceSector(sector_t *sec, fixed_t momz, line_t *sourceline)
|
|||||||
bouncer = Z_Calloc(sizeof (*bouncer), PU_LEVSPEC, NULL);
|
bouncer = Z_Calloc(sizeof (*bouncer), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&bouncer->thinker);
|
P_AddThinker(&bouncer->thinker);
|
||||||
sec->ceilingdata = bouncer;
|
sec->ceilingdata = bouncer;
|
||||||
bouncer->thinker.function.acp1 = (actionf_p1)T_BounceCheese;
|
bouncer->thinker.function = (actionf_p1)T_BounceCheese;
|
||||||
|
|
||||||
// set up the fields according to the type of elevator action
|
// set up the fields according to the type of elevator action
|
||||||
bouncer->sector = sec;
|
bouncer->sector = sec;
|
||||||
@@ -2991,7 +2991,7 @@ INT32 EV_DoContinuousFall(sector_t *sec, sector_t *backsector, fixed_t spd, bool
|
|||||||
// create and initialize new thinker
|
// create and initialize new thinker
|
||||||
faller = Z_Calloc(sizeof (*faller), PU_LEVSPEC, NULL);
|
faller = Z_Calloc(sizeof (*faller), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&faller->thinker);
|
P_AddThinker(&faller->thinker);
|
||||||
faller->thinker.function.acp1 = (actionf_p1)T_ContinuousFalling;
|
faller->thinker.function = (actionf_p1)T_ContinuousFalling;
|
||||||
|
|
||||||
// set up the fields
|
// set up the fields
|
||||||
faller->sector = sec;
|
faller->sector = sec;
|
||||||
@@ -3044,7 +3044,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
|
|||||||
// create and initialize new elevator thinker
|
// create and initialize new elevator thinker
|
||||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&elevator->thinker);
|
P_AddThinker(&elevator->thinker);
|
||||||
elevator->thinker.function.acp1 = (actionf_p1)T_StartCrumble;
|
elevator->thinker.function = (actionf_p1)T_StartCrumble;
|
||||||
|
|
||||||
// Does this crumbler return?
|
// Does this crumbler return?
|
||||||
if (crumblereturn)
|
if (crumblereturn)
|
||||||
@@ -3123,7 +3123,7 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob
|
|||||||
P_AddThinker(&block->thinker);
|
P_AddThinker(&block->thinker);
|
||||||
sec->floordata = block;
|
sec->floordata = block;
|
||||||
sec->ceilingdata = block;
|
sec->ceilingdata = block;
|
||||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlock;
|
block->thinker.function = (actionf_p1)T_MarioBlock;
|
||||||
|
|
||||||
// Set up the fields
|
// Set up the fields
|
||||||
block->sector = sec;
|
block->sector = sec;
|
||||||
|
|||||||
+22
-21
@@ -473,7 +473,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
if (player->spectator)
|
if (player->spectator)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (special->tracer && !P_MobjWasRemoved(special->tracer) && toucher == special->tracer)
|
if (!P_MobjWasRemoved(special->tracer) && toucher == special->tracer)
|
||||||
{
|
{
|
||||||
mobj_t *spbexplode;
|
mobj_t *spbexplode;
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
|
|
||||||
spbexplode = P_SpawnMobj(toucher->x, toucher->y, toucher->z, MT_SPBEXPLOSION);
|
spbexplode = P_SpawnMobj(toucher->x, toucher->y, toucher->z, MT_SPBEXPLOSION);
|
||||||
spbexplode->extravalue1 = 1; // Tell K_ExplodePlayer to use extra knockback
|
spbexplode->extravalue1 = 1; // Tell K_ExplodePlayer to use extra knockback
|
||||||
if (special->target && !P_MobjWasRemoved(special->target))
|
if (!P_MobjWasRemoved(special->target))
|
||||||
P_SetTarget(&spbexplode->target, special->target);
|
P_SetTarget(&spbexplode->target, special->target);
|
||||||
|
|
||||||
P_RemoveMobj(special);
|
P_RemoveMobj(special);
|
||||||
@@ -496,7 +496,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
K_SpinPlayer(player, special->target, 0, special, false);
|
K_SpinPlayer(player, special->target, 0, special, false);
|
||||||
return;
|
return;
|
||||||
case MT_SMK_MOLE:
|
case MT_SMK_MOLE:
|
||||||
if (special->target && !P_MobjWasRemoved(special->target))
|
if (!P_MobjWasRemoved(special->target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (special->health <= 0 || toucher->health <= 0)
|
if (special->health <= 0 || toucher->health <= 0)
|
||||||
@@ -587,7 +587,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
special->momx = special->momy = special->momz = 0;
|
special->momx = special->momy = special->momz = 0;
|
||||||
P_GivePlayerRings(player, 1);
|
P_GivePlayerRings(player, 1);
|
||||||
|
|
||||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING)
|
if (UNLIKELY((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING))
|
||||||
P_DoNightsScore(player);
|
P_DoNightsScore(player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
special->momx = special->momy = 0;
|
special->momx = special->momy = 0;
|
||||||
P_GivePlayerRings(player, 1);
|
P_GivePlayerRings(player, 1);
|
||||||
|
|
||||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN)
|
if (UNLIKELY((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN))
|
||||||
P_DoNightsScore(player);
|
P_DoNightsScore(player);
|
||||||
break;
|
break;
|
||||||
case MT_BLUEBALL:
|
case MT_BLUEBALL:
|
||||||
@@ -615,7 +615,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
else
|
else
|
||||||
special->scalespeed = 4*FRACUNIT/5;
|
special->scalespeed = 4*FRACUNIT/5;
|
||||||
|
|
||||||
if (maptol & TOL_NIGHTS)
|
if (UNLIKELY(maptol & TOL_NIGHTS))
|
||||||
P_DoNightsScore(player);
|
P_DoNightsScore(player);
|
||||||
break;
|
break;
|
||||||
case MT_AUTOPICKUP:
|
case MT_AUTOPICKUP:
|
||||||
@@ -832,6 +832,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
if (player->bumpertime < TICRATE/4)
|
if (player->bumpertime < TICRATE/4)
|
||||||
{
|
{
|
||||||
S_StartSound(toucher, special->info->seesound);
|
S_StartSound(toucher, special->info->seesound);
|
||||||
|
|
||||||
if (player->pflags & PF_NIGHTSMODE)
|
if (player->pflags & PF_NIGHTSMODE)
|
||||||
{
|
{
|
||||||
player->bumpertime = TICRATE/2;
|
player->bumpertime = TICRATE/2;
|
||||||
@@ -961,7 +962,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
// scan the remaining thinkers to find koopa
|
// scan the remaining thinkers to find koopa
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -1226,9 +1227,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
return; // SRB2kart - don't need bubbles mucking with the player
|
return; // SRB2kart - don't need bubbles mucking with the player
|
||||||
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
|
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
|
||||||
return;
|
return;
|
||||||
if (maptol & TOL_NIGHTS)
|
if (UNLIKELY(maptol & TOL_NIGHTS))
|
||||||
return;
|
return;
|
||||||
if (mariomode)
|
if (UNLIKELY(mariomode))
|
||||||
return;
|
return;
|
||||||
else if (toucher->eflags & MFE_VERTICALFLIP)
|
else if (toucher->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
@@ -1765,7 +1766,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
|||||||
case MT_SMK_ICEBLOCK:
|
case MT_SMK_ICEBLOCK:
|
||||||
{
|
{
|
||||||
mobj_t *cur = target->hnext;
|
mobj_t *cur = target->hnext;
|
||||||
while (cur && !P_MobjWasRemoved(cur))
|
while (!P_MobjWasRemoved(cur))
|
||||||
{
|
{
|
||||||
P_SetMobjState(cur, S_SMK_ICEBLOCK2);
|
P_SetMobjState(cur, S_SMK_ICEBLOCK2);
|
||||||
cur = cur->hnext;
|
cur = cur->hnext;
|
||||||
@@ -1816,7 +1817,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
|||||||
// this can happen if the boss was hurt earlier than expected
|
// this can happen if the boss was hurt earlier than expected
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo = (mobj_t *)th;
|
mo = (mobj_t *)th;
|
||||||
@@ -1838,14 +1839,14 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
|||||||
// kill tracer
|
// kill tracer
|
||||||
if (target->type == MT_FROGGER)
|
if (target->type == MT_FROGGER)
|
||||||
{
|
{
|
||||||
if (target->tracer && !P_MobjWasRemoved(target->tracer))
|
if (!P_MobjWasRemoved(target->tracer))
|
||||||
P_KillMobj(target->tracer, inflictor, source);
|
P_KillMobj(target->tracer, inflictor, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target->type == MT_FROGGER || target->type == MT_ROBRA_HEAD || target->type == MT_BLUEROBRA_HEAD) // clean hnext list
|
if (target->type == MT_FROGGER || target->type == MT_ROBRA_HEAD || target->type == MT_BLUEROBRA_HEAD) // clean hnext list
|
||||||
{
|
{
|
||||||
mobj_t *cur = target->hnext;
|
mobj_t *cur = target->hnext;
|
||||||
while (cur && !P_MobjWasRemoved(cur))
|
while (!P_MobjWasRemoved(cur))
|
||||||
{
|
{
|
||||||
P_KillMobj(cur, inflictor, source);
|
P_KillMobj(cur, inflictor, source);
|
||||||
cur = cur->hnext;
|
cur = cur->hnext;
|
||||||
@@ -2352,11 +2353,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||||||
if (player->exiting)
|
if (player->exiting)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS))
|
if (UNLIKELY(!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling
|
if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) // NiGHTS damage handling
|
||||||
{
|
{
|
||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
@@ -2601,7 +2602,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
|||||||
ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale);
|
ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale);
|
||||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||||
|
|
||||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||||
|
|
||||||
P_SetObjectMomZ(mo, 8*FRACUNIT, false);
|
P_SetObjectMomZ(mo, 8*FRACUNIT, false);
|
||||||
@@ -2625,7 +2626,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
|||||||
ns = FixedMul(momxy, mo->scale);
|
ns = FixedMul(momxy, mo->scale);
|
||||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||||
|
|
||||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||||
|
|
||||||
ns = momz;
|
ns = momz;
|
||||||
@@ -2732,7 +2733,7 @@ void P_PlayerWeaponPanelBurst(player_t *player)
|
|||||||
ns = FixedMul(3*FRACUNIT, mo->scale);
|
ns = FixedMul(3*FRACUNIT, mo->scale);
|
||||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||||
|
|
||||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||||
|
|
||||||
P_SetObjectMomZ(mo, 4*FRACUNIT, false);
|
P_SetObjectMomZ(mo, 4*FRACUNIT, false);
|
||||||
@@ -2816,7 +2817,7 @@ void P_PlayerWeaponAmmoBurst(player_t *player)
|
|||||||
ns = FixedMul(2*FRACUNIT, mo->scale);
|
ns = FixedMul(2*FRACUNIT, mo->scale);
|
||||||
mo->momx = FixedMul(FINECOSINE(fa), ns);
|
mo->momx = FixedMul(FINECOSINE(fa), ns);
|
||||||
|
|
||||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||||
|
|
||||||
P_SetObjectMomZ(mo, 3*FRACUNIT, false);
|
P_SetObjectMomZ(mo, 3*FRACUNIT, false);
|
||||||
@@ -2932,7 +2933,7 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss)
|
|||||||
|
|
||||||
momx = FixedMul(FINECOSINE(fa), ns);
|
momx = FixedMul(FINECOSINE(fa), ns);
|
||||||
|
|
||||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||||
momy = FixedMul(FINESINE(fa),ns);
|
momy = FixedMul(FINESINE(fa),ns);
|
||||||
else
|
else
|
||||||
momy = 0;
|
momy = 0;
|
||||||
@@ -2989,7 +2990,7 @@ void P_PlayerFlagBurst(player_t *player, boolean toss)
|
|||||||
{
|
{
|
||||||
angle_t fa = P_RandomByte()*FINEANGLES/256;
|
angle_t fa = P_RandomByte()*FINEANGLES/256;
|
||||||
flag->momx = FixedMul(FINECOSINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
flag->momx = FixedMul(FINECOSINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
||||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||||
flag->momy = FixedMul(FINESINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
flag->momy = FixedMul(FINESINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -78,7 +78,7 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxse
|
|||||||
|
|
||||||
P_AddThinker(&flick->thinker);
|
P_AddThinker(&flick->thinker);
|
||||||
|
|
||||||
flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
flick->thinker.function = (actionf_p1)T_FireFlicker;
|
||||||
flick->sector = maxsector;
|
flick->sector = maxsector;
|
||||||
flick->maxlight = maxsector->lightlevel;
|
flick->maxlight = maxsector->lightlevel;
|
||||||
flick->minlight = minsector->lightlevel;
|
flick->minlight = minsector->lightlevel;
|
||||||
@@ -140,7 +140,7 @@ void P_SpawnLightningFlash(sector_t *sector)
|
|||||||
|
|
||||||
if (sector->lightingdata)
|
if (sector->lightingdata)
|
||||||
{
|
{
|
||||||
if (((lightflash_t *)sector->lightingdata)->thinker.function.acp1
|
if (((lightflash_t *)sector->lightingdata)->thinker.function
|
||||||
== (actionf_p1)T_LightningFlash)
|
== (actionf_p1)T_LightningFlash)
|
||||||
{
|
{
|
||||||
// lightning was already flashing in this sector
|
// lightning was already flashing in this sector
|
||||||
@@ -157,7 +157,7 @@ void P_SpawnLightningFlash(sector_t *sector)
|
|||||||
|
|
||||||
P_AddThinker(&flash->thinker);
|
P_AddThinker(&flash->thinker);
|
||||||
|
|
||||||
flash->thinker.function.acp1 = (actionf_p1)T_LightningFlash;
|
flash->thinker.function = (actionf_p1)T_LightningFlash;
|
||||||
flash->sector = sector;
|
flash->sector = sector;
|
||||||
flash->maxlight = 255;
|
flash->maxlight = 255;
|
||||||
flash->minlight = minlight;
|
flash->minlight = minlight;
|
||||||
@@ -219,7 +219,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector,
|
|||||||
flash->sector = maxsector;
|
flash->sector = maxsector;
|
||||||
flash->darktime = darktime;
|
flash->darktime = darktime;
|
||||||
flash->brighttime = brighttime;
|
flash->brighttime = brighttime;
|
||||||
flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
|
flash->thinker.function = (actionf_p1)T_StrobeFlash;
|
||||||
flash->maxlight = maxsector->lightlevel;
|
flash->maxlight = maxsector->lightlevel;
|
||||||
flash->minlight = minsector->lightlevel;
|
flash->minlight = minsector->lightlevel;
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector,
|
|||||||
g->minlight = g->maxlight;
|
g->minlight = g->maxlight;
|
||||||
g->maxlight = oops;
|
g->maxlight = oops;
|
||||||
}
|
}
|
||||||
g->thinker.function.acp1 = (actionf_p1)T_Glow;
|
g->thinker.function = (actionf_p1)T_Glow;
|
||||||
g->direction = 1;
|
g->direction = 1;
|
||||||
g->speed = length/4;
|
g->speed = length/4;
|
||||||
if (g->speed > (g->maxlight - g->minlight)/2) // don't make it ridiculous speed
|
if (g->speed > (g->maxlight - g->minlight)/2) // don't make it ridiculous speed
|
||||||
@@ -347,7 +347,7 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed)
|
|||||||
|
|
||||||
P_RemoveLighting(sector); // remove the old lighting effect first
|
P_RemoveLighting(sector); // remove the old lighting effect first
|
||||||
ll = Z_Calloc(sizeof (*ll), PU_LEVSPEC, NULL);
|
ll = Z_Calloc(sizeof (*ll), PU_LEVSPEC, NULL);
|
||||||
ll->thinker.function.acp1 = (actionf_p1)T_LightFade;
|
ll->thinker.function = (actionf_p1)T_LightFade;
|
||||||
sector->lightingdata = ll; // set it to the lightlevel_t
|
sector->lightingdata = ll; // set it to the lightlevel_t
|
||||||
|
|
||||||
P_AddThinker(&ll->thinker); // add thinker
|
P_AddThinker(&ll->thinker); // add thinker
|
||||||
|
|||||||
+1
-1
@@ -279,7 +279,7 @@ void P_SceneryThinker(mobj_t *mobj);
|
|||||||
// To test it in Lua, check mobj.valid
|
// To test it in Lua, check mobj.valid
|
||||||
FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(const mobj_t *mobj)
|
FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(const mobj_t *mobj)
|
||||||
{
|
{
|
||||||
return (!mobj || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker);
|
return (!mobj || mobj->thinker.function != (actionf_p1)P_MobjThinker);
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||||
|
|||||||
+11
-11
@@ -140,7 +140,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||||||
if (object->player && object->player->spectator)
|
if (object->player && object->player->spectator)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (object->player && (object->player->pflags & PF_NIGHTSMODE))
|
if (UNLIKELY(object->player && (object->player->pflags & PF_NIGHTSMODE)))
|
||||||
{
|
{
|
||||||
/*Someone want to make these work like bumpers?*/
|
/*Someone want to make these work like bumpers?*/
|
||||||
return false;
|
return false;
|
||||||
@@ -321,7 +321,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Ignore... things.
|
// Ignore... things.
|
||||||
if (!tmthing || !thing || P_MobjWasRemoved(thing))
|
if (!tmthing || P_MobjWasRemoved(thing))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
I_Assert(!P_MobjWasRemoved(tmthing));
|
I_Assert(!P_MobjWasRemoved(tmthing));
|
||||||
@@ -335,7 +335,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||||||
#ifdef SEENAMES
|
#ifdef SEENAMES
|
||||||
// Do name checks all the way up here
|
// Do name checks all the way up here
|
||||||
// So that NOTHING ELSE can see MT_NAMECHECK because it is client-side.
|
// So that NOTHING ELSE can see MT_NAMECHECK because it is client-side.
|
||||||
if (tmthing->type == MT_NAMECHECK)
|
if (UNLIKELY(tmthing->type == MT_NAMECHECK))
|
||||||
{
|
{
|
||||||
// Ignore things that aren't players, ignore spectators, ignore yourself.
|
// Ignore things that aren't players, ignore spectators, ignore yourself.
|
||||||
// (also don't bother to check that tmthing->target->player is non-NULL because we're not actually using it here.)
|
// (also don't bother to check that tmthing->target->player is non-NULL because we're not actually using it here.)
|
||||||
@@ -361,8 +361,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Don't collide with your buddies while NiGHTS-flying.
|
// Don't collide with your buddies while NiGHTS-flying.
|
||||||
if (tmthing->player && thing->player && (maptol & TOL_NIGHTS)
|
if (UNLIKELY(tmthing->player && thing->player && (maptol & TOL_NIGHTS)
|
||||||
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE)))
|
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE))))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
blockdist = thing->radius + tmthing->radius;
|
blockdist = thing->radius + tmthing->radius;
|
||||||
@@ -2004,7 +2004,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
|
|
||||||
mapcampointer = thiscam;
|
mapcampointer = thiscam;
|
||||||
|
|
||||||
if (GETSECSPECIAL(newsec->special, 4) == 12)
|
if (UNLIKELY(GETSECSPECIAL(newsec->special, 4) == 12))
|
||||||
{ // Camera noclip on entire sector.
|
{ // Camera noclip on entire sector.
|
||||||
tmfloorz = tmdropoffz = thiscam->z;
|
tmfloorz = tmdropoffz = thiscam->z;
|
||||||
tmceilingz = tmdrpoffceilz = thiscam->z + thiscam->height;
|
tmceilingz = tmdrpoffceilz = thiscam->z + thiscam->height;
|
||||||
@@ -2045,10 +2045,10 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
{
|
{
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || UNLIKELY(GETSECSPECIAL(rover->master->frontsector->special, 4) == 12))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
topheight = P_CameraGetFOFTopZ(thiscam, newsec, rover, x, y, NULL);
|
topheight = P_CameraGetFOFTopZ(thiscam, newsec, rover, x, y, NULL);
|
||||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsec, rover, x, y, NULL);
|
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsec, rover, x, y, NULL);
|
||||||
|
|
||||||
delta1 = thiscam->z - (bottomheight
|
delta1 = thiscam->z - (bottomheight
|
||||||
@@ -2120,7 +2120,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||||||
// We're inside it! Yess...
|
// We're inside it! Yess...
|
||||||
polysec = po->lines[0]->backsector;
|
polysec = po->lines[0]->backsector;
|
||||||
|
|
||||||
if (GETSECSPECIAL(polysec->special, 4) == 12)
|
if (UNLIKELY(GETSECSPECIAL(polysec->special, 4) == 12))
|
||||||
{ // Camera noclip polyobj.
|
{ // Camera noclip polyobj.
|
||||||
plink = (polymaplink_t *)(plink->link.next);
|
plink = (polymaplink_t *)(plink->link.next);
|
||||||
continue;
|
continue;
|
||||||
@@ -3183,7 +3183,7 @@ stairstep:
|
|||||||
|
|
||||||
P_HitSlideLine(bestslideline); // clip the moves
|
P_HitSlideLine(bestslideline); // clip the moves
|
||||||
|
|
||||||
if ((twodlevel || (mo->flags2 & MF2_TWOD)) && mo->player)
|
if (UNLIKELY((twodlevel || (mo->flags2 & MF2_TWOD)) && mo->player))
|
||||||
{
|
{
|
||||||
mo->momx = tmxmove;
|
mo->momx = tmxmove;
|
||||||
tmymove = 0;
|
tmymove = 0;
|
||||||
@@ -3626,7 +3626,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
|||||||
|
|
||||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||||
{
|
{
|
||||||
if (think->function.acp1 != (actionf_p1)T_StartCrumble)
|
if (think->function != (actionf_p1)T_StartCrumble)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
crumbler = (elevator_t *)think;
|
crumbler = (elevator_t *)think;
|
||||||
|
|||||||
+2
-2
@@ -366,7 +366,7 @@ void P_CameraLineOpening(line_t *linedef)
|
|||||||
{
|
{
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || UNLIKELY(GETSECSPECIAL(rover->master->frontsector->special, 4) == 12))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef);
|
topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef);
|
||||||
@@ -394,7 +394,7 @@ void P_CameraLineOpening(line_t *linedef)
|
|||||||
{
|
{
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || UNLIKELY(GETSECSPECIAL(rover->master->frontsector->special, 4) == 12))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef);
|
topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef);
|
||||||
|
|||||||
+1590
-1503
File diff suppressed because it is too large.
Load diff
+13
-13
@@ -1557,7 +1557,7 @@ void Polyobj_InitLevel(void)
|
|||||||
// the mobj_t pointers on a queue for use below.
|
// the mobj_t pointers on a queue for use below.
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mobj_t *mo = (mobj_t *)th;
|
mobj_t *mo = (mobj_t *)th;
|
||||||
@@ -1832,7 +1832,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||||||
// We redo this each tic to make savegame compatibility easier.
|
// We redo this each tic to make savegame compatibility easier.
|
||||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||||
{
|
{
|
||||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
if (wp->function != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)wp;
|
mo2 = (mobj_t *)wp;
|
||||||
@@ -1916,7 +1916,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||||||
// Find next waypoint
|
// Find next waypoint
|
||||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||||
{
|
{
|
||||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
if (wp->function != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)wp;
|
mo2 = (mobj_t *)wp;
|
||||||
@@ -1955,7 +1955,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||||||
|
|
||||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||||
{
|
{
|
||||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
if (wp->function != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)wp;
|
mo2 = (mobj_t *)wp;
|
||||||
@@ -1992,7 +1992,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||||||
|
|
||||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||||
{
|
{
|
||||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
if (wp->function != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)wp;
|
mo2 = (mobj_t *)wp;
|
||||||
@@ -2357,7 +2357,7 @@ INT32 EV_DoPolyObjRotate(polyrotdata_t *prdata)
|
|||||||
|
|
||||||
// create a new thinker
|
// create a new thinker
|
||||||
th = Z_Malloc(sizeof(polyrotate_t), PU_LEVSPEC, NULL);
|
th = Z_Malloc(sizeof(polyrotate_t), PU_LEVSPEC, NULL);
|
||||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjRotate;
|
th->thinker.function = (actionf_p1)T_PolyObjRotate;
|
||||||
PolyObj_AddThinker(&th->thinker);
|
PolyObj_AddThinker(&th->thinker);
|
||||||
po->thinker = &th->thinker;
|
po->thinker = &th->thinker;
|
||||||
|
|
||||||
@@ -2425,7 +2425,7 @@ INT32 EV_DoPolyObjMove(polymovedata_t *pmdata)
|
|||||||
|
|
||||||
// create a new thinker
|
// create a new thinker
|
||||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjMove;
|
th->thinker.function = (actionf_p1)T_PolyObjMove;
|
||||||
PolyObj_AddThinker(&th->thinker);
|
PolyObj_AddThinker(&th->thinker);
|
||||||
po->thinker = &th->thinker;
|
po->thinker = &th->thinker;
|
||||||
|
|
||||||
@@ -2491,7 +2491,7 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
|||||||
|
|
||||||
// create a new thinker
|
// create a new thinker
|
||||||
th = Z_Malloc(sizeof(polywaypoint_t), PU_LEVSPEC, NULL);
|
th = Z_Malloc(sizeof(polywaypoint_t), PU_LEVSPEC, NULL);
|
||||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjWaypoint;
|
th->thinker.function = (actionf_p1)T_PolyObjWaypoint;
|
||||||
PolyObj_AddThinker(&th->thinker);
|
PolyObj_AddThinker(&th->thinker);
|
||||||
po->thinker = &th->thinker;
|
po->thinker = &th->thinker;
|
||||||
|
|
||||||
@@ -2512,7 +2512,7 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
|||||||
// Find the first waypoint we need to use
|
// Find the first waypoint we need to use
|
||||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||||
{
|
{
|
||||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
if (wp->function != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)wp;
|
mo2 = (mobj_t *)wp;
|
||||||
@@ -2627,7 +2627,7 @@ static void Polyobj_doSlideDoor(polyobj_t *po, polydoordata_t *doordata)
|
|||||||
|
|
||||||
// allocate and add a new slide door thinker
|
// allocate and add a new slide door thinker
|
||||||
th = Z_Malloc(sizeof(polyslidedoor_t), PU_LEVSPEC, NULL);
|
th = Z_Malloc(sizeof(polyslidedoor_t), PU_LEVSPEC, NULL);
|
||||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSlide;
|
th->thinker.function = (actionf_p1)T_PolyDoorSlide;
|
||||||
PolyObj_AddThinker(&th->thinker);
|
PolyObj_AddThinker(&th->thinker);
|
||||||
|
|
||||||
// point the polyobject to this thinker
|
// point the polyobject to this thinker
|
||||||
@@ -2678,7 +2678,7 @@ static void Polyobj_doSwingDoor(polyobj_t *po, polydoordata_t *doordata)
|
|||||||
|
|
||||||
// allocate and add a new swing door thinker
|
// allocate and add a new swing door thinker
|
||||||
th = Z_Malloc(sizeof(polyswingdoor_t), PU_LEVSPEC, NULL);
|
th = Z_Malloc(sizeof(polyswingdoor_t), PU_LEVSPEC, NULL);
|
||||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSwing;
|
th->thinker.function = (actionf_p1)T_PolyDoorSwing;
|
||||||
PolyObj_AddThinker(&th->thinker);
|
PolyObj_AddThinker(&th->thinker);
|
||||||
|
|
||||||
// point the polyobject to this thinker
|
// point the polyobject to this thinker
|
||||||
@@ -2763,7 +2763,7 @@ INT32 EV_DoPolyObjDisplace(polydisplacedata_t *prdata)
|
|||||||
|
|
||||||
// create a new thinker
|
// create a new thinker
|
||||||
th = Z_Malloc(sizeof(polydisplace_t), PU_LEVSPEC, NULL);
|
th = Z_Malloc(sizeof(polydisplace_t), PU_LEVSPEC, NULL);
|
||||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjDisplace;
|
th->thinker.function = (actionf_p1)T_PolyObjDisplace;
|
||||||
PolyObj_AddThinker(&th->thinker);
|
PolyObj_AddThinker(&th->thinker);
|
||||||
po->thinker = &th->thinker;
|
po->thinker = &th->thinker;
|
||||||
|
|
||||||
@@ -2867,7 +2867,7 @@ INT32 EV_DoPolyObjFlag(line_t *pfdata)
|
|||||||
|
|
||||||
// create a new thinker
|
// create a new thinker
|
||||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjFlag;
|
th->thinker.function = (actionf_p1)T_PolyObjFlag;
|
||||||
PolyObj_AddThinker(&th->thinker);
|
PolyObj_AddThinker(&th->thinker);
|
||||||
po->thinker = &th->thinker;
|
po->thinker = &th->thinker;
|
||||||
|
|
||||||
|
|||||||
+67
-67
@@ -1677,194 +1677,194 @@ static void P_NetArchiveThinkers(savebuffer_t *save)
|
|||||||
// save off the current thinkers
|
// save off the current thinkers
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
if (th->function == (actionf_p1)P_RemoveThinkerDelayed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
numsaved++;
|
numsaved++;
|
||||||
|
|
||||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
if (th->function == (actionf_p1)P_MobjThinker)
|
||||||
{
|
{
|
||||||
SaveMobjThinker(save, th, tc_mobj);
|
SaveMobjThinker(save, th, tc_mobj);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_MoveCeiling)
|
else if (th->function == (actionf_p1)T_MoveCeiling)
|
||||||
{
|
{
|
||||||
SaveCeilingThinker(save, th, tc_ceiling);
|
SaveCeilingThinker(save, th, tc_ceiling);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_CrushCeiling)
|
else if (th->function == (actionf_p1)T_CrushCeiling)
|
||||||
{
|
{
|
||||||
SaveCeilingThinker(save, th, tc_crushceiling);
|
SaveCeilingThinker(save, th, tc_crushceiling);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_MoveFloor)
|
else if (th->function == (actionf_p1)T_MoveFloor)
|
||||||
{
|
{
|
||||||
SaveFloormoveThinker(save, th, tc_floor);
|
SaveFloormoveThinker(save, th, tc_floor);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_LightningFlash)
|
else if (th->function == (actionf_p1)T_LightningFlash)
|
||||||
{
|
{
|
||||||
SaveLightflashThinker(save, th, tc_flash);
|
SaveLightflashThinker(save, th, tc_flash);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_StrobeFlash)
|
else if (th->function == (actionf_p1)T_StrobeFlash)
|
||||||
{
|
{
|
||||||
SaveStrobeThinker(save, th, tc_strobe);
|
SaveStrobeThinker(save, th, tc_strobe);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Glow)
|
else if (th->function == (actionf_p1)T_Glow)
|
||||||
{
|
{
|
||||||
SaveGlowThinker(save, th, tc_glow);
|
SaveGlowThinker(save, th, tc_glow);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_FireFlicker)
|
else if (th->function == (actionf_p1)T_FireFlicker)
|
||||||
{
|
{
|
||||||
SaveFireflickerThinker(save, th, tc_fireflicker);
|
SaveFireflickerThinker(save, th, tc_fireflicker);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_MoveElevator)
|
else if (th->function == (actionf_p1)T_MoveElevator)
|
||||||
{
|
{
|
||||||
SaveElevatorThinker(save, th, tc_elevator);
|
SaveElevatorThinker(save, th, tc_elevator);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_ContinuousFalling)
|
else if (th->function == (actionf_p1)T_ContinuousFalling)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_continuousfalling);
|
SaveSpecialLevelThinker(save, th, tc_continuousfalling);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_ThwompSector)
|
else if (th->function == (actionf_p1)T_ThwompSector)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_thwomp);
|
SaveSpecialLevelThinker(save, th, tc_thwomp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_NoEnemiesSector)
|
else if (th->function == (actionf_p1)T_NoEnemiesSector)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_noenemies);
|
SaveSpecialLevelThinker(save, th, tc_noenemies);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_EachTimeThinker)
|
else if (th->function == (actionf_p1)T_EachTimeThinker)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_eachtime);
|
SaveSpecialLevelThinker(save, th, tc_eachtime);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_RaiseSector)
|
else if (th->function == (actionf_p1)T_RaiseSector)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_raisesector);
|
SaveSpecialLevelThinker(save, th, tc_raisesector);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_CameraScanner)
|
else if (th->function == (actionf_p1)T_CameraScanner)
|
||||||
{
|
{
|
||||||
SaveElevatorThinker(save, th, tc_camerascanner);
|
SaveElevatorThinker(save, th, tc_camerascanner);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Scroll)
|
else if (th->function == (actionf_p1)T_Scroll)
|
||||||
{
|
{
|
||||||
SaveScrollThinker(save, th, tc_scroll);
|
SaveScrollThinker(save, th, tc_scroll);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Friction)
|
else if (th->function == (actionf_p1)T_Friction)
|
||||||
{
|
{
|
||||||
SaveFrictionThinker(save, th, tc_friction);
|
SaveFrictionThinker(save, th, tc_friction);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Pusher)
|
else if (th->function == (actionf_p1)T_Pusher)
|
||||||
{
|
{
|
||||||
SavePusherThinker(save, th, tc_pusher);
|
SavePusherThinker(save, th, tc_pusher);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_BounceCheese)
|
else if (th->function == (actionf_p1)T_BounceCheese)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_bouncecheese);
|
SaveSpecialLevelThinker(save, th, tc_bouncecheese);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_StartCrumble)
|
else if (th->function == (actionf_p1)T_StartCrumble)
|
||||||
{
|
{
|
||||||
SaveElevatorThinker(save, th, tc_startcrumble);
|
SaveElevatorThinker(save, th, tc_startcrumble);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_MarioBlock)
|
else if (th->function == (actionf_p1)T_MarioBlock)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_marioblock);
|
SaveSpecialLevelThinker(save, th, tc_marioblock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_MarioBlockChecker)
|
else if (th->function == (actionf_p1)T_MarioBlockChecker)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_marioblockchecker);
|
SaveSpecialLevelThinker(save, th, tc_marioblockchecker);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_SpikeSector)
|
else if (th->function == (actionf_p1)T_SpikeSector)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_spikesector);
|
SaveSpecialLevelThinker(save, th, tc_spikesector);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_FloatSector)
|
else if (th->function == (actionf_p1)T_FloatSector)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_floatsector);
|
SaveSpecialLevelThinker(save, th, tc_floatsector);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_BridgeThinker)
|
else if (th->function == (actionf_p1)T_BridgeThinker)
|
||||||
{
|
{
|
||||||
SaveSpecialLevelThinker(save, th, tc_bridgethinker);
|
SaveSpecialLevelThinker(save, th, tc_bridgethinker);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_LaserFlash)
|
else if (th->function == (actionf_p1)T_LaserFlash)
|
||||||
{
|
{
|
||||||
SaveLaserThinker(save, th, tc_laserflash);
|
SaveLaserThinker(save, th, tc_laserflash);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_LightFade)
|
else if (th->function == (actionf_p1)T_LightFade)
|
||||||
{
|
{
|
||||||
SaveLightlevelThinker(save, th, tc_lightfade);
|
SaveLightlevelThinker(save, th, tc_lightfade);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_ExecutorDelay)
|
else if (th->function == (actionf_p1)T_ExecutorDelay)
|
||||||
{
|
{
|
||||||
SaveExecutorThinker(save, th, tc_executor);
|
SaveExecutorThinker(save, th, tc_executor);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Disappear)
|
else if (th->function == (actionf_p1)T_Disappear)
|
||||||
{
|
{
|
||||||
SaveDisappearThinker(save, th, tc_disappear);
|
SaveDisappearThinker(save, th, tc_disappear);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_PolyObjRotate)
|
else if (th->function == (actionf_p1)T_PolyObjRotate)
|
||||||
{
|
{
|
||||||
SavePolyrotatetThinker(save, th, tc_polyrotate);
|
SavePolyrotatetThinker(save, th, tc_polyrotate);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_PolyObjMove)
|
else if (th->function == (actionf_p1)T_PolyObjMove)
|
||||||
{
|
{
|
||||||
SavePolymoveThinker(save, th, tc_polymove);
|
SavePolymoveThinker(save, th, tc_polymove);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_PolyObjWaypoint)
|
else if (th->function == (actionf_p1)T_PolyObjWaypoint)
|
||||||
{
|
{
|
||||||
SavePolywaypointThinker(save, th, tc_polywaypoint);
|
SavePolywaypointThinker(save, th, tc_polywaypoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_PolyDoorSlide)
|
else if (th->function == (actionf_p1)T_PolyDoorSlide)
|
||||||
{
|
{
|
||||||
SavePolyslidedoorThinker(save, th, tc_polyslidedoor);
|
SavePolyslidedoorThinker(save, th, tc_polyslidedoor);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_PolyDoorSwing)
|
else if (th->function == (actionf_p1)T_PolyDoorSwing)
|
||||||
{
|
{
|
||||||
SavePolyswingdoorThinker(save, th, tc_polyswingdoor);
|
SavePolyswingdoorThinker(save, th, tc_polyswingdoor);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_PolyObjFlag)
|
else if (th->function == (actionf_p1)T_PolyObjFlag)
|
||||||
{
|
{
|
||||||
SavePolymoveThinker(save, th, tc_polyflag);
|
SavePolymoveThinker(save, th, tc_polyflag);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (th->function.acp1 == (actionf_p1)T_PolyObjDisplace)
|
else if (th->function == (actionf_p1)T_PolyObjDisplace)
|
||||||
{
|
{
|
||||||
SavePolydisplaceThinker(save, th, tc_polydisplace);
|
SavePolydisplaceThinker(save, th, tc_polydisplace);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
else if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) // wait garbage collection
|
else if (th->function != (actionf_p1)P_RemoveThinkerDelayed) // wait garbage collection
|
||||||
I_Error("unknown thinker type %p", th->function.acp1);
|
I_Error("unknown thinker type %p", th->function);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1884,7 +1884,7 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mobj = (mobj_t *)th;
|
mobj = (mobj_t *)th;
|
||||||
@@ -1983,7 +1983,7 @@ static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
mobj = AllocMobj();
|
mobj = AllocMobj();
|
||||||
|
|
||||||
// declare this as a valid mobj as soon as possible.
|
// declare this as a valid mobj as soon as possible.
|
||||||
mobj->thinker.function.acp1 = thinker;
|
mobj->thinker.function = thinker;
|
||||||
|
|
||||||
mobj->z = z;
|
mobj->z = z;
|
||||||
mobj->floorz = floorz;
|
mobj->floorz = floorz;
|
||||||
@@ -2216,7 +2216,7 @@ static void LoadSpecialLevelThinker(savebuffer_t *save, actionf_p1 thinker, UINT
|
|||||||
{
|
{
|
||||||
levelspecthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
levelspecthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
size_t i;
|
size_t i;
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
ht->vars[i] = READFIXED(save->p); //var[16]
|
ht->vars[i] = READFIXED(save->p); //var[16]
|
||||||
@@ -2244,7 +2244,7 @@ static void LoadSpecialLevelThinker(savebuffer_t *save, actionf_p1 thinker, UINT
|
|||||||
static void LoadCeilingThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadCeilingThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
ceiling_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
ceiling_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->type = READUINT8(save->p);
|
ht->type = READUINT8(save->p);
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->bottomheight = READFIXED(save->p);
|
ht->bottomheight = READFIXED(save->p);
|
||||||
@@ -2273,7 +2273,7 @@ static void LoadCeilingThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static void LoadFloormoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadFloormoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
floormove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
floormove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->type = READUINT8(save->p);
|
ht->type = READUINT8(save->p);
|
||||||
ht->crush = READUINT8(save->p);
|
ht->crush = READUINT8(save->p);
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
@@ -2297,7 +2297,7 @@ static void LoadFloormoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static void LoadLightflashThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadLightflashThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
lightflash_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
lightflash_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->maxlight = READINT32(save->p);
|
ht->maxlight = READINT32(save->p);
|
||||||
ht->minlight = READINT32(save->p);
|
ht->minlight = READINT32(save->p);
|
||||||
@@ -2314,7 +2314,7 @@ static void LoadLightflashThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static void LoadStrobeThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadStrobeThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
strobe_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
strobe_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->count = READINT32(save->p);
|
ht->count = READINT32(save->p);
|
||||||
ht->minlight = READINT32(save->p);
|
ht->minlight = READINT32(save->p);
|
||||||
@@ -2334,7 +2334,7 @@ static void LoadStrobeThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static void LoadGlowThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadGlowThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->minlight = READINT32(save->p);
|
ht->minlight = READINT32(save->p);
|
||||||
ht->maxlight = READINT32(save->p);
|
ht->maxlight = READINT32(save->p);
|
||||||
@@ -2353,7 +2353,7 @@ static void LoadGlowThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static void LoadFireflickerThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadFireflickerThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
fireflicker_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
fireflicker_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->count = READINT32(save->p);
|
ht->count = READINT32(save->p);
|
||||||
ht->resetcount = READINT32(save->p);
|
ht->resetcount = READINT32(save->p);
|
||||||
@@ -2372,7 +2372,7 @@ static void LoadFireflickerThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static void LoadElevatorThinker(savebuffer_t *save, actionf_p1 thinker, UINT8 floorOrCeiling)
|
static void LoadElevatorThinker(savebuffer_t *save, actionf_p1 thinker, UINT8 floorOrCeiling)
|
||||||
{
|
{
|
||||||
elevator_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
elevator_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->type = READUINT8(save->p);
|
ht->type = READUINT8(save->p);
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->actionsector = LoadSector(READUINT32(save->p));
|
ht->actionsector = LoadSector(READUINT32(save->p));
|
||||||
@@ -2410,7 +2410,7 @@ static void LoadElevatorThinker(savebuffer_t *save, actionf_p1 thinker, UINT8 fl
|
|||||||
static void LoadScrollThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadScrollThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
scroll_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
scroll_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->dx = READFIXED(save->p);
|
ht->dx = READFIXED(save->p);
|
||||||
ht->dy = READFIXED(save->p);
|
ht->dy = READFIXED(save->p);
|
||||||
ht->affectee = READINT32(save->p);
|
ht->affectee = READINT32(save->p);
|
||||||
@@ -2432,7 +2432,7 @@ static void LoadScrollThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static inline void LoadFrictionThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadFrictionThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
friction_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
friction_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->friction = READINT32(save->p);
|
ht->friction = READINT32(save->p);
|
||||||
ht->movefactor = READINT32(save->p);
|
ht->movefactor = READINT32(save->p);
|
||||||
ht->affectee = READINT32(save->p);
|
ht->affectee = READINT32(save->p);
|
||||||
@@ -2449,7 +2449,7 @@ static inline void LoadFrictionThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static void LoadPusherThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadPusherThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
pusher_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
pusher_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->type = READUINT8(save->p);
|
ht->type = READUINT8(save->p);
|
||||||
ht->x_mag = READINT32(save->p);
|
ht->x_mag = READINT32(save->p);
|
||||||
ht->y_mag = READINT32(save->p);
|
ht->y_mag = READINT32(save->p);
|
||||||
@@ -2476,7 +2476,7 @@ static inline void LoadLaserThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
{
|
{
|
||||||
laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ffloor_t *rover = NULL;
|
ffloor_t *rover = NULL;
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->sec = LoadSector(READUINT32(save->p));
|
ht->sec = LoadSector(READUINT32(save->p));
|
||||||
ht->sourceline = LoadLine(READUINT32(save->p));
|
ht->sourceline = LoadLine(READUINT32(save->p));
|
||||||
@@ -2495,7 +2495,7 @@ static inline void LoadLaserThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
FUNCINLINE static ATTRINLINE void LoadLightlevelThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadLightlevelThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
ht->destlevel = READINT32(save->p);
|
ht->destlevel = READINT32(save->p);
|
||||||
ht->speed = READINT32(save->p);
|
ht->speed = READINT32(save->p);
|
||||||
@@ -2512,7 +2512,7 @@ FUNCINLINE static ATTRINLINE void LoadLightlevelThinker(savebuffer_t *save, acti
|
|||||||
static inline void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
executor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
executor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->line = LoadLine(READUINT32(save->p));
|
ht->line = LoadLine(READUINT32(save->p));
|
||||||
ht->caller = LoadMobj(READUINT32(save->p));
|
ht->caller = LoadMobj(READUINT32(save->p));
|
||||||
ht->sector = LoadSector(READUINT32(save->p));
|
ht->sector = LoadSector(READUINT32(save->p));
|
||||||
@@ -2528,7 +2528,7 @@ static inline void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static inline void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
disappear_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
disappear_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->appeartime = READUINT32(save->p);
|
ht->appeartime = READUINT32(save->p);
|
||||||
ht->disappeartime = READUINT32(save->p);
|
ht->disappeartime = READUINT32(save->p);
|
||||||
ht->offset = READUINT32(save->p);
|
ht->offset = READUINT32(save->p);
|
||||||
@@ -2547,7 +2547,7 @@ static inline void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static inline void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyrotate_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
polyrotate_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->polyObjNum = READINT32(save->p);
|
ht->polyObjNum = READINT32(save->p);
|
||||||
ht->speed = READINT32(save->p);
|
ht->speed = READINT32(save->p);
|
||||||
ht->distance = READINT32(save->p);
|
ht->distance = READINT32(save->p);
|
||||||
@@ -2563,7 +2563,7 @@ static inline void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker
|
|||||||
static void LoadPolymoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
static void LoadPolymoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polymove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
polymove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->polyObjNum = READINT32(save->p);
|
ht->polyObjNum = READINT32(save->p);
|
||||||
ht->speed = READINT32(save->p);
|
ht->speed = READINT32(save->p);
|
||||||
ht->momx = READFIXED(save->p);
|
ht->momx = READFIXED(save->p);
|
||||||
@@ -2581,7 +2581,7 @@ static void LoadPolymoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polywaypoint_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
polywaypoint_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->polyObjNum = READINT32(save->p);
|
ht->polyObjNum = READINT32(save->p);
|
||||||
ht->speed = READINT32(save->p);
|
ht->speed = READINT32(save->p);
|
||||||
ht->sequence = READINT32(save->p);
|
ht->sequence = READINT32(save->p);
|
||||||
@@ -2605,7 +2605,7 @@ static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinke
|
|||||||
static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyslidedoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
polyslidedoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->polyObjNum = READINT32(save->p);
|
ht->polyObjNum = READINT32(save->p);
|
||||||
ht->delay = READINT32(save->p);
|
ht->delay = READINT32(save->p);
|
||||||
ht->delayCount = READINT32(save->p);
|
ht->delayCount = READINT32(save->p);
|
||||||
@@ -2630,7 +2630,7 @@ static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyswingdoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
polyswingdoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->polyObjNum = READINT32(save->p);
|
ht->polyObjNum = READINT32(save->p);
|
||||||
ht->delay = READINT32(save->p);
|
ht->delay = READINT32(save->p);
|
||||||
ht->delayCount = READINT32(save->p);
|
ht->delayCount = READINT32(save->p);
|
||||||
@@ -2650,7 +2650,7 @@ static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
static inline void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinker)
|
static inline void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polydisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
polydisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function = thinker;
|
||||||
ht->polyObjNum = READINT32(save->p);
|
ht->polyObjNum = READINT32(save->p);
|
||||||
ht->controlSector = LoadSector(READUINT32(save->p));
|
ht->controlSector = LoadSector(READUINT32(save->p));
|
||||||
ht->dx = READFIXED(save->p);
|
ht->dx = READFIXED(save->p);
|
||||||
@@ -2680,7 +2680,7 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
|||||||
{
|
{
|
||||||
next = currentthinker->next;
|
next = currentthinker->next;
|
||||||
|
|
||||||
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
if (currentthinker->function == (actionf_p1)P_MobjThinker)
|
||||||
P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it
|
P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2874,7 +2874,7 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
|||||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||||
currentthinker = currentthinker->next)
|
currentthinker = currentthinker->next)
|
||||||
{
|
{
|
||||||
if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay)
|
if (currentthinker->function != (actionf_p1)T_ExecutorDelay)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
delay = (void *)currentthinker;
|
delay = (void *)currentthinker;
|
||||||
@@ -2989,7 +2989,7 @@ static inline void P_FinishMobjs(void)
|
|||||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||||
currentthinker = currentthinker->next)
|
currentthinker = currentthinker->next)
|
||||||
{
|
{
|
||||||
if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (currentthinker->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mobj = (mobj_t *)currentthinker;
|
mobj = (mobj_t *)currentthinker;
|
||||||
@@ -3014,7 +3014,7 @@ static void P_RelinkPointers(void)
|
|||||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||||
currentthinker = currentthinker->next)
|
currentthinker = currentthinker->next)
|
||||||
{
|
{
|
||||||
if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (currentthinker->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mobj = (mobj_t *)currentthinker;
|
mobj = (mobj_t *)currentthinker;
|
||||||
@@ -3431,7 +3431,7 @@ void P_SaveNetGame(savebuffer_t *save, boolean resending)
|
|||||||
{
|
{
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mobj = (mobj_t *)th;
|
mobj = (mobj_t *)th;
|
||||||
|
|||||||
+20
-14
@@ -34,6 +34,7 @@
|
|||||||
#include "r_fps.h" // R_ResetViewInterpolation in level load
|
#include "r_fps.h" // R_ResetViewInterpolation in level load
|
||||||
|
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
|
#include "m_emotes.h"
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
@@ -411,7 +412,7 @@ static inline float P_SegLengthFloat(seg_t *seg)
|
|||||||
dx = FIXED_TO_FLOAT(seg->v2->x - seg->v1->x);
|
dx = FIXED_TO_FLOAT(seg->v2->x - seg->v1->x);
|
||||||
dy = FIXED_TO_FLOAT(seg->v2->y - seg->v1->y);
|
dy = FIXED_TO_FLOAT(seg->v2->y - seg->v1->y);
|
||||||
|
|
||||||
return (float)hypot(dx, dy);
|
return hypotf(dx, dy);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2344,9 +2345,7 @@ static void P_RunLevelScript(const char *scriptname)
|
|||||||
lumpnum_t lumpnum;
|
lumpnum_t lumpnum;
|
||||||
char newname[9];
|
char newname[9];
|
||||||
|
|
||||||
strncpy(newname, scriptname, 8);
|
strlcpy(newname, scriptname, sizeof(newname));
|
||||||
|
|
||||||
newname[8] = '\0';
|
|
||||||
|
|
||||||
lumpnum = W_CheckNumForName(newname);
|
lumpnum = W_CheckNumForName(newname);
|
||||||
|
|
||||||
@@ -2572,6 +2571,7 @@ static void P_InitMinimapInfo(void)
|
|||||||
lumpnum_t lumpnum;
|
lumpnum_t lumpnum;
|
||||||
fixed_t a;
|
fixed_t a;
|
||||||
fixed_t b;
|
fixed_t b;
|
||||||
|
|
||||||
node_t *bsp = &nodes[numnodes-1];
|
node_t *bsp = &nodes[numnodes-1];
|
||||||
|
|
||||||
minimapinfo.minimap_pic = NULL;
|
minimapinfo.minimap_pic = NULL;
|
||||||
@@ -3008,9 +3008,8 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||||
if (rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
HWR_FreeExtraSubsectors();
|
|
||||||
// Create plane polygons.
|
// Create plane polygons.
|
||||||
HWR_LoadLevel(reloadinggamestate);
|
HWR_LoadLevel();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3313,6 +3312,12 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
|||||||
if (!mapsadded)
|
if (!mapsadded)
|
||||||
CONS_Printf(M_GetText("No maps added\n"));
|
CONS_Printf(M_GetText("No maps added\n"));
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
// Free GPU textures before freeing patches.
|
||||||
|
if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED))
|
||||||
|
HWR_ClearAllTextures();
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// search for sprite replacements
|
// search for sprite replacements
|
||||||
//
|
//
|
||||||
@@ -3323,7 +3328,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
|||||||
// Reload it all anyway, just in case they
|
// Reload it all anyway, just in case they
|
||||||
// added some textures but didn't insert a
|
// added some textures but didn't insert a
|
||||||
// TEXTURES/etc. list.
|
// TEXTURES/etc. list.
|
||||||
//R_LoadTexturesPwad(wadnum);
|
R_LoadTexturesPwad(wadnum);
|
||||||
|
|
||||||
// everything from MultiSetupWadFile until ST_Start was here originally
|
// everything from MultiSetupWadFile until ST_Start was here originally
|
||||||
|
|
||||||
@@ -3337,6 +3342,11 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
|||||||
//
|
//
|
||||||
S_LoadMusicDefs(wadnum);
|
S_LoadMusicDefs(wadnum);
|
||||||
|
|
||||||
|
//
|
||||||
|
// look for emotes
|
||||||
|
//
|
||||||
|
M_LoadEmotes(wadnum);
|
||||||
|
|
||||||
// TODO: Experimental SPRTINFO support, test first
|
// TODO: Experimental SPRTINFO support, test first
|
||||||
R_LoadSpriteInfoLumps(wadnum, wadfiles[wadnum]->numlumps);
|
R_LoadSpriteInfoLumps(wadnum, wadfiles[wadnum]->numlumps);
|
||||||
|
|
||||||
@@ -3347,7 +3357,8 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
|||||||
|
|
||||||
// Only exists to make sure there's no way to overwrite partadd_stage externally
|
// Only exists to make sure there's no way to overwrite partadd_stage externally
|
||||||
// unless you really push yourself.
|
// unless you really push yourself.
|
||||||
SINT8 P_PartialAddGetStage(void) {
|
SINT8 P_PartialAddGetStage(void)
|
||||||
|
{
|
||||||
return partadd_stage;
|
return partadd_stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3381,13 +3392,8 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
|
|||||||
|
|
||||||
if (partadd_stage == 1)
|
if (partadd_stage == 1)
|
||||||
{
|
{
|
||||||
#ifdef HWRENDER
|
|
||||||
// Free GPU textures before freeing patches.
|
|
||||||
if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED))
|
|
||||||
HWR_ClearAllTextures();
|
|
||||||
#endif
|
|
||||||
// Reload all textures, unconditionally for better or worse.
|
// Reload all textures, unconditionally for better or worse.
|
||||||
R_LoadTextures();
|
//R_LoadTextures();
|
||||||
|
|
||||||
if (fullsetup)
|
if (fullsetup)
|
||||||
++partadd_stage;
|
++partadd_stage;
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ void P_SetupLevelSky(INT32 skynum, boolean global);
|
|||||||
boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate);
|
boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate);
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
void HWR_LoadLevel(boolean reloadinggamestate);
|
void HWR_LoadLevel(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
||||||
|
|||||||
+37
-36
@@ -1302,7 +1302,7 @@ static void P_AddExecutorDelay(line_t *line, mobj_t *mobj, sector_t *sector)
|
|||||||
|
|
||||||
e = Z_Calloc(sizeof (*e), PU_LEVSPEC, NULL);
|
e = Z_Calloc(sizeof (*e), PU_LEVSPEC, NULL);
|
||||||
|
|
||||||
e->thinker.function.acp1 = (actionf_p1)T_ExecutorDelay;
|
e->thinker.function = (actionf_p1)T_ExecutorDelay;
|
||||||
e->line = line;
|
e->line = line;
|
||||||
e->sector = sector;
|
e->sector = sector;
|
||||||
e->timer = (line->backsector->ceilingheight>>FRACBITS)+(line->backsector->floorheight>>FRACBITS);
|
e->timer = (line->backsector->ceilingheight>>FRACBITS)+(line->backsector->floorheight>>FRACBITS);
|
||||||
@@ -2602,7 +2602,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)T_Scroll)
|
if (th->function != (actionf_p1)T_Scroll)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
scroller = (scroll_t *)th;
|
scroller = (scroll_t *)th;
|
||||||
@@ -2937,7 +2937,7 @@ void P_SetupSignExit(player_t *player)
|
|||||||
// spin all signposts in the level then.
|
// spin all signposts in the level then.
|
||||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||||
{
|
{
|
||||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (think->function != (actionf_p1)P_MobjThinker)
|
||||||
continue; // not a mobj thinker
|
continue; // not a mobj thinker
|
||||||
|
|
||||||
thing = (mobj_t *)think;
|
thing = (mobj_t *)think;
|
||||||
@@ -2986,7 +2986,7 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
|
|||||||
|
|
||||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||||
{
|
{
|
||||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (think->function != (actionf_p1)P_MobjThinker)
|
||||||
continue; // not a mobj thinker
|
continue; // not a mobj thinker
|
||||||
|
|
||||||
mo = (mobj_t *)think;
|
mo = (mobj_t *)think;
|
||||||
@@ -3419,7 +3419,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
|||||||
// The chimps are my friends.. heeheeheheehehee..... - LouisJM
|
// The chimps are my friends.. heeheeheheehehee..... - LouisJM
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -3760,7 +3760,7 @@ DoneSection2:
|
|||||||
// to find the first waypoint
|
// to find the first waypoint
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -3833,7 +3833,7 @@ DoneSection2:
|
|||||||
// to find the last waypoint
|
// to find the last waypoint
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -3889,6 +3889,7 @@ DoneSection2:
|
|||||||
{
|
{
|
||||||
if (!playeringame[i] || players[i].spectator)
|
if (!playeringame[i] || players[i].spectator)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nump++;
|
nump++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3912,7 +3913,7 @@ DoneSection2:
|
|||||||
|
|
||||||
player->kartstuff[k_lapanimation] = 80;
|
player->kartstuff[k_lapanimation] = 80;
|
||||||
|
|
||||||
if (player->pflags & PF_NIGHTSMODE)
|
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
|
||||||
player->drillmeter += 48*20;
|
player->drillmeter += 48*20;
|
||||||
|
|
||||||
if (netgame && player->laps >= (UINT8)cv_numlaps.value)
|
if (netgame && player->laps >= (UINT8)cv_numlaps.value)
|
||||||
@@ -4044,7 +4045,7 @@ DoneSection2:
|
|||||||
// to find the first waypoint
|
// to find the first waypoint
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -4082,7 +4083,7 @@ DoneSection2:
|
|||||||
// Find waypoint before this one (waypointlow)
|
// Find waypoint before this one (waypointlow)
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -4109,7 +4110,7 @@ DoneSection2:
|
|||||||
// Find waypoint after this one (waypointhigh)
|
// Find waypoint after this one (waypointhigh)
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -4799,7 +4800,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Should this FOF have spikeness?
|
// Should this FOF have spikeness?
|
||||||
if (th->function.acp1 == (actionf_p1)T_SpikeSector)
|
if (th->function == (actionf_p1)T_SpikeSector)
|
||||||
{
|
{
|
||||||
lst = (levelspecthink_t *)th;
|
lst = (levelspecthink_t *)th;
|
||||||
|
|
||||||
@@ -4807,7 +4808,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||||||
P_AddSpikeThinker(sec, (INT32)sec2num);
|
P_AddSpikeThinker(sec, (INT32)sec2num);
|
||||||
}
|
}
|
||||||
// Should this FOF have friction?
|
// Should this FOF have friction?
|
||||||
else if(th->function.acp1 == (actionf_p1)T_Friction)
|
else if(th->function == (actionf_p1)T_Friction)
|
||||||
{
|
{
|
||||||
f = (friction_t *)th;
|
f = (friction_t *)th;
|
||||||
|
|
||||||
@@ -4815,7 +4816,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||||||
Add_Friction(f->friction, f->movefactor, (INT32)(sec-sectors), f->affectee);
|
Add_Friction(f->friction, f->movefactor, (INT32)(sec-sectors), f->affectee);
|
||||||
}
|
}
|
||||||
// Should this FOF have wind/current/pusher?
|
// Should this FOF have wind/current/pusher?
|
||||||
else if(th->function.acp1 == (actionf_p1)T_Pusher)
|
else if(th->function == (actionf_p1)T_Pusher)
|
||||||
{
|
{
|
||||||
p = (pusher_t *)th;
|
p = (pusher_t *)th;
|
||||||
|
|
||||||
@@ -4906,7 +4907,7 @@ static void P_AddSpikeThinker(sector_t *sec, INT32 referrer)
|
|||||||
spikes = Z_Calloc(sizeof (*spikes), PU_LEVSPEC, NULL);
|
spikes = Z_Calloc(sizeof (*spikes), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&spikes->thinker);
|
P_AddThinker(&spikes->thinker);
|
||||||
|
|
||||||
spikes->thinker.function.acp1 = (actionf_p1)T_SpikeSector;
|
spikes->thinker.function = (actionf_p1)T_SpikeSector;
|
||||||
|
|
||||||
spikes->sector = sec;
|
spikes->sector = sec;
|
||||||
spikes->vars[0] = referrer;
|
spikes->vars[0] = referrer;
|
||||||
@@ -4928,7 +4929,7 @@ static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline)
|
|||||||
floater = Z_Calloc(sizeof (*floater), PU_LEVSPEC, NULL);
|
floater = Z_Calloc(sizeof (*floater), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&floater->thinker);
|
P_AddThinker(&floater->thinker);
|
||||||
|
|
||||||
floater->thinker.function.acp1 = (actionf_p1)T_FloatSector;
|
floater->thinker.function = (actionf_p1)T_FloatSector;
|
||||||
|
|
||||||
floater->sector = sec;
|
floater->sector = sec;
|
||||||
floater->vars[0] = tag;
|
floater->vars[0] = tag;
|
||||||
@@ -4957,7 +4958,7 @@ static void P_AddBlockThinker(sector_t *sec, line_t *sourceline)
|
|||||||
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&block->thinker);
|
P_AddThinker(&block->thinker);
|
||||||
|
|
||||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlockChecker;
|
block->thinker.function = (actionf_p1)T_MarioBlockChecker;
|
||||||
block->sourceline = sourceline;
|
block->sourceline = sourceline;
|
||||||
|
|
||||||
block->sector = sec;
|
block->sector = sec;
|
||||||
@@ -4986,7 +4987,7 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline)
|
|||||||
raise = Z_Calloc(sizeof (*raise), PU_LEVSPEC, NULL);
|
raise = Z_Calloc(sizeof (*raise), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&raise->thinker);
|
P_AddThinker(&raise->thinker);
|
||||||
|
|
||||||
raise->thinker.function.acp1 = (actionf_p1)T_RaiseSector;
|
raise->thinker.function = (actionf_p1)T_RaiseSector;
|
||||||
|
|
||||||
if (sourceline->flags & ML_BLOCKMONSTERS)
|
if (sourceline->flags & ML_BLOCKMONSTERS)
|
||||||
raise->vars[0] = 1;
|
raise->vars[0] = 1;
|
||||||
@@ -5029,7 +5030,7 @@ static void P_AddOldAirbob(sector_t *sec, line_t *sourceline, boolean noadjust)
|
|||||||
airbob = Z_Calloc(sizeof (*airbob), PU_LEVSPEC, NULL);
|
airbob = Z_Calloc(sizeof (*airbob), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&airbob->thinker);
|
P_AddThinker(&airbob->thinker);
|
||||||
|
|
||||||
airbob->thinker.function.acp1 = (actionf_p1)T_RaiseSector;
|
airbob->thinker.function = (actionf_p1)T_RaiseSector;
|
||||||
|
|
||||||
// set up the fields
|
// set up the fields
|
||||||
airbob->sector = sec;
|
airbob->sector = sec;
|
||||||
@@ -5094,7 +5095,7 @@ static inline void P_AddThwompThinker(sector_t *sec, sector_t *actionsector, lin
|
|||||||
thwomp = Z_Calloc(sizeof (*thwomp), PU_LEVSPEC, NULL);
|
thwomp = Z_Calloc(sizeof (*thwomp), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&thwomp->thinker);
|
P_AddThinker(&thwomp->thinker);
|
||||||
|
|
||||||
thwomp->thinker.function.acp1 = (actionf_p1)T_ThwompSector;
|
thwomp->thinker.function = (actionf_p1)T_ThwompSector;
|
||||||
|
|
||||||
// set up the fields according to the type of elevator action
|
// set up the fields according to the type of elevator action
|
||||||
thwomp->sector = sec;
|
thwomp->sector = sec;
|
||||||
@@ -5135,7 +5136,7 @@ static inline void P_AddNoEnemiesThinker(sector_t *sec, line_t *sourceline)
|
|||||||
nobaddies = Z_Calloc(sizeof (*nobaddies), PU_LEVSPEC, NULL);
|
nobaddies = Z_Calloc(sizeof (*nobaddies), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&nobaddies->thinker);
|
P_AddThinker(&nobaddies->thinker);
|
||||||
|
|
||||||
nobaddies->thinker.function.acp1 = (actionf_p1)T_NoEnemiesSector;
|
nobaddies->thinker.function = (actionf_p1)T_NoEnemiesSector;
|
||||||
|
|
||||||
nobaddies->sector = sec;
|
nobaddies->sector = sec;
|
||||||
nobaddies->sourceline = sourceline;
|
nobaddies->sourceline = sourceline;
|
||||||
@@ -5157,7 +5158,7 @@ static inline void P_AddEachTimeThinker(sector_t *sec, line_t *sourceline)
|
|||||||
eachtime = Z_Calloc(sizeof (*eachtime), PU_LEVSPEC, NULL);
|
eachtime = Z_Calloc(sizeof (*eachtime), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&eachtime->thinker);
|
P_AddThinker(&eachtime->thinker);
|
||||||
|
|
||||||
eachtime->thinker.function.acp1 = (actionf_p1)T_EachTimeThinker;
|
eachtime->thinker.function = (actionf_p1)T_EachTimeThinker;
|
||||||
|
|
||||||
eachtime->sector = sec;
|
eachtime->sector = sec;
|
||||||
eachtime->sourceline = sourceline;
|
eachtime->sourceline = sourceline;
|
||||||
@@ -5179,7 +5180,7 @@ static inline void P_AddCameraScanner(sector_t *sourcesec, sector_t *actionsecto
|
|||||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||||
P_AddThinker(&elevator->thinker);
|
P_AddThinker(&elevator->thinker);
|
||||||
|
|
||||||
elevator->thinker.function.acp1 = (actionf_p1)T_CameraScanner;
|
elevator->thinker.function = (actionf_p1)T_CameraScanner;
|
||||||
elevator->type = elevateBounce;
|
elevator->type = elevateBounce;
|
||||||
|
|
||||||
// set up the fields according to the type of elevator action
|
// set up the fields according to the type of elevator action
|
||||||
@@ -5268,7 +5269,7 @@ static inline void EV_AddLaserThinker(sector_t *sec, sector_t *sec2, line_t *lin
|
|||||||
|
|
||||||
P_AddThinker(&flash->thinker);
|
P_AddThinker(&flash->thinker);
|
||||||
|
|
||||||
flash->thinker.function.acp1 = (actionf_p1)T_LaserFlash;
|
flash->thinker.function = (actionf_p1)T_LaserFlash;
|
||||||
flash->ffloor = ffloor;
|
flash->ffloor = ffloor;
|
||||||
flash->sector = sec; // For finding mobjs
|
flash->sector = sec; // For finding mobjs
|
||||||
flash->sec = sec2;
|
flash->sec = sec2;
|
||||||
@@ -5382,11 +5383,11 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
|||||||
// Firstly, find out how many there are in each sector
|
// Firstly, find out how many there are in each sector
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 == (actionf_p1)T_SpikeSector)
|
if (th->function == (actionf_p1)T_SpikeSector)
|
||||||
secthinkers[((levelspecthink_t *)th)->sector - sectors].count++;
|
secthinkers[((levelspecthink_t *)th)->sector - sectors].count++;
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Friction)
|
else if (th->function == (actionf_p1)T_Friction)
|
||||||
secthinkers[((friction_t *)th)->affectee].count++;
|
secthinkers[((friction_t *)th)->affectee].count++;
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Pusher)
|
else if (th->function == (actionf_p1)T_Pusher)
|
||||||
secthinkers[((pusher_t *)th)->affectee].count++;
|
secthinkers[((pusher_t *)th)->affectee].count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5404,11 +5405,11 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
|||||||
{
|
{
|
||||||
size_t secnum = (size_t)-1;
|
size_t secnum = (size_t)-1;
|
||||||
|
|
||||||
if (th->function.acp1 == (actionf_p1)T_SpikeSector)
|
if (th->function == (actionf_p1)T_SpikeSector)
|
||||||
secnum = ((levelspecthink_t *)th)->sector - sectors;
|
secnum = ((levelspecthink_t *)th)->sector - sectors;
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Friction)
|
else if (th->function == (actionf_p1)T_Friction)
|
||||||
secnum = ((friction_t *)th)->affectee;
|
secnum = ((friction_t *)th)->affectee;
|
||||||
else if (th->function.acp1 == (actionf_p1)T_Pusher)
|
else if (th->function == (actionf_p1)T_Pusher)
|
||||||
secnum = ((pusher_t *)th)->affectee;
|
secnum = ((pusher_t *)th)->affectee;
|
||||||
|
|
||||||
if (secnum != (size_t)-1)
|
if (secnum != (size_t)-1)
|
||||||
@@ -6632,7 +6633,7 @@ void T_Scroll(scroll_t *s)
|
|||||||
static void Add_Scroller(INT32 type, fixed_t dx, fixed_t dy, INT32 control, INT32 affectee, INT32 accel, INT32 exclusive)
|
static void Add_Scroller(INT32 type, fixed_t dx, fixed_t dy, INT32 control, INT32 affectee, INT32 accel, INT32 exclusive)
|
||||||
{
|
{
|
||||||
scroll_t *s = Z_Calloc(sizeof *s, PU_LEVSPEC, NULL);
|
scroll_t *s = Z_Calloc(sizeof *s, PU_LEVSPEC, NULL);
|
||||||
s->thinker.function.acp1 = (actionf_p1)T_Scroll;
|
s->thinker.function = (actionf_p1)T_Scroll;
|
||||||
s->type = type;
|
s->type = type;
|
||||||
s->dx = dx;
|
s->dx = dx;
|
||||||
s->dy = dy;
|
s->dy = dy;
|
||||||
@@ -6802,7 +6803,7 @@ static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t o
|
|||||||
{
|
{
|
||||||
disappear_t *d = Z_Malloc(sizeof *d, PU_LEVSPEC, NULL);
|
disappear_t *d = Z_Malloc(sizeof *d, PU_LEVSPEC, NULL);
|
||||||
|
|
||||||
d->thinker.function.acp1 = (actionf_p1)T_Disappear;
|
d->thinker.function = (actionf_p1)T_Disappear;
|
||||||
d->appeartime = appeartime;
|
d->appeartime = appeartime;
|
||||||
d->disappeartime = disappeartime;
|
d->disappeartime = disappeartime;
|
||||||
d->offset = offset;
|
d->offset = offset;
|
||||||
@@ -6887,7 +6888,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32
|
|||||||
{
|
{
|
||||||
friction_t *f = Z_Calloc(sizeof *f, PU_LEVSPEC, NULL);
|
friction_t *f = Z_Calloc(sizeof *f, PU_LEVSPEC, NULL);
|
||||||
|
|
||||||
f->thinker.function.acp1 = (actionf_p1)T_Friction;
|
f->thinker.function = (actionf_p1)T_Friction;
|
||||||
f->friction = friction;
|
f->friction = friction;
|
||||||
f->movefactor = movefactor;
|
f->movefactor = movefactor;
|
||||||
f->affectee = affectee;
|
f->affectee = affectee;
|
||||||
@@ -7042,7 +7043,7 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *
|
|||||||
{
|
{
|
||||||
pusher_t *p = Z_Calloc(sizeof *p, PU_LEVSPEC, NULL);
|
pusher_t *p = Z_Calloc(sizeof *p, PU_LEVSPEC, NULL);
|
||||||
|
|
||||||
p->thinker.function.acp1 = (actionf_p1)T_Pusher;
|
p->thinker.function = (actionf_p1)T_Pusher;
|
||||||
p->source = source;
|
p->source = source;
|
||||||
p->type = type;
|
p->type = type;
|
||||||
p->x_mag = x_mag>>FRACBITS;
|
p->x_mag = x_mag>>FRACBITS;
|
||||||
@@ -7102,7 +7103,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Allow this to affect pushable objects at some point?
|
// Allow this to affect pushable objects at some point?
|
||||||
if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || thing->player->pflags & PF_NIGHTSMODE))
|
if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || UNLIKELY(thing->player->pflags & PF_NIGHTSMODE)))
|
||||||
{
|
{
|
||||||
INT32 dist;
|
INT32 dist;
|
||||||
INT32 speed;
|
INT32 speed;
|
||||||
@@ -7133,7 +7134,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
|
|||||||
// Written with bits and pieces of P_HomingAttack
|
// Written with bits and pieces of P_HomingAttack
|
||||||
if ((speed > 0) && (P_CheckSight(thing, tmpusher->source)))
|
if ((speed > 0) && (P_CheckSight(thing, tmpusher->source)))
|
||||||
{
|
{
|
||||||
if (!(thing->player->pflags & PF_NIGHTSMODE))
|
if (LIKELY(!(thing->player->pflags & PF_NIGHTSMODE)))
|
||||||
{
|
{
|
||||||
// only push wrt Z if health & 1 (mapthing has ambush flag)
|
// only push wrt Z if health & 1 (mapthing has ambush flag)
|
||||||
if (tmpusher->source->health & 1)
|
if (tmpusher->source->health & 1)
|
||||||
|
|||||||
+61
-37
@@ -115,7 +115,7 @@ void Command_Numthinkers_f(void)
|
|||||||
|
|
||||||
for (think = listtype->next; think != listtype; think = think->next)
|
for (think = listtype->next; think != listtype; think = think->next)
|
||||||
{
|
{
|
||||||
if (think->function.acp1 != action)
|
if (think->function != action)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
@@ -152,7 +152,7 @@ void Command_CountMobjs_f(void)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (((mobj_t *)th)->type == i)
|
if (((mobj_t *)th)->type == i)
|
||||||
@@ -172,7 +172,7 @@ void Command_CountMobjs_f(void)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (((mobj_t *)th)->type == i)
|
if (((mobj_t *)th)->type == i)
|
||||||
@@ -190,7 +190,7 @@ void Command_CountMobjs_f(void)
|
|||||||
void P_InitThinkers(void)
|
void P_InitThinkers(void)
|
||||||
{
|
{
|
||||||
thinkercap.prev = thinkercap.next = &thinkercap;
|
thinkercap.prev = thinkercap.next = &thinkercap;
|
||||||
precipcap.prev = precipcap.next = &precipcap;
|
precipcap.prev = precipcap.next = &precipcap;
|
||||||
waypointcap = NULL;
|
waypointcap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ void P_AddThinker(thinker_t *thinker)
|
|||||||
|
|
||||||
thinker->references = 0; // killough 11/98: init reference counter to 0
|
thinker->references = 0; // killough 11/98: init reference counter to 0
|
||||||
|
|
||||||
thinker->cachable = (thinker->function.acp1 == (actionf_p1)P_MobjThinker);
|
thinker->cachable = (thinker->function == (actionf_p1)P_MobjThinker);
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
thinker->debug_mobjtype = MT_NULL;
|
thinker->debug_mobjtype = MT_NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -235,7 +235,7 @@ void P_AddPrecipThinker(thinker_t *thinker)
|
|||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
static const char *MobjTypeName(const mobj_t *mobj)
|
static const char *MobjTypeName(const mobj_t *mobj)
|
||||||
{
|
{
|
||||||
actionf_p1 p1 = mobj->thinker.function.acp1;
|
actionf_p1 p1 = mobj->thinker.function;
|
||||||
|
|
||||||
if (p1 == (actionf_p1)P_MobjThinker)
|
if (p1 == (actionf_p1)P_MobjThinker)
|
||||||
{
|
{
|
||||||
@@ -254,7 +254,7 @@ static const char *MobjTypeName(const mobj_t *mobj)
|
|||||||
|
|
||||||
static const char *MobjThinkerName(const mobj_t *mobj)
|
static const char *MobjThinkerName(const mobj_t *mobj)
|
||||||
{
|
{
|
||||||
actionf_p1 p1 = mobj->thinker.function.acp1;
|
actionf_p1 p1 = mobj->thinker.function;
|
||||||
|
|
||||||
if (p1 == (actionf_p1)P_MobjThinker)
|
if (p1 == (actionf_p1)P_MobjThinker)
|
||||||
{
|
{
|
||||||
@@ -371,7 +371,7 @@ void P_UnlinkThinker(thinker_t *thinker)
|
|||||||
void P_RemoveThinker(thinker_t *thinker)
|
void P_RemoveThinker(thinker_t *thinker)
|
||||||
{
|
{
|
||||||
LUA_InvalidateUserdata(thinker);
|
LUA_InvalidateUserdata(thinker);
|
||||||
thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed;
|
thinker->function = (actionf_p1)P_RemoveThinkerDelayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -455,12 +455,15 @@ static inline void P_RunThinkers(void)
|
|||||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = currentthinker->next)
|
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = currentthinker->next)
|
||||||
{
|
{
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
I_Assert(currentthinker->function.acp1 != NULL);
|
I_Assert(currentthinker->function != NULL);
|
||||||
#endif
|
#endif
|
||||||
currentthinker->function.acp1(currentthinker);
|
currentthinker->function(currentthinker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Controller rumble!
|
||||||
|
// this keeps track of a bunch of things
|
||||||
|
// and makes your controller rumble accordingly
|
||||||
static void P_DeviceRumbleTick(void)
|
static void P_DeviceRumbleTick(void)
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
@@ -472,27 +475,31 @@ static void P_DeviceRumbleTick(void)
|
|||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
for (i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
UINT16 low = 0;
|
|
||||||
UINT16 high = 0;
|
|
||||||
|
|
||||||
if (!cv_usejoystick[i].value || !cv_rumble[i].value)
|
if (!cv_usejoystick[i].value || !cv_rumble[i].value)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
player_t *player = ((i == 0) ? &players[consoleplayer] : &players[displayplayers[i]]);
|
|
||||||
|
|
||||||
if (player->spectator || !player->mo)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (camera[i].freecam)
|
if (camera[i].freecam)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->exiting)
|
UINT16 low = 0, high = 0;
|
||||||
|
UINT16 lenght = 57; // in ms
|
||||||
|
|
||||||
|
const player_t *player = ((i == 0) ? &players[consoleplayer] : &players[displayplayers[i]]);
|
||||||
|
|
||||||
|
// allow lua to do some crap for spectators
|
||||||
|
if (player->spectator || !player->mo)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset the rumble if you exit or are ded lel
|
||||||
|
if (player->exiting ||
|
||||||
|
player->playerstate == PST_DEAD ||
|
||||||
|
player->kartstuff[k_respawn] > 1)
|
||||||
{
|
{
|
||||||
G_PlayerDeviceRumble(i, low, high, 0);
|
G_PlayerDeviceRumble(i, low, high, 0);
|
||||||
continue;
|
continue;
|
||||||
@@ -501,15 +508,17 @@ static void P_DeviceRumbleTick(void)
|
|||||||
if (player->kartstuff[k_spinouttimer])
|
if (player->kartstuff[k_spinouttimer])
|
||||||
{
|
{
|
||||||
//low = high = FRACUNIT / 6;
|
//low = high = FRACUNIT / 6;
|
||||||
low = high = FixedMul((FRACUNIT / 4), (FixedDiv(player->kartstuff[k_spinouttimer], (3*TICRATE / 2))));
|
low = high = FixedMul((FRACUNIT / 4), (FixedDiv(player->kartstuff[k_spinouttimer], (3*TICRATE / 2)))); // try do some some kinda fadeout
|
||||||
}
|
}
|
||||||
else if (player->kartstuff[k_sneakertimer] > (sneakertime-(TICRATE/2)))
|
else if (player->kartstuff[k_sneakertimer] > (sneakertime-(TICRATE/2)))
|
||||||
{
|
{
|
||||||
low = high = FRACUNIT / 8;
|
low = high = FRACUNIT / 8;
|
||||||
}
|
}
|
||||||
else if ((player->kartstuff[k_offroad])
|
else if ((player->kartstuff[k_offroad])
|
||||||
&& P_IsObjectOnGround(player->mo) && player->speed != 0)
|
&& player->speed != 0
|
||||||
|
&& P_IsObjectOnGround(player->mo))
|
||||||
{
|
{
|
||||||
|
// weaken this depending on if you got hyu or invinc
|
||||||
if (player->kartstuff[k_hyudorotimer])
|
if (player->kartstuff[k_hyudorotimer])
|
||||||
{
|
{
|
||||||
high = FRACUNIT / 128;
|
high = FRACUNIT / 128;
|
||||||
@@ -524,7 +533,8 @@ static void P_DeviceRumbleTick(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((player->kartstuff[k_bananadrag] > TICRATE)
|
else if ((player->kartstuff[k_bananadrag] > TICRATE)
|
||||||
&& P_IsObjectOnGround(player->mo) && player->speed != 0)
|
&& player->speed != 0
|
||||||
|
&& P_IsObjectOnGround(player->mo))
|
||||||
{
|
{
|
||||||
if (leveltime & 1) // this is actually funny lel
|
if (leveltime & 1) // this is actually funny lel
|
||||||
high = FRACUNIT / 64;
|
high = FRACUNIT / 64;
|
||||||
@@ -541,7 +551,7 @@ static void P_DeviceRumbleTick(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_PlayerDeviceRumble(i, low, high, 57);
|
G_PlayerDeviceRumble(i, low, high, lenght);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,7 +566,11 @@ void P_RunChaseCameras(void)
|
|||||||
player_t *p = &players[displayplayers[i]];
|
player_t *p = &players[displayplayers[i]];
|
||||||
camera_t *cam = &camera[i];
|
camera_t *cam = &camera[i];
|
||||||
|
|
||||||
if (cv_verticallook[i].value && leveltime > starttime && p->mo && p->kartstuff[k_respawn] == 0 && p->kartstuff[k_throwdir] != 0)
|
if (cv_verticallook[i].value &&
|
||||||
|
leveltime > starttime
|
||||||
|
&& p->mo
|
||||||
|
&& p->kartstuff[k_respawn] == 0
|
||||||
|
&& p->kartstuff[k_throwdir] != 0)
|
||||||
{
|
{
|
||||||
if (p->speed < 6 * p->mo->scale && abs(cam->dpad_y_held) < 2*TICRATE)
|
if (p->speed < 6 * p->mo->scale && abs(cam->dpad_y_held) < 2*TICRATE)
|
||||||
cam->dpad_y_held += p->kartstuff[k_throwdir];
|
cam->dpad_y_held += p->kartstuff[k_throwdir];
|
||||||
@@ -599,6 +613,11 @@ static void P_RunQuakes(void)
|
|||||||
--quake.time;
|
--quake.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset our Sprite scales and offsets
|
||||||
|
// at the start of our tic
|
||||||
|
// this is just to make things simpler
|
||||||
|
// as we dont have to reset it ourselves after use
|
||||||
|
// done at the start so lua can still overwrite everything
|
||||||
static inline void P_ResetSpriteStuff(void)
|
static inline void P_ResetSpriteStuff(void)
|
||||||
{
|
{
|
||||||
thinker_t *th;
|
thinker_t *th;
|
||||||
@@ -610,7 +629,7 @@ static inline void P_ResetSpriteStuff(void)
|
|||||||
{
|
{
|
||||||
mobj_t *mo;
|
mobj_t *mo;
|
||||||
|
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // not a mobj
|
if (th->function != (actionf_p1)P_MobjThinker) // not a mobj
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo = (mobj_t *)th;
|
mo = (mobj_t *)th;
|
||||||
@@ -734,8 +753,12 @@ void P_Ticker(boolean run)
|
|||||||
|
|
||||||
PS_START_TIMING(ps_playerthink_time);
|
PS_START_TIMING(ps_playerthink_time);
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
{
|
||||||
P_PlayerThink(&players[i]);
|
if (!playeringame[i] || P_MobjWasRemoved(players[i].mo))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
P_PlayerThink(&players[i]);
|
||||||
|
}
|
||||||
PS_STOP_TIMING(ps_playerthink_time);
|
PS_STOP_TIMING(ps_playerthink_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,8 +777,12 @@ void P_Ticker(boolean run)
|
|||||||
|
|
||||||
// Run any "after all the other thinkers" stuff
|
// Run any "after all the other thinkers" stuff
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
{
|
||||||
P_PlayerAfterThink(&players[i]);
|
if (!playeringame[i] || P_MobjWasRemoved(players[i].mo))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
P_PlayerAfterThink(&players[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply rumble to local players
|
// Apply rumble to local players
|
||||||
if (!demo.playback)
|
if (!demo.playback)
|
||||||
@@ -833,12 +860,12 @@ void P_Ticker(boolean run)
|
|||||||
|
|
||||||
if (demo.recording)
|
if (demo.recording)
|
||||||
{
|
{
|
||||||
INT32 axis = JoyAxis(AXISLOOKBACK, 1);
|
|
||||||
|
|
||||||
G_WriteAllGhostTics();
|
G_WriteAllGhostTics();
|
||||||
|
|
||||||
if (cv_recordmultiplayerdemos.value)
|
if (cv_recordmultiplayerdemos.value)
|
||||||
{
|
{
|
||||||
|
const INT32 axis = JoyAxis(AXISLOOKBACK, 1);
|
||||||
|
|
||||||
if (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE)
|
if (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE)
|
||||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||||
demo.savemode = DSM_TITLEENTRY;
|
demo.savemode = DSM_TITLEENTRY;
|
||||||
@@ -954,10 +981,7 @@ void P_PreTicker(INT32 frames)
|
|||||||
// Run any "after all the other thinkers" stuff
|
// Run any "after all the other thinkers" stuff
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (!playeringame[i])
|
if (!playeringame[i] || P_MobjWasRemoved(players[i].mo))
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!players[i].mo || P_MobjWasRemoved(players[i].mo))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
P_PlayerAfterThink(&players[i]);
|
P_PlayerAfterThink(&players[i]);
|
||||||
|
|||||||
+52
-46
@@ -73,7 +73,7 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
|
|||||||
|
|
||||||
mo->momx += FixedMul(move, FINECOSINE(angle));
|
mo->momx += FixedMul(move, FINECOSINE(angle));
|
||||||
|
|
||||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (mo->flags2 & MF2_TWOD))))
|
||||||
mo->momy += FixedMul(move, FINESINE(angle));
|
mo->momy += FixedMul(move, FINESINE(angle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move)
|
|||||||
|
|
||||||
mo->momx = FixedMul(move, FINECOSINE(angle));
|
mo->momx = FixedMul(move, FINECOSINE(angle));
|
||||||
|
|
||||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)))
|
if (LIKELY(!(twodlevel || (mo->flags2 & MF2_TWOD))))
|
||||||
mo->momy = FixedMul(move,FINESINE(angle));
|
mo->momy = FixedMul(move,FINESINE(angle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,9 +498,9 @@ void P_PlayLivesJingle(player_t *player)
|
|||||||
if (player && !P_IsLocalPlayer(player))
|
if (player && !P_IsLocalPlayer(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (use1upSound)
|
if (UNLIKELY(use1upSound))
|
||||||
S_StartSound(NULL, sfx_oneup);
|
S_StartSound(NULL, sfx_oneup);
|
||||||
else if (mariomode)
|
else if (UNLIKELY(mariomode))
|
||||||
S_StartSound(NULL, sfx_marioa);
|
S_StartSound(NULL, sfx_marioa);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -528,7 +528,7 @@ void P_PlayRinglossSound(mobj_t *source, mobj_t *damager)
|
|||||||
S_StartSound(NULL, sfx);
|
S_StartSound(NULL, sfx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S_StartSound(source, (mariomode) ? sfx_mario8 : sfx_khurt1 + key);
|
S_StartSound(source, UNLIKELY(mariomode) ? sfx_mario8 : sfx_khurt1 + key);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S_StartSound(source, sfx_slip);
|
S_StartSound(source, sfx_slip);
|
||||||
@@ -552,9 +552,13 @@ static UINT8 getPlayerPos(player_t *player)
|
|||||||
{
|
{
|
||||||
UINT8 pos = 1;
|
UINT8 pos = 1;
|
||||||
|
|
||||||
for (int i = 0; i < MAXPLAYERS; ++i) {
|
for (UINT8 i = 0; i < MAXPLAYERS; ++i)
|
||||||
if (!playeringame[i] || players[i].spectator) continue;
|
{
|
||||||
if (players[i].marescore > player->marescore) ++pos;
|
if (!playeringame[i] || players[i].spectator)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (players[i].marescore > player->marescore)
|
||||||
|
++pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
@@ -1064,7 +1068,7 @@ void P_SpawnShieldOrb(player_t *player)
|
|||||||
// blaze through the thinkers to see if an orb already exists!
|
// blaze through the thinkers to see if an orb already exists!
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
shieldobj = (mobj_t *)th;
|
shieldobj = (mobj_t *)th;
|
||||||
@@ -1283,13 +1287,14 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
|
|||||||
{
|
{
|
||||||
sector_t *sector = mo->subsector->sector;
|
sector_t *sector = mo->subsector->sector;
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
|
fixed_t flipoffset;
|
||||||
fixed_t flipoffset = ((mo->eflags & MFE_VERTICALFLIP) ? (mo->height/2) : 0);
|
|
||||||
|
|
||||||
if (sector->ffloors)
|
if (sector->ffloors)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
|
||||||
|
flipoffset = ((mo->eflags & MFE_VERTICALFLIP) ? (mo->height/2) : 0);
|
||||||
|
|
||||||
for (rover = sector->ffloors; rover; rover = rover->next)
|
for (rover = sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS))
|
if (!(rover->flags & FF_EXISTS))
|
||||||
@@ -1678,6 +1683,7 @@ static void P_DoBubbleBreath(player_t *player)
|
|||||||
bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_SMALLBUBBLE);
|
bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_SMALLBUBBLE);
|
||||||
else if (P_RandomChance(3*FRACUNIT/256))
|
else if (P_RandomChance(3*FRACUNIT/256))
|
||||||
bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_MEDIUMBUBBLE);
|
bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_MEDIUMBUBBLE);
|
||||||
|
|
||||||
if (bubble)
|
if (bubble)
|
||||||
{
|
{
|
||||||
bubble->threshold = 42;
|
bubble->threshold = 42;
|
||||||
@@ -1685,8 +1691,8 @@ static void P_DoBubbleBreath(player_t *player)
|
|||||||
P_SetScale(bubble, bubble->destscale);
|
P_SetScale(bubble, bubble->destscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles
|
//if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles
|
||||||
return;
|
//return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1780,7 +1786,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -2155,7 +2161,7 @@ static void P_MovePlayer(player_t *player)
|
|||||||
}
|
}
|
||||||
// note: don't unset stasis here
|
// note: don't unset stasis here
|
||||||
|
|
||||||
if (!player->spectator && G_TagGametype())
|
if (UNLIKELY(!player->spectator && G_TagGametype()))
|
||||||
{
|
{
|
||||||
// If we have stasis already here, it's because it's forced on us
|
// If we have stasis already here, it's because it's forced on us
|
||||||
// by a linedef executor or what have you
|
// by a linedef executor or what have you
|
||||||
@@ -2215,7 +2221,7 @@ static void P_MovePlayer(player_t *player)
|
|||||||
player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0;
|
player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leveltime >= starttime)
|
if (LIKELY(leveltime >= starttime))
|
||||||
{
|
{
|
||||||
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
|
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
|
||||||
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
|
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
|
||||||
@@ -2254,7 +2260,7 @@ static void P_MovePlayer(player_t *player)
|
|||||||
P_3dMovement(player);
|
P_3dMovement(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maptol & TOL_2D)
|
if (UNLIKELY(maptol & TOL_2D)) // psure this doesent even work at all
|
||||||
runspd = FixedMul(runspd, 2*FRACUNIT/3);
|
runspd = FixedMul(runspd, 2*FRACUNIT/3);
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@@ -2315,10 +2321,10 @@ static void P_MovePlayer(player_t *player)
|
|||||||
|
|
||||||
// Drifting sound
|
// Drifting sound
|
||||||
// Start looping the sound now.
|
// Start looping the sound now.
|
||||||
if (leveltime % 50 == 0 && onground && player->kartstuff[k_drift] != 0)
|
if (onground && leveltime % 50 == 0 && player->kartstuff[k_drift] != 0)
|
||||||
S_StartSound(player->mo, sfx_drift);
|
S_StartSound(player->mo, sfx_drift);
|
||||||
// Leveltime being 50 might take a while at times. We'll start it up once, isntantly.
|
// Leveltime being 50 might take a while at times. We'll start it up once, isntantly.
|
||||||
else if (!S_SoundPlaying(player->mo, sfx_drift) && onground && player->kartstuff[k_drift] != 0)
|
else if (onground && !S_SoundPlaying(player->mo, sfx_drift) && player->kartstuff[k_drift] != 0)
|
||||||
S_StartSound(player->mo, sfx_drift);
|
S_StartSound(player->mo, sfx_drift);
|
||||||
// Ok, we'll stop now.
|
// Ok, we'll stop now.
|
||||||
else if (player->kartstuff[k_drift] == 0 || !onground)
|
else if (player->kartstuff[k_drift] == 0 || !onground)
|
||||||
@@ -2343,7 +2349,7 @@ static void P_MovePlayer(player_t *player)
|
|||||||
P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
|
P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->gotflag) // If you can't glide, then why the heck would you be gliding?
|
if (UNLIKELY(player->gotflag)) // If you can't glide, then why the heck would you be gliding?
|
||||||
{
|
{
|
||||||
player->pflags &= ~PF_GLIDING;
|
player->pflags &= ~PF_GLIDING;
|
||||||
player->glidetime = 0;
|
player->glidetime = 0;
|
||||||
@@ -2506,7 +2512,7 @@ static void P_DoZoomTube(player_t *player)
|
|||||||
// Find next waypoint
|
// Find next waypoint
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
if (th->function != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -2596,7 +2602,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
|
|||||||
|
|
||||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||||
{
|
{
|
||||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (think->function != (actionf_p1)P_MobjThinker)
|
||||||
continue; // not a mobj thinker
|
continue; // not a mobj thinker
|
||||||
|
|
||||||
mo = (mobj_t *)think;
|
mo = (mobj_t *)think;
|
||||||
@@ -2673,7 +2679,7 @@ boolean P_LookForEnemies(player_t *player)
|
|||||||
|
|
||||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||||
{
|
{
|
||||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (think->function != (actionf_p1)P_MobjThinker)
|
||||||
continue; // not a mobj thinker
|
continue; // not a mobj thinker
|
||||||
|
|
||||||
mo = (mobj_t *)think;
|
mo = (mobj_t *)think;
|
||||||
@@ -2704,8 +2710,8 @@ boolean P_LookForEnemies(player_t *player)
|
|||||||
player->mo->z-mo->z) > FixedMul(RING_DIST, player->mo->scale))
|
player->mo->z-mo->z) > FixedMul(RING_DIST, player->mo->scale))
|
||||||
continue; // out of range
|
continue; // out of range
|
||||||
|
|
||||||
if ((twodlevel || player->mo->flags2 & MF2_TWOD)
|
if (UNLIKELY((twodlevel || player->mo->flags2 & MF2_TWOD)
|
||||||
&& abs(player->mo->y-mo->y) > player->mo->radius)
|
&& abs(player->mo->y-mo->y) > player->mo->radius))
|
||||||
continue; // not in your 2d plane
|
continue; // not in your 2d plane
|
||||||
|
|
||||||
if (mo->type == MT_PLAYER) // Don't chase after other players!
|
if (mo->type == MT_PLAYER) // Don't chase after other players!
|
||||||
@@ -2797,7 +2803,7 @@ void P_FindEmerald(void)
|
|||||||
// to find all emeralds
|
// to find all emeralds
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -3510,7 +3516,7 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam,
|
|||||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || UNLIKELY(GETSECSPECIAL(rover->master->frontsector->special, 4) == 12))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
||||||
@@ -3575,7 +3581,7 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam,
|
|||||||
// We're inside it! Yess...
|
// We're inside it! Yess...
|
||||||
polysec = po->lines[0]->backsector;
|
polysec = po->lines[0]->backsector;
|
||||||
|
|
||||||
if (GETSECSPECIAL(polysec->special, 4) == 12)
|
if (UNLIKELY(GETSECSPECIAL(polysec->special, 4) == 12))
|
||||||
{ // Camera noclip polyobj.
|
{ // Camera noclip polyobj.
|
||||||
plink = (polymaplink_t *)(plink->link.next);
|
plink = (polymaplink_t *)(plink->link.next);
|
||||||
continue;
|
continue;
|
||||||
@@ -3631,7 +3637,7 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam,
|
|||||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
if ((rover->flags & FF_BLOCKOTHERS) && (rover->flags & FF_RENDERALL) && (rover->flags & FF_EXISTS) && GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
if (UNLIKELY((rover->flags & FF_BLOCKOTHERS) && (rover->flags & FF_RENDERALL) && (rover->flags & FF_EXISTS) && GETSECSPECIAL(rover->master->frontsector->special, 4) == 12))
|
||||||
{
|
{
|
||||||
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
||||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
||||||
@@ -4077,7 +4083,7 @@ boolean P_SpectatorJoinGame(player_t *player)
|
|||||||
// Team changing in Team Match and CTF
|
// Team changing in Team Match and CTF
|
||||||
// Pressing fire assigns you to a team that needs players if allowed.
|
// Pressing fire assigns you to a team that needs players if allowed.
|
||||||
// Partial code reproduction from p_tick.c autobalance code.
|
// Partial code reproduction from p_tick.c autobalance code.
|
||||||
else if (G_GametypeHasTeams())
|
else if (UNLIKELY(G_GametypeHasTeams()))
|
||||||
{
|
{
|
||||||
INT32 changeto = 0;
|
INT32 changeto = 0;
|
||||||
INT32 z, numplayersred = 0, numplayersblue = 0;
|
INT32 z, numplayersred = 0, numplayersblue = 0;
|
||||||
@@ -4245,7 +4251,7 @@ static void P_CalcPostImg(player_t *player, camera_t *thiscam)
|
|||||||
else
|
else
|
||||||
pviewheight = player->mo->z + player->viewheight;
|
pviewheight = player->mo->z + player->viewheight;
|
||||||
|
|
||||||
if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj))
|
if (player->awayviewtics && !P_MobjWasRemoved(player->awayviewmobj))
|
||||||
{
|
{
|
||||||
sector = player->awayviewmobj->subsector->sector;
|
sector = player->awayviewmobj->subsector->sector;
|
||||||
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
|
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
|
||||||
@@ -4319,10 +4325,10 @@ static INT32 Quaketilt(player_t *player)
|
|||||||
if (abs(delta) > ANGLE_90)
|
if (abs(delta) > ANGLE_90)
|
||||||
delta = (INT32)(( moma + ANGLE_180 ) - player->mo->angle );
|
delta = (INT32)(( moma + ANGLE_180 ) - player->mo->angle );
|
||||||
|
|
||||||
const boolean sliptiding = player->kartstuff[k_drift] ? 0 : player->kartstuff[k_aizdriftstrat];
|
|
||||||
|
|
||||||
if (P_IsObjectOnGround(player->mo))
|
if (P_IsObjectOnGround(player->mo))
|
||||||
{
|
{
|
||||||
|
const boolean sliptiding = player->kartstuff[k_drift] ? 0 : player->kartstuff[k_aizdriftstrat];
|
||||||
|
|
||||||
if (sliptiding)
|
if (sliptiding)
|
||||||
{
|
{
|
||||||
tilt = ANGLE_45;
|
tilt = ANGLE_45;
|
||||||
@@ -4475,8 +4481,8 @@ void P_PlayerThink(player_t *player)
|
|||||||
{
|
{
|
||||||
seenplayer = NULL;
|
seenplayer = NULL;
|
||||||
|
|
||||||
if (cv_seenames.value && cv_allowseenames.value &&
|
if (UNLIKELY(cv_seenames.value && cv_allowseenames.value &&
|
||||||
!(G_TagGametype() && (player->pflags & PF_TAGIT)))
|
!(G_TagGametype() && (player->pflags & PF_TAGIT))))
|
||||||
{
|
{
|
||||||
mobj_t *mo = P_SpawnNameFinder(player->mo, MT_NAMECHECK);
|
mobj_t *mo = P_SpawnNameFinder(player->mo, MT_NAMECHECK);
|
||||||
|
|
||||||
@@ -4765,8 +4771,8 @@ void P_PlayerThink(player_t *player)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
|
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
|
||||||
if (!objectplacing && !((netgame || multiplayer) && player->spectator)
|
if (UNLIKELY(!objectplacing && !((netgame || multiplayer) && player->spectator)
|
||||||
&& maptol & TOL_NIGHTS && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper]))
|
&& maptol & TOL_NIGHTS && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper])))
|
||||||
{
|
{
|
||||||
thinker_t *th;
|
thinker_t *th;
|
||||||
mobj_t *mo2;
|
mobj_t *mo2;
|
||||||
@@ -4776,7 +4782,7 @@ void P_PlayerThink(player_t *player)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
mo2 = (mobj_t *)th;
|
||||||
@@ -4831,7 +4837,7 @@ void P_PlayerThink(player_t *player)
|
|||||||
player->pflags &= ~PF_FULLSTASIS;
|
player->pflags &= ~PF_FULLSTASIS;
|
||||||
|
|
||||||
if (player->onconveyor == 1)
|
if (player->onconveyor == 1)
|
||||||
player->cmomy = player->cmomx = 0;
|
player->cmomy = player->cmomx = 0;
|
||||||
|
|
||||||
P_DoBubbleBreath(player); // Spawn Sonic's bubbles
|
P_DoBubbleBreath(player); // Spawn Sonic's bubbles
|
||||||
P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles
|
P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles
|
||||||
@@ -4868,7 +4874,7 @@ void P_PlayerThink(player_t *player)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check for use
|
// check for use
|
||||||
if (!(player->pflags & PF_NIGHTSMODE))
|
if (LIKELY(!(player->pflags & PF_NIGHTSMODE)))
|
||||||
{
|
{
|
||||||
if (cmd->buttons & BT_BRAKE)
|
if (cmd->buttons & BT_BRAKE)
|
||||||
player->pflags |= PF_USEDOWN;
|
player->pflags |= PF_USEDOWN;
|
||||||
@@ -5040,6 +5046,11 @@ void P_PlayerAfterThink(player_t *player)
|
|||||||
P_PlayerInSpecialSector(player);
|
P_PlayerInSpecialSector(player);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (player->playerstate == PST_DEAD)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
for (i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
if (player == &players[displayplayers[i]])
|
if (player == &players[displayplayers[i]])
|
||||||
@@ -5049,12 +5060,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->playerstate == PST_DEAD)
|
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->pflags & PF_NIGHTSMODE)
|
|
||||||
{
|
{
|
||||||
player->powers[pw_gravityboots] = 0;
|
player->powers[pw_gravityboots] = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+244
-153
@@ -235,6 +235,7 @@ UINT32 ASTBlendTexturePixel(RGBA_t background, RGBA_t foreground, int style, UIN
|
|||||||
// Painfully simple texture id cacheing to make maps load faster. :3
|
// Painfully simple texture id cacheing to make maps load faster. :3
|
||||||
static struct {
|
static struct {
|
||||||
char name[9];
|
char name[9];
|
||||||
|
UINT32 hash;
|
||||||
INT32 id;
|
INT32 id;
|
||||||
} *tidcache = NULL;
|
} *tidcache = NULL;
|
||||||
static INT32 tidcachelen = 0;
|
static INT32 tidcachelen = 0;
|
||||||
@@ -484,9 +485,7 @@ UINT8 *R_GetColumn(fixed_t tex, INT32 col)
|
|||||||
// Odd width texture, cannot just mask.
|
// Odd width texture, cannot just mask.
|
||||||
// Sometime gets colnum = -1 or = width, even without tiling.
|
// Sometime gets colnum = -1 or = width, even without tiling.
|
||||||
// Test LostCiv, Map 20, crates.
|
// Test LostCiv, Map 20, crates.
|
||||||
col = ( col < 0 ) ?
|
col = ((col % texwidth) + texwidth) % texwidth;
|
||||||
texwidth - (((-col - 1) % texwidth) + 1)
|
|
||||||
: col % texwidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
@@ -522,32 +521,151 @@ void R_FlushTextureCache(void)
|
|||||||
int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
|
int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
|
||||||
void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
|
void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
|
||||||
|
|
||||||
//
|
|
||||||
// R_LoadTextures
|
|
||||||
// Initializes the texture list with the textures from the world map.
|
|
||||||
//
|
|
||||||
#define TX_START "TX_START"
|
#define TX_START "TX_START"
|
||||||
#define TX_END "TX_END"
|
#define TX_END "TX_END"
|
||||||
void R_LoadTextures(void)
|
|
||||||
|
static INT32
|
||||||
|
Rloadtextures (INT32 i, INT32 w)
|
||||||
{
|
{
|
||||||
INT32 i, k, w;
|
|
||||||
UINT16 j;
|
UINT16 j;
|
||||||
|
INT32 k;
|
||||||
UINT16 texstart, texend, texturesLumpPos;
|
UINT16 texstart, texend, texturesLumpPos;
|
||||||
softwarepatch_t *patchlump;
|
softwarepatch_t *patchlump;
|
||||||
texpatch_t *patch;
|
texpatch_t *patch;
|
||||||
texture_t *texture;
|
texture_t *texture;
|
||||||
|
|
||||||
// Free previous memory before numtextures change.
|
// Get the lump numbers for the markers in the WAD, if they exist.
|
||||||
if (numtextures)
|
if (W_FileHasFolders(wadfiles[w]))
|
||||||
{
|
{
|
||||||
for (i = 0; i < numtextures; i++)
|
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
||||||
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||||
|
while (texturesLumpPos != INT16_MAX)
|
||||||
{
|
{
|
||||||
Z_Free(textures[i]);
|
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
||||||
Z_Free(texturecache[i]);
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
|
||||||
}
|
}
|
||||||
Z_Free(texturetranslation);
|
|
||||||
Z_Free(textures);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForMarkerStartPwad(TX_START, (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
||||||
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||||
|
if (texturesLumpPos != INT16_MAX)
|
||||||
|
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
// Work through each lump between the markers in the WAD.
|
||||||
|
for (j = 0; j < (texend - texstart); j++)
|
||||||
|
{
|
||||||
|
UINT16 wadnum = (UINT16)w;
|
||||||
|
lumpnum_t lumpnum = texstart + j;
|
||||||
|
|
||||||
|
if (W_FileHasFolders(wadfiles[w]))
|
||||||
|
{
|
||||||
|
if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder
|
||||||
|
continue; // If it is then SKIP IT
|
||||||
|
}
|
||||||
|
|
||||||
|
patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC);
|
||||||
|
|
||||||
|
//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);
|
||||||
|
|
||||||
|
// Set texture properties.
|
||||||
|
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||||
|
texture->hash = quickncasehash(texture->name, 8);
|
||||||
|
texture->width = SHORT(patchlump->width);
|
||||||
|
texture->height = SHORT(patchlump->height);
|
||||||
|
texture->type = TEXTURETYPE_SINGLEPATCH;
|
||||||
|
texture->patchcount = 1;
|
||||||
|
texture->holes = false;
|
||||||
|
|
||||||
|
// Allocate information for the texture's patches.
|
||||||
|
patch = &texture->patches[0];
|
||||||
|
|
||||||
|
patch->originx = patch->originy = 0;
|
||||||
|
patch->wad = wadnum;
|
||||||
|
patch->lump = texstart + j;
|
||||||
|
|
||||||
|
Z_Free(patchlump);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static INT32
|
||||||
|
count_range
|
||||||
|
( const char * marker_start,
|
||||||
|
const char * marker_end,
|
||||||
|
const char * folder,
|
||||||
|
UINT16 wadnum)
|
||||||
|
{
|
||||||
|
UINT16 j;
|
||||||
|
UINT16 texstart, texend;
|
||||||
|
INT32 count = 0;
|
||||||
|
|
||||||
|
// Count flats
|
||||||
|
if (W_FileHasFolders(wadfiles[wadnum]))
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForFolderStartPK3(folder, wadnum, 0);
|
||||||
|
texend = W_CheckNumForFolderEndPK3(folder, wadnum, texstart);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForMarkerStartPwad(marker_start, wadnum, 0);
|
||||||
|
texend = W_CheckNumForNamePwad(marker_end, wadnum, texstart);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texstart != INT16_MAX && texend != INT16_MAX)
|
||||||
|
{
|
||||||
|
// PK3s have subfolders, so we can't just make a simple sum
|
||||||
|
if (W_FileHasFolders(wadfiles[wadnum]))
|
||||||
|
{
|
||||||
|
for (j = texstart; j < texend; j++)
|
||||||
|
{
|
||||||
|
if (!W_IsLumpFolder(wadnum, j)) // Check if lump is a folder; if not, then count it
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Add all the textures between markers
|
||||||
|
{
|
||||||
|
count += (texend - texstart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static INT32 R_CountTextures(UINT16 wadnum)
|
||||||
|
{
|
||||||
|
UINT16 texturesLumpPos;
|
||||||
|
INT32 count = 0;
|
||||||
|
|
||||||
// Load patches and textures.
|
// Load patches and textures.
|
||||||
|
|
||||||
@@ -556,159 +674,127 @@ void R_LoadTextures(void)
|
|||||||
// the markers.
|
// the markers.
|
||||||
// This system will allocate memory for all duplicate/patched textures even if it never uses them,
|
// This system will allocate memory for all duplicate/patched textures even if it never uses them,
|
||||||
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
|
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
|
||||||
for (w = 0, numtextures = 0; w < numwadfiles; w++)
|
|
||||||
|
// Count the textures from TEXTURES lumps
|
||||||
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, 0);
|
||||||
|
|
||||||
|
while (texturesLumpPos != INT16_MAX)
|
||||||
{
|
{
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
count += R_CountTexturesInTEXTURESLump(wadnum, texturesLumpPos);
|
||||||
{
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, texturesLumpPos + 1);
|
||||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
|
||||||
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
|
|
||||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
|
||||||
while (texturesLumpPos != INT16_MAX)
|
|
||||||
{
|
|
||||||
numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add all the textures between TX_START and TX_END
|
|
||||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// PK3s have subfolders, so we can't just make a simple sum
|
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
|
||||||
{
|
|
||||||
for (j = texstart; j < texend; j++)
|
|
||||||
{
|
|
||||||
if (W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it
|
|
||||||
continue;
|
|
||||||
|
|
||||||
numtextures++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
numtextures += (UINT32)(texend - texstart);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no textures found by this point, bomb out
|
// Count single-patch textures
|
||||||
if (!numtextures)
|
count += count_range(TX_START, TX_END, "textures/", wadnum);
|
||||||
I_Error("No textures detected in any WADs!\n");
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
recallocuser
|
||||||
|
( void * user,
|
||||||
|
size_t old,
|
||||||
|
size_t new)
|
||||||
|
{
|
||||||
|
char *p = Z_Realloc(*(void**)user,
|
||||||
|
new, PU_STATIC, user);
|
||||||
|
|
||||||
|
if (new > old)
|
||||||
|
memset(&p[old], 0, (new - old));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_AllocateTextures(INT32 add)
|
||||||
|
{
|
||||||
|
const INT32 newtextures = (numtextures + add);
|
||||||
|
const size_t newsize = newtextures * sizeof (void*);
|
||||||
|
const size_t oldsize = numtextures * sizeof (void*);
|
||||||
|
|
||||||
|
INT32 i;
|
||||||
|
|
||||||
// Allocate memory and initialize to 0 for all the textures we are initialising.
|
// Allocate memory and initialize to 0 for all the textures we are initialising.
|
||||||
// There are actually 5 buffers allocated in one for convenience.
|
recallocuser(&textures, oldsize, newsize);
|
||||||
textures = Z_Calloc((numtextures * sizeof(void *)) * 5, PU_STATIC, NULL);
|
|
||||||
|
|
||||||
// Allocate texture column offset table.
|
// Allocate texture column offset table.
|
||||||
texturecolumnofs = (void *)((UINT8 *)textures + (numtextures * sizeof(void *)));
|
recallocuser(&texturecolumnofs, oldsize, newsize);
|
||||||
// Allocate texture referencing cache.
|
// Allocate texture referencing cache.
|
||||||
texturecache = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 2));
|
recallocuser(&texturecache, oldsize, newsize);
|
||||||
// Allocate texture width mask table.
|
// Allocate texture width table.
|
||||||
texturewidthmask = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 3));
|
recallocuser(&texturewidthmask, oldsize, newsize);
|
||||||
// Allocate texture height mask table.
|
// Allocate texture height table.
|
||||||
textureheight = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 4));
|
recallocuser(&textureheight, oldsize, newsize);
|
||||||
// Create translation table for global animation.
|
// Create translation table for global animation.
|
||||||
texturetranslation = Z_Malloc((numtextures + 1) * sizeof(*texturetranslation), PU_STATIC, NULL);
|
Z_Realloc(texturetranslation, (newtextures + 1) * sizeof(*texturetranslation), PU_STATIC, &texturetranslation);
|
||||||
|
|
||||||
for (i = 0; i < numtextures; i++)
|
for (i = 0; i < numtextures; ++i)
|
||||||
texturetranslation[i] = i;
|
|
||||||
|
|
||||||
for (i = 0, w = 0; w < numwadfiles; w++)
|
|
||||||
{
|
{
|
||||||
// Get the lump numbers for the markers in the WAD, if they exist.
|
// R_FlushTextureCache relies on the user for
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
// Z_Free, texturecache has been reallocated so the
|
||||||
{
|
// user is now garbage memory.
|
||||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
Z_SetUser(texturecache[i], (void**)&texturecache[i]);
|
||||||
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
|
||||||
while (texturesLumpPos != INT16_MAX)
|
|
||||||
{
|
|
||||||
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
|
|
||||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
|
||||||
if (texturesLumpPos != INT16_MAX)
|
|
||||||
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Work through each lump between the markers in the WAD.
|
|
||||||
for (j = 0; j < (texend - texstart); j++)
|
|
||||||
{
|
|
||||||
UINT16 wadnum = (UINT16)w;
|
|
||||||
lumpnum_t lumpnum = texstart + j;
|
|
||||||
|
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
|
||||||
{
|
|
||||||
if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder
|
|
||||||
continue; // If it is then SKIP IT
|
|
||||||
}
|
|
||||||
|
|
||||||
patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC);
|
|
||||||
|
|
||||||
//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);
|
|
||||||
|
|
||||||
// Set texture properties.
|
|
||||||
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
|
||||||
texture->width = SHORT(patchlump->width);
|
|
||||||
texture->height = SHORT(patchlump->height);
|
|
||||||
texture->type = TEXTURETYPE_SINGLEPATCH;
|
|
||||||
texture->patchcount = 1;
|
|
||||||
texture->holes = false;
|
|
||||||
|
|
||||||
// Allocate information for the texture's patches.
|
|
||||||
patch = &texture->patches[0];
|
|
||||||
|
|
||||||
patch->originx = patch->originy = 0;
|
|
||||||
patch->wad = wadnum;
|
|
||||||
patch->lump = texstart + j;
|
|
||||||
|
|
||||||
Z_Free(patchlump);
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (i < newtextures)
|
||||||
|
{
|
||||||
|
texturetranslation[i] = i;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static INT32 R_DefineTextures(INT32 i, UINT16 w)
|
||||||
|
{
|
||||||
|
return Rloadtextures(i, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_FinishLoadingTextures(INT32 add)
|
||||||
|
{
|
||||||
|
numtextures += add;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
HWR_LoadMapTextures(numtextures);
|
HWR_LoadMapTextures(numtextures);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_LoadTextures
|
||||||
|
// Initializes the texture list with the textures from the world map.
|
||||||
|
//
|
||||||
|
void R_LoadTextures(void)
|
||||||
|
{
|
||||||
|
INT32 i, w;
|
||||||
|
INT32 newtextures = 0;
|
||||||
|
|
||||||
|
for (w = 0; w < numwadfiles; w++)
|
||||||
|
{
|
||||||
|
newtextures += R_CountTextures((UINT16)w);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no textures found by this point, bomb out
|
||||||
|
if (!newtextures)
|
||||||
|
I_Error("No textures detected in any WADs!\n");
|
||||||
|
|
||||||
|
R_AllocateTextures(newtextures);
|
||||||
|
|
||||||
|
for (i = 0, w = 0; w < numwadfiles; w++)
|
||||||
|
{
|
||||||
|
i = R_DefineTextures(i, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_FinishLoadingTextures(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_LoadTexturesPwad(UINT16 wadnum)
|
||||||
|
{
|
||||||
|
INT32 newtextures = R_CountTextures(wadnum);
|
||||||
|
|
||||||
|
if (!newtextures)
|
||||||
|
return;
|
||||||
|
|
||||||
|
R_AllocateTextures(newtextures);
|
||||||
|
newtextures = R_DefineTextures(numtextures, wadnum) - numtextures;
|
||||||
|
R_FinishLoadingTextures(newtextures);
|
||||||
|
}
|
||||||
|
|
||||||
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
||||||
{
|
{
|
||||||
char *texturesToken;
|
char *texturesToken;
|
||||||
@@ -960,6 +1046,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
// Allocate memory for a zero-patch texture. Obviously, we'll be adding patches momentarily.
|
// Allocate memory for a zero-patch texture. Obviously, we'll be adding patches momentarily.
|
||||||
resultTexture = (texture_t *)Z_Calloc(sizeof(texture_t), PU_STATIC, NULL);
|
resultTexture = (texture_t *)Z_Calloc(sizeof(texture_t), PU_STATIC, NULL);
|
||||||
M_Memcpy(resultTexture->name, newTextureName, 8);
|
M_Memcpy(resultTexture->name, newTextureName, 8);
|
||||||
|
resultTexture->hash = quickncasehash(newTextureName, 8);
|
||||||
resultTexture->width = newTextureWidth;
|
resultTexture->width = newTextureWidth;
|
||||||
resultTexture->height = newTextureHeight;
|
resultTexture->height = newTextureHeight;
|
||||||
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
||||||
@@ -1743,19 +1830,22 @@ void R_ClearTextureNumCache(boolean btell)
|
|||||||
INT32 R_CheckTextureNumForName(const char *name)
|
INT32 R_CheckTextureNumForName(const char *name)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
UINT32 hash;
|
||||||
|
|
||||||
// "NoTexture" marker.
|
// "NoTexture" marker.
|
||||||
if (name[0] == '-')
|
if (name[0] == '-')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
hash = quickncasehash(name, 8);
|
||||||
|
|
||||||
for (i = 0; i < tidcachelen; i++)
|
for (i = 0; i < tidcachelen; i++)
|
||||||
if (!strncasecmp(tidcache[i].name, name, 8))
|
if (tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
|
||||||
return tidcache[i].id;
|
return tidcache[i].id;
|
||||||
|
|
||||||
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
||||||
//for (i = 0; i < numtextures; i++) <- old
|
//for (i = 0; i < numtextures; i++) <- old
|
||||||
for (i = (numtextures - 1); i >= 0; i--) // <- new
|
for (i = (numtextures - 1); i >= 0; i--) // <- new
|
||||||
if (!strncasecmp(textures[i]->name, name, 8))
|
if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8))
|
||||||
{
|
{
|
||||||
tidcachelen++;
|
tidcachelen++;
|
||||||
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
|
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
|
||||||
@@ -1764,6 +1854,7 @@ INT32 R_CheckTextureNumForName(const char *name)
|
|||||||
#ifndef ZDEBUG
|
#ifndef ZDEBUG
|
||||||
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
|
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
|
||||||
#endif
|
#endif
|
||||||
|
tidcache[tidcachelen-1].hash = hash;
|
||||||
tidcache[tidcachelen-1].id = i;
|
tidcache[tidcachelen-1].id = i;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -1865,7 +1956,7 @@ static void R_PrecacheLevelSprites(void)
|
|||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ typedef struct
|
|||||||
// Keep name for switch changing, etc.
|
// Keep name for switch changing, etc.
|
||||||
char name[8];
|
char name[8];
|
||||||
UINT8 type; // TEXTURETYPE_
|
UINT8 type; // TEXTURETYPE_
|
||||||
|
UINT32 hash;
|
||||||
INT16 width, height;
|
INT16 width, height;
|
||||||
boolean holes;
|
boolean holes;
|
||||||
// All the patches[patchcount] are drawn back to front into the cached texture.
|
// All the patches[patchcount] are drawn back to front into the cached texture.
|
||||||
@@ -76,6 +77,7 @@ extern CV_PossibleValue_t Color_cons_t[];
|
|||||||
|
|
||||||
// Load TEXTURE1/TEXTURE2/PNAMES definitions, create lookup tables
|
// Load TEXTURE1/TEXTURE2/PNAMES definitions, create lookup tables
|
||||||
void R_LoadTextures(void);
|
void R_LoadTextures(void);
|
||||||
|
void R_LoadTexturesPwad(UINT16 wadnum);
|
||||||
void R_FlushTextureCache(void);
|
void R_FlushTextureCache(void);
|
||||||
|
|
||||||
UINT8 *R_GenerateTexture(size_t texnum);
|
UINT8 *R_GenerateTexture(size_t texnum);
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ static CV_PossibleValue_t fov_cons_t[] = {{MINFOV*FRACUNIT, "MIN"}, {MAXFOV*FRAC
|
|||||||
static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
|
||||||
static CV_PossibleValue_t maxportals_cons_t[] = {{0, "MIN"}, {12, "MAX"}, {0, NULL}}; // lmao rendering 32 portals, you're a card
|
static CV_PossibleValue_t maxportals_cons_t[] = {{0, "MIN"}, {12, "MAX"}, {0, NULL}}; // lmao rendering 32 portals, you're a card
|
||||||
static CV_PossibleValue_t homremoval_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Flash"}, {0, NULL}};
|
static CV_PossibleValue_t homremoval_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Flash"}, {0, NULL}};
|
||||||
|
static CV_PossibleValue_t secbright_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NULL}};
|
||||||
|
|
||||||
static void R_SetFov(fixed_t playerfov);
|
static void R_SetFov(fixed_t playerfov);
|
||||||
|
|
||||||
@@ -201,6 +202,8 @@ consvar_t cv_ripplewater = {"waterripples", "On", CV_SAVE, CV_OnOff, NULL, 0
|
|||||||
// Okay, whoever said homremoval causes a performance hit should be shot.
|
// Okay, whoever said homremoval causes a performance hit should be shot.
|
||||||
consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
consvar_t cv_secbright = {"r_secbright", "0", CV_SAVE, secbright_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
consvar_t cv_maxportals = {"maxportals", "2", CV_SAVE, maxportals_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_maxportals = {"maxportals", "2", CV_SAVE, maxportals_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// cap fov, fov too high tears software apart.
|
// cap fov, fov too high tears software apart.
|
||||||
@@ -1558,6 +1561,7 @@ void R_RegisterEngineStuff(void)
|
|||||||
CV_RegisterVar(&cv_skybox);
|
CV_RegisterVar(&cv_skybox);
|
||||||
CV_RegisterVar(&cv_ffloorclip);
|
CV_RegisterVar(&cv_ffloorclip);
|
||||||
CV_RegisterVar(&cv_spriteclip);
|
CV_RegisterVar(&cv_spriteclip);
|
||||||
|
CV_RegisterVar(&cv_secbright);
|
||||||
CV_RegisterVar(&cv_softcyancut);
|
CV_RegisterVar(&cv_softcyancut);
|
||||||
|
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
|
|||||||
@@ -197,9 +197,15 @@ extern consvar_t cv_tailspickup;
|
|||||||
extern consvar_t cv_maxinterpdist;
|
extern consvar_t cv_maxinterpdist;
|
||||||
extern consvar_t cv_playerfade;
|
extern consvar_t cv_playerfade;
|
||||||
extern consvar_t cv_ripplewater;
|
extern consvar_t cv_ripplewater;
|
||||||
|
extern consvar_t cv_secbright;
|
||||||
|
|
||||||
extern consvar_t cv_randomdirlight;
|
extern consvar_t cv_randomdirlight;
|
||||||
|
|
||||||
|
static inline INT32 R_GetSoftLightlevel(INT32 llevel)
|
||||||
|
{
|
||||||
|
return CLAMP(llevel, cv_secbright.value, 255) >> LIGHTSEGSHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
// Called by startup code.
|
// Called by startup code.
|
||||||
void R_Init(void);
|
void R_Init(void);
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -1059,7 +1059,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
|||||||
#else
|
#else
|
||||||
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||||
#endif
|
#endif
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = R_GetSoftLightlevel(pl->lightlevel);
|
||||||
else
|
else
|
||||||
light = LIGHTLEVELS-1;
|
light = LIGHTLEVELS-1;
|
||||||
}
|
}
|
||||||
@@ -1111,16 +1111,17 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
|||||||
#else
|
#else
|
||||||
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||||
#endif
|
#endif
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = R_GetSoftLightlevel(pl->lightlevel);
|
||||||
else
|
else
|
||||||
light = LIGHTLEVELS-1;
|
light = LIGHTLEVELS-1;
|
||||||
}
|
}
|
||||||
else if (pl->ffloor->flags & FF_FOG)
|
else if (pl->ffloor->flags & FF_FOG)
|
||||||
{
|
{
|
||||||
spanfunctype = SPANDRAWFUNC_FOG;
|
spanfunctype = SPANDRAWFUNC_FOG;
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = R_GetSoftLightlevel(pl->lightlevel);
|
||||||
}
|
}
|
||||||
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
else
|
||||||
|
light = R_GetSoftLightlevel(pl->lightlevel);
|
||||||
|
|
||||||
if (pl->ffloor->flags & FF_RIPPLE && cv_ripplewater.value)
|
if (pl->ffloor->flags & FF_RIPPLE && cv_ripplewater.value)
|
||||||
{
|
{
|
||||||
@@ -1172,7 +1173,8 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
else
|
||||||
|
light = R_GetSoftLightlevel(pl->lightlevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
ds->currentplane = pl;
|
ds->currentplane = pl;
|
||||||
|
|||||||
+10
-11
@@ -209,11 +209,11 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
|||||||
rlight->flags = static_cast<ffloortype_e>(light->flags);
|
rlight->flags = static_cast<ffloortype_e>(light->flags);
|
||||||
|
|
||||||
if (rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
|
if (rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
|
||||||
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(rlight->lightlevel);
|
||||||
else if (R_CheckColumnFunc(COLDRAWFUNC_FUZZY))
|
else if (R_CheckColumnFunc(COLDRAWFUNC_FUZZY))
|
||||||
lightnum = LIGHTLEVELS - 1;
|
lightnum = LIGHTLEVELS - 1;
|
||||||
else
|
else
|
||||||
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(rlight->lightlevel);
|
||||||
|
|
||||||
if (rlight->extra_colormap && rlight->extra_colormap->fog)
|
if (rlight->extra_colormap && rlight->extra_colormap->fog)
|
||||||
;
|
;
|
||||||
@@ -227,7 +227,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
|||||||
{
|
{
|
||||||
if ((R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == false)
|
if ((R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == false)
|
||||||
|| (frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
|| (frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
||||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(frontsector->lightlevel);
|
||||||
else
|
else
|
||||||
lightnum = LIGHTLEVELS - 1;
|
lightnum = LIGHTLEVELS - 1;
|
||||||
|
|
||||||
@@ -764,9 +764,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
|
|
||||||
// Check if the current light effects the colormap/lightlevel
|
// Check if the current light effects the colormap/lightlevel
|
||||||
if (pfloor->flags & FF_FOG)
|
if (pfloor->flags & FF_FOG)
|
||||||
rlight->lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT);
|
rlight->lightnum = R_GetSoftLightlevel(pfloor->master->frontsector->lightlevel);
|
||||||
else
|
else
|
||||||
rlight->lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
|
rlight->lightnum = R_GetSoftLightlevel(rlight->lightlevel);
|
||||||
|
|
||||||
if (pfloor->flags & FF_FOG || rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
|
if (pfloor->flags & FF_FOG || rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
|
||||||
;
|
;
|
||||||
@@ -782,14 +782,13 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
{
|
{
|
||||||
// Get correct light level!
|
// Get correct light level!
|
||||||
if ((frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
if ((frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
||||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(frontsector->lightlevel);
|
||||||
else if (fog)
|
else if (fog)
|
||||||
lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(pfloor->master->frontsector->lightlevel);
|
||||||
else if (fuzzy)
|
else if (fuzzy)
|
||||||
lightnum = LIGHTLEVELS-1;
|
lightnum = LIGHTLEVELS-1;
|
||||||
else
|
else
|
||||||
lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)
|
lightnum = R_GetSoftLightlevel(R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)->lightlevel);
|
||||||
->lightlevel >> LIGHTSEGSHIFT;
|
|
||||||
|
|
||||||
if (pfloor->flags & FF_FOG || (frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
if (pfloor->flags & FF_FOG || (frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
||||||
;
|
;
|
||||||
@@ -1385,7 +1384,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
for (i = 0; i < dc->numlights; i++)
|
for (i = 0; i < dc->numlights; i++)
|
||||||
{
|
{
|
||||||
INT32 lightnum;
|
INT32 lightnum;
|
||||||
lightnum = (dc->lightlist[i].lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(dc->lightlist[i].lightlevel);
|
||||||
|
|
||||||
if (dc->lightlist[i].extra_colormap)
|
if (dc->lightlist[i].extra_colormap)
|
||||||
;
|
;
|
||||||
@@ -2443,7 +2442,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
// use different light tables
|
// use different light tables
|
||||||
// for horizontal / vertical / diagonal
|
// for horizontal / vertical / diagonal
|
||||||
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
|
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
|
||||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(frontsector->lightlevel);
|
||||||
|
|
||||||
if (P_ApplyLightOffset(lightnum, frontsector))
|
if (P_ApplyLightOffset(lightnum, frontsector))
|
||||||
lightnum += curline->lightOffset;
|
lightnum += curline->lightOffset;
|
||||||
|
|||||||
+3
-3
@@ -1061,7 +1061,7 @@ static void R_SplitSprite(vissprite_t *sprite)
|
|||||||
|
|
||||||
if (!(sector->lightlist[i].caster->flags & FF_NOSHADE))
|
if (!(sector->lightlist[i].caster->flags & FF_NOSHADE))
|
||||||
{
|
{
|
||||||
INT32 lightnum = (*sector->lightlist[i].lightlevel >> LIGHTSEGSHIFT);
|
INT32 lightnum = R_GetSoftLightlevel(*sector->lightlist[i].lightlevel);
|
||||||
|
|
||||||
if (lightnum < 0)
|
if (lightnum < 0)
|
||||||
spritelights = scalelight[0];
|
spritelights = scalelight[0];
|
||||||
@@ -1660,7 +1660,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||||||
lightnum = thing->subsector->sector->lightlevel;
|
lightnum = thing->subsector->sector->lightlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
lightnum = (lightnum + R_ThingLightLevel(thing)) >> LIGHTSEGSHIFT;
|
lightnum = R_GetSoftLightlevel(lightnum + R_ThingLightLevel(thing));
|
||||||
|
|
||||||
if (maplighting.directional && P_SectorUsesDirectionalLighting(thing->subsector->sector))
|
if (maplighting.directional && P_SectorUsesDirectionalLighting(thing->subsector->sector))
|
||||||
{
|
{
|
||||||
@@ -2057,7 +2057,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
|||||||
{
|
{
|
||||||
if (sec->heightsec == -1) lightlevel = sec->lightlevel;
|
if (sec->heightsec == -1) lightlevel = sec->lightlevel;
|
||||||
|
|
||||||
lightnum = (lightlevel >> LIGHTSEGSHIFT);
|
lightnum = R_GetSoftLightlevel(lightlevel);
|
||||||
|
|
||||||
if (lightnum < 0)
|
if (lightnum < 0)
|
||||||
spritelights = scalelight[0];
|
spritelights = scalelight[0];
|
||||||
|
|||||||
+80
-68
@@ -34,7 +34,7 @@
|
|||||||
#include "lua_hook.h" // MusicChange hook
|
#include "lua_hook.h" // MusicChange hook
|
||||||
#include "lua_hud.h" // LUA_HudEnabled(hud_musiccredit)
|
#include "lua_hud.h" // LUA_HudEnabled(hud_musiccredit)
|
||||||
|
|
||||||
static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
|
static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, sfxinfo_t *sfxinfo);
|
||||||
static void SetChannelsNum(void);
|
static void SetChannelsNum(void);
|
||||||
static void Command_Tunes_f(void);
|
static void Command_Tunes_f(void);
|
||||||
static void Command_RestartAudio_f(void);
|
static void Command_RestartAudio_f(void);
|
||||||
@@ -59,10 +59,12 @@ static void AmigaType_OnChange(void);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||||
consvar_t cv_samplerate = {"samplerate", "44100", 0, CV_Unsigned, NULL, 22050, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
|
consvar_t cv_samplerate = {"samplerate", "44100", 0, CV_Unsigned, NULL, 22050, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
|
||||||
|
#endif
|
||||||
|
|
||||||
static CV_PossibleValue_t audbuffersize_cons_t[] = {{256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}};
|
static CV_PossibleValue_t audbuffersize_cons_t[] = {{128, "128"}, {256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}};
|
||||||
consvar_t cv_audbuffersize = {"buffersize", "2048", CV_SAVE, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// stereo reverse
|
// stereo reverse
|
||||||
consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
@@ -79,7 +81,11 @@ consvar_t cv_midimusicvolume = {"midimusicvolume", "18", CV_SAVE, soundvolume_co
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// number of channels available
|
// number of channels available
|
||||||
consvar_t cv_numChannels = {"snd_channels", "64", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
|
static CV_PossibleValue_t numChannels_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NULL}};
|
||||||
|
consvar_t cv_numChannels = {"snd_channels", "64", CV_SAVE|CV_CALL, numChannels_cons_t, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
static CV_PossibleValue_t samesoundlimit_cons_t[] = {{0, "MIN"}, {64, "MAX"}, {0, NULL}};
|
||||||
|
consvar_t cv_samesoundlimit = {"samesoundlimit", "0", CV_SAVE, samesoundlimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
//consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
//consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
@@ -274,7 +280,9 @@ void S_RegisterSoundStuff(void)
|
|||||||
|
|
||||||
CV_RegisterVar(&stereoreverse);
|
CV_RegisterVar(&stereoreverse);
|
||||||
CV_RegisterVar(&precachesound);
|
CV_RegisterVar(&precachesound);
|
||||||
|
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||||
CV_RegisterVar(&cv_samplerate);
|
CV_RegisterVar(&cv_samplerate);
|
||||||
|
#endif
|
||||||
//CV_RegisterVar(&cv_resetmusic);
|
//CV_RegisterVar(&cv_resetmusic);
|
||||||
CV_RegisterVar(&cv_gamesounds);
|
CV_RegisterVar(&cv_gamesounds);
|
||||||
CV_RegisterVar(&cv_gamedigimusic);
|
CV_RegisterVar(&cv_gamedigimusic);
|
||||||
@@ -282,6 +290,8 @@ void S_RegisterSoundStuff(void)
|
|||||||
CV_RegisterVar(&cv_gamemidimusic);
|
CV_RegisterVar(&cv_gamemidimusic);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_samesoundlimit);
|
||||||
|
|
||||||
// bird music stuff
|
// bird music stuff
|
||||||
CV_RegisterVar(&cv_playmusicifunfocused);
|
CV_RegisterVar(&cv_playmusicifunfocused);
|
||||||
CV_RegisterVar(&cv_playsoundifunfocused);
|
CV_RegisterVar(&cv_playsoundifunfocused);
|
||||||
@@ -324,9 +334,6 @@ static void SetChannelsNum(void)
|
|||||||
Z_Free(channels);
|
Z_Free(channels);
|
||||||
channels = NULL;
|
channels = NULL;
|
||||||
|
|
||||||
if (cv_numChannels.value == 999999999) //Alam_GBC: OH MY ROD!(ROD rimmiced with GOD!)
|
|
||||||
CV_StealthSet(&cv_numChannels,cv_numChannels.defaultvalue);
|
|
||||||
|
|
||||||
if (cv_numChannels.value)
|
if (cv_numChannels.value)
|
||||||
channels = (channel_t *)Z_Calloc(cv_numChannels.value * sizeof (channel_t), PU_STATIC, NULL);
|
channels = (channel_t *)Z_Calloc(cv_numChannels.value * sizeof (channel_t), PU_STATIC, NULL);
|
||||||
numofchannels = (channels ? cv_numChannels.value : 0);
|
numofchannels = (channels ? cv_numChannels.value : 0);
|
||||||
@@ -427,6 +434,25 @@ static INT32 S_ScaleVolumeWithSplitscreen(INT32 volume)
|
|||||||
return FixedDiv(volume * FRACUNIT, root) / FRACUNIT;
|
return FixedDiv(volume * FRACUNIT, root) / FRACUNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean S_CheckSameSoundLimit(sfxenum_t sfx_id)
|
||||||
|
{
|
||||||
|
INT32 cnum, scount = 0;
|
||||||
|
|
||||||
|
if (!cv_samesoundlimit.value)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||||
|
if ((size_t)(channels[cnum].sfxinfo - S_sfx) == (size_t)sfx_id)
|
||||||
|
scount++;
|
||||||
|
|
||||||
|
//CONS_Printf("same sound count: %d for sfx: %d\n", scount, sfx_id);
|
||||||
|
|
||||||
|
if (scount >= cv_samesoundlimit.value)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||||
{
|
{
|
||||||
const mobj_t *origin = (const mobj_t *)origin_p;
|
const mobj_t *origin = (const mobj_t *)origin_p;
|
||||||
@@ -434,7 +460,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
INT32 initial_volume;
|
INT32 initial_volume;
|
||||||
|
|
||||||
sfxinfo_t *sfx;
|
sfxinfo_t *sfx;
|
||||||
INT32 sep, pitch, priority, cnum;
|
INT32 sep, cnum;
|
||||||
boolean anyListeners = false;
|
boolean anyListeners = false;
|
||||||
boolean itsUs = false;
|
boolean itsUs = false;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
@@ -449,13 +475,16 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
if (sfx_id == sfx_None)
|
if (sfx_id == sfx_None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
initial_volume = (origin ? S_ScaleVolumeWithSplitscreen(volume) : volume);
|
// reached same sound limit?
|
||||||
|
if (!S_CheckSameSoundLimit(sfx_id))
|
||||||
|
return;
|
||||||
|
|
||||||
|
memset(listener, 0, sizeof(listener));
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
for (i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
player_t *player = &players[displayplayers[i]];
|
player_t *player = &players[displayplayers[i]];
|
||||||
|
|
||||||
memset(&listener[i], 0, sizeof (listener[i]));
|
|
||||||
listenmobj[i] = NULL;
|
listenmobj[i] = NULL;
|
||||||
|
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
@@ -471,11 +500,6 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
{
|
{
|
||||||
itsUs = true;
|
itsUs = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
|
||||||
{
|
|
||||||
player_t *player = &players[displayplayers[i]];
|
|
||||||
|
|
||||||
if (camera[i].chase && !player->awayviewtics)
|
if (camera[i].chase && !player->awayviewtics)
|
||||||
{
|
{
|
||||||
@@ -514,9 +538,9 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
sfx = &S_sfx[sfx_id];
|
sfx = &S_sfx[sfx_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initial_volume = (origin ? S_ScaleVolumeWithSplitscreen(volume) : volume);
|
||||||
|
|
||||||
// Initialize sound parameters
|
// Initialize sound parameters
|
||||||
pitch = NORM_PITCH;
|
|
||||||
priority = NORM_PRIORITY;
|
|
||||||
sep = NORM_SEP;
|
sep = NORM_SEP;
|
||||||
|
|
||||||
i = 0; // sensible default
|
i = 0; // sensible default
|
||||||
@@ -554,7 +578,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
|
|
||||||
if (listenmobj[i])
|
if (listenmobj[i])
|
||||||
{
|
{
|
||||||
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, &pitch, sfx);
|
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!audible)
|
if (!audible)
|
||||||
@@ -574,12 +598,6 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
sfx->data = I_GetSfx(sfx);
|
sfx->data = I_GetSfx(sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// increase the usefulness
|
|
||||||
if (sfx->usefulness++ < 0)
|
|
||||||
{
|
|
||||||
sfx->usefulness = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid channel reverse if surround
|
// Avoid channel reverse if surround
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
@@ -598,7 +616,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
channels[cnum].sfxinfo = sfx;
|
channels[cnum].sfxinfo = sfx;
|
||||||
channels[cnum].origin = origin;
|
channels[cnum].origin = origin;
|
||||||
channels[cnum].volume = initial_volume;
|
channels[cnum].volume = initial_volume;
|
||||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, cnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,7 +625,7 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
|||||||
if (S_SoundDisabled())
|
if (S_SoundDisabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mariomode) // Sounds change in Mario mode!
|
if (UNLIKELY(mariomode)) // Sounds change in Mario mode!
|
||||||
{
|
{
|
||||||
switch (sfx_id)
|
switch (sfx_id)
|
||||||
{
|
{
|
||||||
@@ -630,7 +648,8 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maptol & TOL_XMAS) // Some sounds change for xmas
|
|
||||||
|
if (UNLIKELY(maptol & TOL_XMAS)) // Some sounds change for xmas
|
||||||
{
|
{
|
||||||
switch (sfx_id)
|
switch (sfx_id)
|
||||||
{
|
{
|
||||||
@@ -677,7 +696,7 @@ static INT32 actualmidimusicvolume;
|
|||||||
|
|
||||||
void S_UpdateSounds(void)
|
void S_UpdateSounds(void)
|
||||||
{
|
{
|
||||||
INT32 cnum, volume, sep, pitch;
|
INT32 cnum, volume, sep;
|
||||||
boolean audible = false;
|
boolean audible = false;
|
||||||
channel_t *c;
|
channel_t *c;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
@@ -687,14 +706,16 @@ void S_UpdateSounds(void)
|
|||||||
|
|
||||||
// Update sound/music volumes, if changed manually at console
|
// Update sound/music volumes, if changed manually at console
|
||||||
if (actualsfxvolume != cv_soundvolume.value)
|
if (actualsfxvolume != cv_soundvolume.value)
|
||||||
S_SetSfxVolume (cv_soundvolume.value);
|
S_SetSfxVolume(cv_soundvolume.value);
|
||||||
if (actualdigmusicvolume != cv_digmusicvolume.value)
|
if (actualdigmusicvolume != cv_digmusicvolume.value)
|
||||||
S_SetDigMusicVolume (cv_digmusicvolume.value);
|
S_SetDigMusicVolume(cv_digmusicvolume.value);
|
||||||
#ifndef NO_MIDI
|
#ifndef NO_MIDI
|
||||||
if (actualmidimusicvolume != cv_midimusicvolume.value)
|
if (actualmidimusicvolume != cv_midimusicvolume.value)
|
||||||
S_SetMIDIMusicVolume (cv_midimusicvolume.value);
|
S_SetMIDIMusicVolume(cv_midimusicvolume.value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
memset(listener, 0, sizeof(listener));
|
||||||
|
|
||||||
// We're done now, if we're not in a level.
|
// We're done now, if we're not in a level.
|
||||||
if (gamestate != GS_LEVEL)
|
if (gamestate != GS_LEVEL)
|
||||||
{
|
{
|
||||||
@@ -714,7 +735,6 @@ void S_UpdateSounds(void)
|
|||||||
{
|
{
|
||||||
player_t *player = &players[displayplayers[i]];
|
player_t *player = &players[displayplayers[i]];
|
||||||
|
|
||||||
memset(&listener[i], 0, sizeof (listener[i]));
|
|
||||||
listenmobj[i] = NULL;
|
listenmobj[i] = NULL;
|
||||||
|
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
@@ -725,15 +745,6 @@ void S_UpdateSounds(void)
|
|||||||
{
|
{
|
||||||
listenmobj[i] = player->mo;
|
listenmobj[i] = player->mo;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NOMUMBLE
|
|
||||||
I_UpdateMumble(players[consoleplayer].mo, listener[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
|
||||||
{
|
|
||||||
player_t *player = &players[displayplayers[i]];
|
|
||||||
|
|
||||||
if (camera[i].chase && !player->awayviewtics)
|
if (camera[i].chase && !player->awayviewtics)
|
||||||
{
|
{
|
||||||
@@ -751,6 +762,10 @@ void S_UpdateSounds(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NOMUMBLE
|
||||||
|
I_UpdateMumble(players[consoleplayer].mo, listener[0]);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||||
{
|
{
|
||||||
c = &channels[cnum];
|
c = &channels[cnum];
|
||||||
@@ -761,7 +776,6 @@ void S_UpdateSounds(void)
|
|||||||
{
|
{
|
||||||
// initialize parameters
|
// initialize parameters
|
||||||
volume = c->volume; // 8 bits internal volume precision
|
volume = c->volume; // 8 bits internal volume precision
|
||||||
pitch = NORM_PITCH;
|
|
||||||
sep = NORM_SEP;
|
sep = NORM_SEP;
|
||||||
|
|
||||||
// check non-local sounds for distance clipping
|
// check non-local sounds for distance clipping
|
||||||
@@ -817,13 +831,13 @@ void S_UpdateSounds(void)
|
|||||||
{
|
{
|
||||||
audible = S_AdjustSoundParams(
|
audible = S_AdjustSoundParams(
|
||||||
listenmobj[i], c->origin,
|
listenmobj[i], c->origin,
|
||||||
&volume, &sep, &pitch,
|
&volume, &sep,
|
||||||
c->sfxinfo
|
c->sfxinfo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audible)
|
if (audible)
|
||||||
I_UpdateSoundParams(c->handle, volume, sep, pitch);
|
I_UpdateSoundParams(c->handle, volume, sep);
|
||||||
else
|
else
|
||||||
S_StopChannel(cnum);
|
S_StopChannel(cnum);
|
||||||
}
|
}
|
||||||
@@ -876,8 +890,6 @@ static void S_StopChannel(INT32 cnum)
|
|||||||
if (cnum != i && c->sfxinfo == channels[i].sfxinfo)
|
if (cnum != i && c->sfxinfo == channels[i].sfxinfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// degrade usefulness of sound data
|
|
||||||
c->sfxinfo->usefulness--;
|
|
||||||
c->sfxinfo = 0;
|
c->sfxinfo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,8 +930,7 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t
|
|||||||
// If the sound is not audible, returns a 0.
|
// If the sound is not audible, returns a 0.
|
||||||
// Otherwise, modifies parameters and returns 1.
|
// Otherwise, modifies parameters and returns 1.
|
||||||
//
|
//
|
||||||
boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch,
|
static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, sfxinfo_t *sfxinfo)
|
||||||
sfxinfo_t *sfxinfo)
|
|
||||||
{
|
{
|
||||||
const boolean reverse = (stereoreverse.value ^ encoremode);
|
const boolean reverse = (stereoreverse.value ^ encoremode);
|
||||||
|
|
||||||
@@ -928,8 +939,6 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
|||||||
listener_t listensource;
|
listener_t listensource;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
(void)pitch;
|
|
||||||
|
|
||||||
if (!listener)
|
if (!listener)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -962,13 +971,16 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Essentially check in a 1024 unit radius of the player for an outdoor area.
|
// Essentially check in a 1024 unit radius of the player for an outdoor area.
|
||||||
yl = listensource.y - 1024*FRACUNIT;
|
#define RADIUSSTEP (64*FRACUNIT)
|
||||||
yh = listensource.y + 1024*FRACUNIT;
|
#define SEARCHRADIUS (16*RADIUSSTEP)
|
||||||
xl = listensource.x - 1024*FRACUNIT;
|
yl = listensource.y - SEARCHRADIUS;
|
||||||
xh = listensource.x + 1024*FRACUNIT;
|
yh = listensource.y + SEARCHRADIUS;
|
||||||
approx_dist = 1024*FRACUNIT;
|
xl = listensource.x - SEARCHRADIUS;
|
||||||
for (y = yl; y <= yh; y += FRACUNIT*64)
|
xh = listensource.x + SEARCHRADIUS;
|
||||||
for (x = xl; x <= xh; x += FRACUNIT*64)
|
approx_dist = SEARCHRADIUS;
|
||||||
|
#undef SEARCHRADIUS
|
||||||
|
for (y = yl; y <= yh; y += RADIUSSTEP)
|
||||||
|
for (x = xl; x <= xh; x += RADIUSSTEP)
|
||||||
{
|
{
|
||||||
if (R_PointInSubsectorFast(x, y)->sector->ceilingpic == skyflatnum)
|
if (R_PointInSubsectorFast(x, y)->sector->ceilingpic == skyflatnum)
|
||||||
{
|
{
|
||||||
@@ -980,6 +992,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#undef RADIUSSTEP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -990,14 +1003,14 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
|||||||
|
|
||||||
// Ring loss, deaths, etc, should all be heard louder.
|
// Ring loss, deaths, etc, should all be heard louder.
|
||||||
if (sfxinfo->pitch & SF_X8AWAYSOUND)
|
if (sfxinfo->pitch & SF_X8AWAYSOUND)
|
||||||
approx_dist = FixedDiv(approx_dist,8*FRACUNIT);
|
approx_dist = FixedDiv(approx_dist, 8*FRACUNIT);
|
||||||
|
|
||||||
// Combine 8XAWAYSOUND with 4XAWAYSOUND and get.... 32XAWAYSOUND?
|
// Combine 8XAWAYSOUND with 4XAWAYSOUND and get.... 32XAWAYSOUND?
|
||||||
if (sfxinfo->pitch & SF_X4AWAYSOUND)
|
if (sfxinfo->pitch & SF_X4AWAYSOUND)
|
||||||
approx_dist = FixedDiv(approx_dist,4*FRACUNIT);
|
approx_dist = FixedDiv(approx_dist, 4*FRACUNIT);
|
||||||
|
|
||||||
if (sfxinfo->pitch & SF_X2AWAYSOUND)
|
if (sfxinfo->pitch & SF_X2AWAYSOUND)
|
||||||
approx_dist = FixedDiv(approx_dist,2*FRACUNIT);
|
approx_dist = FixedDiv(approx_dist, 2*FRACUNIT);
|
||||||
|
|
||||||
if (approx_dist > S_CLIPPING_DIST)
|
if (approx_dist > S_CLIPPING_DIST)
|
||||||
return false;
|
return false;
|
||||||
@@ -1030,7 +1043,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
|||||||
if (approx_dist >= S_CLOSE_DIST)
|
if (approx_dist >= S_CLOSE_DIST)
|
||||||
{
|
{
|
||||||
// distance effect
|
// distance effect
|
||||||
INT32 n = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS));
|
const INT32 n = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS));
|
||||||
*vol = FixedMul(*vol * FRACUNIT / 255, n) / S_ATTENUATOR;
|
*vol = FixedMul(*vol * FRACUNIT / 255, n) / S_ATTENUATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1146,7 +1159,6 @@ void S_InitSfxChannels(INT32 sfxVolume)
|
|||||||
// Note that sounds have not been cached (yet).
|
// Note that sounds have not been cached (yet).
|
||||||
for (i = 1; i < NUMSFX; i++)
|
for (i = 1; i < NUMSFX; i++)
|
||||||
{
|
{
|
||||||
S_sfx[i].usefulness = -1; // for I_GetSfx()
|
|
||||||
S_sfx[i].lumpnum = LUMPERROR;
|
S_sfx[i].lumpnum = LUMPERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1906,12 +1918,12 @@ void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SetRestoreMusicFadeInCvar (consvar_t *cv)
|
void S_SetRestoreMusicFadeInCvar(consvar_t *cv)
|
||||||
{
|
{
|
||||||
music_refade_cv = cv_birdmusic.value ? cv : 0;
|
music_refade_cv = cv_birdmusic.value ? cv : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int S_GetRestoreMusicFadeIn (void)
|
int S_GetRestoreMusicFadeIn(void)
|
||||||
{
|
{
|
||||||
if (music_refade_cv && cv_fading.value)
|
if (music_refade_cv && cv_fading.value)
|
||||||
return music_refade_cv->value;
|
return music_refade_cv->value;
|
||||||
@@ -2020,7 +2032,6 @@ void S_KeepMusic(void)
|
|||||||
if (oldmap == gamemap && oldencore == encoremode)
|
if (oldmap == gamemap && oldencore == encoremode)
|
||||||
{
|
{
|
||||||
const boolean musicchanged = S_CheckMusicException();
|
const boolean musicchanged = S_CheckMusicException();
|
||||||
|
|
||||||
resumekeepmusic = (musicchanged && keepmusic.resume);
|
resumekeepmusic = (musicchanged && keepmusic.resume);
|
||||||
keepmapmusic = (!musicchanged || resumekeepmusic);
|
keepmapmusic = (!musicchanged || resumekeepmusic);
|
||||||
}
|
}
|
||||||
@@ -2187,6 +2198,7 @@ static void Command_Tunes_f(void)
|
|||||||
mapmusic.name, (mapmusic.flags & MUSIC_TRACKMASK));
|
mapmusic.name, (mapmusic.flags & MUSIC_TRACKMASK));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(tunearg, "-none"))
|
if (!strcasecmp(tunearg, "-none"))
|
||||||
{
|
{
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
@@ -2205,6 +2217,7 @@ static void Command_Tunes_f(void)
|
|||||||
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
||||||
|
|
||||||
@@ -2214,12 +2227,11 @@ static void Command_Tunes_f(void)
|
|||||||
if (tunenum)
|
if (tunenum)
|
||||||
snprintf(mapmusic.name, 7, "%sM", G_BuildMapName(tunenum));
|
snprintf(mapmusic.name, 7, "%sM", G_BuildMapName(tunenum));
|
||||||
else
|
else
|
||||||
strncpy(mapmusic.name, tunearg, 7);
|
strlcpy(mapmusic.name, tunearg, sizeof(mapmusic.name));
|
||||||
|
|
||||||
if (argc > 4)
|
if (argc > 4)
|
||||||
position = (UINT32)atoi(COM_Argv(4));
|
position = (UINT32)atoi(COM_Argv(4));
|
||||||
|
|
||||||
mapmusic.name[6] = 0;
|
|
||||||
mapmusic.flags = (track & MUSIC_TRACKMASK);
|
mapmusic.flags = (track & MUSIC_TRACKMASK);
|
||||||
mapmusic.position = position;
|
mapmusic.position = position;
|
||||||
mapmusic.resume = 0;
|
mapmusic.resume = 0;
|
||||||
@@ -2246,7 +2258,7 @@ static void Command_RestartAudio_f(void)
|
|||||||
I_StartupSound();
|
I_StartupSound();
|
||||||
I_InitMusic();
|
I_InitMusic();
|
||||||
|
|
||||||
// These must be called or no sound and music until manually set.
|
// These must be called or no sound and music until manually set.
|
||||||
|
|
||||||
I_SetSfxVolume(cv_soundvolume.value);
|
I_SetSfxVolume(cv_soundvolume.value);
|
||||||
#ifdef NO_MIDI
|
#ifdef NO_MIDI
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ extern consvar_t stereoreverse;
|
|||||||
extern consvar_t cv_soundvolume, cv_digmusicvolume;//, cv_midimusicvolume;
|
extern consvar_t cv_soundvolume, cv_digmusicvolume;//, cv_midimusicvolume;
|
||||||
extern consvar_t cv_numChannels;
|
extern consvar_t cv_numChannels;
|
||||||
|
|
||||||
|
extern consvar_t cv_samesoundlimit;
|
||||||
|
|
||||||
extern consvar_t cv_audbuffersize;
|
extern consvar_t cv_audbuffersize;
|
||||||
//extern consvar_t cv_resetmusic;
|
//extern consvar_t cv_resetmusic;
|
||||||
extern consvar_t cv_gamedigimusic;
|
extern consvar_t cv_gamedigimusic;
|
||||||
|
|||||||
+5
-1
@@ -66,7 +66,9 @@ static void Highreshudscale_OnChange(void)
|
|||||||
|
|
||||||
static void SCR_ChangeFullscreen (void);
|
static void SCR_ChangeFullscreen (void);
|
||||||
|
|
||||||
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
|
static CV_PossibleValue_t fullscreen_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Borderless Window"}, {0, NULL}};
|
||||||
|
|
||||||
|
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, fullscreen_cons_t, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
static CV_PossibleValue_t accuratefps_cons_t[] = {{0, "Inaccurate"}, {1, "Accurate"}, {0, NULL}};
|
static CV_PossibleValue_t accuratefps_cons_t[] = {{0, "Inaccurate"}, {1, "Accurate"}, {0, NULL}};
|
||||||
consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
@@ -325,6 +327,8 @@ void SCR_SetDefaultMode(void)
|
|||||||
void SCR_ChangeFullscreen(void)
|
void SCR_ChangeFullscreen(void)
|
||||||
{
|
{
|
||||||
#ifdef DIRECTFULLSCREEN
|
#ifdef DIRECTFULLSCREEN
|
||||||
|
I_SetBorderlessWindow(); // Running this here so we can have borderless window at startup
|
||||||
|
|
||||||
// allow_fullscreen is set by VID_PrepareModeList
|
// allow_fullscreen is set by VID_PrepareModeList
|
||||||
// it is used to prevent switching to fullscreen during startup
|
// it is used to prevent switching to fullscreen during startup
|
||||||
if (!allow_fullscreen)
|
if (!allow_fullscreen)
|
||||||
|
|||||||
+14
-5
@@ -1806,13 +1806,22 @@ void I_SleepDuration(precise_t duration)
|
|||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__)
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__)
|
||||||
UINT64 precision = I_GetPrecisePrecision();
|
UINT64 precision = I_GetPrecisePrecision();
|
||||||
struct timespec ts = {
|
precise_t dest = I_GetPreciseTime() + duration;
|
||||||
|
precise_t slack = (precision / 5000); // 0.2 ms slack
|
||||||
|
if (duration > slack)
|
||||||
|
{
|
||||||
|
duration -= slack;
|
||||||
|
struct timespec ts = {
|
||||||
.tv_sec = static_cast<__time_t>(duration / precision),
|
.tv_sec = static_cast<__time_t>(duration / precision),
|
||||||
.tv_nsec = static_cast<__syscall_slong_t>(duration * 1000000000 / precision % 1000000000),
|
.tv_nsec = static_cast<__syscall_slong_t>(duration * 1000000000 / precision % 1000000000),
|
||||||
};
|
};
|
||||||
int status;
|
int status;
|
||||||
do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
|
do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
|
||||||
while (status == EINTR);
|
while (status == EINTR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// busy-wait the rest
|
||||||
|
while (((INT64)dest - (INT64)I_GetPreciseTime()) > 0);
|
||||||
#elif defined (MIN_SLEEP_DURATION_MS)
|
#elif defined (MIN_SLEEP_DURATION_MS)
|
||||||
UINT64 precision = I_GetPrecisePrecision();
|
UINT64 precision = I_GetPrecisePrecision();
|
||||||
INT32 sleepvalue = cv_sleep.value;
|
INT32 sleepvalue = cv_sleep.value;
|
||||||
|
|||||||
+10
-1
@@ -150,7 +150,7 @@ UINT8 graphics_started = 0; // Is used in console.c and screen.c
|
|||||||
// To disable fullscreen at startup; is set in VID_PrepareModeList
|
// To disable fullscreen at startup; is set in VID_PrepareModeList
|
||||||
boolean allow_fullscreen = false;
|
boolean allow_fullscreen = false;
|
||||||
static SDL_bool disable_fullscreen = SDL_FALSE;
|
static SDL_bool disable_fullscreen = SDL_FALSE;
|
||||||
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value
|
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)? 0: (cv_fullscreen.value == 1)
|
||||||
static SDL_bool disable_mouse = SDL_FALSE;
|
static SDL_bool disable_mouse = SDL_FALSE;
|
||||||
#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus)
|
#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus)
|
||||||
#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
|
#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
|
||||||
@@ -1353,6 +1353,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
|||||||
{
|
{
|
||||||
wasfullscreen = SDL_TRUE;
|
wasfullscreen = SDL_TRUE;
|
||||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
I_SetBorderlessWindow();
|
||||||
}
|
}
|
||||||
else // windowed mode
|
else // windowed mode
|
||||||
{
|
{
|
||||||
@@ -1360,6 +1361,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
|||||||
{
|
{
|
||||||
wasfullscreen = SDL_FALSE;
|
wasfullscreen = SDL_FALSE;
|
||||||
SDL_SetWindowFullscreen(window, 0);
|
SDL_SetWindowFullscreen(window, 0);
|
||||||
|
I_SetBorderlessWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reposition window only in windowed mode
|
// Reposition window only in windowed mode
|
||||||
@@ -1379,6 +1381,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
|||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
I_SetBorderlessWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2157,4 +2160,10 @@ static void Impl_SetVsync(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I_SetBorderlessWindow(void)
|
||||||
|
{
|
||||||
|
SDL_bool borderless = (cv_fullscreen.value == 2) ? SDL_FALSE : SDL_TRUE;
|
||||||
|
SDL_SetWindowBordered(window, borderless);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+7
-10
@@ -80,7 +80,7 @@ write netcode into the sound code, OKAY?
|
|||||||
#define GME_BASS 1.0f
|
#define GME_BASS 1.0f
|
||||||
#endif // HAVE_GME
|
#endif // HAVE_GME
|
||||||
|
|
||||||
|
|
||||||
//static UINT16 BUFFERSIZE = 2048;
|
//static UINT16 BUFFERSIZE = 2048;
|
||||||
static UINT16 SAMPLERATE = 44100;
|
static UINT16 SAMPLERATE = 44100;
|
||||||
|
|
||||||
@@ -528,14 +528,12 @@ void I_FreeSfx(sfxinfo_t *sfx)
|
|||||||
sfx->lumpnum = LUMPERROR;
|
sfx->lumpnum = LUMPERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, INT32 channel)
|
||||||
{
|
{
|
||||||
UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
|
UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
|
||||||
INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0);
|
INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0);
|
||||||
Mix_Volume(handle, volume);
|
Mix_Volume(handle, volume);
|
||||||
Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
|
Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
|
||||||
(void)pitch; // Mixer can't handle pitch
|
|
||||||
(void)priority; // priority and channel management is handled by SRB2...
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,12 +547,11 @@ boolean I_SoundIsPlaying(INT32 handle)
|
|||||||
return Mix_Playing(handle);
|
return Mix_Playing(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
|
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep)
|
||||||
{
|
{
|
||||||
UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
|
UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
|
||||||
Mix_Volume(handle, volume);
|
Mix_Volume(handle, volume);
|
||||||
Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
|
Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
|
||||||
(void)pitch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_SetSfxVolume(UINT8 volume)
|
void I_SetSfxVolume(UINT8 volume)
|
||||||
@@ -710,7 +707,7 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
|
|||||||
|
|
||||||
// play gme into stream
|
// play gme into stream
|
||||||
gme_play(gme, len/2, (short *)stream);
|
gme_play(gme, len/2, (short *)stream);
|
||||||
|
|
||||||
// Limiter to prevent music from being disorted with some formats
|
// Limiter to prevent music from being disorted with some formats
|
||||||
if (music_volume >= 18)
|
if (music_volume >= 18)
|
||||||
music_volume = 18;
|
music_volume = 18;
|
||||||
@@ -726,7 +723,7 @@ static void mix_openmpt(void *udata, Uint8 *stream, int len)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
short *p;
|
short *p;
|
||||||
|
|
||||||
(void)udata;
|
(void)udata;
|
||||||
|
|
||||||
if (!openmpt_mhandle || songpaused)
|
if (!openmpt_mhandle || songpaused)
|
||||||
@@ -734,7 +731,7 @@ static void mix_openmpt(void *udata, Uint8 *stream, int len)
|
|||||||
|
|
||||||
// Play module into stream
|
// Play module into stream
|
||||||
openmpt_module_read_interleaved_stereo(openmpt_mhandle, SAMPLERATE, cv_audbuffersize.value, (short *)stream);
|
openmpt_module_read_interleaved_stereo(openmpt_mhandle, SAMPLERATE, cv_audbuffersize.value, (short *)stream);
|
||||||
|
|
||||||
// Limiter to prevent music from being disorted with some formats
|
// Limiter to prevent music from being disorted with some formats
|
||||||
if (music_volume >= 18)
|
if (music_volume >= 18)
|
||||||
music_volume = 18;
|
music_volume = 18;
|
||||||
@@ -823,7 +820,7 @@ boolean I_SetSongSpeed(float speed)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_OPENMPT
|
#ifdef HAVE_OPENMPT
|
||||||
if (openmpt_mhandle)
|
if (openmpt_mhandle)
|
||||||
{
|
{
|
||||||
if (speed > 4.0f)
|
if (speed > 4.0f)
|
||||||
speed = 4.0f; // Limit this to 4x to prevent crashing, stupid fix but... ~SteelT 27/9/19
|
speed = 4.0f; // Limit this to 4x to prevent crashing, stupid fix but... ~SteelT 27/9/19
|
||||||
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR < 5
|
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR < 5
|
||||||
|
|||||||
+1
-1
@@ -1079,7 +1079,7 @@ void I_StartupSound(void)
|
|||||||
{
|
{
|
||||||
#ifndef HAVE_MIXER
|
#ifndef HAVE_MIXER
|
||||||
#ifndef NO_MIDI
|
#ifndef NO_MIDI
|
||||||
midi_disabled =
|
midi_disabled =
|
||||||
#endif
|
#endif
|
||||||
digital_disabled = true;
|
digital_disabled = true;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+888
-891
File diff suppressed because it is too large.
Load diff
@@ -78,9 +78,6 @@ struct sfxinfo_struct
|
|||||||
// pitch if a link
|
// pitch if a link
|
||||||
INT32 pitch;
|
INT32 pitch;
|
||||||
|
|
||||||
// volume if a link
|
|
||||||
INT32 volume;
|
|
||||||
|
|
||||||
// sound data
|
// sound data
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
@@ -91,11 +88,6 @@ struct sfxinfo_struct
|
|||||||
// 0 up to (NUMSKINSOUNDS-1), -1 = not skin specifc
|
// 0 up to (NUMSKINSOUNDS-1), -1 = not skin specifc
|
||||||
INT32 skinsound;
|
INT32 skinsound;
|
||||||
|
|
||||||
// this is checked every second to see if sound
|
|
||||||
// can be thrown out (if 0, then decrement, if -1,
|
|
||||||
// then throw out, if > 0, then it is in use)
|
|
||||||
INT32 usefulness;
|
|
||||||
|
|
||||||
// lump number of sfx
|
// lump number of sfx
|
||||||
lumpnum_t lumpnum;
|
lumpnum_t lumpnum;
|
||||||
};
|
};
|
||||||
|
|||||||
+75
-47
@@ -126,6 +126,10 @@ void W_Shutdown(void)
|
|||||||
Z_Free(wad->lumpinfo[wad->numlumps].longname);
|
Z_Free(wad->lumpinfo[wad->numlumps].longname);
|
||||||
Z_Free(wad->lumpinfo[wad->numlumps].fullname);
|
Z_Free(wad->lumpinfo[wad->numlumps].fullname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M_AATreeFree(wad->startfolders);
|
||||||
|
M_AATreeFree(wad->endfolders);
|
||||||
|
|
||||||
Z_Free(wad->lumpinfo);
|
Z_Free(wad->lumpinfo);
|
||||||
Z_Free(wad);
|
Z_Free(wad);
|
||||||
}
|
}
|
||||||
@@ -338,6 +342,11 @@ static void W_InvalidateLumpnumCache(void)
|
|||||||
memset(lumpnumcache, 0, sizeof (lumpnumcache));
|
memset(lumpnumcache, 0, sizeof (lumpnumcache));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT32 W_HashLumpName(const char *name)
|
||||||
|
{
|
||||||
|
return FNV1a_HashLowercaseString(name);
|
||||||
|
}
|
||||||
|
|
||||||
/** Detect a file type.
|
/** Detect a file type.
|
||||||
* \todo Actually detect the wad/pkzip headers and whatnot, instead of just checking the extensions.
|
* \todo Actually detect the wad/pkzip headers and whatnot, instead of just checking the extensions.
|
||||||
*/
|
*/
|
||||||
@@ -362,11 +371,24 @@ static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const
|
|||||||
fseek(handle, 0, SEEK_END);
|
fseek(handle, 0, SEEK_END);
|
||||||
lumpinfo->size = ftell(handle);
|
lumpinfo->size = ftell(handle);
|
||||||
fseek(handle, 0, SEEK_SET);
|
fseek(handle, 0, SEEK_SET);
|
||||||
strlcpy(lumpinfo->name, lumpname, 9);
|
|
||||||
|
|
||||||
// Allocate the lump's full and long name.
|
strlcpy(lumpinfo->name, lumpname, sizeof(lumpinfo->name));
|
||||||
lumpinfo->fullname = Z_StrDup(lumpname);
|
lumpinfo->namelength = strlen(lumpinfo->name);
|
||||||
lumpinfo->longname = Z_StrDup(lumpname);
|
lumpinfo->hash.name = W_HashLumpName(lumpname);
|
||||||
|
|
||||||
|
// Allocate the lump's long name.
|
||||||
|
lumpinfo->longname = Z_Malloc((lumpinfo->namelength + 1) * sizeof(char), PU_STATIC, NULL);
|
||||||
|
strcpy(lumpinfo->longname, lumpname);
|
||||||
|
lumpinfo->longname[lumpinfo->namelength] = '\0';
|
||||||
|
lumpinfo->longnamelength = lumpinfo->namelength;
|
||||||
|
lumpinfo->hash.longname = lumpinfo->hash.name;
|
||||||
|
|
||||||
|
// Allocate the lump's full name.
|
||||||
|
lumpinfo->fullname = Z_Malloc((lumpinfo->namelength + 1) * sizeof(char), PU_STATIC, NULL);
|
||||||
|
strcpy(lumpinfo->fullname, lumpname);
|
||||||
|
lumpinfo->fullname[lumpinfo->namelength] = '\0';
|
||||||
|
lumpinfo->fullnamelength = lumpinfo->namelength;
|
||||||
|
lumpinfo->hash.fullname = lumpinfo->hash.name;
|
||||||
|
|
||||||
*numlumps = 1;
|
*numlumps = 1;
|
||||||
return lumpinfo;
|
return lumpinfo;
|
||||||
@@ -454,16 +476,22 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
|
|||||||
lump_p->compression = CM_NOCOMPRESSION;
|
lump_p->compression = CM_NOCOMPRESSION;
|
||||||
memset(lump_p->name, 0x00, 9);
|
memset(lump_p->name, 0x00, 9);
|
||||||
strncpy(lump_p->name, fileinfo->name, 8);
|
strncpy(lump_p->name, fileinfo->name, 8);
|
||||||
|
lump_p->namelength = strlen(lump_p->name);
|
||||||
|
lump_p->hash.name = W_HashLumpName(lump_p->name);
|
||||||
|
|
||||||
// Allocate the lump's long name.
|
// Allocate the lump's long name.
|
||||||
lump_p->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
lump_p->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
||||||
strncpy(lump_p->longname, fileinfo->name, 8);
|
strncpy(lump_p->longname, fileinfo->name, 8);
|
||||||
lump_p->longname[8] = '\0';
|
lump_p->longname[8] = '\0';
|
||||||
|
lump_p->longnamelength = lump_p->namelength;
|
||||||
|
lump_p->hash.longname = lump_p->hash.name;
|
||||||
|
|
||||||
// Allocate the lump's full name.
|
// Allocate the lump's full name.
|
||||||
lump_p->fullname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
lump_p->fullname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
||||||
strncpy(lump_p->fullname, fileinfo->name, 8);
|
strncpy(lump_p->fullname, fileinfo->name, 8);
|
||||||
lump_p->fullname[8] = '\0';
|
lump_p->fullname[8] = '\0';
|
||||||
|
lump_p->fullnamelength = lump_p->namelength;
|
||||||
|
lump_p->hash.fullname = lump_p->hash.name;
|
||||||
}
|
}
|
||||||
free(fileinfov);
|
free(fileinfov);
|
||||||
*nlmp = numlumps;
|
*nlmp = numlumps;
|
||||||
@@ -656,12 +684,18 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
|||||||
|
|
||||||
memset(lump_p->name, '\0', 9); // Making sure they're initialized to 0. Is it necessary?
|
memset(lump_p->name, '\0', 9); // Making sure they're initialized to 0. Is it necessary?
|
||||||
strncpy(lump_p->name, trimname, min(8, dotpos - trimname));
|
strncpy(lump_p->name, trimname, min(8, dotpos - trimname));
|
||||||
|
lump_p->namelength = strlen(lump_p->name);
|
||||||
|
lump_p->hash.name = W_HashLumpName(lump_p->name);
|
||||||
|
|
||||||
lump_p->longname = Z_Calloc(dotpos - trimname + 1, PU_STATIC, NULL);
|
lump_p->longname = Z_Calloc(dotpos - trimname + 1, PU_STATIC, NULL);
|
||||||
strlcpy(lump_p->longname, trimname, dotpos - trimname + 1);
|
strlcpy(lump_p->longname, trimname, dotpos - trimname + 1);
|
||||||
|
lump_p->longnamelength = strlen(lump_p->longname);
|
||||||
|
lump_p->hash.longname = W_HashLumpName(lump_p->longname);
|
||||||
|
|
||||||
lump_p->fullname = (char*)(Z_Calloc(SHORT(zentry->namelen) + 1, PU_STATIC, NULL));
|
lump_p->fullname = (char*)(Z_Calloc(SHORT(zentry->namelen) + 1, PU_STATIC, NULL));
|
||||||
strncpy(lump_p->fullname, fullname, SHORT(zentry->namelen));
|
strncpy(lump_p->fullname, fullname, SHORT(zentry->namelen));
|
||||||
|
lump_p->fullnamelength = zentry->namelen;
|
||||||
|
lump_p->hash.fullname = W_HashLumpName(lump_p->fullname);
|
||||||
|
|
||||||
switch(SHORT(zentry->compression))
|
switch(SHORT(zentry->compression))
|
||||||
{
|
{
|
||||||
@@ -817,6 +851,8 @@ UINT16 W_InitFile(const char *filename, boolean local)
|
|||||||
fseek(handle, 0, SEEK_END);
|
fseek(handle, 0, SEEK_END);
|
||||||
wadfile->filesize = (unsigned)ftell(handle);
|
wadfile->filesize = (unsigned)ftell(handle);
|
||||||
wadfile->type = type;
|
wadfile->type = type;
|
||||||
|
wadfile->startfolders = M_AATreeAlloc(0);
|
||||||
|
wadfile->endfolders = M_AATreeAlloc(0);
|
||||||
|
|
||||||
// already generated, just copy it over
|
// already generated, just copy it over
|
||||||
M_Memcpy(&wadfile->md5sum, &md5sum, 16);
|
M_Memcpy(&wadfile->md5sum, &md5sum, 16);
|
||||||
@@ -872,7 +908,6 @@ UINT16 W_InitFile(const char *filename, boolean local)
|
|||||||
return wadfile->numlumps;
|
return wadfile->numlumps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Tries to load a series of files.
|
/** Tries to load a series of files.
|
||||||
* All files are wads unless they have an extension of ".soc" or ".lua".
|
* All files are wads unless they have an extension of ".soc" or ".lua".
|
||||||
*
|
*
|
||||||
@@ -976,6 +1011,8 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
static char uname[9];
|
static char uname[9];
|
||||||
|
UINT32 hash;
|
||||||
|
size_t namelen;
|
||||||
|
|
||||||
if (!TestValidLump(wad,0))
|
if (!TestValidLump(wad,0))
|
||||||
return INT16_MAX;
|
return INT16_MAX;
|
||||||
@@ -983,6 +1020,8 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||||||
memset(uname, 0, sizeof uname);
|
memset(uname, 0, sizeof uname);
|
||||||
strncpy(uname, name, sizeof(uname)-1);
|
strncpy(uname, name, sizeof(uname)-1);
|
||||||
strupr(uname);
|
strupr(uname);
|
||||||
|
namelen = strlen(uname);
|
||||||
|
hash = W_HashLumpName(uname);
|
||||||
|
|
||||||
//
|
//
|
||||||
// scan forward
|
// scan forward
|
||||||
@@ -993,7 +1032,9 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||||||
{
|
{
|
||||||
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
||||||
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
||||||
if (memcmp(lump_p->name, uname, sizeof(uname) - 1) == 0)
|
if (lump_p->namelength == namelen
|
||||||
|
&& lump_p->hash.name == hash
|
||||||
|
&& !memcmp(lump_p->name, uname, sizeof(uname) - 1))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,13 +1051,12 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||||||
UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
static char uname[256 + 1];
|
|
||||||
|
|
||||||
if (!TestValidLump(wad,0))
|
if (!TestValidLump(wad,0))
|
||||||
return INT16_MAX;
|
return INT16_MAX;
|
||||||
|
|
||||||
strlcpy(uname, name, sizeof uname);
|
size_t namelen = strlen(name);
|
||||||
strupr(uname);
|
UINT32 hash = W_HashLumpName(name);
|
||||||
|
|
||||||
//
|
//
|
||||||
// scan forward
|
// scan forward
|
||||||
@@ -1027,7 +1067,9 @@ UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
|||||||
{
|
{
|
||||||
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
||||||
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
||||||
if (!strcmp(lump_p->longname, uname))
|
if (lump_p->longnamelength == namelen
|
||||||
|
&& lump_p->hash.longname == hash
|
||||||
|
&& !stricmp(lump_p->longname, name))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1051,6 +1093,12 @@ UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlum
|
|||||||
INT32 i;
|
INT32 i;
|
||||||
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
||||||
name_length = strlen(name);
|
name_length = strlen(name);
|
||||||
|
UINT32 hash = quickncasehash(name, name_length);
|
||||||
|
|
||||||
|
void *val = M_AATreeGet(wadfiles[wad]->startfolders, hash);
|
||||||
|
if (val != NULL)
|
||||||
|
return (uintptr_t)val;
|
||||||
|
|
||||||
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
||||||
{
|
{
|
||||||
if (strnicmp(name, lump_p->fullname, name_length) == 0)
|
if (strnicmp(name, lump_p->fullname, name_length) == 0)
|
||||||
@@ -1058,10 +1106,16 @@ UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlum
|
|||||||
/* SLADE is special and puts a single directory entry. Skip that. */
|
/* SLADE is special and puts a single directory entry. Skip that. */
|
||||||
if (strlen(lump_p->fullname) == name_length)
|
if (strlen(lump_p->fullname) == name_length)
|
||||||
i++;
|
i++;
|
||||||
break;
|
|
||||||
|
M_AATreeSet(wadfiles[wad]->startfolders, hash, (void *)(uintptr_t)i);
|
||||||
|
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i;
|
|
||||||
|
M_AATreeSet(wadfiles[wad]->startfolders, hash, (void *)INT16_MAX);
|
||||||
|
|
||||||
|
return INT16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In a PK3 type of resource file, it looks for the next lumpinfo entry that doesn't share the specified pathfile.
|
// In a PK3 type of resource file, it looks for the next lumpinfo entry that doesn't share the specified pathfile.
|
||||||
@@ -1072,11 +1126,20 @@ UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump)
|
|||||||
INT32 i;
|
INT32 i;
|
||||||
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
||||||
size_t name_length = strlen(name);
|
size_t name_length = strlen(name);
|
||||||
|
UINT32 hash = quickncasehash(name, name_length);
|
||||||
|
|
||||||
|
void *val = M_AATreeGet(wadfiles[wad]->endfolders, hash);
|
||||||
|
if (val != NULL)
|
||||||
|
return (uintptr_t)val;
|
||||||
|
|
||||||
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
||||||
{
|
{
|
||||||
if (strnicmp(name, lump_p->fullname, name_length))
|
if (strnicmp(name, lump_p->fullname, name_length))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M_AATreeSet(wadfiles[wad]->endfolders, hash, (void *)(uintptr_t)i);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,41 +1264,6 @@ lumpnum_t W_CheckNumForLongName(const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for valid map data through all added files in descendant order.
|
|
||||||
// Get a map marker for WADs, and a standalone WAD file lump inside PK3s.
|
|
||||||
// TODO: Make it search through cache first, maybe...?
|
|
||||||
lumpnum_t W_CheckNumForMap(const char *name)
|
|
||||||
{
|
|
||||||
UINT16 lumpNum, end;
|
|
||||||
UINT32 i;
|
|
||||||
for (i = numwadfiles - 1; i < numwadfiles; i--)
|
|
||||||
{
|
|
||||||
if (wadfiles[i]->type == RET_WAD)
|
|
||||||
{
|
|
||||||
for (lumpNum = 0; lumpNum < wadfiles[i]->numlumps; lumpNum++)
|
|
||||||
if (!strncmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
|
|
||||||
return (i<<16) + lumpNum;
|
|
||||||
}
|
|
||||||
else if (wadfiles[i]->type == RET_PK3)
|
|
||||||
{
|
|
||||||
lumpNum = W_CheckNumForFolderStartPK3("maps/", i, 0);
|
|
||||||
if (lumpNum != INT16_MAX)
|
|
||||||
end = W_CheckNumForFolderEndPK3("maps/", i, lumpNum);
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
// Now look for the specified map.
|
|
||||||
for (; lumpNum < end; lumpNum++)
|
|
||||||
if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
|
|
||||||
{
|
|
||||||
const char *extension = strrchr(wadfiles[i]->lumpinfo[lumpNum].fullname, '.');
|
|
||||||
if (!(extension && stricmp(extension, ".wad")))
|
|
||||||
return (i<<16) + lumpNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return LUMPERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// W_GetNumForName
|
// W_GetNumForName
|
||||||
//
|
//
|
||||||
|
|||||||
+17
-1
@@ -22,6 +22,8 @@ extern "C" {
|
|||||||
#include "hardware/hw_data.h"
|
#include "hardware/hw_data.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "m_aatree.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
@@ -75,8 +77,19 @@ typedef struct
|
|||||||
char name[9]; // filelump_t name[] e.g. "LongEntr"
|
char name[9]; // filelump_t name[] e.g. "LongEntr"
|
||||||
char *longname; // e.g. "LongEntryName"
|
char *longname; // e.g. "LongEntryName"
|
||||||
char *fullname; // e.g. "Folder/Subfolder/LongEntryName.extension"
|
char *fullname; // e.g. "Folder/Subfolder/LongEntryName.extension"
|
||||||
|
|
||||||
|
size_t namelength; // length of name
|
||||||
|
size_t longnamelength; // length of longname
|
||||||
|
size_t fullnamelength; // length of fullname
|
||||||
|
|
||||||
size_t size; // real (uncompressed) size
|
size_t size; // real (uncompressed) size
|
||||||
compmethod compression; // lump compression method
|
compmethod compression; // lump compression method
|
||||||
|
|
||||||
|
struct {
|
||||||
|
UINT32 name; // hash of name
|
||||||
|
UINT32 longname; // hash of longname
|
||||||
|
UINT32 fullname; // hash of fullname
|
||||||
|
} hash;
|
||||||
} lumpinfo_t;
|
} lumpinfo_t;
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
@@ -131,6 +144,8 @@ typedef struct wadfile_s
|
|||||||
#ifdef ROTSPRITE
|
#ifdef ROTSPRITE
|
||||||
lumpcache_t *rotcache; // Cache rotsprites for rotating patches.
|
lumpcache_t *rotcache; // Cache rotsprites for rotating patches.
|
||||||
#endif
|
#endif
|
||||||
|
aatree_t *startfolders;
|
||||||
|
aatree_t *endfolders;
|
||||||
UINT16 numlumps; // this wad's number of resources
|
UINT16 numlumps; // this wad's number of resources
|
||||||
FILE *handle;
|
FILE *handle;
|
||||||
UINT32 filesize; // for network
|
UINT32 filesize; // for network
|
||||||
@@ -167,6 +182,8 @@ INT32 W_AddAutoloadedLocalFiles(char **filenames);
|
|||||||
|
|
||||||
#define W_FileHasFolders(wadfile) ((wadfile)->type == RET_PK3)
|
#define W_FileHasFolders(wadfile) ((wadfile)->type == RET_PK3)
|
||||||
|
|
||||||
|
UINT32 W_HashLumpName(const char *name);
|
||||||
|
|
||||||
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
||||||
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
||||||
|
|
||||||
@@ -180,7 +197,6 @@ UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump);
|
|||||||
UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump);
|
UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||||
UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
|
UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||||
|
|
||||||
lumpnum_t W_CheckNumForMap(const char *name);
|
|
||||||
lumpnum_t W_CheckNumForName(const char *name);
|
lumpnum_t W_CheckNumForName(const char *name);
|
||||||
lumpnum_t W_CheckNumForLongName(const char *name);
|
lumpnum_t W_CheckNumForLongName(const char *name);
|
||||||
lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR
|
lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR
|
||||||
|
|||||||
Reference in new issue
Block a user