Compare commits
410
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
677e381a2c | ||
|
|
01b24e5417 | ||
|
|
f86a99cd1b | ||
|
|
85cac497ea | ||
|
|
92d6c2b7b0 | ||
|
|
f67f8e7dbf | ||
|
|
6adf39b460 | ||
|
|
e160427108 | ||
|
|
275d28c9c6 | ||
|
|
2a848e32e4 | ||
|
|
6af09bd215 | ||
|
|
015d9208e3 | ||
|
|
94d01d1ee9 | ||
|
|
7e5acd72c1 | ||
|
|
6017543666 | ||
|
|
3af0009453 | ||
|
|
145eecf8a4 | ||
|
|
684a43a95c | ||
|
|
4fcb41f659 | ||
|
|
8d1ef1721f | ||
|
|
02ffceb300 | ||
|
|
44fe156751 | ||
|
|
aca48d69cd | ||
|
|
294ce055cd | ||
|
|
4117eb5b40 | ||
|
|
a9068ee162 | ||
|
|
9549a204a5 | ||
|
|
c276736002 | ||
|
|
b5dfe74cfe | ||
|
|
6c891f1146 | ||
|
|
7d06f59da5 | ||
|
|
9dee0f0ea8 | ||
|
|
9338b5b10f | ||
|
|
b7ecffedcd | ||
|
|
7deeb4486f | ||
|
|
602bd1a010 | ||
|
|
f57b8092fc | ||
|
|
ca04e084a2 | ||
|
|
ff6279a406 | ||
|
|
c36f64e97b | ||
|
|
7b776f01bd | ||
|
|
43b7492300 | ||
|
|
1fe79fe236 | ||
|
|
222b63d2c3 | ||
|
|
a7c41b458a | ||
|
|
3901c7c7da | ||
|
|
932a08b2da | ||
|
|
4c97a4f9e0 | ||
|
|
a1d16b4613 | ||
|
|
16e1e00c67 | ||
|
|
b76fc9699a | ||
|
|
cb3638e3ab | ||
|
|
e85d91e682 | ||
|
|
2653b59af4 | ||
|
|
caff071a1b | ||
|
|
40165fd6db | ||
|
|
c701e1fe7e | ||
|
|
525e19566e | ||
|
|
27e734bde0 | ||
|
|
bd53786887 | ||
|
|
ad1b1eabe4 | ||
|
|
e120907e0f | ||
|
|
b0c217201e | ||
|
|
dac7026739 | ||
|
|
91a4646f19 | ||
|
|
eba5965220 | ||
|
|
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 | ||
|
|
48d9b2bc98 | ||
|
|
939bf588b3 | ||
|
|
cb2e017bcf | ||
|
|
d91fbf5d36 | ||
|
|
9859e43be7 | ||
|
|
306fec6f9e | ||
|
|
3e8b3e868b | ||
|
|
9261d9c5b2 | ||
|
|
f97941f86e | ||
|
|
a4810bd6c8 | ||
|
|
93cbba218a | ||
|
|
e749346f0c | ||
|
|
a658883664 | ||
|
|
d94c10014f | ||
|
|
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 | ||
|
|
9fb3f4c9a3 | ||
|
|
9a60441e54 | ||
|
|
a61b028e97 | ||
|
|
29cf728fac | ||
|
|
3c78c5c57d | ||
|
|
7f3f332821 | ||
|
|
38576082fb | ||
|
|
4a4b5661f2 | ||
|
|
1e879dc432 | ||
|
|
e29bdd09c5 | ||
|
|
f3c8ff19b9 | ||
|
|
fdd19632bf | ||
|
|
74b082760d | ||
|
|
4460fa608b | ||
|
|
949192c570 | ||
|
|
4fa0ca2304 | ||
|
|
d9d2f043fa | ||
|
|
1ea51f29c5 | ||
|
|
b0653416f6 | ||
|
|
efc4a513ce | ||
|
|
b13793b2a4 | ||
|
|
e102d218ff | ||
|
|
20cdec33fb | ||
|
|
12d4a6d291 | ||
|
|
d2b1ff595d | ||
|
|
03d79fba16 | ||
|
|
989c29f7a0 | ||
|
|
8a79c0a4e0 | ||
|
|
307c333c50 | ||
|
|
3ce8b9f09c | ||
|
|
4dbe637510 | ||
|
|
c0e97e7f43 | ||
|
|
37fc64e97d | ||
|
|
ca93f08230 | ||
|
|
3581ce811c | ||
|
|
b4570cbdaa | ||
|
|
f2dc344bf8 | ||
|
|
c0654448f0 | ||
|
|
2bf3912633 | ||
|
|
4d71fb8409 | ||
|
|
8543a099f4 | ||
|
|
9c6ec02b18 | ||
|
|
bb9118ee32 | ||
|
|
0411c40fae | ||
|
|
68cb96ab97 | ||
|
|
0159b8d0a3 | ||
|
|
aea3b49a51 | ||
|
|
1a6f775cc3 | ||
|
|
ddd192fad0 | ||
|
|
2e4fb32dac | ||
|
|
7d6e210625 | ||
|
|
3ca42ce42f | ||
|
|
e4e40cf049 | ||
|
|
d4f912e3b0 | ||
|
|
eec4443c95 | ||
|
|
b938c75892 | ||
|
|
455cb9ca24 | ||
|
|
24e7f5f864 | ||
|
|
298fa36c5d | ||
|
|
d31e9c5b55 | ||
|
|
30f53f398f | ||
|
|
eee217deec | ||
|
|
1847aac223 | ||
|
|
487ef6f1b9 | ||
|
|
14be968089 | ||
|
|
9f678263d0 | ||
|
|
a554b886c6 | ||
|
|
f2d68b075c | ||
|
|
dc24de3501 | ||
|
|
d2c73f072e | ||
|
|
96bc7f7aa6 | ||
|
|
bd48b24000 | ||
|
|
a26867bbdb | ||
|
|
8d570b7ba3 | ||
|
|
96f5a8adb3 | ||
|
|
3b34f0a972 | ||
|
|
fe5a0b7c64 | ||
|
|
2aa5324225 | ||
|
|
22f50402fe | ||
|
|
4e2f1bcf2b | ||
|
|
ca34b0c8d6 | ||
|
|
0df5ef996c | ||
|
|
4c0ea2695e | ||
|
|
48556ca428 | ||
|
|
cb0667921e | ||
|
|
52ab27a825 | ||
|
|
5db50bbaff | ||
|
|
416da7cdc8 | ||
|
|
f47057e800 | ||
|
|
090559a766 | ||
|
|
1a6a3de443 | ||
|
|
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 | ||
|
|
d1a6394e52 | ||
|
|
6f4e387061 | ||
|
|
33ef566fd2 | ||
|
|
eeecd954e2 | ||
|
|
ccb804a4ed | ||
|
|
a21029ee9e | ||
|
|
ccc90842a7 | ||
|
|
dc069d7bb5 | ||
|
|
f4a827dfc2 | ||
|
|
4f3232b6cc | ||
|
|
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 | ||
|
|
3685502edf | ||
|
|
9899747a7f | ||
|
|
d2a415380d | ||
|
|
dd7ffd7dfe | ||
|
|
770f9af5e1 | ||
|
|
c2ab5be8b8 | ||
|
|
b8ae656968 | ||
|
|
553b61e1f5 | ||
|
|
f87bcef079 | ||
|
|
c3458afe2b | ||
|
|
17bc8a4a36 | ||
|
|
b04f017ab6 | ||
|
|
083ddb6396 | ||
|
|
c3129742c3 | ||
|
|
877bd640f3 | ||
|
|
3233df9c6c | ||
|
|
9ad5f5189c | ||
|
|
c7718dea79 | ||
|
|
fa3dcdb24f | ||
|
|
311258dda0 | ||
|
|
a0f8816de7 | ||
|
|
c546b6225c | ||
|
|
f6c6621af8 | ||
|
|
5a0fb59b26 | ||
|
|
07c52e6af5 | ||
|
|
405c566038 | ||
|
|
78780799ea | ||
|
|
82b9457aa7 | ||
|
|
4e6abb39dd |
No files matched your search
+12
@@ -192,6 +192,18 @@ from `0` to `#musicdefs-1`, or string indices (which is equal to calling `S_Find
|
||||
Hook is called whenever `S_ShowMusicCredit` (either from game or mod) is called. Takes musicdef as only argument, returning true
|
||||
will overwrite vanilla behavior (not show music credit), can be used to implement custom music credit pop-ups.
|
||||
|
||||
## addHook("SetupVote", function(result, gt, secondgt, prevmap))
|
||||
|
||||
Hook is called whenever server sets up options for vote screen. `result` is table where lua can store options to,
|
||||
(for example, `result[1] = 1` will force green hills as first option), gt is current gametype, secondgt is
|
||||
alternative gametype picked for 3rd entry (for example, gt can be `GT_RACE`, and secondgt can be `GT_MATCH`)
|
||||
prevmap is the previous map that was played (small note - in game code, it is offset by -1, but for lua its offset back,
|
||||
so if previous gamemap was 1, prevmap would also be 1. Which means you can safely do mapheaderinfo[prevmap] to get info on previous map)
|
||||
|
||||
Limitations: currently, game can only change gametype for 3rd option in map (meaning for example, if current gametype is race, and you
|
||||
put battle map in first option, when it gets picked that map will be still run in race gametype). That means, game will only handle maps with
|
||||
different gametype if it is put in 3rd vote option.
|
||||
|
||||
# Other changes
|
||||
|
||||
## P_PlayRinglossSound(source, damager)
|
||||
|
||||
@@ -30,6 +30,24 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
0-Clause BSD License
|
||||
applies to:
|
||||
- qs22k
|
||||
Copyright (c) 2022, Raymond Gardner
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
curl License
|
||||
applies to:
|
||||
|
||||
+37
-9
@@ -49,7 +49,7 @@
|
||||
# Already enabled by default for 32-bit
|
||||
# Windows.
|
||||
# NOCURL=1 - Disable libcurl--HTTP capability.
|
||||
# NOGME=1 - Disable game music emu, retro VGM support.
|
||||
# NOLIBGME=1 - Disable game music emu, retro VGM support.
|
||||
# NOOPENMPT=1 - Disable module (tracker) music support.
|
||||
# NOMIXER=1 - Disable SDL Mixer (audio playback).
|
||||
# NOTHREADS=1 - Disable multithreading.
|
||||
@@ -131,9 +131,19 @@ endif
|
||||
include Makefile.d/util.mk
|
||||
|
||||
ifdef PREFIX
|
||||
ifdef USECLANG
|
||||
CC:=$(PREFIX)-clang
|
||||
CXX:=$(PREFIX)-clang++
|
||||
else
|
||||
CC:=$(PREFIX)-gcc
|
||||
CXX:=$(PREFIX)-g++
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef USECLANG
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
endif
|
||||
|
||||
OBJDUMP_OPTS?=--wide --source --line-numbers
|
||||
|
||||
@@ -236,7 +246,7 @@ endif
|
||||
# build with profiling information
|
||||
ifdef PROFILEMODE
|
||||
opts+=-pg
|
||||
libs+=-pg
|
||||
LDFLAGS+=-pg
|
||||
endif
|
||||
|
||||
ifdef DEBUGMODE
|
||||
@@ -246,26 +256,44 @@ debug_opts=-DNDEBUG
|
||||
opts+=-O3
|
||||
ifdef USELTO
|
||||
# compile with LTO
|
||||
ifdef MINGW
|
||||
opts+=-flto=auto -g
|
||||
LDFLAGS+=-flto=auto -g
|
||||
else
|
||||
opts+=-flto=auto
|
||||
libs+=-flto=auto
|
||||
LDFLAGS+=-flto=auto
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef USEASAN
|
||||
# compile with asan
|
||||
ifdef MINGW
|
||||
opts+=-fsanitize=address -g
|
||||
libs+=-fsanitize=address -g
|
||||
else
|
||||
opts+=-fsanitize=address
|
||||
libs+=-fsanitize=address
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CC),clang)
|
||||
LDFLAGS+= -fuse-ld=lld
|
||||
endif
|
||||
|
||||
# debug_opts also get passed to windres
|
||||
opts+=$(debug_opts)
|
||||
|
||||
opts+=$(foreach v,$(passthru_opts),$(if $($(v)),-D$(v)))
|
||||
|
||||
opts+=$(WFLAGS) $(CPPFLAGS) $(CFLAGS)
|
||||
cxxopts:=$(opts) $(CXXFLAGS) -std=c++17
|
||||
CXXFLAGS+=-std=c++17 # force c17 for c++ since most vpss run older ubuntu versions with old compilers
|
||||
|
||||
opts+=$(WFLAGS) $(CFLAGS)
|
||||
cxxopts:=$(opts) $(CXXFLAGS)
|
||||
opts+=$(CWFLAGS) # warning flags that shouldnt be passed to c++ compiler
|
||||
|
||||
libs+=$(LDFLAGS) -lstdc++ -lpthread
|
||||
|
||||
asflags:=$(ASFLAGS) -x assembler-with-cpp
|
||||
|
||||
cc=$(CC)
|
||||
@@ -375,12 +403,12 @@ ifdef Echo_name
|
||||
@printf '%-20.20s\r' $$<
|
||||
endif
|
||||
endif
|
||||
$(.)$(cc) -MM -MF $$@ -MT $(objdir)/$$*.o $(2) $$<
|
||||
$(.)$(2) -MM -MF $$@ -MT $(objdir)/$$*.o $(3) $$<
|
||||
endef
|
||||
|
||||
$(eval $(call _recipe,c))
|
||||
$(eval $(call _recipe,cpp))
|
||||
$(eval $(call _recipe,s,$(asflags)))
|
||||
$(eval $(call _recipe,c,$(cc)))
|
||||
$(eval $(call _recipe,cpp,$(cxx)))
|
||||
$(eval $(call _recipe,s,$(cc),$(asflags)))
|
||||
|
||||
# compiling recipe template
|
||||
# 1: target file suffix
|
||||
|
||||
@@ -14,6 +14,6 @@ sources+=dedicated/i_threads.c
|
||||
endif
|
||||
|
||||
NOOPENMPT=1
|
||||
NOGME=1
|
||||
NOLIBGME=1
|
||||
NOHW=1
|
||||
NOUPNP=1
|
||||
@@ -6,8 +6,7 @@ passthru_opts+=\
|
||||
NOHW NOMD5 NOPOSTPROCESSING\
|
||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
||||
HAVE_MINIUPNPC\
|
||||
HAVE_DISCORDRPC DEVELOP\
|
||||
NOBLUAJIT
|
||||
HAVE_DISCORDRPC DEVELOP
|
||||
|
||||
# build with debugging information
|
||||
ifdef DEBUGMODE
|
||||
@@ -69,18 +68,13 @@ opts+=-DHAVE_MINIUPNPC
|
||||
endif
|
||||
|
||||
ifndef NOLIBBACKTRACE
|
||||
$(eval $(call Propogate_flags,LIBBACKTRACE))
|
||||
libs+=-lbacktrace
|
||||
opts+=-DHAVE_LIBBACKTRACE
|
||||
endif
|
||||
|
||||
#windoze hack
|
||||
ifdef MINGW
|
||||
ifndef NODISCORDRPC
|
||||
HAVE_DISCORDRPC=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_DISCORDRPC
|
||||
$(eval $(call Propogate_flags,DISCORDRPC))
|
||||
libs+=-ldiscord-rpc
|
||||
opts+=-DUSE_STUN
|
||||
sources+=discord.c stun.c
|
||||
@@ -96,7 +90,7 @@ opts+=-DHAVE_VALGRIND
|
||||
endif
|
||||
|
||||
default_packages:=\
|
||||
GME/libgme/LIBGME\
|
||||
LIBGME/libgme/LIBGME\
|
||||
OPENMPT/libopenmpt/LIBOPENMPT\
|
||||
ZLIB/zlib\
|
||||
|
||||
|
||||
@@ -20,10 +20,6 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
|
||||
CXXFLAGS+= -Wno-aggregate-return
|
||||
|
||||
# -W -Wno-unused
|
||||
|
||||
ifdef GCC150
|
||||
opts+=-std=gnu17
|
||||
endif
|
||||
WFLAGS:=-Wall -Wno-trigraphs
|
||||
ifndef GCC295
|
||||
#WFLAGS+=-Wno-packed
|
||||
@@ -45,7 +41,8 @@ ifdef GCC41
|
||||
WFLAGS+=-Wshadow
|
||||
endif
|
||||
#WFLAGS+=-Wlarger-than-%len%
|
||||
WFLAGS+=-Wpointer-arith -Wbad-function-cast
|
||||
WFLAGS+=-Wpointer-arith
|
||||
CWFLAGS+=-Wbad-function-cast
|
||||
ifdef GCC45
|
||||
#WFLAGS+=-Wc++-compat
|
||||
endif
|
||||
@@ -75,9 +72,10 @@ endif
|
||||
endif
|
||||
#WFLAGS+=-Wstrict-prototypes
|
||||
ifdef GCC40
|
||||
WFLAGS+=-Wold-style-definition
|
||||
CWFLAGS+=-Wold-style-definition
|
||||
endif
|
||||
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
|
||||
WFLAGS+=-Wmissing-declarations
|
||||
CWFLAGS+=-Wmissing-prototypes
|
||||
ifdef GCC40
|
||||
WFLAGS+=-Wmissing-field-initializers
|
||||
endif
|
||||
@@ -88,7 +86,7 @@ endif
|
||||
#WFLAGS+=-Wpacked
|
||||
#WFLAGS+=-Wpadded
|
||||
#WFLAGS+=-Wredundant-decls
|
||||
WFLAGS+=-Wnested-externs
|
||||
CWFLAGS+=-Wnested-externs
|
||||
#WFLAGS+=-Wunreachable-code
|
||||
WFLAGS+=-Winline
|
||||
ifdef DEBUGMODE
|
||||
@@ -146,6 +144,10 @@ ifdef GCC81
|
||||
WFLAGS+=-Wno-error=multistatement-macros
|
||||
endif
|
||||
|
||||
ifeq ($(CC),clang)
|
||||
WFLAGS+= -Wno-unknown-pragmas -Wno-cast-align
|
||||
endif
|
||||
|
||||
ifdef NONX86
|
||||
ifdef X86_64 # yeah that SEEMS contradictory
|
||||
opts+=-march=nocona
|
||||
|
||||
@@ -15,6 +15,7 @@ endif
|
||||
|
||||
sources+=win32/Srb2win.rc
|
||||
opts+=-DSTDC_HEADERS
|
||||
libs+=-Wl,-Bstatic -lstdc++ -lpthread -lgcc -Wl,-Bdynamic
|
||||
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
|
||||
|
||||
ifndef DEDICATED
|
||||
@@ -42,6 +43,10 @@ libs+=-Wl,--large-address-aware
|
||||
NOLIBBACKTRACE=1
|
||||
endif
|
||||
|
||||
ifndef NODISCORDRPC
|
||||
HAVE_DISCORDRPC=1
|
||||
endif
|
||||
|
||||
ifndef MINGW64
|
||||
32=32
|
||||
x86=x86
|
||||
@@ -66,7 +71,7 @@ $(eval $(call _set,LIBGME))
|
||||
|
||||
lib:=../libs/libopenmpt
|
||||
LIBOPENMPT_opts:=-I$(lib)/inc
|
||||
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86)/mingw -lopenmpt
|
||||
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86) -lopenmpt
|
||||
$(eval $(call _set,LIBOPENMPT))
|
||||
|
||||
lib:=../libs/SDL2_mixer/$(mingw)
|
||||
|
||||
@@ -29,6 +29,7 @@ m_cond.c
|
||||
m_fixed.c
|
||||
m_menu.c
|
||||
m_textinput.c
|
||||
m_emotes.cpp
|
||||
m_misc.c
|
||||
m_perfstats.c
|
||||
m_queue.c
|
||||
|
||||
@@ -324,6 +324,7 @@ static void AM_initVariables(void)
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
}
|
||||
|
||||
AM_changeWindowLoc();
|
||||
|
||||
// for saving & restoring
|
||||
|
||||
+5
-5
@@ -133,26 +133,26 @@ LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {
|
||||
if (!lua_checkstack(L, space))
|
||||
if (l_unlikely(!lua_checkstack(L, space)))
|
||||
luaL_error(L, "stack overflow (%s)", mes);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
|
||||
if (lua_type(L, narg) != t)
|
||||
if (l_unlikely(lua_type(L, narg) != t))
|
||||
tag_error(L, narg, t);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkany (lua_State *L, int narg) {
|
||||
if (lua_type(L, narg) == LUA_TNONE)
|
||||
if (l_unlikely(lua_type(L, narg) == LUA_TNONE))
|
||||
luaL_argerror(L, narg, "value expected");
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
|
||||
const char *s = lua_tolstring(L, narg, len);
|
||||
if (!s) tag_error(L, narg, LUA_TSTRING);
|
||||
if (l_unlikely(!s)) tag_error(L, narg, LUA_TSTRING);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
|
||||
|
||||
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
|
||||
lua_Number d = lua_tonumber(L, narg);
|
||||
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
|
||||
if (l_unlikely(d == 0 && !lua_isnumber(L, narg))) /* avoid extra test when d is not 0 */
|
||||
tag_error(L, narg, LUA_TNUMBER);
|
||||
return d;
|
||||
}
|
||||
|
||||
+22
-2
@@ -36,6 +36,26 @@ LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
|
||||
/* extra error code for `luaL_load' */
|
||||
#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 {
|
||||
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_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,
|
||||
const char *const lst[]);
|
||||
@@ -102,7 +122,7 @@ LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
|
||||
*/
|
||||
|
||||
#define luaL_argcheck(L, cond,numarg,extramsg) \
|
||||
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
((void)(l_likely(cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
|
||||
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
|
||||
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
|
||||
|
||||
+9
-9
@@ -106,7 +106,7 @@ static int luaB_setmetatable (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
|
||||
"nil or table expected");
|
||||
if (luaL_getmetafield(L, 1, "__metatable"))
|
||||
if (l_unlikely(luaL_getmetafield(L, 1, "__metatable")))
|
||||
luaL_error(L, "cannot change a protected metatable");
|
||||
lua_settop(L, 2);
|
||||
lua_setmetatable(L, 1);
|
||||
@@ -120,10 +120,10 @@ static void getfunc (lua_State *L, int opt) {
|
||||
lua_Debug ar;
|
||||
int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);
|
||||
luaL_argcheck(L, level >= 0, 1, "level must be non-negative");
|
||||
if (lua_getstack(L, level, &ar) == 0)
|
||||
if (l_unlikely(lua_getstack(L, level, &ar) == 0))
|
||||
luaL_argerror(L, 1, "invalid level");
|
||||
lua_getinfo(L, "f", &ar);
|
||||
if (lua_isnil(L, -1))
|
||||
if (l_unlikely(lua_isnil(L, -1)))
|
||||
luaL_error(L, "no function environment for tail call at level %d",
|
||||
level);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ static int luaB_setfenv (lua_State *L) {
|
||||
lua_setfenv(L, -2);
|
||||
return 0;
|
||||
}
|
||||
else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)
|
||||
else if (l_unlikely(lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0))
|
||||
luaL_error(L,
|
||||
LUA_QL("setfenv") " cannot change environment of given object");
|
||||
return 1;
|
||||
@@ -265,7 +265,7 @@ static int luaB_ipairs (lua_State *L) {
|
||||
|
||||
static int luaB_assert (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (!lua_toboolean(L, 1))
|
||||
if (l_unlikely(!lua_toboolean(L, 1)))
|
||||
return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
|
||||
return lua_gettop(L);
|
||||
}
|
||||
@@ -278,7 +278,7 @@ static int luaB_unpack (lua_State *L) {
|
||||
e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
|
||||
if (i > e) return 0; /* empty range */
|
||||
n = e - i + 1; /* number of elements */
|
||||
if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
|
||||
if (l_unlikely(n <= 0 || !lua_checkstack(L, n))) /* n <= 0 means arith. overflow */
|
||||
return luaL_error(L, "too many results to unpack");
|
||||
lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
|
||||
while (i++ < e) /* push arg[i + 1...e] */
|
||||
@@ -445,9 +445,9 @@ static int luaB_costatus (lua_State *L) {
|
||||
|
||||
static int auxresume (lua_State *L, lua_State *co, int narg) {
|
||||
int status = costatus(L, co);
|
||||
if (!lua_checkstack(co, narg))
|
||||
if (l_unlikely(!lua_checkstack(co, narg)))
|
||||
luaL_error(L, "too many arguments to resume");
|
||||
if (status != CO_SUS) {
|
||||
if (l_unlikely(status != CO_SUS)) {
|
||||
lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]);
|
||||
return -1; /* error flag */
|
||||
}
|
||||
@@ -456,7 +456,7 @@ static int auxresume (lua_State *L, lua_State *co, int narg) {
|
||||
status = lua_resume(co, narg);
|
||||
if (status == 0 || status == LUA_YIELD) {
|
||||
int nres = lua_gettop(co);
|
||||
if (!lua_checkstack(L, nres + 1))
|
||||
if (l_unlikely(!lua_checkstack(L, nres + 1)))
|
||||
luaL_error(L, "too many results to resume");
|
||||
lua_xmove(co, L, nres); /* move yielded values */
|
||||
return nres;
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ static int db_getinfo (lua_State *L) {
|
||||
}
|
||||
else
|
||||
return luaL_argerror(L, arg+1, "function or level expected");
|
||||
if (!lua_getinfo(L1, options, &ar))
|
||||
if (l_unlikely(!lua_getinfo(L1, options, &ar)))
|
||||
return luaL_argerror(L, arg+2, "invalid option");
|
||||
lua_createtable(L, 0, 2);
|
||||
if (strchr(options, 'S')) {
|
||||
@@ -104,7 +104,7 @@ static int db_getlocal (lua_State *L) {
|
||||
lua_State *L1 = getthread(L, &arg);
|
||||
lua_Debug ar;
|
||||
const char *name;
|
||||
if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */
|
||||
if (l_unlikely(!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))) /* out of range? */
|
||||
return luaL_argerror(L, arg+1, "level out of range");
|
||||
name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2));
|
||||
if (name) {
|
||||
|
||||
+13
-13
@@ -172,7 +172,7 @@ void luaD_reallocCI (lua_State *L, int newsize) {
|
||||
|
||||
|
||||
void luaD_growstack (lua_State *L, int n) {
|
||||
if (n <= L->stacksize) /* double size is enough? */
|
||||
if (l_likely(n <= L->stacksize)) /* double size is enough? */
|
||||
luaD_reallocstack(L, 2*L->stacksize);
|
||||
else
|
||||
luaD_reallocstack(L, L->stacksize + n);
|
||||
@@ -180,11 +180,11 @@ void luaD_growstack (lua_State *L, int n) {
|
||||
|
||||
|
||||
static CallInfo *growCI (lua_State *L) {
|
||||
if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */
|
||||
if (l_unlikely(L->size_ci > LUAI_MAXCALLS)) /* overflow while handling overflow? */
|
||||
luaD_throw(L, LUA_ERRERR);
|
||||
else {
|
||||
luaD_reallocCI(L, 2*L->size_ci);
|
||||
if (L->size_ci > LUAI_MAXCALLS)
|
||||
if (l_unlikely(L->size_ci > LUAI_MAXCALLS))
|
||||
luaG_runerror(L, "stack overflow");
|
||||
}
|
||||
return ++L->ci;
|
||||
@@ -257,7 +257,7 @@ static StkId tryfuncTM (lua_State *L, StkId func) {
|
||||
const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
|
||||
StkId p;
|
||||
ptrdiff_t funcr = savestack(L, func);
|
||||
if (!ttisfunction(tm))
|
||||
if (l_unlikely(!ttisfunction(tm)))
|
||||
luaG_typeerror(L, func, "call");
|
||||
/* Open a hole inside the stack at `func' */
|
||||
for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
|
||||
@@ -356,7 +356,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
||||
StkId res;
|
||||
int wanted, i;
|
||||
CallInfo *ci;
|
||||
if (L->hookmask & LUA_MASKRET)
|
||||
if (l_unlikely(L->hookmask) & LUA_MASKRET)
|
||||
firstResult = callrethooks(L, firstResult);
|
||||
ci = L->ci--;
|
||||
res = ci->func; /* res == final position of 1st result */
|
||||
@@ -380,7 +380,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
||||
** function position.
|
||||
*/
|
||||
void luaD_call (lua_State *L, StkId func, int nResults) {
|
||||
if (++L->nCcalls >= LUAI_MAXCCALLS) {
|
||||
if (l_unlikely(++L->nCcalls >= LUAI_MAXCCALLS)) {
|
||||
if (L->nCcalls == LUAI_MAXCCALLS)
|
||||
luaG_runerror(L, "C stack overflow");
|
||||
else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))
|
||||
@@ -430,15 +430,15 @@ static int resume_error (lua_State *L, const char *msg) {
|
||||
LUA_API int lua_resume (lua_State *L, int nargs) {
|
||||
int status;
|
||||
lua_lock(L);
|
||||
if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci))
|
||||
if (l_unlikely(L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)))
|
||||
return resume_error(L, "cannot resume non-suspended coroutine");
|
||||
if (L->nCcalls >= LUAI_MAXCCALLS)
|
||||
if (l_unlikely(L->nCcalls >= LUAI_MAXCCALLS))
|
||||
return resume_error(L, "C stack overflow");
|
||||
luai_userstateresume(L, nargs);
|
||||
lua_assert(L->errfunc == 0);
|
||||
L->baseCcalls = ++L->nCcalls;
|
||||
status = luaD_rawrunprotected(L, resume, L->top - nargs);
|
||||
if (status != 0) { /* error? */
|
||||
if (l_unlikely(status != 0)) { /* error? */
|
||||
L->status = cast_byte(status); /* mark thread as `dead' */
|
||||
luaD_seterrorobj(L, status, L->top);
|
||||
L->ci->top = L->top;
|
||||
@@ -456,7 +456,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) {
|
||||
LUA_API int lua_yield (lua_State *L, int nresults) {
|
||||
luai_userstateyield(L, nresults);
|
||||
lua_lock(L);
|
||||
if (L->nCcalls > L->baseCcalls)
|
||||
if (l_unlikely(L->nCcalls > L->baseCcalls))
|
||||
luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
|
||||
L->base = L->top - nresults; /* protect stack slots below */
|
||||
L->status = LUA_YIELD;
|
||||
@@ -474,7 +474,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u,
|
||||
ptrdiff_t old_errfunc = L->errfunc;
|
||||
L->errfunc = ef;
|
||||
status = luaD_rawrunprotected(L, func, u);
|
||||
if (status != 0) { /* an error occurred? */
|
||||
if (l_unlikely(status != 0)) { /* an error occurred? */
|
||||
StkId oldtop = restorestack(L, old_top);
|
||||
luaF_close(L, oldtop); /* close eventual pending closures */
|
||||
luaD_seterrorobj(L, status, oldtop);
|
||||
@@ -511,8 +511,8 @@ static void f_parser (lua_State *L, void *ud) {
|
||||
tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z,
|
||||
&p->buff, p->name);
|
||||
#else
|
||||
if (c == LUA_SIGNATURE[0])
|
||||
luaG_runerror(L, "invalid format, cannot load bytecode scripts");
|
||||
if (l_unlikely(c == LUA_SIGNATURE[0]))
|
||||
luaG_runerror(L, "invalid format, cannot load bytecode scripts");
|
||||
tf = luaY_parser(L, p->z, &p->buff, p->name);
|
||||
#endif
|
||||
cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L)));
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
#define luaD_checkstack(L,n) \
|
||||
if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
|
||||
if (l_unlikely((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue))) \
|
||||
luaD_growstack(L, n); \
|
||||
else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
|
||||
|
||||
|
||||
+10
-10
@@ -84,7 +84,7 @@ static int io_type (lua_State *L) {
|
||||
|
||||
static FILE *tofile (lua_State *L) {
|
||||
FILE **f = tofilep(L);
|
||||
if (*f == NULL)
|
||||
if (l_unlikely(*f == NULL))
|
||||
luaL_error(L, "attempt to use a closed file");
|
||||
return *f;
|
||||
}
|
||||
@@ -184,8 +184,8 @@ static int io_open (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||
|| StartsWith(filename, "/") || !pass)
|
||||
if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||
|| StartsWith(filename, "/") || !pass))
|
||||
{
|
||||
luaL_error(L,"access denied to %s", filename);
|
||||
return pushresult(L,0,filename);
|
||||
@@ -202,7 +202,7 @@ static int io_open (lua_State *L) {
|
||||
{
|
||||
*splitter = 0;
|
||||
I_mkdir(destFilename, 0755);
|
||||
*splitter = '/';
|
||||
*splitter = '/';
|
||||
splitter++;
|
||||
|
||||
forward = strchr(splitter, '/');
|
||||
@@ -226,7 +226,7 @@ static FILE *getiofile (lua_State *L, int findex) {
|
||||
FILE *f;
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, findex);
|
||||
f = *(FILE **)lua_touserdata(L, -1);
|
||||
if (f == NULL)
|
||||
if (l_unlikely(f == NULL))
|
||||
luaL_error(L, "standard %s file is closed", fnames[findex - 1]);
|
||||
return f;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ static int g_iofile (lua_State *L, int f, const char *mode) {
|
||||
if (filename) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, mode);
|
||||
if (*pf == NULL)
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
}
|
||||
else {
|
||||
@@ -290,7 +290,7 @@ static int io_lines (lua_State *L) {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, "r");
|
||||
if (*pf == NULL)
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
aux_lines(L, lua_gettop(L), 1);
|
||||
return 1;
|
||||
@@ -307,7 +307,7 @@ static int io_lines (lua_State *L) {
|
||||
|
||||
static int read_number (lua_State *L, FILE *f) {
|
||||
lua_Number d;
|
||||
if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
|
||||
if (l_likely(fscanf(f, LUA_NUMBER_SCAN, &d) == 1)) {
|
||||
lua_pushnumber(L, d);
|
||||
return 1;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, arg, &l);
|
||||
if (ftell(f) + l > FILELIMIT)
|
||||
if (l_unlikely(ftell(f) + l > FILELIMIT))
|
||||
{
|
||||
luaL_error(L,"write limit bypassed in file. Changes have been discarded.");
|
||||
break;
|
||||
@@ -483,7 +483,7 @@ static int f_seek (lua_State *L) {
|
||||
int op = luaL_checkoption(L, 2, "cur", modenames);
|
||||
long offset = luaL_optlong(L, 3, 0);
|
||||
op = fseek(f, offset, mode[op]);
|
||||
if (op)
|
||||
if (l_unlikely(op))
|
||||
return pushresult(L, 0, NULL); /* error */
|
||||
else {
|
||||
lua_pushinteger(L, ftell(f));
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,
|
||||
void *newblock;
|
||||
int newsize;
|
||||
if (*size >= limit/2) { /* cannot double it? */
|
||||
if (*size >= limit) /* cannot grow even a little? */
|
||||
if (l_unlikely(*size >= limit)) /* cannot grow even a little? */
|
||||
luaG_runerror(L, errormsg);
|
||||
newsize = limit; /* still have at least one free place */
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
|
||||
global_State *g = G(L);
|
||||
lua_assert((osize == 0) == (block == NULL));
|
||||
block = (*g->frealloc)(g->ud, block, osize, nsize);
|
||||
if (block == NULL && nsize > 0)
|
||||
if (l_unlikely(block == NULL && nsize > 0))
|
||||
luaD_throw(L, LUA_ERRMEM);
|
||||
lua_assert((nsize == 0) == (block == NULL));
|
||||
g->totalbytes = (g->totalbytes - osize) + nsize;
|
||||
|
||||
+6
-6
@@ -103,7 +103,7 @@ static void checknext (LexState *ls, int c) {
|
||||
|
||||
|
||||
static void check_match (LexState *ls, int what, int who, int where) {
|
||||
if (!testnext(ls, what)) {
|
||||
if (l_unlikely(!testnext(ls, what))) {
|
||||
if (where == ls->linenumber)
|
||||
error_expected(ls, what);
|
||||
else {
|
||||
@@ -275,7 +275,7 @@ static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
|
||||
|
||||
|
||||
static void enterlevel (LexState *ls) {
|
||||
if (++ls->L->nCcalls > LUAI_MAXCCALLS)
|
||||
if (l_unlikely(++ls->L->nCcalls > LUAI_MAXCCALLS))
|
||||
luaX_lexerror(ls, "chunk has too many syntax levels", 0);
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ static void funcargs (LexState *ls, expdesc *f) {
|
||||
int line = ls->linenumber;
|
||||
switch (ls->t.token) {
|
||||
case '(': { /* funcargs -> `(' [ explist1 ] `)' */
|
||||
if (line != ls->lastline)
|
||||
if (l_unlikely(line != ls->lastline))
|
||||
luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)");
|
||||
luaX_next(ls);
|
||||
if (ls->t.token == ')') /* arg list is empty? */
|
||||
@@ -712,7 +712,7 @@ static void prefixexp (LexState *ls, expdesc *v) {
|
||||
case '$': {
|
||||
lua_Number i = ls->t.seminfo.r;
|
||||
if (i == 0) i = ls->fs->nrhs;
|
||||
if (i <= 0 || i > ls->fs->nlhs)
|
||||
if (l_unlikely(i <= 0 || i > ls->fs->nlhs))
|
||||
luaX_syntaxerror(ls, "pseudo-variable out of range or not in assignment");
|
||||
else {
|
||||
expdesc_list *lhs = ls->fs->lhs;
|
||||
@@ -1105,7 +1105,7 @@ static void breakstat (LexState *ls, lua_Number n) {
|
||||
upval |= bl->upval;
|
||||
bl = bl->previous;
|
||||
}
|
||||
if (!bl)
|
||||
if (l_unlikely(!bl))
|
||||
luaX_syntaxerror(ls, "no loop to break");
|
||||
if (upval)
|
||||
luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
|
||||
@@ -1124,7 +1124,7 @@ static void continuestat (LexState *ls) {
|
||||
//upval |= bl->upval; // AK: ADDITION (would this fix forbody probs?)
|
||||
bl = bl->previous;
|
||||
}
|
||||
if (!bl)
|
||||
if (l_unlikely(!bl))
|
||||
luaX_syntaxerror(ls, "no loop to continue");
|
||||
|
||||
//if (upval) //AK: experimental
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
|
||||
o != NULL;
|
||||
o = o->gch.next) {
|
||||
TString *ts = rawgco2ts(o);
|
||||
if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {
|
||||
if (l_unlikely(ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0))) {
|
||||
/* string may be dead */
|
||||
if (isdead(G(L), o)) changewhite(o);
|
||||
return ts;
|
||||
@@ -95,7 +95,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
|
||||
|
||||
Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
|
||||
Udata *u;
|
||||
if (s > MAX_SIZET - sizeof(Udata))
|
||||
if (l_unlikely(s > MAX_SIZET - sizeof(Udata)))
|
||||
luaM_toobig(L);
|
||||
u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));
|
||||
u->uv.marked = luaC_white(G(L)); /* is not finalized */
|
||||
|
||||
+14
-12
@@ -113,7 +113,7 @@ static int str_byte (lua_State *L) {
|
||||
if ((size_t)pose > l) pose = l;
|
||||
if (posi > pose) return 0; /* empty interval; return no values */
|
||||
n = (int)(pose - posi + 1);
|
||||
if (posi + n <= pose) /* overflow? */
|
||||
if (l_unlikely(posi + n <= pose)) /* overflow? */
|
||||
luaL_error(L, "string slice too long");
|
||||
luaL_checkstack(L, n, "string slice too long");
|
||||
for (i=0; i<n; i++)
|
||||
@@ -187,7 +187,7 @@ typedef struct MatchState {
|
||||
|
||||
static int check_capture (MatchState *ms, int l) {
|
||||
l -= '1';
|
||||
if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
|
||||
if (l_unlikely(l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED))
|
||||
return luaL_error(ms->L, "invalid capture index");
|
||||
return l;
|
||||
}
|
||||
@@ -204,14 +204,14 @@ static int capture_to_close (MatchState *ms) {
|
||||
static const char *classend (MatchState *ms, const char *p) {
|
||||
switch (*p++) {
|
||||
case L_ESC: {
|
||||
if (*p == '\0')
|
||||
if (l_unlikely(*p == '\0'))
|
||||
luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
|
||||
return p+1;
|
||||
}
|
||||
case '[': {
|
||||
if (*p == '^') p++;
|
||||
do { /* look for a `]' */
|
||||
if (*p == '\0')
|
||||
if (l_unlikely(*p == '\0'))
|
||||
luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
|
||||
if (*(p++) == L_ESC && *p != '\0')
|
||||
p++; /* skip escapes (e.g. `%]') */
|
||||
@@ -282,7 +282,7 @@ static const char *match (MatchState *ms, const char *s, const char *p);
|
||||
|
||||
static const char *matchbalance (MatchState *ms, const char *s,
|
||||
const char *p) {
|
||||
if (*p == 0 || *(p+1) == 0)
|
||||
if (l_unlikely(*p == 0 || *(p+1) == 0))
|
||||
luaL_error(ms->L, "unbalanced pattern");
|
||||
if (*s != *p) return NULL;
|
||||
else {
|
||||
@@ -332,7 +332,8 @@ static const char *start_capture (MatchState *ms, const char *s,
|
||||
const char *p, int what) {
|
||||
const char *res;
|
||||
int level = ms->level;
|
||||
if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures");
|
||||
if (l_unlikely(level >= LUA_MAXCAPTURES))
|
||||
luaL_error(ms->L, "too many captures");
|
||||
ms->capture[level].init = s;
|
||||
ms->capture[level].len = what;
|
||||
ms->level = level+1;
|
||||
@@ -386,7 +387,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
|
||||
case 'f': { /* frontier? */
|
||||
const char *ep; char previous;
|
||||
p += 2;
|
||||
if (*p != '[')
|
||||
if (l_unlikely(*p != '['))
|
||||
luaL_error(ms->L, "missing " LUA_QL("[") " after "
|
||||
LUA_QL("%%f") " in pattern");
|
||||
ep = classend(ms, p); /* points to what is next */
|
||||
@@ -468,14 +469,15 @@ static const char *lmemfind (const char *s1, size_t l1,
|
||||
static void push_onecapture (MatchState *ms, int i, const char *s,
|
||||
const char *e) {
|
||||
if (i >= ms->level) {
|
||||
if (i == 0) /* ms->level == 0, too */
|
||||
if (l_likely(i == 0)) /* ms->level == 0, too */
|
||||
lua_pushlstring(ms->L, s, e - s); /* add whole match */
|
||||
else
|
||||
luaL_error(ms->L, "invalid capture index");
|
||||
}
|
||||
else {
|
||||
ptrdiff_t l = ms->capture[i].len;
|
||||
if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
|
||||
if (l_unlikely(l == CAP_UNFINISHED))
|
||||
luaL_error(ms->L, "unfinished capture");
|
||||
if (l == CAP_POSITION)
|
||||
lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
|
||||
else
|
||||
@@ -637,7 +639,7 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
|
||||
lua_pop(L, 1);
|
||||
lua_pushlstring(L, s, e - s); /* keep original text */
|
||||
}
|
||||
else if (!lua_isstring(L, -1))
|
||||
else if (l_unlikely(!lua_isstring(L, -1)))
|
||||
luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1));
|
||||
luaL_addvalue(b); /* add result to accumulator */
|
||||
}
|
||||
@@ -727,7 +729,7 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
|
||||
static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
|
||||
const char *p = strfrmt;
|
||||
while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */
|
||||
if ((size_t)(p - strfrmt) >= sizeof(FLAGS))
|
||||
if (l_unlikely((size_t)(p - strfrmt) >= sizeof(FLAGS)))
|
||||
luaL_error(L, "invalid format (repeated flags)");
|
||||
if (isdigit(uchar(*p))) p++; /* skip width */
|
||||
if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
|
||||
@@ -736,7 +738,7 @@ static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
|
||||
if (isdigit(uchar(*p))) p++; /* skip precision */
|
||||
if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
|
||||
}
|
||||
if (isdigit(uchar(*p)))
|
||||
if (l_unlikely(isdigit(uchar(*p))))
|
||||
luaL_error(L, "invalid format (width or precision too long)");
|
||||
*(form++) = '%';
|
||||
strncpy(form, strfrmt, p - strfrmt + 1);
|
||||
|
||||
+4
-3
@@ -278,7 +278,7 @@ static void setnodevector (lua_State *L, Table *t, int size) {
|
||||
else {
|
||||
int i;
|
||||
lsize = ceillog2(size);
|
||||
if (lsize > MAXBITS)
|
||||
if (l_unlikely(lsize > MAXBITS))
|
||||
luaG_runerror(L, "table overflow");
|
||||
size = twoto(lsize);
|
||||
t->node = luaM_newvector(L, size, Node);
|
||||
@@ -498,8 +498,9 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
|
||||
if (p != luaO_nilobject)
|
||||
return cast(TValue *, p);
|
||||
else {
|
||||
if (ttisnil(key)) luaG_runerror(L, "table index is nil");
|
||||
else if (ttisnumber(key) && luai_numisnan(nvalue(key)))
|
||||
if (l_unlikely(ttisnil(key)))
|
||||
luaG_runerror(L, "table index is nil");
|
||||
else if (l_unlikely(ttisnumber(key) && luai_numisnan(nvalue(key))))
|
||||
luaG_runerror(L, "table index is NaN");
|
||||
return newkey(L, t, key);
|
||||
}
|
||||
|
||||
+5
-3
@@ -134,7 +134,7 @@ static int tremove (lua_State *L) {
|
||||
|
||||
static void addfield (lua_State *L, luaL_Buffer *b, int i) {
|
||||
lua_rawgeti(L, 1, i);
|
||||
if (!lua_isstring(L, -1))
|
||||
if (l_unlikely(!lua_isstring(L, -1)))
|
||||
luaL_error(L, "invalid value (%s) at index %d in table for "
|
||||
LUA_QL("concat"), luaL_typename(L, -1), i);
|
||||
luaL_addvalue(b);
|
||||
@@ -224,12 +224,14 @@ static void auxsort (lua_State *L, int l, int u) {
|
||||
for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */
|
||||
/* repeat ++i until a[i] >= P */
|
||||
while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
|
||||
if (i>u) luaL_error(L, "invalid order function for sorting");
|
||||
if (l_unlikely(i>u))
|
||||
luaL_error(L, "invalid order function for sorting");
|
||||
lua_pop(L, 1); /* remove a[i] */
|
||||
}
|
||||
/* repeat --j until a[j] <= P */
|
||||
while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
|
||||
if (j<l) luaL_error(L, "invalid order function for sorting");
|
||||
if (l_unlikely(j<l))
|
||||
luaL_error(L, "invalid order function for sorting");
|
||||
lua_pop(L, 1); /* remove a[j] */
|
||||
}
|
||||
if (j<i) {
|
||||
|
||||
@@ -773,6 +773,23 @@ union luai_Cast { double l_d; long l_l; };
|
||||
|
||||
/* =================================================================== */
|
||||
|
||||
/*
|
||||
* * macros to improve jump prediction, used mostly for error handling
|
||||
** and debug facilities.
|
||||
*/
|
||||
#if !defined(l_likely)
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(__GNUC__)
|
||||
#define l_likely(x) (__builtin_expect(((x) != 0), 1))
|
||||
#define l_unlikely(x) (__builtin_expect(((x) != 0), 0))
|
||||
#else
|
||||
#define l_likely(x) (x)
|
||||
#define l_unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Local configuration. You can use this space to add your redefinitions
|
||||
** without modifying the main part of the file.
|
||||
|
||||
+12
-11
@@ -119,7 +119,7 @@ void luaV_gettable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
}
|
||||
/* else will try the tag method */
|
||||
}
|
||||
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
|
||||
else if (l_unlikely(ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))))
|
||||
luaG_typeerror(L, t, "index");
|
||||
if (ttisfunction(tm)) {
|
||||
callTMres(L, val, tm, t, key);
|
||||
@@ -147,7 +147,7 @@ void luaV_settable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
}
|
||||
/* else will try the tag method */
|
||||
}
|
||||
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
|
||||
else if (l_unlikely(ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))))
|
||||
luaG_typeerror(L, t, "index");
|
||||
if (ttisfunction(tm)) {
|
||||
callTM(L, tm, t, key, val);
|
||||
@@ -293,7 +293,8 @@ void luaV_concat (lua_State *L, int total, int last) {
|
||||
/* collect total length */
|
||||
for (n = 1; n < total && tostring(L, top-n-1); n++) {
|
||||
size_t l = tsvalue(top-n-1)->len;
|
||||
if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
|
||||
if (l_unlikely(l >= MAX_SIZET - tl))
|
||||
luaG_runerror(L, "string length overflow");
|
||||
tl += l;
|
||||
}
|
||||
buffer = luaZ_openspace(L, &G(L)->buff, tl);
|
||||
@@ -322,8 +323,8 @@ static void Arith (lua_State *L, StkId ra, TValue *rb,
|
||||
case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
|
||||
case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
|
||||
case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
|
||||
case TM_DIV: if (nc == 0) { luaG_runerror(L, "divide by zero error"); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (nc == 0) { luaG_runerror(L, "modulo by zero error"); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_DIV: if (l_unlikely(nc == 0)) { luaG_runerror(L, "divide by zero error"); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (l_unlikely(nc == 0)) { luaG_runerror(L, "modulo by zero error"); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
|
||||
case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
|
||||
case TM_AND: setnvalue(ra, luai_numand(nb, nc)); break;
|
||||
@@ -491,7 +492,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
TValue *rc = RKC(i);
|
||||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
if (l_unlikely(nc == 0)) {
|
||||
luaG_runerror(L, "divide by zero error");
|
||||
}
|
||||
else
|
||||
@@ -506,7 +507,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
TValue *rc = RKC(i);
|
||||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
if (l_unlikely(nc == 0)) {
|
||||
luaG_runerror(L, "modulo by zero error");
|
||||
}
|
||||
else
|
||||
@@ -580,7 +581,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
}
|
||||
default: { /* try metamethod */
|
||||
Protect(
|
||||
if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN))
|
||||
if (l_unlikely(!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)))
|
||||
luaG_typeerror(L, rb, "get length of");
|
||||
)
|
||||
}
|
||||
@@ -724,11 +725,11 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
const TValue *plimit = ra+1;
|
||||
const TValue *pstep = ra+2;
|
||||
L->savedpc = pc; /* next steps may throw errors */
|
||||
if (!tonumber(init, ra))
|
||||
if (l_unlikely(!tonumber(init, ra)))
|
||||
luaG_runerror(L, LUA_QL("for") " initial value must be a number");
|
||||
else if (!tonumber(plimit, ra+1))
|
||||
else if (l_unlikely(!tonumber(plimit, ra+1)))
|
||||
luaG_runerror(L, LUA_QL("for") " limit must be a number");
|
||||
else if (!tonumber(pstep, ra+2))
|
||||
else if (l_unlikely(!tonumber(pstep, ra+2)))
|
||||
luaG_runerror(L, LUA_QL("for") " step must be a number");
|
||||
if (ra && pstep)
|
||||
setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ struct SourceLocation {
|
||||
|
||||
class IErrorAssertHandler {
|
||||
public:
|
||||
static void handle(const SourceLocation& source_location, const char* expression) {
|
||||
[[ noreturn ]] static void handle(const SourceLocation& source_location, const char* expression) {
|
||||
I_Error("Assertion failed at %s:%u: %s != true",
|
||||
source_location.file_name,
|
||||
source_location.line_number,
|
||||
|
||||
+1140
-919
File diff suppressed because it is too large.
Load diff
+7
-4
@@ -42,8 +42,8 @@ applications may follow different packet versions.
|
||||
#define VANILLA_GT_MATCH 3
|
||||
|
||||
// Networking and tick handling related.
|
||||
#define BACKUPTICS 32
|
||||
#define TICQUEUE 512 // more than enough for most timeouts....
|
||||
#define BACKUPTICS 512 // more than enough for most timeouts....
|
||||
#define CLIENTBACKUPTICS 32
|
||||
#define MAXTEXTCMD 256
|
||||
|
||||
// No. of tics your controls can be delayed by.
|
||||
@@ -120,6 +120,8 @@ typedef enum
|
||||
PT_ISSATURN, // Saturn specific identifier packet
|
||||
#endif
|
||||
|
||||
PT_MAPICON, // Send map image icon (gamespy).
|
||||
PT_NEEDMAPICON, // Request missed map icon (gamespy).
|
||||
NUMPACKETTYPE
|
||||
} packettype_t;
|
||||
|
||||
@@ -513,6 +515,7 @@ typedef struct
|
||||
INT32 filesneedednum; // 4 bytes
|
||||
filesneededconfig_pak filesneededcfg; // ??? bytes
|
||||
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
|
||||
UINT8 mapicondata[0];
|
||||
} u; // This is needed to pack diff packet types data together
|
||||
} ATTRPACK doomdata_t;
|
||||
|
||||
@@ -533,7 +536,6 @@ extern UINT32 serverlistultimatecount;
|
||||
extern INT32 mapchangepending;
|
||||
|
||||
// Points inside doomcom
|
||||
extern doomdata_t *netbuffer;
|
||||
extern consvar_t cv_stunserver;
|
||||
extern consvar_t cv_httpsource;
|
||||
extern consvar_t cv_kicktime;
|
||||
@@ -565,7 +567,6 @@ typedef enum
|
||||
KR_TIMEOUT, //Connection Timeout
|
||||
KR_BAN, //Banned by server
|
||||
KR_LEAVE, //Quit the game
|
||||
|
||||
} kickreason_t;
|
||||
|
||||
/* the max number of name changes in some time period */
|
||||
@@ -671,6 +672,8 @@ SINT8 nametonum(const char *name);
|
||||
extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
extern boolean player_muted[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
|
||||
void D_ResetTiccmds(void);
|
||||
|
||||
+34
-39
@@ -40,6 +40,7 @@
|
||||
#include "g_game.h"
|
||||
#include "g_input.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "m_emotes.h"
|
||||
#include "i_sound.h"
|
||||
#include "i_system.h"
|
||||
#include "i_time.h"
|
||||
@@ -120,11 +121,8 @@ INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
// These variables are only true if
|
||||
// whether the respective sound system is disabled
|
||||
// or they're init'ed, but the player just toggled them
|
||||
#ifndef NO_MIDI
|
||||
boolean midi_disabled = false;
|
||||
#endif
|
||||
boolean sound_disabled = false;
|
||||
boolean digital_disabled = false;
|
||||
boolean music_disabled = false;
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
INT32 debugload = 0;
|
||||
@@ -152,6 +150,8 @@ boolean dedicated = false;
|
||||
|
||||
boolean loaded_config = false; // true once config.cfg loaded AND executed
|
||||
|
||||
static void D_CleanFile(char **filearray);
|
||||
|
||||
//
|
||||
// D_PostEvent
|
||||
// Called by the I/O functions when input is detected
|
||||
@@ -896,9 +896,24 @@ void D_SRB2Loop(void)
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
|
||||
if ((interp || doDisplay) && !frameskip)
|
||||
if (interp || doDisplay)
|
||||
{
|
||||
ranwipe = D_Display();
|
||||
if (!frameskip)
|
||||
{
|
||||
ranwipe = D_Display();
|
||||
}
|
||||
else if (!dedicated)
|
||||
{
|
||||
// always update console and hud
|
||||
// otherwise it may take minutes to open it
|
||||
CON_Drawer();
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only take screenshots after drawing.
|
||||
@@ -910,7 +925,7 @@ void D_SRB2Loop(void)
|
||||
// consoleplayer -> displayplayers (hear sounds from viewpoint)
|
||||
S_UpdateSounds(); // move positional sounds
|
||||
|
||||
LUA_Step();
|
||||
//LUA_Step();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (!dedicated && renderisnewtic)
|
||||
@@ -918,7 +933,6 @@ void D_SRB2Loop(void)
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Fully completed frame made.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
|
||||
@@ -956,6 +970,7 @@ void D_SRB2Loop(void)
|
||||
I_SleepDuration(capbudget - elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
// Capture the time once more to get the real delta time.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
|
||||
@@ -1215,7 +1230,7 @@ void D_AddPostloadFiles(void)
|
||||
postautoloaded = true;
|
||||
}
|
||||
|
||||
void D_CleanFile(char **filearray)
|
||||
static void D_CleanFile(char **filearray)
|
||||
{
|
||||
size_t pnumwadfiles;
|
||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
||||
@@ -1478,7 +1493,7 @@ static void D_CheckSaturnExtraFiles(void)
|
||||
}
|
||||
|
||||
// extra round joystick inputdisplay sprites
|
||||
if (W_CheckMultipleLumps("JOYBCK","JOYKNB","JOYSHD", NULL))
|
||||
if (W_CheckMultipleLumps("JOYBCK", "JOYKNB", "JOYSHD", NULL))
|
||||
{
|
||||
joystickicon = true;
|
||||
PUSHCONS(inputdisplay_cons_temp, last_inputdisplay_i, 3, "StickGFX");
|
||||
@@ -1971,45 +1986,23 @@ void D_SRB2Main(void)
|
||||
if (dedicated)
|
||||
{
|
||||
sound_disabled = true;
|
||||
digital_disabled = true;
|
||||
#ifndef NO_MIDI
|
||||
midi_disabled = true;
|
||||
#endif
|
||||
music_disabled = true;
|
||||
}
|
||||
|
||||
if (M_CheckParm("-noaudio")) // combines -nosound and -nomusic
|
||||
{
|
||||
sound_disabled = true;
|
||||
digital_disabled = true;
|
||||
#ifndef NO_MIDI
|
||||
midi_disabled = true;
|
||||
#endif
|
||||
music_disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (M_CheckParm("-nosound"))
|
||||
sound_disabled = true;
|
||||
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
|
||||
{
|
||||
digital_disabled = true;
|
||||
#ifndef NO_MIDI
|
||||
midi_disabled = true;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef NO_MIDI
|
||||
if (M_CheckParm("-nomidimusic"))
|
||||
midi_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
|
||||
#endif
|
||||
if (M_CheckParm("-nodigmusic"))
|
||||
digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
|
||||
}
|
||||
if (M_CheckParm("-nomusic"))
|
||||
music_disabled = true;
|
||||
}
|
||||
if (!( sound_disabled && digital_disabled
|
||||
#ifndef NO_MIDI
|
||||
&& midi_disabled
|
||||
#endif
|
||||
))
|
||||
|
||||
if (!(sound_disabled && music_disabled))
|
||||
{
|
||||
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
|
||||
I_StartupSound();
|
||||
@@ -2019,6 +2012,8 @@ void D_SRB2Main(void)
|
||||
|
||||
S_InitMusicDefs();
|
||||
|
||||
M_InitEmotes();
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
|
||||
@@ -85,8 +85,6 @@ void D_PostEvent(const event_t *ev);
|
||||
|
||||
void D_ProcessEvents(void);
|
||||
|
||||
void D_CleanFile(char **filearray);
|
||||
|
||||
const char *D_Home(void);
|
||||
|
||||
//
|
||||
|
||||
+35
-29
@@ -48,12 +48,6 @@ tic_t connectiontimeout = (10*TICRATE);
|
||||
|
||||
/// \brief network packet
|
||||
doomcom_t *doomcom = NULL;
|
||||
/// \brief network packet data, points inside doomcom
|
||||
doomdata_t *netbuffer = NULL;
|
||||
/// \brief hole punching packet, also points inside doomcom
|
||||
#ifdef HOLEPUNCH
|
||||
holepunch_t *holepunchpacket = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
FILE *debugfile = NULL; // put some net info in a file during the game
|
||||
@@ -209,13 +203,9 @@ static node_t nodes[MAXNETNODES];
|
||||
// 0 if a = n (mod 256)
|
||||
// >0 if a > b (mod 256)
|
||||
// mnemonic: to use it compare to 0: cmpack(a,b)<0 is "a < b" ...
|
||||
FUNCMATH static INT32 cmpack(UINT8 a, UINT8 b)
|
||||
FUNCMATH static inline INT32 cmpack(UINT8 a, UINT8 b)
|
||||
{
|
||||
register INT32 d = a - b;
|
||||
|
||||
if (d >= 127 || d < -128)
|
||||
return -d;
|
||||
return d;
|
||||
return (SINT8)(a - b);
|
||||
}
|
||||
|
||||
/** Sets freeack to a free acknum and copies the netbuffer in the ackpak table
|
||||
@@ -229,6 +219,8 @@ static boolean GetFreeAcknum(UINT8 *freeack)
|
||||
node_t *node = &nodes[doomcom->remotenode];
|
||||
INT32 i, numfreeslot = 0;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
if (cmpack((UINT8)((node->remotefirstack + MAXACKTOSEND) % 256), node->nextacknum) < 0)
|
||||
{
|
||||
DEBFILE(va("too fast %d %d\n",node->remotefirstack,node->nextacknum));
|
||||
@@ -298,6 +290,7 @@ static boolean Processackpak(void)
|
||||
INT32 i;
|
||||
boolean goodpacket = true;
|
||||
node_t *node = &nodes[doomcom->remotenode];
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
// Received an ack return, so remove the ack in the list
|
||||
if (netbuffer->ackreturn && cmpack(node->remotefirstack, netbuffer->ackreturn) < 0)
|
||||
@@ -307,7 +300,7 @@ static boolean Processackpak(void)
|
||||
// Search the ackbuffer and free it
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
if (ackpak[i].acknum && ackpak[i].destinationnode == node - nodes
|
||||
if (ackpak[i].acknum && ackpak[i].destinationnode == doomcom->remotenode
|
||||
&& cmpack(ackpak[i].acknum, netbuffer->ackreturn) <= 0)
|
||||
{
|
||||
RemoveAck(i);
|
||||
@@ -423,6 +416,7 @@ void Net_SendAcks(INT32 node)
|
||||
#ifdef NONET
|
||||
(void)node;
|
||||
#else
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
netbuffer->packettype = PT_NOTHING;
|
||||
M_Memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
|
||||
HSendPacket(node, false, 0, MAXACKTOSEND);
|
||||
@@ -434,6 +428,8 @@ static void GotAcks(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
for (j = 0; j < MAXACKTOSEND; j++)
|
||||
{
|
||||
if (netbuffer->u.textcmd[j])
|
||||
@@ -487,6 +483,8 @@ void Net_AckTicker(void)
|
||||
#ifndef NONET
|
||||
INT32 i;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
const INT32 nodei = ackpak[i].destinationnode;
|
||||
@@ -542,6 +540,7 @@ void Net_UnAcknowledgePacket(INT32 node)
|
||||
#ifdef NONET
|
||||
(void)node;
|
||||
#else
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
|
||||
DEBFILE(va("UnAcknowledge node %d\n", node));
|
||||
|
||||
@@ -736,6 +735,7 @@ void Net_CloseConnection(INT32 node)
|
||||
//
|
||||
static UINT32 NetbufferChecksum(void)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
UINT32 c = 0x1234567;
|
||||
const INT32 l = doomcom->datalength - 4;
|
||||
const UINT8 *buf = (UINT8 *)netbuffer + 4;
|
||||
@@ -852,6 +852,8 @@ const char *Net_GetPacketName(UINT8 packettype)
|
||||
|
||||
static void DebugPrintpacket(const char *header)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
fprintf(debugfile, "%-12s (node %d,ack %d,ackret %d,size %d) type(%d) : %s\n",
|
||||
header, doomcom->remotenode, netbuffer->ack, netbuffer->ackreturn, doomcom->datalength,
|
||||
netbuffer->packettype, Net_GetPacketName(netbuffer->packettype));
|
||||
@@ -1021,6 +1023,7 @@ void Command_Droprate(void)
|
||||
#ifndef NONET
|
||||
static boolean ShouldDropPacket(void)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
return (packetdropquantity[netbuffer->packettype])
|
||||
|| (packetdroprate != 0 && rand() < (((double)RAND_MAX) * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||
}
|
||||
@@ -1032,6 +1035,7 @@ static boolean ShouldDropPacket(void)
|
||||
//
|
||||
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlength)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
doomcom->datalength = (INT16)(packetlength + BASEPACKETSIZE);
|
||||
|
||||
if (node == 0) // Packet is to go back to us
|
||||
@@ -1132,7 +1136,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
//
|
||||
boolean HGetPacket(void)
|
||||
{
|
||||
//boolean nodejustjoined;
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
// Get a packet from self
|
||||
if (rebound_tail != rebound_head)
|
||||
@@ -1197,6 +1201,7 @@ boolean HGetPacket(void)
|
||||
GotAcks();
|
||||
continue;
|
||||
}
|
||||
doomcom->datalength -= BASEPACKETSIZE;
|
||||
break;
|
||||
}
|
||||
#endif // ifndef NONET
|
||||
@@ -1220,6 +1225,18 @@ static void Internal_FreeNodenum(INT32 nodenum)
|
||||
(void)nodenum;
|
||||
}
|
||||
|
||||
static char *I_NetSplitAddress(char *host, char **port)
|
||||
{
|
||||
boolean v4 = (host[0] != '[');
|
||||
|
||||
host = strtok(host, v4 ? ":" : "[]");
|
||||
|
||||
if (port)
|
||||
*port = strtok(NULL, ":");
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
SINT8 I_NetMakeNode(const char *hostname)
|
||||
{
|
||||
SINT8 newnode = -1;
|
||||
@@ -1227,20 +1244,14 @@ SINT8 I_NetMakeNode(const char *hostname)
|
||||
if (I_NetMakeNodewPort)
|
||||
{
|
||||
char *localhostname = strdup(hostname);
|
||||
char *t = localhostname;
|
||||
const char *port;
|
||||
char *port;
|
||||
if (!localhostname)
|
||||
return newnode;
|
||||
|
||||
// retrieve portnum from address!
|
||||
strtok(localhostname, ":");
|
||||
port = strtok(NULL, ":");
|
||||
hostname = I_NetSplitAddress(localhostname, &port);
|
||||
|
||||
// remove the port in the hostname as we've it already
|
||||
while ((*t != ':') && (*t != '\0'))
|
||||
t++;
|
||||
*t = '\0';
|
||||
|
||||
newnode = I_NetMakeNodewPort(localhostname, port);
|
||||
newnode = I_NetMakeNodewPort(hostname, port);
|
||||
free(localhostname);
|
||||
}
|
||||
return newnode;
|
||||
@@ -1332,11 +1343,6 @@ boolean D_CheckNetGame(void)
|
||||
if (doomcom->numnodes > MAXNETNODES)
|
||||
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
|
||||
|
||||
netbuffer = (doomdata_t *)(void *)&doomcom->data;
|
||||
#ifdef HOLEPUNCH
|
||||
holepunchpacket = (holepunch_t *)(void *)&doomcom->data;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
if (M_CheckParm("-debugfile"))
|
||||
{
|
||||
|
||||
+26
-7
@@ -21,6 +21,7 @@
|
||||
#include "i_system.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "m_emotes.h"
|
||||
#include "g_input.h"
|
||||
#include "m_menu.h"
|
||||
#include "r_local.h"
|
||||
@@ -912,6 +913,8 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_keyboardlayout);
|
||||
|
||||
CV_RegisterVar(&cv_emotes);
|
||||
|
||||
// time attack ghost options are also saved to config
|
||||
CV_RegisterVar(&cv_ghost_besttime);
|
||||
CV_RegisterVar(&cv_ghost_bestlap);
|
||||
@@ -934,6 +937,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_consolechat);
|
||||
CV_RegisterVar(&cv_chatnotifications);
|
||||
CV_RegisterVar(&cv_chatbacktint);
|
||||
CV_RegisterVar(&cv_chatcentertext);
|
||||
CV_RegisterVar(&cv_songcredits);
|
||||
CV_RegisterVar(&cv_showfreeplay);
|
||||
CV_RegisterVar(&cv_skinselectspin);
|
||||
@@ -1026,6 +1030,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
||||
CV_RegisterVar(&cv_parallelsoftware);
|
||||
CV_RegisterVar(&cv_paralleldrawmasked);
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
@@ -2082,7 +2087,7 @@ static void Command_ResetCamera_f(void)
|
||||
}
|
||||
|
||||
/* Consider replacing nametonum with this */
|
||||
static INT32 LookupPlayer(const char *s)
|
||||
INT32 D_LookupPlayer(const char *s)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
@@ -2098,8 +2103,7 @@ static INT32 LookupPlayer(const char *s)
|
||||
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
||||
{
|
||||
/* Match name case-insensitively: fully, or partially the start. */
|
||||
if (playeringame[playernum])
|
||||
if (strnicmp(player_names[playernum], s, strlen(s)) == 0)
|
||||
if (playeringame[playernum] && (strnicmp(player_names[playernum], s, strlen(s)) == 0))
|
||||
{
|
||||
return playernum;
|
||||
}
|
||||
@@ -2110,14 +2114,18 @@ static INT32 LookupPlayer(const char *s)
|
||||
static INT32 FindPlayerByPlace(INT32 place)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
||||
if (playeringame[playernum])
|
||||
{
|
||||
if (!playeringame[playernum])
|
||||
continue;
|
||||
|
||||
if (players[playernum].kartstuff[k_position] == place)
|
||||
{
|
||||
return playernum;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2210,7 +2218,7 @@ static void Command_View_f(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (( playernum = LookupPlayer(COM_Argv(1)) ) == -1)
|
||||
if (( playernum = D_LookupPlayer(COM_Argv(1)) ) == -1)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "There is no player by that name!\n");
|
||||
return;
|
||||
@@ -2498,6 +2506,14 @@ void D_SetupVote(void)
|
||||
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
|
||||
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
|
||||
INT16 votebuffer[4] = {-1,-1,-1,0};
|
||||
INT16 luamaps[4] = {0, 0, 0, 0};
|
||||
|
||||
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
|
||||
|
||||
// Correct secondgt if needed
|
||||
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
||||
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
||||
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
||||
|
||||
if (cv_kartencore.value && gt == GT_RACE)
|
||||
WRITEUINT8(p, (gt|0x80));
|
||||
@@ -2506,10 +2522,13 @@ void D_SetupVote(void)
|
||||
WRITEUINT8(p, secondgt);
|
||||
secondgt &= ~0x80;
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
UINT16 m;
|
||||
if (i == 2) // sometimes a different gametype
|
||||
if (luamaps[i])
|
||||
m = luamaps[i]-1;
|
||||
else if (i == 2) // sometimes a different gametype
|
||||
m = G_RandMap(G_TOLFlag(secondgt), prevmap, false, 0, true, votebuffer);
|
||||
else if (i >= 3) // unknown-random and force-unknown MAP HELL
|
||||
m = G_RandMap(G_TOLFlag(gt), prevmap, false, (i-2), (i < 4), votebuffer);
|
||||
@@ -5674,7 +5693,7 @@ static void Command_Archivetest_f(void)
|
||||
// assign mobjnum
|
||||
i = 1;
|
||||
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++;
|
||||
|
||||
// allocate buffer
|
||||
|
||||
@@ -323,6 +323,7 @@ void ClearAdminPlayers(void);
|
||||
void RemoveAdminPlayer(INT32 playernum);
|
||||
void ItemFinder_OnChange(void);
|
||||
void D_SetPassword(const char *pw);
|
||||
INT32 D_LookupPlayer(const char *s);
|
||||
|
||||
// used for the player setup menu
|
||||
UINT8 CanChangeSkin(INT32 playernum);
|
||||
|
||||
@@ -142,6 +142,7 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
|
||||
{
|
||||
size_t i;
|
||||
UINT8 count = 0;
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
UINT8 *p_start = netbuffer->packettype == PT_MOREFILESNEEDED ? netbuffer->u.filesneededcfg.files : netbuffer->u.serverinfo.fileneeded;
|
||||
UINT8 *p = p_start;
|
||||
char wadfilename[MAX_WADPATH] = "";
|
||||
@@ -323,6 +324,7 @@ boolean CL_SendRequestFile(void)
|
||||
#ifdef MORELEGACYDOWNLOADER
|
||||
boolean firstloop = true;
|
||||
#endif
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (M_CheckParm("-nodownload"))
|
||||
@@ -451,9 +453,11 @@ tryagain:
|
||||
// returns false if a requested file was not found or cannot be sent
|
||||
boolean Got_RequestFilePak(INT32 node)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
char wad[MAX_WADPATH+1];
|
||||
UINT8 *p = netbuffer->u.textcmd;
|
||||
UINT8 id;
|
||||
|
||||
while (p < netbuffer->u.textcmd + MAXTEXTCMD) // Don't allow hacked client to overflow
|
||||
{
|
||||
id = READUINT8(p);
|
||||
@@ -817,6 +821,7 @@ void SV_FileSendTicker(void)
|
||||
size_t size;
|
||||
filetx_t *f;
|
||||
INT32 packetsent, ram, i, j;
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
if (!filestosend) // No file to send
|
||||
return;
|
||||
@@ -945,6 +950,7 @@ void SV_FileSendTicker(void)
|
||||
|
||||
void Got_Filetxpak(void)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
INT32 filenum = netbuffer->u.filetxpak.fileid;
|
||||
fileneeded_t *file = &fileneeded[filenum];
|
||||
char *filename = file->filename;
|
||||
@@ -1185,6 +1191,18 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
||||
badmd5 = true;
|
||||
// if not found at all, just move on without doing anything
|
||||
|
||||
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
|
||||
{
|
||||
// next, check any custom directory if specified
|
||||
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
|
||||
|
||||
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
|
||||
return FS_FOUND;
|
||||
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
|
||||
badmd5 = true;
|
||||
// if not found at all, just move on without doing anything
|
||||
}
|
||||
|
||||
// finally check "." directory
|
||||
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
|
||||
|
||||
|
||||
+1
-8
@@ -28,18 +28,11 @@
|
||||
// To compile this as "ANSI C with classes" we will need to handle the various
|
||||
// action functions cleanly.
|
||||
//
|
||||
typedef void (*actionf_v)();
|
||||
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
|
||||
// to handle an actor.
|
||||
typedef actionf_t think_t;
|
||||
typedef actionf_p1 think_t;
|
||||
|
||||
// Doubly linked list of actors.
|
||||
typedef struct thinker_s
|
||||
|
||||
@@ -69,13 +69,11 @@ void I_ShutdownSound(void){}
|
||||
|
||||
\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)
|
||||
{
|
||||
(void)id;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
(void)priority;
|
||||
(void)channel;
|
||||
return 0;
|
||||
}
|
||||
@@ -116,12 +114,11 @@ boolean I_SoundIsPlaying(INT32 handle)
|
||||
|
||||
\return void
|
||||
*/
|
||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
|
||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep)
|
||||
{
|
||||
(void)handle;
|
||||
(void)vol;
|
||||
(void)sep;
|
||||
(void)pitch;
|
||||
}
|
||||
|
||||
/** \brief The I_SetSfxVolume function
|
||||
|
||||
@@ -152,3 +152,8 @@ boolean I_UseNativeKeyboard(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_SetBorderlessWindow(void)
|
||||
{
|
||||
|
||||
}
|
||||
+227
-218
@@ -178,6 +178,9 @@ FUNCPRINTF static void deh_warning(const char *first, ...)
|
||||
else
|
||||
CONS_Alert(CONS_WARNING, "Line %u: %s\n", dbg_line, buf);
|
||||
|
||||
if (dbg_line != -1 && (M_CheckParm("-strict") || M_CheckParm("-strict-soc")))
|
||||
I_Error("deh_warning: %s", buf);
|
||||
|
||||
deh_num_warning++;
|
||||
|
||||
Z_Free(buf);
|
||||
@@ -1416,211 +1419,211 @@ static void readhuditem(MYFILE *f, INT32 num)
|
||||
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONNUM ENUM IN INFO.H
|
||||
actionpointer_t actionpointers[] =
|
||||
{
|
||||
{{A_Explode}, "A_EXPLODE"},
|
||||
{{A_Pain}, "A_PAIN"},
|
||||
{{A_Fall}, "A_FALL"},
|
||||
{{A_MonitorPop}, "A_MONITORPOP"},
|
||||
{{A_Look}, "A_LOOK"},
|
||||
{{A_Chase}, "A_CHASE"},
|
||||
{{A_FaceStabChase}, "A_FACESTABCHASE"},
|
||||
{{A_FaceTarget}, "A_FACETARGET"},
|
||||
{{A_FaceTracer}, "A_FACETRACER"},
|
||||
{{A_Scream}, "A_SCREAM"},
|
||||
{{A_BossDeath}, "A_BOSSDEATH"},
|
||||
{{A_CustomPower}, "A_CUSTOMPOWER"},
|
||||
{{A_GiveWeapon}, "A_GIVEWEAPON"},
|
||||
{{A_RingShield}, "A_RINGSHIELD"},
|
||||
{{A_RingBox}, "A_RINGBOX"},
|
||||
{{A_Invincibility}, "A_INVINCIBILITY"},
|
||||
{{A_SuperSneakers}, "A_SUPERSNEAKERS"},
|
||||
{{A_BunnyHop}, "A_BUNNYHOP"},
|
||||
{{A_BubbleSpawn}, "A_BUBBLESPAWN"},
|
||||
{{A_FanBubbleSpawn}, "A_FANBUBBLESPAWN"},
|
||||
{{A_BubbleRise}, "A_BUBBLERISE"},
|
||||
{{A_BubbleCheck}, "A_BUBBLECHECK"},
|
||||
{{A_AwardScore}, "A_AWARDSCORE"},
|
||||
{{A_ExtraLife}, "A_EXTRALIFE"},
|
||||
{{A_BombShield}, "A_BOMBSHIELD"},
|
||||
{{A_JumpShield}, "A_JUMPSHIELD"},
|
||||
{{A_WaterShield}, "A_WATERSHIELD"},
|
||||
{{A_ForceShield}, "A_FORCESHIELD"},
|
||||
{{A_PityShield}, "A_PITYSHIELD"},
|
||||
{{A_GravityBox}, "A_GRAVITYBOX"},
|
||||
{{A_ScoreRise}, "A_SCORERISE"},
|
||||
{{A_ParticleSpawn}, "A_PARTICLESPAWN"},
|
||||
{{A_AttractChase}, "A_ATTRACTCHASE"},
|
||||
{{A_DropMine}, "A_DROPMINE"},
|
||||
{{A_FishJump}, "A_FISHJUMP"},
|
||||
{{A_ThrownRing}, "A_THROWNRING"},
|
||||
{{A_GrenadeRing}, "A_GRENADERING"}, // SRB2kart
|
||||
{{A_SetSolidSteam}, "A_SETSOLIDSTEAM"},
|
||||
{{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"},
|
||||
{{A_SignPlayer}, "A_SIGNPLAYER"},
|
||||
{{A_OverlayThink}, "A_OVERLAYTHINK"},
|
||||
{{A_JetChase}, "A_JETCHASE"},
|
||||
{{A_JetbThink}, "A_JETBTHINK"},
|
||||
{{A_JetgThink}, "A_JETGTHINK"},
|
||||
{{A_JetgShoot}, "A_JETGSHOOT"},
|
||||
{{A_ShootBullet}, "A_SHOOTBULLET"},
|
||||
{{A_MinusDigging}, "A_MINUSDIGGING"},
|
||||
{{A_MinusPopup}, "A_MINUSPOPUP"},
|
||||
{{A_MinusCheck}, "A_MINUSCHECK"},
|
||||
{{A_ChickenCheck}, "A_CHICKENCHECK"},
|
||||
{{A_MouseThink}, "A_MOUSETHINK"},
|
||||
{{A_DetonChase}, "A_DETONCHASE"},
|
||||
{{A_CapeChase}, "A_CAPECHASE"},
|
||||
{{A_RotateSpikeBall}, "A_ROTATESPIKEBALL"},
|
||||
{{A_SlingAppear}, "A_SLINGAPPEAR"},
|
||||
{{A_MaceRotate}, "A_MACEROTATE"},
|
||||
{{A_UnidusBall}, "A_UNIDUSBALL"},
|
||||
{{A_RockSpawn}, "A_ROCKSPAWN"},
|
||||
{{A_SetFuse}, "A_SETFUSE"},
|
||||
{{A_CrawlaCommanderThink}, "A_CRAWLACOMMANDERTHINK"},
|
||||
{{A_SmokeTrailer}, "A_SMOKETRAILER"},
|
||||
{{A_RingExplode}, "A_RINGEXPLODE"},
|
||||
{{A_OldRingExplode}, "A_OLDRINGEXPLODE"},
|
||||
{{A_MixUp}, "A_MIXUP"},
|
||||
{{A_RecyclePowers}, "A_RECYCLEPOWERS"},
|
||||
{{A_Boss1Chase}, "A_BOSS1CHASE"},
|
||||
{{A_FocusTarget}, "A_FOCUSTARGET"},
|
||||
{{A_Boss2Chase}, "A_BOSS2CHASE"},
|
||||
{{A_Boss2Pogo}, "A_BOSS2POGO"},
|
||||
{{A_BossZoom}, "A_BOSSZOOM"},
|
||||
{{A_BossScream}, "A_BOSSSCREAM"},
|
||||
{{A_Boss2TakeDamage}, "A_BOSS2TAKEDAMAGE"},
|
||||
{{A_Boss7Chase}, "A_BOSS7CHASE"},
|
||||
{{A_GoopSplat}, "A_GOOPSPLAT"},
|
||||
{{A_Boss2PogoSFX}, "A_BOSS2POGOSFX"},
|
||||
{{A_Boss2PogoTarget}, "A_BOSS2POGOTARGET"},
|
||||
{{A_BossJetFume}, "A_BOSSJETFUME"},
|
||||
{{A_EggmanBox}, "A_EGGMANBOX"},
|
||||
{{A_TurretFire}, "A_TURRETFIRE"},
|
||||
{{A_SuperTurretFire}, "A_SUPERTURRETFIRE"},
|
||||
{{A_TurretStop}, "A_TURRETSTOP"},
|
||||
{{A_JetJawRoam}, "A_JETJAWROAM"},
|
||||
{{A_JetJawChomp}, "A_JETJAWCHOMP"},
|
||||
{{A_PointyThink}, "A_POINTYTHINK"},
|
||||
{{A_CheckBuddy}, "A_CHECKBUDDY"},
|
||||
{{A_HoodThink}, "A_HOODTHINK"},
|
||||
{{A_ArrowCheck}, "A_ARROWCHECK"},
|
||||
{{A_SnailerThink}, "A_SNAILERTHINK"},
|
||||
{{A_SharpChase}, "A_SHARPCHASE"},
|
||||
{{A_SharpSpin}, "A_SHARPSPIN"},
|
||||
{{A_VultureVtol}, "A_VULTUREVTOL"},
|
||||
{{A_VultureCheck}, "A_VULTURECHECK"},
|
||||
{{A_SkimChase}, "A_SKIMCHASE"},
|
||||
{{A_1upThinker}, "A_1UPTHINKER"},
|
||||
{{A_SkullAttack}, "A_SKULLATTACK"},
|
||||
{{A_LobShot}, "A_LOBSHOT"},
|
||||
{{A_FireShot}, "A_FIRESHOT"},
|
||||
{{A_SuperFireShot}, "A_SUPERFIRESHOT"},
|
||||
{{A_BossFireShot}, "A_BOSSFIRESHOT"},
|
||||
{{A_Boss7FireMissiles}, "A_BOSS7FIREMISSILES"},
|
||||
{{A_Boss1Laser}, "A_BOSS1LASER"},
|
||||
{{A_Boss4Reverse}, "A_BOSS4REVERSE"},
|
||||
{{A_Boss4SpeedUp}, "A_BOSS4SPEEDUP"},
|
||||
{{A_Boss4Raise}, "A_BOSS4RAISE"},
|
||||
{{A_SparkFollow}, "A_SPARKFOLLOW"},
|
||||
{{A_BuzzFly}, "A_BUZZFLY"},
|
||||
{{A_GuardChase}, "A_GUARDCHASE"},
|
||||
{{A_EggShield}, "A_EGGSHIELD"},
|
||||
{{A_SetReactionTime}, "A_SETREACTIONTIME"},
|
||||
{{A_Boss1Spikeballs}, "A_BOSS1SPIKEBALLS"},
|
||||
{{A_Boss3TakeDamage}, "A_BOSS3TAKEDAMAGE"},
|
||||
{{A_Boss3Path}, "A_BOSS3PATH"},
|
||||
{{A_LinedefExecute}, "A_LINEDEFEXECUTE"},
|
||||
{{A_PlaySeeSound}, "A_PLAYSEESOUND"},
|
||||
{{A_PlayAttackSound}, "A_PLAYATTACKSOUND"},
|
||||
{{A_PlayActiveSound}, "A_PLAYACTIVESOUND"},
|
||||
{{A_SpawnObjectAbsolute}, "A_SPAWNOBJECTABSOLUTE"},
|
||||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
{{A_SetTics}, "A_SETTICS"},
|
||||
{{A_SetRandomTics}, "A_SETRANDOMTICS"},
|
||||
{{A_ChangeColorRelative}, "A_CHANGECOLORRELATIVE"},
|
||||
{{A_ChangeColorAbsolute}, "A_CHANGECOLORABSOLUTE"},
|
||||
{{A_MoveRelative}, "A_MOVERELATIVE"},
|
||||
{{A_MoveAbsolute}, "A_MOVEABSOLUTE"},
|
||||
{{A_Thrust}, "A_THRUST"},
|
||||
{{A_ZThrust}, "A_ZTHRUST"},
|
||||
{{A_SetTargetsTarget}, "A_SETTARGETSTARGET"},
|
||||
{{A_SetObjectFlags}, "A_SETOBJECTFLAGS"},
|
||||
{{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"},
|
||||
{{A_RandomState}, "A_RANDOMSTATE"},
|
||||
{{A_RandomStateRange}, "A_RANDOMSTATERANGE"},
|
||||
{{A_DualAction}, "A_DUALACTION"},
|
||||
{{A_RemoteAction}, "A_REMOTEACTION"},
|
||||
{{A_ToggleFlameJet}, "A_TOGGLEFLAMEJET"},
|
||||
{{A_ItemPop}, "A_ITEMPOP"}, // SRB2kart
|
||||
{{A_JawzChase}, "A_JAWZCHASE"}, // SRB2kart
|
||||
{{A_JawzExplode}, "A_JAWZEXPLODE"}, // SRB2kart
|
||||
{{A_SPBChase}, "A_SPBCHASE"}, // SRB2kart
|
||||
{{A_MineExplode}, "A_MINEEXPLODE"}, // SRB2kart
|
||||
{{A_BallhogExplode}, "A_BALLHOGEXPLODE"}, // SRB2kart
|
||||
{{A_LightningFollowPlayer},"A_LIGHTNINGFOLLOWPLAYER"}, //SRB2kart
|
||||
{{A_FZBoomFlash}, "A_FZBOOMFLASH"}, //SRB2kart
|
||||
{{A_FZBoomSmoke}, "A_FZBOOMSMOKE"}, //SRB2kart
|
||||
{{A_RandomShadowFrame}, "A_RANDOMSHADOWFRAME"}, //SRB2kart
|
||||
{{A_RoamingShadowThinker}, "A_ROAMINGSHADOWTHINKER"}, //SRB2kart
|
||||
{{A_MayonakaArrow}, "A_MAYONAKAARROW"}, //SRB2kart
|
||||
{{A_ReaperThinker}, "A_REAPERTHINKER"}, //SRB2kart
|
||||
{{A_MementosTPParticles}, "A_MEMENTOSTPPARTICLES"}, //SRB2kart
|
||||
{{A_FlameParticle}, "A_FLAMEPARTICLE"}, // SRB2kart
|
||||
{{A_OrbitNights}, "A_ORBITNIGHTS"},
|
||||
{{A_GhostMe}, "A_GHOSTME"},
|
||||
{{A_SetObjectState}, "A_SETOBJECTSTATE"},
|
||||
{{A_SetObjectTypeState}, "A_SETOBJECTTYPESTATE"},
|
||||
{{A_KnockBack}, "A_KNOCKBACK"},
|
||||
{{A_PushAway}, "A_PUSHAWAY"},
|
||||
{{A_RingDrain}, "A_RINGDRAIN"},
|
||||
{{A_SplitShot}, "A_SPLITSHOT"},
|
||||
{{A_MissileSplit}, "A_MISSILESPLIT"},
|
||||
{{A_MultiShot}, "A_MULTISHOT"},
|
||||
{{A_InstaLoop}, "A_INSTALOOP"},
|
||||
{{A_Custom3DRotate}, "A_CUSTOM3DROTATE"},
|
||||
{{A_SearchForPlayers}, "A_SEARCHFORPLAYERS"},
|
||||
{{A_CheckRandom}, "A_CHECKRANDOM"},
|
||||
{{A_CheckTargetRings}, "A_CHECKTARGETRINGS"},
|
||||
{{A_CheckRings}, "A_CHECKRINGS"},
|
||||
{{A_CheckTotalRings}, "A_CHECKTOTALRINGS"},
|
||||
{{A_CheckHealth}, "A_CHECKHEALTH"},
|
||||
{{A_CheckRange}, "A_CHECKRANGE"},
|
||||
{{A_CheckHeight}, "A_CHECKHEIGHT"},
|
||||
{{A_CheckTrueRange}, "A_CHECKTRUERANGE"},
|
||||
{{A_CheckThingCount}, "A_CHECKTHINGCOUNT"},
|
||||
{{A_CheckAmbush}, "A_CHECKAMBUSH"},
|
||||
{{A_CheckCustomValue}, "A_CHECKCUSTOMVALUE"},
|
||||
{{A_CheckCusValMemo}, "A_CHECKCUSVALMEMO"},
|
||||
{{A_SetCustomValue}, "A_SETCUSTOMVALUE"},
|
||||
{{A_UseCusValMemo}, "A_USECUSVALMEMO"},
|
||||
{{A_RelayCustomValue}, "A_RELAYCUSTOMVALUE"},
|
||||
{{A_CusValAction}, "A_CUSVALACTION"},
|
||||
{{A_ForceStop}, "A_FORCESTOP"},
|
||||
{{A_ForceWin}, "A_FORCEWIN"},
|
||||
{{A_SpikeRetract}, "A_SPIKERETRACT"},
|
||||
{{A_InfoState}, "A_INFOSTATE"},
|
||||
{{A_Repeat}, "A_REPEAT"},
|
||||
{{A_SetScale}, "A_SETSCALE"},
|
||||
{{A_RemoteDamage}, "A_REMOTEDAMAGE"},
|
||||
{{A_HomingChase}, "A_HOMINGCHASE"},
|
||||
{{A_TrapShot}, "A_TRAPSHOT"},
|
||||
{{A_VileTarget}, "A_VILETARGET"},
|
||||
{{A_VileAttack}, "A_VILEATTACK"},
|
||||
{{A_VileFire}, "A_VILEFIRE"},
|
||||
{{A_BrakChase}, "A_BRAKCHASE"},
|
||||
{{A_BrakFireShot}, "A_BRAKFIRESHOT"},
|
||||
{{A_BrakLobShot}, "A_BRAKLOBSHOT"},
|
||||
{{A_NapalmScatter}, "A_NAPALMSCATTER"},
|
||||
{{A_SpawnFreshCopy}, "A_SPAWNFRESHCOPY"},
|
||||
{A_Explode, "A_EXPLODE"},
|
||||
{A_Pain, "A_PAIN"},
|
||||
{A_Fall, "A_FALL"},
|
||||
{A_MonitorPop, "A_MONITORPOP"},
|
||||
{A_Look, "A_LOOK"},
|
||||
{A_Chase, "A_CHASE"},
|
||||
{A_FaceStabChase, "A_FACESTABCHASE"},
|
||||
{A_FaceTarget, "A_FACETARGET"},
|
||||
{A_FaceTracer, "A_FACETRACER"},
|
||||
{A_Scream, "A_SCREAM"},
|
||||
{A_BossDeath, "A_BOSSDEATH"},
|
||||
{A_CustomPower, "A_CUSTOMPOWER"},
|
||||
{A_GiveWeapon, "A_GIVEWEAPON"},
|
||||
{A_RingShield, "A_RINGSHIELD"},
|
||||
{A_RingBox, "A_RINGBOX"},
|
||||
{A_Invincibility, "A_INVINCIBILITY"},
|
||||
{A_SuperSneakers, "A_SUPERSNEAKERS"},
|
||||
{A_BunnyHop, "A_BUNNYHOP"},
|
||||
{A_BubbleSpawn, "A_BUBBLESPAWN"},
|
||||
{A_FanBubbleSpawn, "A_FANBUBBLESPAWN"},
|
||||
{A_BubbleRise, "A_BUBBLERISE"},
|
||||
{A_BubbleCheck, "A_BUBBLECHECK"},
|
||||
{A_AwardScore, "A_AWARDSCORE"},
|
||||
{A_ExtraLife, "A_EXTRALIFE"},
|
||||
{A_BombShield, "A_BOMBSHIELD"},
|
||||
{A_JumpShield, "A_JUMPSHIELD"},
|
||||
{A_WaterShield, "A_WATERSHIELD"},
|
||||
{A_ForceShield, "A_FORCESHIELD"},
|
||||
{A_PityShield, "A_PITYSHIELD"},
|
||||
{A_GravityBox, "A_GRAVITYBOX"},
|
||||
{A_ScoreRise, "A_SCORERISE"},
|
||||
{A_ParticleSpawn, "A_PARTICLESPAWN"},
|
||||
{A_AttractChase, "A_ATTRACTCHASE"},
|
||||
{A_DropMine, "A_DROPMINE"},
|
||||
{A_FishJump, "A_FISHJUMP"},
|
||||
{A_ThrownRing, "A_THROWNRING"},
|
||||
{A_GrenadeRing, "A_GRENADERING"}, // SRB2kart
|
||||
{A_SetSolidSteam, "A_SETSOLIDSTEAM"},
|
||||
{A_UnsetSolidSteam, "A_UNSETSOLIDSTEAM"},
|
||||
{A_SignPlayer, "A_SIGNPLAYER"},
|
||||
{A_OverlayThink, "A_OVERLAYTHINK"},
|
||||
{A_JetChase, "A_JETCHASE"},
|
||||
{A_JetbThink, "A_JETBTHINK"},
|
||||
{A_JetgThink, "A_JETGTHINK"},
|
||||
{A_JetgShoot, "A_JETGSHOOT"},
|
||||
{A_ShootBullet, "A_SHOOTBULLET"},
|
||||
{A_MinusDigging, "A_MINUSDIGGING"},
|
||||
{A_MinusPopup, "A_MINUSPOPUP"},
|
||||
{A_MinusCheck, "A_MINUSCHECK"},
|
||||
{A_ChickenCheck, "A_CHICKENCHECK"},
|
||||
{A_MouseThink, "A_MOUSETHINK"},
|
||||
{A_DetonChase, "A_DETONCHASE"},
|
||||
{A_CapeChase, "A_CAPECHASE"},
|
||||
{A_RotateSpikeBall, "A_ROTATESPIKEBALL"},
|
||||
{A_SlingAppear, "A_SLINGAPPEAR"},
|
||||
{A_MaceRotate, "A_MACEROTATE"},
|
||||
{A_UnidusBall, "A_UNIDUSBALL"},
|
||||
{A_RockSpawn, "A_ROCKSPAWN"},
|
||||
{A_SetFuse, "A_SETFUSE"},
|
||||
{A_CrawlaCommanderThink, "A_CRAWLACOMMANDERTHINK"},
|
||||
{A_SmokeTrailer, "A_SMOKETRAILER"},
|
||||
{A_RingExplode, "A_RINGEXPLODE"},
|
||||
{A_OldRingExplode, "A_OLDRINGEXPLODE"},
|
||||
{A_MixUp, "A_MIXUP"},
|
||||
{A_RecyclePowers, "A_RECYCLEPOWERS"},
|
||||
{A_Boss1Chase, "A_BOSS1CHASE"},
|
||||
{A_FocusTarget, "A_FOCUSTARGET"},
|
||||
{A_Boss2Chase, "A_BOSS2CHASE"},
|
||||
{A_Boss2Pogo, "A_BOSS2POGO"},
|
||||
{A_BossZoom, "A_BOSSZOOM"},
|
||||
{A_BossScream, "A_BOSSSCREAM"},
|
||||
{A_Boss2TakeDamage, "A_BOSS2TAKEDAMAGE"},
|
||||
{A_Boss7Chase, "A_BOSS7CHASE"},
|
||||
{A_GoopSplat, "A_GOOPSPLAT"},
|
||||
{A_Boss2PogoSFX, "A_BOSS2POGOSFX"},
|
||||
{A_Boss2PogoTarget, "A_BOSS2POGOTARGET"},
|
||||
{A_BossJetFume, "A_BOSSJETFUME"},
|
||||
{A_EggmanBox, "A_EGGMANBOX"},
|
||||
{A_TurretFire, "A_TURRETFIRE"},
|
||||
{A_SuperTurretFire, "A_SUPERTURRETFIRE"},
|
||||
{A_TurretStop, "A_TURRETSTOP"},
|
||||
{A_JetJawRoam, "A_JETJAWROAM"},
|
||||
{A_JetJawChomp, "A_JETJAWCHOMP"},
|
||||
{A_PointyThink, "A_POINTYTHINK"},
|
||||
{A_CheckBuddy, "A_CHECKBUDDY"},
|
||||
{A_HoodThink, "A_HOODTHINK"},
|
||||
{A_ArrowCheck, "A_ARROWCHECK"},
|
||||
{A_SnailerThink, "A_SNAILERTHINK"},
|
||||
{A_SharpChase, "A_SHARPCHASE"},
|
||||
{A_SharpSpin, "A_SHARPSPIN"},
|
||||
{A_VultureVtol, "A_VULTUREVTOL"},
|
||||
{A_VultureCheck, "A_VULTURECHECK"},
|
||||
{A_SkimChase, "A_SKIMCHASE"},
|
||||
{A_1upThinker, "A_1UPTHINKER"},
|
||||
{A_SkullAttack, "A_SKULLATTACK"},
|
||||
{A_LobShot, "A_LOBSHOT"},
|
||||
{A_FireShot, "A_FIRESHOT"},
|
||||
{A_SuperFireShot, "A_SUPERFIRESHOT"},
|
||||
{A_BossFireShot, "A_BOSSFIRESHOT"},
|
||||
{A_Boss7FireMissiles, "A_BOSS7FIREMISSILES"},
|
||||
{A_Boss1Laser, "A_BOSS1LASER"},
|
||||
{A_Boss4Reverse, "A_BOSS4REVERSE"},
|
||||
{A_Boss4SpeedUp, "A_BOSS4SPEEDUP"},
|
||||
{A_Boss4Raise, "A_BOSS4RAISE"},
|
||||
{A_SparkFollow, "A_SPARKFOLLOW"},
|
||||
{A_BuzzFly, "A_BUZZFLY"},
|
||||
{A_GuardChase, "A_GUARDCHASE"},
|
||||
{A_EggShield, "A_EGGSHIELD"},
|
||||
{A_SetReactionTime, "A_SETREACTIONTIME"},
|
||||
{A_Boss1Spikeballs, "A_BOSS1SPIKEBALLS"},
|
||||
{A_Boss3TakeDamage, "A_BOSS3TAKEDAMAGE"},
|
||||
{A_Boss3Path, "A_BOSS3PATH"},
|
||||
{A_LinedefExecute, "A_LINEDEFEXECUTE"},
|
||||
{A_PlaySeeSound, "A_PLAYSEESOUND"},
|
||||
{A_PlayAttackSound, "A_PLAYATTACKSOUND"},
|
||||
{A_PlayActiveSound, "A_PLAYACTIVESOUND"},
|
||||
{A_SpawnObjectAbsolute, "A_SPAWNOBJECTABSOLUTE"},
|
||||
{A_SpawnObjectRelative, "A_SPAWNOBJECTRELATIVE"},
|
||||
{A_ChangeAngleRelative, "A_CHANGEANGLERELATIVE"},
|
||||
{A_ChangeAngleAbsolute, "A_CHANGEANGLEABSOLUTE"},
|
||||
{A_PlaySound, "A_PLAYSOUND"},
|
||||
{A_FindTarget, "A_FINDTARGET"},
|
||||
{A_FindTracer, "A_FINDTRACER"},
|
||||
{A_SetTics, "A_SETTICS"},
|
||||
{A_SetRandomTics, "A_SETRANDOMTICS"},
|
||||
{A_ChangeColorRelative, "A_CHANGECOLORRELATIVE"},
|
||||
{A_ChangeColorAbsolute, "A_CHANGECOLORABSOLUTE"},
|
||||
{A_MoveRelative, "A_MOVERELATIVE"},
|
||||
{A_MoveAbsolute, "A_MOVEABSOLUTE"},
|
||||
{A_Thrust, "A_THRUST"},
|
||||
{A_ZThrust, "A_ZTHRUST"},
|
||||
{A_SetTargetsTarget, "A_SETTARGETSTARGET"},
|
||||
{A_SetObjectFlags, "A_SETOBJECTFLAGS"},
|
||||
{A_SetObjectFlags2, "A_SETOBJECTFLAGS2"},
|
||||
{A_RandomState, "A_RANDOMSTATE"},
|
||||
{A_RandomStateRange, "A_RANDOMSTATERANGE"},
|
||||
{A_DualAction, "A_DUALACTION"},
|
||||
{A_RemoteAction, "A_REMOTEACTION"},
|
||||
{A_ToggleFlameJet, "A_TOGGLEFLAMEJET"},
|
||||
{A_ItemPop, "A_ITEMPOP"}, // SRB2kart
|
||||
{A_JawzChase, "A_JAWZCHASE"}, // SRB2kart
|
||||
{A_JawzExplode, "A_JAWZEXPLODE"}, // SRB2kart
|
||||
{A_SPBChase, "A_SPBCHASE"}, // SRB2kart
|
||||
{A_MineExplode, "A_MINEEXPLODE"}, // SRB2kart
|
||||
{A_BallhogExplode, "A_BALLHOGEXPLODE"}, // SRB2kart
|
||||
{A_LightningFollowPlayer,"A_LIGHTNINGFOLLOWPLAYER"}, //SRB2kart
|
||||
{A_FZBoomFlash, "A_FZBOOMFLASH"}, //SRB2kart
|
||||
{A_FZBoomSmoke, "A_FZBOOMSMOKE"}, //SRB2kart
|
||||
{A_RandomShadowFrame, "A_RANDOMSHADOWFRAME"}, //SRB2kart
|
||||
{A_RoamingShadowThinker, "A_ROAMINGSHADOWTHINKER"}, //SRB2kart
|
||||
{A_MayonakaArrow, "A_MAYONAKAARROW"}, //SRB2kart
|
||||
{A_ReaperThinker, "A_REAPERTHINKER"}, //SRB2kart
|
||||
{A_MementosTPParticles, "A_MEMENTOSTPPARTICLES"}, //SRB2kart
|
||||
{A_FlameParticle, "A_FLAMEPARTICLE"}, // SRB2kart
|
||||
{A_OrbitNights, "A_ORBITNIGHTS"},
|
||||
{A_GhostMe, "A_GHOSTME"},
|
||||
{A_SetObjectState, "A_SETOBJECTSTATE"},
|
||||
{A_SetObjectTypeState, "A_SETOBJECTTYPESTATE"},
|
||||
{A_KnockBack, "A_KNOCKBACK"},
|
||||
{A_PushAway, "A_PUSHAWAY"},
|
||||
{A_RingDrain, "A_RINGDRAIN"},
|
||||
{A_SplitShot, "A_SPLITSHOT"},
|
||||
{A_MissileSplit, "A_MISSILESPLIT"},
|
||||
{A_MultiShot, "A_MULTISHOT"},
|
||||
{A_InstaLoop, "A_INSTALOOP"},
|
||||
{A_Custom3DRotate, "A_CUSTOM3DROTATE"},
|
||||
{A_SearchForPlayers, "A_SEARCHFORPLAYERS"},
|
||||
{A_CheckRandom, "A_CHECKRANDOM"},
|
||||
{A_CheckTargetRings, "A_CHECKTARGETRINGS"},
|
||||
{A_CheckRings, "A_CHECKRINGS"},
|
||||
{A_CheckTotalRings, "A_CHECKTOTALRINGS"},
|
||||
{A_CheckHealth, "A_CHECKHEALTH"},
|
||||
{A_CheckRange, "A_CHECKRANGE"},
|
||||
{A_CheckHeight, "A_CHECKHEIGHT"},
|
||||
{A_CheckTrueRange, "A_CHECKTRUERANGE"},
|
||||
{A_CheckThingCount, "A_CHECKTHINGCOUNT"},
|
||||
{A_CheckAmbush, "A_CHECKAMBUSH"},
|
||||
{A_CheckCustomValue, "A_CHECKCUSTOMVALUE"},
|
||||
{A_CheckCusValMemo, "A_CHECKCUSVALMEMO"},
|
||||
{A_SetCustomValue, "A_SETCUSTOMVALUE"},
|
||||
{A_UseCusValMemo, "A_USECUSVALMEMO"},
|
||||
{A_RelayCustomValue, "A_RELAYCUSTOMVALUE"},
|
||||
{A_CusValAction, "A_CUSVALACTION"},
|
||||
{A_ForceStop, "A_FORCESTOP"},
|
||||
{A_ForceWin, "A_FORCEWIN"},
|
||||
{A_SpikeRetract, "A_SPIKERETRACT"},
|
||||
{A_InfoState, "A_INFOSTATE"},
|
||||
{A_Repeat, "A_REPEAT"},
|
||||
{A_SetScale, "A_SETSCALE"},
|
||||
{A_RemoteDamage, "A_REMOTEDAMAGE"},
|
||||
{A_HomingChase, "A_HOMINGCHASE"},
|
||||
{A_TrapShot, "A_TRAPSHOT"},
|
||||
{A_VileTarget, "A_VILETARGET"},
|
||||
{A_VileAttack, "A_VILEATTACK"},
|
||||
{A_VileFire, "A_VILEFIRE"},
|
||||
{A_BrakChase, "A_BRAKCHASE"},
|
||||
{A_BrakFireShot, "A_BRAKFIRESHOT"},
|
||||
{A_BrakLobShot, "A_BRAKLOBSHOT"},
|
||||
{A_NapalmScatter, "A_NAPALMSCATTER"},
|
||||
{A_SpawnFreshCopy, "A_SPAWNFRESHCOPY"},
|
||||
|
||||
{{NULL}, "NONE"},
|
||||
{NULL, "NONE"},
|
||||
|
||||
// This NULL entry must be the last in the list
|
||||
{{NULL}, NULL},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
static void readframe(MYFILE *f, INT32 num)
|
||||
@@ -1702,7 +1705,7 @@ static void readframe(MYFILE *f, INT32 num)
|
||||
|
||||
for (z = 0; actionpointers[z].name; z++)
|
||||
{
|
||||
if (actionpointers[z].action.acv == states[num].action.acv)
|
||||
if (actionpointers[z].action == states[num].action)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -1711,17 +1714,17 @@ static void readframe(MYFILE *f, INT32 num)
|
||||
z = 0;
|
||||
found = LUA_SetLuaAction(&states[num], actiontocompare);
|
||||
if (!found)
|
||||
while (actionpointers[z].name)
|
||||
{
|
||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||
while (actionpointers[z].name)
|
||||
{
|
||||
states[num].action = actionpointers[z].action;
|
||||
states[num].action.acv = actionpointers[z].action.acv; // assign
|
||||
states[num].action.acp1 = actionpointers[z].action.acp1;
|
||||
found = true;
|
||||
break;
|
||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||
{
|
||||
states[num].action = actionpointers[z].action;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
z++;
|
||||
}
|
||||
z++;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
@@ -2855,7 +2858,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
dbg_line = -1; // start at -1 so the first line is 0.
|
||||
while (!myfeof(f))
|
||||
{
|
||||
char origpos[128];
|
||||
char origpos[256];
|
||||
INT32 size = 0;
|
||||
char *traverse;
|
||||
|
||||
@@ -2871,6 +2874,12 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
size++;
|
||||
}
|
||||
|
||||
if (size > (int)sizeof(origpos))
|
||||
{
|
||||
deh_warning("Line is too long");
|
||||
size = sizeof(origpos)-1;
|
||||
}
|
||||
|
||||
strncpy(origpos, s, size);
|
||||
origpos[size] = '\0';
|
||||
|
||||
@@ -8524,13 +8533,13 @@ static inline int lib_freeslot(lua_State *L)
|
||||
// Arguments: mobj_t actor, int var1, int var2
|
||||
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));
|
||||
var1 = (INT32)luaL_optinteger(L,2,0);
|
||||
var2 = (INT32)luaL_optinteger(L,3,0);
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
action->acp1(actor);
|
||||
(*action)(actor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -9344,13 +9353,15 @@ int LUA_SOCLib(lua_State *L)
|
||||
|
||||
const char *LUA_GetActionName(void *action)
|
||||
{
|
||||
actionf_t *act = (actionf_t *)action;
|
||||
actionf_p1 *act = (actionf_p1 *)action;
|
||||
size_t 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 NULL;
|
||||
}
|
||||
|
||||
@@ -9363,8 +9374,6 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
|
||||
if (fasticmp(actiontocompare, actionpointers[z].name))
|
||||
{
|
||||
st->action = actionpointers[z].action;
|
||||
st->action.acv = actionpointers[z].action.acv; // assign
|
||||
st->action.acp1 = actionpointers[z].action.acp1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -70,7 +70,11 @@ extern "C" {
|
||||
#include <string.h>
|
||||
|
||||
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
|
||||
#ifdef __cplusplus
|
||||
#include <cmath>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -111,8 +115,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v8.2"
|
||||
#define VERSIONSTRINGW L"Saturn v8.2"
|
||||
#define VERSIONSTRING "Saturn v8.3"
|
||||
#define VERSIONSTRINGW L"Saturn v8.3"
|
||||
// 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 appveyor.yml, for the build bots!
|
||||
@@ -646,7 +650,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
#define NOCLIPCAM
|
||||
|
||||
/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define
|
||||
#define NO_MIDI
|
||||
// yall didnt properly disable it so it always worked lol (:
|
||||
//#define NO_MIDI
|
||||
|
||||
/// Sprite rotation
|
||||
#define ROTSPRITE
|
||||
|
||||
+15
-20
@@ -102,13 +102,8 @@ extern boolean forceresetplayers, deferencoremode;
|
||||
// Internal parameters for sound rendering.
|
||||
// ========================================
|
||||
|
||||
#ifdef NO_MIDI
|
||||
#define midi_disabled true
|
||||
#else
|
||||
extern boolean midi_disabled;
|
||||
#endif
|
||||
extern boolean sound_disabled;
|
||||
extern boolean digital_disabled;
|
||||
extern boolean music_disabled;
|
||||
|
||||
// =========================
|
||||
// Status flags for refresh.
|
||||
@@ -446,19 +441,19 @@ extern UINT16 spacetimetics;
|
||||
extern UINT16 extralifetics;
|
||||
|
||||
// SRB2kart
|
||||
extern tic_t introtime;
|
||||
extern tic_t starttime;
|
||||
extern tic_t raceexittime;
|
||||
extern tic_t battleexittime;
|
||||
extern INT32 hyudorotime;
|
||||
extern INT32 stealtime;
|
||||
extern INT32 sneakertime;
|
||||
extern INT32 itemtime;
|
||||
extern INT32 comebacktime;
|
||||
extern INT32 bumptime;
|
||||
extern INT32 wipeoutslowtime;
|
||||
extern INT32 wantedreduce;
|
||||
extern INT32 wantedfrequency;
|
||||
extern const tic_t introtime;
|
||||
extern const tic_t starttime;
|
||||
extern const tic_t raceexittime;
|
||||
extern const tic_t battleexittime;
|
||||
extern const INT32 hyudorotime;
|
||||
extern const INT32 stealtime;
|
||||
extern const INT32 sneakertime;
|
||||
extern const INT32 itemtime;
|
||||
extern const INT32 comebacktime;
|
||||
extern const INT32 bumptime;
|
||||
extern const INT32 wipeoutslowtime;
|
||||
extern const INT32 wantedreduce;
|
||||
extern const INT32 wantedfrequency;
|
||||
|
||||
extern UINT8 introtoplay;
|
||||
extern UINT8 creditscutscene;
|
||||
@@ -575,7 +570,7 @@ extern consvar_t cv_downloading; // allow clients to downloading WADs.
|
||||
extern consvar_t cv_nettimeout; // SRB2Kart: Advanced server options menu
|
||||
extern consvar_t cv_jointimeout;
|
||||
extern consvar_t cv_maxping;
|
||||
extern ticcmd_t netcmds[TICQUEUE][MAXPLAYERS];
|
||||
extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
|
||||
extern INT32 serverplayer;
|
||||
extern INT32 adminplayers[MAXPLAYERS];
|
||||
|
||||
|
||||
@@ -540,6 +540,8 @@ static const char *credits[] = {
|
||||
"\"Jin\"",
|
||||
"\"riomccloud\"",
|
||||
"\"chromaticpipe\"",
|
||||
"\"PAS\"",
|
||||
"\"$HOME\"",
|
||||
"\"Achii\"",
|
||||
"\"Anonimus\"",
|
||||
"\"scizor300\"",
|
||||
|
||||
+11
-10
@@ -365,8 +365,8 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||
char searchpath[1024];
|
||||
size_t *searchpathindex;
|
||||
|
||||
dirhandle = (DIR**) malloc(maxsearchdepth * sizeof (DIR*));
|
||||
searchpathindex = (size_t *) malloc(maxsearchdepth * sizeof (size_t));
|
||||
dirhandle = (DIR**) malloc(maxsearchdepth * sizeof(DIR*));
|
||||
searchpathindex = (size_t *) malloc(maxsearchdepth * sizeof(size_t));
|
||||
|
||||
strcpy(searchpath,startpath);
|
||||
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
|
||||
strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
|
||||
strcpy(&searchpath[searchpathindex[depthleft]], dent->d_name);
|
||||
|
||||
#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))
|
||||
dent->d_type = DT_DIR;
|
||||
else if (S_ISLNK(fsstat.st_mode))
|
||||
else if (S_ISLNK(fsstat.st_mode))
|
||||
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;
|
||||
dirhandle[depthleft] = opendir(searchpath);
|
||||
|
||||
if (!dirhandle[depthleft])
|
||||
{
|
||||
// can't open it... maybe no read-permissions
|
||||
// go back to previous dir
|
||||
depthleft++;
|
||||
// can't open it... maybe no read-permissions
|
||||
// go back to previous dir
|
||||
depthleft++;
|
||||
}
|
||||
|
||||
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
||||
@@ -455,9 +456,9 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||
{
|
||||
case FS_FOUND:
|
||||
if (completepath)
|
||||
strcpy(filename,searchpath);
|
||||
strcpy(filename, searchpath);
|
||||
else
|
||||
strcpy(filename,dent->d_name);
|
||||
strcpy(filename, dent->d_name);
|
||||
retval = FS_FOUND;
|
||||
found = 1;
|
||||
break;
|
||||
|
||||
+2
-2
@@ -1051,7 +1051,7 @@ void G_ConsGhostTic(INT32 playernum)
|
||||
mobj = NULL;
|
||||
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;
|
||||
mobj = (mobj_t *)th;
|
||||
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
|
||||
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;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
|
||||
+55
-50
@@ -109,7 +109,7 @@ boolean addedtogame;
|
||||
player_t players[MAXPLAYERS];
|
||||
|
||||
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 levelstarttic; // gametic at level start
|
||||
@@ -196,19 +196,19 @@ UINT16 spacetimetics = 11*TICRATE + (TICRATE/2);
|
||||
UINT16 extralifetics = 4*TICRATE;
|
||||
|
||||
// SRB2kart
|
||||
tic_t introtime = 108+5; // plus 5 for white fade
|
||||
tic_t starttime = 6*TICRATE + (3*TICRATE/4);
|
||||
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
||||
tic_t battleexittime = 8*TICRATE;
|
||||
INT32 hyudorotime = 7*TICRATE;
|
||||
INT32 stealtime = TICRATE/2;
|
||||
INT32 sneakertime = TICRATE + (TICRATE/3);
|
||||
INT32 itemtime = 8*TICRATE;
|
||||
INT32 comebacktime = 10*TICRATE;
|
||||
INT32 bumptime = 6;
|
||||
INT32 wipeoutslowtime = 20;
|
||||
INT32 wantedreduce = 5*TICRATE;
|
||||
INT32 wantedfrequency = 10*TICRATE;
|
||||
const tic_t introtime = 108+5; // plus 5 for white fade
|
||||
const tic_t starttime = 6*TICRATE + (3*TICRATE/4);
|
||||
const tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
||||
const tic_t battleexittime = 8*TICRATE;
|
||||
const INT32 hyudorotime = 7*TICRATE;
|
||||
const INT32 stealtime = TICRATE/2;
|
||||
const INT32 sneakertime = TICRATE + (TICRATE/3);
|
||||
const INT32 itemtime = 8*TICRATE;
|
||||
const INT32 comebacktime = 10*TICRATE;
|
||||
const INT32 bumptime = 6;
|
||||
const INT32 wipeoutslowtime = 20;
|
||||
const INT32 wantedreduce = 5*TICRATE;
|
||||
const INT32 wantedfrequency = 10*TICRATE;
|
||||
|
||||
INT32 gameovertics = 15*TICRATE;
|
||||
|
||||
@@ -310,6 +310,8 @@ consvar_t cv_chatbacktint = {"chatbacktint", "On", CV_SAVE, CV_OnOff, NULL, 0, N
|
||||
static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}};
|
||||
consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_chatcentertext = {"chatcentertext", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Pause game upon window losing focus
|
||||
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -681,47 +683,49 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
INT32 axisval;
|
||||
boolean flp = false;
|
||||
|
||||
UINT8 pnum = player-1;
|
||||
|
||||
//find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis[player-1].value;
|
||||
axisval = cv_turnaxis[pnum].value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis[player-1].value;
|
||||
axisval = cv_moveaxis[pnum].value;
|
||||
break;
|
||||
case AXISCAMTURN:
|
||||
axisval = cv_camturnaxis[player-1].value;
|
||||
axisval = cv_camturnaxis[pnum].value;
|
||||
break;
|
||||
case AXISCAMSTRAFE:
|
||||
axisval = cv_camstrafeaxis[player-1].value;
|
||||
axisval = cv_camstrafeaxis[pnum].value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis[player-1].value;
|
||||
axisval = cv_brakeaxis[pnum].value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis[player-1].value;
|
||||
axisval = cv_aimaxis[pnum].value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis[player-1].value;
|
||||
axisval = cv_lookaxis[pnum].value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis[player-1].value;
|
||||
axisval = cv_fireaxis[pnum].value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis[player-1].value;
|
||||
axisval = cv_driftaxis[pnum].value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis[player-1].value;
|
||||
axisval = cv_lookbackaxis[pnum].value;
|
||||
break;
|
||||
case AXISCUSTOM1:
|
||||
axisval = cv_custom1axis[player-1].value;
|
||||
axisval = cv_custom1axis[pnum].value;
|
||||
break;
|
||||
case AXISCUSTOM2:
|
||||
axisval = cv_custom2axis[player-1].value;
|
||||
axisval = cv_custom2axis[pnum].value;
|
||||
break;
|
||||
case AXISCUSTOM3:
|
||||
axisval = cv_custom3axis[player-1].value;
|
||||
axisval = cv_custom3axis[pnum].value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
@@ -732,44 +736,51 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
axisval = -axisval;
|
||||
flp = true;
|
||||
}
|
||||
|
||||
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
|
||||
return 0;
|
||||
|
||||
if (axisval%2)
|
||||
if (axisval % 2)
|
||||
{
|
||||
axisval /= 2;
|
||||
retaxis = joyxmove[axisval];
|
||||
retaxis = joyxmove[pnum][axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
|
||||
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[player-1].value) >> FRACBITS;
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[pnum].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
|
||||
if (flp)
|
||||
retaxis = -retaxis; // flip it around
|
||||
|
||||
return retaxis;
|
||||
}
|
||||
else
|
||||
{
|
||||
axisval--;
|
||||
axisval /= 2;
|
||||
retaxis = joyymove[axisval];
|
||||
retaxis = joyymove[pnum][axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
|
||||
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[player-1].value) >> FRACBITS;
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[pnum].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
|
||||
if (flp)
|
||||
retaxis = -retaxis; // flip it around
|
||||
|
||||
return retaxis;
|
||||
}
|
||||
}
|
||||
@@ -874,7 +885,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
return;
|
||||
|
||||
const UINT8 forplayer = (ssplayer-1);
|
||||
player_t *player = ((ssplayer == 1) ? &players[consoleplayer] : &players[displayplayers[forplayer]]);
|
||||
player_t *player = P_GetLocalPlayerForNum(forplayer);
|
||||
|
||||
camera_t *thiscam = &camera[forplayer];
|
||||
const boolean freecam = camera[forplayer].freecam;
|
||||
@@ -1216,15 +1227,9 @@ static void G_DoLoadLevel(boolean resetplayer)
|
||||
}
|
||||
|
||||
// clear cmd building stuff
|
||||
memset(gamekeydown, 0, sizeof (gamekeydown));
|
||||
|
||||
for (i = 0; i < JOYAXISSET; i++)
|
||||
{
|
||||
joyxmove[i] = joyymove[i] = 0;
|
||||
joy2xmove[i] = joy2ymove[i] = 0;
|
||||
joy3xmove[i] = joy3ymove[i] = 0;
|
||||
joy4xmove[i] = joy4ymove[i] = 0;
|
||||
}
|
||||
memset(gamekeydown, 0, sizeof(gamekeydown));
|
||||
memset(joyxmove, 0, sizeof(joyxmove));
|
||||
memset(joyymove, 0, sizeof(joyymove));
|
||||
mousex = mousey = 0;
|
||||
|
||||
// clear hud messages remains (usually from game startup)
|
||||
@@ -1784,17 +1789,17 @@ void G_Ticker(boolean run)
|
||||
}
|
||||
}
|
||||
|
||||
buf = gametic % TICQUEUE;
|
||||
buf = gametic % BACKUPTICS;
|
||||
|
||||
if (!demo.playback)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++) // read/write demo and check turbo cheat
|
||||
{
|
||||
cmd = &players[i].cmd;
|
||||
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
cmd = &players[i].cmd;
|
||||
|
||||
//@TODO all this throwdir stuff shouldn't be here! But it stays for now to maintain 1.0.4 compat...
|
||||
// Remove for 1.1!
|
||||
|
||||
@@ -2559,7 +2564,7 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
|
||||
// scan all thinkers
|
||||
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;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard di
|
||||
extern INT16 rw_maximums[NUM_WEAPONS];
|
||||
|
||||
// used in game menu
|
||||
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection/*, cv_compactscoreboard*/;
|
||||
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/;
|
||||
extern consvar_t cv_songcredits;
|
||||
extern consvar_t cv_showfreeplay;
|
||||
extern consvar_t cv_growmusic, cv_supermusic;
|
||||
|
||||
+9
-19
@@ -114,8 +114,7 @@ INT32 mousex, mousey;
|
||||
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
|
||||
|
||||
// joystick values are repeated
|
||||
INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
|
||||
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
|
||||
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
|
||||
// current state of the keys: true if pushed
|
||||
UINT8 gamekeydown[NUMINPUTS];
|
||||
@@ -187,32 +186,32 @@ void G_MapEventsToControls(event_t *ev)
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[0][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[0][i] = ev->data3;
|
||||
break;
|
||||
|
||||
case ev_joystick2: // buttons are virtual keys
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET || menuactive)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[1][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[1][i] = ev->data3;
|
||||
break;
|
||||
|
||||
case ev_joystick3:
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joy3xmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joy3ymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
|
||||
break;
|
||||
|
||||
case ev_joystick4:
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joy4xmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -258,15 +257,6 @@ void G_ResetControls(void)
|
||||
memset(joyxmove, 0, sizeof(joyxmove));
|
||||
memset(joyymove, 0, sizeof(joyymove));
|
||||
|
||||
memset(joy2xmove, 0, sizeof(joy2xmove));
|
||||
memset(joy2ymove, 0, sizeof(joy2ymove));
|
||||
|
||||
memset(joy3xmove, 0, sizeof(joy3xmove));
|
||||
memset(joy3ymove, 0, sizeof(joy3ymove));
|
||||
|
||||
memset(joy4xmove, 0, sizeof(joy4xmove));
|
||||
memset(joy4ymove, 0, sizeof(joy4ymove));
|
||||
|
||||
// reset those just in case the game missed the keyup event
|
||||
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
|
||||
}
|
||||
|
||||
+8
-5
@@ -41,10 +41,12 @@ typedef enum
|
||||
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_2JOY1 = KEY_DBLHAT1 + MOUSEBUTTONS,
|
||||
KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4,
|
||||
KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_DBL2JOY1 = KEY_2HAT1 + MOUSEBUTTONS,
|
||||
KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4,
|
||||
KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4,
|
||||
@@ -61,8 +63,10 @@ typedef enum
|
||||
|
||||
KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4,
|
||||
KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1,
|
||||
KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1,
|
||||
KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1,
|
||||
|
||||
NUMINPUTS = KEY_MOUSEWHEELDOWN + 1,
|
||||
NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1, // FIXME: all the mouse 2 stuff should be removed, but it screws up mappings somehow
|
||||
} key_input_e;
|
||||
|
||||
typedef enum
|
||||
@@ -113,8 +117,7 @@ extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 mousex, mousey;
|
||||
extern INT32 mlooky; //mousey with mlookSensitivity
|
||||
|
||||
extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
|
||||
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
|
||||
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
|
||||
// current state of the keys: true if pushed
|
||||
extern UINT8 gamekeydown[NUMINPUTS];
|
||||
|
||||
@@ -99,7 +99,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
polygonArrayAllocSize *= 2;
|
||||
polygonArray = realloc(polygonArray, polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||
// also need to redo the index array, dont need to copy it though
|
||||
polygonArraySorted = realloc(polygonArraySorted, polygonArrayAllocSize * sizeof(PolygonArrayEntry*));
|
||||
free(polygonArraySorted);
|
||||
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
|
||||
}
|
||||
|
||||
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
|
||||
|
||||
@@ -21,8 +21,6 @@ extern "C" {
|
||||
#include "hw_data.h"
|
||||
#include "hw_gl.h"
|
||||
|
||||
extern boolean currently_batching;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
|
||||
|
||||
+210
-137
@@ -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.
|
||||
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
|
||||
// ==========================================================================
|
||||
|
||||
//debug counters
|
||||
#ifdef DEBUG_HWBSP
|
||||
static INT32 nobackpoly = 0;
|
||||
static INT32 skipcut = 0;
|
||||
static INT32 totalsubsecpolys = 0;
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Polygon fast alloc / free
|
||||
@@ -96,8 +102,8 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||
double frac;
|
||||
double num;
|
||||
double den;
|
||||
double v1x,v1y,v1dx,v1dy;
|
||||
double v2x,v2y,v2dx,v2dy;
|
||||
double v1x, v1y, v1dx, v1dy;
|
||||
double v2x, v2y, v2dx, v2dy;
|
||||
|
||||
// a segment of a polygon
|
||||
v1x = v1->x;
|
||||
@@ -112,6 +118,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||
v2dy = bsp->dy;
|
||||
|
||||
den = v2dy*v1dx - v2dx*v1dy;
|
||||
|
||||
if (fabsf((float)den) < 1.0E-36f) // avoid checking exactly for 0.0
|
||||
return NULL; // parallel
|
||||
|
||||
@@ -119,6 +126,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||
// (do not accept hit with the extensions)
|
||||
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
||||
frac = num / den;
|
||||
|
||||
if (frac < 0.0l || frac > 1.0l)
|
||||
return NULL;
|
||||
|
||||
@@ -128,7 +136,6 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||
frac = num / den;
|
||||
bspfrac = (float)frac;
|
||||
|
||||
|
||||
// find the interception point along the partition line
|
||||
pt.x = (float)(v2x + v2dx*frac);
|
||||
pt.y = (float)(v2y + v2dy*frac);
|
||||
@@ -136,37 +143,18 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||
return &pt;
|
||||
}
|
||||
|
||||
#define DIVLINE_VERTEX_DIFF 0.45f
|
||||
|
||||
// if two vertice coords have a x and/or y difference
|
||||
// of less or equal than 1 FRACUNIT, they are considered the same
|
||||
// point. Note: hardcoded value, 1.0f could be anything else.
|
||||
static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
|
||||
{
|
||||
#if 0
|
||||
float diff;
|
||||
diff = p2->x - p1->x;
|
||||
if (diff < -1.5f || diff > 1.5f)
|
||||
if (fabsf( p2->x - p1->x ) > DIVLINE_VERTEX_DIFF)
|
||||
return false;
|
||||
diff = p2->y - p1->y;
|
||||
if (diff < -1.5f || diff > 1.5f)
|
||||
if (fabsf( p2->y - p1->y ) > DIVLINE_VERTEX_DIFF)
|
||||
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
|
||||
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
|
||||
return true;
|
||||
}
|
||||
@@ -182,22 +170,23 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||
poly_t **frontpoly, //return one poly here
|
||||
poly_t **backpoly) //return the other here
|
||||
{
|
||||
INT32 i,j;
|
||||
INT32 i, j;
|
||||
polyvertex_t *pv;
|
||||
|
||||
INT32 ps = -1,pe = -1;
|
||||
INT32 nptfront,nptback;
|
||||
INT32 ps = -1, pe = -1;
|
||||
INT32 nptfront, nptback;
|
||||
polyvertex_t vs = {0,0,0};
|
||||
polyvertex_t ve = {0,0,0};
|
||||
polyvertex_t lastpv = {0,0,0};
|
||||
float fracs = 0.0f,frace = 0.0f; //used to tell which poly is on
|
||||
// the front side of the bsp partition line
|
||||
INT32 psonline = 0, peonline = 0;
|
||||
float fracs = 0.0f, frace = 0.0f; //used to tell which poly is on
|
||||
// the front side of the bsp partition line
|
||||
INT32 psonline = 0, peonline = 0;
|
||||
|
||||
for (i = 0; i < poly->numpts; i++)
|
||||
{
|
||||
j = i + 1;
|
||||
if (j == poly->numpts) j = 0;
|
||||
if (j == poly->numpts)
|
||||
j = 0;
|
||||
|
||||
// start & end points
|
||||
pv = fracdivline(bsp, &poly->pts[i], &poly->pts[j]);
|
||||
@@ -283,7 +272,8 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||
*backpoly = NULL;
|
||||
return;
|
||||
}
|
||||
if (pe <= ps)
|
||||
|
||||
if (UNLIKELY(pe <= ps))
|
||||
I_Error("SplitPoly: invalid splitting line (%d %d)", ps, pe);
|
||||
|
||||
// number of points on each side, _not_ counting those
|
||||
@@ -295,6 +285,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||
*backpoly = HWR_AllocPoly(2 + nptback);
|
||||
else
|
||||
*backpoly = NULL;
|
||||
|
||||
if (nptfront > 0)
|
||||
*frontpoly = HWR_AllocPoly(2 + nptfront);
|
||||
else
|
||||
@@ -307,10 +298,12 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||
*pv++ = vs;
|
||||
*pv++ = ve;
|
||||
i = pe;
|
||||
|
||||
do
|
||||
{
|
||||
if (++i == poly->numpts)
|
||||
i = 0;
|
||||
|
||||
*pv++ = poly->pts[i];
|
||||
} while (i != ps && --nptfront);
|
||||
}
|
||||
@@ -322,10 +315,12 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||
*pv++ = ve;
|
||||
*pv++ = vs;
|
||||
i = ps;
|
||||
|
||||
do
|
||||
{
|
||||
if (++i == poly->numpts)
|
||||
i = 0;
|
||||
|
||||
*pv++ = poly->pts[i];
|
||||
} while (i != pe && --nptback);
|
||||
}
|
||||
@@ -352,36 +347,48 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||
static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||
{
|
||||
INT32 i, j;
|
||||
|
||||
polyvertex_t *pv;
|
||||
|
||||
INT32 nump = 0, ps, pe;
|
||||
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;
|
||||
|
||||
fdivline_t cutseg; // x, y, dx, dy as start of node_t struct
|
||||
|
||||
poly_t *temppoly;
|
||||
|
||||
// for each seg of the subsector
|
||||
for (; count--; lseg++)
|
||||
{
|
||||
//x,y,dx,dy (like a divline)
|
||||
line_t *line = lseg->linedef;
|
||||
// x, y, dx, dy (like a divline)
|
||||
const line_t *line = lseg->linedef;
|
||||
|
||||
// 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!
|
||||
INT32 line2 = P_FindSpecialLineFromTag(PORTALSPECIAL, line->tag, -1);
|
||||
|
||||
if (line == &lines[line2])
|
||||
line2 = P_FindSpecialLineFromTag(PORTALSPECIAL, line->tag, line2);
|
||||
|
||||
if (line2 >= 0) // found it!
|
||||
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.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);
|
||||
@@ -395,6 +402,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||
// see if it cuts the convex poly
|
||||
ps = -1;
|
||||
pe = -1;
|
||||
|
||||
for (i = 0; i < poly->numpts; i++)
|
||||
{
|
||||
j = i + 1;
|
||||
@@ -437,6 +445,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||
ve = vs;
|
||||
vs = *pv;
|
||||
}
|
||||
|
||||
//found 2nd point
|
||||
break;
|
||||
}
|
||||
@@ -450,25 +459,32 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||
{
|
||||
// generate FRONT poly
|
||||
temppoly = HWR_AllocPoly(nump);
|
||||
|
||||
pv = temppoly->pts;
|
||||
*pv++ = vs;
|
||||
*pv++ = ve;
|
||||
|
||||
do
|
||||
{
|
||||
if (++ps == poly->numpts)
|
||||
ps = 0;
|
||||
*pv++ = poly->pts[ps];
|
||||
} while (ps != pe);
|
||||
|
||||
HWR_FreePoly(poly);
|
||||
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
|
||||
// line is aligned to one of the borders of the poly, and
|
||||
// only some times..)
|
||||
else
|
||||
{
|
||||
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;
|
||||
@@ -491,8 +507,10 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
|
||||
|
||||
if (poly)
|
||||
{
|
||||
poly = CutOutSubsecPoly (lseg,count,poly);
|
||||
poly = CutOutSubsecPoly(lseg,count,poly);
|
||||
#ifdef DEBUG_HWBSP
|
||||
totalsubsecpolys++;
|
||||
#endif
|
||||
//extra data for this subsector
|
||||
extrasubsectors[num].planepoly = poly;
|
||||
}
|
||||
@@ -502,8 +520,8 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
|
||||
// search for the segs source of this divline
|
||||
static inline void SearchDivline(node_t *bsp, fdivline_t *divline)
|
||||
{
|
||||
divline->x = FIXED_TO_FLOAT(bsp->x);
|
||||
divline->y = FIXED_TO_FLOAT(bsp->y);
|
||||
divline->x = FIXED_TO_FLOAT(bsp->x);
|
||||
divline->y = FIXED_TO_FLOAT(bsp->y);
|
||||
divline->dx = FIXED_TO_FLOAT(bsp->dx);
|
||||
divline->dy = FIXED_TO_FLOAT(bsp->dy);
|
||||
}
|
||||
@@ -561,10 +579,12 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
||||
if (poly && poly->numpts > 2)
|
||||
{
|
||||
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");
|
||||
else if (addsubsector > 0x7fff)
|
||||
else if (UNLIKELY(addsubsector > 0x7fff))
|
||||
I_Error("WalkBSPNode: addsubsector > 0x7fff\n");
|
||||
|
||||
*leafnode = (UINT16)((UINT16)addsubsector | NF_SUBSECTOR);
|
||||
extrasubsectors[addsubsector].planepoly = poly;
|
||||
addsubsector++;
|
||||
@@ -586,6 +606,7 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
M_ClearBox(bbox);
|
||||
poly = extrasubsectors[bspnum & ~NF_SUBSECTOR].planepoly;
|
||||
|
||||
@@ -600,12 +621,14 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
||||
SplitPoly(&fdivline, poly, &frontpoly, &backpoly);
|
||||
poly = NULL;
|
||||
|
||||
#ifdef DEBUG_HWBSP
|
||||
//debug
|
||||
if (!backpoly)
|
||||
nobackpoly++;
|
||||
#endif
|
||||
|
||||
// Recursively divide front space.
|
||||
if (frontpoly)
|
||||
if (LIKELY(frontpoly))
|
||||
{
|
||||
WalkBSPNode(bsp->children[0], frontpoly, &bsp->children[0],bsp->bbox[0]);
|
||||
|
||||
@@ -640,53 +663,79 @@ void HWR_FreeExtraSubsectors(void)
|
||||
#define MAXDIST 1.5f
|
||||
// BP: can't move vertex: DON'T change polygon geometry! (convex)
|
||||
//#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 polyvertex_t *p;
|
||||
register float ax, ay, bx, by, cx, cy, d, norm;
|
||||
|
||||
// check bbox of the seg first
|
||||
if (v1->x > v2->x)
|
||||
// check bbox of the seg first (without altering v1, v2)
|
||||
if (v2->x > v1->x)
|
||||
{
|
||||
p = v1;
|
||||
v1 = v2;
|
||||
v2 = p;
|
||||
// check if x within seg box v1..v2
|
||||
if ((va->x + MAXDIST) < v1->x) return false;
|
||||
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)
|
||||
return false;
|
||||
|
||||
if (v1->y > v2->y)
|
||||
if (v2->y > v1->y)
|
||||
{
|
||||
p = v1;
|
||||
v1 = v2;
|
||||
v2 = p;
|
||||
// check if x within seg box v1..v2
|
||||
if ((va->y + MAXDIST) < v1->y) return false;
|
||||
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
|
||||
ax= v2->x-v1->x;
|
||||
ay= v2->y-v1->y;
|
||||
norm = hypotf(ax, ay);
|
||||
// v1 = origin
|
||||
ax = v2->x-v1->x;
|
||||
ay = v2->y-v1->y;
|
||||
norm = hypotf(ax, ay); // length of seg
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
if (norm != 0) // yes, this can be exactly 0
|
||||
#pragma GCC diagnostic pop
|
||||
{
|
||||
ax /= norm;
|
||||
ay /= norm;
|
||||
ay /= norm; // unit vector along seg, v1->v2
|
||||
}
|
||||
bx = a->x-v1->x;
|
||||
by = a->y-v1->y;
|
||||
//d = a.b
|
||||
d =ax*bx+ay*by;
|
||||
|
||||
bx = va->x - v1->x;
|
||||
by = va->y - v1->y; // vector v1->va
|
||||
|
||||
// d = (a DOT b), (product of lengths * cosine( angle ))
|
||||
d = ax*bx+ay*by;
|
||||
|
||||
// bound of the seg
|
||||
if (d < 0 || d > norm)
|
||||
{
|
||||
// Also excludes some va within MAXDIST of v1 or v2
|
||||
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;
|
||||
cy = ay*d-by;
|
||||
|
||||
#ifdef MOVEVERTEX
|
||||
if (cx*cx+cy*cy <= MAXDIST*MAXDIST)
|
||||
{
|
||||
@@ -707,7 +756,7 @@ static INT32 numsplitpoly;
|
||||
static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
|
||||
{
|
||||
poly_t *q;
|
||||
INT32 j,k;
|
||||
INT32 j,k;
|
||||
|
||||
if (bspnum & NF_SUBSECTOR)
|
||||
{
|
||||
@@ -715,47 +764,55 @@ static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
|
||||
{
|
||||
bspnum &= ~NF_SUBSECTOR;
|
||||
q = extrasubsectors[bspnum].planepoly;
|
||||
|
||||
if (poly == q || !q)
|
||||
return;
|
||||
for (j = 0; j < q->numpts; j++)
|
||||
|
||||
const INT32 numpts = q->numpts;
|
||||
|
||||
for (j = 0; j < numpts; j++)
|
||||
{
|
||||
k = j+1;
|
||||
if (k == q->numpts) k = 0;
|
||||
if (k == numpts)
|
||||
k = 0;
|
||||
|
||||
if (!SameVertice(p, &q->pts[j])
|
||||
&& !SameVertice(p, &q->pts[k])
|
||||
&& PointInSeg(p, &q->pts[j],
|
||||
&q->pts[k]))
|
||||
&& PointInSeg(p, &q->pts[j], &q->pts[k]))
|
||||
{
|
||||
poly_t *newpoly = HWR_AllocPoly(q->numpts+1);
|
||||
poly_t *newpoly = HWR_AllocPoly(numpts+1);
|
||||
INT32 n;
|
||||
|
||||
for (n = 0; n <= j; n++)
|
||||
newpoly->pts[n] = q->pts[n];
|
||||
|
||||
newpoly->pts[k] = *p;
|
||||
|
||||
for (n = k+1; n < newpoly->numpts; n++)
|
||||
newpoly->pts[n] = q->pts[n-1];
|
||||
|
||||
numsplitpoly++;
|
||||
extrasubsectors[bspnum].planepoly =
|
||||
newpoly;
|
||||
extrasubsectors[bspnum].planepoly = newpoly;
|
||||
HWR_FreePoly(q);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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][BOXLEFT ])-MAXDIST <= p->x) &&
|
||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[0][BOXRIGHT ])+MAXDIST >= p->x))
|
||||
SearchSegInBSP(nodes[bspnum].children[0],p,poly);
|
||||
(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][BOXRIGHT ])+MAXDIST >= p->x))
|
||||
SearchSegInBSP(nodes[bspnum].children[0], p, poly);
|
||||
|
||||
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][BOXLEFT ])-MAXDIST <= p->x) &&
|
||||
(FIXED_TO_FLOAT(nodes[bspnum].bbox[1][BOXRIGHT ])+MAXDIST >= p->x))
|
||||
SearchSegInBSP(nodes[bspnum].children[1],p,poly);
|
||||
(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][BOXRIGHT ])+MAXDIST >= p->x))
|
||||
SearchSegInBSP(nodes[bspnum].children[1], p, poly);
|
||||
}
|
||||
|
||||
// search for T-intersection problem
|
||||
@@ -779,13 +836,18 @@ static INT32 SolveTProblem(void)
|
||||
for (l = 0; l < addsubsector; l++)
|
||||
{
|
||||
p = extrasubsectors[l].planepoly;
|
||||
|
||||
if (!p)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < p->numpts; i++)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -825,29 +887,31 @@ static void AdjustSegs(void)
|
||||
if (lseg->polyseg)
|
||||
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);
|
||||
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
|
||||
distv1 = distv1*distv1+tmp*tmp;
|
||||
if (distv1 <= nearv1)
|
||||
{
|
||||
v1found = j;
|
||||
nearv1 = distv1;
|
||||
}
|
||||
// the same with v2
|
||||
distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
|
||||
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
|
||||
distv2 = distv2*distv2+tmp*tmp;
|
||||
if (distv2 <= nearv2)
|
||||
{
|
||||
v2found = j;
|
||||
nearv2 = distv2;
|
||||
}
|
||||
v1found = j;
|
||||
nearv1 = distv1;
|
||||
}
|
||||
|
||||
// the same with v2
|
||||
distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
|
||||
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
|
||||
distv2 = distv2*distv2+tmp*tmp;
|
||||
|
||||
if (distv2 <= nearv2)
|
||||
{
|
||||
v2found = j;
|
||||
nearv2 = distv2;
|
||||
}
|
||||
}
|
||||
if (p && nearv1 <= NEARDIST*NEARDIST)
|
||||
|
||||
if (nearv1 <= NEARDIST*NEARDIST)
|
||||
// share vertice with segs
|
||||
lseg->pv1 = &(p->pts[v1found]);
|
||||
else
|
||||
@@ -862,7 +926,8 @@ static void AdjustSegs(void)
|
||||
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
|
||||
lseg->pv1 = pv;
|
||||
}
|
||||
if (p && nearv2 <= NEARDIST*NEARDIST)
|
||||
|
||||
if (nearv2 <= NEARDIST*NEARDIST)
|
||||
lseg->pv2 = &(p->pts[v2found]);
|
||||
else
|
||||
{
|
||||
@@ -875,11 +940,15 @@ static void AdjustSegs(void)
|
||||
// recompute length
|
||||
{
|
||||
float x,y;
|
||||
x = ((polyvertex_t *)lseg->pv2)->x - ((polyvertex_t *)lseg->pv1)->x
|
||||
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
||||
y = ((polyvertex_t *)lseg->pv2)->y - ((polyvertex_t *)lseg->pv1)->y
|
||||
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
||||
lseg->flength = (float)hypot(x, y);
|
||||
|
||||
const polyvertex_t *pv1 = (polyvertex_t *)lseg->pv1;
|
||||
const polyvertex_t *pv2 = (polyvertex_t *)lseg->pv2;
|
||||
|
||||
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
|
||||
//if (nearv2 > NEARDIST*NEARDIST || nearv1 > NEARDIST*NEARDIST)
|
||||
// lseg->length = 1;
|
||||
@@ -905,29 +974,29 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
#endif
|
||||
|
||||
// reset the portal flag
|
||||
gl_maphasportals = 0;
|
||||
// reset the portal and horizonline flag
|
||||
gl_maphasportals = gl_maphashorizonlines = 0;
|
||||
|
||||
// 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);
|
||||
for (i = 0;i < numvertexes; i++)
|
||||
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();
|
||||
|
||||
// allocate extra data for each subsector present in map
|
||||
totsubsectors = numsubsectors + NEWSUBSECTORS;
|
||||
extrasubsectors = calloc(totsubsectors, sizeof (*extrasubsectors));
|
||||
if (extrasubsectors == NULL)
|
||||
if (UNLIKELY(extrasubsectors == NULL))
|
||||
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
|
||||
addsubsector = numsubsectors;
|
||||
|
||||
@@ -951,17 +1020,21 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||
WalkBSPNode(bspnum, rootp, NULL,rootbbox);
|
||||
|
||||
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();
|
||||
|
||||
#ifdef DEBUG_HWBSP
|
||||
//debug debug..
|
||||
//if (nobackpoly)
|
||||
// CONS_Debug(DBG_RENDER, "no back polygon %u times\n",nobackpoly);
|
||||
if (nobackpoly)
|
||||
CONS_Debug(DBG_RENDER, "no back polygon %u times\n",nobackpoly);
|
||||
//"(should happen only with the deep water trick)"
|
||||
//if (skipcut)
|
||||
// CONS_Debug(DBG_RENDER, "%u cuts were skipped because of only one point\n",skipcut);
|
||||
if (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
|
||||
+53
-91
@@ -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.
|
||||
|
||||
// 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)
|
||||
{
|
||||
switch (format)
|
||||
@@ -334,7 +328,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
gltex->mipmap.format = textureformat;
|
||||
|
||||
// hack the Legacy skies..
|
||||
if (UNLIKELY(strncmp(texture->name, "SKY", 3) == 0 &&
|
||||
if (UNLIKELY(memcmp(texture->name, "SKY", 3) == 0 &&
|
||||
(texture->name[4] == 0 || texture->name[5] == 0)))
|
||||
{
|
||||
skyspecial = true;
|
||||
@@ -606,7 +600,6 @@ void HWR_FreeMapTextures(void)
|
||||
|
||||
static void HWR_PrecacheLevelFlats(void)
|
||||
{
|
||||
levelflat_t levelflat;
|
||||
lumpnum_t lump;
|
||||
size_t i, j;
|
||||
INT32 k;
|
||||
@@ -620,28 +613,22 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
{
|
||||
sector_t *sec = §ors[i];
|
||||
|
||||
// sector checked already?
|
||||
if (sec->validcount == validcount)
|
||||
continue;
|
||||
|
||||
sec->validcount = validcount;
|
||||
|
||||
// gotta check sector floor and ceiling
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
const boolean ceiling = (j == 0);
|
||||
INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
|
||||
const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
|
||||
|
||||
levelflat = levelflats[pic];
|
||||
const levelflat_t *levelflat = &levelflats[pic];
|
||||
|
||||
lump = levelflat.lumpnum;
|
||||
lump = levelflat->lumpnum;
|
||||
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
|
||||
|
||||
if (levelflat.speed) // it is an animated flat
|
||||
if (levelflat->speed) // it is an animated flat
|
||||
{
|
||||
for (k = 1; k < levelflat.numpics; k++)
|
||||
for (k = 1; k < levelflat->numpics; k++)
|
||||
{
|
||||
lump = levelflat.baselumpnum + k;
|
||||
lump = levelflat->baselumpnum + k;
|
||||
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
|
||||
}
|
||||
}
|
||||
@@ -655,18 +642,18 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
// just load every flat in the level
|
||||
for (i = 0; i < numlevelflats; i++)
|
||||
{
|
||||
levelflat = levelflats[i];
|
||||
lump = levelflat.lumpnum;
|
||||
const levelflat_t *levelflat = &levelflats[i];
|
||||
lump = levelflat->lumpnum;
|
||||
|
||||
HWR_GetFlat(lump, false);
|
||||
|
||||
if (levelflat.speed) // it is an animated flat
|
||||
if (!levelflat->speed) // is it an animated flat ?
|
||||
continue;
|
||||
|
||||
for (k = 1; k < levelflat->numpics; k++)
|
||||
{
|
||||
for (k = 1; k < levelflat.numpics; k++)
|
||||
{
|
||||
lump = levelflat.baselumpnum + k;
|
||||
HWR_GetFlat(lump, false);
|
||||
}
|
||||
lump = levelflat->baselumpnum + k;
|
||||
HWR_GetFlat(lump, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -676,52 +663,55 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
{
|
||||
char *texturepresent;
|
||||
anim_t *anim;
|
||||
size_t i, j;
|
||||
size_t i, j, f;
|
||||
INT32 h;
|
||||
|
||||
texturepresent = calloc(numtextures, sizeof (*texturepresent));
|
||||
if (texturepresent == NULL) I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel");
|
||||
if (texturepresent == NULL)
|
||||
I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel");
|
||||
|
||||
// Sky texture is always present.
|
||||
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
|
||||
// while the sky texture is stored like a wall texture, with a skynum dependent name.
|
||||
texturepresent[skytexture] = 1;
|
||||
HWR_GetTexture(skytexture, false);
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
line_t *line = &lines[i];
|
||||
const line_t *line = &lines[i];
|
||||
#ifdef GLENCORE
|
||||
const int noencoremap = ((line->flags & ML_TFERLINE) ? 2 : 1);
|
||||
const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1);
|
||||
#else
|
||||
const int noencoremap = 1;
|
||||
#endif
|
||||
|
||||
// line checked already?
|
||||
if (line->validcount == validcount)
|
||||
continue;
|
||||
|
||||
line->validcount = validcount;
|
||||
|
||||
// two sides
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
side_t *side = &sides[line->sidenum[j]];
|
||||
|
||||
// Single-side linedef
|
||||
// check if single-sided linedef
|
||||
if (line->sidenum[j] == 0xffff)
|
||||
continue;
|
||||
|
||||
if (side->toptexture >= 0 && side->toptexture < numtextures)
|
||||
const side_t *side = &sides[line->sidenum[j]];
|
||||
const INT32 sidetex[] = {side->toptexture, side->midtexture, side->bottomtexture};
|
||||
|
||||
// gotta check from top to bottom uwu
|
||||
for (f = 0; f < 3; f++)
|
||||
{
|
||||
texturepresent[side->toptexture] = 1|noencoremap;
|
||||
}
|
||||
if (side->midtexture >= 0 && side->midtexture < numtextures)
|
||||
{
|
||||
texturepresent[side->midtexture] = 1|noencoremap;
|
||||
}
|
||||
if (side->bottomtexture >= 0 && side->bottomtexture < numtextures)
|
||||
{
|
||||
texturepresent[side->bottomtexture] = 1|noencoremap;
|
||||
const INT32 texnum = sidetex[f];
|
||||
if (texnum < 0 || texnum >= numtextures || texturepresent[texnum])
|
||||
continue;
|
||||
|
||||
texturepresent[texnum] = 1|noencoremap;
|
||||
|
||||
HWR_GetTexture(texnum, false);
|
||||
#ifdef GLENCORE
|
||||
if (noencoremap & 2)
|
||||
HWR_GetTexture(texnum, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check for animated textures
|
||||
for (anim = anims; anim < lastanim; anim++)
|
||||
{
|
||||
if (!anim->istexture)
|
||||
@@ -732,47 +722,21 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
if (!texpresent)
|
||||
continue;
|
||||
|
||||
if (texpresent & 1)
|
||||
for (h = 1; h < anim->numpics; h++)
|
||||
{
|
||||
for (h = 1; h < anim->numpics; h++)
|
||||
if (texpresent & 1)
|
||||
{
|
||||
HWR_GetTexture(anim->basepic+h, false);
|
||||
}
|
||||
}
|
||||
#ifdef GLENCORE
|
||||
if (texpresent & 2)
|
||||
{
|
||||
for (h = 1; h < anim->numpics; h++)
|
||||
if (texpresent & 2)
|
||||
{
|
||||
HWR_GetTexture(anim->basepic+h, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Sky texture is always present.
|
||||
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
|
||||
// while the sky texture is stored like a wall texture, with a skynum dependent name.
|
||||
texturepresent[skytexture] = 1;
|
||||
|
||||
for (i = 0; i < (unsigned)numtextures; i++)
|
||||
{
|
||||
const char texpresent = texturepresent[i];
|
||||
|
||||
if (!texpresent)
|
||||
continue;
|
||||
|
||||
if (texpresent & 1)
|
||||
{
|
||||
HWR_GetTexture(i, false);
|
||||
}
|
||||
#ifdef GLENCORE
|
||||
if (texpresent & 2)
|
||||
{
|
||||
HWR_GetTexture(i, true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
free(texturepresent);
|
||||
}
|
||||
|
||||
@@ -781,21 +745,19 @@ static void HWR_PrecacheLevelSprites(void)
|
||||
patch_t *spritepatch;
|
||||
char *spritepresent;
|
||||
size_t i, j, k;
|
||||
lumpnum_t lump;
|
||||
|
||||
thinker_t *th;
|
||||
mobj_t *mo;
|
||||
spriteframe_t *sf;
|
||||
|
||||
spritepresent = calloc(numsprites, sizeof (*spritepresent));
|
||||
if (spritepresent == NULL) I_Error("%s: Out of memory looking up sprites", "HWR_PrecacheLevel");
|
||||
if (spritepresent == NULL)
|
||||
I_Error("%s: Out of memory looking up sprites", "HWR_PrecacheLevel");
|
||||
|
||||
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;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
const mobj_t *mo = (mobj_t *)th;
|
||||
|
||||
// ogl is weird
|
||||
// for some reason it does not want to preload sprites with colormaps
|
||||
@@ -813,10 +775,10 @@ static void HWR_PrecacheLevelSprites(void)
|
||||
|
||||
for (j = 0; j < sprites[i].numframes; j++)
|
||||
{
|
||||
sf = &sprites[i].spriteframes[j];
|
||||
const spriteframe_t *sf = &sprites[i].spriteframes[j];
|
||||
|
||||
#define cacheang(a) {\
|
||||
lump = sf->lumppat[a];\
|
||||
const lumpnum_t lump = sf->lumppat[a];\
|
||||
spritepatch = (patch_t *)W_CachePatchNum(lump, PU_SPRITE);\
|
||||
if (spritepatch != NULL)\
|
||||
HWR_GetPatch(spritepatch);\
|
||||
|
||||
@@ -121,7 +121,7 @@ static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end)
|
||||
|
||||
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle)
|
||||
{
|
||||
if(startAngle > endAngle)
|
||||
if (startAngle > endAngle)
|
||||
{
|
||||
return (gld_clipper_IsRangeVisible(startAngle, ANGLE_MAX) || gld_clipper_IsRangeVisible(0, endAngle));
|
||||
}
|
||||
|
||||
+18
-6
@@ -610,7 +610,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
const RGBA_t *palette = HWR_GetTexturePalette();
|
||||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
@@ -794,7 +794,7 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
||||
{
|
||||
F2DCoord v1, v2;
|
||||
RGBA_t color_rgba;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
const RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
color_rgba = palette[color&0xFF];
|
||||
|
||||
@@ -815,7 +815,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh, fwait = 0;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
RGBA_t *palette;
|
||||
|
||||
if (wh < 0)
|
||||
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)
|
||||
return;
|
||||
|
||||
if (fx < 0)
|
||||
{
|
||||
fw += fx;
|
||||
fx = 0;
|
||||
}
|
||||
|
||||
if (fy < 0)
|
||||
{
|
||||
fh += fy;
|
||||
@@ -873,11 +875,13 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
|
||||
if (fw <= 0 || fh <= 0)
|
||||
return;
|
||||
|
||||
if (fx + fw > vid.width)
|
||||
{
|
||||
fwait = fw - (fvw- fx);
|
||||
fw = fvw - fx;
|
||||
}
|
||||
|
||||
if (fy + fh > vid.height)
|
||||
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[2].t = v[3].t = 1.0f;
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
Surf.PolyColor = palette[color&0xFF];
|
||||
|
||||
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];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
if (w < 0 || h < 0)
|
||||
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)
|
||||
{
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
RGBA_t rgbaColour = palette[color&0xFF];
|
||||
FRGBAFloat clearColour;
|
||||
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))
|
||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
|
||||
}
|
||||
|
||||
if (options & V_SPLITSCREEN)
|
||||
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
|
||||
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)
|
||||
return;
|
||||
|
||||
if (fx < 0)
|
||||
{
|
||||
fw += fx;
|
||||
fx = 0;
|
||||
}
|
||||
|
||||
if (fy < 0)
|
||||
{
|
||||
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)
|
||||
return;
|
||||
|
||||
if (fx + fw > vid.width)
|
||||
fw = fvw - fx;
|
||||
|
||||
if (fy + fh > vid.height)
|
||||
fh = fvh - fy;
|
||||
|
||||
@@ -1026,12 +1037,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh;
|
||||
UINT8 alphalevel = ((color & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
if (w < 0 || h < 0)
|
||||
return; // consistency w/ software
|
||||
|
||||
const UINT8 alphalevel = ((color & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
const RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
// |/ |
|
||||
|
||||
@@ -60,6 +60,9 @@ void HWR_FreeExtraSubsectors(void);
|
||||
// --------
|
||||
// hw_cache.c
|
||||
// --------
|
||||
|
||||
extern RGBA_t mapPalette[256];
|
||||
|
||||
void HWR_InitMapTextures(void);
|
||||
void HWR_LoadMapTextures(size_t pnumtextures);
|
||||
void HWR_FreeMapTextures(void);
|
||||
@@ -85,7 +88,6 @@ void HWR_ClearAllTextures(void);
|
||||
void HWR_FreeColormapCache(void);
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||
|
||||
RGBA_t *HWR_GetTexturePalette(void);
|
||||
void HWR_SetPalette(RGBA_t *palette);
|
||||
void HWR_SetMapPalette(void);
|
||||
UINT32 HWR_CreateLightTable(UINT8 *lighttable);
|
||||
|
||||
+192
-201
@@ -14,8 +14,6 @@
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include <algorithm>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../doomdef.h"
|
||||
@@ -99,8 +97,6 @@ line_t *gl_linedef;
|
||||
sector_t *gl_frontsector;
|
||||
sector_t *gl_backsector;
|
||||
|
||||
static boolean gl_maphashorizonlines = false;
|
||||
|
||||
// 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};
|
||||
// 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_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_AddPrecipitationSprites(void);
|
||||
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 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 secbright_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t glfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED, "Nearest"},
|
||||
{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_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_glanisotropicmode = {"gr_anisotropicmode", "1", CV_CALL|CV_SAVE, glanisotropicmode_cons_t, CV_anisotropic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -374,7 +378,7 @@ void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32
|
||||
fixed_t extralight = R_GetSpriteDirectionalLighting(R_PointToAngle(spr->mobj->x, spr->mobj->y));
|
||||
|
||||
// Less change in contrast in dark sectors
|
||||
extralight = FixedMul(extralight, CLAMP(*lightlevel, 0, 255) * FRACUNIT / 255);
|
||||
extralight = FixedMul(extralight, std::min(std::max(0, *lightlevel), 255) * FRACUNIT / 255);
|
||||
|
||||
// simple OGL approximation
|
||||
fixed_t tr = R_QuickCamDist(spr->mobj->x, spr->mobj->y) << FRACBITS;
|
||||
@@ -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;
|
||||
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
|
||||
if (!HWR_UseShader())
|
||||
{
|
||||
@@ -446,15 +453,13 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
||||
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
|
||||
if (!HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
V_CubeApply(&tint_color.s.red, &tint_color.s.green, &tint_color.s.blue);
|
||||
V_CubeApply(&fade_color.s.red, &fade_color.s.green, &fade_color.s.blue);
|
||||
}
|
||||
|
||||
Surface->PolyColor.rgba = poly_color.rgba;
|
||||
Surface->TintColor.rgba = tint_color.rgba;
|
||||
Surface->FadeColor.rgba = fade_color.rgba;
|
||||
@@ -544,9 +549,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
INT32 i;
|
||||
|
||||
float height; // constant y for all points on the convex flat polygon
|
||||
float flatxref, flatyref = 0.0f;
|
||||
float fflatsize = 64.0f;
|
||||
INT32 flatflag = 63;
|
||||
static float flatxref = 0.0f, flatyref = 0.0f;
|
||||
static float fflatsize = 64.0f;
|
||||
static INT32 flatflag = 63;
|
||||
size_t len;
|
||||
|
||||
float tempxsow, tempytow;
|
||||
@@ -704,7 +709,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++)
|
||||
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));
|
||||
|
||||
@@ -746,7 +752,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
|
||||
for (i = 0; i < subsector->numlines; i++, line++)
|
||||
{
|
||||
if (line->linedef->special != HORIZONSPECIAL)
|
||||
// this check sucks and is a hotspot lel
|
||||
if (LIKELY(line->linedef->special != HORIZONSPECIAL))
|
||||
continue;
|
||||
|
||||
if (R_PointOnSegSide(viewx, viewy, line) != 0)
|
||||
@@ -762,8 +769,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 = FixedToFloat(line->v1->x);
|
||||
y1 = FixedToFloat(line->v1->x);
|
||||
x1 = y1 = FixedToFloat(line->v1->x);
|
||||
}
|
||||
|
||||
if (line->pv2)
|
||||
@@ -1008,10 +1014,10 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
|
||||
float diff;
|
||||
|
||||
fixed_t v1x = FloatToFixed(wallVerts[0].x);
|
||||
fixed_t v1y = FloatToFixed(wallVerts[0].z);
|
||||
fixed_t v2x = FloatToFixed(wallVerts[1].x);
|
||||
fixed_t v2y = FloatToFixed(wallVerts[1].z);
|
||||
const fixed_t v1x = FloatToFixed(wallVerts[0].x);
|
||||
const fixed_t v1y = FloatToFixed(wallVerts[0].z);
|
||||
const fixed_t v2x = FloatToFixed(wallVerts[1].x);
|
||||
const fixed_t v2y = FloatToFixed(wallVerts[1].z);
|
||||
|
||||
const UINT8 alpha = Surf->PolyColor.s.alpha;
|
||||
FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, gl_curline, NULL);
|
||||
@@ -1049,7 +1055,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
if ((endtop < endrealbot) && (top < realbot))
|
||||
return;
|
||||
|
||||
lightlist_t *list = sector->lightlist;
|
||||
const lightlist_t *list = sector->lightlist;
|
||||
|
||||
if (!(list[i].flags & FF_NOSHADE))
|
||||
{
|
||||
@@ -1217,6 +1223,7 @@ static void HWR_DrawSkyWallList(void)
|
||||
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
GL_UnSetShader();
|
||||
|
||||
for (i = 0; i < skyWallVertexArraySize; i++)
|
||||
{
|
||||
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture|PF_Skydecal);
|
||||
@@ -1387,9 +1394,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
wallVerts[2].z = wallVerts[1].z = ve.y;
|
||||
|
||||
// x offset the texture
|
||||
fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
|
||||
float cliplow = (float)texturehpeg;
|
||||
float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
|
||||
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
|
||||
const float cliplow = (float)texturehpeg;
|
||||
const float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
|
||||
|
||||
FUINT lightnum = gl_frontsector->lightlevel;
|
||||
extracolormap_t *colormap = gl_frontsector->extra_colormap;
|
||||
@@ -1400,7 +1407,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (gl_frontsector)
|
||||
Surf.PolyColor.s.alpha = 255;
|
||||
|
||||
INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||
GLMapTexture_t *glTex = NULL;
|
||||
|
||||
// two sided line
|
||||
@@ -1678,7 +1685,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
|
||||
// Find the wall's coordinates
|
||||
fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
|
||||
const fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
|
||||
|
||||
if (gl_linedef->flags & ML_EFFECT2)
|
||||
{
|
||||
@@ -2004,6 +2011,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
}
|
||||
|
||||
FBITFIELD blendmode;
|
||||
|
||||
if (roverflags & FF_FOG)
|
||||
@@ -3025,7 +3033,7 @@ static void HWR_Subsector(size_t num)
|
||||
// rendering heights for bottom and top planes
|
||||
// yes there were functions for this stuff, no idea why it wasnt used but bleh
|
||||
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
|
||||
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
|
||||
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
|
||||
|
||||
if (gl_frontsector->cullheight)
|
||||
{
|
||||
@@ -3165,7 +3173,10 @@ doaddline:
|
||||
{
|
||||
// draw sprites first, coz they are clipped to the solidsegs of
|
||||
// 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
|
||||
// gl_frontsector doesn't point anymore to sub->sector due to
|
||||
@@ -3296,7 +3307,7 @@ static gl_vissprite_t gl_overflowsprite;
|
||||
|
||||
static gl_vissprite_t *HWR_GetVisSprite(UINT32 num)
|
||||
{
|
||||
UINT32 chunk = num >> VISSPRITECHUNKBITS;
|
||||
const UINT32 chunk = num >> VISSPRITECHUNKBITS;
|
||||
|
||||
// Allocate chunk if necessary
|
||||
if (!gl_visspritechunks[chunk])
|
||||
@@ -3316,7 +3327,7 @@ static gl_vissprite_t *HWR_NewVisSprite(void)
|
||||
// Finds a floor through which light does not pass.
|
||||
static fixed_t HWR_OpaqueFloorAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||
{
|
||||
const sector_t *sec = R_PointInSubsector(x, y)->sector;
|
||||
const sector_t *sec = R_PointInSubsectorFast(x, y)->sector;
|
||||
fixed_t floorz = sec->floorheight;
|
||||
|
||||
if (sec->ffloors)
|
||||
@@ -3358,13 +3369,6 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
fixed_t slopez;
|
||||
float offset = 0;
|
||||
|
||||
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
|
||||
if (spr->mobj)
|
||||
this_scale = FixedToFloat(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale);
|
||||
|
||||
R_GetShadowZ(spr->mobj, &floorslope);
|
||||
|
||||
mobjfloor = HWR_OpaqueFloorAtPos(
|
||||
@@ -3415,6 +3419,14 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
else
|
||||
floorheight = FixedInt(spr->mobj->z - mobjfloor);
|
||||
|
||||
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
|
||||
|
||||
if (spr->mobj)
|
||||
this_scale = FixedToFloat(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale);
|
||||
|
||||
// create the sprite billboard
|
||||
//
|
||||
// 3--2
|
||||
@@ -3520,7 +3532,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
|
||||
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;
|
||||
}
|
||||
@@ -3732,6 +3744,9 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
|
||||
}
|
||||
|
||||
if (cv_playerfade.value && spr->mobj->player)
|
||||
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
shader = SHADER_SPRITE;
|
||||
@@ -3757,7 +3772,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
continue;
|
||||
|
||||
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;
|
||||
break;
|
||||
@@ -3776,7 +3791,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -3886,11 +3901,13 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
if (!spr->mobj || !spr->mobj->subsector)
|
||||
const mobj_t *sprmo = spr->mobj;
|
||||
|
||||
if (UNLIKELY(!sprmo || !sprmo->subsector))
|
||||
return;
|
||||
|
||||
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
|
||||
const sector_t *sector = spr->mobj->subsector->sector;
|
||||
const boolean papersprite = (sprmo->frame & FF_PAPERSPRITE);
|
||||
const sector_t *sector = sprmo->subsector->sector;
|
||||
|
||||
if (sector->numlights)
|
||||
{
|
||||
@@ -3956,9 +3973,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
|
||||
// Draw shadow BEFORE sprite
|
||||
if (UNLIKELY(cv_shadow.value // Shadows enabled
|
||||
&& (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
|
||||
&& !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
|
||||
&& (spr->mobj->z >= spr->mobj->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
|
||||
&& (sprmo->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
|
||||
&& !(sprmo->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
|
||||
&& (sprmo->z >= sprmo->floorz))) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
|
||||
{
|
||||
////////////////////
|
||||
// SHADOW SPRITE! //
|
||||
@@ -3981,31 +3998,31 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
|
||||
if (!lightset)
|
||||
{
|
||||
lightlevel = static_cast<INT32>(CLAMP(sector->lightlevel, 0, 255));
|
||||
lightlevel = static_cast<INT32>(sector->lightlevel);
|
||||
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
|
||||
}
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !fullbright);
|
||||
|
||||
INT32 blendmode;
|
||||
if (spr->mobj->frame & FF_BLENDMASK)
|
||||
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
if (sprmo->frame & FF_BLENDMASK)
|
||||
blendmode = ((sprmo->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
else
|
||||
blendmode = spr->mobj->blendmode;
|
||||
blendmode = sprmo->blendmode;
|
||||
|
||||
if (UNLIKELY(!cv_translucency.value)) // translucency disabled
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
blend = PF_Translucent|PF_Occlude;
|
||||
}
|
||||
else if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
else if (sprmo->flags2 & MF2_SHADOW)
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
blend = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
else if (sprmo->frame & FF_TRANSMASK)
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
INT32 trans = (sprmo->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
blend = HWR_SurfaceBlend(blendmode, trans, &Surf);
|
||||
}
|
||||
else
|
||||
@@ -4018,6 +4035,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
|
||||
}
|
||||
|
||||
if (cv_playerfade.value && sprmo->player)
|
||||
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
shader = SHADER_SPRITE;
|
||||
@@ -4038,7 +4058,9 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
if (!spr->mobj || !spr->mobj->subsector)
|
||||
const mobj_t *sprmo = spr->mobj;
|
||||
|
||||
if (UNLIKELY(!sprmo || !sprmo->subsector))
|
||||
return;
|
||||
|
||||
// cache sprite graphics
|
||||
@@ -4076,26 +4098,26 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
wallVerts[0].t = wallVerts[1].t = hwrpatch->max_t;
|
||||
|
||||
// colormap test
|
||||
sector_t *sector = spr->mobj->subsector->sector;
|
||||
UINT8 lightlevel = 255;
|
||||
sector_t *sector = sprmo->subsector->sector;
|
||||
INT32 lightlevel = 255;
|
||||
extracolormap_t *colormap = sector->extra_colormap;
|
||||
|
||||
if (sector->numlights)
|
||||
{
|
||||
INT32 light;
|
||||
|
||||
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, sprmo->z + sprmo->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = static_cast<UINT8>(CLAMP(*sector->lightlist[light].lightlevel, 0, 255));
|
||||
if (!(sprmo->frame & FF_FULLBRIGHT))
|
||||
lightlevel = static_cast<INT32>(*sector->lightlist[light].lightlevel);
|
||||
|
||||
if (sector->lightlist[light].extra_colormap)
|
||||
colormap = sector->lightlist[light].extra_colormap;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = static_cast<UINT8>(CLAMP(sector->lightlevel, 0, 255));
|
||||
if (!(sprmo->frame & FF_FULLBRIGHT))
|
||||
lightlevel = static_cast<INT32>(sector->lightlevel);
|
||||
|
||||
if (sector->extra_colormap)
|
||||
colormap = sector->extra_colormap;
|
||||
@@ -4103,9 +4125,9 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector));
|
||||
|
||||
if (spr->mobj->frame & FF_TRANSMASK)
|
||||
if (sprmo->frame & FF_TRANSMASK)
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
INT32 trans = (sprmo->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
blend = HWR_SurfaceBlend(AST_TRANSLUCENT, trans, &Surf);
|
||||
}
|
||||
else
|
||||
@@ -4137,8 +4159,8 @@ gl_vissprite_t* gl_vsprorder[MAXVISSPRITES];
|
||||
// sorted and drawn together with transparent surfaces.
|
||||
static int CompareVisSprites(const void *p1, const void *p2)
|
||||
{
|
||||
gl_vissprite_t* spr1 = *(gl_vissprite_t*const*)p1;
|
||||
gl_vissprite_t* spr2 = *(gl_vissprite_t*const*)p2;
|
||||
const gl_vissprite_t* spr1 = *(gl_vissprite_t*const*)p1;
|
||||
const gl_vissprite_t* spr2 = *(gl_vissprite_t*const*)p2;
|
||||
int idiff;
|
||||
float fdiff;
|
||||
|
||||
@@ -4316,8 +4338,8 @@ static void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *poly
|
||||
|
||||
static int CompareDrawNodePlanes(const void *p1, const void *p2)
|
||||
{
|
||||
INT32 n1 = *(const INT32*)p1;
|
||||
INT32 n2 = *(const INT32*)p2;
|
||||
const INT32 n1 = *(const INT32*)p1;
|
||||
const INT32 n2 = *(const INT32*)p2;
|
||||
|
||||
return ABS(drawnodes[n2].u.plane.fixedheight - viewz) - ABS(drawnodes[n1].u.plane.fixedheight - viewz);
|
||||
}
|
||||
@@ -4450,6 +4472,15 @@ static void HWR_RenderDrawNodes(void)
|
||||
// --------------------------------------------------------------------------
|
||||
// Draw all vissprites
|
||||
// --------------------------------------------------------------------------
|
||||
namespace
|
||||
{
|
||||
enum class DrawSpritesType
|
||||
{
|
||||
kSprites,
|
||||
kModels,
|
||||
};
|
||||
|
||||
template <DrawSpritesType Type>
|
||||
static void HWR_DrawSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
@@ -4464,61 +4495,53 @@ static void HWR_DrawSprites(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
HWR_DrawSprite(spr);
|
||||
}
|
||||
}
|
||||
|
||||
static void HWR_DrawModels(void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
for (i = 0; i < gl_visspritecount; i++)
|
||||
{
|
||||
gl_vissprite_t *spr = gl_vsprorder[i];
|
||||
|
||||
if (spr->precip)
|
||||
if constexpr (Type == DrawSpritesType::kModels)
|
||||
{
|
||||
HWR_DrawPrecipitationSprite(spr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!spr->mobj)
|
||||
continue;
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
md2_t *md2;
|
||||
|
||||
if (spr->mobj->localskin)
|
||||
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
md2_t *md2;
|
||||
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (((md2->notfound || md2->scale < 0.0f) && ((!cv_glfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (((md2->notfound || md2->scale < 0.0f) && ((!cv_glfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
{
|
||||
if (md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if constexpr (Type == DrawSpritesType::kSprites)
|
||||
{
|
||||
if (md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
HWR_DrawSprite(spr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// HWR_AddSprites
|
||||
// During BSP traversal, this adds sprites by sector.
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
namespace
|
||||
{
|
||||
template <AddSpritesType Type>
|
||||
static void HWR_AddSprites(sector_t *sec)
|
||||
{
|
||||
mobj_t *thing;
|
||||
@@ -4534,22 +4557,29 @@ static void HWR_AddSprites(sector_t *sec)
|
||||
// Well, now it will be done.
|
||||
sec->validcount = validcount;
|
||||
|
||||
limit_dist = cv_drawdist.value;
|
||||
|
||||
if (current_bsp_culling_distance)
|
||||
if constexpr (Type == AddSpritesType::kLimitDist)
|
||||
{
|
||||
// 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;
|
||||
limit_dist = cv_drawdist.value;
|
||||
|
||||
if (current_bsp_culling_distance)
|
||||
{
|
||||
// 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.
|
||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||
{
|
||||
if (!R_ThingWithinDist(thing, limit_dist))
|
||||
continue;
|
||||
// reduce branching in this rather tight loop
|
||||
if constexpr (Type == AddSpritesType::kLimitDist)
|
||||
{
|
||||
if (!R_ThingWithinDist(thing, limit_dist))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!R_ThingVisible(thing))
|
||||
continue;
|
||||
@@ -4557,6 +4587,7 @@ static void HWR_AddSprites(sector_t *sec)
|
||||
HWR_ProjectSprite(thing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// HWR_AddPrecipitationSprites
|
||||
@@ -4666,8 +4697,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
|
||||
return;
|
||||
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
|
||||
INT32 blendmode;
|
||||
if (thing->frame & FF_BLENDMASK)
|
||||
blendmode = ((thing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
@@ -4681,6 +4710,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
return;
|
||||
}
|
||||
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
|
||||
// transform the origin point
|
||||
tr_x = FixedToFloat(interp.x);
|
||||
tr_y = FixedToFloat(interp.y);
|
||||
@@ -4708,12 +4739,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate);
|
||||
#endif
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -4752,6 +4777,12 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
I_Error("sprframes NULL for sprite %d\n", thing->sprite);
|
||||
#endif
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate);
|
||||
#endif
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite
|
||||
#ifdef ROTSPRITE
|
||||
|| (shouldrotate)
|
||||
@@ -4940,24 +4971,24 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
vis->mobj = thing;
|
||||
|
||||
//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)
|
||||
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)
|
||||
vis->colormap = static_cast<UINT8*>(R_GetTranslationColormap(TC_METALSONIC, SKINCOLOR_NONE, GTC_CACHE));
|
||||
vis->colormap = R_GetTranslationColormap(TC_METALSONIC, SKINCOLOR_NONE, GTC_CACHE);
|
||||
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)
|
||||
{
|
||||
// New colormap stuff for skins Tails 06-07-2002
|
||||
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!
|
||||
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
|
||||
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
|
||||
{
|
||||
@@ -5195,13 +5226,13 @@ void HWR_BuildSkyDome(void)
|
||||
{
|
||||
int c, r;
|
||||
signed char yflip;
|
||||
int row_count = 4;
|
||||
static constexpr int row_count = 4;
|
||||
int col_count = 4;
|
||||
float delta;
|
||||
|
||||
gl_sky_t *sky = &gl_sky;
|
||||
gl_skyvertex_t *vertex_p;
|
||||
texture_t *texture = textures[texturetranslation[skytexture]];
|
||||
const texture_t *texture = textures[texturetranslation[skytexture]];
|
||||
|
||||
sky->detail = 16;
|
||||
col_count *= sky->detail;
|
||||
@@ -5275,19 +5306,14 @@ static void HWR_DrawSkyBackground(void)
|
||||
{
|
||||
FTransform dometransform;
|
||||
|
||||
if (drewsky)
|
||||
return;
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
if (drewsky || HWR_IsWireframeMode())
|
||||
return;
|
||||
|
||||
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
|
||||
memcpy(&dometransform, &atransform, sizeof(FTransform));
|
||||
|
||||
dometransform.x = 0.0;
|
||||
dometransform.y = 0.0;
|
||||
dometransform.z = 0.0;
|
||||
dometransform.x = dometransform.y = dometransform.z = 0.0;
|
||||
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// It should replace all other gl_viewxxx when finished
|
||||
@@ -5304,6 +5330,7 @@ static void HWR_DrawSkyBackground(void)
|
||||
|
||||
if (HWR_UseShader())
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
|
||||
GL_SetTransform(&dometransform);
|
||||
GL_RenderSkyDome(&gl_sky);
|
||||
}
|
||||
@@ -5321,7 +5348,6 @@ static inline void HWR_ClearView(void)
|
||||
GL_ClearBuffer(false, true, true, NULL);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_SetViewSize : set projection and scaling values
|
||||
// -----------------+
|
||||
@@ -5410,7 +5436,7 @@ void HWR_SetTransform(float fpov)
|
||||
|
||||
void HWR_ClearClipper(void)
|
||||
{
|
||||
angle_t a1 = gld_FrustumAngle(gl_aimingangle);
|
||||
const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
|
||||
gld_clipper_Clear();
|
||||
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
@@ -5552,7 +5578,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
GL_ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
GL_ClearBuffer(false, false, true, NULL);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov);// restore transform
|
||||
}
|
||||
}
|
||||
@@ -5563,10 +5589,10 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
HWR_SortVisSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritesorttime);
|
||||
PS_START_TIMING(ps_hw_spritedrawtime);
|
||||
if (LIKELY(!cv_glmdls.value))
|
||||
HWR_DrawSprites();
|
||||
if (UNLIKELY(cv_glmdls.value))
|
||||
HWR_DrawSprites<DrawSpritesType::kModels>();
|
||||
else
|
||||
HWR_DrawModels();
|
||||
HWR_DrawSprites<DrawSpritesType::kSprites>();
|
||||
PS_STOP_TIMING(ps_hw_spritedrawtime);
|
||||
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
@@ -5671,13 +5697,7 @@ void HWR_RenderPlayerView(void)
|
||||
// Clear the color buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs.
|
||||
if (viewssnum == 0) // Only do it if it's the first screen being rendered
|
||||
{
|
||||
FRGBAFloat ClearColor;
|
||||
|
||||
ClearColor.red = 0.0f;
|
||||
ClearColor.green = 0.0f;
|
||||
ClearColor.blue = 0.0f;
|
||||
ClearColor.alpha = 1.0f;
|
||||
|
||||
static FRGBAFloat ClearColor = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
GL_ClearBuffer(true, false, false, &ClearColor);
|
||||
}
|
||||
|
||||
@@ -5686,13 +5706,19 @@ void HWR_RenderPlayerView(void)
|
||||
if (cv_ripplewater.value)
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
|
||||
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
||||
if (cv_glmdls.value)
|
||||
{
|
||||
if (maplighting.directional)
|
||||
{
|
||||
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
||||
}
|
||||
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
|
||||
}
|
||||
}
|
||||
|
||||
if (viewssnum > 3)
|
||||
@@ -5716,40 +5742,7 @@ void HWR_RenderPlayerView(void)
|
||||
HWR_RenderFrame(player, false);
|
||||
}
|
||||
|
||||
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)
|
||||
void HWR_LoadLevel(void)
|
||||
{
|
||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||
|
||||
@@ -5757,9 +5750,6 @@ void HWR_LoadLevel(boolean reloadinggamestate)
|
||||
HWR_ClearSkyDome();
|
||||
HWR_BuildSkyDome();
|
||||
|
||||
if (!reloadinggamestate)
|
||||
HWR_CheckForHorizonLines();
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
HWR_SetMapPalette();
|
||||
}
|
||||
@@ -5833,7 +5823,6 @@ void HWR_AddCommands(void)
|
||||
CV_RegisterVar(&cv_glshaders);
|
||||
|
||||
CV_RegisterVar(&cv_gllightdither);
|
||||
CV_RegisterVar(&cv_glsecbright);
|
||||
|
||||
CV_RegisterVar(&cv_glfiltermode);
|
||||
CV_RegisterVar(&cv_glanisotropicmode);
|
||||
@@ -5969,7 +5958,7 @@ void HWR_Shutdown(void)
|
||||
static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap)
|
||||
{
|
||||
FBITFIELD blendmode = blend;
|
||||
UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
|
||||
const UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
|
||||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
@@ -6029,6 +6018,8 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
||||
// hw_bsp.c
|
||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||
extern boolean gl_maphasportals;
|
||||
extern boolean gl_maphashorizonlines;
|
||||
|
||||
// Console variables
|
||||
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_gllightdither;
|
||||
extern consvar_t cv_glsecbright;
|
||||
|
||||
extern consvar_t cv_glfiltermode;
|
||||
extern consvar_t cv_glanisotropicmode;
|
||||
@@ -233,6 +233,12 @@ FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
|
||||
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
|
||||
}// extern "C"
|
||||
#endif
|
||||
|
||||
+13
-7
@@ -695,6 +695,7 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
UINT8 translation[17]; // First the color index
|
||||
UINT8 cutoff[17]; // Brightness cutoff before using the next color
|
||||
UINT8 translen = 0;
|
||||
@@ -702,7 +703,7 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
||||
UINT8 colorbrightnesses[17];
|
||||
UINT8 color_match_lookup[256]; // optimization attempt
|
||||
|
||||
blendcolor = V_GetColor(0); // initialize
|
||||
blendcolor = palette[0]; // initialize
|
||||
memset(translation, 0, sizeof(translation));
|
||||
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
|
||||
{
|
||||
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
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
blendcolor = V_GetColor(translation[firsti]);
|
||||
blendcolor = palette[translation[firsti]];
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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)
|
||||
colormap = sector->lightlist[light].extra_colormap;
|
||||
@@ -1158,7 +1159,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
else
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
|
||||
lightlevel = sector->lightlevel;
|
||||
|
||||
if (sector->extra_colormap)
|
||||
colormap = sector->extra_colormap;
|
||||
@@ -1227,6 +1228,9 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
|
||||
if (cv_playerfade.value && spr->mobj->player)
|
||||
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
|
||||
@@ -1241,7 +1245,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - skins;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - skins;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1266,6 +1270,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
|
||||
if (md2->error)
|
||||
return; // we already failed loading this before :(
|
||||
|
||||
if (!md2->model)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "Loading model... (%s, %s)", sprnames[spr->mobj->sprite], md2->filename);
|
||||
@@ -1284,6 +1289,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->glpatch;
|
||||
if (gpatch)
|
||||
|
||||
@@ -132,7 +132,7 @@ void HWR_PortalFrame(gl_portal_t* portal)
|
||||
{
|
||||
portalclipline = NULL;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ static struct {
|
||||
// Sprite shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
|
||||
// Model shader
|
||||
// Model shader + diffuse lighting from above
|
||||
{GLSL_MODEL_LIGHTING_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
|
||||
// Water shader
|
||||
|
||||
@@ -689,7 +689,7 @@ typedef enum
|
||||
gluniform_leveltime,
|
||||
|
||||
gluniform_scr_resolution,
|
||||
|
||||
|
||||
gluniform_max,
|
||||
} gluniform_t;
|
||||
|
||||
@@ -1729,6 +1729,114 @@ static void GL_AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
}
|
||||
}
|
||||
|
||||
#define PADDING_CHECK(offset, alphaCheck) { from = to + (offset); if ((alphaCheck)) from = NULL; else goto foundFrom; }
|
||||
|
||||
static void PadRGBABitmap(RGBA_t *tex, UINT16 w, UINT16 h)
|
||||
{
|
||||
INT32 i;
|
||||
boolean notLeft, notRight, notTop, notBottom;
|
||||
RGBA_t *to = tex - 1, *from;
|
||||
|
||||
for (i = 0; i < w * h; i++)
|
||||
{
|
||||
to++;
|
||||
if (to->rgba != 0)
|
||||
continue;
|
||||
from = NULL;
|
||||
|
||||
notLeft = i % w != 0;
|
||||
notRight = i % w != w - 1;
|
||||
notTop = i / w != 0;
|
||||
notBottom = i / w != h - 1;
|
||||
|
||||
if (notRight) PADDING_CHECK(1, from->s.alpha == 0) // Check +X
|
||||
if (notBottom) PADDING_CHECK(w, from->s.alpha == 0) // Check +Y
|
||||
if (notLeft) PADDING_CHECK(-1, from->s.alpha == 0) // Check -X
|
||||
if (notTop) PADDING_CHECK(-w, from->s.alpha == 0) // Check -Y
|
||||
if (notRight && notBottom) PADDING_CHECK(1 + w, from->s.alpha == 0) // Check +X+Y
|
||||
if (notLeft && notBottom) PADDING_CHECK(-1 + w, from->s.alpha == 0) // Check -X+Y
|
||||
if (notLeft && notTop) PADDING_CHECK(-1 - w, from->s.alpha == 0) // Check -X-Y
|
||||
if (notRight && notTop) PADDING_CHECK(1 - w, from->s.alpha == 0) // Check +X-Y
|
||||
|
||||
foundFrom:
|
||||
if (from != NULL)
|
||||
{
|
||||
*to = *from;
|
||||
to->s.alpha = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef PADDING_CHECK
|
||||
|
||||
static void GenerateMipmaps(INT32 w, INT32 h, RGBA_t *tex, INT32 maxLOD)
|
||||
{
|
||||
if (tex == NULL)
|
||||
{
|
||||
GL_MSG_Warning("GenerateMipmaps: attempted to generate mipmaps without texture data");
|
||||
return;
|
||||
}
|
||||
|
||||
RGBA_t samplePoint[4];
|
||||
boolean padTexture;
|
||||
INT32 pointsSampled = 0;
|
||||
INT32 m, j, i, p;
|
||||
UINT16 sumR, sumG, sumB, sumA;
|
||||
|
||||
for (m = 0; m < maxLOD; m++)
|
||||
{
|
||||
if (w <= 1 || h <= 1)
|
||||
return;
|
||||
|
||||
padTexture = false;
|
||||
|
||||
for (j = 0; j < h / 2; j++)
|
||||
{
|
||||
for (i = 0; i < w / 2; i++)
|
||||
{
|
||||
samplePoint[0] = tex[w*j*2 + i*2];
|
||||
samplePoint[1] = tex[w*j*2 + i*2+1];
|
||||
samplePoint[2] = tex[w*(j*2+1) + i*2];
|
||||
samplePoint[3] = tex[w*(j*2+1) + i*2+1];
|
||||
|
||||
pointsSampled = sumR = sumG = sumB = sumA = 0;
|
||||
|
||||
for (p = 0; p < 4; p++)
|
||||
{
|
||||
if (samplePoint[p].s.alpha == 0)
|
||||
continue;
|
||||
sumR += samplePoint[p].s.red;
|
||||
sumG += samplePoint[p].s.green;
|
||||
sumB += samplePoint[p].s.blue;
|
||||
sumA += samplePoint[p].s.alpha;
|
||||
pointsSampled++;
|
||||
}
|
||||
|
||||
if (pointsSampled > 0)
|
||||
{
|
||||
tex[(w/2)*j+i].s.red = sumR / pointsSampled;
|
||||
tex[(w/2)*j+i].s.green = sumG / pointsSampled;
|
||||
tex[(w/2)*j+i].s.blue = sumB / pointsSampled;
|
||||
tex[(w/2)*j+i].s.alpha = sumA / pointsSampled;
|
||||
}
|
||||
else
|
||||
{
|
||||
tex[(w/2)*j+i].rgba = 0;
|
||||
padTexture = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
w /= 2;
|
||||
h /= 2;
|
||||
|
||||
if (padTexture)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
|
||||
pglTexSubImage2D(GL_TEXTURE_2D, m + 1, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, tex);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// UpdateTexture : Updates texture data.
|
||||
// -----------------+
|
||||
@@ -1737,6 +1845,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
// Upload a texture
|
||||
GLuint num = pTexInfo->downloaded;
|
||||
boolean update = true;
|
||||
const boolean applyPadding = mag_filter == GL_LINEAR || min_filter == GL_LINEAR;
|
||||
|
||||
INT32 w = pTexInfo->width, h = pTexInfo->height;
|
||||
INT32 i, j;
|
||||
@@ -1795,15 +1904,32 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
pImgData++;
|
||||
}
|
||||
}
|
||||
|
||||
if (applyPadding)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
|
||||
break;
|
||||
case GL_TEXFMT_RGBA:
|
||||
// Directly upload the texture data without any kind of conversion.
|
||||
ptex = pImgData;
|
||||
|
||||
// However, it does need to be copied to a buffer for generating mipmaps and padding
|
||||
if (MipMap || applyPadding)
|
||||
{
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
tex = textureBuffer;
|
||||
memcpy(tex, ptex, w * h * 4);
|
||||
ptex = tex;
|
||||
|
||||
if (applyPadding)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
}
|
||||
|
||||
break;
|
||||
case GL_TEXFMT_ALPHA_INTENSITY_88:
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
ptex = tex = textureBuffer;
|
||||
texformat = GL_LUMINANCE_ALPHA;
|
||||
texformat = GL_RGBA;
|
||||
|
||||
for (idx = 0, j = 0; j < h; j++)
|
||||
{
|
||||
@@ -1821,7 +1947,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
case GL_TEXFMT_ALPHA_8: // Used for fade masks
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
ptex = tex = textureBuffer;
|
||||
texformat = GL_ALPHA;
|
||||
texformat = GL_RGBA;
|
||||
|
||||
memset(&tex->s, 255, sizeof(byteColor_t)*w*h); // 255 because the fade mask is modulated with the screen texture, so alpha affects it while the colours don't
|
||||
|
||||
@@ -1857,8 +1983,6 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
|
||||
if (MipMap && !transparent) // No mipmaps on transparent stuff
|
||||
{
|
||||
int maxlod = (texformat == GL_LUMINANCE_ALPHA || texformat == GL_ALPHA) ? 4 : 5;
|
||||
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
|
||||
if (update)
|
||||
@@ -1868,7 +1992,8 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
|
||||
// Control the mipmap level of detail
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, maxlod);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
|
||||
GenerateMipmaps(w, h, tex, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1892,7 +2017,6 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropic_filter);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
@@ -1907,8 +2031,7 @@ void GL_SetTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (pTexInfo->downloaded != tex_downloaded)
|
||||
{
|
||||
if (!currently_batching)
|
||||
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
|
||||
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
|
||||
tex_downloaded = pTexInfo->downloaded;
|
||||
}
|
||||
}
|
||||
@@ -1989,7 +2112,7 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
|
||||
UNIFORM_1(shader->uniforms[gluniform_lighting], (GLfloat)Surface->LightInfo.light_level, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_start], (GLfloat)Surface->LightInfo.fade_start, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_end], (GLfloat)Surface->LightInfo.fade_end, pglUniform1f);
|
||||
directional = Surface->LightInfo.directional;
|
||||
directional = cv_glmdls.value && Surface->LightInfo.directional;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2735,7 +2858,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
|
||||
poly.green = byte2float[Surface->PolyColor.s.green];
|
||||
poly.blue = byte2float[Surface->PolyColor.s.blue];
|
||||
poly.alpha = byte2float[Surface->PolyColor.s.alpha];
|
||||
|
||||
|
||||
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
|
||||
|
||||
GL_SetBlend(((poly.alpha < 1) ? Surface->PolyFlags : (PF_Masked|PF_Occlude))|PF_Modulated);
|
||||
@@ -2749,7 +2872,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
|
||||
fade.green = byte2float[Surface->FadeColor.s.green];
|
||||
fade.blue = byte2float[Surface->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[Surface->FadeColor.s.alpha];
|
||||
|
||||
|
||||
if (Surface->LightTableId && Surface->LightTableId != lt_downloaded)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
|
||||
+15
-3
@@ -110,13 +110,21 @@ HMS_on_read (char *s, size_t _1, size_t n, void *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 */
|
||||
blocks = ( n / DEFAULT_BUFFER_SIZE + 1 );
|
||||
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);
|
||||
@@ -220,7 +228,11 @@ HMS_connect (const char *format, ...)
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4);
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
if (!M_CheckParm("-ipv6"))
|
||||
#endif
|
||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
||||
|
||||
+141
-27
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "m_menu.h" // gametype_cons_t
|
||||
#include "m_cond.h" // emblems
|
||||
#include "m_emotes.h"
|
||||
|
||||
#include "d_clisrv.h"
|
||||
|
||||
@@ -94,6 +95,9 @@ static textinput_t w_chat;
|
||||
static boolean headsupactive = false;
|
||||
boolean hu_showscores; // draw rankings
|
||||
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;
|
||||
|
||||
@@ -310,7 +314,7 @@ void HU_LoadGraphics(void)
|
||||
lt_font[0] = (patch_t *)W_CachePatchName("LTFNT039", PU_HUDGFX); /// \note fake start hack
|
||||
|
||||
// Number support
|
||||
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
|
||||
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
|
||||
lt_font[10] = (patch_t *)W_CachePatchName("LTFNT049", PU_HUDGFX);
|
||||
lt_font[11] = (patch_t *)W_CachePatchName("LTFNT050", PU_HUDGFX);
|
||||
lt_font[12] = (patch_t *)W_CachePatchName("LTFNT051", PU_HUDGFX);
|
||||
@@ -701,7 +705,7 @@ static void Command_Sayto_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
target = nametonum(COM_Argv(1));
|
||||
target = D_LookupPlayer(COM_Argv(1));
|
||||
if (target == -1)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("No player with that name!\n"));
|
||||
@@ -747,7 +751,7 @@ static void Command_CSay_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!server && !IsPlayerAdmin(consoleplayer))
|
||||
if (!server && !IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Only servers and admins can use csay.\n"));
|
||||
return;
|
||||
@@ -949,6 +953,9 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
else
|
||||
stop_spamming[playernum] = 4; // you can hold off for 4 tics, can you?
|
||||
|
||||
if (player_muted[playernum])
|
||||
spam_eatmsg = 1; // Let lua know we're skipping this message
|
||||
|
||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||
|
||||
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
@@ -1103,6 +1110,7 @@ void HU_Ticker(void)
|
||||
return;
|
||||
|
||||
hu_tick++;
|
||||
hu_emoteanim++;
|
||||
hu_tick &= 7; // currently only to blink chat input cursor
|
||||
|
||||
if (PLAYER1INPUTDOWN(gc_scores))
|
||||
@@ -1179,6 +1187,23 @@ static boolean HU_clearChatSpaces(void)
|
||||
return nothingbutspaces;
|
||||
}
|
||||
|
||||
static void DoMute(const char *name)
|
||||
{
|
||||
INT32 pnum = D_LookupPlayer(name);
|
||||
|
||||
if (pnum < 0)
|
||||
{
|
||||
HU_AddChatText("\x85""ERROR: \x80Player not found.", false);
|
||||
return;
|
||||
}
|
||||
|
||||
player_muted[pnum] = !player_muted[pnum];
|
||||
|
||||
HU_AddChatText(va("Player '%s' has been %smuted.", player_names[pnum], player_muted[pnum] ? "" : "un"), false);
|
||||
if (player_muted[pnum])
|
||||
HU_AddChatText("Use same command to unmute them.", false);
|
||||
}
|
||||
|
||||
static void HU_SendChatMessage(void)
|
||||
{
|
||||
char buf[2 + HU_MAXMSGLEN + 1];
|
||||
@@ -1205,7 +1230,19 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
size_t len = strlen(msg);
|
||||
|
||||
if (len >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
{
|
||||
if (len > 6)
|
||||
DoMute(msg+6);
|
||||
else
|
||||
HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (len > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
@@ -1367,7 +1404,7 @@ boolean HU_Responder(event_t *ev)
|
||||
&& ev->data1 != gamecontrol[0][gc_talkkey][1]))
|
||||
return false;
|
||||
|
||||
M_TextInputHandle(&w_chat, c);
|
||||
M_TextInputHandleEmotes(&w_chat, c, emote_suggestions, MAXEMOTESUGGESTIONS);
|
||||
|
||||
if (c == KEY_ENTER)
|
||||
{
|
||||
@@ -1407,6 +1444,8 @@ boolean HU_Responder(event_t *ev)
|
||||
|
||||
#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.
|
||||
// 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.
|
||||
@@ -1418,6 +1457,8 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||
size_t slen;
|
||||
char *newstring = Z_StrDup(string);
|
||||
INT32 spacewidth = (vid.width < 640) ? 8 : 4, charwidth = (vid.width < 640) ? 8 : 4;
|
||||
emote_t *emote = NULL;
|
||||
int emotelen = 0;
|
||||
|
||||
slen = strlen(string);
|
||||
x = 0;
|
||||
@@ -1439,7 +1480,12 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||
c = toupper(c);
|
||||
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;
|
||||
lastusablespace = i;
|
||||
@@ -1461,7 +1507,6 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||
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.
|
||||
|
||||
INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh
|
||||
@@ -1494,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]);
|
||||
size_t j = 0;
|
||||
INT32 linescount = 0;
|
||||
emote_t *emote = NULL;
|
||||
int emotelen = 0;
|
||||
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
@@ -1518,6 +1565,11 @@ static void HU_drawMiniChat(void)
|
||||
|
||||
++j;
|
||||
}
|
||||
else if ((emote = M_VerifyEmote(msg+j, &emotelen)))
|
||||
{
|
||||
dx += EMOTEWIDTH - charwidth;
|
||||
j += emotelen;
|
||||
}
|
||||
else
|
||||
{
|
||||
j++;
|
||||
@@ -1563,6 +1615,8 @@ static void HU_drawMiniChat(void)
|
||||
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.
|
||||
UINT8 *colormap = NULL;
|
||||
emote_t *emote = NULL;
|
||||
int emotelen = 0;
|
||||
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
@@ -1589,12 +1643,22 @@ static void HU_drawMiniChat(void)
|
||||
|
||||
++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
|
||||
{
|
||||
if (cv_chatbacktint.value) // on request of wolfy
|
||||
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy+cv_chatcentertext.value, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
|
||||
}
|
||||
|
||||
dx += charwidth;
|
||||
@@ -1666,6 +1730,9 @@ static void HU_drawChatLog(INT32 offset)
|
||||
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.
|
||||
UINT8 *colormap = NULL;
|
||||
emote_t *emote = NULL;
|
||||
int emotelen = 0;
|
||||
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
@@ -1687,6 +1754,15 @@ static void HU_drawChatLog(INT32 offset)
|
||||
|
||||
++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
|
||||
{
|
||||
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
||||
@@ -1812,7 +1888,7 @@ static void HU_DrawChat(void)
|
||||
typelines = 1;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -1823,30 +1899,40 @@ static void HU_DrawChat(void)
|
||||
while (w_chat_buf[i])
|
||||
{
|
||||
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 cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
|
||||
if (hu_tick < 4)
|
||||
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;
|
||||
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;
|
||||
if (c > boxw-(charwidth*2) && !skippedline)
|
||||
{
|
||||
@@ -1856,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.
|
||||
if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
||||
{
|
||||
@@ -2849,13 +2965,11 @@ void HU_DoCEcho(const char *msg)
|
||||
*p = '\n';
|
||||
|
||||
CONS_Printf("%s\n", temp);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (cv_cechotoggle.value)
|
||||
cechotimer = cechoduration;
|
||||
|
||||
I_OutputMsg("%s\n", msg); // print to log
|
||||
|
||||
if (!cv_cechotoggle.value)
|
||||
return;
|
||||
|
||||
cechotimer = cechoduration;
|
||||
I_OutputMsg("%s\n", msg); // ALWAYS print to log
|
||||
}
|
||||
+4
-4
@@ -82,6 +82,8 @@ typedef struct
|
||||
char data[MAXPACKETLENGTH];
|
||||
} ATTRPACK doomcom_t;
|
||||
|
||||
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
|
||||
|
||||
#ifdef HOLEPUNCH
|
||||
typedef struct
|
||||
{
|
||||
@@ -89,6 +91,8 @@ typedef struct
|
||||
INT32 addr;
|
||||
INT16 port;
|
||||
} ATTRPACK holepunch_t;
|
||||
|
||||
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@@ -97,10 +101,6 @@ typedef struct
|
||||
|
||||
extern doomcom_t *doomcom;
|
||||
|
||||
#ifdef HOLEPUNCH
|
||||
extern holepunch_t *holepunchpacket;
|
||||
#endif
|
||||
|
||||
/** \brief return packet in doomcom struct
|
||||
*/
|
||||
extern boolean (*I_NetGet)(void);
|
||||
|
||||
+4
-3
@@ -43,8 +43,9 @@ extern UINT8 sound_started;
|
||||
|
||||
/** \brief info of samplerate
|
||||
*/
|
||||
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||
extern consvar_t cv_samplerate;
|
||||
//extern consvar_t cv_rndsoundpitch;
|
||||
#endif
|
||||
|
||||
/** \brief The I_GetSfx function
|
||||
|
||||
@@ -83,7 +84,7 @@ void I_ShutdownSound(void);
|
||||
|
||||
\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.
|
||||
|
||||
@@ -114,7 +115,7 @@ boolean I_SoundIsPlaying(INT32 handle);
|
||||
|
||||
\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
|
||||
|
||||
|
||||
+78
-28
@@ -371,8 +371,16 @@ static inline void I_UPnP_rem(const char *port, const char * servicetype)
|
||||
|
||||
static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
{
|
||||
static char s[64]; // 255.255.255.255:65535 or IPv6:65535
|
||||
static char s[64]; // 255.255.255.255:65535 or
|
||||
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
||||
|
||||
#ifdef HAVE_NTOP
|
||||
#ifdef HAVE_IPV6
|
||||
int v6 = (sk->any.sa_family == AF_INET6);
|
||||
#else
|
||||
int v6 = 0;
|
||||
#endif
|
||||
|
||||
void *addr;
|
||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
|
||||
@@ -387,14 +395,20 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
|
||||
if(addr == NULL)
|
||||
sprintf(s, "No address");
|
||||
else if(inet_ntop(sk->any.sa_family, addr, s, sizeof (s)) == NULL)
|
||||
else if(inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
||||
{
|
||||
e = errno;
|
||||
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e));
|
||||
}
|
||||
#ifdef HAVE_IPV6
|
||||
else if(sk->any.sa_family == AF_INET6 && sk->ip6.sin6_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
||||
else if(sk->any.sa_family == AF_INET6)
|
||||
{
|
||||
s[0] = '[';
|
||||
strcat(s, "]");
|
||||
|
||||
if (sk->ip6.sin6_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
||||
}
|
||||
#endif
|
||||
else if(sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
||||
@@ -486,10 +500,30 @@ static time_t SOCK_GetUnbanTime(size_t ban)
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
static boolean SOCK_cmpipv6(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
{
|
||||
UINT8 bitmask;
|
||||
I_Assert(mask <= 128);
|
||||
if (mask == 0)
|
||||
mask = 128;
|
||||
if (memcmp(&a->ip6.sin6_addr.s6_addr, &b->ip6.sin6_addr.s6_addr, mask / 8) != 0)
|
||||
return false;
|
||||
if (mask % 8 == 0)
|
||||
return true;
|
||||
bitmask = 255 << (mask % 8);
|
||||
return (a->ip6.sin6_addr.s6_addr[mask / 8] & bitmask) == (b->ip6.sin6_addr.s6_addr[mask / 8] & bitmask);
|
||||
}
|
||||
#endif
|
||||
|
||||
static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
{
|
||||
UINT32 bitmask = INADDR_NONE;
|
||||
|
||||
if (a->any.sa_family != b->any.sa_family)
|
||||
return false;
|
||||
|
||||
if (mask && mask < 32)
|
||||
bitmask = htonl((UINT32)(-1) << (32 - mask));
|
||||
|
||||
@@ -498,13 +532,14 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
&& (b->ip4.sin_port == 0 || (a->ip4.sin_port == b->ip4.sin_port));
|
||||
#ifdef HAVE_IPV6
|
||||
else if (b->any.sa_family == AF_INET6)
|
||||
return memcmp(&a->ip6.sin6_addr, &b->ip6.sin6_addr, sizeof(b->ip6.sin6_addr))
|
||||
return SOCK_cmpipv6(a, b, mask)
|
||||
&& (b->ip6.sin6_port == 0 || (a->ip6.sin6_port == b->ip6.sin6_port));
|
||||
#endif
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// This is a hack. For some reason, nodes aren't being freed properly.
|
||||
// This goes through and cleans up what nodes were supposed to be freed.
|
||||
/** \warning This function causes the file downloading to stop if someone joins.
|
||||
@@ -620,6 +655,7 @@ is_external_address (UINT32 p)
|
||||
|
||||
static boolean hole_punch(ssize_t c)
|
||||
{
|
||||
holepunch_t *holepunchpacket = HOLEPUNCH_DATA(doomcom);
|
||||
|
||||
/* See ../doc/Holepunch-Protocol.txt */
|
||||
if (cv_rendezvousserver.string[0] &&
|
||||
@@ -659,6 +695,7 @@ static boolean SOCK_Get(void)
|
||||
fromlen = (socklen_t)sizeof(fromaddress);
|
||||
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
|
||||
(void *)&fromaddress, &fromlen);
|
||||
|
||||
if (c > 0)
|
||||
{
|
||||
#ifdef USE_STUN
|
||||
@@ -868,11 +905,11 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
unsigned long trueval = true;
|
||||
#endif
|
||||
mysockaddr_t straddr;
|
||||
struct sockaddr_in sin;
|
||||
socklen_t len = sizeof(sin);
|
||||
socklen_t len = sizeof(straddr);
|
||||
|
||||
if (s == (SOCKET_TYPE)ERRSOCKET)
|
||||
return (SOCKET_TYPE)ERRSOCKET;
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
{ // Alam_GBC: disable the new UDP connection reset behavior for Win2k and up
|
||||
#ifdef USE_WINSOCK2
|
||||
@@ -892,14 +929,12 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
}
|
||||
#endif
|
||||
|
||||
straddr.any = *addr;
|
||||
memcpy(&straddr, addr, addrlen);
|
||||
I_OutputMsg("Binding to %s\n", SOCK_AddrToStr(&straddr));
|
||||
|
||||
if (family == AF_INET)
|
||||
{
|
||||
mysockaddr_t tmpaddr;
|
||||
tmpaddr.any = *addr ;
|
||||
if (tmpaddr.ip4.sin_addr.s_addr == htonl(INADDR_ANY))
|
||||
if (straddr.ip4.sin_addr.s_addr == htonl(INADDR_ANY))
|
||||
{
|
||||
opt = true;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
@@ -924,7 +959,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
#ifdef HAVE_IPV6
|
||||
else if (family == AF_INET6)
|
||||
{
|
||||
if (memcmp(addr, &in6addr_any, sizeof(in6addr_any)) == 0) //IN6_ARE_ADDR_EQUAL
|
||||
if (memcmp(&straddr.ip6.sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0) //IN6_ARE_ADDR_EQUAL
|
||||
{
|
||||
opt = true;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
@@ -939,7 +974,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
// make it IPv6 ony
|
||||
opt = true;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = setsockopt(s, SOL_SOCKET, IPV6_V6ONLY, (char *)&opt, opts);
|
||||
rc = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&opt, opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
@@ -969,7 +1004,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
|
||||
inet_pton(AF_INET6, IPV6_MULTICAST_ADDRESS, &maddr.ipv6mr_multiaddr);
|
||||
maddr.ipv6mr_interface = 0;
|
||||
rc = setsockopt(s, SOL_SOCKET, IPV6_JOIN_GROUP, (const char *)&maddr, sizeof(maddr));
|
||||
rc = setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char *)&maddr, sizeof(maddr));
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
@@ -1032,7 +1067,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
CONS_Printf(M_GetText("Network system buffer set to: %dKb\n"), opt>>10);
|
||||
}
|
||||
|
||||
rc = getsockname(s, (struct sockaddr *)&sin, &len);
|
||||
rc = getsockname(s, &straddr.any, &len);
|
||||
if (rc != 0)
|
||||
{
|
||||
e = errno;
|
||||
@@ -1040,7 +1075,14 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
I_OutputMsg("getsockname failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
else
|
||||
current_port = (UINT16)ntohs(sin.sin_port);
|
||||
{
|
||||
if (family == AF_INET)
|
||||
current_port = (UINT16)ntohs(straddr.ip4.sin_port);
|
||||
#ifdef HAVE_IPV6
|
||||
else if (family == AF_INET6)
|
||||
current_port = (UINT16)ntohs(straddr.ip6.sin6_port);
|
||||
#endif
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -1121,6 +1163,7 @@ static boolean UDP_Socket(void)
|
||||
I_freeaddrinfo(ai);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
if (b_ipv6)
|
||||
{
|
||||
@@ -1319,12 +1362,13 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
|
||||
{
|
||||
struct my_addrinfo *ai = NULL, *runp, hints;
|
||||
int gaie;
|
||||
size_t i;
|
||||
|
||||
if (!port || !port[0])
|
||||
port = DEFAULTPORT;
|
||||
|
||||
memset (&hints, 0x00, sizeof (hints));
|
||||
hints.ai_flags = 0;
|
||||
hints.ai_flags = AI_ADDRCONFIG;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_protocol = IPPROTO_UDP;
|
||||
@@ -1343,10 +1387,19 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
|
||||
{
|
||||
while (runp != NULL)
|
||||
{
|
||||
if (sendto(mysockets[0], NULL, 0, 0, runp->ai_addr, runp->ai_addrlen) == 0)
|
||||
break;
|
||||
// test ip address of server
|
||||
for (i = 0; i < mysocketses; ++i)
|
||||
{
|
||||
if (runp->ai_addr->sa_family == myfamily[i])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
runp = runp->ai_next;
|
||||
if (i >= mysocketses)
|
||||
runp = runp->ai_next;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,6 +1443,8 @@ static void rendezvous(int size)
|
||||
|
||||
tic_t tic = I_GetTime();
|
||||
|
||||
holepunch_t *holepunchpacket = HOLEPUNCH_DATA(doomcom);
|
||||
|
||||
if (tic != refreshtic)
|
||||
{
|
||||
if (SOCK_GetAddr(&rzv.ip4, host, (port ? port : "7777"), false))
|
||||
@@ -1415,6 +1470,7 @@ static void rendezvous(int size)
|
||||
static void SOCK_RequestHolePunch(INT32 node)
|
||||
{
|
||||
mysockaddr_t * addr = &clientaddress[node];
|
||||
holepunch_t *holepunchpacket = HOLEPUNCH_DATA(doomcom);
|
||||
|
||||
holepunchpacket->addr = addr->ip4.sin_addr.s_addr;
|
||||
holepunchpacket->port = addr->ip4.sin_port;
|
||||
@@ -1475,13 +1531,7 @@ static void AddBannedIndex(void)
|
||||
banned_size *= 2;
|
||||
}
|
||||
|
||||
banned = Z_ReallocAlign(
|
||||
(void*) banned,
|
||||
sizeof(banned_t) * banned_size,
|
||||
PU_STATIC,
|
||||
NULL,
|
||||
sizeof(banned_t) * 8
|
||||
);
|
||||
banned = Z_Realloc((void*) banned, sizeof(banned_t) * banned_size, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
numbans++;
|
||||
@@ -1742,7 +1792,7 @@ boolean I_InitTcpNetwork(void)
|
||||
|
||||
// server address only in ip
|
||||
if (serverhostname[0])
|
||||
{
|
||||
{
|
||||
CONS_Printf("SERVERNAME: %s\n", serverhostname);
|
||||
COM_BufAddText("connect \"");
|
||||
COM_BufAddText(serverhostname);
|
||||
|
||||
@@ -145,6 +145,8 @@ boolean I_UseNativeKeyboard(void);
|
||||
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
void I_SetBorderlessWindow(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
|
||||
+2660
-2717
File diff suppressed because it is too large.
Load diff
+202
-205
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
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.
|
||||
} actionpointer_t;
|
||||
|
||||
@@ -246,209 +246,206 @@ struct mobj_s;
|
||||
|
||||
// IMPORTANT NOTE: If you add/remove from this list of action
|
||||
// functions, don't forget to update them in dehacked.c!
|
||||
void A_Explode(struct mobj_s *actor);
|
||||
void A_Pain(struct mobj_s *actor);
|
||||
void A_Fall(struct mobj_s *actor);
|
||||
void A_MonitorPop(struct mobj_s *actor);
|
||||
void A_Look(struct mobj_s *actor);
|
||||
void A_Chase(struct mobj_s *actor);
|
||||
void A_FaceStabChase(struct mobj_s *actor);
|
||||
void A_FaceTarget(struct mobj_s *actor);
|
||||
void A_FaceTracer(struct mobj_s *actor);
|
||||
void A_Scream(struct mobj_s *actor);
|
||||
void A_BossDeath(struct mobj_s *actor);
|
||||
void A_CustomPower(struct mobj_s *actor); // Use this for a custom power
|
||||
void A_GiveWeapon(struct mobj_s *actor); // Gives the player weapon(s)
|
||||
void A_JumpShield(struct mobj_s *actor); // Obtained Jump Shield
|
||||
void A_RingShield(struct mobj_s *actor); // Obtained Ring Shield
|
||||
void A_RingBox(struct mobj_s *actor); // Obtained Ring Box Tails
|
||||
void A_Invincibility(struct mobj_s *actor); // Obtained Invincibility Box
|
||||
void A_SuperSneakers(struct mobj_s *actor); // Obtained Super Sneakers Box
|
||||
void A_BunnyHop(struct mobj_s *actor); // have bunny hop tails
|
||||
void A_BubbleSpawn(struct mobj_s *actor); // Randomly spawn bubbles
|
||||
void A_FanBubbleSpawn(struct mobj_s *actor);
|
||||
void A_BubbleRise(struct mobj_s *actor); // Bubbles float to surface
|
||||
void A_BubbleCheck(struct mobj_s *actor); // Don't draw if not underwater
|
||||
void A_AwardScore(struct mobj_s *actor);
|
||||
void A_ExtraLife(struct mobj_s *actor); // Extra Life
|
||||
void A_BombShield(struct mobj_s *actor); // Obtained Bomb Shield
|
||||
void A_WaterShield(struct mobj_s *actor); // Obtained Water Shield
|
||||
void A_ForceShield(struct mobj_s *actor); // Obtained Force Shield
|
||||
void A_PityShield(struct mobj_s *actor); // Obtained Pity Shield. We're... sorry.
|
||||
void A_GravityBox(struct mobj_s *actor);
|
||||
void A_ScoreRise(struct mobj_s *actor); // Rise the score logo
|
||||
void A_ParticleSpawn(struct mobj_s *actor);
|
||||
void A_AttractChase(struct mobj_s *actor); // Ring Chase
|
||||
void A_DropMine(struct mobj_s *actor); // Drop Mine from Skim or Jetty-Syn Bomber
|
||||
void A_FishJump(struct mobj_s *actor); // Fish Jump
|
||||
void A_ThrownRing(struct mobj_s *actor); // Sparkle trail for red ring
|
||||
void A_GrenadeRing(struct mobj_s *actor); // SRB2kart
|
||||
void A_SetSolidSteam(struct mobj_s *actor);
|
||||
void A_UnsetSolidSteam(struct mobj_s *actor);
|
||||
void A_SignPlayer(struct mobj_s *actor);
|
||||
void A_OverlayThink(struct mobj_s *actor);
|
||||
void A_JetChase(struct mobj_s *actor);
|
||||
void A_JetbThink(struct mobj_s *actor); // Jetty-Syn Bomber Thinker
|
||||
void A_JetgThink(struct mobj_s *actor); // Jetty-Syn Gunner Thinker
|
||||
void A_JetgShoot(struct mobj_s *actor); // Jetty-Syn Shoot Function
|
||||
void A_ShootBullet(struct mobj_s *actor); // JetgShoot without reactiontime setting
|
||||
void A_MinusDigging(struct mobj_s *actor);
|
||||
void A_MinusPopup(struct mobj_s *actor);
|
||||
void A_MinusCheck(struct mobj_s *actor);
|
||||
void A_ChickenCheck(struct mobj_s *actor);
|
||||
void A_MouseThink(struct mobj_s *actor); // Mouse Thinker
|
||||
void A_DetonChase(struct mobj_s *actor); // Deton Chaser
|
||||
void A_CapeChase(struct mobj_s *actor); // Fake little Super Sonic cape
|
||||
void A_RotateSpikeBall(struct mobj_s *actor); // Spike ball rotation
|
||||
void A_SlingAppear(struct mobj_s *actor);
|
||||
void A_MaceRotate(struct mobj_s *actor);
|
||||
void A_UnidusBall(struct mobj_s *actor);
|
||||
void A_RockSpawn(struct mobj_s *actor);
|
||||
void A_SetFuse(struct mobj_s *actor);
|
||||
void A_CrawlaCommanderThink(struct mobj_s *actor); // Crawla Commander
|
||||
void A_SmokeTrailer(struct mobj_s *actor);
|
||||
void A_RingExplode(struct mobj_s *actor);
|
||||
void A_OldRingExplode(struct mobj_s *actor);
|
||||
void A_MixUp(struct mobj_s *actor);
|
||||
void A_RecyclePowers(struct mobj_s *actor);
|
||||
void A_BossScream(struct mobj_s *actor);
|
||||
void A_Boss2TakeDamage(struct mobj_s *actor);
|
||||
void A_GoopSplat(struct mobj_s *actor);
|
||||
void A_Boss2PogoSFX(struct mobj_s *actor);
|
||||
void A_Boss2PogoTarget(struct mobj_s *actor);
|
||||
void A_EggmanBox(struct mobj_s *actor);
|
||||
void A_TurretFire(struct mobj_s *actor);
|
||||
void A_SuperTurretFire(struct mobj_s *actor);
|
||||
void A_TurretStop(struct mobj_s *actor);
|
||||
void A_JetJawRoam(struct mobj_s *actor);
|
||||
void A_JetJawChomp(struct mobj_s *actor);
|
||||
void A_PointyThink(struct mobj_s *actor);
|
||||
void A_CheckBuddy(struct mobj_s *actor);
|
||||
void A_HoodThink(struct mobj_s *actor);
|
||||
void A_ArrowCheck(struct mobj_s *actor);
|
||||
void A_SnailerThink(struct mobj_s *actor);
|
||||
void A_SharpChase(struct mobj_s *actor);
|
||||
void A_SharpSpin(struct mobj_s *actor);
|
||||
void A_VultureVtol(struct mobj_s *actor);
|
||||
void A_VultureCheck(struct mobj_s *actor);
|
||||
void A_SkimChase(struct mobj_s *actor);
|
||||
void A_SkullAttack(struct mobj_s *actor);
|
||||
void A_LobShot(struct mobj_s *actor);
|
||||
void A_FireShot(struct mobj_s *actor);
|
||||
void A_SuperFireShot(struct mobj_s *actor);
|
||||
void A_BossFireShot(struct mobj_s *actor);
|
||||
void A_Boss7FireMissiles(struct mobj_s *actor);
|
||||
void A_Boss1Laser(struct mobj_s *actor);
|
||||
void A_FocusTarget(struct mobj_s *actor);
|
||||
void A_Boss4Reverse(struct mobj_s *actor);
|
||||
void A_Boss4SpeedUp(struct mobj_s *actor);
|
||||
void A_Boss4Raise(struct mobj_s *actor);
|
||||
void A_SparkFollow(struct mobj_s *actor);
|
||||
void A_BuzzFly(struct mobj_s *actor);
|
||||
void A_GuardChase(struct mobj_s *actor);
|
||||
void A_EggShield(struct mobj_s *actor);
|
||||
void A_SetReactionTime(struct mobj_s *actor);
|
||||
void A_Boss1Spikeballs(struct mobj_s *actor);
|
||||
void A_Boss3TakeDamage(struct mobj_s *actor);
|
||||
void A_Boss3Path(struct mobj_s *actor);
|
||||
void A_LinedefExecute(struct mobj_s *actor);
|
||||
void A_PlaySeeSound(struct mobj_s *actor);
|
||||
void A_PlayAttackSound(struct mobj_s *actor);
|
||||
void A_PlayActiveSound(struct mobj_s *actor);
|
||||
void A_1upThinker(struct mobj_s *actor);
|
||||
void A_BossZoom(struct mobj_s *actor); //Unused
|
||||
void A_Boss1Chase(struct mobj_s *actor);
|
||||
void A_Boss2Chase(struct mobj_s *actor);
|
||||
void A_Boss2Pogo(struct mobj_s *actor);
|
||||
void A_Boss7Chase(struct mobj_s *actor);
|
||||
void A_BossJetFume(struct mobj_s *actor);
|
||||
void A_SpawnObjectAbsolute(struct mobj_s *actor);
|
||||
void A_SpawnObjectRelative(struct mobj_s *actor);
|
||||
void A_ChangeAngleRelative(struct mobj_s *actor);
|
||||
void A_ChangeAngleAbsolute(struct mobj_s *actor);
|
||||
void A_RollAngle(struct mobj_s *actor);
|
||||
void A_ChangeRollAngleRelative(struct mobj_s *actor);
|
||||
void A_ChangeRollAngleAbsolute(struct mobj_s *actor);
|
||||
void A_PlaySound(struct mobj_s *actor);
|
||||
void A_FindTarget(struct mobj_s *actor);
|
||||
void A_FindTracer(struct mobj_s *actor);
|
||||
void A_SetTics(struct mobj_s *actor);
|
||||
void A_SetRandomTics(struct mobj_s *actor);
|
||||
void A_ChangeColorRelative(struct mobj_s *actor);
|
||||
void A_ChangeColorAbsolute(struct mobj_s *actor);
|
||||
void A_MoveRelative(struct mobj_s *actor);
|
||||
void A_MoveAbsolute(struct mobj_s *actor);
|
||||
void A_Thrust(struct mobj_s *actor);
|
||||
void A_ZThrust(struct mobj_s *actor);
|
||||
void A_SetTargetsTarget(struct mobj_s *actor);
|
||||
void A_SetObjectFlags(struct mobj_s *actor);
|
||||
void A_SetObjectFlags2(struct mobj_s *actor);
|
||||
void A_RandomState(struct mobj_s *actor);
|
||||
void A_RandomStateRange(struct mobj_s *actor);
|
||||
void A_DualAction(struct mobj_s *actor);
|
||||
void A_RemoteAction(struct mobj_s *actor);
|
||||
void A_ToggleFlameJet(struct mobj_s *actor);
|
||||
void A_ItemPop(struct mobj_s *actor); // SRB2kart
|
||||
void A_JawzChase(struct mobj_s *actor); // SRB2kart
|
||||
void A_JawzExplode(struct mobj_s *actor); // SRB2kart
|
||||
void A_SPBChase(struct mobj_s *actor); // SRB2kart
|
||||
void A_MineExplode(struct mobj_s *actor); // SRB2kart
|
||||
void A_BallhogExplode(struct mobj_s *actor); // SRB2kart
|
||||
void A_LightningFollowPlayer(struct mobj_s *actor); // SRB2kart: Lightning shield effect player chasing
|
||||
void A_FZBoomFlash(struct mobj_s *actor); // SRB2kart
|
||||
void A_FZBoomSmoke(struct mobj_s *actor); // SRB2kart
|
||||
void A_RandomShadowFrame(struct mobj_s *actor); //SRB2kart: Shadow spawner frame randomizer
|
||||
void A_RoamingShadowThinker(struct mobj_s *actor); // SRB2kart: Roaming Shadow moving + attacking players.
|
||||
void A_MayonakaArrow(struct mobj_s *actor); //SRB2kart: midnight channel arrow sign
|
||||
void A_ReaperThinker(struct mobj_s *actor); //SRB2kart: mementos reaper
|
||||
void A_MementosTPParticles(struct mobj_s *actor); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
|
||||
void A_FlameParticle(struct mobj_s *actor); // SRB2kart
|
||||
void A_OrbitNights(struct mobj_s *actor);
|
||||
void A_GhostMe(struct mobj_s *actor);
|
||||
void A_SetObjectState(struct mobj_s *actor);
|
||||
void A_SetObjectTypeState(struct mobj_s *actor);
|
||||
void A_KnockBack(struct mobj_s *actor);
|
||||
void A_PushAway(struct mobj_s *actor);
|
||||
void A_RingDrain(struct mobj_s *actor);
|
||||
void A_SplitShot(struct mobj_s *actor);
|
||||
void A_MissileSplit(struct mobj_s *actor);
|
||||
void A_MultiShot(struct mobj_s *actor);
|
||||
void A_InstaLoop(struct mobj_s *actor);
|
||||
void A_Custom3DRotate(struct mobj_s *actor);
|
||||
void A_SearchForPlayers(struct mobj_s *actor);
|
||||
void A_CheckRandom(struct mobj_s *actor);
|
||||
void A_CheckTargetRings(struct mobj_s *actor);
|
||||
void A_CheckRings(struct mobj_s *actor);
|
||||
void A_CheckTotalRings(struct mobj_s *actor);
|
||||
void A_CheckHealth(struct mobj_s *actor);
|
||||
void A_CheckRange(struct mobj_s *actor);
|
||||
void A_CheckHeight(struct mobj_s *actor);
|
||||
void A_CheckTrueRange(struct mobj_s *actor);
|
||||
void A_CheckThingCount(struct mobj_s *actor);
|
||||
void A_CheckAmbush(struct mobj_s *actor);
|
||||
void A_CheckCustomValue(struct mobj_s *actor);
|
||||
void A_CheckCusValMemo(struct mobj_s *actor);
|
||||
void A_SetCustomValue(struct mobj_s *actor);
|
||||
void A_UseCusValMemo(struct mobj_s *actor);
|
||||
void A_RelayCustomValue(struct mobj_s *actor);
|
||||
void A_CusValAction(struct mobj_s *actor);
|
||||
void A_ForceStop(struct mobj_s *actor);
|
||||
void A_ForceWin(struct mobj_s *actor);
|
||||
void A_SpikeRetract(struct mobj_s *actor);
|
||||
void A_InfoState(struct mobj_s *actor);
|
||||
void A_Repeat(struct mobj_s *actor);
|
||||
void A_SetScale(struct mobj_s *actor);
|
||||
void A_RemoteDamage(struct mobj_s *actor);
|
||||
void A_HomingChase(struct mobj_s *actor);
|
||||
void A_TrapShot(struct mobj_s *actor);
|
||||
void A_VileTarget(struct mobj_s *actor);
|
||||
void A_VileAttack(struct mobj_s *actor);
|
||||
void A_VileFire(struct mobj_s *actor);
|
||||
void A_BrakChase(struct mobj_s *actor);
|
||||
void A_BrakFireShot(struct mobj_s *actor);
|
||||
void A_BrakLobShot(struct mobj_s *actor);
|
||||
void A_NapalmScatter(struct mobj_s *actor);
|
||||
void A_SpawnFreshCopy(struct mobj_s *actor);
|
||||
void A_Explode(void *actor);
|
||||
void A_Pain(void *actor);
|
||||
void A_Fall(void *actor);
|
||||
void A_MonitorPop(void *actor);
|
||||
void A_Look(void *actor);
|
||||
void A_Chase(void *actor);
|
||||
void A_FaceStabChase(void *actor);
|
||||
void A_FaceTarget(void *actor);
|
||||
void A_FaceTracer(void *actor);
|
||||
void A_Scream(void *actor);
|
||||
void A_BossDeath(void *actor);
|
||||
void A_CustomPower(void *actor); // Use this for a custom power
|
||||
void A_GiveWeapon(void *actor); // Gives the player weapon(s)
|
||||
void A_JumpShield(void *actor); // Obtained Jump Shield
|
||||
void A_RingShield(void *actor); // Obtained Ring Shield
|
||||
void A_RingBox(void *actor); // Obtained Ring Box Tails
|
||||
void A_Invincibility(void *actor); // Obtained Invincibility Box
|
||||
void A_SuperSneakers(void *actor); // Obtained Super Sneakers Box
|
||||
void A_BunnyHop(void *actor); // have bunny hop tails
|
||||
void A_BubbleSpawn(void *actor); // Randomly spawn bubbles
|
||||
void A_FanBubbleSpawn(void *actor);
|
||||
void A_BubbleRise(void *actor); // Bubbles float to surface
|
||||
void A_BubbleCheck(void *actor); // Don't draw if not underwater
|
||||
void A_AwardScore(void *actor);
|
||||
void A_ExtraLife(void *actor); // Extra Life
|
||||
void A_BombShield(void *actor); // Obtained Bomb Shield
|
||||
void A_WaterShield(void *actor); // Obtained Water Shield
|
||||
void A_ForceShield(void *actor); // Obtained Force Shield
|
||||
void A_PityShield(void *actor); // Obtained Pity Shield. We're... sorry.
|
||||
void A_GravityBox(void *actor);
|
||||
void A_ScoreRise(void *actor); // Rise the score logo
|
||||
void A_ParticleSpawn(void *actor);
|
||||
void A_AttractChase(void *actor); // Ring Chase
|
||||
void A_DropMine(void *actor); // Drop Mine from Skim or Jetty-Syn Bomber
|
||||
void A_FishJump(void *actor); // Fish Jump
|
||||
void A_ThrownRing(void *actor); // Sparkle trail for red ring
|
||||
void A_GrenadeRing(void *actor); // SRB2kart
|
||||
void A_SetSolidSteam(void *actor);
|
||||
void A_UnsetSolidSteam(void *actor);
|
||||
void A_SignPlayer(void *actor);
|
||||
void A_OverlayThink(void *actor);
|
||||
void A_JetChase(void *actor);
|
||||
void A_JetbThink(void *actor); // Jetty-Syn Bomber Thinker
|
||||
void A_JetgThink(void *actor); // Jetty-Syn Gunner Thinker
|
||||
void A_JetgShoot(void *actor); // Jetty-Syn Shoot Function
|
||||
void A_ShootBullet(void *actor); // JetgShoot without reactiontime setting
|
||||
void A_MinusDigging(void *actor);
|
||||
void A_MinusPopup(void *actor);
|
||||
void A_MinusCheck(void *actor);
|
||||
void A_ChickenCheck(void *actor);
|
||||
void A_MouseThink(void *actor); // Mouse Thinker
|
||||
void A_DetonChase(void *actor); // Deton Chaser
|
||||
void A_CapeChase(void *actor); // Fake little Super Sonic cape
|
||||
void A_RotateSpikeBall(void *actor); // Spike ball rotation
|
||||
void A_SlingAppear(void *actor);
|
||||
void A_MaceRotate(void *actor);
|
||||
void A_UnidusBall(void *actor);
|
||||
void A_RockSpawn(void *actor);
|
||||
void A_SetFuse(void *actor);
|
||||
void A_CrawlaCommanderThink(void *actor); // Crawla Commander
|
||||
void A_SmokeTrailer(void *actor);
|
||||
void A_RingExplode(void *actor);
|
||||
void A_OldRingExplode(void *actor);
|
||||
void A_MixUp(void *actor);
|
||||
void A_RecyclePowers(void *actor);
|
||||
void A_BossScream(void *actor);
|
||||
void A_Boss2TakeDamage(void *actor);
|
||||
void A_GoopSplat(void *actor);
|
||||
void A_Boss2PogoSFX(void *actor);
|
||||
void A_Boss2PogoTarget(void *actor);
|
||||
void A_EggmanBox(void *actor);
|
||||
void A_TurretFire(void *actor);
|
||||
void A_SuperTurretFire(void *actor);
|
||||
void A_TurretStop(void *actor);
|
||||
void A_JetJawRoam(void *actor);
|
||||
void A_JetJawChomp(void *actor);
|
||||
void A_PointyThink(void *actor);
|
||||
void A_CheckBuddy(void *actor);
|
||||
void A_HoodThink(void *actor);
|
||||
void A_ArrowCheck(void *actor);
|
||||
void A_SnailerThink(void *actor);
|
||||
void A_SharpChase(void *actor);
|
||||
void A_SharpSpin(void *actor);
|
||||
void A_VultureVtol(void *actor);
|
||||
void A_VultureCheck(void *actor);
|
||||
void A_SkimChase(void *actor);
|
||||
void A_SkullAttack(void *actor);
|
||||
void A_LobShot(void *actor);
|
||||
void A_FireShot(void *actor);
|
||||
void A_SuperFireShot(void *actor);
|
||||
void A_BossFireShot(void *actor);
|
||||
void A_Boss7FireMissiles(void *actor);
|
||||
void A_Boss1Laser(void *actor);
|
||||
void A_FocusTarget(void *actor);
|
||||
void A_Boss4Reverse(void *actor);
|
||||
void A_Boss4SpeedUp(void *actor);
|
||||
void A_Boss4Raise(void *actor);
|
||||
void A_SparkFollow(void *actor);
|
||||
void A_BuzzFly(void *actor);
|
||||
void A_GuardChase(void *actor);
|
||||
void A_EggShield(void *actor);
|
||||
void A_SetReactionTime(void *actor);
|
||||
void A_Boss1Spikeballs(void *actor);
|
||||
void A_Boss3TakeDamage(void *actor);
|
||||
void A_Boss3Path(void *actor);
|
||||
void A_LinedefExecute(void *actor);
|
||||
void A_PlaySeeSound(void *actor);
|
||||
void A_PlayAttackSound(void *actor);
|
||||
void A_PlayActiveSound(void *actor);
|
||||
void A_1upThinker(void *actor);
|
||||
void A_BossZoom(void *actor); //Unused
|
||||
void A_Boss1Chase(void *actor);
|
||||
void A_Boss2Chase(void *actor);
|
||||
void A_Boss2Pogo(void *actor);
|
||||
void A_Boss7Chase(void *actor);
|
||||
void A_BossJetFume(void *actor);
|
||||
void A_SpawnObjectAbsolute(void *actor);
|
||||
void A_SpawnObjectRelative(void *actor);
|
||||
void A_ChangeAngleRelative(void *actor);
|
||||
void A_ChangeAngleAbsolute(void *actor);
|
||||
void A_PlaySound(void *actor);
|
||||
void A_FindTarget(void *actor);
|
||||
void A_FindTracer(void *actor);
|
||||
void A_SetTics(void *actor);
|
||||
void A_SetRandomTics(void *actor);
|
||||
void A_ChangeColorRelative(void *actor);
|
||||
void A_ChangeColorAbsolute(void *actor);
|
||||
void A_MoveRelative(void *actor);
|
||||
void A_MoveAbsolute(void *actor);
|
||||
void A_Thrust(void *actor);
|
||||
void A_ZThrust(void *actor);
|
||||
void A_SetTargetsTarget(void *actor);
|
||||
void A_SetObjectFlags(void *actor);
|
||||
void A_SetObjectFlags2(void *actor);
|
||||
void A_RandomState(void *actor);
|
||||
void A_RandomStateRange(void *actor);
|
||||
void A_DualAction(void *actor);
|
||||
void A_RemoteAction(void *actor);
|
||||
void A_ToggleFlameJet(void *actor);
|
||||
void A_ItemPop(void *actor); // SRB2kart
|
||||
void A_JawzChase(void *actor); // SRB2kart
|
||||
void A_JawzExplode(void *actor); // SRB2kart
|
||||
void A_SPBChase(void *actor); // SRB2kart
|
||||
void A_MineExplode(void *actor); // SRB2kart
|
||||
void A_BallhogExplode(void *actor); // SRB2kart
|
||||
void A_LightningFollowPlayer(void *actor); // SRB2kart: Lightning shield effect player chasing
|
||||
void A_FZBoomFlash(void *actor); // SRB2kart
|
||||
void A_FZBoomSmoke(void *actor); // SRB2kart
|
||||
void A_RandomShadowFrame(void *actor); //SRB2kart: Shadow spawner frame randomizer
|
||||
void A_RoamingShadowThinker(void *actor); // SRB2kart: Roaming Shadow moving + attacking players.
|
||||
void A_MayonakaArrow(void *actor); //SRB2kart: midnight channel arrow sign
|
||||
void A_ReaperThinker(void *actor); //SRB2kart: mementos reaper
|
||||
void A_MementosTPParticles(void *actor); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
|
||||
void A_FlameParticle(void *actor); // SRB2kart
|
||||
void A_OrbitNights(void *actor);
|
||||
void A_GhostMe(void *actor);
|
||||
void A_SetObjectState(void *actor);
|
||||
void A_SetObjectTypeState(void *actor);
|
||||
void A_KnockBack(void *actor);
|
||||
void A_PushAway(void *actor);
|
||||
void A_RingDrain(void *actor);
|
||||
void A_SplitShot(void *actor);
|
||||
void A_MissileSplit(void *actor);
|
||||
void A_MultiShot(void *actor);
|
||||
void A_InstaLoop(void *actor);
|
||||
void A_Custom3DRotate(void *actor);
|
||||
void A_SearchForPlayers(void *actor);
|
||||
void A_CheckRandom(void *actor);
|
||||
void A_CheckTargetRings(void *actor);
|
||||
void A_CheckRings(void *actor);
|
||||
void A_CheckTotalRings(void *actor);
|
||||
void A_CheckHealth(void *actor);
|
||||
void A_CheckRange(void *actor);
|
||||
void A_CheckHeight(void *actor);
|
||||
void A_CheckTrueRange(void *actor);
|
||||
void A_CheckThingCount(void *actor);
|
||||
void A_CheckAmbush(void *actor);
|
||||
void A_CheckCustomValue(void *actor);
|
||||
void A_CheckCusValMemo(void *actor);
|
||||
void A_SetCustomValue(void *actor);
|
||||
void A_UseCusValMemo(void *actor);
|
||||
void A_RelayCustomValue(void *actor);
|
||||
void A_CusValAction(void *actor);
|
||||
void A_ForceStop(void *actor);
|
||||
void A_ForceWin(void *actor);
|
||||
void A_SpikeRetract(void *actor);
|
||||
void A_InfoState(void *actor);
|
||||
void A_Repeat(void *actor);
|
||||
void A_SetScale(void *actor);
|
||||
void A_RemoteDamage(void *actor);
|
||||
void A_HomingChase(void *actor);
|
||||
void A_TrapShot(void *actor);
|
||||
void A_VileTarget(void *actor);
|
||||
void A_VileAttack(void *actor);
|
||||
void A_VileFire(void *actor);
|
||||
void A_BrakChase(void *actor);
|
||||
void A_BrakFireShot(void *actor);
|
||||
void A_BrakLobShot(void *actor);
|
||||
void A_NapalmScatter(void *actor);
|
||||
void A_SpawnFreshCopy(void *actor);
|
||||
|
||||
extern boolean actionsoverridden[NUMACTIONS];
|
||||
|
||||
@@ -4312,7 +4309,7 @@ typedef struct
|
||||
spritenum_t sprite;
|
||||
UINT32 frame; // we use the upper 16 bits for translucency and other shade effects
|
||||
INT32 tics;
|
||||
actionf_t action;
|
||||
actionf_p1 action;
|
||||
INT32 var1;
|
||||
INT32 var2;
|
||||
statenum_t nextstate;
|
||||
|
||||
+164
-113
@@ -96,8 +96,9 @@ consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, N
|
||||
CV_PossibleValue_t minimapdot_cons_t[NUMMINIMAPDOTSTUFF];
|
||||
consvar_t cv_showminimapangle = {"showminimapangle", "Off", CV_SAVE, minimapdot_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_posanim = {"postitionanimation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_smallposnum = {"smallpositionnumber", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t posanim_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}};
|
||||
consvar_t cv_posanim = {"postitionanimation", "On", CV_SAVE, posanim_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_smallposnum = {"smallpositionnumber", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -1137,6 +1138,33 @@ static boolean K_UseColorSpeedo(int speedostyle)
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
GAUGE_DEFAULT = 1,
|
||||
GAUGE_SMALL,
|
||||
GAUGE_BIGNUM,
|
||||
GAUGE_NUMONLY,
|
||||
GAUGE_EXTRA,
|
||||
};
|
||||
|
||||
static SINT8 K_GetDriftgaugeStyle(void)
|
||||
{
|
||||
if (driftgaugegfx)
|
||||
{
|
||||
if (cv_driftgaugestyle.value == 1)
|
||||
return GAUGE_DEFAULT;
|
||||
else if (cv_driftgaugestyle.value == 2)
|
||||
return GAUGE_SMALL;
|
||||
else if (cv_driftgaugestyle.value == 3)
|
||||
return GAUGE_BIGNUM;
|
||||
else if (cv_driftgaugestyle.value == 5 && xtra_speedo3)
|
||||
return GAUGE_EXTRA;
|
||||
}
|
||||
|
||||
// Fallback
|
||||
return GAUGE_NUMONLY; // (cv_driftgaugestyle.value == 4)
|
||||
}
|
||||
|
||||
static boolean K_IsHighResolution(void)
|
||||
{
|
||||
return (vid.width >= 640 && vid.height >= 400);
|
||||
@@ -1312,48 +1340,76 @@ static void K_drawKartStats(void)
|
||||
spdxoffset = 0;
|
||||
spdoffset = 0;
|
||||
|
||||
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
||||
|
||||
UINT8 splitnum = 0;
|
||||
|
||||
for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum)
|
||||
{
|
||||
if (stplyrnum == splitnum)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!LUA_HudEnabled(hud_statdisplay))
|
||||
return;
|
||||
|
||||
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
||||
|
||||
//Internal offset for speedometer
|
||||
|
||||
const UINT8 speedostyle = K_GetSpeedometerStyle();
|
||||
|
||||
if (cv_kartspeedometer.value && (!splitscreen))
|
||||
{
|
||||
if ((speedostyle == SPEEDO_EXTRA) || (speedostyle == SPEEDO_ACHII) || (speedostyle == SPEEDO_EXTRA3))
|
||||
spdoffset = -10;
|
||||
else if (speedostyle == SPEEDO_DIAL)
|
||||
switch (speedostyle)
|
||||
{
|
||||
spdxoffset = 11;
|
||||
spdoffset = 14;
|
||||
case SPEEDO_EXTRA:
|
||||
case SPEEDO_ACHII:
|
||||
case SPEEDO_EXTRA3:
|
||||
spdoffset = -10;
|
||||
break;
|
||||
case SPEEDO_DIAL:
|
||||
spdxoffset = 11;
|
||||
spdoffset = 14;
|
||||
break;
|
||||
default:
|
||||
spdoffset = -14;
|
||||
break;
|
||||
}
|
||||
else
|
||||
spdoffset = -14;
|
||||
}
|
||||
else
|
||||
spdoffset = 0;
|
||||
|
||||
if ((speedostyle != SPEEDO_DIAL) || (splitscreen))
|
||||
spdoffset += (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0);
|
||||
if (G_BattleGametype() && ((speedostyle != SPEEDO_DIAL) || splitscreen))
|
||||
spdoffset += ((stplyr->kartstuff[k_bumper] ? -5 : -8));
|
||||
|
||||
// Customizations c:
|
||||
if (!splitscreen)
|
||||
{
|
||||
skin_t *fakeskin;
|
||||
INT32 flags2;
|
||||
|
||||
x += 18 + cv_stat_xoffset.value + spdxoffset;
|
||||
y += cv_stat_yoffset.value + spdoffset;
|
||||
|
||||
flags |= V_HUDTRANS;
|
||||
flags2 = flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor);
|
||||
|
||||
fakeskin = K_GetPlayerSkin(stplyr);
|
||||
|
||||
// Skin name
|
||||
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
|
||||
{
|
||||
V_DrawSmallString(x+20, y+12, flags2, fakeskin->realname);
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(x+20, y+7, flags2, fakeskin->realname);
|
||||
}
|
||||
|
||||
// Icon and stats
|
||||
if (K_UseHighResPortraits())
|
||||
V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
||||
else
|
||||
V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
||||
|
||||
V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE));
|
||||
V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE));
|
||||
|
||||
return;
|
||||
}
|
||||
else if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c:
|
||||
|
||||
if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c:
|
||||
{
|
||||
x -= 10;
|
||||
y -= 40;
|
||||
@@ -1361,7 +1417,7 @@ static void K_drawKartStats(void)
|
||||
|
||||
// If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping
|
||||
// to bottom
|
||||
if (splitnum == 0)
|
||||
if (stplyrnum == 0)
|
||||
{
|
||||
y /= 2;
|
||||
flags = V_SNAPTOLEFT;
|
||||
@@ -1374,52 +1430,25 @@ static void K_drawKartStats(void)
|
||||
}
|
||||
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
|
||||
x = POSI_X + 19;
|
||||
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.
|
||||
{
|
||||
x = POSI2_X - 75;
|
||||
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;
|
||||
|
||||
skin_t *fakeskin;
|
||||
fakeskin = K_GetPlayerSkin(stplyr);
|
||||
|
||||
if (!splitscreen)
|
||||
{
|
||||
// Skin name
|
||||
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
|
||||
{
|
||||
V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor), fakeskin->realname);
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(x+20, y+7, flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor), fakeskin->realname);
|
||||
}
|
||||
|
||||
// Icon and stats
|
||||
if (K_UseHighResPortraits())
|
||||
V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
||||
else
|
||||
V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
||||
|
||||
V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE));
|
||||
V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE));
|
||||
}
|
||||
else
|
||||
{
|
||||
// In splitscreen, just draw a string with stats
|
||||
V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight));
|
||||
}
|
||||
// In splitscreen, just draw a string with stats
|
||||
V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight));
|
||||
}
|
||||
|
||||
static void K_drawKartItem(void)
|
||||
@@ -1706,7 +1735,7 @@ static void K_drawKartItem(void)
|
||||
switch (stplyr->kartstuff[k_itemblinkmode])
|
||||
{
|
||||
case 2:
|
||||
localcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||
localcolor = K_RainbowColor();
|
||||
break;
|
||||
case 1:
|
||||
localcolor = SKINCOLOR_RED;
|
||||
@@ -1811,6 +1840,7 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
||||
if (!mode)
|
||||
{
|
||||
splitflags = V_HUDTRANS|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT);
|
||||
|
||||
if (cv_timelimit.value && timelimitintics > 0)
|
||||
{
|
||||
if (drawtime >= timelimitintics)
|
||||
@@ -1948,6 +1978,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
||||
}
|
||||
}
|
||||
|
||||
#define POS_DELAY_TIME 10
|
||||
|
||||
static void K_DrawKartPositionNum(INT32 num)
|
||||
{
|
||||
// POSI_X = BASEVIDWIDTH - 51; // 269
|
||||
@@ -1966,7 +1998,15 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
|
||||
if ((cv_posanim.value && stplyr->kartstuff[k_positiondelay]) || stplyr->exiting)
|
||||
{
|
||||
scale *= 2;
|
||||
if (cv_posanim.value == 2)
|
||||
{
|
||||
const UINT8 delay = (stplyr->exiting) ? POS_DELAY_TIME : stplyr->kartstuff[k_positiondelay];
|
||||
const fixed_t add = (scale * 3) >> ((splitscreen == 1) ? 1 : 2);
|
||||
scale = (scale + min((add * (delay * delay)) / (POS_DELAY_TIME * POS_DELAY_TIME), add));
|
||||
}
|
||||
else
|
||||
scale *= 2;
|
||||
|
||||
overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
|
||||
}
|
||||
|
||||
@@ -2164,9 +2204,7 @@ static boolean K_drawKartPositionFaces(void)
|
||||
|
||||
if (!playeringame[rankplayer[i]])
|
||||
continue;
|
||||
if (player->spectator)
|
||||
continue;
|
||||
if (!player->mo)
|
||||
if (player->spectator || !player->mo)
|
||||
continue;
|
||||
|
||||
const UINT8 mocolor = player->mo->color;
|
||||
@@ -2175,9 +2213,10 @@ static boolean K_drawKartPositionFaces(void)
|
||||
|
||||
if (mocolor)
|
||||
{
|
||||
colormap = R_GetTranslationColormap(player->skin, mocolor, GTC_CACHE);
|
||||
if (player->mo->colorized)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, mocolor, GTC_CACHE);
|
||||
else
|
||||
colormap = R_GetTranslationColormap(player->skin, mocolor, GTC_CACHE);
|
||||
|
||||
if (K_UseHighResPortraits())
|
||||
V_DrawSmallMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceWant(player), colormap);
|
||||
@@ -2206,8 +2245,10 @@ static boolean K_drawKartPositionFaces(void)
|
||||
else
|
||||
{
|
||||
INT32 pos = player->kartstuff[k_position];
|
||||
|
||||
if (pos < 0 || pos > MAXPLAYERS)
|
||||
pos = 0;
|
||||
|
||||
// Draws the little number over the face
|
||||
V_DrawScaledPatch(FACE_X-5, Y+10, V_HUDTRANS|V_SNAPTOLEFT, kp_facenum[pos]);
|
||||
}
|
||||
@@ -2233,6 +2274,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
|
||||
|
||||
V_DrawFill(1-duptweak, 26, dupadjust-2, 1, 0); // Draw a horizontal line because it looks nice!
|
||||
|
||||
if (scorelines > 8)
|
||||
{
|
||||
V_DrawFill(160, 26, 1, 147, 0); // Draw a vertical line to separate the two sides.
|
||||
@@ -3032,6 +3074,12 @@ static void K_drawNameTags(void)
|
||||
else
|
||||
flipped = players[i].mo->eflags & MFE_VERTICALFLIP;
|
||||
|
||||
#ifdef HWRENDER
|
||||
// Needs extra offset. Not perfect but this will do for now
|
||||
if (rendermode == render_opengl && !cv_glshearing.value && cv_smallnametags.value)
|
||||
namey -= dup*6;
|
||||
#endif
|
||||
|
||||
if (cv_smallnametags.value || !nametaggfx)
|
||||
{
|
||||
if (flipped)
|
||||
@@ -3143,7 +3191,7 @@ static void K_drawDriftGauge(void)
|
||||
fixed_t basex, basey;
|
||||
const int dup = vid.dupx;
|
||||
int i;
|
||||
UINT8 *cmap;
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
static const UINT8 driftcolors[3][4] = {
|
||||
{0, 0, 10, 16}, // no drift
|
||||
@@ -3157,7 +3205,7 @@ static void K_drawDriftGauge(void)
|
||||
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
|
||||
};
|
||||
|
||||
@@ -3189,23 +3237,21 @@ skipcrap:
|
||||
const INT32 driftcharge = min(driftval*4, stplyr->kartstuff[k_driftcharge]);
|
||||
const INT32 driftlevel = min(driftcharge / driftval, 2);
|
||||
const INT32 drifttrans = ((cv_driftgaugetrans.value) ? V_LocalTransFlag() : 0);
|
||||
const SINT8 gaugestyle = K_GetDriftgaugeStyle();
|
||||
|
||||
basex = pos.x>>FRACBITS;
|
||||
basey = pos.y>>FRACBITS;
|
||||
|
||||
switch (cv_driftgaugestyle.value)
|
||||
switch (gaugestyle)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
case GAUGE_DEFAULT:
|
||||
case GAUGE_SMALL:
|
||||
case GAUGE_EXTRA:
|
||||
case GAUGE_BIGNUM:
|
||||
{
|
||||
if (!driftgaugegfx)
|
||||
break;
|
||||
patch_t *driftpatch = NULL;
|
||||
|
||||
const boolean usescaledpatch = (cv_driftgaugestyle.value == 5 && xtra_speedo3);
|
||||
|
||||
if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3 || usescaledpatch)
|
||||
if (gaugestyle == GAUGE_DEFAULT || gaugestyle == GAUGE_BIGNUM || gaugestyle == GAUGE_EXTRA)
|
||||
{
|
||||
barx = basex - dup*23;
|
||||
BAR_WIDTH = dup*47;
|
||||
@@ -3218,40 +3264,44 @@ skipcrap:
|
||||
|
||||
bary = basey - dup*2;
|
||||
|
||||
if (usescaledpatch) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
|
||||
if (gaugestyle == GAUGE_EXTRA) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
|
||||
{
|
||||
if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // Colourized hud
|
||||
if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // We reuse the extra speedometer patch hence this check
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallstickerclr3, colormap, 0);
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
driftpatch = skp_smallstickerclr3;
|
||||
}
|
||||
else
|
||||
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallsticker3, NULL, 0);
|
||||
driftpatch = skp_smallsticker3;
|
||||
|
||||
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (K_UseColorHud()) // Colourized hud
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmallcolor : driftgaugecolor, colormap);
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
driftpatch = (gaugestyle == GAUGE_SMALL ? driftgaugesmallcolor : driftgaugecolor);
|
||||
}
|
||||
else
|
||||
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmall : driftgauge, NULL);
|
||||
driftpatch = (gaugestyle == GAUGE_SMALL ? driftgaugesmall : driftgauge);
|
||||
|
||||
V_DrawMappedPatch(gaugestyle == GAUGE_SMALL ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap);
|
||||
}
|
||||
|
||||
if (driftcharge >= driftval*4) // rainbow sparks
|
||||
{
|
||||
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 18 - 1)] + i*2) | V_NOSCALESTART|drifttrans);
|
||||
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 17)] + i*2) | V_NOSCALESTART|drifttrans);
|
||||
}
|
||||
else // none/blue/red
|
||||
{
|
||||
const INT32 limit = (driftval * (driftcharge >= driftval*2 ? 2 : 1));
|
||||
const INT32 width = ((driftcharge - (driftcharge >= driftval ? limit : 0)) * BAR_WIDTH) / limit;
|
||||
|
||||
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -3263,21 +3313,20 @@ skipcrap:
|
||||
}
|
||||
|
||||
// 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)
|
||||
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
|
||||
if (gaugestyle == GAUGE_BIGNUM)
|
||||
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
|
||||
else
|
||||
V_DrawPingNum(cv_driftgaugestyle.value == 2 ? basex + (dup*22) : basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, cmap);
|
||||
V_DrawPingNum((gaugestyle == GAUGE_SMALL ? basex + (dup*22) : basex + (dup*32)), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, colormap);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case GAUGE_NUMONLY:
|
||||
{
|
||||
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
|
||||
|
||||
if (driftcharge >= driftval*4)
|
||||
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
|
||||
else
|
||||
colormap = 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, colormap);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -3294,6 +3343,7 @@ static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fix
|
||||
range *= gamespeed+1;
|
||||
|
||||
dist = abs(R_PointToDist2(px, py, mx, my));
|
||||
|
||||
if (dist > range)
|
||||
return -BASEVIDWIDTH;
|
||||
|
||||
@@ -3337,6 +3387,7 @@ static void K_drawKartWanted(void)
|
||||
{
|
||||
basex = WANT_X;
|
||||
basey = WANT_Y;
|
||||
|
||||
if (splitscreen == 2)
|
||||
{
|
||||
basey += 16; // slight adjust for 3P
|
||||
@@ -3393,17 +3444,14 @@ static void K_drawKartPlayerCheck(void)
|
||||
UINT8 *colormap;
|
||||
INT32 x;
|
||||
|
||||
const INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM);
|
||||
|
||||
if (!stplyr->mo || stplyr->spectator)
|
||||
return;
|
||||
|
||||
if (stplyr->awayviewtics)
|
||||
if (!stplyr->mo || stplyr->spectator || stplyr->awayviewtics)
|
||||
return;
|
||||
|
||||
if (camspin[0])
|
||||
return;
|
||||
|
||||
const INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
UINT8 pnum = 0;
|
||||
@@ -3521,7 +3569,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
skin = K_GetMobjSkin(mo);
|
||||
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);
|
||||
|
||||
if (encoremode)
|
||||
@@ -3954,7 +4002,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;
|
||||
|
||||
@@ -4089,17 +4137,23 @@ static void K_drawKartFirstPerson(void)
|
||||
x -= xoffs;
|
||||
else
|
||||
x += xoffs;
|
||||
|
||||
if (!splitscreen)
|
||||
y += yoffs;
|
||||
}
|
||||
|
||||
const INT32 driftcharge = stplyr->kartstuff[k_driftcharge];
|
||||
|
||||
// drift sparks!
|
||||
if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsthree))
|
||||
colmap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE);
|
||||
else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dstwo))
|
||||
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE);
|
||||
else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsone))
|
||||
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE);
|
||||
if ((leveltime & 1) && driftcharge)
|
||||
{
|
||||
if (driftcharge >= dsthree)
|
||||
colmap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
|
||||
else if (driftcharge >= dstwo)
|
||||
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE);
|
||||
else if (driftcharge >= dsone)
|
||||
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
// invincibility/grow/shrink!
|
||||
@@ -4128,7 +4182,7 @@ static void K_drawInput(void)
|
||||
|
||||
const UINT8 hudcolor = K_GetHudColor();
|
||||
const INT32 accent1 = splitflags|colortranslations[hudcolor][5];
|
||||
const INT32 accent2 = splitflags|colortranslations[hudcolor][9];
|
||||
const INT32 accent2 = splitflags|colortranslations[hudcolor][7];
|
||||
const UINT8 *hudcolormap = R_GetTranslationColormap(0, hudcolor, GTC_CACHE);
|
||||
|
||||
const ticcmd_t *cmd = &stplyr->cmd;
|
||||
@@ -4375,10 +4429,6 @@ static void K_drawLapStartAnim(void)
|
||||
void K_drawKartFreePlay(UINT32 flashtime)
|
||||
{
|
||||
// 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)
|
||||
return;
|
||||
|
||||
@@ -4492,6 +4542,7 @@ static void K_drawCheckpointDebugger(void)
|
||||
V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Can finish)", stplyr->starpostnum, numstarposts));
|
||||
else
|
||||
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]));
|
||||
}
|
||||
|
||||
@@ -4754,7 +4805,7 @@ void K_drawKartHUD(void)
|
||||
V_DrawScaledPatch(BASEVIDWIDTH/2 - (kp_yougotem->width/2), 32, V_HUDTRANS, kp_yougotem);
|
||||
|
||||
// Draw FREE PLAY.
|
||||
if (isfreeplay && !stplyr->spectator && timeinmap > 113)
|
||||
if (isfreeplay && cv_showfreeplay.value && !stplyr->spectator && timeinmap > 113)
|
||||
{
|
||||
if (LUA_HudEnabled(hud_freeplay))
|
||||
K_drawKartFreePlay(leveltime);
|
||||
|
||||
+179
-92
@@ -484,6 +484,15 @@ UINT8 colortranslations[MAXTRANSLATIONS][16] = {
|
||||
{120, 120, 96, 96, 97, 98, 98, 99, 81, 81, 69, 71, 73, 75, 77, 79}, // SKINCOLOR_CSUPER5
|
||||
};
|
||||
|
||||
//
|
||||
// Gives you a color to use for rainbow effects (like invincibility).
|
||||
// Return: Skincolor value.
|
||||
//
|
||||
UINT8 K_RainbowColor(void)
|
||||
{
|
||||
return (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||
}
|
||||
|
||||
// Define for getting accurate color brightness readings according to how the human eye sees them.
|
||||
// https://en.wikipedia.org/wiki/Relative_luminance
|
||||
// 0.2126 to red
|
||||
@@ -522,6 +531,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
dest_colormap[i] = (UINT8)i;
|
||||
continue;
|
||||
}
|
||||
|
||||
color = V_GetColor(i);
|
||||
SETBRIGHTNESS(brightness, color.s.red, color.s.green, color.s.blue);
|
||||
brightdif = 256;
|
||||
@@ -550,26 +560,41 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
*/
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 starttranscolor;
|
||||
INT32 i, starttranscolor;
|
||||
|
||||
// Handle a couple of simple special cases
|
||||
if (skinnum == TC_BOSS
|
||||
|| skinnum == TC_ALLWHITE
|
||||
|| skinnum == TC_METALSONIC
|
||||
|| skinnum == TC_BLINK
|
||||
|| color == SKINCOLOR_NONE)
|
||||
if (skinnum < TC_DEFAULT)
|
||||
{
|
||||
for (i = 0; i < NUM_PALETTE_ENTRIES; i++)
|
||||
switch (skinnum)
|
||||
{
|
||||
if (skinnum == TC_ALLWHITE)
|
||||
dest_colormap[i] = 0;
|
||||
else if (skinnum == TC_BLINK)
|
||||
dest_colormap[i] = colortranslations[color][3];
|
||||
else
|
||||
dest_colormap[i] = (UINT8)i;
|
||||
case TC_ALLWHITE:
|
||||
memset(dest_colormap, 0, NUM_PALETTE_ENTRIES * sizeof(UINT8));
|
||||
return;
|
||||
case TC_RAINBOW:
|
||||
if (color >= MAXTRANSLATIONS)
|
||||
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!
|
||||
if (skinnum == TC_BOSS)
|
||||
dest_colormap[31] = 0;
|
||||
@@ -578,14 +603,25 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (starttranscolor >= NUM_PALETTE_ENTRIES)
|
||||
I_Error("Invalid startcolor #%d.", starttranscolor);
|
||||
|
||||
// Fill in the entries of the palette that are fixed
|
||||
for (i = 0; i < starttranscolor; i++)
|
||||
dest_colormap[i] = (UINT8)i;
|
||||
@@ -618,36 +654,46 @@ UINT8 K_GetKartColorByName(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// returns the players skinnumber
|
||||
// accounts for localskins
|
||||
//
|
||||
INT32 K_GetSkinNum(player_t *player)
|
||||
{
|
||||
return player->localskin ? (player->localskin - 1) : player->skin;
|
||||
}
|
||||
|
||||
//
|
||||
// returns the mobj skinnumber
|
||||
// accounts for localskins
|
||||
//
|
||||
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local)
|
||||
{
|
||||
return skin - K_GetSkinArray(local);
|
||||
}
|
||||
|
||||
//
|
||||
// returns the players skinnumber
|
||||
// accounts for localskins
|
||||
//
|
||||
skin_t *K_GetMobjSkin(const mobj_t *mobj)
|
||||
{
|
||||
return mobj->localskin ? mobj->localskin : mobj->skin;
|
||||
}
|
||||
|
||||
//
|
||||
// returns the skin array to use
|
||||
// accounts for localskins
|
||||
//
|
||||
skin_t *K_GetSkinArray(boolean local)
|
||||
{
|
||||
return local ? localskins : skins;
|
||||
}
|
||||
|
||||
//
|
||||
// returns the players skin
|
||||
// accounts for localskins
|
||||
//
|
||||
skin_t *K_GetPlayerSkin(player_t *player)
|
||||
{
|
||||
return &K_GetSkinArray(player->skinlocal)[K_GetSkinNum(player)];
|
||||
@@ -1585,7 +1631,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.
|
||||
// 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.
|
||||
|
||||
for (i = 2; i < 5; i++) // check for sector special
|
||||
@@ -1669,10 +1715,10 @@ static void K_SpawnDashDustRelease(player_t *player)
|
||||
I_Assert(player->mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(player->mo));
|
||||
|
||||
if (!P_IsObjectOnGround(player->mo))
|
||||
if (!player->speed && !player->kartstuff[k_startboost])
|
||||
return;
|
||||
|
||||
if (!player->speed && !player->kartstuff[k_startboost])
|
||||
if (!P_IsObjectOnGround(player->mo))
|
||||
return;
|
||||
|
||||
travelangle = player->mo->angle;
|
||||
@@ -1902,11 +1948,11 @@ static void K_PlayGenericCombatSound(mobj_t *source, mobj_t *other, sfxenum_t sf
|
||||
|
||||
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);
|
||||
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(alwaysHear ? NULL : source, skin->soundsid[S_sfx[sfx_id].skinsound]);
|
||||
}
|
||||
|
||||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
@@ -1928,7 +1974,7 @@ void K_PlayAttackTaunt(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
|
||||
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))
|
||||
S_StartSound(source, sfx_kbost1+pick);
|
||||
@@ -1941,8 +1987,6 @@ void K_PlayBoostTaunt(mobj_t *source)
|
||||
|
||||
void K_PlayOvertakeSound(mobj_t *source)
|
||||
{
|
||||
boolean tasteful = (!source->player || !source->player->kartstuff[k_voices]);
|
||||
|
||||
if (!G_RaceGametype()) // Only in race
|
||||
return;
|
||||
|
||||
@@ -1950,6 +1994,8 @@ void K_PlayOvertakeSound(mobj_t *source)
|
||||
if (leveltime < starttime+(10*TICRATE))
|
||||
return;
|
||||
|
||||
const boolean tasteful = (!source->player || !source->player->kartstuff[k_voices]);
|
||||
|
||||
if (cv_kartvoices.value && (tasteful || cv_kartvoices.value == 2))
|
||||
S_StartSound(source, sfx_kslow);
|
||||
|
||||
@@ -2185,6 +2231,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower)
|
||||
|
||||
if (doboostpower)
|
||||
return FixedMul(finalspeed, player->kartstuff[k_boostpower]+player->kartstuff[k_speedboost]);
|
||||
|
||||
return finalspeed;
|
||||
}
|
||||
|
||||
@@ -2221,10 +2268,14 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove
|
||||
{
|
||||
fixed_t accelmax = 4000;
|
||||
fixed_t newspeed, oldspeed, finalspeed;
|
||||
fixed_t p_speed = K_GetKartSpeed(player, true);
|
||||
fixed_t p_accel = K_GetKartAccel(player);
|
||||
fixed_t p_speed, p_accel;
|
||||
|
||||
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!
|
||||
oldspeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale);
|
||||
@@ -2328,6 +2379,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
|
||||
if (P_MobjWasRemoved(player->mo))
|
||||
return; // mobj was removed (in theory that shouldn't happen)
|
||||
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
@@ -2440,7 +2492,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
|
||||
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
|
||||
S_StartSound(player->mo, sfx_kc59);
|
||||
@@ -2468,8 +2520,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.
|
||||
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);
|
||||
|
||||
if (P_MobjWasRemoved(player->mo))
|
||||
return; // mobj was removed (in theory that shouldn't happen)
|
||||
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
@@ -2582,6 +2636,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
|
||||
if (P_MobjWasRemoved(player->mo))
|
||||
return; // mobj was removed (in theory that shouldn't happen)
|
||||
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
@@ -2667,6 +2722,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
player->powers[pw_flashing] = K_GetKartFlashing(player);
|
||||
|
||||
upgoer = (18*mapobjectscale*P_MobjFlip(player->mo));
|
||||
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
upgoer = (117 * upgoer) / 200;
|
||||
|
||||
@@ -2853,7 +2909,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->momz = FixedMul(FixedDiv(mobjz - z, dist), FixedDiv(dist, 6*FRACUNIT));
|
||||
|
||||
if (source && !P_MobjWasRemoved(source))
|
||||
if (!P_MobjWasRemoved(source))
|
||||
P_SetTarget(&mobj->target, source);
|
||||
}
|
||||
}
|
||||
@@ -3047,7 +3103,7 @@ static UINT16 K_DriftSparkColor(player_t *player, INT32 charge)
|
||||
|
||||
if (charge >= K_GetKartDriftSparkValue(player)*4)
|
||||
{
|
||||
color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||
color = K_RainbowColor();
|
||||
}
|
||||
else if (charge >= K_GetKartDriftSparkValue(player)*2)
|
||||
{
|
||||
@@ -3081,14 +3137,12 @@ static void K_SpawnDriftSparks(player_t *player)
|
||||
if (leveltime % 2 == 1)
|
||||
return;
|
||||
|
||||
if (cv_airsparks.value)
|
||||
goto skipground;
|
||||
const boolean onground = P_IsObjectOnGround(player->mo);
|
||||
|
||||
if (!P_IsObjectOnGround(player->mo))
|
||||
// kinda sketchy
|
||||
if (!cv_airsparks.value && !onground)
|
||||
return;
|
||||
|
||||
skipground: // idk im sleepy
|
||||
|
||||
if (!player->kartstuff[k_drift] || player->kartstuff[k_driftcharge] < K_GetKartDriftSparkValue(player))
|
||||
return;
|
||||
|
||||
@@ -3105,6 +3159,8 @@ skipground: // idk im sleepy
|
||||
newy = player->mo->y + P_ReturnThrustY(player->mo, thrustangle, smolscale);
|
||||
spark = P_SpawnMobj(newx, newy, player->mo->z, MT_DRIFTSPARK);
|
||||
|
||||
spark->islocal = cv_airsparks.value && !onground;
|
||||
|
||||
P_SetTarget(&spark->target, player->mo);
|
||||
spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift];
|
||||
|
||||
@@ -3539,11 +3595,14 @@ void K_SpawnSparkleTrail(mobj_t *mo)
|
||||
fixed_t newz = mo->z + mo->momz + (P_RandomRange(0, mo->height>>FRACBITS)<<FRACBITS);
|
||||
|
||||
sparkle = P_SpawnMobj(newx, newy, newz, MT_SPARKLETRAIL);
|
||||
|
||||
K_FlipFromObject(sparkle, mo);
|
||||
|
||||
P_SetTarget(&sparkle->target, mo);
|
||||
|
||||
sparkle->destscale = mo->destscale;
|
||||
P_SetScale(sparkle, mo->scale);
|
||||
|
||||
sparkle->color = mo->color;
|
||||
|
||||
if (cv_playerblendeffects.value && mo->player && K_SpeedLinesShouldBlend(mo->player))
|
||||
@@ -3602,7 +3661,6 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent)
|
||||
void K_DriftDustHandling(mobj_t *spawner)
|
||||
{
|
||||
angle_t anglediff;
|
||||
const INT16 spawnrange = spawner->radius>>FRACBITS;
|
||||
|
||||
if (!P_IsObjectOnGround(spawner) || leveltime % 2 != 0)
|
||||
return;
|
||||
@@ -3639,6 +3697,8 @@ void K_DriftDustHandling(mobj_t *spawner)
|
||||
if (anglediff > ANGLE_180)
|
||||
anglediff = InvAngle(anglediff);
|
||||
|
||||
const INT16 spawnrange = spawner->radius>>FRACBITS;
|
||||
|
||||
if (anglediff > ANG10*4) // Trying to turn further than 40 degrees
|
||||
{
|
||||
fixed_t spawnx = P_RandomRange(-spawnrange, spawnrange)<<FRACBITS;
|
||||
@@ -3666,7 +3726,7 @@ static mobj_t *K_FindLastTrailMobj(player_t *player)
|
||||
if (!player || !(trail = player->mo) || !player->mo->hnext || !player->mo->hnext->health)
|
||||
return NULL;
|
||||
|
||||
while (trail->hnext && !P_MobjWasRemoved(trail->hnext) && trail->hnext->health)
|
||||
while (!P_MobjWasRemoved(trail->hnext) && trail->hnext->health)
|
||||
{
|
||||
trail = trail->hnext;
|
||||
}
|
||||
@@ -3898,12 +3958,11 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
|
||||
|
||||
void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
||||
{
|
||||
angle_t fa = R_PointToAngle2(0, 0, punter->momx, punter->momy) >> ANGLETOFINESHIFT;
|
||||
fixed_t z = 30*mapobjectscale + punter->momz;
|
||||
fixed_t spd;
|
||||
angle_t fa;
|
||||
fixed_t z, spd;
|
||||
mobj_t *mine;
|
||||
|
||||
if (!thismine || P_MobjWasRemoved(thismine))
|
||||
if (P_MobjWasRemoved(thismine))
|
||||
return;
|
||||
|
||||
//This guarantees you hit a mine being dragged
|
||||
@@ -3932,9 +3991,12 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
||||
else
|
||||
mine = thismine;
|
||||
|
||||
if (!mine || P_MobjWasRemoved(mine))
|
||||
if (P_MobjWasRemoved(mine))
|
||||
return;
|
||||
|
||||
fa = R_PointToAngle2(0, 0, punter->momx, punter->momy) >> ANGLETOFINESHIFT;
|
||||
z = 30*mapobjectscale + punter->momz;
|
||||
|
||||
spd = K_GetProjectileSpeed();
|
||||
|
||||
mine->flags |= MF_NOCLIPTHING;
|
||||
@@ -4099,7 +4161,8 @@ void K_DoSneaker(player_t *player, INT32 type)
|
||||
if (player->mo->hnext)
|
||||
{
|
||||
mobj_t *cur = player->mo->hnext;
|
||||
while (cur && !P_MobjWasRemoved(cur))
|
||||
|
||||
while (!P_MobjWasRemoved(cur))
|
||||
{
|
||||
if (!cur->tracer)
|
||||
{
|
||||
@@ -4145,8 +4208,10 @@ static void K_DoShrink(player_t *user)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator || !players[i].mo)
|
||||
continue;
|
||||
|
||||
if (&players[i] == user)
|
||||
continue;
|
||||
|
||||
if (players[i].kartstuff[k_position] < user->kartstuff[k_position])
|
||||
{
|
||||
//P_FlashPal(&players[i], PAL_NUKE, 10);
|
||||
@@ -4163,7 +4228,7 @@ static void K_DoShrink(player_t *user)
|
||||
K_DropItems(&players[i]);
|
||||
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->destscale = (6*mapobjectscale)/8;
|
||||
@@ -4293,7 +4358,7 @@ void K_DropHnextList(player_t *player)
|
||||
mobjtype_t type;
|
||||
boolean orbit, ponground, dropall = true;
|
||||
|
||||
if (!work || P_MobjWasRemoved(work))
|
||||
if (P_MobjWasRemoved(work))
|
||||
return;
|
||||
|
||||
flip = P_MobjFlip(player->mo);
|
||||
@@ -4432,7 +4497,7 @@ void K_DropItems(player_t *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);
|
||||
P_SetScale(drop, drop->scale>>4);
|
||||
@@ -4461,7 +4526,7 @@ void K_DropRocketSneaker(player_t *player)
|
||||
fixed_t flingangle;
|
||||
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;
|
||||
|
||||
while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe))
|
||||
@@ -4500,7 +4565,7 @@ void K_DropRocketSneaker(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;
|
||||
|
||||
if (player->mo->hnext->type != MT_SINK_SHIELD)
|
||||
@@ -4517,13 +4582,13 @@ void K_RepairOrbitChain(mobj_t *orbit)
|
||||
mobj_t *cachenext = orbit->hnext;
|
||||
|
||||
// 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, 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, NULL);
|
||||
@@ -4538,7 +4603,7 @@ void K_RepairOrbitChain(mobj_t *orbit)
|
||||
mobj_t *cur = orbit->target->hnext;
|
||||
mobj_t *prev = NULL;
|
||||
|
||||
while (cur && !P_MobjWasRemoved(cur))
|
||||
while (!P_MobjWasRemoved(cur))
|
||||
{
|
||||
prev = cur;
|
||||
cur = cur->hnext;
|
||||
@@ -4600,7 +4665,7 @@ static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z
|
||||
//sec = R_PointInSubsector(x, y)->sector;
|
||||
|
||||
if (mobj->x != x || mobj->y != y || mobj->subsector == NULL)
|
||||
sec = R_PointInSubsector(x, y)->sector;
|
||||
sec = R_PointInSubsectorFast(x, y)->sector;
|
||||
else
|
||||
sec = mobj->subsector->sector;
|
||||
|
||||
@@ -4738,7 +4803,7 @@ static void K_MoveHeldObjects(player_t *player)
|
||||
|
||||
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.
|
||||
fixed_t z;
|
||||
@@ -4816,7 +4881,7 @@ static void K_MoveHeldObjects(player_t *player)
|
||||
if (P_IsObjectOnGround(player->mo) && player->speed > 0)
|
||||
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);
|
||||
angle_t ang;
|
||||
@@ -4844,7 +4909,7 @@ static void K_MoveHeldObjects(player_t *player)
|
||||
else
|
||||
dist = cur->extravalue1/2;
|
||||
|
||||
if (!targ || P_MobjWasRemoved(targ))
|
||||
if (P_MobjWasRemoved(targ))
|
||||
continue;
|
||||
|
||||
// Shrink your items if the player shrunk too.
|
||||
@@ -4902,7 +4967,7 @@ static void K_MoveHeldObjects(player_t *player)
|
||||
mobj_t *cur = player->mo->hnext;
|
||||
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);
|
||||
boolean vibrate = ((leveltime & 1) && !cur->tracer);
|
||||
@@ -4967,7 +5032,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;
|
||||
|
||||
@@ -5031,6 +5096,7 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
|
||||
|
||||
// Find the angle, see who's got the best.
|
||||
thisang = actor->angle - R_PointToAngle2(actor->x, actor->y, player->mo->x, player->mo->y);
|
||||
|
||||
if (thisang > ANGLE_180)
|
||||
thisang = InvAngle(thisang);
|
||||
|
||||
@@ -5227,10 +5293,11 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
||||
static void K_UpdateInvincibilitySounds(player_t *player)
|
||||
{
|
||||
INT32 sfxnum = sfx_None;
|
||||
const boolean localplayer = P_IsLocalPlayer(player);
|
||||
|
||||
if (player->mo->health > 0)
|
||||
{
|
||||
const boolean localplayer = P_IsLocalPlayer(player);
|
||||
|
||||
if (player->kartstuff[k_growshrinktimer] > 0 && (!localplayer || cv_growmusic.value == 2)) // Prioritize Grow
|
||||
sfxnum = cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow;
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 0 && (!localplayer || cv_supermusic.value == 2))
|
||||
@@ -5323,7 +5390,7 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
|
||||
else if (player->kartstuff[k_driftboost] <= 50)
|
||||
speedcolor = SKINCOLOR_RASPBERRY;
|
||||
else if (player->kartstuff[k_driftboost] <= 125)
|
||||
speedcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||
speedcolor = K_RainbowColor();
|
||||
|
||||
if (cv_coloredspeedlines.value == 2)
|
||||
speedcolor = (leveltime & 1) ? playercolor : speedcolor;
|
||||
@@ -5361,6 +5428,7 @@ FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player, bool
|
||||
fast->momx = 3*player->mo->momx/4;
|
||||
fast->momy = 3*player->mo->momy/4;
|
||||
fast->momz = 3*player->mo->momz/4;
|
||||
fast->islocal = !synched;
|
||||
P_SetTarget(&fast->target, player->mo); // easier lua access
|
||||
|
||||
K_MatchGenericExtraFlags(fast, player->mo);
|
||||
@@ -5707,7 +5775,7 @@ void K_KartPlayerAfterThink(player_t *player)
|
||||
else
|
||||
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_jawztargetdelay] = 0;
|
||||
@@ -5769,7 +5837,7 @@ boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y)
|
||||
static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
||||
{
|
||||
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 (player->kartstuff[k_drift] == 0 || !P_IsObjectOnGround(player->mo))
|
||||
@@ -5780,6 +5848,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
|
||||
}
|
||||
|
||||
driftweight = player->kartweight*14; // 12
|
||||
|
||||
//basedrift = 90*player->kartstuff[k_drift]; // 450
|
||||
//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
|
||||
@@ -5790,6 +5860,9 @@ static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
||||
|
||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
||||
{
|
||||
fixed_t p_topspeed, p_curspeed, p_maxspeed;
|
||||
fixed_t adjustangle;
|
||||
|
||||
if (player->spectator)
|
||||
return turnvalue;
|
||||
|
||||
@@ -5808,10 +5881,10 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
||||
return turnvalue;
|
||||
}
|
||||
|
||||
fixed_t p_topspeed = K_GetKartSpeed(player, false);
|
||||
fixed_t p_curspeed = min(player->speed, p_topspeed * 2);
|
||||
fixed_t p_maxspeed = p_topspeed * 3;
|
||||
fixed_t adjustangle = FixedDiv((p_maxspeed>>16) - (p_curspeed>>16), (p_maxspeed>>16) + player->kartweight);
|
||||
p_topspeed = K_GetKartSpeed(player, false);
|
||||
p_curspeed = min(player->speed, p_topspeed * 2);
|
||||
p_maxspeed = p_topspeed * 3;
|
||||
adjustangle = FixedDiv((p_maxspeed>>16) - (p_curspeed>>16), (p_maxspeed>>16) + player->kartweight);
|
||||
|
||||
turnvalue = FixedMul(turnvalue, adjustangle); // Weight has a small effect on turning
|
||||
|
||||
@@ -6062,32 +6135,47 @@ void K_KartUpdatePosition(player_t *player)
|
||||
// This checks every thing on the map, and looks for MT_BOSS3WAYPOINT (the thing we're using for checkpoint wp's, for now)
|
||||
for (mo = waypointcap; mo != NULL; mo = mo->tracer)
|
||||
{
|
||||
pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x,
|
||||
mo->y - player->mo->y),
|
||||
mo->z - player->mo->z) / FRACUNIT;
|
||||
imo = P_AproxDistance(P_AproxDistance( mo->x - players[i].mo->x,
|
||||
mo->y - players[i].mo->y),
|
||||
mo->z - players[i].mo->z) / FRACUNIT;
|
||||
const boolean isprevcheckpointp = mo->health == player->starpostnum;
|
||||
const boolean isnextcheckpointp = mo->health == (player->starpostnum + 1);
|
||||
|
||||
if (mo->health == player->starpostnum && (!mo->movecount || mo->movecount == player->laps+1))
|
||||
if ((isprevcheckpointp || isnextcheckpointp) && (!mo->movecount || mo->movecount == player->laps+1))
|
||||
{
|
||||
player->kartstuff[k_prevcheck] += pmo;
|
||||
ppcd++;
|
||||
pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x,
|
||||
mo->y - player->mo->y),
|
||||
mo->z - player->mo->z) / FRACUNIT;
|
||||
|
||||
if (isprevcheckpointp)
|
||||
{
|
||||
player->kartstuff[k_prevcheck] += pmo;
|
||||
ppcd++;
|
||||
}
|
||||
|
||||
if (isnextcheckpointp)
|
||||
{
|
||||
player->kartstuff[k_nextcheck] += pmo;
|
||||
pncd++;
|
||||
}
|
||||
}
|
||||
if (mo->health == (player->starpostnum + 1) && (!mo->movecount || mo->movecount == player->laps+1))
|
||||
|
||||
const boolean isprevcheckpointi = mo->health == players[i].starpostnum;
|
||||
const boolean isnextcheckpointi = mo->health == (players[i].starpostnum + 1);
|
||||
|
||||
if ((isprevcheckpointi || isnextcheckpointi) && (!mo->movecount || mo->movecount == players[i].laps+1))
|
||||
{
|
||||
player->kartstuff[k_nextcheck] += pmo;
|
||||
pncd++;
|
||||
}
|
||||
if (mo->health == players[i].starpostnum && (!mo->movecount || mo->movecount == players[i].laps+1))
|
||||
{
|
||||
players[i].kartstuff[k_prevcheck] += imo;
|
||||
ipcd++;
|
||||
}
|
||||
if (mo->health == (players[i].starpostnum + 1) && (!mo->movecount || mo->movecount == players[i].laps+1))
|
||||
{
|
||||
players[i].kartstuff[k_nextcheck] += imo;
|
||||
incd++;
|
||||
imo = P_AproxDistance(P_AproxDistance( mo->x - players[i].mo->x,
|
||||
mo->y - players[i].mo->y),
|
||||
mo->z - players[i].mo->z) / FRACUNIT;
|
||||
|
||||
if (isprevcheckpointi)
|
||||
{
|
||||
players[i].kartstuff[k_prevcheck] += imo;
|
||||
ipcd++;
|
||||
}
|
||||
if (isnextcheckpointi )
|
||||
{
|
||||
players[i].kartstuff[k_nextcheck] += imo;
|
||||
incd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6198,7 +6286,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
|
||||
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,
|
||||
{
|
||||
@@ -6778,10 +6866,9 @@ void K_MoveKartPlayer(player_t *player, boolean 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
|
||||
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
extern UINT8 colortranslations[MAXTRANSLATIONS][16];
|
||||
extern const char *KartColor_Names[MAXSKINCOLORS];
|
||||
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
|
||||
UINT8 K_RainbowColor(void);
|
||||
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
|
||||
UINT8 K_GetKartColorByName(const char *name);
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
X (IntermissionThinker),/* Y_Ticker */\
|
||||
X (VoteThinker),/*SRB2KART*/\
|
||||
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
|
||||
X (SetupVote),/*SRB2KART - Saturn*/
|
||||
|
||||
#define STRING_HOOK_LIST(X) \
|
||||
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
|
||||
@@ -140,3 +141,8 @@ int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); /
|
||||
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
|
||||
// SRB2KART - Saturn: Allows changing vote level picks
|
||||
// (note: function format in lua doesn't include maxresults, so its function(result, gametype, secondgametype, prevmap)
|
||||
// to get maxresults use #result)
|
||||
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt);
|
||||
+52
-6
@@ -393,6 +393,16 @@ FUNCINLINE static ATTRINLINE boolean prepare_string_hook
|
||||
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
|
||||
(
|
||||
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)
|
||||
{
|
||||
const hook_t * map = &hudHookIds[hook_type];
|
||||
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);
|
||||
|
||||
hud_running = true; // local hook
|
||||
hud_interpcounter = 0;
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
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
|
||||
hud_running = false;
|
||||
|
||||
@@ -1132,3 +1138,43 @@ boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *sourc
|
||||
{
|
||||
return kartdamage_hook(player, inflictor, source, HOOK(PlayerExplode), res_true);
|
||||
}
|
||||
|
||||
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt)
|
||||
{
|
||||
Hook_State hook;
|
||||
if (prepare_hook(&hook, 0, HOOK(SetupVote)))
|
||||
{
|
||||
// { 0, 0, 0, 0, }
|
||||
lua_newtable(gL);
|
||||
for (int i = 1; i <= maxresults; ++i)
|
||||
{
|
||||
lua_pushinteger(gL, 0);
|
||||
lua_rawseti(gL, -2, i);
|
||||
}
|
||||
|
||||
// call_hooks does lua_settop(gL, 0) so we need to store our table somewhere
|
||||
lua_pushvalue(gL, -1);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "SetupVoteResults");
|
||||
|
||||
lua_pushinteger(gL, gt);
|
||||
lua_pushinteger(gL, secondgt);
|
||||
lua_pushinteger(gL, prevmap+1); // prevmap is gamemap-1 so we offset it back
|
||||
|
||||
call_hooks(&hook, 0, res_none);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "SetupVoteResults");
|
||||
for (int i = 1; i <= maxresults; ++i)
|
||||
{
|
||||
lua_rawgeti(gL, -1, i);
|
||||
result[i-1] = lua_tointeger(gL, -1);
|
||||
lua_pop(gL, 1);
|
||||
|
||||
if (result[i-1] && (result[i-1] < 0 || !mapheaderinfo[result[i-1]-1]))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "Unknown map #%d for vote\n", result[i-1]);
|
||||
result[i-1] = 0;
|
||||
}
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -181,7 +181,7 @@ static int lib_setState(lua_State *L)
|
||||
switch(lua_type(L, 3))
|
||||
{
|
||||
case LUA_TNIL: // Null? Set the action to nothing, then.
|
||||
state->action.acp1 = NULL;
|
||||
state->action = NULL;
|
||||
break;
|
||||
case LUA_TSTRING: // It's a string, expect the name of a built-in action
|
||||
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_rawset(L, -3); // Set it in the registry
|
||||
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;
|
||||
default: // ?!
|
||||
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, 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.
|
||||
}
|
||||
|
||||
@@ -350,9 +350,9 @@ static int state_get(lua_State *L)
|
||||
case state_action:
|
||||
{
|
||||
const char *name;
|
||||
if (!st->action.acp1) // Action is NULL.
|
||||
if (!st->action) // Action is NULL.
|
||||
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);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
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))
|
||||
{
|
||||
case LUA_TNIL: // Null? Set the action to nothing, then.
|
||||
st->action.acp1 = NULL;
|
||||
st->action = NULL;
|
||||
break;
|
||||
case LUA_TSTRING: // It's a string, expect the name of a built-in action
|
||||
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_rawset(L, -3); // Set it in the registry
|
||||
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;
|
||||
default: // ?!
|
||||
return luaL_typerror(L, 3, "function");
|
||||
|
||||
+1
-1
@@ -227,4 +227,4 @@ int LUA_MathLib(lua_State *L)
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
luaL_register(L, NULL, lib);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -150,7 +150,8 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, cvmem, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset),
|
||||
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, islocal, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
{ NULL, 0, NULL, NULL },
|
||||
};
|
||||
#undef FIELD
|
||||
|
||||
+23
-15
@@ -24,6 +24,7 @@
|
||||
#include "p_slopes.h" // for P_SlopeById
|
||||
#include "s_sound.h"
|
||||
#include "m_menu.h"
|
||||
#include "m_argv.h"
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
#include "d_netfil.h" // for LUA_DumpFile
|
||||
#endif
|
||||
@@ -252,7 +253,11 @@ static inline void LUA_LoadFile(MYFILE *f, char *name)
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, lua_gettop(gL) - 1)) {
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||
if (M_CheckParm("-strict") || M_CheckParm("-strict-lua"))
|
||||
I_Error("Lua error: %s", lua_tostring(gL, -1));
|
||||
else
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||
|
||||
lua_pop(gL,1);
|
||||
}
|
||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
||||
@@ -1023,8 +1028,8 @@ static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX, boolean network)
|
||||
case ARCH_MOBJ:
|
||||
if (network == false) // for replays :chaosleep:
|
||||
{
|
||||
*p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game.
|
||||
return 3; // Don't set the field
|
||||
*p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game.
|
||||
return 3; // Don't set the field
|
||||
}
|
||||
|
||||
LUA_PushUserdata(gL, P_FindNewPosition(READUINT32(*p)), META_MOBJ);
|
||||
@@ -1099,9 +1104,9 @@ static void UnArchiveExtVars(UINT8 **p, void *pointer, boolean network)
|
||||
CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field);
|
||||
break;
|
||||
}
|
||||
else if (ret == 3) // This will return 3 if we shouldn't set this field.
|
||||
else if (ret == 3) // This will return 3 if we shouldn't set this field.
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field);
|
||||
//CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1155,7 +1160,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
||||
ret = UnArchiveValue(p, TABLESINDEX, network);
|
||||
if (ret == 3)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
lua_pushnil(gL);
|
||||
}
|
||||
else if (ret == 1) // read key
|
||||
@@ -1170,7 +1175,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
||||
}
|
||||
else if (ret == 3)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
lua_pushnil(gL);
|
||||
}
|
||||
else if (ret == 2) // read value
|
||||
@@ -1189,7 +1194,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
||||
}
|
||||
}
|
||||
|
||||
void LUA_Step(void)
|
||||
/*void LUA_Step(void)
|
||||
{
|
||||
if (!gL)
|
||||
return;
|
||||
@@ -1200,7 +1205,7 @@ void LUA_Step(void)
|
||||
lua_settop(gL, 0);
|
||||
lua_gc(gL, LUA_GCSTEP, 1);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void LUA_Archive(savebuffer_t *save, boolean network)
|
||||
{
|
||||
@@ -1212,7 +1217,7 @@ void LUA_Archive(savebuffer_t *save, boolean network)
|
||||
|
||||
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;
|
||||
// all players in game will be archived, even if they just add a 0.
|
||||
ArchiveExtVars(&save->p, &players[i], "player");
|
||||
@@ -1224,7 +1229,7 @@ void LUA_Archive(savebuffer_t *save, boolean network)
|
||||
{
|
||||
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;
|
||||
|
||||
// archive function will determine when to skip mobjs,
|
||||
@@ -1264,15 +1269,18 @@ void LUA_UnArchive(savebuffer_t *save, boolean network)
|
||||
{
|
||||
do {
|
||||
mobjnum = READUINT32(save->p); // read a mobjnum
|
||||
|
||||
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;
|
||||
|
||||
if (((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
|
||||
UnArchiveExtVars(&save->p, th, network); // apply variables
|
||||
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
|
||||
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
|
||||
}
|
||||
|
||||
+9
-4
@@ -10,6 +10,9 @@
|
||||
/// \file lua_script.h
|
||||
/// \brief Lua scripting basics
|
||||
|
||||
#ifndef LUA_SCRIPT_H
|
||||
#define LUA_SCRIPT_H
|
||||
|
||||
#include "m_fixed.h"
|
||||
#include "doomtype.h"
|
||||
#include "d_player.h"
|
||||
@@ -55,7 +58,7 @@ void LUA_InvalidateUserdata(void *data);
|
||||
void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
void LUA_InvalidatePlayer(player_t *player);
|
||||
void LUA_Step(void);
|
||||
//void LUA_Step(void);
|
||||
void LUA_Archive(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)\
|
||||
{\
|
||||
static UINT8 seen = 0;\
|
||||
if (!seen) {\
|
||||
if (UNLIKELY(!seen)) {\
|
||||
seen = 1;\
|
||||
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)\
|
||||
{\
|
||||
static UINT8 seen = 0;\
|
||||
if (!seen) {\
|
||||
if (UNLIKELY(!seen)) {\
|
||||
seen = 1;\
|
||||
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)\
|
||||
{\
|
||||
static UINT8 seen = 0;\
|
||||
if (!seen) {\
|
||||
if (UNLIKELY(!seen)) {\
|
||||
seen = 1;\
|
||||
CONS_Alert(CONS_WARNING,"%s\n", warningmsg);\
|
||||
}\
|
||||
}
|
||||
|
||||
#endif/*LUA_SCRIPT_H*/
|
||||
@@ -32,7 +32,7 @@ struct iterationState {
|
||||
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);
|
||||
if (it->next != LUA_REFNIL)
|
||||
@@ -44,7 +44,7 @@ static int iterationState_gc(lua_State *L)
|
||||
}
|
||||
|
||||
#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); \
|
||||
else \
|
||||
lua_pushlightuserdata(L, (th)); \
|
||||
@@ -88,7 +88,7 @@ static int lib_iterateThinkers(lua_State *L)
|
||||
return luaL_error(L, "next thinker invalidated during iteration");
|
||||
|
||||
for (; next != &thinkercap; next = next->next)
|
||||
if (!it->filter || next->function.acp1 == it->filter)
|
||||
if (!it->filter || next->function == it->filter)
|
||||
{
|
||||
push_thinker(next);
|
||||
if (next->next != &thinkercap)
|
||||
@@ -130,4 +130,4 @@ int LUA_ThinkerLib(lua_State *L)
|
||||
lua_setfield(L, -2, "iterate");
|
||||
lua_setglobal(L, "thinkers");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+51
-34
@@ -20,17 +20,17 @@
|
||||
|
||||
typedef struct aatree_node_s
|
||||
{
|
||||
INT32 level;
|
||||
INT32 key;
|
||||
void* value;
|
||||
INT32 key;
|
||||
INT32 depth;
|
||||
void *value;
|
||||
|
||||
struct aatree_node_s *left, *right;
|
||||
} aatree_node_t;
|
||||
|
||||
struct aatree_s
|
||||
{
|
||||
aatree_node_t *root;
|
||||
UINT32 flags;
|
||||
aatree_node_t *root;
|
||||
UINT32 flags;
|
||||
};
|
||||
|
||||
aatree_t *M_AATreeAlloc(UINT32 flags)
|
||||
@@ -56,40 +56,48 @@ void M_AATreeFree(aatree_t *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)
|
||||
{
|
||||
// Not allowed: horizontal left-link. Reverse the
|
||||
// horizontal link and hook the orphan back in.
|
||||
aatree_node_t *oldleft = node->left;
|
||||
node->left = oldleft->right;
|
||||
oldleft->right = node;
|
||||
|
||||
return oldleft;
|
||||
}
|
||||
|
||||
// No change needed.
|
||||
return node;
|
||||
aatree_node_t *newnode = node->left;
|
||||
aatree_node_t *tmp = newnode->right;
|
||||
newnode->right = node;
|
||||
node->left = tmp;
|
||||
return newnode;
|
||||
}
|
||||
|
||||
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.
|
||||
// The middle one becomes the new root at this point,
|
||||
// with suitable adjustments below.
|
||||
I_Assert(node->left->key < node->right->key);
|
||||
balance = node->left->depth - node->right->depth;
|
||||
}
|
||||
|
||||
aatree_node_t *oldright = node->right;
|
||||
node->right = oldright->left;
|
||||
oldright->left = node;
|
||||
oldright->level++;
|
||||
|
||||
return oldright;
|
||||
if (balance > 1)
|
||||
{
|
||||
return M_AATreeRotateRight(node);
|
||||
}
|
||||
else if (balance < -1)
|
||||
{
|
||||
return M_AATreeRotateLeft(node);
|
||||
}
|
||||
|
||||
// No change needed.
|
||||
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
|
||||
node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
|
||||
node->level = 1;
|
||||
node->key = key;
|
||||
if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
|
||||
else node->value = value;
|
||||
node->left = node->right = NULL;
|
||||
node->depth = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,8 +125,17 @@ static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32
|
||||
else node->value = value;
|
||||
}
|
||||
|
||||
node = M_AATreeSkew(node);
|
||||
node = M_AATreeSplit(node);
|
||||
node = M_AATreeRebalance(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;
|
||||
|
||||
+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)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if (th->function != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
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__
|
||||
+473
-3699
File diff suppressed because it is too large.
Load diff
+17
-28
@@ -212,14 +212,14 @@ extern menuitem_t PlayerMenu[MAXSKINS];
|
||||
typedef struct menu_s
|
||||
{
|
||||
const char *menutitlepic;
|
||||
INT16 numitems; // # of menu items
|
||||
struct menu_s *prevMenu; // previous menu
|
||||
menuitem_t *menuitems; // menu items
|
||||
void (*drawroutine)(void); // draw routine
|
||||
INT16 x, y; // x, y of menu
|
||||
INT16 lastOn; // last item user was on in menu
|
||||
boolean (*quitroutine)(void); // called before quit a menu return true if we can
|
||||
const char* tooltips[MAXTOOLTIPS]; // tooltips! give me that info bitch
|
||||
INT16 numitems; // # of menu items
|
||||
struct menu_s *prevMenu; // previous menu
|
||||
menuitem_t *menuitems; // menu items
|
||||
void (*drawroutine)(void); // draw routine
|
||||
INT16 x, y; // x, y of menu
|
||||
INT16 lastOn; // last item user was on in menu
|
||||
boolean (*quitroutine)(void); // called before quit a menu return true if we can
|
||||
const char* *tooltips; // tooltips! give me that info bitch
|
||||
} menu_t;
|
||||
|
||||
void M_SetupNextMenu(menu_t *menudef);
|
||||
@@ -335,7 +335,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name);
|
||||
|
||||
// These defines make it a little easier to make menus
|
||||
#define DEFAULTMENUSTYLE(header, source, prev, x, y)\
|
||||
#define DEFAULTMENUSTYLE(header, source, prev, x, y, tooltip)\
|
||||
{\
|
||||
header,\
|
||||
sizeof(source)/sizeof(menuitem_t),\
|
||||
@@ -345,10 +345,10 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
tooltip\
|
||||
}
|
||||
|
||||
#define DEFAULTSCROLLSTYLE(header, source, prev, x, y)\
|
||||
#define DEFAULTSCROLLSTYLE(header, source, prev, x, y, tooltip)\
|
||||
{\
|
||||
header,\
|
||||
sizeof(source)/sizeof(menuitem_t),\
|
||||
@@ -358,7 +358,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
tooltip\
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define CENTERMENUSTYLE(header, source, prev, y)\
|
||||
@@ -385,7 +385,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
BASEVIDWIDTH/2, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define MAPICONMENUSTYLE(header, source, prev)\
|
||||
@@ -398,7 +398,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
24,40,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define CONTROLMENUSTYLE(source, prev)\
|
||||
@@ -411,7 +411,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
26, 40,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define IMAGEDEF(source)\
|
||||
@@ -424,18 +424,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
0, 0,\
|
||||
0,\
|
||||
NULL,\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define DoToolTips(menu, tooltip)\
|
||||
if (currentMenu == &menu)\
|
||||
{\
|
||||
if (!(tooltip[itemOn] == NULL))\
|
||||
{\
|
||||
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, tooltip[itemOn], coolalphatimer);\
|
||||
if (coolalphatimer > 0 && interpTimerHackAllow)\
|
||||
coolalphatimer--;\
|
||||
}\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+2947
File diff suppressed because it is too large.
Load diff
+171
@@ -1604,6 +1604,52 @@ boolean M_ScreenshotResponder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen, tic_t timer)
|
||||
{
|
||||
// How much should we scroll. Not sure why +1 is needed, but without it this function skips 2
|
||||
// characters at once sometimes
|
||||
const size_t amount = len - maxlen + 1;
|
||||
|
||||
// Note: anything above 17 will cause zero division
|
||||
const size_t MAXSPEED = 6;
|
||||
const tic_t t = timer / (35/min(amount, MAXSPEED));
|
||||
|
||||
const size_t state = (t / amount) % 4;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
// Show beginning of the name
|
||||
case 0:
|
||||
memcpy(result, name, maxlen-1);
|
||||
break;
|
||||
|
||||
// Scroll towards end of the name
|
||||
case 1:
|
||||
{
|
||||
const size_t advance = t % amount;
|
||||
memcpy(result, name+advance, maxlen-1);
|
||||
}
|
||||
break;
|
||||
|
||||
// Show end of the name
|
||||
case 2:
|
||||
memcpy(result, name+len+1-maxlen, maxlen-1);
|
||||
break;
|
||||
|
||||
// Scroll towards start of the name
|
||||
case 3:
|
||||
{
|
||||
const size_t advance = t % amount;
|
||||
memcpy(result, name+len+1-maxlen-advance, maxlen-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Technically not necessary, since it gets set again after function call, but just in case
|
||||
result[maxlen] = 0;
|
||||
}
|
||||
|
||||
void M_MinimapGenerate(void)
|
||||
{
|
||||
#ifdef USE_PNG
|
||||
@@ -1762,6 +1808,87 @@ INT32 axtoi(const char *hexStg)
|
||||
return intValue;
|
||||
}
|
||||
|
||||
void CopyCaretColors(char *p, const char *s, int n)
|
||||
{
|
||||
char *t;
|
||||
int m;
|
||||
int c;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
while (( t = strchr(s, '^') ))
|
||||
{
|
||||
m = ( t - s );
|
||||
|
||||
if (m >= n)
|
||||
{
|
||||
memcpy(p, s, n);
|
||||
return;
|
||||
}
|
||||
else
|
||||
memcpy(p, s, m);
|
||||
|
||||
p += m;
|
||||
n -= m;
|
||||
s += m;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (s[1])
|
||||
{
|
||||
c = toupper(s[1]);
|
||||
if (isdigit(c))
|
||||
c = 0x80 + ( c - '0' );
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
c = 0x80 + ( c - 'A' );
|
||||
else
|
||||
c = 0;
|
||||
|
||||
if (c)
|
||||
{
|
||||
*p++ = c;
|
||||
n--;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n < 2)
|
||||
break;
|
||||
|
||||
memcpy(p, s, 2);
|
||||
|
||||
p += 2;
|
||||
n -= 2;
|
||||
}
|
||||
|
||||
s += 2;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy(p, s, n);
|
||||
}
|
||||
|
||||
void StripColors(char *dst, char *src, size_t n)
|
||||
{
|
||||
size_t j = 0;
|
||||
|
||||
for (size_t i = 0; j < n && src[i] != 0; ++i)
|
||||
{
|
||||
char c = src[i];
|
||||
|
||||
if ((c & 0x80) == 0)
|
||||
dst[j++] = c;
|
||||
}
|
||||
|
||||
dst[j] = 0;
|
||||
}
|
||||
|
||||
/** Token parser for TEXTURES, ANIMDEFS, and potentially other lumps later down the line.
|
||||
* Was originally R_GetTexturesToken when I was coding up the TEXTURES parser, until I realized I needed it for ANIMDEFS too.
|
||||
* Parses up to the next whitespace character or comma. When finding the start of the next token, whitespace is skipped.
|
||||
@@ -2167,6 +2294,50 @@ void M_MkdirEach(const char *path, int start, int 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
|
||||
} // extern "C"
|
||||
|
||||
@@ -73,6 +73,8 @@ void M_ScreenShot(void);
|
||||
void M_DoScreenShot(void);
|
||||
boolean M_ScreenshotResponder(event_t *ev);
|
||||
|
||||
void M_ScrollString(const char name[], size_t len, char result[], size_t maxlen, tic_t timer);
|
||||
|
||||
void M_MinimapGenerate(void);
|
||||
|
||||
void Command_SaveConfig_f(void);
|
||||
@@ -85,6 +87,11 @@ void M_SaveConfig(const char *filename);
|
||||
|
||||
INT32 axtoi(const char *hexStg);
|
||||
|
||||
void CopyCaretColors(char *p, const char *s, int n);
|
||||
|
||||
// Remove color codes from string
|
||||
void StripColors(char *dst, char *src, size_t n);
|
||||
|
||||
const char *GetRevisionString(void);
|
||||
|
||||
// Vector/matrix math
|
||||
@@ -117,6 +124,11 @@ const char * M_Ftrim (double);
|
||||
// counting bits, for weapon ammo code, usually
|
||||
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"
|
||||
extern char configfile[MAX_WADPATH];
|
||||
|
||||
|
||||
+8
-8
@@ -590,9 +590,9 @@ static void PS_CountThinkers(void)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (thinker->function == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
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;
|
||||
ps_mobjcount.value.i++;
|
||||
@@ -609,7 +609,7 @@ static void PS_CountThinkers(void)
|
||||
|
||||
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
|
||||
|
||||
ps_precipcount.value.i++;
|
||||
@@ -620,7 +620,7 @@ static void PS_CountThinkers(void)
|
||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (thinker->function == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
ps_removecount.value.i++;
|
||||
else if (i == THINK_POLYOBJ)
|
||||
ps_polythcount.value.i++;
|
||||
@@ -628,7 +628,7 @@ static void PS_CountThinkers(void)
|
||||
ps_mainthcount.value.i++;
|
||||
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;
|
||||
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 x, y;
|
||||
|
||||
if (cv_perfstats.value >= 3)
|
||||
if (cv_perfstats.value >= 3)
|
||||
{
|
||||
x = 2;
|
||||
y = 0;
|
||||
@@ -892,7 +892,7 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
|
||||
|
||||
PS_DrawDescriptorHeader();
|
||||
|
||||
for (i = 0; i < hook_length; i++)
|
||||
for (i = 0; i < hook_length; i++)
|
||||
{
|
||||
#define NEXT_ROW() y += HEIGHT;
|
||||
|
||||
@@ -1010,7 +1010,7 @@ void M_DrawPerfStats(void)
|
||||
// tics when frame skips happen
|
||||
PS_DrawGameLogicStats();
|
||||
}
|
||||
else if (cv_perfstats.value >= 3) // lua thinkframe
|
||||
else if (cv_perfstats.value >= 3) // lua thinkframe
|
||||
{
|
||||
if (!PS_IsLevelActive())
|
||||
return;
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ ATTRINLINE static fixed_t FUNCINLINE __internal_prng__(void)
|
||||
randomseed ^= randomseed >> 13;
|
||||
randomseed ^= randomseed >> 11;
|
||||
randomseed ^= randomseed << 21;
|
||||
return ( (randomseed*36548569) >> 4) & (FRACUNIT-1);
|
||||
return ((randomseed*36548569) >> 4) & (FRACUNIT-1);
|
||||
}
|
||||
|
||||
/** Provides a random fixed point number. Distribution is uniform.
|
||||
|
||||
+169
-5
@@ -130,6 +130,82 @@ static void M_TextInputPaste(textinput_t *input)
|
||||
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)
|
||||
{
|
||||
input->buffer = buffer;
|
||||
@@ -156,7 +232,7 @@ void M_TextInputSetString(textinput_t *input, const char *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
|
||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||
@@ -241,16 +317,14 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
||||
|
||||
if (key == KEY_LEFTARROW)
|
||||
{
|
||||
if (input->cursor != 0)
|
||||
--input->cursor;
|
||||
M_TextInputLeft(input, emotes);
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
{
|
||||
if (input->cursor < input->length)
|
||||
++input->cursor;
|
||||
M_TextInputRight(input, emotes);
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
@@ -320,6 +394,96 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
||||
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)
|
||||
{
|
||||
if (renderisnewtic)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define __M_TEXTINPUT__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "m_emotes.h" // M_VerifyEmote, M_FindEmote
|
||||
|
||||
typedef struct textinput_s {
|
||||
size_t cursor;
|
||||
@@ -22,6 +23,10 @@ void M_TextInputSetString(textinput_t *input, const char *c);
|
||||
|
||||
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)
|
||||
void M_DrawTextInputScroll(INT32 x, INT32 y, textinput_t *input, INT32 flags, INT32 MAXINPUTWIDTH);
|
||||
|
||||
|
||||
@@ -30,7 +30,11 @@ typedef union
|
||||
typedef struct
|
||||
{
|
||||
msg_header_t header;
|
||||
#ifndef HAVE_IPV6
|
||||
char ip[16];
|
||||
#else
|
||||
char ip[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
|
||||
#endif
|
||||
char port[8];
|
||||
char contact[32];
|
||||
char version[8]; // format is: x.yy.z (like 1.30.2 or 1.31)
|
||||
|
||||
+2
-2
@@ -412,7 +412,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
|
||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
|
||||
ceiling->thinker.function = (actionf_p1)T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
ceiling->crush = false;
|
||||
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);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_CrushCeiling;
|
||||
ceiling->thinker.function = (actionf_p1)T_CrushCeiling;
|
||||
ceiling->sector = sec;
|
||||
ceiling->crush = true;
|
||||
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++)
|
||||
{
|
||||
if (!players[displayplayers[i]].mo || P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||
if (P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||
continue;
|
||||
|
||||
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;
|
||||
|
||||
// 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->crush = false; // default: types that crush will change this
|
||||
dofloor->sector = sec;
|
||||
@@ -2766,7 +2766,7 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
|
||||
P_AddThinker(&elevator->thinker);
|
||||
sec->floordata = elevator;
|
||||
sec->ceilingdata = elevator;
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_MoveElevator;
|
||||
elevator->thinker.function = (actionf_p1)T_MoveElevator;
|
||||
elevator->type = elevtype;
|
||||
elevator->sourceline = line;
|
||||
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);
|
||||
P_AddThinker(&bouncer->thinker);
|
||||
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
|
||||
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
|
||||
faller = Z_Calloc(sizeof (*faller), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&faller->thinker);
|
||||
faller->thinker.function.acp1 = (actionf_p1)T_ContinuousFalling;
|
||||
faller->thinker.function = (actionf_p1)T_ContinuousFalling;
|
||||
|
||||
// set up the fields
|
||||
faller->sector = sec;
|
||||
@@ -3044,7 +3044,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
|
||||
// create and initialize new elevator thinker
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_StartCrumble;
|
||||
elevator->thinker.function = (actionf_p1)T_StartCrumble;
|
||||
|
||||
// Does this crumbler return?
|
||||
if (crumblereturn)
|
||||
@@ -3123,7 +3123,7 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob
|
||||
P_AddThinker(&block->thinker);
|
||||
sec->floordata = block;
|
||||
sec->ceilingdata = block;
|
||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlock;
|
||||
block->thinker.function = (actionf_p1)T_MarioBlock;
|
||||
|
||||
// Set up the fields
|
||||
block->sector = sec;
|
||||
|
||||
+25
-22
@@ -473,7 +473,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
if (player->spectator)
|
||||
return;
|
||||
|
||||
if (special->tracer && !P_MobjWasRemoved(special->tracer) && toucher == special->tracer)
|
||||
if (!P_MobjWasRemoved(special->tracer) && toucher == special->tracer)
|
||||
{
|
||||
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->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_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);
|
||||
return;
|
||||
case MT_SMK_MOLE:
|
||||
if (special->target && !P_MobjWasRemoved(special->target))
|
||||
if (!P_MobjWasRemoved(special->target))
|
||||
return;
|
||||
|
||||
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;
|
||||
P_GivePlayerRings(player, 1);
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING)
|
||||
if (UNLIKELY((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING))
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
|
||||
@@ -599,7 +599,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
special->momx = special->momy = 0;
|
||||
P_GivePlayerRings(player, 1);
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN)
|
||||
if (UNLIKELY((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN))
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
case MT_BLUEBALL:
|
||||
@@ -615,7 +615,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
else
|
||||
special->scalespeed = 4*FRACUNIT/5;
|
||||
|
||||
if (maptol & TOL_NIGHTS)
|
||||
if (UNLIKELY(maptol & TOL_NIGHTS))
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
case MT_AUTOPICKUP:
|
||||
@@ -832,6 +832,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
if (player->bumpertime < TICRATE/4)
|
||||
{
|
||||
S_StartSound(toucher, special->info->seesound);
|
||||
|
||||
if (player->pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
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
|
||||
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;
|
||||
|
||||
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
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
|
||||
return;
|
||||
if (maptol & TOL_NIGHTS)
|
||||
if (UNLIKELY(maptol & TOL_NIGHTS))
|
||||
return;
|
||||
if (mariomode)
|
||||
if (UNLIKELY(mariomode))
|
||||
return;
|
||||
else if (toucher->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
@@ -1542,15 +1543,17 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (target->target->hnext)
|
||||
K_KillBananaChain(target->target->hnext, inflictor, source);
|
||||
|
||||
target->target->player->kartstuff[k_itemamount] = 0;
|
||||
}
|
||||
else if (target->target->player->kartstuff[k_itemamount])
|
||||
else
|
||||
target->target->player->kartstuff[k_itemamount]--;
|
||||
}
|
||||
else if ((target->type == MT_ORBINAUT_SHIELD && target->target->player->kartstuff[k_itemtype] == KITEM_ORBINAUT) // orbit items
|
||||
|| (target->type == MT_JAWZ_SHIELD && target->target->player->kartstuff[k_itemtype] == KITEM_JAWZ))
|
||||
{
|
||||
target->target->player->kartstuff[k_itemamount]--;
|
||||
|
||||
if (target->lastlook != 0)
|
||||
{
|
||||
K_RepairOrbitChain(target);
|
||||
@@ -1763,7 +1766,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
case MT_SMK_ICEBLOCK:
|
||||
{
|
||||
mobj_t *cur = target->hnext;
|
||||
while (cur && !P_MobjWasRemoved(cur))
|
||||
while (!P_MobjWasRemoved(cur))
|
||||
{
|
||||
P_SetMobjState(cur, S_SMK_ICEBLOCK2);
|
||||
cur = cur->hnext;
|
||||
@@ -1814,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
|
||||
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;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
@@ -1836,14 +1839,14 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
// kill tracer
|
||||
if (target->type == MT_FROGGER)
|
||||
{
|
||||
if (target->tracer && !P_MobjWasRemoved(target->tracer))
|
||||
if (!P_MobjWasRemoved(target->tracer))
|
||||
P_KillMobj(target->tracer, inflictor, source);
|
||||
}
|
||||
|
||||
if (target->type == MT_FROGGER || target->type == MT_ROBRA_HEAD || target->type == MT_BLUEROBRA_HEAD) // clean hnext list
|
||||
{
|
||||
mobj_t *cur = target->hnext;
|
||||
while (cur && !P_MobjWasRemoved(cur))
|
||||
while (!P_MobjWasRemoved(cur))
|
||||
{
|
||||
P_KillMobj(cur, inflictor, source);
|
||||
cur = cur->hnext;
|
||||
@@ -2350,11 +2353,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (player->exiting)
|
||||
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;
|
||||
}
|
||||
|
||||
if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling
|
||||
if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) // NiGHTS damage handling
|
||||
{
|
||||
if (!force)
|
||||
{
|
||||
@@ -2599,7 +2602,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale);
|
||||
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);
|
||||
|
||||
P_SetObjectMomZ(mo, 8*FRACUNIT, false);
|
||||
@@ -2623,7 +2626,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
ns = FixedMul(momxy, mo->scale);
|
||||
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);
|
||||
|
||||
ns = momz;
|
||||
@@ -2730,7 +2733,7 @@ void P_PlayerWeaponPanelBurst(player_t *player)
|
||||
ns = FixedMul(3*FRACUNIT, mo->scale);
|
||||
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);
|
||||
|
||||
P_SetObjectMomZ(mo, 4*FRACUNIT, false);
|
||||
@@ -2814,7 +2817,7 @@ void P_PlayerWeaponAmmoBurst(player_t *player)
|
||||
ns = FixedMul(2*FRACUNIT, mo->scale);
|
||||
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);
|
||||
|
||||
P_SetObjectMomZ(mo, 3*FRACUNIT, false);
|
||||
@@ -2930,7 +2933,7 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss)
|
||||
|
||||
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);
|
||||
else
|
||||
momy = 0;
|
||||
@@ -2987,7 +2990,7 @@ void P_PlayerFlagBurst(player_t *player, boolean toss)
|
||||
{
|
||||
angle_t fa = P_RandomByte()*FINEANGLES/256;
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -78,7 +78,7 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxse
|
||||
|
||||
P_AddThinker(&flick->thinker);
|
||||
|
||||
flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
||||
flick->thinker.function = (actionf_p1)T_FireFlicker;
|
||||
flick->sector = maxsector;
|
||||
flick->maxlight = maxsector->lightlevel;
|
||||
flick->minlight = minsector->lightlevel;
|
||||
@@ -140,7 +140,7 @@ void P_SpawnLightningFlash(sector_t *sector)
|
||||
|
||||
if (sector->lightingdata)
|
||||
{
|
||||
if (((lightflash_t *)sector->lightingdata)->thinker.function.acp1
|
||||
if (((lightflash_t *)sector->lightingdata)->thinker.function
|
||||
== (actionf_p1)T_LightningFlash)
|
||||
{
|
||||
// lightning was already flashing in this sector
|
||||
@@ -157,7 +157,7 @@ void P_SpawnLightningFlash(sector_t *sector)
|
||||
|
||||
P_AddThinker(&flash->thinker);
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LightningFlash;
|
||||
flash->thinker.function = (actionf_p1)T_LightningFlash;
|
||||
flash->sector = sector;
|
||||
flash->maxlight = 255;
|
||||
flash->minlight = minlight;
|
||||
@@ -219,7 +219,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector,
|
||||
flash->sector = maxsector;
|
||||
flash->darktime = darktime;
|
||||
flash->brighttime = brighttime;
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
|
||||
flash->thinker.function = (actionf_p1)T_StrobeFlash;
|
||||
flash->maxlight = maxsector->lightlevel;
|
||||
flash->minlight = minsector->lightlevel;
|
||||
|
||||
@@ -301,7 +301,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector,
|
||||
g->minlight = g->maxlight;
|
||||
g->maxlight = oops;
|
||||
}
|
||||
g->thinker.function.acp1 = (actionf_p1)T_Glow;
|
||||
g->thinker.function = (actionf_p1)T_Glow;
|
||||
g->direction = 1;
|
||||
g->speed = length/4;
|
||||
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
|
||||
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
|
||||
|
||||
P_AddThinker(&ll->thinker); // add thinker
|
||||
|
||||
+9
-3
@@ -128,6 +128,9 @@ typedef struct camera_s
|
||||
// SRB2Kart: camera pans while drifting
|
||||
fixed_t pan;
|
||||
|
||||
// SRB2Kart: camera pitches on slopes
|
||||
angle_t pitch;
|
||||
|
||||
// postproccess effects
|
||||
UINT8 postimg;
|
||||
} camera_t;
|
||||
@@ -144,9 +147,11 @@ enum
|
||||
|
||||
extern camera_t camera[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_dist[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_height[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_pitch[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_lookbackmom[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_timeover[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
@@ -158,7 +163,7 @@ extern consvar_t cv_tiltsmoothing;
|
||||
|
||||
extern consvar_t cv_actionmovie;
|
||||
|
||||
extern consvar_t cv_lookbackmom[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_screenquake;
|
||||
|
||||
extern consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
@@ -178,6 +183,7 @@ void P_CalcChasePostImg(player_t *player, camera_t *thiscam);
|
||||
boolean P_PlayerInPain(player_t *player);
|
||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void P_ResetPlayer(player_t *player);
|
||||
player_t *P_GetLocalPlayerForNum(UINT8 pnum);
|
||||
boolean P_IsLocalPlayer(const player_t *player);
|
||||
boolean P_IsDisplayPlayer(const player_t *player);
|
||||
|
||||
@@ -277,7 +283,7 @@ void P_SceneryThinker(mobj_t *mobj);
|
||||
// To test it in Lua, check mobj.valid
|
||||
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);
|
||||
|
||||
+46
-44
@@ -140,7 +140,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||
if (object->player && object->player->spectator)
|
||||
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?*/
|
||||
return false;
|
||||
@@ -321,7 +321,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
return true;
|
||||
|
||||
// Ignore... things.
|
||||
if (!tmthing || !thing || P_MobjWasRemoved(thing))
|
||||
if (!tmthing || P_MobjWasRemoved(thing))
|
||||
return true;
|
||||
|
||||
I_Assert(!P_MobjWasRemoved(tmthing));
|
||||
@@ -335,7 +335,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
#ifdef SEENAMES
|
||||
// Do name checks all the way up here
|
||||
// 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.
|
||||
// (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;
|
||||
|
||||
// Don't collide with your buddies while NiGHTS-flying.
|
||||
if (tmthing->player && thing->player && (maptol & TOL_NIGHTS)
|
||||
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE)))
|
||||
if (UNLIKELY(tmthing->player && thing->player && (maptol & TOL_NIGHTS)
|
||||
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE))))
|
||||
return true;
|
||||
|
||||
blockdist = thing->radius + tmthing->radius;
|
||||
@@ -1691,7 +1691,7 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
{
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
subsector_t *newsubsec;
|
||||
sector_t *newsec;
|
||||
boolean blockval = true;
|
||||
|
||||
ps_checkposition_calls.value.i++;
|
||||
@@ -1714,9 +1714,9 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tmbbox[BOXLEFT] = x - tmthing->radius;
|
||||
|
||||
if (thing->x != x || thing->y != y || thing->subsector == NULL)
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
newsec = R_PointInSubsector(x, y)->sector;
|
||||
else
|
||||
newsubsec = thing->subsector;
|
||||
newsec = thing->subsector->sector;
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
@@ -1724,33 +1724,34 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
// that contains the point.
|
||||
// Any contacted lines the step closer together
|
||||
// will adjust them.
|
||||
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight;
|
||||
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
|
||||
tmfloorslope = newsubsec->sector->f_slope;
|
||||
tmceilingslope = newsubsec->sector->c_slope;
|
||||
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsec, x, y, NULL); //newsec->floorheight;
|
||||
tmceilingz = P_GetCeilingZ(thing, newsec, x, y, NULL); //newsec->ceilingheight;
|
||||
tmfloorslope = newsec->f_slope;
|
||||
tmceilingslope = newsec->c_slope;
|
||||
|
||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||
if (newsubsec->sector->ffloors)
|
||||
if (newsec->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t delta1, delta2;
|
||||
INT32 thingtop = thing->z + thing->height;
|
||||
|
||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||
for (rover = newsec->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t topheight, bottomheight, midheight;
|
||||
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||
topheight = P_GetFOFTopZ(thing, newsec, rover, x, y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(thing, newsec, rover, x, y, NULL);
|
||||
|
||||
if ((rover->flags & (FF_SWIMMABLE|FF_GOOWATER)) == (FF_SWIMMABLE|FF_GOOWATER) && !(thing->flags & MF_NOGRAVITY))
|
||||
{
|
||||
// If you're inside goowater and slowing down
|
||||
fixed_t sinklevel = FixedMul(thing->info->height/6, thing->scale);
|
||||
fixed_t minspeed = FixedMul(thing->info->height/9, thing->scale);
|
||||
|
||||
if (thing->z < topheight && bottomheight < thingtop
|
||||
&& abs(thing->momz) < minspeed)
|
||||
{
|
||||
@@ -1984,7 +1985,7 @@ void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fix
|
||||
boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
subsector_t *newsubsec;
|
||||
sector_t *newsec;
|
||||
|
||||
tmx = x;
|
||||
tmy = y;
|
||||
@@ -1995,15 +1996,15 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
tmbbox[BOXLEFT] = x - thiscam->radius;
|
||||
|
||||
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
newsec = R_PointInSubsectorFast(x, y)->sector;
|
||||
else
|
||||
newsubsec = thiscam->subsector;
|
||||
newsec = thiscam->subsector->sector;
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
mapcampointer = thiscam;
|
||||
|
||||
if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12)
|
||||
if (UNLIKELY(GETSECSPECIAL(newsec->special, 4) == 12))
|
||||
{ // Camera noclip on entire sector.
|
||||
tmfloorz = tmdropoffz = thiscam->z;
|
||||
tmceilingz = tmdrpoffceilz = thiscam->z + thiscam->height;
|
||||
@@ -2014,45 +2015,47 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
// that contains the point.
|
||||
// Any contacted lines the step closer together
|
||||
// will adjust them.
|
||||
tmfloorz = tmdropoffz = P_CameraGetFloorZ(thiscam, newsubsec->sector, x, y, NULL);
|
||||
tmfloorz = tmdropoffz = P_CameraGetFloorZ(thiscam, newsec, x, y, NULL);
|
||||
|
||||
tmceilingz = P_CameraGetCeilingZ(thiscam, newsubsec->sector, x, y, NULL);
|
||||
tmceilingz = P_CameraGetCeilingZ(thiscam, newsec, x, y, NULL);
|
||||
|
||||
// Cameras use the heightsec's heights rather then the actual sector heights.
|
||||
// If you can see through it, why not move the camera through it too?
|
||||
if (newsubsec->sector->heightsec >= 0)
|
||||
if (newsec->heightsec >= 0)
|
||||
{
|
||||
tmfloorz = tmdropoffz = sectors[newsubsec->sector->heightsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->heightsec].ceilingheight;
|
||||
tmfloorz = tmdropoffz = sectors[newsec->heightsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsec->heightsec].ceilingheight;
|
||||
}
|
||||
|
||||
// Use preset camera clipping heights if set with Sector Special Parameters whose control sector has Camera Intangible special -Red
|
||||
if (newsubsec->sector->camsec >= 0)
|
||||
if (newsec->camsec >= 0)
|
||||
{
|
||||
tmfloorz = tmdropoffz = sectors[newsubsec->sector->camsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->camsec].ceilingheight;
|
||||
tmfloorz = tmdropoffz = sectors[newsec->camsec].floorheight;
|
||||
tmceilingz = tmdrpoffceilz = sectors[newsec->camsec].ceilingheight;
|
||||
}
|
||||
|
||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||
if (newsubsec->sector->ffloors)
|
||||
if (newsec->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t delta1, delta2;
|
||||
INT32 thingtop = thiscam->z + thiscam->height;
|
||||
|
||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||
for (rover = newsec->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
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;
|
||||
|
||||
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL);
|
||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL);
|
||||
topheight = P_CameraGetFOFTopZ(thiscam, newsec, rover, x, y, NULL);
|
||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsec, rover, x, y, NULL);
|
||||
|
||||
delta1 = thiscam->z - (bottomheight
|
||||
+ ((topheight - bottomheight)/2));
|
||||
delta2 = thingtop - (bottomheight
|
||||
+ ((topheight - bottomheight)/2));
|
||||
|
||||
if (topheight > tmfloorz && abs(delta1) < abs(delta2))
|
||||
{
|
||||
tmfloorz = tmdropoffz = topheight;
|
||||
@@ -2117,7 +2120,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
// We're inside it! Yess...
|
||||
polysec = po->lines[0]->backsector;
|
||||
|
||||
if (GETSECSPECIAL(polysec->special, 4) == 12)
|
||||
if (UNLIKELY(GETSECSPECIAL(polysec->special, 4) == 12))
|
||||
{ // Camera noclip polyobj.
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
continue;
|
||||
@@ -2171,8 +2174,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
subsector_t *s;
|
||||
|
||||
boolean retval = true;
|
||||
UINT8 i;
|
||||
|
||||
floatok = false;
|
||||
@@ -2181,7 +2182,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
return false;
|
||||
|
||||
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
||||
s = R_PointInSubsector(x, y);
|
||||
s = R_PointInSubsectorFast(x, y);
|
||||
else
|
||||
s = thiscam->subsector;
|
||||
|
||||
@@ -2222,12 +2223,12 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
else
|
||||
tryy = y;
|
||||
|
||||
if (!P_CheckCameraPosition(tryx, tryy, thiscam))
|
||||
return false; // solid wall or thing
|
||||
|
||||
if (tmceilingz - tmfloorz < thiscam->height)
|
||||
return false; // doesn't fit
|
||||
|
||||
if (!P_CheckCameraPosition(tryx, tryy, thiscam))
|
||||
return false; // solid wall or thing
|
||||
|
||||
floatok = true;
|
||||
|
||||
if (tmceilingz - thiscam->z < thiscam->height)
|
||||
@@ -2248,7 +2249,8 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
|
||||
if ((tmfloorz - thiscam->z > MAXCAMERASTEPMOVE))
|
||||
return false; // too big a step up
|
||||
} while(tryx != x || tryy != y);
|
||||
|
||||
} while (tryx != x || tryy != y);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2265,7 +2267,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = s;
|
||||
|
||||
return retval;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3181,7 +3183,7 @@ stairstep:
|
||||
|
||||
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;
|
||||
tmymove = 0;
|
||||
@@ -3624,7 +3626,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||
|
||||
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;
|
||||
|
||||
crumbler = (elevator_t *)think;
|
||||
|
||||
+3
-3
@@ -366,7 +366,7 @@ void P_CameraLineOpening(line_t *linedef)
|
||||
{
|
||||
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;
|
||||
|
||||
topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef);
|
||||
@@ -394,7 +394,7 @@ void P_CameraLineOpening(line_t *linedef)
|
||||
{
|
||||
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;
|
||||
|
||||
topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef);
|
||||
@@ -908,7 +908,7 @@ void P_SetUnderlayPosition(mobj_t *thing)
|
||||
|
||||
void P_SetPrecipitationThingPosition(precipmobj_t *thing)
|
||||
{
|
||||
thing->subsector = R_PointInSubsector(thing->x, thing->y);
|
||||
thing->subsector = R_PointInSubsectorFast(thing->x, thing->y);
|
||||
|
||||
// NOTE: this works because bnext/bprev are at the same
|
||||
// offsets in precipmobj_t and mobj_t
|
||||
|
||||
Loaded 100 of 146 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user