Compare commits
424
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fdc829686 | ||
|
|
f2b9077f5a | ||
|
|
cd4bdde67c | ||
|
|
de94ad24a5 | ||
|
|
6d01ec4c55 | ||
|
|
f72c64d7d1 | ||
|
|
92a3e974b0 | ||
|
|
7d6cce5881 | ||
|
|
bb3f9b5882 | ||
|
|
27d6447a83 | ||
|
|
20044fa6a7 | ||
|
|
26480882c8 | ||
|
|
b23020435f | ||
|
|
267e2be69b | ||
|
|
b9428360c0 | ||
|
|
2112be8ef7 | ||
|
|
44288a5865 | ||
|
|
66f89fb4ad | ||
|
|
eceb671ea8 | ||
|
|
a15615a229 | ||
|
|
8e10bcc739 | ||
|
|
22e65cd5e7 | ||
|
|
72383520cb | ||
|
|
38ef55b869 | ||
|
|
649373ff51 | ||
|
|
ca09a5dd46 | ||
|
|
11546cd906 | ||
|
|
4110130ca7 | ||
|
|
6b9900ad4e | ||
|
|
97e6222176 | ||
|
|
3d39f50388 | ||
|
|
eef56a7c82 | ||
|
|
8853666645 | ||
|
|
a379764076 | ||
|
|
edd1cc6059 | ||
|
|
f355b2269c | ||
|
|
03280db377 | ||
|
|
86aeff5547 | ||
|
|
b5b2062efa | ||
|
|
b51731d675 | ||
|
|
229e8d9592 | ||
|
|
da9c19bba4 | ||
|
|
3156851554 | ||
|
|
a19cb5f2bc | ||
|
|
2639f94dff | ||
|
|
2c769f8043 | ||
|
|
332f7db32f | ||
|
|
3381f6af3a | ||
|
|
45d33b951c | ||
|
|
1922b32799 | ||
|
|
6bb72c363f | ||
|
|
378382f3ad | ||
|
|
7e09493cf2 | ||
|
|
126fce9119 | ||
|
|
0b5879ffb3 | ||
|
|
0bd2c6220d | ||
|
|
a434ce2080 | ||
|
|
c8193380e7 | ||
|
|
e38580c9c2 | ||
|
|
c46ff7daff | ||
|
|
4418653edb | ||
|
|
1d9bcaa786 | ||
|
|
27bfd0078c | ||
|
|
67a75730d0 | ||
|
|
d12369f6f4 | ||
|
|
4a7ce87ac2 | ||
|
|
d8b36ef0da | ||
|
|
1341ec80bf | ||
|
|
9882291828 | ||
|
|
aa4fa1e42e | ||
|
|
8a641d3e37 | ||
|
|
317f5f8d48 | ||
|
|
92c0ddd068 | ||
|
|
4f037896db | ||
|
|
494a87feea | ||
|
|
4a3af6bc8a | ||
|
|
0c7851bd26 | ||
|
|
5b46ae2eb9 | ||
|
|
2034eedbe4 | ||
|
|
fde4f64b83 | ||
|
|
404927c53c | ||
|
|
e0796b0cf1 | ||
|
|
8df8749a9c | ||
|
|
1c2fb14f45 | ||
|
|
82f70ff75e | ||
|
|
46b2d5fbcd | ||
|
|
23b2e35dbd | ||
|
|
a576ddf0e4 | ||
|
|
df63b3ece0 | ||
|
|
52cd614613 | ||
|
|
db04046cb3 | ||
|
|
5ec48f72e0 | ||
|
|
7a1c6bd9e4 | ||
|
|
75af036fcf | ||
|
|
accc9890df | ||
|
|
cb97973b1c | ||
|
|
331f09cdd9 | ||
|
|
939084d57b | ||
|
|
1cbfc71fc6 | ||
|
|
7b550200f0 | ||
|
|
665a11fa2b | ||
|
|
1a49b161cc | ||
|
|
99e4870a52 | ||
|
|
13ad27bc90 | ||
|
|
7ae361cb7c | ||
|
|
0e1bfbb0b5 | ||
|
|
3dec352245 | ||
|
|
8e273a1f19 | ||
|
|
1ab20814e9 | ||
|
|
37649a0d3c | ||
|
|
f3d1bf1106 | ||
|
|
93311c628e | ||
|
|
f8dfc954a0 | ||
|
|
dbe5f8a4ba | ||
|
|
a05c38b1fe | ||
|
|
91b6143f15 | ||
|
|
0eaedd4b5e | ||
|
|
727a31fdb5 | ||
|
|
3b64263dc6 | ||
|
|
83b6a63f13 | ||
|
|
f6f6600118 | ||
|
|
04c0bf2f17 | ||
|
|
4da9c5ac07 | ||
|
|
97cae4de59 | ||
|
|
74088c1d26 | ||
|
|
b03e74c366 | ||
|
|
cd9ee7d139 | ||
|
|
3080f2953d | ||
|
|
f7c7dae3a5 | ||
|
|
3f16f42adf | ||
|
|
7b2e763d07 | ||
|
|
c1b771fdc8 | ||
|
|
e5b12ece35 | ||
|
|
43c99f8851 | ||
|
|
7304988071 | ||
|
|
d0b0a7490a | ||
|
|
de4bcec782 | ||
|
|
0e843c2a96 | ||
|
|
9abd34baa3 | ||
|
|
4fca31049f | ||
|
|
13f6b62dc0 | ||
|
|
3a5b282b9b | ||
|
|
d763456655 | ||
|
|
b23fa084f1 | ||
|
|
216acf083a | ||
|
|
686a9f7237 | ||
|
|
5a206822c5 | ||
|
|
9805b03533 | ||
|
|
d519f9cf06 | ||
|
|
6265d0e38e | ||
|
|
55d9d64910 | ||
|
|
e2a651e553 | ||
|
|
e4343f0935 | ||
|
|
68090a55e1 | ||
|
|
00bdd684ed | ||
|
|
f4e498e559 | ||
|
|
39c33b1f59 | ||
|
|
55acbb208e | ||
|
|
208f96535e | ||
|
|
64bda53a78 | ||
|
|
e016777331 | ||
|
|
508cab4a0d | ||
|
|
b779be3574 | ||
|
|
fddcebc2d2 | ||
|
|
91c5dc3c19 | ||
|
|
9401eb1591 | ||
|
|
521bb88cda | ||
|
|
c1765258b2 | ||
|
|
6afcb06e08 | ||
|
|
1ae5bb9d27 | ||
|
|
252cd5cde5 | ||
|
|
12558740a4 | ||
|
|
e1fbe8d657 | ||
|
|
b29a3ecfba | ||
|
|
bd3a5ac284 | ||
|
|
7de8b2d881 | ||
|
|
3139dff6ba | ||
|
|
c4211045f2 | ||
|
|
6633dfe1e2 | ||
|
|
9e2a48cae1 | ||
|
|
43f8a0213a | ||
|
|
975978ca9c | ||
|
|
dad630f3eb | ||
|
|
11f8b974df | ||
|
|
00773a0c10 | ||
|
|
6f6066906e | ||
|
|
7730b69ef4 | ||
|
|
e3084cc28e | ||
|
|
b784fc58d0 | ||
|
|
8baa972bb2 | ||
|
|
3b2251017c | ||
|
|
f0e7dace72 | ||
|
|
4a837d3339 | ||
|
|
a2aa43e7fc | ||
|
|
3c0899263f | ||
|
|
91bb601ecb | ||
|
|
1bd0c5d9bf | ||
|
|
8b76426825 | ||
|
|
85464921ba | ||
|
|
9b6034853f | ||
|
|
0ab732c9b2 | ||
|
|
8662648ef5 | ||
|
|
51808b8ced | ||
|
|
2a7e442544 | ||
|
|
dbdd5b8b6e | ||
|
|
b8483376c4 | ||
|
|
70105ccefc | ||
|
|
3a9082a694 | ||
|
|
82c18be717 | ||
|
|
0d39c2a0f6 | ||
|
|
4240af23cf | ||
|
|
80697046d5 | ||
|
|
765dd72b38 | ||
|
|
403b60240f | ||
|
|
f973e6cd72 | ||
|
|
5aff1acea8 | ||
|
|
9e07ca0007 | ||
|
|
df97bef4b5 | ||
|
|
b402738428 | ||
|
|
2de9a6bb94 | ||
|
|
fb0c88cf55 | ||
|
|
1f6096e3ff | ||
|
|
a4e6b5d177 | ||
|
|
4477f5ab93 | ||
|
|
11992d2e08 | ||
|
|
802979b81d | ||
|
|
06d0f5b95b | ||
|
|
da06c84aa4 | ||
|
|
ecae607b59 | ||
|
|
f26717954e | ||
|
|
a4080980ec | ||
|
|
3db21bf778 | ||
|
|
66518ced75 | ||
|
|
5598526f52 | ||
|
|
14ec6e0674 | ||
|
|
549112822a | ||
|
|
e1cb858d9a | ||
|
|
1659c2e753 | ||
|
|
e2222f66a9 | ||
|
|
8a15b5e640 | ||
|
|
f499b11113 | ||
|
|
bec632800d | ||
|
|
a14c2f59b8 | ||
|
|
e66d215dd3 | ||
|
|
809ae20558 | ||
|
|
7b26ecb5f5 | ||
|
|
0c2ccc56cd | ||
|
|
525681b5a5 | ||
|
|
c9a3dfcac9 | ||
|
|
a05aab1c7b | ||
|
|
7dfc638305 | ||
|
|
3585969285 | ||
|
|
3361ebe3c5 | ||
|
|
ebfd7f3e4e | ||
|
|
e2c8a773be | ||
|
|
6816c6dd19 | ||
|
|
b9e26a7e2f | ||
|
|
38abb4c9e4 | ||
|
|
fc469d6433 | ||
|
|
52f1d727c0 | ||
|
|
80a29dc5a1 | ||
|
|
f4703be2ca | ||
|
|
7c78cf067c | ||
|
|
54cbfbe699 | ||
|
|
05f454157f | ||
|
|
c451f0f1a6 | ||
|
|
35b85bec36 | ||
|
|
b0c64be31d | ||
|
|
d09a28e3da | ||
|
|
550c66b25b | ||
|
|
dfec9e24f3 | ||
|
|
2350889445 | ||
|
|
990854e176 | ||
|
|
8c727b979c | ||
|
|
60de48ad65 | ||
|
|
2fd1abce5c | ||
|
|
691a61de72 | ||
|
|
3a153c3abe | ||
|
|
d22645e56a | ||
|
|
08fe3beef1 | ||
|
|
2c54c92e14 | ||
|
|
c127cd9016 | ||
|
|
9cb790ac23 | ||
|
|
c2c7381bc1 | ||
|
|
1e4eeb2bcf | ||
|
|
b1f99f8d2f | ||
|
|
f752da7d03 | ||
|
|
7ddcf6d0d4 | ||
|
|
b21776183e | ||
|
|
9c0dcac5c6 | ||
|
|
1b75d8b8e2 | ||
|
|
145e305494 | ||
|
|
8f4d185ea6 | ||
|
|
4b5ff6be5d | ||
|
|
d27ef85b9e | ||
|
|
1ac210c2fc | ||
|
|
878b7f4b43 | ||
|
|
7cbac66935 | ||
|
|
7e09223e6e | ||
|
|
b4e1be5bee | ||
|
|
d3e5e236ac | ||
|
|
238ce98c44 | ||
|
|
2824e5d850 | ||
|
|
cd154d5748 | ||
|
|
c0a8153a10 | ||
|
|
3433fc7651 | ||
|
|
22d1ee8f60 | ||
|
|
5155958ade | ||
|
|
5fdd486bab | ||
|
|
4672037bcd | ||
|
|
2281b82b5a | ||
|
|
3fe096c7d4 | ||
|
|
dd3ca0e161 | ||
|
|
d8da78f900 | ||
|
|
9325e7be8f | ||
|
|
f3f94bf80e | ||
|
|
506dc2455a | ||
|
|
94d6ee15b5 | ||
|
|
2d918d32a1 | ||
|
|
dd516b573b | ||
|
|
de9698efc8 | ||
|
|
14b026f04b | ||
|
|
9dd45440c0 | ||
|
|
c59e8387ca | ||
|
|
772ad9f04f | ||
|
|
6053c2c619 | ||
|
|
a515b133c5 | ||
|
|
240dae9a1a | ||
|
|
b8a703233a | ||
|
|
bf44c95d00 | ||
|
|
c3dd1755dc | ||
|
|
b6e766ee44 | ||
|
|
5437040b78 | ||
|
|
c786569981 | ||
|
|
7064b14539 | ||
|
|
f275ae98f5 | ||
|
|
ef07d89e29 | ||
|
|
b9bbd45e15 | ||
|
|
2bda27b80d | ||
|
|
6ebf90cc50 | ||
|
|
ea00bebb04 | ||
|
|
b862d835a5 | ||
|
|
d6602747ae | ||
|
|
9f79429d03 | ||
|
|
5ff0c09868 | ||
|
|
ad1c3e63a4 | ||
|
|
24dd6ba675 | ||
|
|
85f036a45b | ||
|
|
6f8342b9a8 | ||
|
|
c5c6f6b820 | ||
|
|
3d472c34a1 | ||
|
|
63ca366bd8 | ||
|
|
e9e888ab7f | ||
|
|
5ea55b3e3a | ||
|
|
8b1797927a | ||
|
|
05a98964fb | ||
|
|
8cbf798de8 | ||
|
|
9314a24cb2 | ||
|
|
19b1683e61 | ||
|
|
d029107e75 | ||
|
|
bc97e0b703 | ||
|
|
f47c663f79 | ||
|
|
6f9d41eadb | ||
|
|
1b512edc56 | ||
|
|
884a6da2bd | ||
|
|
7a3d958fc1 | ||
|
|
7223581539 | ||
|
|
664bd2de3f | ||
|
|
63568e3861 | ||
|
|
f149d058a1 | ||
|
|
970251ced3 | ||
|
|
dba7a7dc3c | ||
|
|
393c0be407 | ||
|
|
5e9ea2429b | ||
|
|
81a14995da | ||
|
|
4267ac9a8d | ||
|
|
bcf72cc0e8 | ||
|
|
54d9a98090 | ||
|
|
86ea7dde40 | ||
|
|
81d415c5ba | ||
|
|
de1b801bda | ||
|
|
2c665fef6f | ||
|
|
c6fbf405bf | ||
|
|
7076c35521 | ||
|
|
86ed1b709e | ||
|
|
cb94235ac1 | ||
|
|
d0c50c49a7 | ||
|
|
7f1217b2ab | ||
|
|
3b01393a71 | ||
|
|
ef763487a5 | ||
|
|
03f5ac87fa | ||
|
|
b2cac97106 | ||
|
|
c3ce75055a | ||
|
|
90d64c4e15 | ||
|
|
595648a2b3 | ||
|
|
8e799ddd74 | ||
|
|
a754e9c08a | ||
|
|
112c9398e7 | ||
|
|
ccd691548e | ||
|
|
afd7b85005 | ||
|
|
f9e1cdb940 | ||
|
|
63fe657c7d | ||
|
|
63f649724e | ||
|
|
df10262ebb | ||
|
|
a87ac3e35e | ||
|
|
b71d9d2e68 | ||
|
|
cc44a5785d | ||
|
|
172d2bf545 | ||
|
|
7493b3d2ab | ||
|
|
31370741f2 | ||
|
|
e187f73044 | ||
|
|
3aa55ee9c3 | ||
|
|
8cfc8a5492 | ||
|
|
3f1c8db362 | ||
|
|
0d999d7a70 | ||
|
|
8bc081d937 | ||
|
|
42eb8d1af5 | ||
|
|
1a810bc923 | ||
|
|
065572ef64 | ||
|
|
e88702e10c | ||
|
|
ee2d934525 | ||
|
|
2a3a33226e | ||
|
|
539315710c | ||
|
|
191a6ca76f |
No files matched your search
+5
-1
@@ -134,6 +134,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
||||
r_sky.c
|
||||
r_splats.c
|
||||
r_things.c
|
||||
r_portal.c
|
||||
|
||||
r_bsp.h
|
||||
r_data.h
|
||||
@@ -149,6 +150,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
||||
r_splats.h
|
||||
r_state.h
|
||||
r_things.h
|
||||
r_portal.h
|
||||
)
|
||||
|
||||
set(SRB2_CORE_GAME_SOURCES
|
||||
@@ -470,6 +472,7 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
|
||||
@@ -484,9 +487,10 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
|
||||
|
||||
+8
-6
@@ -229,6 +229,7 @@ endif
|
||||
|
||||
ifdef LINUX
|
||||
UNIXCOMMON=1
|
||||
NOOBJDUMP=1
|
||||
ifndef NOGME
|
||||
HAVE_LIBGME=1
|
||||
endif
|
||||
@@ -293,11 +294,11 @@ ifdef NOHW
|
||||
else
|
||||
OPTS+=-DHWRENDER
|
||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.o\
|
||||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
|
||||
endif
|
||||
|
||||
OPTS += -DCOMPVERSION -fwrapv
|
||||
OPTS += -DCOMPVERSION
|
||||
|
||||
ifndef NONX86
|
||||
ifndef GCC29
|
||||
@@ -563,6 +564,7 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/r_splats.o \
|
||||
$(OBJDIR)/r_patch.o \
|
||||
$(OBJDIR)/r_things.o \
|
||||
$(OBJDIR)/r_portal.o \
|
||||
$(OBJDIR)/screen.o \
|
||||
$(OBJDIR)/v_video.o \
|
||||
$(OBJDIR)/s_sound.o \
|
||||
@@ -736,18 +738,18 @@ else
|
||||
ifdef SDL
|
||||
ifdef MINGW
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
else
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
|
||||
+372
-111
@@ -1,8 +1,10 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -26,43 +28,37 @@
|
||||
#endif
|
||||
|
||||
// For use if I do walls with outsides/insides
|
||||
static const UINT8 REDS = (8*16);
|
||||
static const UINT8 REDS = (2*16);
|
||||
static const UINT8 REDRANGE = 16;
|
||||
static const UINT8 GRAYS = (1*16);
|
||||
static const UINT8 GRAYSRANGE = 16;
|
||||
static const UINT8 BROWNS = (3*16);
|
||||
static const UINT8 YELLOWS = (7*16);
|
||||
static const UINT8 GREENS = (10*16);
|
||||
static const UINT8 BROWNS = (15*16);
|
||||
static const UINT8 YELLOWS = (5*16)+8;
|
||||
static const UINT8 GREENS = (6*16);
|
||||
static const UINT8 BLUES = (9*16);
|
||||
static const UINT8 DBLACK = 31;
|
||||
static const UINT8 DWHITE = 0;
|
||||
|
||||
static const UINT8 NOCLIMBREDS = 248;
|
||||
static const UINT8 NOCLIMBREDRANGE = 8;
|
||||
static const UINT8 NOCLIMBGRAYS = 204;
|
||||
static const UINT8 NOCLIMBBROWNS = (2*16);
|
||||
static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||
|
||||
// Automap colors
|
||||
#define BACKGROUND DBLACK
|
||||
#define WALLCOLORS (REDS + REDRANGE/2)
|
||||
#define WALLRANGE (REDRANGE/2)
|
||||
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
|
||||
#define NOCLIMBWALLRANGE (NOCLIMBREDRANGE/2)
|
||||
#define THOKWALLCOLORS REDS
|
||||
#define THOKWALLRANGE REDRANGE
|
||||
#define NOCLIMBTHOKWALLCOLORS NOCLIMBREDS
|
||||
#define NOCLIMBTHOKWALLRANGE NOCLIMBREDRANGE
|
||||
#define TSWALLCOLORS GRAYS
|
||||
#define TSWALLRANGE GRAYSRANGE
|
||||
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
|
||||
#define TSWALLCOLORS DWHITE
|
||||
#define TSFINISHLINE GRAYS
|
||||
#define TSFOFINFO (BLUES + 4)
|
||||
#define FDWALLCOLORS BROWNS
|
||||
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
|
||||
#define CDWALLCOLORS YELLOWS
|
||||
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
||||
#define THINGCOLORS GREENS
|
||||
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
|
||||
#define XHAIRCOLORS GRAYS
|
||||
|
||||
// Automap passes
|
||||
#define PASS_SOLID 1
|
||||
#define PASS_INTANGIBLE 2
|
||||
#define PASS_FOF 4
|
||||
|
||||
// controls
|
||||
#define AM_PANUPKEY KEY_UPARROW
|
||||
#define AM_PANDOWNKEY KEY_DOWNARROW
|
||||
@@ -110,11 +106,6 @@ typedef struct
|
||||
mpoint_t a, b;
|
||||
} mline_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t slp, islp;
|
||||
} islope_t;
|
||||
|
||||
//
|
||||
// The vector graphics for the automap.
|
||||
// A line drawing of the player pointing right,
|
||||
@@ -136,16 +127,14 @@ static const mline_t player_arrow[] = {
|
||||
#undef R
|
||||
#define NUMPLYRLINES (sizeof (player_arrow)/sizeof (mline_t))
|
||||
|
||||
#if 0
|
||||
#define R (FRACUNIT)
|
||||
static mline_t triangle_guy[] = {
|
||||
{ { (fixed_t)-.867f*R, (fixed_t)-.5f*R }, { (fixed_t) .867f*R, (fixed_t)-.5f*R } },
|
||||
{ { (fixed_t) .867f*R, (fixed_t)-.5f*R }, { (fixed_t) 0, (fixed_t) R } },
|
||||
{ { (fixed_t) 0, (fixed_t) R }, { (fixed_t)-.867f*R, (fixed_t)-.5f*R } }
|
||||
static const mline_t cross_mark[] =
|
||||
{
|
||||
{ { -R, 0 }, { R, 0} },
|
||||
{ { 0, -R }, { 0, R } },
|
||||
};
|
||||
#undef R
|
||||
#define NUMTRIANGLEGUYLINES (sizeof (triangle_guy)/sizeof (mline_t))
|
||||
#endif
|
||||
#define NUMCROSSMARKLINES (sizeof(cross_mark)/sizeof(mline_t))
|
||||
|
||||
#define R (FRACUNIT)
|
||||
static const mline_t thintriangle_guy[] = {
|
||||
@@ -162,10 +151,14 @@ static boolean draw_grid = false;
|
||||
boolean automapactive = false;
|
||||
boolean am_recalc = false; //added : 05-02-98 : true when screen size changes
|
||||
static boolean am_stopped = true;
|
||||
static boolean am_minigen = false;
|
||||
|
||||
static UINT8 *am_buf = NULL;
|
||||
|
||||
static INT32 f_x, f_y; // location of window on screen (always zero for both)
|
||||
static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively)
|
||||
|
||||
static boolean m_keydown[4]; // which window panning keys are being pressed down?
|
||||
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
|
||||
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
|
||||
static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
|
||||
@@ -205,12 +198,13 @@ static fixed_t scale_ftom;
|
||||
|
||||
static player_t *plr; // the player represented by an arrow
|
||||
|
||||
static INT32 followplayer = true; // specifies whether to follow the player around
|
||||
static boolean followplayer = true; // specifies whether to follow the player around
|
||||
|
||||
// function for drawing lines, depends on rendermode
|
||||
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
||||
static AMDRAWFLINEFUNC AM_drawFline;
|
||||
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc);
|
||||
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
|
||||
|
||||
static void AM_activateNewScale(void)
|
||||
@@ -340,22 +334,23 @@ static void AM_initVariables(void)
|
||||
old_m_h = m_h;
|
||||
}
|
||||
|
||||
//
|
||||
// Called when the screen size changes.
|
||||
//
|
||||
static void AM_FrameBufferInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
am_buf = screens[0];
|
||||
}
|
||||
|
||||
//
|
||||
// should be called at the start of every level
|
||||
// right now, i figure it out myself
|
||||
//
|
||||
static void AM_LevelInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
||||
if (scale_mtof > max_scale_mtof)
|
||||
@@ -377,7 +372,7 @@ void AM_Stop(void)
|
||||
*
|
||||
* \sa AM_Stop
|
||||
*/
|
||||
static inline void AM_Start(void)
|
||||
void AM_Start(void)
|
||||
{
|
||||
static INT32 lastlevel = -1;
|
||||
|
||||
@@ -386,8 +381,12 @@ static inline void AM_Start(void)
|
||||
am_stopped = false;
|
||||
if (lastlevel != gamemap || am_recalc) // screen size changed
|
||||
{
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
AM_FrameBufferInit();
|
||||
if (lastlevel != gamemap)
|
||||
{
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
}
|
||||
am_recalc = false;
|
||||
}
|
||||
AM_initVariables();
|
||||
@@ -413,6 +412,27 @@ static void AM_maxOutWindowScale(void)
|
||||
AM_activateNewScale();
|
||||
}
|
||||
|
||||
//
|
||||
// set window panning
|
||||
//
|
||||
static void AM_setWindowPanning(void)
|
||||
{
|
||||
// up and down
|
||||
if (m_keydown[2]) // pan up
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
else if (m_keydown[3]) // pan down
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.y = 0;
|
||||
// left and right
|
||||
if (m_keydown[0]) // pan right
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
else if (m_keydown[1]) // pan left
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.x = 0;
|
||||
}
|
||||
|
||||
/** Responds to user inputs in automap mode.
|
||||
*
|
||||
* \param ev Event to possibly respond to.
|
||||
@@ -445,35 +465,49 @@ boolean AM_Responder(event_t *ev)
|
||||
{
|
||||
case AM_PANRIGHTKEY: // pan right
|
||||
if (!followplayer)
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[0] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANLEFTKEY: // pan left
|
||||
if (!followplayer)
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[1] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANUPKEY: // pan up
|
||||
if (!followplayer)
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[2] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANDOWNKEY: // pan down
|
||||
if (!followplayer)
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[3] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_ZOOMOUTKEY: // zoom out
|
||||
mtof_zoommul = M_ZOOMOUT;
|
||||
ftom_zoommul = M_ZOOMIN;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_ZOOMINKEY: // zoom in
|
||||
mtof_zoommul = M_ZOOMIN;
|
||||
ftom_zoommul = M_ZOOMOUT;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_TOGGLEKEY:
|
||||
AM_Stop();
|
||||
@@ -487,6 +521,7 @@ boolean AM_Responder(event_t *ev)
|
||||
}
|
||||
else
|
||||
AM_restoreScaleAndLoc();
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_FOLLOWKEY:
|
||||
followplayer = !followplayer;
|
||||
@@ -506,14 +541,32 @@ boolean AM_Responder(event_t *ev)
|
||||
switch (ev->data1)
|
||||
{
|
||||
case AM_PANRIGHTKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[0] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANLEFTKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.x = 0;
|
||||
{
|
||||
m_keydown[1] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANUPKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[2] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANDOWNKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.y = 0;
|
||||
{
|
||||
m_keydown[3] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_ZOOMOUTKEY:
|
||||
case AM_ZOOMINKEY:
|
||||
@@ -714,6 +767,16 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
|
||||
}
|
||||
#undef DOOUTCODE
|
||||
|
||||
//
|
||||
// Draws a pixel.
|
||||
//
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
|
||||
{
|
||||
if (xx < 0 || yy < 0 || xx >= f_w || yy >= f_h)
|
||||
return; // off the screen
|
||||
am_buf[(yy*f_w) + xx] = cc;
|
||||
}
|
||||
|
||||
//
|
||||
// Classic Bresenham w/ whatever optimizations needed for speed
|
||||
//
|
||||
@@ -735,8 +798,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
|
||||
|
||||
dx = fl->b.x - fl->a.x;
|
||||
ax = 2 * (dx < 0 ? -dx : dx);
|
||||
sx = dx < 0 ? -1 : 1;
|
||||
@@ -753,7 +814,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d = ay - ax/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (x == fl->b.x)
|
||||
return;
|
||||
if (d >= 0)
|
||||
@@ -770,7 +831,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d = ax - ay/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (y == fl->b.y)
|
||||
return;
|
||||
if (d >= 0)
|
||||
@@ -782,8 +843,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d += ax;
|
||||
}
|
||||
}
|
||||
|
||||
#undef PUTDOT
|
||||
}
|
||||
|
||||
//
|
||||
@@ -805,17 +864,18 @@ static void AM_drawGrid(INT32 color)
|
||||
fixed_t x, y;
|
||||
fixed_t start, end;
|
||||
mline_t ml;
|
||||
fixed_t gridsize = (MAPBLOCKUNITS<<MAPBITS);
|
||||
|
||||
// Figure out start of vertical gridlines
|
||||
start = m_x;
|
||||
if ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS))
|
||||
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS));
|
||||
if ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize)
|
||||
start += gridsize - ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize);
|
||||
end = m_x + m_w;
|
||||
|
||||
// draw vertical gridlines
|
||||
ml.a.y = m_y;
|
||||
ml.b.y = m_y + m_h;
|
||||
for (x = start; x < end; x += (MAPBLOCKUNITS<<FRACBITS))
|
||||
for (x = start; x < end; x += gridsize)
|
||||
{
|
||||
ml.a.x = x;
|
||||
ml.b.x = x;
|
||||
@@ -824,14 +884,14 @@ static void AM_drawGrid(INT32 color)
|
||||
|
||||
// Figure out start of horizontal gridlines
|
||||
start = m_y;
|
||||
if ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS))
|
||||
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS));
|
||||
if ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize)
|
||||
start += gridsize - ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize);
|
||||
end = m_y + m_h;
|
||||
|
||||
// draw horizontal gridlines
|
||||
ml.a.x = m_x;
|
||||
ml.b.x = m_x + m_w;
|
||||
for (y = start; y < end; y += (MAPBLOCKUNITS<<FRACBITS))
|
||||
for (y = start; y < end; y += gridsize)
|
||||
{
|
||||
ml.a.y = y;
|
||||
ml.b.y = y;
|
||||
@@ -839,14 +899,63 @@ static void AM_drawGrid(INT32 color)
|
||||
}
|
||||
}
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
} else \
|
||||
end1 = end2 = (normalheight + FRACUNIT/2) >> FRACBITS;
|
||||
|
||||
static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondarystore)
|
||||
{
|
||||
ffloor_t *secondaryrover = NULL;
|
||||
for (; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t rovt1, rovt2;
|
||||
fixed_t rovb1, rovb2;
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
SLOPEPARAMS(*rover->t_slope, rovt1, rovt2, *rover->topheight)
|
||||
SLOPEPARAMS(*rover->b_slope, rovb1, rovb2, *rover->bottomheight)
|
||||
for (secondaryrover = secondarystore; secondaryrover; secondaryrover = secondaryrover->next)
|
||||
{
|
||||
fixed_t sect1, sect2;
|
||||
fixed_t secb1, secb2;
|
||||
if (!(secondaryrover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(secondaryrover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
if (secondaryrover->secnum == rover->secnum)
|
||||
break;
|
||||
SLOPEPARAMS(*secondaryrover->t_slope, sect1, sect2, *secondaryrover->topheight)
|
||||
SLOPEPARAMS(*secondaryrover->b_slope, secb1, secb2, *secondaryrover->bottomheight)
|
||||
if (rovt1 != sect1)
|
||||
continue;
|
||||
if (rovt2 != sect2)
|
||||
continue;
|
||||
if (rovb1 != secb1)
|
||||
continue;
|
||||
if (rovb2 != secb2)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (secondaryrover == NULL)
|
||||
break;
|
||||
}
|
||||
return rover;
|
||||
}
|
||||
|
||||
//
|
||||
// Determines visible lines, draws them.
|
||||
// This is LineDef based, not LineSeg based.
|
||||
//
|
||||
static inline void AM_drawWalls(void)
|
||||
static void AM_drawWalls(UINT8 pass)
|
||||
{
|
||||
size_t i;
|
||||
static mline_t l;
|
||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale)>>FRACBITS;
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
|
||||
|
||||
@@ -856,74 +965,143 @@ static inline void AM_drawWalls(void)
|
||||
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
|
||||
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
|
||||
} else \
|
||||
end1 = end2 = normalheight;
|
||||
|
||||
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
|
||||
if (lines[i].backsector) {
|
||||
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
}
|
||||
#undef SLOPEPARAMS
|
||||
|
||||
if (!lines[i].backsector) // 1-sided
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBWALLCOLORS);
|
||||
else
|
||||
if (!(pass & PASS_SOLID))
|
||||
;
|
||||
else if (frontf1 != frontc1 || frontf2 != frontc2 || lines[i].frontsector->f_slope)
|
||||
{
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
else if (!am_minigen)
|
||||
{
|
||||
AM_drawMline(&l, WALLCOLORS);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||
{
|
||||
if (backf1 == backc1 && backf2 == backc2
|
||||
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
else
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
if (!am_minigen && (pass & PASS_INTANGIBLE))
|
||||
{
|
||||
AM_drawMline(&l, GRIDCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (pass & PASS_SOLID)
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS);
|
||||
else
|
||||
AM_drawMline(&l, THOKWALLCOLORS);
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB) {
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||
//dont think kart even supports those idk?
|
||||
/*if (lines[i].flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // Completely solid course boundary
|
||||
}
|
||||
else if ((lines[i].flags & ML_MIDSOLID)
|
||||
&& sides[lines->sidenum[0]].midtexture)
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // solid midtexture, likely a course boundary
|
||||
}*/
|
||||
if ((backf1 != frontf1 && abs(backf1 - frontf1) > maxstep)
|
||||
|| (backf2 != frontf2 && abs(backf2 - frontf2) > maxstep))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // floor-wall, likely a course boundary
|
||||
}
|
||||
/*else if (lines[i].special == 2001) // guh its a sector effect in kart idk how to make it work tbh lol
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSFINISHLINE); // finish line
|
||||
}*/
|
||||
else if (backf1 != frontf1 || backf2 != frontf2)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floorlevel change
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2)
|
||||
{
|
||||
if (!(pass & PASS_INTANGIBLE))
|
||||
;
|
||||
else if (abs(backc1 - frontc1) < maxstep
|
||||
|| abs(backc2 - frontc2) < maxstep)
|
||||
{
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceilinglevel change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
{
|
||||
AM_drawMline(&l, GRIDCOLORS); // ceiling-wall, not likely to be a course boundary but flagged up just in case
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||
{
|
||||
ffloor_t *rover = NULL;
|
||||
|
||||
if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors)
|
||||
{
|
||||
if (lines[i].backsector->ffloors == NULL)
|
||||
{
|
||||
// Check frontside for one solid
|
||||
for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (lines[i].frontsector->ffloors == NULL)
|
||||
{
|
||||
// Check backside for one solid
|
||||
for (rover = lines[i].backsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check to see if any secnums exist in one but not the other.
|
||||
rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors);
|
||||
if (rover == NULL)
|
||||
rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors);
|
||||
}
|
||||
}
|
||||
if (rover != NULL)
|
||||
{
|
||||
if (pass & PASS_FOF)
|
||||
AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet
|
||||
}
|
||||
else if (!am_minigen)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line
|
||||
}
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef SLOPEPARAMS
|
||||
|
||||
//
|
||||
// Rotation in 2D.
|
||||
// Used to rotate player arrow line character.
|
||||
@@ -996,7 +1174,7 @@ static inline void AM_drawPlayers(void)
|
||||
|
||||
if (!multiplayer)
|
||||
{
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1191,7 @@ static inline void AM_drawPlayers(void)
|
||||
if (p->skincolor > 0)
|
||||
color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8];
|
||||
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1033,13 +1211,27 @@ static inline void AM_drawThings(UINT8 colors)
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws the crosshair, actually just a dot in software mode.
|
||||
/** Draws the crosshair.
|
||||
*
|
||||
* \param color Color for the crosshair.
|
||||
*/
|
||||
static inline void AM_drawCrosshair(UINT8 color)
|
||||
{
|
||||
V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART);
|
||||
const fixed_t scale = 4<<FRACBITS;
|
||||
size_t i;
|
||||
fline_t fl;
|
||||
for (i = 0; i < NUMCROSSMARKLINES; i++)
|
||||
{
|
||||
fl.a.x = FixedMul(cross_mark[i].a.x, scale) >> FRACBITS;
|
||||
fl.a.y = FixedMul(cross_mark[i].a.y, scale) >> FRACBITS;
|
||||
fl.b.x = FixedMul(cross_mark[i].b.x, scale) >> FRACBITS;
|
||||
fl.b.y = FixedMul(cross_mark[i].b.y, scale) >> FRACBITS;
|
||||
fl.a.x += f_x + (f_w / 2);
|
||||
fl.a.y += f_y + (f_h / 2);
|
||||
fl.b.x += f_x + (f_w / 2);
|
||||
fl.b.y += f_y + (f_h / 2);
|
||||
AM_drawFline(&fl, color);
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws the automap.
|
||||
@@ -1049,11 +1241,80 @@ void AM_Drawer(void)
|
||||
if (!automapactive)
|
||||
return;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_clearFB(BACKGROUND);
|
||||
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||
AM_drawWalls();
|
||||
AM_drawWalls(PASS_FOF|PASS_INTANGIBLE|PASS_SOLID);
|
||||
AM_drawPlayers();
|
||||
AM_drawThings(THINGCOLORS);
|
||||
|
||||
AM_drawCrosshair(XHAIRCOLORS);
|
||||
if (!followplayer) AM_drawCrosshair(XHAIRCOLORS);
|
||||
}
|
||||
|
||||
minigen_t *AM_MinimapGenerate(INT32 mul)
|
||||
{
|
||||
static minigen_t ret = {0};
|
||||
|
||||
if (automapactive)
|
||||
return NULL;
|
||||
|
||||
am_minigen = true;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft; // yes, even in GL
|
||||
|
||||
//AM_FrameBufferInit();
|
||||
f_x = f_y = 0;
|
||||
ret.w = f_w = minimapinfo.minimap_w * mul;
|
||||
ret.h = f_h = minimapinfo.minimap_h * mul;
|
||||
am_buf = ret.buf = NULL;
|
||||
|
||||
//AM_LevelInit();
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = min_scale_mtof - (min_scale_mtof/20);
|
||||
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
|
||||
|
||||
//AM_initVariables();
|
||||
f_oldloc.x = INT32_MAX;
|
||||
|
||||
m_paninc.x = m_paninc.y = 0;
|
||||
ftom_zoommul = FRACUNIT;
|
||||
mtof_zoommul = FRACUNIT;
|
||||
|
||||
m_w = FTOM(f_w);
|
||||
m_h = FTOM(f_h);
|
||||
|
||||
//AM_changeWindowLoc();
|
||||
m_x = min_x - FixedMul(m_w, FRACUNIT/40);
|
||||
m_y = min_y - FixedMul(m_h, FRACUNIT/40);
|
||||
m_x2 = m_x + m_w;
|
||||
m_y2 = m_y + m_h;
|
||||
|
||||
// for saving & restoring
|
||||
old_m_x = m_x;
|
||||
old_m_y = m_y;
|
||||
old_m_w = m_w;
|
||||
old_m_h = m_h;
|
||||
|
||||
am_buf = ret.buf = malloc((f_w*f_h));
|
||||
|
||||
if (ret.buf == NULL)
|
||||
return NULL;
|
||||
|
||||
//AM_clearFB(BACKGROUND);
|
||||
memset(am_buf, 0xff, (f_w*f_h));
|
||||
AM_drawWalls(PASS_FOF);
|
||||
AM_drawWalls(PASS_INTANGIBLE);
|
||||
AM_drawWalls(PASS_SOLID);
|
||||
|
||||
am_buf = NULL;
|
||||
am_recalc = true;
|
||||
|
||||
am_minigen = false;
|
||||
|
||||
return &ret;
|
||||
}
|
||||
+17
-8
@@ -1,8 +1,10 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -26,11 +28,6 @@ typedef struct
|
||||
fpoint_t a, b;
|
||||
} fline_t;
|
||||
|
||||
// Used by ST StatusBar stuff.
|
||||
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
|
||||
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
|
||||
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
|
||||
|
||||
extern boolean am_recalc; // true if screen size changes
|
||||
extern boolean automapactive; // In AutoMap mode?
|
||||
|
||||
@@ -43,7 +40,19 @@ void AM_Ticker(void);
|
||||
// Called by main loop, instead of view drawer if automap is active.
|
||||
void AM_Drawer(void);
|
||||
|
||||
// Enables the automap.
|
||||
void AM_Start(void);
|
||||
|
||||
// Called to force the automap to quit if the level is completed while it is up.
|
||||
void AM_Stop(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 w, h;
|
||||
UINT8 *buf;
|
||||
} minigen_t;
|
||||
|
||||
// Minimap generation
|
||||
minigen_t *AM_MinimapGenerate(INT32 mul);
|
||||
|
||||
#endif
|
||||
+2
-5
@@ -36,7 +36,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
||||
return;
|
||||
|
||||
// Lua can handle it!
|
||||
if (LUAh_BotAI(sonic, tails, cmd))
|
||||
if (LUA_HookBotAI(sonic, tails, cmd))
|
||||
return;
|
||||
|
||||
if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||
@@ -118,11 +118,8 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
return;
|
||||
}
|
||||
|
||||
// Bot AI isn't programmed in analog.
|
||||
//CV_SetValue(&cv_analog2, false);
|
||||
|
||||
// Let Lua scripts build ticcmds
|
||||
if (LUAh_BotTiccmd(player, cmd))
|
||||
if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
|
||||
return;
|
||||
|
||||
// We don't have any main character AI, sorry. D:
|
||||
|
||||
+28
-23
@@ -1,7 +1,7 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2024 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -11,6 +11,9 @@
|
||||
/// \brief Macros to read/write from/to a UINT8 *,
|
||||
/// used for packet creation and such
|
||||
|
||||
#ifndef __BYTEPTR_H__
|
||||
#define __BYTEPTR_H__
|
||||
|
||||
#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__)
|
||||
#define DEALIGNED
|
||||
#endif
|
||||
@@ -150,7 +153,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
|
||||
#undef DEALIGNED
|
||||
|
||||
#define WRITESTRINGN(p, s, n) ({ \
|
||||
#define WRITESTRINGN(p, s, n) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \
|
||||
@@ -158,70 +161,72 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
\
|
||||
if (tmp_i < n) \
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITESTRINGL(p, s, n) ({ \
|
||||
#define WRITESTRINGL(p, s, n) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
|
||||
WRITECHAR(p, s[tmp_i]); \
|
||||
\
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITESTRING(p, s) ({ \
|
||||
#define WRITESTRING(p, s) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \
|
||||
WRITECHAR(p, s[tmp_i]); \
|
||||
\
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITEMEM(p, s, n) ({ \
|
||||
memcpy(p, s, n); \
|
||||
p += n; \
|
||||
})
|
||||
#define WRITEMEM(p, s, n) do { \
|
||||
memcpy(p, s, n); \
|
||||
p += n; \
|
||||
} while (0)
|
||||
|
||||
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
|
||||
|
||||
#define SKIPSTRINGN(p, n) ({ \
|
||||
#define SKIPSTRINGN(p, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n && READCHAR(p) != '\0') \
|
||||
tmp_i++; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n)
|
||||
|
||||
#define READSTRINGN(p, s, n) ({ \
|
||||
#define READSTRINGN(p, s, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READSTRINGL(p, s, n) ({ \
|
||||
#define READSTRINGL(p, s, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READSTRING(p, s) ({ \
|
||||
#define READSTRING(p, s) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while ((s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READMEM(p, s, n) ({ \
|
||||
memcpy(s, p, n); \
|
||||
p += n; \
|
||||
})
|
||||
#define READMEM(p, s, n) do { \
|
||||
memcpy(s, p, n); \
|
||||
p += n; \
|
||||
} while (0)
|
||||
|
||||
#endif // __BYTEPTR_H__
|
||||
+1
-1
@@ -628,7 +628,7 @@ static void COM_ExecuteString(char *ptext)
|
||||
|
||||
// check cvars
|
||||
// Hurdler: added at Ebola's request ;)
|
||||
// (don't flood the console in software mode with bad gr_xxx command)
|
||||
// (don't flood the console in software mode with bad gl_xxx command)
|
||||
if (!CV_Command() && con_destlines)
|
||||
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
|
||||
}
|
||||
|
||||
+1
-1
@@ -1236,7 +1236,7 @@ void CONS_Printf(const char *fmt, ...)
|
||||
txt = malloc(8192);
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsprintf(txt, fmt, argptr);
|
||||
vsnprintf(txt, 8192, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
// echo console prints to log file
|
||||
|
||||
+309
-366
File diff suppressed because it is too large.
Load diff
+5
-5
@@ -600,10 +600,8 @@ void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
||||
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam);
|
||||
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam); // splitsreen player
|
||||
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam); // splitsreen3 player
|
||||
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam); // splitsreen4 player
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
|
||||
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
|
||||
|
||||
// Create any new ticcmds and broadcast to other players.
|
||||
void NetKeepAlive(void);
|
||||
@@ -647,10 +645,12 @@ extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
|
||||
void D_ResetTiccmds(void);
|
||||
ticcmd_t *D_LocalTiccmd(UINT8 ss);
|
||||
|
||||
tic_t GetLag(INT32 node);
|
||||
UINT8 GetFreeXCmdSize(void);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNSYNCH
|
||||
|
||||
+51
-66
@@ -15,6 +15,7 @@
|
||||
/// plus functions to parse command line parameters, configure game
|
||||
/// parameters, and call the startup functions.
|
||||
|
||||
#include "d_netcmd.h"
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -99,7 +100,6 @@ UINT8 window_notinfocus = false;
|
||||
// DEMO LOOP
|
||||
//
|
||||
//static INT32 demosequence;
|
||||
static const char *pagename = "MAP1PIC";
|
||||
static char *startupwadfiles[MAX_WADFILES];
|
||||
static char *startuppwads[MAX_WADFILES];
|
||||
|
||||
@@ -116,7 +116,6 @@ boolean devparm = false; // started game with -devparm
|
||||
boolean singletics = false; // timedemo
|
||||
boolean lastdraw = false;
|
||||
|
||||
postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
|
||||
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
// These variables are only true if
|
||||
@@ -183,7 +182,7 @@ static inline void D_DeviceLEDTick(void)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (cv_usejoystick[i].value == 0)
|
||||
continue;
|
||||
|
||||
color[i] = G_GetSkinColor(i);
|
||||
@@ -451,6 +450,8 @@ static boolean D_Display(void)
|
||||
{
|
||||
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||
{
|
||||
viewssnum = i;
|
||||
|
||||
if (i == 0) // Initialize for P1
|
||||
{
|
||||
viewwindowy = 0;
|
||||
@@ -460,8 +461,6 @@ static boolean D_Display(void)
|
||||
objectsdrawn = 0;
|
||||
}
|
||||
|
||||
viewssnum = i;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
|
||||
@@ -513,15 +512,12 @@ static boolean D_Display(void)
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (!splitscreen)
|
||||
R_ApplyViewMorph();
|
||||
if (!splitscreen)
|
||||
R_ApplyViewMorph();
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (!postimgtype[i])
|
||||
continue;
|
||||
|
||||
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
|
||||
V_DoPostProcessor(i, &players[displayplayers[i]], postimgparam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,6 +538,8 @@ static boolean D_Display(void)
|
||||
PS_START_TIMING(ps_uitime);
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
|
||||
NetUpdate(); // TEST: run this EVERY frame
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -745,10 +743,10 @@ void D_SRB2Loop(void)
|
||||
|
||||
renderisnewtic = (realtics > 0 || singletics);
|
||||
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
|
||||
if (renderisnewtic)
|
||||
{
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
|
||||
// don't skip more than 10 frames at a time
|
||||
// (fadein / fadeout cause massive frame skip!)
|
||||
if (realtics > 8)
|
||||
@@ -818,7 +816,7 @@ void D_SRB2Loop(void)
|
||||
{
|
||||
renderdeltatics = FLOAT_TO_FIXED(deltatics);
|
||||
|
||||
if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped)
|
||||
if (!(paused || P_AutoPause()) && !hu_stopped)
|
||||
{
|
||||
rendertimefrac = g_time.timefrac;
|
||||
}
|
||||
@@ -827,7 +825,14 @@ void D_SRB2Loop(void)
|
||||
rendertimefrac = FRACUNIT;
|
||||
}
|
||||
|
||||
rendertimefrac_unpaused = g_time.timefrac;
|
||||
if (!hu_stopped)
|
||||
{
|
||||
rendertimefrac_unpaused = g_time.timefrac;
|
||||
}
|
||||
else
|
||||
{
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -857,7 +862,7 @@ void D_SRB2Loop(void)
|
||||
LUA_Step();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
if (!dedicated)
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
@@ -962,10 +967,14 @@ void D_StartTitle(void)
|
||||
|
||||
gameaction = ga_nothing;
|
||||
memset(displayplayers, 0, sizeof(displayplayers));
|
||||
memset(g_localplayers, 0, sizeof g_localplayers);
|
||||
consoleplayer = 0;
|
||||
//demosequence = -1;
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
paused = false;
|
||||
|
||||
S_ResetKeepAndSpecialMus(); // just in case
|
||||
|
||||
F_StartTitleScreen();
|
||||
|
||||
// Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade
|
||||
@@ -1072,8 +1081,7 @@ static void D_FindAddonsToAutoload(void)
|
||||
const char *autoloadpath;
|
||||
boolean postload;
|
||||
|
||||
INT32 i, len;
|
||||
boolean hasprefix = false;
|
||||
INT32 i;
|
||||
char wadsToAutoload[256] = "";
|
||||
|
||||
// does it exist tho
|
||||
@@ -1095,7 +1103,8 @@ static void D_FindAddonsToAutoload(void)
|
||||
|| (wadsToAutoload[0] == '#'))
|
||||
continue;
|
||||
// this marks it so that it loads after loading server addons
|
||||
else if (fastncmp(wadsToAutoload, "postload ", 9)) {
|
||||
else if (fastncmp(wadsToAutoload, "postload ", 9))
|
||||
{
|
||||
strremove(wadsToAutoload, "postload ");
|
||||
postload = true;
|
||||
}
|
||||
@@ -1107,34 +1116,10 @@ static void D_FindAddonsToAutoload(void)
|
||||
wadsToAutoload[i] = '\0';
|
||||
}
|
||||
|
||||
len = strlen(wadsToAutoload);
|
||||
hasprefix = false;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
if (!postload && W_CheckPostLoadList(wadsToAutoload))
|
||||
{
|
||||
if (wadsToAutoload[i] == '_')
|
||||
{
|
||||
hasprefix = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Lets just hope no one adds bonuschars in autoload
|
||||
if (hasprefix)
|
||||
{
|
||||
// We searching for c in prefix, which stands for "character" and doesn't work well with
|
||||
// autoload atm, only fine for postload
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
if (wadsToAutoload[i] == '_') break; // Prefix end
|
||||
|
||||
if (wadsToAutoload[i] == 'c' || wadsToAutoload[i] == 'C')
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "forcing postload for %s as local skin\n", wadsToAutoload);
|
||||
postload = true;
|
||||
break; // Found it
|
||||
}
|
||||
}
|
||||
CONS_Printf("forcing postload for file %s\n", wadsToAutoload);
|
||||
postload = true;
|
||||
}
|
||||
|
||||
// LOAD IT
|
||||
@@ -1152,30 +1137,30 @@ static void D_FindAddonsToAutoload(void)
|
||||
fclose(autoloadconfigfile);
|
||||
}
|
||||
|
||||
void D_AddAutoloadFiles(void)
|
||||
static void D_AddAutoloadFiles(void)
|
||||
{
|
||||
if (wasautoloaded && postautoloaded)
|
||||
if (wasautoloaded)
|
||||
return;
|
||||
|
||||
if (!wasautoloaded && !modeattacking)
|
||||
{
|
||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfiles);
|
||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfiles);
|
||||
|
||||
wasautoloaded = true;
|
||||
}
|
||||
wasautoloaded = true;
|
||||
}
|
||||
|
||||
if ((!postautoloaded) && netgame)
|
||||
{
|
||||
CONS_Printf("D_AutoloadFile(): Loading postloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfilespost);
|
||||
void D_AddPostloadFiles(void)
|
||||
{
|
||||
if (postautoloaded || !netgame)
|
||||
return;
|
||||
|
||||
postautoloaded = true;
|
||||
}
|
||||
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
||||
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfilespost);
|
||||
|
||||
postautoloaded = true;
|
||||
}
|
||||
|
||||
void D_CleanFile(char **filearray)
|
||||
@@ -1865,11 +1850,12 @@ void D_SRB2Main(void)
|
||||
}
|
||||
|
||||
S_InitMusicDefs();
|
||||
S_InitMTDefs();
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
D_AddAutoloadFiles();
|
||||
|
||||
// Set up splitscreen players before joining!
|
||||
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
|
||||
{
|
||||
@@ -2071,7 +2057,6 @@ void D_SRB2Main(void)
|
||||
|
||||
if (dedicated && server)
|
||||
{
|
||||
pagename = "TITLESKY";
|
||||
levelstarttic = gametic;
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
if (!P_SetupLevel(false, false))
|
||||
|
||||
+3
-3
@@ -45,12 +45,12 @@ extern boolean statdp; // stat display for extended player setup
|
||||
extern boolean nametaggfx; // Nametag stuffs
|
||||
extern boolean driftgaugegfx;
|
||||
|
||||
void D_AddAutoloadFiles(void);
|
||||
|
||||
// autoload stuff
|
||||
extern boolean autoloading;
|
||||
extern boolean autoloaded;
|
||||
extern boolean postautoloaded;
|
||||
extern boolean wasautoloaded;
|
||||
|
||||
void D_AddPostloadFiles(void);
|
||||
|
||||
extern char *autoloadwadfilespost[MAX_WADFILES];
|
||||
extern char *autoloadwadfiles[MAX_WADFILES];
|
||||
|
||||
+1
-13
@@ -69,8 +69,6 @@ INT16 hardware_MAXPACKETLENGTH;
|
||||
|
||||
boolean (*I_NetGet)(void) = NULL;
|
||||
void (*I_NetSend)(void) = NULL;
|
||||
boolean (*I_NetCanSend)(void) = NULL;
|
||||
boolean (*I_NetCanGet)(void) = NULL;
|
||||
void (*I_NetCloseSocket)(void) = NULL;
|
||||
void (*I_NetFreeNodenum)(INT32 nodenum) = NULL;
|
||||
SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL;
|
||||
@@ -1087,15 +1085,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
netbuffer->ackreturn = 0;
|
||||
if (reliable)
|
||||
{
|
||||
if (I_NetCanSend && !I_NetCanSend())
|
||||
{
|
||||
if (netbuffer->packettype < PT_CANFAIL)
|
||||
GetFreeAcknum(&netbuffer->ack, true);
|
||||
|
||||
DEBFILE("HSendPacket: Out of bandwidth\n");
|
||||
return false;
|
||||
}
|
||||
else if (!GetFreeAcknum(&netbuffer->ack, false))
|
||||
if (!GetFreeAcknum(&netbuffer->ack, false))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1292,7 +1282,6 @@ boolean D_CheckNetGame(void)
|
||||
|
||||
I_NetGet = Internal_Get;
|
||||
I_NetSend = Internal_Send;
|
||||
I_NetCanSend = NULL;
|
||||
I_NetCloseSocket = NULL;
|
||||
I_NetFreeNodenum = Internal_FreeNodenum;
|
||||
I_NetMakeNodewPort = NULL;
|
||||
@@ -1491,7 +1480,6 @@ void D_CloseConnection(void)
|
||||
|
||||
I_NetGet = Internal_Get;
|
||||
I_NetSend = Internal_Send;
|
||||
I_NetCanSend = NULL;
|
||||
I_NetCloseSocket = NULL;
|
||||
I_NetFreeNodenum = Internal_FreeNodenum;
|
||||
I_NetMakeNodewPort = NULL;
|
||||
|
||||
+267
-218
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "command.h"
|
||||
#include "dehacked.h"
|
||||
#include "i_time.h"
|
||||
#include "i_system.h"
|
||||
#include "g_game.h"
|
||||
@@ -141,6 +142,8 @@ static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_GLocalSkin(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
static void Command_ListDoomednums_f(void);
|
||||
static void Command_ListUnusedSprites_f(void);
|
||||
static void Command_RunSOC(void);
|
||||
static void Command_Pause(void);
|
||||
static void Command_Respawn(void);
|
||||
@@ -303,14 +306,12 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
|
||||
consvar_t cv_laglesscam = {"laglesscamera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||
consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick3 = {"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
|
||||
{"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
@@ -318,13 +319,17 @@ consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_
|
||||
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
|
||||
#endif
|
||||
consvar_t cv_joyscale = {"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale2 = {"joyscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale3 = {"joyscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale4 = {"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#else
|
||||
consvar_t cv_joyscale = {"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save
|
||||
consvar_t cv_joyscale2 = {"joyscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save
|
||||
consvar_t cv_joyscale[2] = { //Alam: Dummy for save
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
consvar_t cv_mouse2port = {"mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -539,9 +544,9 @@ consvar_t cv_nametagscore = {"kartnametagscore", "Off", CV_SAVE, CV_OnOff, NULL,
|
||||
consvar_t cv_shownametagfinish = {"kartshownametagfinished", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shownametagspectator = {"kartshownametagspectator", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
static CV_PossibleValue_t driftgaugeoffset_cons_t[] = {
|
||||
{-FRACUNIT*128, "MIN"}, {FRACUNIT*128, "MAX"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t driftgaugestyle_cons_t[] = {
|
||||
{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {0, NULL}};
|
||||
|
||||
@@ -567,7 +572,15 @@ static CV_PossibleValue_t ps_descriptor_cons_t[] = {
|
||||
{1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}};
|
||||
consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
//consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_director[MAXSPLITSCREENPLAYERS] = {
|
||||
{"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_kartdebugdirector = {"debugdirector", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showdirectorhud = {"showdirectorhud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -703,6 +716,8 @@ void D_RegisterServerCommands(void)
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
|
||||
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
|
||||
|
||||
COM_AddCommand("runsoc", Command_RunSOC);
|
||||
COM_AddCommand("pause", Command_Pause);
|
||||
@@ -900,6 +915,7 @@ void D_RegisterClientCommands(void)
|
||||
COM_AddCommand("screenshot", M_ScreenShot);
|
||||
COM_AddCommand("startmovie", Command_StartMovie_f);
|
||||
COM_AddCommand("stopmovie", Command_StopMovie_f);
|
||||
COM_AddCommand("minigen", M_MinimapGenerate);
|
||||
|
||||
CV_RegisterVar(&cv_screenshot_option);
|
||||
CV_RegisterVar(&cv_screenshot_folder);
|
||||
@@ -997,7 +1013,11 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
CV_RegisterVar(&cv_showdownloadprompt);
|
||||
|
||||
CV_RegisterVar(&cv_director);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_director[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_kartdebugdirector);
|
||||
CV_RegisterVar(&cv_showdirectorhud);
|
||||
|
||||
@@ -1019,58 +1039,22 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_pauseifunfocused);
|
||||
|
||||
// g_input.c
|
||||
CV_RegisterVar(&cv_turnaxis);
|
||||
CV_RegisterVar(&cv_turnaxis2);
|
||||
CV_RegisterVar(&cv_turnaxis3);
|
||||
CV_RegisterVar(&cv_turnaxis4);
|
||||
CV_RegisterVar(&cv_moveaxis);
|
||||
CV_RegisterVar(&cv_moveaxis2);
|
||||
CV_RegisterVar(&cv_moveaxis3);
|
||||
CV_RegisterVar(&cv_moveaxis4);
|
||||
CV_RegisterVar(&cv_brakeaxis);
|
||||
CV_RegisterVar(&cv_brakeaxis2);
|
||||
CV_RegisterVar(&cv_brakeaxis3);
|
||||
CV_RegisterVar(&cv_brakeaxis4);
|
||||
CV_RegisterVar(&cv_aimaxis);
|
||||
CV_RegisterVar(&cv_aimaxis2);
|
||||
CV_RegisterVar(&cv_aimaxis3);
|
||||
CV_RegisterVar(&cv_aimaxis4);
|
||||
CV_RegisterVar(&cv_lookaxis);
|
||||
CV_RegisterVar(&cv_lookaxis2);
|
||||
CV_RegisterVar(&cv_lookaxis3);
|
||||
CV_RegisterVar(&cv_lookaxis4);
|
||||
CV_RegisterVar(&cv_fireaxis);
|
||||
CV_RegisterVar(&cv_fireaxis2);
|
||||
CV_RegisterVar(&cv_fireaxis3);
|
||||
CV_RegisterVar(&cv_fireaxis4);
|
||||
CV_RegisterVar(&cv_driftaxis);
|
||||
CV_RegisterVar(&cv_driftaxis2);
|
||||
CV_RegisterVar(&cv_driftaxis3);
|
||||
CV_RegisterVar(&cv_driftaxis4);
|
||||
CV_RegisterVar(&cv_lookbackaxis);
|
||||
CV_RegisterVar(&cv_lookbackaxis2);
|
||||
CV_RegisterVar(&cv_lookbackaxis3);
|
||||
CV_RegisterVar(&cv_lookbackaxis4);
|
||||
CV_RegisterVar(&cv_custom1axis);
|
||||
CV_RegisterVar(&cv_custom1axis2);
|
||||
CV_RegisterVar(&cv_custom1axis3);
|
||||
CV_RegisterVar(&cv_custom1axis4);
|
||||
CV_RegisterVar(&cv_custom2axis);
|
||||
CV_RegisterVar(&cv_custom2axis2);
|
||||
CV_RegisterVar(&cv_custom2axis3);
|
||||
CV_RegisterVar(&cv_custom2axis4);
|
||||
CV_RegisterVar(&cv_custom3axis);
|
||||
CV_RegisterVar(&cv_custom3axis2);
|
||||
CV_RegisterVar(&cv_custom3axis3);
|
||||
CV_RegisterVar(&cv_custom3axis4);
|
||||
CV_RegisterVar(&cv_xdeadzone);
|
||||
CV_RegisterVar(&cv_ydeadzone);
|
||||
CV_RegisterVar(&cv_xdeadzone2);
|
||||
CV_RegisterVar(&cv_ydeadzone2);
|
||||
CV_RegisterVar(&cv_xdeadzone3);
|
||||
CV_RegisterVar(&cv_ydeadzone3);
|
||||
CV_RegisterVar(&cv_xdeadzone4);
|
||||
CV_RegisterVar(&cv_ydeadzone4);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_turnaxis[i]);
|
||||
CV_RegisterVar(&cv_moveaxis[i]);
|
||||
CV_RegisterVar(&cv_brakeaxis[i]);
|
||||
CV_RegisterVar(&cv_aimaxis[i]);
|
||||
CV_RegisterVar(&cv_lookaxis[i]);
|
||||
CV_RegisterVar(&cv_fireaxis[i]);
|
||||
CV_RegisterVar(&cv_driftaxis[i]);
|
||||
CV_RegisterVar(&cv_lookbackaxis[i]);
|
||||
CV_RegisterVar(&cv_custom1axis[i]);
|
||||
CV_RegisterVar(&cv_custom2axis[i]);
|
||||
CV_RegisterVar(&cv_custom3axis[i]);
|
||||
CV_RegisterVar(&cv_xdeadzone[i]);
|
||||
CV_RegisterVar(&cv_ydeadzone[i]);
|
||||
}
|
||||
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
@@ -1107,28 +1091,19 @@ void D_RegisterClientCommands(void)
|
||||
//CV_RegisterVar(&cv_mousemove);
|
||||
//CV_RegisterVar(&cv_mousemove2);
|
||||
|
||||
CV_RegisterVar(&cv_usejoystick);
|
||||
CV_RegisterVar(&cv_usejoystick2);
|
||||
CV_RegisterVar(&cv_usejoystick3);
|
||||
CV_RegisterVar(&cv_usejoystick4);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
}
|
||||
#ifdef LJOYSTICK
|
||||
CV_RegisterVar(&cv_joyport);
|
||||
CV_RegisterVar(&cv_joyport2);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_joyscale);
|
||||
CV_RegisterVar(&cv_joyscale2);
|
||||
CV_RegisterVar(&cv_joyscale3);
|
||||
CV_RegisterVar(&cv_joyscale4);
|
||||
|
||||
// Analog Control
|
||||
/*CV_RegisterVar(&cv_analog);
|
||||
CV_RegisterVar(&cv_analog2);
|
||||
CV_RegisterVar(&cv_analog3);
|
||||
CV_RegisterVar(&cv_analog4);
|
||||
CV_RegisterVar(&cv_useranalog);
|
||||
CV_RegisterVar(&cv_useranalog2);
|
||||
CV_RegisterVar(&cv_useranalog3);
|
||||
CV_RegisterVar(&cv_useranalog4);*/
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
}
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
@@ -1157,7 +1132,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_nametag);
|
||||
CV_RegisterVar(&cv_nametagtrans);
|
||||
CV_RegisterVar(&cv_nametagfacerank);
|
||||
@@ -1172,7 +1147,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_nametagscore);
|
||||
CV_RegisterVar(&cv_shownametagfinish);
|
||||
CV_RegisterVar(&cv_shownametagspectator);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_driftgauge);
|
||||
CV_RegisterVar(&cv_driftgaugeofs);
|
||||
CV_RegisterVar(&cv_driftgaugetrans);
|
||||
@@ -1675,25 +1650,9 @@ static void SendNameAndColor(void)
|
||||
}
|
||||
else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin.value != players[consoleplayer].skin);
|
||||
|
||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
||||
CV_StealthSet(&cv_skin, skins[cv_skin.value].name);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor);
|
||||
|
||||
players[consoleplayer].skincolor = (cv_playercolor.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1737,7 +1696,7 @@ static void SendNameAndColor(void)
|
||||
WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin.value);
|
||||
SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(0, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
// splitscreen
|
||||
@@ -1807,24 +1766,8 @@ static void SendNameAndColor2(void)
|
||||
|
||||
if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin2.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin2.value != players[secondplaya].skin);
|
||||
|
||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
|
||||
players[secondplaya].skincolor = (cv_playercolor2.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[secondplaya].mo)
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1867,7 +1810,7 @@ static void SendNameAndColor2(void)
|
||||
WRITESTRINGN(p, cv_playername2.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor2.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin2.value);
|
||||
SendNetXCmd2(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(1, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void SendNameAndColor3(void)
|
||||
@@ -1988,7 +1931,7 @@ static void SendNameAndColor3(void)
|
||||
WRITESTRINGN(p, cv_playername3.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor3.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin3.value);
|
||||
SendNetXCmd3(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(2, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void SendNameAndColor4(void)
|
||||
@@ -2057,24 +2000,8 @@ static void SendNameAndColor4(void)
|
||||
|
||||
if ((foundskin = R_SkinAvailable(cv_skin4.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin4.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin4.value != players[fourthplaya].skin);
|
||||
|
||||
SetPlayerSkin(fourthplaya, cv_skin4.string);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor4, skins[players[fourthplaya].skin].prefcolor);
|
||||
|
||||
players[fourthplaya].skincolor = (cv_playercolor4.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[fourthplaya].mo)
|
||||
players[fourthplaya].mo->color = players[fourthplaya].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2117,7 +2044,7 @@ static void SendNameAndColor4(void)
|
||||
WRITESTRINGN(p, cv_playername4.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor4.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin4.value);
|
||||
SendNetXCmd4(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(3, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
@@ -2222,11 +2149,9 @@ void SendWeaponPref(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam.value)
|
||||
if (cv_flipcam[0].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(0, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref2(void)
|
||||
@@ -2234,11 +2159,9 @@ void SendWeaponPref2(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam2.value)
|
||||
if (cv_flipcam[1].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog2.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd2(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(1, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref3(void)
|
||||
@@ -2246,11 +2169,9 @@ void SendWeaponPref3(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam3.value)
|
||||
if (cv_flipcam[2].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog3.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd3(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(2, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref4(void)
|
||||
@@ -2258,11 +2179,9 @@ void SendWeaponPref4(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam4.value)
|
||||
if (cv_flipcam[3].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog4.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd4(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(3, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
|
||||
@@ -2394,7 +2313,7 @@ static void Command_View_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (demo.freecam)
|
||||
if (camera[viewnum-1].freecam)
|
||||
return;
|
||||
|
||||
displayplayerp = &displayplayers[viewnum-1];
|
||||
@@ -2521,6 +2440,12 @@ static void Command_Playdemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!demo.playback && gamestate == GS_LEVEL) // special case: allow starting another demo while watching a demo
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't time a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2560,6 +2485,12 @@ static void Command_Timedemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!demo.playback && gamestate == GS_LEVEL) // special case: allow starting another demo while watching a demo
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't time a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2983,6 +2914,14 @@ static void Command_Map_f(void)
|
||||
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||
else
|
||||
{
|
||||
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
|
||||
Z_Free(realmapname);
|
||||
Z_Free(mapname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Course %s (%s) doesn't support %s mode!\n(Use -force to override)\n"), realmapname, G_BuildMapName(newmapnum),
|
||||
@@ -3015,9 +2954,14 @@ static void Command_Map_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
// spend atleast 35 seconds in one map
|
||||
if (cv_demochangemap.value && demo.recording && demo.savemode != DSM_NOTSAVING && (timeinmap > 1463) && ((cv_demochangemap.value == 2 && newmapnum == gamemap) || newmapnum != gamemap))
|
||||
G_SaveDemo();
|
||||
if (cv_demochangemap.value && demo.recording)
|
||||
{
|
||||
// spend atleast 40 seconds in one map
|
||||
if (demo.savemode != DSM_NOTSAVING && (timeinmap > (TICRATE * 40)) && ((cv_demochangemap.value == 2 && newmapnum == gamemap) || newmapnum != gamemap))
|
||||
G_SaveDemo();
|
||||
else
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
|
||||
fromlevelselect = false;
|
||||
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
|
||||
@@ -3106,7 +3050,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
||||
|
||||
//mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||
//LUAh_MapChange(mapnumber);
|
||||
//LUA_HookInt(mapnumber, HOOK(MapChange));
|
||||
|
||||
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
demo.savebutton = 0;
|
||||
@@ -3466,7 +3410,7 @@ static void Command_Teamchange_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(0, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange2_f(void)
|
||||
@@ -3557,7 +3501,7 @@ static void Command_Teamchange2_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd2(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(1, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange3_f(void)
|
||||
@@ -3648,7 +3592,7 @@ static void Command_Teamchange3_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd3(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(2, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange4_f(void)
|
||||
@@ -3739,7 +3683,7 @@ static void Command_Teamchange4_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd4(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(3, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_ServerTeamChange_f(void)
|
||||
@@ -4005,19 +3949,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
if (!players[playernum].spectator)
|
||||
{
|
||||
if (players[playernum].mo)
|
||||
{
|
||||
//if (!players[playernum].spectator)
|
||||
P_DamageMobj(players[playernum].mo, NULL, NULL, 10000);
|
||||
/*else
|
||||
{
|
||||
if (players[playernum].mo)
|
||||
{
|
||||
P_RemoveMobj(players[playernum].mo);
|
||||
players[playernum].mo = NULL;
|
||||
}
|
||||
players[playernum].playerstate = PST_REBORN;
|
||||
}*/
|
||||
}
|
||||
P_DamageMobj(players[playernum].mo, NULL, NULL, 10000);
|
||||
else
|
||||
players[playernum].playerstate = PST_REBORN;
|
||||
}
|
||||
@@ -4151,10 +4083,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
players[playernum].mo->health = 1;
|
||||
}
|
||||
|
||||
// In tag, check to see if you still have a game.
|
||||
/*if (G_TagGametype())
|
||||
P_CheckSurvivors();
|
||||
else*/ if (G_BattleGametype())
|
||||
if (G_BattleGametype())
|
||||
K_CheckBumpers(); // SRB2Kart
|
||||
else if (G_RaceGametype())
|
||||
P_CheckRacers(); // also SRB2Kart
|
||||
@@ -4878,10 +4807,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
boolean kick = false;
|
||||
boolean toomany = false;
|
||||
INT32 i,j;
|
||||
serverinfo_pak *dummycheck = NULL;
|
||||
|
||||
// Shut the compiler up.
|
||||
(void)dummycheck;
|
||||
|
||||
READSTRINGN(*cp, filename, 240);
|
||||
READMEM(*cp, md5sum, 16);
|
||||
@@ -5009,6 +4934,151 @@ static void Command_ListWADS_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
|
||||
static void Command_ListDoomednums_f(void)
|
||||
{
|
||||
INT16 i, j, k = 0, l = 0;
|
||||
INT32 argc = COM_Argc();
|
||||
INT16 table[MAXDOOMEDNUM];
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
l = MAXDOOMEDNUM;
|
||||
break;
|
||||
case 3:
|
||||
l = atoi(COM_Argv(2));
|
||||
if (l < 1 || l > MAXDOOMEDNUM)
|
||||
{
|
||||
CONS_Printf("arg 2: doomednum \x82""%d \x85out of range (1-4095)\n", k);
|
||||
return;
|
||||
}
|
||||
//FALLTHRU
|
||||
case 2:
|
||||
k = atoi(COM_Argv(1));
|
||||
if (k < 1 || k > MAXDOOMEDNUM)
|
||||
{
|
||||
CONS_Printf("arg 1: doomednum \x82""%d \x85out of range (1-4095)\n", k);
|
||||
return;
|
||||
}
|
||||
if (!l)
|
||||
l = k;
|
||||
else if (l < k) // silently and helpfully swap.
|
||||
{
|
||||
j = k;
|
||||
k = l;
|
||||
l = j;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CONS_Printf("listmapthings: \x86too many arguments!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// see P_SpawnNonMobjMapThing
|
||||
memset(table, 0, sizeof(table));
|
||||
for (i = 1; i <= MAXPLAYERS; i++)
|
||||
table[i-1] = MT_PLAYER; // playerstarts
|
||||
table[33-1] = table[34-1] = table[35-1] = MT_PLAYER; // battle/team starts
|
||||
table[750-1] = table[777-1] = table[778-1] = MT_UNKNOWN; // slopes
|
||||
for (i = 600; i <= 609; i++)
|
||||
table[i-1] = MT_RING; // placement patterns
|
||||
table[1705-1] = table[1713-1] = MT_HOOP; // types of hoop
|
||||
|
||||
CONS_Printf("\x82""Checking for double defines...\n");
|
||||
for (i = 1; i < MT_FIRSTFREESLOT+NUMMOBJFREESLOTS; i++)
|
||||
{
|
||||
j = mobjinfo[i].doomednum;
|
||||
if (j < (k ? k : 1) || j > (l ? l : MAXDOOMEDNUM))
|
||||
continue;
|
||||
if (table[j-1])
|
||||
{
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is \x85""double-defined\x80 by ", j);
|
||||
if (i < MT_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf("\x87""hardcode %s <-- MAJOR ERROR\n", MOBJTYPE_LIST[i]);
|
||||
continue;
|
||||
}
|
||||
CONS_Printf("\x81""freeslot MT_""%s\n", FREE_MOBJS[i-MT_FIRSTFREESLOT]);
|
||||
continue;
|
||||
}
|
||||
table[j-1] = i;
|
||||
}
|
||||
CONS_Printf("\x82Printing doomednum usage...\n");
|
||||
if (!k)
|
||||
{
|
||||
i = 35; // skip MT_PLAYER spam
|
||||
CONS_Printf(" doomednums \x82""1-35""\x80 are used by ""\x87""hardcode MT_PLAYER\n");
|
||||
}
|
||||
else
|
||||
i = k-1;
|
||||
|
||||
for (; i < l; i++)
|
||||
{
|
||||
if (!table[i])
|
||||
{
|
||||
if (k)
|
||||
{
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is \x83""free!", i+1);
|
||||
if (i < 99) // above the humble crawla? how dare you
|
||||
CONS_Printf(" (Don't freeslot this low...)");
|
||||
CONS_Printf("\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is used by ", i+1);
|
||||
if (table[i] < MT_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf("\x87""hardcode %s\n", MOBJTYPE_LIST[table[i]]);
|
||||
continue;
|
||||
}
|
||||
CONS_Printf("\x81""freeslot MT_""%s\n", FREE_MOBJS[table[i]-MT_FIRSTFREESLOT]);
|
||||
}
|
||||
}
|
||||
|
||||
#undef MAXDOOMEDNUM
|
||||
|
||||
void Command_ListUnusedSprites_f(void)
|
||||
{
|
||||
size_t i, j;
|
||||
|
||||
CONS_Printf("\x82Printing sprite non-usage...\n");
|
||||
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
if (sprites[i].numframes)
|
||||
{
|
||||
// We're only showing unused sprites...
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i < SPR_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf(" \x87""hardcode SPR_""%.4s\n", sprnames[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] == 0xFF)
|
||||
{
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i+j]);
|
||||
}
|
||||
|
||||
i += j;
|
||||
}
|
||||
|
||||
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8)))
|
||||
{
|
||||
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// MISC. COMMANDS
|
||||
// =========================================================================
|
||||
@@ -5298,9 +5368,6 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||
else if (!multiplayer && !netgame)
|
||||
{
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
// These shouldn't matter anymore
|
||||
//CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue);
|
||||
//CV_SetValue(&cv_itemrespawn, 0);
|
||||
}
|
||||
|
||||
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
||||
@@ -5322,19 +5389,6 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||
}
|
||||
}
|
||||
|
||||
// When swapping to a gametype that supports spectators,
|
||||
// make everyone a spectator initially.
|
||||
/*if (G_GametypeHasSpectators())
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
{
|
||||
players[i].ctfteam = 0;
|
||||
players[i].spectator = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
// don't retain teams in other modes or between changes from ctf to team match.
|
||||
// also, stop any and all forms of team scrambling that might otherwise take place.
|
||||
if (G_GametypeHasTeams())
|
||||
@@ -5785,10 +5839,6 @@ void Command_Retry_f(void)
|
||||
CONS_Printf(M_GetText("You must be in a level to use this.\n"));
|
||||
else if (netgame || multiplayer)
|
||||
CONS_Printf(M_GetText("This only works in single player.\n"));
|
||||
/*else if (!&players[consoleplayer] || players[consoleplayer].lives <= 1)
|
||||
CONS_Printf(M_GetText("You can't retry without any lives remaining!\n"));
|
||||
else if (G_IsSpecialStage(gamemap))
|
||||
CONS_Printf(M_GetText("You can't retry special stages!\n"));*/
|
||||
else
|
||||
{
|
||||
M_ClearMenus(true);
|
||||
@@ -5858,10 +5908,9 @@ static void Command_Togglemodified_f(void)
|
||||
modifiedgame = !modifiedgame;
|
||||
}
|
||||
|
||||
extern UINT8 *save_p;
|
||||
static void Command_Archivetest_f(void)
|
||||
{
|
||||
UINT8 *buf;
|
||||
savebuffer_t save;
|
||||
UINT32 i, wrote;
|
||||
thinker_t *th;
|
||||
if (gamestate != GS_LEVEL)
|
||||
@@ -5877,28 +5926,28 @@ static void Command_Archivetest_f(void)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
|
||||
// allocate buffer
|
||||
buf = save_p = ZZ_Alloc(1024);
|
||||
save.buffer = save.p = ZZ_Alloc(1024);
|
||||
|
||||
// test archive
|
||||
CONS_Printf("LUA_Archive...\n");
|
||||
LUA_Archive();
|
||||
WRITEUINT8(save_p, 0x7F);
|
||||
wrote = (UINT32)(save_p-buf);
|
||||
LUA_Archive(&save, true);
|
||||
WRITEUINT8(save.p, 0x7F);
|
||||
wrote = (UINT32)(save.p - save.buffer);
|
||||
|
||||
// clear Lua state, so we can really see what happens!
|
||||
CONS_Printf("Clearing state!\n");
|
||||
LUA_ClearExtVars();
|
||||
|
||||
// test unarchive
|
||||
save_p = buf;
|
||||
save.p = save.buffer;
|
||||
CONS_Printf("LUA_UnArchive...\n");
|
||||
LUA_UnArchive();
|
||||
i = READUINT8(save_p);
|
||||
if (i != 0x7F || wrote != (UINT32)(save_p-buf))
|
||||
CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(save_p-buf));
|
||||
LUA_UnArchive(&save, true);
|
||||
i = READUINT8(save.p);
|
||||
if (i != 0x7F || wrote != (UINT32)(save.p - save.buffer))
|
||||
CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(save.p - save.buffer));
|
||||
|
||||
// free buffer
|
||||
Z_Free(buf);
|
||||
Z_Free(save.buffer);
|
||||
CONS_Printf("Done. No crash.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-9
@@ -43,18 +43,12 @@ extern consvar_t cv_seenames, cv_allowseenames;
|
||||
extern consvar_t cv_usemouse;
|
||||
//WTF
|
||||
extern consvar_t cv_mouseturn;
|
||||
extern consvar_t cv_usejoystick;
|
||||
extern consvar_t cv_usejoystick2;
|
||||
extern consvar_t cv_usejoystick3;
|
||||
extern consvar_t cv_usejoystick4;
|
||||
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
|
||||
#ifdef LJOYSTICK
|
||||
extern consvar_t cv_joyport;
|
||||
extern consvar_t cv_joyport2;
|
||||
#endif
|
||||
extern consvar_t cv_joyscale;
|
||||
extern consvar_t cv_joyscale2;
|
||||
extern consvar_t cv_joyscale3;
|
||||
extern consvar_t cv_joyscale4;
|
||||
extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS
|
||||
|
||||
// splitscreen with second mouse
|
||||
extern consvar_t cv_mouse2port;
|
||||
@@ -203,7 +197,8 @@ extern consvar_t cv_ps_thinkframe_page;
|
||||
extern consvar_t cv_ps_samplesize;
|
||||
extern consvar_t cv_ps_descriptor;
|
||||
|
||||
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
|
||||
extern consvar_t cv_director[4]; // screw you includes
|
||||
extern consvar_t cv_kartdebugdirector, cv_showdirectorhud;
|
||||
|
||||
extern consvar_t cv_showtrackaddon;
|
||||
|
||||
|
||||
+2
-1
@@ -403,7 +403,6 @@ typedef struct player_s
|
||||
angle_t old_frameangle, old_frameangle2;
|
||||
|
||||
// SRB2Kart CEP: Sliptide rolling
|
||||
INT32 sliptidemem;
|
||||
angle_t sliproll;
|
||||
|
||||
INT16 lturn_max[MAXPREDICTTICS]; // What's the expected turn value for full-left for a number of frames back (to account for netgame latency)?
|
||||
@@ -413,6 +412,8 @@ typedef struct player_s
|
||||
// See pflags_t, above.
|
||||
pflags_t pflags;
|
||||
|
||||
UINT16 postimgflags;
|
||||
|
||||
// playing animation.
|
||||
panim_t panim;
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ typedef struct thinker_s
|
||||
// killough 11/98: count of how many other objects reference
|
||||
// this one using pointers. Used for garbage collection.
|
||||
INT32 references;
|
||||
boolean cachable;
|
||||
} thinker_t;
|
||||
|
||||
#endif
|
||||
+38
-27
@@ -14,7 +14,6 @@
|
||||
#include "d_main.h" // for srb2home
|
||||
#include "g_game.h"
|
||||
#include "sounds.h"
|
||||
#include "info.h"
|
||||
#include "d_think.h"
|
||||
#include "m_argv.h"
|
||||
#include "z_zone.h"
|
||||
@@ -33,12 +32,12 @@
|
||||
#include "r_sky.h"
|
||||
#include "r_draw.h" // translation colormap consts (for lua)
|
||||
#include "fastcmp.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_glib.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#include "d_clisrv.h"
|
||||
#include "v_video.h" // video flags (for lua)
|
||||
|
||||
#include "lua_glib.h"
|
||||
#include "lua_hook.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
@@ -48,13 +47,14 @@
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
static char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
static char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
static UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
|
||||
#define initfreeslots() {\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
}
|
||||
|
||||
// Crazy word-reading stuff
|
||||
@@ -1493,9 +1493,6 @@ actionpointer_t actionpointers[] =
|
||||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
{{A_RollAngle}, "A_ROLLANGLE"},
|
||||
{{A_ChangeRollAngleRelative},"A_CHANGEROLLANGLERELATIVE"},
|
||||
{{A_ChangeRollAngleAbsolute},"A_CHANGEROLLANGLEABSOLUTE"},
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
@@ -3150,7 +3147,7 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
|
||||
// RegEx to generate this from info.h: ^\tS_([^,]+), --> \t"S_\1",
|
||||
// I am leaving the prefixes solely for clarity to programmers,
|
||||
// because sadly no one remembers this place while searching for full state names.
|
||||
static const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
"S_NULL",
|
||||
"S_UNKNOWN",
|
||||
"S_INVISIBLE", // state for invisible sprite
|
||||
@@ -6364,7 +6361,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
||||
// RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1",
|
||||
// I am leaving the prefixes solely for clarity to programmers,
|
||||
// because sadly no one remembers this place while searching for full state names.
|
||||
static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
"MT_NULL",
|
||||
"MT_UNKNOWN",
|
||||
|
||||
@@ -7155,7 +7152,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char *const MOBJFLAG_LIST[] = {
|
||||
const char *const MOBJFLAG_LIST[] = {
|
||||
"SPECIAL",
|
||||
"SOLID",
|
||||
"SHOOTABLE",
|
||||
@@ -7191,7 +7188,7 @@ static const char *const MOBJFLAG_LIST[] = {
|
||||
};
|
||||
|
||||
// \tMF2_(\S+).*// (.+) --> \t"\1", // \2
|
||||
static const char *const MOBJFLAG2_LIST[] = {
|
||||
const char *const MOBJFLAG2_LIST[] = {
|
||||
"AXIS", // It's a NiGHTS axis! (For faster checking)
|
||||
"TWOD", // Moves like it's in a 2D level
|
||||
"DONTRESPAWN", // Don't respawn this object!
|
||||
@@ -7224,7 +7221,7 @@ static const char *const MOBJFLAG2_LIST[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *const MOBJEFLAG_LIST[] = {
|
||||
const char *const MOBJEFLAG_LIST[] = {
|
||||
"ONGROUND", // The mobj stands on solid floor (not on another mobj or in air)
|
||||
"JUSTHITFLOOR", // The mobj just hit the floor while falling, this is cleared on next frame
|
||||
"TOUCHWATER", // The mobj stands in a sector with water, and touches the surface
|
||||
@@ -7242,14 +7239,14 @@ static const char *const MOBJEFLAG_LIST[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
NULL,
|
||||
"OBJECTFLIP", // Reverse gravity flag for objects.
|
||||
"OBJECTSPECIAL", // Special flag used with certain objects.
|
||||
"AMBUSH" // Deaf monsters/do not react to sound.
|
||||
};
|
||||
|
||||
static const char *const PLAYERFLAG_LIST[] = {
|
||||
const char *const PLAYERFLAG_LIST[] = {
|
||||
// Flip camera angle with gravity flip prefrence.
|
||||
"FLIPCAM",
|
||||
|
||||
@@ -7321,7 +7318,7 @@ static const char *const PLAYERFLAG_LIST[] = {
|
||||
};
|
||||
|
||||
// Linedef flags
|
||||
static const char *const ML_LIST[16] = {
|
||||
const char *const ML_LIST[16] = {
|
||||
"IMPASSIBLE",
|
||||
"BLOCKMONSTERS",
|
||||
"TWOSIDED",
|
||||
@@ -7342,7 +7339,7 @@ static const char *const ML_LIST[16] = {
|
||||
|
||||
// This DOES differ from r_draw's Color_Names, unfortunately.
|
||||
// Also includes Super colors
|
||||
static const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
"NONE", // SKINCOLOR_NONE
|
||||
"WHITE", // SKINCOLOR_WHITE
|
||||
"SILVER", // SKINCOLOR_SILVER
|
||||
@@ -7510,7 +7507,7 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
"CSUPER5" // SKINCOLOR_CSUPER5,
|
||||
};
|
||||
|
||||
static const char *const POWERS_LIST[] = {
|
||||
const char *const POWERS_LIST[] = {
|
||||
"INVULNERABILITY",
|
||||
"SNEAKERS",
|
||||
"FLASHING",
|
||||
@@ -7545,7 +7542,7 @@ static const char *const POWERS_LIST[] = {
|
||||
"INGOOP" // In goop
|
||||
};
|
||||
|
||||
static const char *const KARTSTUFF_LIST[] = {
|
||||
const char *const KARTSTUFF_LIST[] = {
|
||||
"POSITION",
|
||||
"OLDPOSITION",
|
||||
"POSITIONDELAY",
|
||||
@@ -7632,7 +7629,7 @@ static const char *const KARTSTUFF_LIST[] = {
|
||||
"GROWCANCEL"
|
||||
};
|
||||
|
||||
static const char *const HUDITEMS_LIST[] = {
|
||||
const char *const HUDITEMS_LIST[] = {
|
||||
"LIVESNAME",
|
||||
"LIVESPIC",
|
||||
"LIVESNUM",
|
||||
@@ -8545,6 +8542,16 @@ static int lua_enumlib_mariomode_get(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_replayfreecam_get(lua_State *L)
|
||||
{
|
||||
if (dedicated) // huh?
|
||||
lua_pushboolean(L, false);
|
||||
else
|
||||
lua_pushboolean(L, camera[R_GetViewNumber()].freecam);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_twodlevel_get(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, twodlevel);
|
||||
@@ -9149,7 +9156,6 @@ int LUA_EnumLib(lua_State *L)
|
||||
PUSHGETTER(globalweather, u8);
|
||||
PUSHGETTER(levelskynum, i32);
|
||||
PUSHGETTER(globallevelskynum, i32);
|
||||
PUSHGETTER((*mapmusname), str);
|
||||
PUSHGETTER(mapmusflags, u16);
|
||||
PUSHGETTER(mapmusposition, u32);
|
||||
PUSHGETTER(gravity, fxp);
|
||||
@@ -9166,6 +9172,11 @@ int LUA_EnumLib(lua_State *L)
|
||||
PUSHGETTER(racecountdown, u32);
|
||||
PUSHGETTER(exitcountdown, u32);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "mapmusname");
|
||||
lua_glib_push_str_getter(L, mapmusname);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "mariomode");
|
||||
lua_pushcfunction(L, lua_enumlib_mariomode_get);
|
||||
@@ -9218,7 +9229,7 @@ int LUA_EnumLib(lua_State *L)
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "replayfreecam");
|
||||
lua_glib_push_bool_getter(L, &demo.freecam);
|
||||
lua_pushcfunction(L, lua_enumlib_replayfreecam_get);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
if (!mathlib)
|
||||
|
||||
@@ -14,6 +14,26 @@
|
||||
#define __DEHACKED_H__
|
||||
|
||||
#include "m_fixed.h" // for get_number
|
||||
#include "info.h"
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
extern char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
extern UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
|
||||
extern const char *const STATE_LIST[];
|
||||
extern const char *const MOBJTYPE_LIST[];
|
||||
extern const char *const MOBJFLAG_LIST[];
|
||||
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
|
||||
extern const char *const MOBJEFLAG_LIST[];
|
||||
extern const char *const MAPTHINGFLAG_LIST[4];
|
||||
extern const char *const PLAYERFLAG_LIST[];
|
||||
extern const char *const ML_LIST[]; // Linedef flags
|
||||
extern const char *COLOR_ENUMS[];
|
||||
extern const char *const POWERS_LIST[];
|
||||
extern const char *const KARTSTUFF_LIST[];
|
||||
extern const char *const HUDITEMS_LIST[];
|
||||
|
||||
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
||||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
|
||||
|
||||
+18
-2
@@ -127,8 +127,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v7.1"
|
||||
#define VERSIONSTRINGW L"Saturn v7.1"
|
||||
#define VERSIONSTRING "Saturn v7.2"
|
||||
#define VERSIONSTRINGW L"Saturn v7.2"
|
||||
// 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!
|
||||
@@ -522,6 +522,22 @@ extern boolean capslock;
|
||||
// i_system.c, replace getchar() once the keyboard has been appropriated
|
||||
INT32 I_GetKey(void);
|
||||
|
||||
/* http://www.cse.yorku.ca/~oz/hash.html */
|
||||
static inline
|
||||
UINT32 quickncasehash (const char *p, size_t n)
|
||||
{
|
||||
size_t i = 0;
|
||||
UINT32 x = 5381;
|
||||
|
||||
while (i < n && p[i])
|
||||
{
|
||||
x = (x * 33) ^ tolower(p[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifndef min // Double-Check with WATTCP-32's cdefs.h
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -112,7 +112,6 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
|
||||
extern boolean nodrawers;
|
||||
extern boolean noblit;
|
||||
extern boolean lastdraw;
|
||||
extern postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern INT32 viewwindowx, viewwindowy;
|
||||
@@ -123,6 +122,7 @@ extern boolean gamedataloaded;
|
||||
// Player taking events, and displaying.
|
||||
extern INT32 consoleplayer;
|
||||
extern INT32 displayplayers[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
// Maps of special importance
|
||||
extern INT16 spstage_start;
|
||||
|
||||
+30
-8
@@ -344,14 +344,12 @@ typedef union FColorRGBA RGBA_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
postimg_none,
|
||||
postimg_water,
|
||||
postimg_motion,
|
||||
postimg_flip,
|
||||
postimg_heat,
|
||||
postimg_mirror,
|
||||
postimg_mirrorflip
|
||||
} postimg_t;
|
||||
POSTIMG_WATER = 1, // Underwater screen effect.
|
||||
POSTIMG_MOTION = 1<<1, // Unused motion blur effect.
|
||||
POSTIMG_FLIP = 1<<2, // Flipcam screen effect.
|
||||
POSTIMG_HEAT = 1<<3, // Heatwave screen effect.
|
||||
POSTIMG_MIRROR = 1<<4, // encore screen effect.
|
||||
} postimgflag_t;
|
||||
|
||||
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
|
||||
#define LUMPERROR UINT32_MAX
|
||||
@@ -367,6 +365,30 @@ typedef UINT32 tic_t;
|
||||
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
|
||||
#endif
|
||||
|
||||
#define TOSTR(x) #x
|
||||
|
||||
typedef UINT8 bitarray_t;
|
||||
|
||||
#define BIT_ARRAY_SIZE(n) (((n) + 7) >> 3)
|
||||
|
||||
static inline int
|
||||
in_bit_array (const bitarray_t * const array, const int value)
|
||||
{
|
||||
return (array[value >> 3] & (1<<(value & 7)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] |= (1<<(value & 7));
|
||||
}
|
||||
|
||||
static inline void
|
||||
unset_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] &= ~(1<<(value & 7));
|
||||
}
|
||||
|
||||
typedef UINT64 precise_t;
|
||||
|
||||
#endif //__DOOMTYPE__
|
||||
+6
-5
@@ -327,7 +327,8 @@ char menupath[1024];
|
||||
size_t menupathindex[menudepth];
|
||||
size_t menudepthleft = menudepth;
|
||||
|
||||
char menusearch[MAXSTRINGLENGTH+1];
|
||||
char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
textinput_t menusearch;
|
||||
|
||||
char **dirmenu, **coredirmenu; // core only local for this file
|
||||
size_t sizedirmenu, sizecoredirmenu; // ditto
|
||||
@@ -497,7 +498,7 @@ static boolean filemenucmp(char *haystack, char *needle)
|
||||
strupr(localhaystack);
|
||||
if (cv_addons_search_type.value)
|
||||
return (strstr(localhaystack, needle) != 0);
|
||||
return (!strncmp(localhaystack, needle, menusearch[0]));
|
||||
return (!strncmp(localhaystack, needle, menusearch.length));
|
||||
}
|
||||
|
||||
void closefilemenu(boolean validsize)
|
||||
@@ -563,7 +564,7 @@ void searchfilemenu(char *tempname)
|
||||
|
||||
first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP...
|
||||
|
||||
if (!menusearch[0])
|
||||
if (!menusearch.length)
|
||||
{
|
||||
if (dirmenu)
|
||||
Z_Free(dirmenu);
|
||||
@@ -590,7 +591,7 @@ void searchfilemenu(char *tempname)
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(localmenusearch, menusearch+1);
|
||||
strcpy(localmenusearch, menusearch.buffer);
|
||||
if (!cv_addons_search_case.value)
|
||||
strupr(localmenusearch);
|
||||
|
||||
@@ -652,7 +653,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
}
|
||||
else
|
||||
menusearch[0] = menusearch[1] = 0; // clear search
|
||||
M_TextInputInit(&menusearch, menusearchbuf, MAXSTRINGLENGTH+1);
|
||||
|
||||
if (!(dirhandle = opendir(menupath))) // get directory
|
||||
{
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "d_netfil.h"
|
||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
|
||||
|
||||
@@ -34,7 +35,8 @@ extern char menupath[1024];
|
||||
extern size_t menupathindex[menudepth];
|
||||
extern size_t menudepthleft;
|
||||
|
||||
extern char menusearch[MAXSTRINGLENGTH+1];
|
||||
extern char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
extern textinput_t menusearch;
|
||||
|
||||
extern char **dirmenu;
|
||||
extern size_t sizedirmenu;
|
||||
|
||||
+668
-947
File diff suppressed because it is too large.
Load diff
+18
-9
@@ -17,6 +17,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_event.h"
|
||||
#include "p_saveg.h"
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern char gamedatafilename[64];
|
||||
@@ -33,7 +34,7 @@ extern INT32 player_name_changes[MAXPLAYERS];
|
||||
extern player_t players[MAXPLAYERS];
|
||||
extern boolean playeringame[MAXPLAYERS];
|
||||
|
||||
extern UINT8 *demo_p;
|
||||
extern savebuffer_t demobuf;
|
||||
|
||||
// ======================================
|
||||
// DEMO playback/recording related stuff.
|
||||
@@ -120,12 +121,21 @@ extern consvar_t cv_pauseifunfocused;
|
||||
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
|
||||
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
|
||||
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
|
||||
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
|
||||
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
|
||||
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_lookbackaxis,cv_custom1axis,cv_custom2axis,cv_custom3axis,cv_xdeadzone,cv_ydeadzone;
|
||||
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_lookbackaxis2,cv_custom1axis2,cv_custom2axis2,cv_custom3axis2,cv_xdeadzone2,cv_ydeadzone2;
|
||||
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_lookbackaxis3,cv_custom1axis3,cv_custom2axis3,cv_custom3axis3,cv_xdeadzone3,cv_ydeadzone3;
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_custom1axis4,cv_custom2axis4,cv_custom3axis4,cv_xdeadzone4,cv_ydeadzone4;
|
||||
|
||||
extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
// Hud offsets
|
||||
@@ -166,7 +176,6 @@ extern consvar_t cv_saltysquish;
|
||||
extern consvar_t cv_driftsparkpulse;
|
||||
extern consvar_t cv_gravstretch;
|
||||
extern consvar_t cv_sloperoll;
|
||||
extern consvar_t cv_spriteroll;
|
||||
extern consvar_t cv_sliptideroll;
|
||||
extern consvar_t cv_slamsound;
|
||||
extern consvar_t cv_sloperolldist;
|
||||
@@ -266,7 +275,6 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost);
|
||||
// A normal game starts at map 1, but a warp test can start elsewhere
|
||||
void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar,
|
||||
UINT8 ssplayers, boolean FLS);
|
||||
void G_DoLoadLevel(boolean resetplayer);
|
||||
|
||||
void G_LoadDemoInfo(menudemo_t *pdemo);
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo); // For use in replay search feature
|
||||
@@ -356,6 +364,7 @@ extern demoghost *ghosts;
|
||||
#define DFILE_ERROR_CANNOTLOAD 0x04 // Files are missing and cannot be loaded.
|
||||
#define DFILE_ERROR_EXTRAFILES 0x05 // Extra files outside of the replay's file list are loaded.
|
||||
|
||||
void G_ResetDemoRecording(void);
|
||||
void G_DoPlayDemo(char *defdemoname);
|
||||
void G_TimeDemo(const char *name);
|
||||
void G_AddGhost(char *defdemoname);
|
||||
|
||||
+14
-27
@@ -902,34 +902,15 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
"custom2",
|
||||
"custom3",
|
||||
"director",
|
||||
"freecam",
|
||||
"camfloat",
|
||||
"camsink",
|
||||
};
|
||||
|
||||
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
|
||||
|
||||
#include "k_kart.h"
|
||||
|
||||
INT32 G_GetDeviceForPlayer(INT32 player)
|
||||
{
|
||||
switch (player)
|
||||
{
|
||||
case 0:
|
||||
return cv_usejoystick.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_usejoystick2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_usejoystick3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_usejoystick4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline UINT16 G_GetSkinColor(INT32 player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
@@ -972,7 +953,7 @@ void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color)
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
return;
|
||||
|
||||
device = G_GetDeviceForPlayer(player);
|
||||
device = cv_usejoystick[player].value;
|
||||
|
||||
if (device <= 0)
|
||||
{
|
||||
@@ -989,7 +970,7 @@ static void G_ResetPlayerGamepadIndicatorColor(INT32 player)
|
||||
{
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
{
|
||||
INT32 device = G_GetDeviceForPlayer(player);
|
||||
INT32 device = cv_usejoystick[player].value;
|
||||
if (device <= 0)
|
||||
return;
|
||||
|
||||
@@ -1003,7 +984,7 @@ static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
@@ -1022,7 +1003,7 @@ void G_ResetAllDeviceRumbles(void)
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
{
|
||||
INT32 device_id = G_GetDeviceForPlayer(i);
|
||||
INT32 device_id = cv_usejoystick[i].value;
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
@@ -1037,7 +1018,7 @@ void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strengt
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
@@ -1161,6 +1142,12 @@ void G_Controldefault(UINT8 player)
|
||||
//gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT
|
||||
gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down
|
||||
gamecontrol[gc_scores ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
|
||||
gamecontrol[gc_camfloat ][0] = 'a';
|
||||
gamecontrol[gc_camsink ][0] = 'd';
|
||||
|
||||
gamecontrol[gc_camfloat ][1] = KEY_JOY1+0; // A
|
||||
gamecontrol[gc_camsink ][1] = KEY_JOY1+1; // B
|
||||
}
|
||||
|
||||
if (player == 0 || player == 2)
|
||||
|
||||
@@ -100,6 +100,9 @@ typedef enum
|
||||
gc_custom2, // Lua scriptable
|
||||
gc_custom3, // Lua scriptable
|
||||
gc_director,
|
||||
gc_freecam, // Toggle for freecam while ingame
|
||||
gc_camfloat, // alternative button for raising cam
|
||||
gc_camsink, // alternative button for sinking
|
||||
num_gamecontrols
|
||||
} gamecontrols_e;
|
||||
|
||||
|
||||
+35
-32
@@ -15,8 +15,9 @@
|
||||
#include "hw_main.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
// Set with HWR_SetCurrentTexture.
|
||||
@@ -46,12 +47,12 @@ int unsortedVertexArrayAllocSize = 65536;
|
||||
// Call HWR_RenderBatches to render all the collected geometry.
|
||||
void HWR_StartBatching(void)
|
||||
{
|
||||
if (currently_batching)
|
||||
if (currently_batching)
|
||||
{
|
||||
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
|
||||
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
|
||||
}
|
||||
|
||||
// init arrays if that has not been done yet
|
||||
// init arrays if that has not been done yet
|
||||
if (!finalVertexArray)
|
||||
{
|
||||
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
@@ -61,22 +62,22 @@ void HWR_StartBatching(void)
|
||||
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
}
|
||||
|
||||
currently_batching = true;
|
||||
currently_batching = true;
|
||||
}
|
||||
|
||||
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
|
||||
// This replaces the direct calls to GL_SetTexture in cases where batching is available.
|
||||
// The texture selection is saved for the next HWR_ProcessPolygon call.
|
||||
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
{
|
||||
if (currently_batching)
|
||||
{
|
||||
current_texture = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
}
|
||||
if (currently_batching)
|
||||
{
|
||||
current_texture = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
// If batching is enabled, this function collects the polygon data and the chosen texture
|
||||
@@ -84,7 +85,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
// render the polygon immediately.
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader_target, boolean horizonSpecial)
|
||||
{
|
||||
if (currently_batching)
|
||||
if (currently_batching)
|
||||
{
|
||||
if (!pSurf)
|
||||
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
|
||||
@@ -129,8 +130,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,14 +221,14 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
// the rendering backend to draw them.
|
||||
void HWR_RenderBatches(void)
|
||||
{
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalIndexWritePos = 0;// position in finalVertexIndexArray
|
||||
|
||||
int polygonReadPos = 0;// position in polygonArraySorted
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
GLMipmap_t *currentTexture;
|
||||
GLMipmap_t *currentTexture = NULL;
|
||||
GLMipmap_t *nextTexture = NULL;
|
||||
FBITFIELD currentPolyFlags = 0;
|
||||
FBITFIELD nextPolyFlags = 0;
|
||||
@@ -236,7 +237,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
int i;
|
||||
|
||||
if (!currently_batching)
|
||||
if (!currently_batching)
|
||||
I_Error("HWR_RenderBatches called without starting batching");
|
||||
|
||||
nextSurfaceInfo.LightInfo.fade_end = 0;
|
||||
@@ -256,6 +257,7 @@ void HWR_RenderBatches(void)
|
||||
ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0;
|
||||
ps_hw_numshaders.value.i = ps_hw_numtextures.value.i
|
||||
= ps_hw_numpolyflags.value.i = ps_hw_numcolors.value.i = 1;
|
||||
|
||||
// init polygonArraySorted
|
||||
for (i = 0; i < polygonArraySize; i++)
|
||||
{
|
||||
@@ -264,11 +266,12 @@ void HWR_RenderBatches(void)
|
||||
|
||||
// sort polygons
|
||||
PS_START_TIMING(ps_hw_batchsorttime);
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
|
||||
else
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders);
|
||||
PS_STOP_TIMING(ps_hw_batchsorttime);
|
||||
|
||||
// sort order
|
||||
// 1. shader
|
||||
// 2. texture
|
||||
@@ -287,15 +290,15 @@ void HWR_RenderBatches(void)
|
||||
|
||||
// set state for first batch
|
||||
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
GL_SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
else
|
||||
GL_SetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
@@ -369,7 +372,7 @@ void HWR_RenderBatches(void)
|
||||
nextSurfaceInfo = nextEntry->surf;
|
||||
if (nextPolyFlags & PF_NoTexture)
|
||||
nextTexture = 0;
|
||||
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable)
|
||||
if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
changeState = true;
|
||||
changeShader = true;
|
||||
@@ -384,7 +387,7 @@ void HWR_RenderBatches(void)
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
@@ -410,7 +413,7 @@ void HWR_RenderBatches(void)
|
||||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
GL_DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
ps_hw_numcalls.value.i++;
|
||||
ps_hw_numverts.value.i += finalIndexWritePos;
|
||||
@@ -428,7 +431,7 @@ void HWR_RenderBatches(void)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
GL_SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
@@ -436,8 +439,8 @@ void HWR_RenderBatches(void)
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
// texture should be already ready for use from calls to GL_SetTexture during batch collection
|
||||
GL_SetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
@@ -457,6 +460,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
ps_hw_numcolors.value.i++;
|
||||
}
|
||||
// and that should be it?
|
||||
}
|
||||
}
|
||||
// reset the arrays (set sizes to 0)
|
||||
@@ -466,5 +470,4 @@ void HWR_RenderBatches(void)
|
||||
PS_STOP_TIMING(ps_hw_batchdrawtime);
|
||||
}
|
||||
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
|
||||
extern boolean currently_batching;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef struct
|
||||
|
||||
// when loading the map, this is set to true if portals are found.
|
||||
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
|
||||
boolean gr_maphasportals = false;
|
||||
boolean gl_maphasportals = false;
|
||||
|
||||
// ==========================================================================
|
||||
// FLOOR & CEILING CONVEX POLYS GENERATION
|
||||
@@ -371,14 +371,14 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||
line_t *line = lseg->linedef;
|
||||
|
||||
// portal check
|
||||
if (!gr_maphasportals && line->special == 40 && lseg->side == 0)
|
||||
if (!gl_maphasportals && line->special == 40 && lseg->side == 0)
|
||||
{
|
||||
// Find the other side!
|
||||
INT32 line2 = P_FindSpecialLineFromTag(40, line->tag, -1);
|
||||
if (line == &lines[line2])
|
||||
line2 = P_FindSpecialLineFromTag(40, line->tag, line2);
|
||||
if (line2 >= 0) // found it!
|
||||
gr_maphasportals = 1;
|
||||
gl_maphasportals = 1;
|
||||
}
|
||||
|
||||
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
|
||||
@@ -768,7 +768,7 @@ static INT32 SolveTProblem(void)
|
||||
INT32 i;
|
||||
size_t l;
|
||||
|
||||
if (cv_grsolvetjoin.value == 0)
|
||||
if (cv_glsolvetjoin.value == 0)
|
||||
return 0;
|
||||
|
||||
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
|
||||
@@ -905,7 +905,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||
#endif
|
||||
|
||||
// reset the portal flag
|
||||
gr_maphasportals = 0;
|
||||
gl_maphasportals = 0;
|
||||
|
||||
// find min/max boundaries of map
|
||||
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
|
||||
@@ -923,9 +923,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
|
||||
|
||||
// allocate table for back to front drawing of subsectors
|
||||
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors);
|
||||
if (!gr_drawsubsectors)
|
||||
I_Error("couldn't malloc gr_drawsubsectors\n");*/
|
||||
/*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;
|
||||
|
||||
+189
-184
@@ -14,9 +14,10 @@
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
@@ -54,10 +55,10 @@ static INT32 format2bpp(GLTextureFormat_t format)
|
||||
// It is now split from it for my sanity! (and the sanity of others)
|
||||
// -- Monster Iestyn (13/02/19)
|
||||
static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap,
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
{
|
||||
fixed_t yfrac, position, count;
|
||||
UINT8 *dest;
|
||||
@@ -73,6 +74,9 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
|
||||
(void)patchheight; // This parameter is unused
|
||||
|
||||
if (!mipmap)
|
||||
return;
|
||||
|
||||
if (originPatch) // originPatch can be NULL here, unlike in the software version
|
||||
originy = originPatch->originy;
|
||||
|
||||
@@ -108,14 +112,14 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
count--;
|
||||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
alpha = 0xff;
|
||||
alpha = 0xFF;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
// Make pixel transparent if chroma keyed
|
||||
if ((mipmap && mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if (mipmap->colormap)
|
||||
if (mipmap && mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
@@ -123,7 +127,8 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
switch (bpp)
|
||||
{
|
||||
case 2 : texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
case 2 : // uhhhhhhhh..........
|
||||
texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
case 3 : colortemp = palette[texel];
|
||||
@@ -141,6 +146,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
dest += blockmodulo;
|
||||
yfrac += yfracstep;
|
||||
}
|
||||
|
||||
patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4);
|
||||
}
|
||||
}
|
||||
@@ -166,7 +172,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
|
||||
if (pwidth <= 0 || pheight <= 0)
|
||||
return;
|
||||
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
ncols = pwidth;
|
||||
@@ -182,6 +188,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -216,7 +223,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
|
||||
if (texture->width <= 0 || texture->height <= 0)
|
||||
return;
|
||||
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
x1 = patch->originx;
|
||||
@@ -260,6 +267,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawTexturePatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -275,15 +283,15 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
|
||||
{
|
||||
UINT8 *block;
|
||||
INT32 bpp, i;
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
INT32 blocksize = (grMipmap->width * grMipmap->height);
|
||||
INT32 blocksize = (glMipmap->width * glMipmap->height);
|
||||
|
||||
bpp = format2bpp(grMipmap->format);
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
|
||||
bpp = format2bpp(glMipmap->format);
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(glMipmap->data));
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
@@ -303,7 +311,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
// Create a composite texture from patches, adapt the texture size to a power of 2
|
||||
// height and width for the hardware texture cache.
|
||||
//
|
||||
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noencore)
|
||||
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noencore)
|
||||
{
|
||||
UINT8 *block;
|
||||
texture_t *texture;
|
||||
@@ -313,7 +321,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
|
||||
INT32 i;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
||||
|
||||
RGBA_t *palette;
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
@@ -328,30 +336,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
)
|
||||
{
|
||||
skyspecial = true;
|
||||
grtex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
|
||||
gltex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
|
||||
}
|
||||
else
|
||||
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
grtex->mipmap.width = (UINT16)texture->width;
|
||||
grtex->mipmap.height = (UINT16)texture->height;
|
||||
gltex->mipmap.width = (UINT16)(texture->width);
|
||||
gltex->mipmap.height = (UINT16)(texture->height);
|
||||
|
||||
if (skyspecial)
|
||||
grtex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
else
|
||||
grtex->mipmap.format = textureformat;
|
||||
gltex->mipmap.format = textureformat;
|
||||
|
||||
grtex->mipmap.colormap = colormaps;
|
||||
gltex->mipmap.colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (encoremap && !noencore)
|
||||
grtex->mipmap.colormap += COLORMAP_REMAPOFFSET;
|
||||
gltex->mipmap.colormap += COLORMAP_REMAPOFFSET;
|
||||
#endif
|
||||
|
||||
|
||||
blockwidth = texture->width;
|
||||
blockheight = texture->height;
|
||||
blocksize = (blockwidth * blockheight);
|
||||
block = MakeBlock(&grtex->mipmap);
|
||||
block = MakeBlock(&gltex->mipmap);
|
||||
|
||||
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
||||
{
|
||||
@@ -359,14 +367,17 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
RGBA_t col;
|
||||
|
||||
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
|
||||
|
||||
for (j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
{
|
||||
block[4*(j*blockwidth+i)+0] = col.s.red;
|
||||
block[4*(j*blockwidth+i)+1] = col.s.green;
|
||||
block[4*(j*blockwidth+i)+2] = col.s.blue;
|
||||
block[4*(j*blockwidth+i)+3] = 0xff;
|
||||
int idx = (j*blockwidth+i);
|
||||
|
||||
block[4*idx+0] = col.s.red;
|
||||
block[4*idx+1] = col.s.green;
|
||||
block[4*idx+2] = col.s.blue;
|
||||
block[4*idx+3] = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,86 +386,81 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
HWR_DrawTexturePatchInCache(&grtex->mipmap,
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
if (format2bpp(grtex->mipmap.format)==4)
|
||||
if (format2bpp(gltex->mipmap.format) == 4)
|
||||
{
|
||||
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
|
||||
{
|
||||
if (block[i] != 0)
|
||||
continue;
|
||||
|
||||
grtex->mipmap.flags |= TF_TRANSPARENT;
|
||||
gltex->mipmap.flags |= TF_TRANSPARENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grtex->scaleX = 1.0f/(texture->width*FRACUNIT);
|
||||
grtex->scaleY = 1.0f/(texture->height*FRACUNIT);
|
||||
gltex->scaleX = 1.0f/(texture->width*FRACUNIT);
|
||||
gltex->scaleY = 1.0f/(texture->height*FRACUNIT);
|
||||
}
|
||||
|
||||
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
|
||||
void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
|
||||
// patch may be NULL if glMipmap has been initialised already and makebitmap is false
|
||||
void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
|
||||
{
|
||||
// don't do it twice (like a cache)
|
||||
if (grMipmap->width == 0)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
// save the original patch header so that the GLPatch can be casted
|
||||
// into a standard patch_t struct and the existing code can get the
|
||||
// orginal patch dimensions and offsets.
|
||||
grPatch->width = SHORT(patch->width);
|
||||
grPatch->height = SHORT(patch->height);
|
||||
grPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
grPatch->topoffset = SHORT(patch->topoffset);
|
||||
glPatch->width = SHORT(patch->width);
|
||||
glPatch->height = SHORT(patch->height);
|
||||
glPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
glPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
//grMipmap->width = (UINT16)SHORT(patch->width);
|
||||
//grMipmap->height = (UINT16)SHORT(patch->height);
|
||||
grMipmap->width = grMipmap->height = 1;
|
||||
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
|
||||
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
|
||||
glMipmap->width = glMipmap->height = 1;
|
||||
while (glMipmap->width < glPatch->width) glMipmap->width <<= 1;
|
||||
while (glMipmap->height < glPatch->height) glMipmap->height <<= 1;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grMipmap->flags = 0;
|
||||
glMipmap->flags = 0;
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = patchformat;
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
|
||||
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
|
||||
glMipmap->format = patchformat;
|
||||
|
||||
//glPatch->max_s = glPatch->max_t = 1.0f;
|
||||
glPatch->max_s = (float)glPatch->width / (float)glMipmap->width;
|
||||
glPatch->max_t = (float)glPatch->height / (float)glMipmap->height;
|
||||
}
|
||||
|
||||
Z_Free(grMipmap->data);
|
||||
grMipmap->data = NULL;
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
|
||||
if (makebitmap)
|
||||
{
|
||||
MakeBlock(grMipmap);
|
||||
HWR_DrawPatchInCache(grMipmap,
|
||||
grMipmap->width, grMipmap->height,
|
||||
grPatch->width, grPatch->height,
|
||||
MakeBlock(glMipmap);
|
||||
|
||||
HWR_DrawPatchInCache(glMipmap,
|
||||
glMipmap->width, glMipmap->height,
|
||||
glPatch->width, glPatch->height,
|
||||
patch);
|
||||
}
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
}
|
||||
|
||||
// =================================================
|
||||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
static size_t gr_numtextures;
|
||||
static GLMapTexture_t *gr_textures; // For all textures
|
||||
static size_t gl_numtextures;
|
||||
static GLMapTexture_t *gl_textures; // For all textures
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
{
|
||||
gr_numtextures = 0;
|
||||
gr_textures = NULL;
|
||||
gl_numtextures = 0;
|
||||
gl_textures = NULL;
|
||||
}
|
||||
|
||||
// Callback function for HWR_FreeTextureCache.
|
||||
@@ -494,7 +500,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
GL_DeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
@@ -505,7 +511,7 @@ void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
GL_ClearMipMapCache();
|
||||
|
||||
// free all hardware-converted graphics cached in the heap
|
||||
// our gool is only the textures since user of the texture is the texture cache
|
||||
@@ -526,10 +532,10 @@ void HWR_FreeTextureCache(void)
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
if (gr_textures)
|
||||
free(gr_textures);
|
||||
gr_textures = NULL;
|
||||
gr_numtextures = 0;
|
||||
if (gl_textures)
|
||||
free(gl_textures);
|
||||
gl_textures = NULL;
|
||||
gl_numtextures = 0;
|
||||
}
|
||||
|
||||
void HWR_LoadTextures(size_t pnumtextures)
|
||||
@@ -537,13 +543,13 @@ void HWR_LoadTextures(size_t pnumtextures)
|
||||
// we must free it since numtextures changed
|
||||
HWR_FreeTextureCache();
|
||||
|
||||
gr_numtextures = pnumtextures;
|
||||
gl_numtextures = pnumtextures;
|
||||
#ifdef GLENCORE
|
||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
|
||||
gl_textures = calloc(pnumtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
|
||||
#else
|
||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
|
||||
gl_textures = calloc(pnumtextures, sizeof (*gl_textures));
|
||||
#endif
|
||||
if (gr_textures == NULL)
|
||||
if (gl_textures == NULL)
|
||||
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
|
||||
}
|
||||
|
||||
@@ -552,9 +558,9 @@ void HWR_LoadTextures(size_t pnumtextures)
|
||||
// --------------------------------------------------------------------------
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
{
|
||||
GLMapTexture_t *grtex;
|
||||
GLMapTexture_t *gltex;
|
||||
|
||||
if (tex < 0 || tex >= (signed)gr_numtextures)
|
||||
if (tex < 0 || tex >= (signed)gl_numtextures)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
|
||||
@@ -563,25 +569,25 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
#endif
|
||||
}
|
||||
#ifdef GLENCORE
|
||||
grtex = &gr_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
|
||||
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
|
||||
#else
|
||||
grtex = &gr_textures[tex];
|
||||
gltex = &gl_textures[tex];
|
||||
#endif
|
||||
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, grtex, noencore);
|
||||
if (!gltex->mipmap.data && !gltex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, gltex, noencore);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
if (!gltex->mipmap.downloaded)
|
||||
GL_SetTexture(&gltex->mipmap);
|
||||
HWR_SetCurrentTexture(&gltex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gltex->mipmap.data, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
return grtex;
|
||||
return gltex;
|
||||
}
|
||||
|
||||
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
|
||||
{
|
||||
#ifdef GLENCORE
|
||||
UINT8 *flat;
|
||||
@@ -590,8 +596,8 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
size_t size, pflatsize;
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
glMipmap->format = GL_TEXFMT_P_8;
|
||||
glMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
|
||||
size = W_LumpLength(flatlumpnum);
|
||||
|
||||
@@ -619,21 +625,21 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
pflatsize = 64;
|
||||
break;
|
||||
}
|
||||
grMipmap->width = (UINT16)pflatsize;
|
||||
grMipmap->height = (UINT16)pflatsize;
|
||||
glMipmap->width = (UINT16)pflatsize;
|
||||
glMipmap->height = (UINT16)pflatsize;
|
||||
|
||||
// the flat raw data needn't be converted with palettized textures
|
||||
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
|
||||
PU_HWRCACHE, &grMipmap->data));
|
||||
PU_HWRCACHE, &glMipmap->data));
|
||||
|
||||
#ifdef GLENCORE
|
||||
flat = grMipmap->data;
|
||||
flat = glMipmap->data;
|
||||
for (steppy = 0; steppy < size; steppy++)
|
||||
{
|
||||
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
continue;
|
||||
|
||||
flat[steppy] = grMipmap->colormap[flat[steppy]];
|
||||
flat[steppy] = glMipmap->colormap[flat[steppy]];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -641,117 +647,117 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
||||
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
grmip->colormap = colormaps;
|
||||
glMipmap->colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (!noencoremap && encoremap)
|
||||
grmip->colormap += COLORMAP_REMAPOFFSET;
|
||||
glMipmap->colormap += COLORMAP_REMAPOFFSET;
|
||||
#endif
|
||||
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFlat(glMipmap, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
if (!glMipmap->downloaded)
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
|
||||
// : load it first in doom cache if not already
|
||||
//
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
|
||||
{
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
{
|
||||
patch_t *patch = gpatch->rawpatch;
|
||||
patch_t *patch = glPatch->rawpatch;
|
||||
if (!patch)
|
||||
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, gpatch, grmip, true);
|
||||
patch = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, glPatch, glMipmap, true);
|
||||
|
||||
// You can't free rawpatch for some reason?
|
||||
// (Obviously I can't, sprite rotation needs that...)
|
||||
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(patch);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
if (!glMipmap->downloaded)
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use
|
||||
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
|
||||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
void HWR_GetPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
|
||||
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
|
||||
{
|
||||
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
||||
// flush the software patch before the conversion! oh yeah I suffered
|
||||
patch_t *ptr = gpatch->rawpatch;
|
||||
patch_t *ptr = glPatch->rawpatch;
|
||||
if (!ptr)
|
||||
ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
|
||||
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, true);
|
||||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
if (!glPatch->mipmap->downloaded)
|
||||
GL_SetTexture(glPatch->mipmap);
|
||||
HWR_SetCurrentTexture(glPatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -------------------+
|
||||
// HWR_GetMappedPatch : Same as HWR_GetPatch for sprite color
|
||||
// -------------------+
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
void HWR_GetMappedPatch(GLPatch_t *glPatch, const UINT8 *colormap)
|
||||
{
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
// Blatant hack for encore colormapping aside...
|
||||
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
HWR_GetPatch(glPatch);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (grmip->colormap != colormap)
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
HWR_LoadMappedPatch(grmip, gpatch);
|
||||
HWR_LoadMappedPatch(glMipmap, glPatch);
|
||||
return;
|
||||
}
|
||||
// not found, create it!
|
||||
@@ -761,38 +767,38 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
grmip->nextcolormap = newmip;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
|
||||
newmip->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newmip, gpatch);
|
||||
newMipmap->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newMipmap, glPatch);
|
||||
}
|
||||
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
if (!gpatch)
|
||||
if (!glPatch)
|
||||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
{
|
||||
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
|
||||
GLPatch_t *grpatch;
|
||||
GLPatch_t *glPatch;
|
||||
|
||||
if (!(grpatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
if (!(glPatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
grpatch->wadnum = wadnum;
|
||||
grpatch->lumpnum = lumpnum;
|
||||
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, grpatch);
|
||||
glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
glPatch->wadnum = wadnum;
|
||||
glPatch->lumpnum = lumpnum;
|
||||
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, glPatch);
|
||||
}
|
||||
|
||||
return grpatch;
|
||||
return glPatch;
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
||||
@@ -840,14 +846,14 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
||||
Z_Free(flat);
|
||||
}
|
||||
|
||||
static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
||||
static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
|
||||
{
|
||||
size_t size;
|
||||
UINT16 fmheight = 0, fmwidth = 0;
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
|
||||
grMipmap->flags = 0;
|
||||
glMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
|
||||
glMipmap->flags = 0;
|
||||
|
||||
size = W_LumpLength(fademasklumpnum);
|
||||
|
||||
@@ -876,28 +882,28 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
||||
}
|
||||
|
||||
// Thankfully, this will still work for this scenario
|
||||
grMipmap->width = fmwidth;
|
||||
grMipmap->height = fmheight;
|
||||
glMipmap->width = fmwidth;
|
||||
glMipmap->height = fmheight;
|
||||
|
||||
MakeBlock(grMipmap);
|
||||
MakeBlock(glMipmap);
|
||||
|
||||
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
|
||||
HWR_DrawFadeMaskInCache(glMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
|
||||
// I DO need to convert this because it isn't power of 2 and we need the alpha
|
||||
}
|
||||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *grmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFadeMask(grmip, fademasklumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(grmip);
|
||||
GL_SetTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// =================================================
|
||||
@@ -909,15 +915,15 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
// set the palette for palette postprocessing
|
||||
if (cv_grpalettedepth.value == 16)
|
||||
if (cv_glpalettedepth.value == 16)
|
||||
{
|
||||
// crush to 16-bit rgb565, like software currently does in the standard configuration
|
||||
// Note: Software's screenshots have the 24-bit palette, but the screen gets
|
||||
// the 16-bit version! For making comparison screenshots either use an external screenshot
|
||||
// tool or set the palette depth to 24 bits.
|
||||
RGBA_t crushed_palette[256];
|
||||
int i;
|
||||
for (i = 0; i < 256; i++)
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
float fred = (float)(palette[i].s.red >> 3);
|
||||
float fgreen = (float)(palette[i].s.green >> 2);
|
||||
@@ -927,21 +933,21 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
crushed_palette[i].s.blue = (UINT8)(fblue / 31.0f * 255.0f);
|
||||
crushed_palette[i].s.alpha = 255;
|
||||
}
|
||||
HWD.pfnSetScreenPalette(crushed_palette);
|
||||
GL_SetScreenPalette(crushed_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetScreenPalette(palette);
|
||||
GL_SetScreenPalette(palette);
|
||||
}
|
||||
|
||||
// this part is responsible for keeping track of the palette OUTSIDE of a level.
|
||||
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
|
||||
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
|
||||
HWR_SetMapPalette();
|
||||
}
|
||||
else
|
||||
{
|
||||
// set the palette for the textures
|
||||
HWD.pfnSetTexturePalette(palette);
|
||||
GL_SetPalette(palette);
|
||||
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
|
||||
memset(mapPalette, 0, sizeof(mapPalette));
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
@@ -974,7 +980,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
HWD.pfnSetPaletteLookup(lut);
|
||||
GL_SetPaletteLookup(lut);
|
||||
Z_Free(lut);
|
||||
}
|
||||
|
||||
@@ -987,11 +993,9 @@ void HWR_SetMapPalette(void)
|
||||
RGBA_t *palette;
|
||||
int i;
|
||||
|
||||
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
|
||||
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
|
||||
{
|
||||
// outside of a level, pMasterPalette should have PLAYPAL ready for us
|
||||
//palette = pMasterPalette; // we dont have this in kart so just use pLocalPalette as before
|
||||
|
||||
// outside of a level, pLocalPalette should have PLAYPAL ready for us
|
||||
palette = pLocalPalette;
|
||||
}
|
||||
else
|
||||
@@ -1001,8 +1005,10 @@ void HWR_SetMapPalette(void)
|
||||
lumpnum_t lumpnum = W_GetNumForName(GetPalette());
|
||||
size_t palsize = W_LumpLength(lumpnum);
|
||||
UINT8 *RGB_data;
|
||||
|
||||
if (palsize < 768) // 256 * 3
|
||||
I_Error("HWR_SetMapPalette: A programmer assumed palette lumps are at least 768 bytes long, but apparently this was a wrong assumption!\n");
|
||||
|
||||
RGB_data = W_CacheLumpNum(lumpnum, PU_CACHE);
|
||||
// we got the RGB palette now, but we need it in RGBA format.
|
||||
for (i = 0; i < 256; i++)
|
||||
@@ -1022,7 +1028,7 @@ void HWR_SetMapPalette(void)
|
||||
// in palette rendering mode, this means that all rgba textures now have wrong colors
|
||||
// and the lookup table is outdated
|
||||
HWR_SetPaletteLookup(mapPalette);
|
||||
HWD.pfnSetTexturePalette(mapPalette);
|
||||
GL_SetPalette(mapPalette);
|
||||
|
||||
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
|
||||
{
|
||||
@@ -1045,12 +1051,11 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
|
||||
for (i = 0; i < 256 * 32; i++)
|
||||
hw_lighttable[i] = palette[lighttable[i]];
|
||||
|
||||
id = HWD.pfnCreateLightTable(hw_lighttable);
|
||||
id = GL_CreateLightTable(hw_lighttable);
|
||||
Z_Free(hw_lighttable);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
// get hwr lighttable id for colormap, create it if it doesn't already exist
|
||||
UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
||||
{
|
||||
@@ -1082,7 +1087,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
||||
void HWR_ClearLightTables(void)
|
||||
{
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnClearLightTables();
|
||||
GL_ClearLightTables();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
@@ -333,11 +333,11 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
// but at least it doesn't overestimate too much...
|
||||
clipfov = atan(1 / projMatrix[0]) * 360 / M_PI;
|
||||
clipfov = atan(1 / projMatrix[0]) * 360 / M_PIl;
|
||||
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
|
||||
if (floatangle >= 180.0)
|
||||
return 0xffffffff;
|
||||
a1 = (angle_t)(ANG1 * (int)floatangle);
|
||||
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
|
||||
return a1;
|
||||
}
|
||||
|
||||
@@ -458,4 +458,4 @@ boolean gld_SphereInFrustum(float x, float y, float z, float radius)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -33,16 +33,18 @@ typedef enum GLTextureFormat_e
|
||||
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
|
||||
} GLTextureFormat_t;
|
||||
|
||||
// data holds the address of the graphics data cached in heap memory
|
||||
// NULL if the texture is not in Doom heap cache.
|
||||
// Texture information (misleadingly named "mipmap" all over the code.)
|
||||
// The *data pointer holds the address of the graphics data cached in heap memory.
|
||||
// NULL if the texture is not in SRB2's heap cache.
|
||||
struct GLMipmap_s
|
||||
{
|
||||
// for UpdateTexture
|
||||
GLTextureFormat_t format;
|
||||
void *data;
|
||||
|
||||
UINT32 flags;
|
||||
UINT16 width, height;
|
||||
UINT32 downloaded; // tex_downloaded
|
||||
UINT32 downloaded; // The GPU has this texture.
|
||||
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
@@ -50,12 +52,12 @@ struct GLMipmap_s
|
||||
typedef struct GLMipmap_s GLMipmap_t;
|
||||
|
||||
//
|
||||
// Doom texture info, as cached for hardware rendering
|
||||
// Level textures, as cached for hardware rendering.
|
||||
//
|
||||
struct GLMapTexture_s
|
||||
{
|
||||
GLMipmap_t mipmap;
|
||||
float scaleX; //used for scaling textures on walls
|
||||
float scaleX; //used for scaling textures on walls
|
||||
float scaleY;
|
||||
};
|
||||
typedef struct GLMapTexture_s GLMapTexture_t;
|
||||
|
||||
+41
-12
@@ -121,8 +121,6 @@ typedef struct
|
||||
poly_t *planepoly; // the generated convex polygon
|
||||
} extrasubsector_t;
|
||||
|
||||
//here lies gr_vissprite
|
||||
|
||||
// Kart features
|
||||
#define USE_FTRANSFORM_ANGLEZ
|
||||
#define USE_FTRANSFORM_MIRROR
|
||||
@@ -134,14 +132,14 @@ typedef struct
|
||||
{
|
||||
FLOAT x,y,z; // position
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2,anglez2; // secondaries
|
||||
FLOAT anglex, angley, anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2, anglez2; // secondaries
|
||||
#else
|
||||
FLOAT anglex,angley; // aimingangle / viewangle
|
||||
FLOAT anglex, angley; // aimingangle / viewangle
|
||||
FLOAT anglex2; // secondaries
|
||||
#endif
|
||||
FLOAT scalex,scaley,scalez;
|
||||
FLOAT spritexscale,spriteyscale;
|
||||
FLOAT scalex, scaley, scalez;
|
||||
FLOAT spritexscale, spriteyscale;
|
||||
FLOAT fovxangle, fovyangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
@@ -166,6 +164,41 @@ typedef struct
|
||||
FLOAT s,t;
|
||||
} FOutVector;
|
||||
|
||||
typedef struct vbo_vertex_s
|
||||
{
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
unsigned char r, g, b, a;
|
||||
} gl_skyvertex_t;
|
||||
|
||||
typedef enum gl_skyloopmode_e
|
||||
{
|
||||
HWD_SKYLOOP_FAN,
|
||||
HWD_SKYLOOP_STRIP
|
||||
} gl_skyloopmode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gl_skyloopmode_t mode;
|
||||
int vertexcount;
|
||||
int vertexindex;
|
||||
boolean use_texture;
|
||||
} gl_skyloopdef_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int vbo;
|
||||
int rows, columns;
|
||||
int loopcount;
|
||||
|
||||
int detail, vertex_count;
|
||||
int texture, width, height;
|
||||
boolean rebuild; // VBO needs to be rebuilt
|
||||
|
||||
gl_skyloopdef_t *loops;
|
||||
gl_skyvertex_t *data;
|
||||
} gl_sky_t;
|
||||
|
||||
// Shader targets used to render specific types of geometry.
|
||||
// A shader target is resolved to an actual shader with HWR_GetShaderFromTarget.
|
||||
// The shader returned may be a base shader or a custom shader.
|
||||
@@ -173,7 +206,6 @@ enum
|
||||
{
|
||||
SHADER_NONE = -1,
|
||||
SHADER_FLOOR = 0,
|
||||
SHADER_SHADOW,
|
||||
SHADER_WALL,
|
||||
SHADER_SPRITE,
|
||||
SHADER_MODEL,
|
||||
@@ -204,7 +236,6 @@ enum hwdshaderstage
|
||||
|
||||
typedef enum hwdshaderstage hwdshaderstage_t;
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// RENDER MODES
|
||||
// ==========================================================================
|
||||
@@ -289,9 +320,6 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
#ifdef USE_FBO_OGL
|
||||
HWD_SET_FRAMEBUFFER,
|
||||
#endif
|
||||
HWD_SET_SHADERS,
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
@@ -346,6 +374,7 @@ enum hwdscreentexture
|
||||
HWD_SCREENTEXTURE_WIPE_END, // destination image for the wipe/fade effect
|
||||
HWD_SCREENTEXTURE_GENERIC1, // underwater/heat effect, intermission background
|
||||
HWD_SCREENTEXTURE_GENERIC2, // palette-based colormap fade, final screen texture
|
||||
HWD_SCREENTEXTURE_VHS,
|
||||
NUMSCREENTEXTURES, // (generic3 is unused if palette rendering is disabled)
|
||||
};
|
||||
typedef enum hwdscreentexture hwdscreentexture_t;
|
||||
|
||||
+50
-49
@@ -18,9 +18,10 @@
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
|
||||
#include "../m_misc.h" //FIL_WriteFile()
|
||||
#include "../r_draw.h" //viewborderlump
|
||||
@@ -122,7 +123,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||
flags |= PF_ForceWrapY;
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
@@ -303,10 +304,10 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
@@ -460,10 +461,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -539,7 +540,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// BTW, I see we put 0 for PFs, and If I'm right, that
|
||||
// means we take the previous PFs as default
|
||||
// how can we be sure they are ok?
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -552,33 +553,33 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// 0--1
|
||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
|
||||
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering() && cv_grscreentextures.value)
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
|
||||
{
|
||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||
|
||||
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
||||
Surf.LightInfo.light_level = strength;
|
||||
HWD.pfnMakeScreenTexture(scr_tex);
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_MakeScreenTexture(scr_tex);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
GL_UnSetShader();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -588,21 +589,21 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
else
|
||||
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
GL_DrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -629,7 +630,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
|
||||
@@ -652,17 +653,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
||||
INT32 basewindowx, basewindowy;
|
||||
GLPatch_t *patch;
|
||||
|
||||
// if (gr_viewwidth == vid.width)
|
||||
// if (gl_viewwidth == vid.width)
|
||||
// return;
|
||||
|
||||
if (!clearlines)
|
||||
clearlines = BASEVIDHEIGHT; // refresh all
|
||||
|
||||
// calc view size based on original game resolution
|
||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy));
|
||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy));
|
||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowx), vid.fdupx));
|
||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
|
||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
|
||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdupx));
|
||||
|
||||
// top
|
||||
HWR_DrawFlatFill(0, 0,
|
||||
@@ -776,16 +777,16 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
||||
F2DCoord v1, v2;
|
||||
RGBA_t color_rgba;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
|
||||
color_rgba = palette[color&0xFF];
|
||||
|
||||
|
||||
v1.x = ((float)fl->a.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v1.y = ((float)fl->a.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
||||
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
||||
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
||||
GL_Draw2DLine(&v1, &v2, color_rgba);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -879,7 +880,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
|
||||
Surf.PolyColor = palette[color&0xFF];
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
GL_DrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
@@ -918,7 +919,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -989,7 +990,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1029,7 +1030,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1108,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
@@ -1191,7 +1192,7 @@ UINT8 *HWR_GetScreenshot(void)
|
||||
return NULL;
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1208,7 @@ boolean HWR_Screenshot(const char *pathname)
|
||||
}
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief imports/exports for the GPU hardware low-level interface API
|
||||
|
||||
#ifndef __HWR_DRV_H__
|
||||
#define __HWR_DRV_H__
|
||||
|
||||
// this must be here 19991024 by Kin
|
||||
#include "../screen.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#include "hw_dll.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
// ==========================================================================
|
||||
// STANDARD DLL EXPORTS
|
||||
// ==========================================================================
|
||||
|
||||
EXPORT boolean HWRAPI(Init) (void);
|
||||
EXPORT void HWRAPI(SetupGLInfo) (void);
|
||||
EXPORT void HWRAPI(SetTexturePalette) (RGBA_t *ppal);
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
|
||||
//Hurdler: added for backward compatibility
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
//Hurdler: added for new development
|
||||
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
// jimita
|
||||
EXPORT boolean HWRAPI(InitShaders) (void);
|
||||
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage);
|
||||
EXPORT boolean HWRAPI(CompileShader) (int slot);
|
||||
EXPORT void HWRAPI(SetShader) (int slot);
|
||||
EXPORT void HWRAPI(UnSetShader) (void);
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut);
|
||||
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable);
|
||||
EXPORT void HWRAPI(ClearLightTables)(void);
|
||||
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette);
|
||||
|
||||
// ==========================================================================
|
||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||
// ==========================================================================
|
||||
|
||||
#if !defined (_CREATE_DLL_)
|
||||
|
||||
struct hwdriver_s
|
||||
{
|
||||
Init pfnInit;
|
||||
SetupGLInfo pfnSetupGLInfo;
|
||||
SetTexturePalette pfnSetTexturePalette;
|
||||
FinishUpdate pfnFinishUpdate;
|
||||
Draw2DLine pfnDraw2DLine;
|
||||
DrawPolygon pfnDrawPolygon;
|
||||
DrawIndexedTriangles pfnDrawIndexedTriangles;
|
||||
SetBlend pfnSetBlend;
|
||||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
DeleteTexture pfnDeleteTexture;
|
||||
ReadScreenTexture pfnReadScreenTexture;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
SetSpecialState pfnSetSpecialState;
|
||||
DrawModel pfnDrawModel;
|
||||
CreateModelVBOs pfnCreateModelVBOs;
|
||||
SetTransform pfnSetTransform;
|
||||
GetTextureUsed pfnGetTextureUsed;
|
||||
PostImgRedraw pfnPostImgRedraw;
|
||||
FlushScreenTextures pfnFlushScreenTextures;
|
||||
DoScreenWipe pfnDoScreenWipe;
|
||||
DrawScreenTexture pfnDrawScreenTexture;
|
||||
MakeScreenTexture pfnMakeScreenTexture;
|
||||
RenderVhsEffect pfnRenderVhsEffect;
|
||||
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
||||
|
||||
RenderSkyDome pfnRenderSkyDome;
|
||||
|
||||
InitShaders pfnInitShaders;
|
||||
LoadShader pfnLoadShader;
|
||||
CompileShader pfnCompileShader;
|
||||
SetShader pfnSetShader;
|
||||
UnSetShader pfnUnSetShader;
|
||||
|
||||
SetShaderInfo pfnSetShaderInfo;
|
||||
|
||||
SetPaletteLookup pfnSetPaletteLookup;
|
||||
CreateLightTable pfnCreateLightTable;
|
||||
ClearLightTables pfnClearLightTables;
|
||||
SetScreenPalette pfnSetScreenPalette;
|
||||
};
|
||||
|
||||
extern struct hwdriver_s hwdriver;
|
||||
|
||||
#define HWD hwdriver
|
||||
|
||||
#endif //not defined _CREATE_DLL_
|
||||
|
||||
#endif //__HWR_DRV_H__
|
||||
@@ -0,0 +1,79 @@
|
||||
// SONIC ROBO BLAST 2 Kart
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_gl.h
|
||||
/// \brief OpenGL low-level interface API
|
||||
|
||||
#ifndef __HWR_GL_H__
|
||||
#define __HWR_GL_H__
|
||||
|
||||
#include "../screen.h"
|
||||
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#define SCREENVERTS 10
|
||||
|
||||
boolean GL_Init(void);
|
||||
void GL_FinishUpdate(INT32 waitvbl);
|
||||
void SetupGLInfo(void);
|
||||
|
||||
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
|
||||
void GL_SetTransform(FTransform *stransform);
|
||||
void GL_SetBlend(FBITFIELD PolyFlags);
|
||||
void GL_SetPalette(RGBA_t *palette);
|
||||
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
|
||||
|
||||
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
|
||||
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
#define GL_DrawModel(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface) GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface)
|
||||
|
||||
void GL_RenderSkyDome(gl_sky_t *sky);
|
||||
|
||||
void GL_SetTexture(GLMipmap_t *pTexInfo);
|
||||
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
|
||||
|
||||
void GL_Flush(void);
|
||||
#define GL_ClearMipMapCache GL_Flush
|
||||
|
||||
INT32 GL_GetTextureUsed(void);
|
||||
|
||||
void GL_CreateModelVBOs(model_t *model);
|
||||
|
||||
void GL_ReadScreenTexture(int tex, UINT16 *dst_data);
|
||||
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
|
||||
void GL_MakeScreenTexture(int tex);
|
||||
void GL_FlushScreenTextures(void);
|
||||
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
|
||||
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
boolean GL_InitShaders(void);
|
||||
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean GL_CompileShader(int slot);
|
||||
void GL_SetShader(int slot);
|
||||
void GL_UnSetShader(void);
|
||||
|
||||
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void GL_SetPaletteLookup(UINT8 *lut);
|
||||
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
|
||||
void GL_ClearLightTables(void);
|
||||
void GL_SetScreenPalette(RGBA_t *palette);
|
||||
|
||||
#endif // __HWR_GL_H__
|
||||
+3
-12
@@ -23,7 +23,7 @@
|
||||
|
||||
// needed for sprite rendering
|
||||
// equivalent of the software renderer's vissprites
|
||||
typedef struct gr_vissprite_s
|
||||
typedef struct gl_vissprite_s
|
||||
{
|
||||
float x1, x2;
|
||||
float z1, z2;
|
||||
@@ -32,7 +32,6 @@ typedef struct gr_vissprite_s
|
||||
float scale;
|
||||
float spritexscale, spriteyscale;
|
||||
float spritexoffset, spriteyoffset;
|
||||
UINT32 renderflags;
|
||||
GLPatch_t *gpatch;
|
||||
boolean flip;
|
||||
UINT8 translucency; //alpha level 0-255
|
||||
@@ -42,7 +41,7 @@ typedef struct gr_vissprite_s
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
UINT8 *colormap;
|
||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||
} gr_vissprite_t;
|
||||
} gl_vissprite_t;
|
||||
|
||||
// --------
|
||||
// hw_bsp.c
|
||||
@@ -64,7 +63,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore);
|
||||
void HWR_GetPatch(GLPatch_t *gpatch);
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
|
||||
void HWR_MakePatch(patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
|
||||
void HWR_MakePatch(patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||
void HWR_SetPalette(RGBA_t *palette);
|
||||
|
||||
@@ -82,14 +81,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
||||
extern INT32 patchformat;
|
||||
extern INT32 textureformat;
|
||||
|
||||
// --------
|
||||
// hw_main.c // originally hw_drawnodes.c from HWPortal branch
|
||||
// --------
|
||||
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
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);
|
||||
|
||||
// --------
|
||||
// hw_shaders.c
|
||||
// --------
|
||||
|
||||
+1393
-1526
File diff suppressed because it is too large.
Load diff
+67
-61
@@ -23,6 +23,7 @@
|
||||
#include "hw_glob.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_portal.h"
|
||||
|
||||
#include "../am_map.h"
|
||||
#include "../d_player.h"
|
||||
@@ -35,15 +36,32 @@
|
||||
void HWR_Startup(void);
|
||||
void HWR_Shutdown(void);
|
||||
|
||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
|
||||
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
|
||||
|
||||
extern float gr_basewindowcenterx, gr_basewindowcentery;
|
||||
extern float gl_basewindowcenterx, gl_basewindowcentery;
|
||||
|
||||
extern unsigned msaa;
|
||||
extern boolean a2c;
|
||||
|
||||
extern FTransform atransform;
|
||||
extern float gr_viewsin, gr_viewcos;
|
||||
extern float gl_viewsin, gl_viewcos;
|
||||
|
||||
extern boolean gl_drawing_stencil;
|
||||
|
||||
extern seg_t *gl_curline;
|
||||
extern side_t *gl_sidedef;
|
||||
extern line_t *gl_linedef;
|
||||
extern sector_t *gl_frontsector;
|
||||
extern sector_t *gl_backsector;
|
||||
|
||||
enum
|
||||
{
|
||||
HWR_STENCIL_NORMAL,
|
||||
HWR_STENCIL_BEGIN,
|
||||
HWR_STENCIL_REVERSE,
|
||||
HWR_STENCIL_DEPTH,
|
||||
HWR_STENCIL_SKY
|
||||
};
|
||||
|
||||
// Performance stats
|
||||
extern ps_metric_t ps_hw_nodesorttime;
|
||||
@@ -62,7 +80,7 @@ extern ps_metric_t ps_hw_numcolors;
|
||||
extern ps_metric_t ps_hw_batchsorttime;
|
||||
extern ps_metric_t ps_hw_batchdrawtime;
|
||||
|
||||
extern boolean gr_shadersavailable;
|
||||
extern boolean gl_shadersavailable;
|
||||
|
||||
// hw_draw.c
|
||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
||||
@@ -81,24 +99,28 @@ UINT8 *HWR_GetScreenshot(void);
|
||||
boolean HWR_Screenshot(const char *lbmname);
|
||||
|
||||
// hw_main.c
|
||||
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox);
|
||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
void HWR_SetViewSize(void);
|
||||
void HWR_AddCommands(void);
|
||||
|
||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
|
||||
|
||||
void HWR_ClearSkyDome(void);
|
||||
void HWR_BuildSkyDome(void);
|
||||
|
||||
void HWR_SetTransform(float fpov, player_t *player);
|
||||
void HWR_ClearClipper(void);
|
||||
void HWR_SetStencilState(int state, int level);
|
||||
|
||||
boolean HWR_UseShader(void);
|
||||
boolean HWR_ShouldUsePaletteRendering(void);
|
||||
boolean HWR_PalRenderFlashpal(void);
|
||||
void HWR_TogglePaletteRendering(void);
|
||||
|
||||
// My original intention was to split hw_main.c
|
||||
// into files like hw_bsp.c, hw_sprites.c...
|
||||
|
||||
// hw_main.c: Lighting and fog
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
|
||||
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
|
||||
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
|
||||
@@ -106,79 +128,63 @@ FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
INT32 HWR_GetTextureUsed(void);
|
||||
|
||||
// hw_main.c: Post-rendering
|
||||
void HWR_DoPostProcessor(player_t *player);
|
||||
void HWR_StartScreenWipe(void);
|
||||
void HWR_EndScreenWipe(void);
|
||||
void HWR_DrawIntermissionBG(void);
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
|
||||
|
||||
// hw_main.c: Planes
|
||||
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
|
||||
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
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);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
// hw_main.c: Segs
|
||||
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
||||
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
// moved HWR_SplitWall to hw_main.c
|
||||
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
|
||||
void HWR_DrawSkyBackground(float fpov);
|
||||
|
||||
// hw_main.c: Sprites
|
||||
void HWR_AddSprites(sector_t *sec);
|
||||
void HWR_ProjectSprite(mobj_t *thing);
|
||||
//void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||
void HWR_DrawSprites(void);
|
||||
|
||||
// hw_bsp.c
|
||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||
extern boolean gr_maphasportals;
|
||||
extern boolean gl_maphasportals;
|
||||
|
||||
// hw_cache.c
|
||||
void HWR_LoadTextures(size_t pnumtextures);
|
||||
RGBA_t *HWR_GetTexturePalette(void);
|
||||
|
||||
void HWR_SetShaderState(void);
|
||||
|
||||
// Console variables
|
||||
extern consvar_t cv_grshaders;
|
||||
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
|
||||
|
||||
extern consvar_t cv_glscreentextures;
|
||||
#ifdef USE_FBO_OGL
|
||||
extern consvar_t cv_grframebuffer;
|
||||
extern consvar_t cv_glframebuffer;
|
||||
#endif
|
||||
extern consvar_t cv_splitwallfix;
|
||||
extern consvar_t cv_grshearing;
|
||||
extern consvar_t cv_grfov;
|
||||
extern consvar_t cv_grmdls;
|
||||
extern consvar_t cv_grfog;
|
||||
extern consvar_t cv_grfogdensity;
|
||||
extern consvar_t cv_grfiltermode;
|
||||
extern consvar_t cv_granisotropicmode;
|
||||
extern consvar_t cv_grcorrecttricks;
|
||||
extern consvar_t cv_grfovchange;
|
||||
extern consvar_t cv_grsolvetjoin;
|
||||
extern consvar_t cv_grspritebillboarding;
|
||||
extern consvar_t cv_grfakecontrast;
|
||||
extern consvar_t cv_grslopecontrast;
|
||||
extern consvar_t cv_grhorizonlines;
|
||||
extern consvar_t cv_grfallbackplayermodel;
|
||||
extern consvar_t cv_grbatching;
|
||||
extern consvar_t cv_grrenderdistance;
|
||||
extern consvar_t cv_grpaletterendering;
|
||||
extern consvar_t cv_grpalettedepth;
|
||||
extern consvar_t cv_grflashpal;
|
||||
extern consvar_t cv_lightdither;
|
||||
extern consvar_t cv_grscreentextures;
|
||||
extern consvar_t cv_grportals;
|
||||
extern consvar_t cv_nostencil;
|
||||
extern consvar_t cv_secbright;
|
||||
|
||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||
extern consvar_t cv_glmdls;
|
||||
extern consvar_t cv_glfallbackplayermodel;
|
||||
|
||||
extern consvar_t cv_glspritebillboarding;
|
||||
extern consvar_t cv_glshearing;
|
||||
|
||||
extern consvar_t cv_glfakecontrast;
|
||||
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;
|
||||
|
||||
extern consvar_t cv_glsolvetjoin;
|
||||
|
||||
extern consvar_t cv_glbatching;
|
||||
|
||||
extern consvar_t cv_glrenderdistance;
|
||||
|
||||
extern consvar_t cv_glhorizonlines;
|
||||
extern consvar_t cv_glportals;
|
||||
|
||||
extern consvar_t cv_glfovchange;
|
||||
|
||||
extern consvar_t cv_glpaletterendering;
|
||||
extern consvar_t cv_glpalettedepth;
|
||||
extern consvar_t cv_glflashpal;
|
||||
|
||||
#endif
|
||||
+108
-110
@@ -25,12 +25,14 @@
|
||||
#include "../doomstat.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_drv.h"
|
||||
|
||||
#include "hw_gl.h"
|
||||
#include "hw_md2.h"
|
||||
#include "../d_main.h"
|
||||
#include "../r_bsp.h"
|
||||
#include "../r_fps.h"
|
||||
#include "../r_main.h"
|
||||
#include "../p_setup.h"
|
||||
#include "../m_misc.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
@@ -43,8 +45,8 @@
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "../v_video.h"
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
@@ -147,7 +149,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
|
||||
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
|
||||
}
|
||||
|
||||
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
|
||||
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *glpatch)
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop png_info_ptr;
|
||||
@@ -201,7 +203,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
||||
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
|
||||
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
|
||||
fclose(png_FILE);
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
Z_Free(glpatch->mipmap->data);
|
||||
return 0;
|
||||
}
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
@@ -242,7 +244,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
||||
|
||||
{
|
||||
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->data);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &glpatch->mipmap->data);
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
|
||||
for (i = 0; i < height; i++)
|
||||
row_pointers[i] = PNG_image + i*pitch;
|
||||
@@ -282,7 +284,7 @@ typedef struct
|
||||
} PcxHeader;
|
||||
|
||||
static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||
GLPatch_t *grpatch)
|
||||
GLPatch_t *glpatch)
|
||||
{
|
||||
PcxHeader header;
|
||||
#define PALSIZE 768
|
||||
@@ -322,7 +324,7 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||
|
||||
pw = *w = header.xmax - header.xmin + 1;
|
||||
ph = *h = header.ymax - header.ymin + 1;
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->data);
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &glpatch->mipmap->data);
|
||||
|
||||
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
|
||||
{
|
||||
@@ -364,43 +366,43 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||
// -----------------+
|
||||
static void md2_loadTexture(md2_t *model)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
GLPatch_t *glpatch;
|
||||
const char *filename = model->filename;
|
||||
|
||||
if (model->grpatch)
|
||||
if (model->glpatch)
|
||||
{
|
||||
grpatch = model->grpatch;
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
glpatch = model->glpatch;
|
||||
Z_Free(glpatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->grpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
|
||||
&(model->glpatch));
|
||||
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
{
|
||||
grpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
glpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
glpatch->mipmap->downloaded = 0;
|
||||
glpatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
glpatch->width = (INT16)w;
|
||||
glpatch->height = (INT16)h;
|
||||
glpatch->mipmap->width = (UINT16)w;
|
||||
glpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
// for palette rendering, color cube is applied in post-processing instead of here
|
||||
if (!HWR_ShouldUsePaletteRendering())
|
||||
@@ -408,7 +410,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
UINT32 size;
|
||||
RGBA_t *image;
|
||||
// Lactozilla: Apply colour cube
|
||||
image = grpatch->mipmap->data;
|
||||
image = glpatch->mipmap->data;
|
||||
size = w*h;
|
||||
while (size--)
|
||||
{
|
||||
@@ -417,8 +419,8 @@ static void md2_loadTexture(md2_t *model)
|
||||
}
|
||||
}
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
GL_SetTexture(glpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -426,49 +428,49 @@ static void md2_loadTexture(md2_t *model)
|
||||
// -----------------+
|
||||
static void md2_loadBlendTexture(md2_t *model)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
GLPatch_t *glpatch;
|
||||
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
|
||||
strcpy(filename, model->filename);
|
||||
|
||||
FIL_ForceExtension(filename, "_blend.png");
|
||||
|
||||
if (model->blendgrpatch)
|
||||
if (model->blendglpatch)
|
||||
{
|
||||
grpatch = model->blendgrpatch;
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
glpatch = model->blendglpatch;
|
||||
Z_Free(glpatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->blendgrpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
|
||||
&(model->blendglpatch));
|
||||
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
{
|
||||
grpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
glpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
glpatch->mipmap->downloaded = 0;
|
||||
glpatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
glpatch->width = (INT16)w;
|
||||
glpatch->height = (INT16)h;
|
||||
glpatch->mipmap->width = (UINT16)w;
|
||||
glpatch->mipmap->height = (UINT16)h;
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
GL_SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
}
|
||||
@@ -489,7 +491,7 @@ void HWR_InitMD2(void)
|
||||
{
|
||||
md2_playermodels[s].scale = -1.0f;
|
||||
md2_playermodels[s].model = NULL;
|
||||
md2_playermodels[s].grpatch = NULL;
|
||||
md2_playermodels[s].glpatch = NULL;
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
@@ -498,7 +500,7 @@ void HWR_InitMD2(void)
|
||||
{
|
||||
md2_localplayermodels[s].scale = -1.0f;
|
||||
md2_localplayermodels[s].model = NULL;
|
||||
md2_localplayermodels[s].grpatch = NULL;
|
||||
md2_localplayermodels[s].glpatch = NULL;
|
||||
md2_localplayermodels[s].skin = -1;
|
||||
md2_localplayermodels[s].notfound = true;
|
||||
md2_localplayermodels[s].error = false;
|
||||
@@ -507,7 +509,7 @@ void HWR_InitMD2(void)
|
||||
{
|
||||
md2_models[i].scale = -1.0f;
|
||||
md2_models[i].model = NULL;
|
||||
md2_models[i].grpatch = NULL;
|
||||
md2_models[i].glpatch = NULL;
|
||||
md2_models[i].skin = -1;
|
||||
md2_models[i].notfound = true;
|
||||
md2_models[i].error = false;
|
||||
@@ -680,7 +682,7 @@ spritemd2found:
|
||||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glMipmap, INT32 skinnum, skincolors_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
@@ -696,24 +698,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
memset(translation, 0, sizeof(translation));
|
||||
memset(cutoff, 0, sizeof(cutoff));
|
||||
|
||||
if (grmip->width == 0)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
grmip->width = gpatch->width;
|
||||
grmip->height = gpatch->height;
|
||||
glMipmap->width = gpatch->width;
|
||||
glMipmap->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grmip->flags = 0;
|
||||
glMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
grmip->format = GL_TEXFMT_RGBA;
|
||||
glMipmap->format = GL_TEXFMT_RGBA;
|
||||
}
|
||||
|
||||
if (grmip->data)
|
||||
if (glMipmap->data)
|
||||
{
|
||||
Z_Free(grmip->data);
|
||||
grmip->data = NULL;
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->data);
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &glMipmap->data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->data;
|
||||
@@ -794,10 +796,9 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (translen > 0)
|
||||
colorbrightnesses[translen] = colorbrightnesses[translen-1];
|
||||
}
|
||||
|
||||
while (size--)
|
||||
{
|
||||
@@ -1044,28 +1045,29 @@ skippixel:
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the Mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
if (glMipmap->downloaded && glMipmap->data)
|
||||
{
|
||||
if (grmip->downloaded && grmip->data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,26 +1078,25 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
grmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
newMipmap->colormap = colormap;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
GL_SetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawMD2 : Draw MD2
|
||||
// :
|
||||
// Returns :
|
||||
// -----------------+
|
||||
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
{
|
||||
md2_t *md2;
|
||||
|
||||
@@ -1105,7 +1106,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
FTransform p;
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
if (!cv_grmdls.value)
|
||||
if (!cv_glmdls.value)
|
||||
return;
|
||||
|
||||
if (spr->precip)
|
||||
@@ -1164,7 +1165,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
angle_t ang;
|
||||
interpmobjstate_t interp;
|
||||
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value))
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
@@ -1234,7 +1235,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
if (md2->model)
|
||||
{
|
||||
md2_printModelInfo(md2->model);
|
||||
HWD.pfnCreateModelVBOs(md2->model);
|
||||
GL_CreateModelVBOs(md2->model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1244,22 +1245,22 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
}
|
||||
}
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->grpatch;
|
||||
gpatch = md2->glpatch;
|
||||
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
|
||||
md2_loadTexture(md2);
|
||||
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
gpatch = md2->glpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
|
||||
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!md2->blendgrpatch
|
||||
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
|
||||
&& !((GLPatch_t *)md2->blendgrpatch)->notfound)))
|
||||
&& (!md2->blendglpatch
|
||||
|| ((!((GLPatch_t *)md2->blendglpatch)->mipmap->format || !((GLPatch_t *)md2->blendglpatch)->mipmap->downloaded)
|
||||
&& !((GLPatch_t *)md2->blendglpatch)->notfound)))
|
||||
md2_loadBlendTexture(md2);
|
||||
|
||||
if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||
md2->blendglpatch && ((GLPatch_t *)md2->blendglpatch)->mipmap->format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendglpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendglpatch)->height)
|
||||
{
|
||||
INT32 tcskinnum = TC_DEFAULT;
|
||||
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
|
||||
@@ -1284,12 +1285,12 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
}
|
||||
else tcskinnum = TC_DEFAULT;
|
||||
}
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendglpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1313,7 +1314,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
// Interpolate the model interpolation. (lol)
|
||||
tics -= FixedToFloat(rendertimefrac);
|
||||
|
||||
if (cv_grmdls.value == 1 && tics <= durs)
|
||||
if (cv_glmdls.value == 1 && tics <= durs)
|
||||
{
|
||||
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
|
||||
if (spr->mobj->frame & FF_ANIMATE)
|
||||
@@ -1370,19 +1371,16 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
|
||||
p.spritexscale = FIXED_TO_FLOAT(spr->mobj->spritexscale);
|
||||
p.spriteyscale = FIXED_TO_FLOAT(spr->mobj->spriteyscale);
|
||||
|
||||
angle_t sliptideroll = 0;
|
||||
|
||||
if (spr->mobj->player)
|
||||
sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value) ? spr->mobj->player->sliproll : 0);
|
||||
angle_t sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value && spr->mobj->player) ? spr->mobj->player->sliproll : 0);
|
||||
|
||||
if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value))
|
||||
if (spr->mobj->rollangle || sliptideroll)
|
||||
{
|
||||
angle_t rollang = 0;
|
||||
rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0);
|
||||
|
||||
rollang = (spr->mobj->player && sliptideroll && cv_sliptideroll.value)
|
||||
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->sliptidemem)
|
||||
rollang = sliptideroll
|
||||
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->kartstuff[k_aizdriftstrat])
|
||||
: (spr->mobj->rollangle * rollfactor);
|
||||
|
||||
fixed_t anglef = AngleFixed(rollang);
|
||||
@@ -1465,7 +1463,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||
GL_SetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
@@ -1478,11 +1476,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
|
||||
|
||||
// offset perpendicular to the camera angle
|
||||
p.x -= ox * gr_viewsin;
|
||||
p.y += ox * gr_viewcos;
|
||||
p.x -= ox * gl_viewsin;
|
||||
p.y += ox * gl_viewcos;
|
||||
p.z += oy;
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
GL_DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef struct
|
||||
float scale;
|
||||
float offset;
|
||||
model_t *model;
|
||||
void *grpatch;
|
||||
void *blendgrpatch;
|
||||
void *glpatch;
|
||||
void *blendglpatch;
|
||||
boolean notfound;
|
||||
INT32 skin;
|
||||
boolean error;
|
||||
@@ -40,7 +40,7 @@ extern md2_t md2_playermodels[MAXSKINS];
|
||||
extern md2_t md2_localplayermodels[MAXLOCALSKINS];
|
||||
|
||||
void HWR_InitMD2(void);
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr);
|
||||
void HWR_DrawMD2(gl_vissprite_t *spr);
|
||||
void HWR_AddPlayerMD2(INT32 skin, boolean local);
|
||||
void HWR_AddSpriteMD2(size_t spritenum);
|
||||
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1996 by id Software, Inc.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_portal.c
|
||||
/// \brief OpenGL renderer portals.
|
||||
|
||||
// ==========================================================================
|
||||
// Visual portals (attr. Hannu Hanhi)
|
||||
// ==========================================================================
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "../r_portal.h"
|
||||
|
||||
#include "../z_zone.h"
|
||||
|
||||
#include "hw_clip.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_main.h"
|
||||
#include "hw_portal.h"
|
||||
|
||||
SINT8 gl_portal_state = GLPORTAL_OFF;
|
||||
|
||||
gl_portallist_t *currentportallist;
|
||||
|
||||
// clip the area outside the portal destination window
|
||||
void HWR_PortalClipping(gl_portal_t *portal)
|
||||
{
|
||||
gld_clipper_SafeAddClipRange(portal->angle1, portal->angle2);
|
||||
}
|
||||
|
||||
static gl_portal_t* HWR_Portal_Add (seg_t *seg)
|
||||
{
|
||||
gl_portal_t *portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
|
||||
|
||||
// Linked list.
|
||||
if (!currentportallist->base)
|
||||
{
|
||||
currentportallist->base = portal;
|
||||
currentportallist->cap = portal;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentportallist->cap->next = portal;
|
||||
currentportallist->cap = portal;
|
||||
}
|
||||
portal->next = NULL;
|
||||
|
||||
portal->seg = seg;
|
||||
|
||||
return portal;
|
||||
}
|
||||
|
||||
void HWR_FreePortalList(gl_portallist_t freelist)
|
||||
{
|
||||
portalcullsector = NULL;
|
||||
|
||||
// free memory from portal list allocated by calls to Add2Lines
|
||||
gl_portal_t *gl_portal_temp = freelist.base;
|
||||
while (gl_portal_temp)
|
||||
{
|
||||
gl_portal_t *nextportal = gl_portal_temp->next;
|
||||
Z_Free(gl_portal_temp);
|
||||
gl_portal_temp = nextportal;
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
{
|
||||
gl_portal_t *portal = HWR_Portal_Add(seg);
|
||||
|
||||
// Offset the portal view by the linedef centers
|
||||
line_t* start = &lines[line1];
|
||||
line_t* dest = &lines[line2];
|
||||
|
||||
angle_t dangle = R_PointToAngle2(0, 0, dest->dx, dest->dy) - R_PointToAngle2(start->dx, start->dy, 0, 0);
|
||||
|
||||
fixed_t disttopoint;
|
||||
angle_t angtopoint;
|
||||
|
||||
vertex_t dest_c, start_c;
|
||||
|
||||
// looking glass center
|
||||
start_c.x = start->v1->x/2 + start->v2->x/2;
|
||||
start_c.y = start->v1->y/2 + start->v2->y/2;
|
||||
|
||||
// other side center
|
||||
dest_c.x = dest->v1->x/2 + dest->v2->x/2;
|
||||
dest_c.y = dest->v1->y/2 + dest->v2->y/2;
|
||||
|
||||
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
|
||||
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
|
||||
angtopoint += dangle;
|
||||
|
||||
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
|
||||
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
|
||||
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
|
||||
portal->viewangle = viewangle + dangle;
|
||||
|
||||
portal->angle1 = R_PointToAngle64(seg->v1->x, seg->v1->y) + dangle;
|
||||
portal->angle2 = R_PointToAngle64(seg->v2->x, seg->v2->y) + dangle;
|
||||
|
||||
portal->clipline = line2;
|
||||
}
|
||||
|
||||
void HWR_PortalFrame(gl_portal_t* portal)
|
||||
{
|
||||
viewx = portal->viewx;
|
||||
viewy = portal->viewy;
|
||||
viewz = portal->viewz;
|
||||
|
||||
viewangle = portal->viewangle;
|
||||
//viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
//viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
if (portal->clipline != -1)
|
||||
{
|
||||
portalclipline = &lines[portal->clipline];
|
||||
portalcullsector = portalclipline->frontsector;
|
||||
viewsector = portalclipline->frontsector;
|
||||
}
|
||||
else
|
||||
{
|
||||
portalclipline = NULL;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
||||
// Renders a portal segment.
|
||||
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
{
|
||||
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
|
||||
|
||||
// set our portal state and prepare to render the seg
|
||||
HWR_SetPortalState(state);
|
||||
|
||||
gl_curline = portal->seg;
|
||||
gl_frontsector = portal->seg->frontsector;
|
||||
gl_backsector = portal->seg->backsector;
|
||||
|
||||
HWR_ProcessSeg();
|
||||
gl_drawing_stencil = false;
|
||||
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
|
||||
|
||||
// go to portal frame lmao
|
||||
HWR_PortalFrame(portal);
|
||||
// call HWR_RenderViewpoint
|
||||
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
HWR_PortalFrame(rootportal);
|
||||
else // current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(viewssnum, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
|
||||
|
||||
// draw portal seg to depth buffer
|
||||
HWR_ClearClipper();
|
||||
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GLPORTAL_DEPTH);
|
||||
}
|
||||
|
||||
// returns true if the point is on the correct (viewable) side of the
|
||||
// portal destination line
|
||||
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y)
|
||||
{
|
||||
// we are checking if the point is on the viewable side of the portal exit.
|
||||
// being exactly on the portal exit line is not enough to pass the test.
|
||||
// P_PointOnLineSide could behave differently from this expectation on this case,
|
||||
// so first check if the point is precisely on the line, and then if not, check the side.
|
||||
|
||||
vertex_t closest_point;
|
||||
P_ClosestPointOnLine(x, y, portalclipline, &closest_point);
|
||||
if (closest_point.x != x || closest_point.y != y)
|
||||
{
|
||||
if (P_PointOnLineSide(x, y, portalclipline) != 1)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
|
||||
{
|
||||
if (!portalclipline)
|
||||
return true;
|
||||
|
||||
if (HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXTOP]) ||
|
||||
HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) ||
|
||||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) ||
|
||||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// we did not find any reason to pass the check, so return failure
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_portal.h
|
||||
/// \brief OpenGL renderer portal struct, functions, linked list extern.
|
||||
|
||||
#ifndef __HW_PORTAL__
|
||||
#define __HW_PORTAL__
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../r_data.h"
|
||||
#include "../r_bsp.h"
|
||||
|
||||
/** Portal structure.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
GLPORTAL_OFF,
|
||||
GLPORTAL_SEARCH,
|
||||
GLPORTAL_STENCIL,
|
||||
GLPORTAL_DEPTH,
|
||||
GLPORTAL_INSIDE,
|
||||
};
|
||||
|
||||
typedef struct gl_portal_s
|
||||
{
|
||||
struct gl_portal_s *next;
|
||||
|
||||
// Viewport.
|
||||
fixed_t viewx;
|
||||
fixed_t viewy;
|
||||
fixed_t viewz;
|
||||
angle_t viewangle;
|
||||
|
||||
seg_t *seg; // seg that is used for drawing to the stencil buffer
|
||||
INT32 clipline; // Optional clipline for line-based portals
|
||||
|
||||
// angles for the left and right edges of the portal
|
||||
// relative to the viewpoint
|
||||
angle_t angle1;
|
||||
angle_t angle2;
|
||||
} gl_portal_t;
|
||||
|
||||
typedef struct gl_portallist_s
|
||||
{
|
||||
gl_portal_t *base;
|
||||
gl_portal_t *cap;
|
||||
} gl_portallist_t;
|
||||
|
||||
extern SINT8 gl_portal_state;
|
||||
|
||||
// new thing
|
||||
extern gl_portallist_t *currentportallist;
|
||||
|
||||
static inline void HWR_SetPortalState (SINT8 state)
|
||||
{
|
||||
gl_portal_state = state;
|
||||
}
|
||||
|
||||
// Adds an entry to the clipper for portal rendering
|
||||
void HWR_PortalClipping(gl_portal_t *portal);
|
||||
|
||||
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg);
|
||||
void HWR_PortalFrame(gl_portal_t* portal);
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level);
|
||||
void HWR_FreePortalList(gl_portallist_t portallist);
|
||||
|
||||
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
|
||||
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+14
-18
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_shaders.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
@@ -25,13 +25,10 @@ static struct {
|
||||
const char *vertex;
|
||||
const char *fragment;
|
||||
} const gl_shadersources[] = {
|
||||
|
||||
|
||||
// Floor shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
|
||||
|
||||
// Shadow shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_SHADOW_FRAGMENT_SHADER},
|
||||
|
||||
// Wall shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
|
||||
@@ -52,7 +49,7 @@ static struct {
|
||||
|
||||
// Palette postprocess shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_PALETTE_POSTPROCESS_FRAGMENT_SHADER},
|
||||
|
||||
|
||||
// UI colormap fade shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_FRAGMENT_SHADER},
|
||||
|
||||
@@ -90,7 +87,7 @@ boolean HWR_InitShaders(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!HWD.pfnInitShaders())
|
||||
if (!GL_InitShaders())
|
||||
return false;
|
||||
|
||||
for (i = 0; i < NUMSHADERTARGETS; i++)
|
||||
@@ -279,11 +276,11 @@ static char *HWR_PreprocessShader(char *original)
|
||||
|
||||
// Calculate length of modified shader.
|
||||
new_len = original_len;
|
||||
|
||||
if (cv_grpaletterendering.value)
|
||||
|
||||
if (cv_glpaletterendering.value)
|
||||
ADD_TO_LEN(PALETTE_RENDERING_DEFINE)
|
||||
|
||||
if (cv_lightdither.value)
|
||||
if (cv_gllightdither.value)
|
||||
ADD_TO_LEN(LIGHT_DITHERING_DEFINE)
|
||||
|
||||
#undef ADD_TO_LEN
|
||||
@@ -324,10 +321,10 @@ static char *HWR_PreprocessShader(char *original)
|
||||
}
|
||||
|
||||
// Write the defines.
|
||||
if (cv_grpaletterendering.value)
|
||||
if (cv_glpaletterendering.value)
|
||||
WRITE_DEFINE(PALETTE_RENDERING_DEFINE)
|
||||
|
||||
if (cv_lightdither.value)
|
||||
if (cv_gllightdither.value)
|
||||
WRITE_DEFINE(LIGHT_DITHERING_DEFINE)
|
||||
|
||||
#undef WRITE_DEFINE
|
||||
@@ -369,16 +366,16 @@ static void HWR_CompileShader(int index)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(vertex_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
}
|
||||
if (fragment_source)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(fragment_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
}
|
||||
|
||||
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
|
||||
gl_shaders[index].compiled = GL_CompileShader(index);
|
||||
}
|
||||
|
||||
// compile or recompile shaders
|
||||
@@ -410,7 +407,7 @@ int HWR_GetShaderFromTarget(int shader_target)
|
||||
// - custom shaders are enabled
|
||||
// - custom shaders are allowed by the server
|
||||
if (custom_shader != -1 && gl_shaders[custom_shader].compiled &&
|
||||
cv_grshaders.value == 1)
|
||||
cv_glshaders.value == 1)
|
||||
return custom_shader;
|
||||
else
|
||||
return gl_shadertargets[shader_target].base_shader;
|
||||
@@ -432,7 +429,6 @@ static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
|
||||
customshaderxlat_t shaderxlat[] =
|
||||
{
|
||||
{"Flat", SHADER_FLOOR},
|
||||
{"Shadow", SHADER_SHADOW},
|
||||
{"WallTexture", SHADER_WALL},
|
||||
{"Sprite", SHADER_SPRITE},
|
||||
{"Model", SHADER_MODEL},
|
||||
@@ -565,7 +561,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
int i;
|
||||
boolean modified_shaders[NUMSHADERTARGETS] = {0};
|
||||
|
||||
if (!gr_shadersavailable)
|
||||
if (!gl_shadersavailable)
|
||||
return;
|
||||
|
||||
lump = HWR_FindShaderDefs(wadnum);
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
GLSL_DOOM_COLORMAP_NODITHER \
|
||||
"#endif\n" \
|
||||
"}\n"
|
||||
|
||||
// lighting cap adjustment:
|
||||
// first num (155.0), increase to make it start to go dark sooner
|
||||
// second num (0.26), increase to make it go dark faster
|
||||
@@ -171,7 +172,7 @@
|
||||
"gl_FragColor = final_color;\n" \
|
||||
"}\n" \
|
||||
"#endif\0"
|
||||
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
@@ -210,10 +211,6 @@
|
||||
#define GLSL_WALL_FRAGMENT_SHADER \
|
||||
GLSL_WALL_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER
|
||||
|
||||
#define GLSL_SHADOW_FRAGMENT_SHADER \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
|
||||
|
||||
//
|
||||
// Water surface shader
|
||||
|
||||
@@ -358,8 +358,8 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
||||
else
|
||||
textureformatGL = GL_RGB5_A1;
|
||||
|
||||
SetModelView(lvid->width, lvid->height);
|
||||
SetStates();
|
||||
GL_SetModelView(lvid->width, lvid->height);
|
||||
GL_SetStates();
|
||||
// we need to clear the depth buffer. Very important!!!
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
||||
// -----------------+
|
||||
// FinishUpdate : Swap front and back buffers
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
void GL_FinishUpdate (INT32 waitvbl)
|
||||
{
|
||||
#ifdef USE_WGL_SWAP
|
||||
static INT32 oldwaitvbl = 0;
|
||||
@@ -547,23 +547,4 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
|
||||
SwapBuffers(hDC);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetPalette : Set the color lookup table for paletted textures
|
||||
// : in OpenGL, we store values for conversion of paletted graphics when
|
||||
// : they are downloaded to the 3D card.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = pal[i].s.red;
|
||||
myPaletteData[i].s.green = pal[i].s.green;
|
||||
myPaletteData[i].s.blue = pal[i].s.blue;
|
||||
myPaletteData[i].s.alpha = pal[i].s.alpha;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+448
-638
File diff suppressed because it is too large.
Load diff
@@ -43,8 +43,9 @@
|
||||
#endif
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
|
||||
#include "../../doomdef.h"
|
||||
#include "../hw_drv.h"
|
||||
#include "../hw_gl.h"
|
||||
#include "../../z_zone.h"
|
||||
|
||||
// ==========================================================================
|
||||
@@ -65,14 +66,15 @@ extern FILE *gllogstream;
|
||||
// PROTOS
|
||||
// ==========================================================================
|
||||
|
||||
boolean LoadGL(void);
|
||||
FUNCPRINTF void GL_DBG_Printf(const char *format, ...);
|
||||
|
||||
void *GetGLFunc(const char *proc);
|
||||
boolean SetupGLfunc(void);
|
||||
void SetupGLFunc4(void);
|
||||
void Flush(void);
|
||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void SetModelView(GLint w, GLint h);
|
||||
void SetStates(void);
|
||||
void GL_Flush(void);
|
||||
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void GL_SetModelView(GLint w, GLint h);
|
||||
void GL_SetStates(void);
|
||||
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
@@ -98,18 +100,14 @@ typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
|
||||
extern PFNglGetIntegerv pglGetIntegerv;
|
||||
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
|
||||
extern PFNglGetString pglGetString;
|
||||
#if 0
|
||||
typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap); // redefined in r_opengl.c
|
||||
static PFNglEnableClientState pglEnableClientState;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GLFramebuffer_DeleteAttachments(void);
|
||||
void GL_Framebuffer_DeleteAttachments(void);
|
||||
|
||||
void GLFramebuffer_Unbind(void);
|
||||
void GLFramebuffer_Enable(void);
|
||||
void GLFramebuffer_Disable(void);
|
||||
void GL_Framebuffer_Unbind(void);
|
||||
void GL_Framebuffer_Enable(void);
|
||||
void GL_Framebuffer_Disable(void);
|
||||
|
||||
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
|
||||
@@ -123,6 +121,8 @@ extern boolean supportFBO;
|
||||
extern const GLubyte *gl_version;
|
||||
extern const GLubyte *gl_renderer;
|
||||
extern const GLubyte *gl_extensions;
|
||||
extern const GLubyte *gl_vendor;
|
||||
extern GLuint gl_num_extensions;
|
||||
|
||||
extern int majorGL, minorGL;
|
||||
|
||||
|
||||
+18
-18
@@ -289,7 +289,7 @@ int
|
||||
HMS_register (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -316,23 +316,23 @@ HMS_register (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
hms_server_token = strdup(strtok(hms->buffer, "\n"));
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_unlist (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
hms = HMS_connect("servers/%s/unlist", hms_server_token);
|
||||
|
||||
@@ -342,19 +342,19 @@ HMS_unlist (void)
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
free(hms_server_token);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_update (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -376,10 +376,10 @@ HMS_update (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -488,7 +488,7 @@ int
|
||||
HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char *version;
|
||||
char *version_name;
|
||||
@@ -498,7 +498,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
||||
ok = 0;
|
||||
okay = 0;
|
||||
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
@@ -510,16 +510,16 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (atoi(version) != MODVERSION)
|
||||
{
|
||||
strlcpy(buffer, version_name, buffer_size);
|
||||
ok = 1;
|
||||
okay = 1;
|
||||
}
|
||||
else
|
||||
ok = -1;
|
||||
okay = -1;
|
||||
}
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
const char *
|
||||
@@ -532,9 +532,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return NULL;
|
||||
|
||||
boolean ok = HMS_do(hms);
|
||||
boolean okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
char *p = strstr(hms->buffer, "\n\n");
|
||||
|
||||
@@ -552,7 +552,7 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
if (!ok)
|
||||
if (!okay)
|
||||
return NULL;
|
||||
|
||||
return buffer;
|
||||
|
||||
+4
-3
@@ -1003,7 +1003,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
|
||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||
|
||||
if (LUAh_PlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
return;
|
||||
|
||||
if (spam_eatmsg)
|
||||
@@ -2274,7 +2274,7 @@ void HU_Drawer(void)
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_scores);
|
||||
LUAh_ScoresHUD(luahuddrawlist_scores);
|
||||
LUA_HUDHOOK(scores, luahuddrawlist_scores);
|
||||
}
|
||||
|
||||
LUA_HUD_DrawList(luahuddrawlist_scores);
|
||||
@@ -2617,7 +2617,8 @@ static void HU_DrawRankings(void)
|
||||
boolean completed[MAXPLAYERS];
|
||||
UINT32 whiteplayer = MAXPLAYERS;
|
||||
|
||||
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
|
||||
if (!automapactive)
|
||||
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
|
||||
|
||||
if (cons_menuhighlight.value)
|
||||
hilicol = cons_menuhighlight.value;
|
||||
|
||||
+1
-1
@@ -53,6 +53,6 @@ typedef struct JoyType_s JoyType_t;
|
||||
for palyer[sic] 1-4's joystick/gamepad
|
||||
*/
|
||||
|
||||
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;
|
||||
extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
#endif // __I_JOY_H__
|
||||
@@ -82,18 +82,10 @@ extern holepunch_t *holepunchpacket;
|
||||
*/
|
||||
extern boolean (*I_NetGet)(void);
|
||||
|
||||
/** \brief ask to driver if there is data waiting
|
||||
*/
|
||||
extern boolean (*I_NetCanGet)(void);
|
||||
|
||||
/** \brief send packet within doomcom struct
|
||||
*/
|
||||
extern void (*I_NetSend)(void);
|
||||
|
||||
/** \brief ask to driver if all is ok to send data now
|
||||
*/
|
||||
extern boolean (*I_NetCanSend)(void);
|
||||
|
||||
/** \brief close a connection
|
||||
|
||||
\param nodenum node to be closed
|
||||
|
||||
+7
-15
@@ -202,9 +202,13 @@ void I_JoyScale4(void);
|
||||
|
||||
// Called by D_SRB2Main.
|
||||
|
||||
/** \brief to startup joystick
|
||||
*/
|
||||
void I_InitJoystick(UINT8 index);
|
||||
|
||||
/** \brief to startup the first joystick
|
||||
*/
|
||||
void I_InitJoystick(void);
|
||||
void I_InitJoystick1(void);
|
||||
|
||||
/** \brief to startup the second joystick
|
||||
*/
|
||||
@@ -307,21 +311,9 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
|
||||
*/
|
||||
const char *I_LocateWad(void);
|
||||
|
||||
/** \brief First Joystick's events
|
||||
/** \brief Joystick events
|
||||
*/
|
||||
void I_GetJoystickEvents(void);
|
||||
|
||||
/** \brief Second Joystick's events
|
||||
*/
|
||||
void I_GetJoystick2Events(void);
|
||||
|
||||
/** \brief Third Joystick's events
|
||||
*/
|
||||
void I_GetJoystick3Events(void);
|
||||
|
||||
/** \brief Fourth Joystick's events
|
||||
*/
|
||||
void I_GetJoystick4Events(void);
|
||||
void I_GetJoystickEvents(UINT8 index);
|
||||
|
||||
/** \brief Mouses events
|
||||
*/
|
||||
|
||||
+6
-75
@@ -168,7 +168,6 @@ static UINT8 UPNP_support = TRUE;
|
||||
#endif
|
||||
|
||||
#include "i_addrinfo.h"
|
||||
#define SELECTTEST
|
||||
|
||||
#define DEFAULTPORT "5029"
|
||||
|
||||
@@ -750,59 +749,6 @@ static boolean SOCK_Get(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// check if we can send (do not go over the buffer)
|
||||
#ifndef NONET
|
||||
|
||||
static fd_set masterset;
|
||||
|
||||
#ifdef SELECTTEST
|
||||
static boolean FD_CPY(fd_set *src, fd_set *dst, SOCKET_TYPE *fd, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
boolean testset = false;
|
||||
FD_ZERO(dst);
|
||||
for (i = 0; i < len;i++)
|
||||
{
|
||||
if(fd[i] != (SOCKET_TYPE)ERRSOCKET &&
|
||||
FD_ISSET(fd[i], src) && !FD_ISSET(fd[i], dst)) // no checking for dups
|
||||
{
|
||||
FD_SET(fd[i], dst);
|
||||
testset = true;
|
||||
}
|
||||
}
|
||||
return testset;
|
||||
}
|
||||
|
||||
static boolean SOCK_CanSend(void)
|
||||
{
|
||||
struct timeval timeval_for_select = {0, 0};
|
||||
fd_set tset;
|
||||
int wselect;
|
||||
|
||||
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
|
||||
return false;
|
||||
wselect = select(255, NULL, &tset, NULL, &timeval_for_select);
|
||||
if (wselect >= 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean SOCK_CanGet(void)
|
||||
{
|
||||
struct timeval timeval_for_select = {0, 0};
|
||||
fd_set tset;
|
||||
int rselect;
|
||||
|
||||
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
|
||||
return false;
|
||||
rselect = select(255, &tset, NULL, NULL, &timeval_for_select);
|
||||
if (rselect >= 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
||||
{
|
||||
@@ -877,7 +823,7 @@ static void SOCK_Send(void)
|
||||
}
|
||||
}
|
||||
#undef ALLOWEDERROR
|
||||
#endif
|
||||
#endif //NONET
|
||||
|
||||
#ifndef NONET
|
||||
static void SOCK_FreeNodenum(INT32 numnode)
|
||||
@@ -1029,7 +975,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = ERRSOCKET;
|
||||
for (s = 0; s < MAXNETNODES+1; s++)
|
||||
nodesocket[s] = ERRSOCKET;
|
||||
FD_ZERO(&masterset);
|
||||
s = 0;
|
||||
|
||||
memset(&hints, 0x00, sizeof (hints));
|
||||
@@ -1056,7 +1001,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1077,7 +1021,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
@@ -1110,7 +1053,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1131,7 +1073,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1298,16 +1239,15 @@ boolean I_InitTcpDriver(void)
|
||||
static void SOCK_CloseSocket(void)
|
||||
{
|
||||
size_t i;
|
||||
for (i=0; i < MAXNETNODES+1; i++)
|
||||
|
||||
for (i = 0; i < mysocketses; i++)
|
||||
{
|
||||
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET
|
||||
&& FD_ISSET(mysockets[i], &masterset))
|
||||
{
|
||||
FD_CLR(mysockets[i], &masterset);
|
||||
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET)
|
||||
close(mysockets[i]);
|
||||
}
|
||||
mysockets[i] = ERRSOCKET;
|
||||
}
|
||||
|
||||
mysocketses = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1417,9 +1357,7 @@ static void rendezvous(int size)
|
||||
|
||||
if (tic == refreshtic)
|
||||
{
|
||||
#ifdef HOLEPUNCH
|
||||
holepunchpacket->magic = hole_punch_magic;
|
||||
#endif
|
||||
sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4);
|
||||
}
|
||||
|
||||
@@ -1444,7 +1382,6 @@ static void SOCK_RegisterHolePunch(void)
|
||||
rendezvous(4);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static boolean SOCK_OpenSocket(void)
|
||||
@@ -1464,13 +1401,7 @@ static boolean SOCK_OpenSocket(void)
|
||||
I_NetFreeNodenum = SOCK_FreeNodenum;
|
||||
I_NetMakeNodewPort = SOCK_NetMakeNodewPort;
|
||||
|
||||
#ifdef SELECTTEST
|
||||
// seem like not work with libsocket : (
|
||||
I_NetCanSend = SOCK_CanSend;
|
||||
I_NetCanGet = SOCK_CanGet;
|
||||
#endif
|
||||
#ifdef HOLEPUNCH
|
||||
|
||||
I_NetRequestHolePunch = SOCK_RequestHolePunch;
|
||||
I_NetRegisterHolePunch = SOCK_RegisterHolePunch;
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -139,13 +139,13 @@ UINT32 I_GetRefreshRate(void);
|
||||
|
||||
boolean I_UseNativeKeyboard(void);
|
||||
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
extern boolean xwaylandcrap;
|
||||
#endif
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
void I_DownSample(void);
|
||||
boolean UseScreenFBO(void);
|
||||
extern boolean downsample;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "d_player.h"
|
||||
#include "lzf.h"
|
||||
|
||||
// Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c!
|
||||
char sprnames[NUMSPRITES + 1][5] =
|
||||
{
|
||||
"NULL","UNKN","THOK","PLAY","POSS","SPOS","FISH","BUZZ","RBUZ","JETB",
|
||||
|
||||
@@ -159,9 +159,6 @@ enum actionnum
|
||||
A_SPAWNOBJECTRELATIVE,
|
||||
A_CHANGEANGLERELATIVE,
|
||||
A_CHANGEANGLEABSOLUTE,
|
||||
A_ROLLANGLE,
|
||||
A_CHANGEROLLANGLERELATIVE,
|
||||
A_CHANGEROLLANGLEABSOLUTE,
|
||||
A_PLAYSOUND,
|
||||
A_FINDTARGET,
|
||||
A_FINDTRACER,
|
||||
@@ -460,7 +457,6 @@ extern boolean actionsoverridden[NUMACTIONS];
|
||||
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
||||
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
|
||||
|
||||
// Hey, moron! If you change this table, don't forget about sprnames in info.c and the sprite lights in hw_light.c!
|
||||
typedef enum sprite
|
||||
{
|
||||
SPR_NULL, // invisible object
|
||||
|
||||
+97
-85
@@ -12,6 +12,7 @@
|
||||
|
||||
//#include "k_kart.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "v_video.h"
|
||||
#include "k_director.h"
|
||||
@@ -19,6 +20,8 @@
|
||||
#include "p_local.h"
|
||||
#include "st_stuff.h"
|
||||
|
||||
#include "r_fps.h"
|
||||
|
||||
#define SWITCHTIME TICRATE * 5 // cooldown between unforced switches
|
||||
#define BOREDOMTIME 3 * TICRATE / 2 // how long until players considered far apart?
|
||||
#define TRANSFERTIME TICRATE // how long to delay reaction shots?
|
||||
@@ -28,6 +31,8 @@
|
||||
|
||||
struct directorinfo
|
||||
{
|
||||
UINT8 viewnum;
|
||||
player_t* viewplayer;
|
||||
tic_t cooldown; // how long has it been since we last switched?
|
||||
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
|
||||
INT32 attacker; // who to switch to when freeze delay elapses
|
||||
@@ -38,6 +43,8 @@ struct directorinfo
|
||||
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
|
||||
} directorinfo;
|
||||
|
||||
struct directorinfo directorinfosplit[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
boolean K_DirectorIsPlayerAlone(void)
|
||||
{
|
||||
UINT8 pingame = 0;
|
||||
@@ -67,25 +74,38 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
|
||||
return FixedMul(n, FixedDiv(scale, mapobjectscale));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(void)
|
||||
boolean K_DirectorIsAvailable(UINT8 viewnum)
|
||||
{
|
||||
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((stplyr && !stplyr->spectator) && (!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
|
||||
if ((demo.playback && demo.title) || modeattacking)
|
||||
return false;
|
||||
return ((gamestate == GS_LEVEL) && (viewnum <= splitscreen) && (demo.playback || (players[g_localplayers[viewnum]].spectator && !K_DirectorIsPlayerAlone())));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(const UINT8 viewnum)
|
||||
{
|
||||
return (cv_director[viewnum].value && K_DirectorIsAvailable(viewnum));
|
||||
}
|
||||
|
||||
void K_InitDirector(void)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
directorinfo.freeze = 0;
|
||||
directorinfo.attacker = 0;
|
||||
directorinfo.maxdist = 0;
|
||||
directorinfo.viewnum = 0;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
directorinfo.sortedplayers[playernum] = -1;
|
||||
directorinfo.gap[playernum] = INT32_MAX;
|
||||
directorinfo.boredom[playernum] = 0;
|
||||
directorinfosplit[i].cooldown = SWITCHTIME;
|
||||
directorinfosplit[i].freeze = 0;
|
||||
directorinfosplit[i].attacker = 0;
|
||||
directorinfosplit[i].maxdist = 0;
|
||||
directorinfosplit[i].viewplayer = NULL;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
directorinfosplit[i].sortedplayers[playernum] = -1;
|
||||
directorinfosplit[i].gap[playernum] = INT32_MAX;
|
||||
directorinfosplit[i].boredom[playernum] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +124,8 @@ static fixed_t K_GetDistanceToFinish(player_t player)
|
||||
continue;
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -124,7 +144,7 @@ static fixed_t K_GetDistanceToFinish(player_t player)
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -148,13 +168,13 @@ static fixed_t K_GetFinishGap(INT32 leader, INT32 follower)
|
||||
}
|
||||
}
|
||||
|
||||
static void K_UpdateDirectorPositions(void)
|
||||
static void K_UpdateDirectorPositions(const UINT8 viewnum)
|
||||
{
|
||||
INT32 playernum;
|
||||
INT32 position;
|
||||
player_t* target;
|
||||
|
||||
memset(directorinfo.sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
memset(directorinfosplit[viewnum].sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
@@ -162,43 +182,43 @@ static void K_UpdateDirectorPositions(void)
|
||||
|
||||
if (playeringame[playernum] && !target->spectator && target->kartstuff[k_position] > 0)
|
||||
{
|
||||
directorinfo.sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
directorinfosplit[viewnum].sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
}
|
||||
}
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
directorinfo.gap[position] = INT32_MAX;
|
||||
directorinfosplit[viewnum].gap[position] = INT32_MAX;
|
||||
|
||||
if (directorinfo.sortedplayers[position] == -1 || directorinfo.sortedplayers[position + 1] == -1)
|
||||
if (directorinfosplit[viewnum].sortedplayers[position] == -1 || directorinfosplit[viewnum].sortedplayers[position + 1] == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
directorinfo.gap[position] = ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
|
||||
directorinfosplit[viewnum].gap[position] = ScaleFromMap(K_GetFinishGap(directorinfosplit[viewnum].sortedplayers[position], directorinfosplit[viewnum].sortedplayers[position + 1]), FRACUNIT);
|
||||
|
||||
if (directorinfo.gap[position] >= BREAKAWAYDIST)
|
||||
if (directorinfosplit[viewnum].gap[position] >= BREAKAWAYDIST)
|
||||
{
|
||||
directorinfo.boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfo.boredom[position] + 1));
|
||||
directorinfosplit[viewnum].boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfosplit[viewnum].boredom[position] + 1));
|
||||
}
|
||||
else if (directorinfo.boredom[position] > 0)
|
||||
else if (directorinfosplit[viewnum].boredom[position] > 0)
|
||||
{
|
||||
directorinfo.boredom[position]--;
|
||||
directorinfosplit[viewnum].boredom[position]--;
|
||||
}
|
||||
}
|
||||
|
||||
if (directorinfo.sortedplayers[0] == -1)
|
||||
if (directorinfosplit[viewnum].sortedplayers[0] == -1)
|
||||
{
|
||||
directorinfo.maxdist = -1;
|
||||
directorinfosplit[viewnum].maxdist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
|
||||
directorinfosplit[viewnum].maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfosplit[viewnum].sortedplayers[0]]), FRACUNIT);
|
||||
}
|
||||
|
||||
static boolean K_CanSwitchDirector(void)
|
||||
static boolean K_CanSwitchDirector(const UINT8 viewnum)
|
||||
{
|
||||
if (directorinfo.cooldown > 0)
|
||||
if (directorinfosplit[viewnum].cooldown > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -206,14 +226,9 @@ static boolean K_CanSwitchDirector(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
static void K_DirectorSwitch(INT32 player, boolean force, const UINT8 viewnum)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(&players[player]))
|
||||
if (!K_DirectorIsEnabled(viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -223,45 +238,45 @@ static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force && !K_CanSwitchDirector())
|
||||
if (!force && !K_CanSwitchDirector(viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
G_ResetView(1, player, true);
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
G_ResetView(viewnum+1, player, true);
|
||||
directorinfosplit[viewnum].cooldown = SWITCHTIME;
|
||||
}
|
||||
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time)
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time, const UINT8 viewnum)
|
||||
{
|
||||
if (players[player].exiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.attacker = player;
|
||||
directorinfo.freeze = time;
|
||||
directorinfosplit[viewnum].attacker = player;
|
||||
directorinfosplit[viewnum].freeze = time;
|
||||
}
|
||||
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_IsDisplayPlayer(player))
|
||||
if (directorinfosplit[directorinfo.viewnum].viewplayer != player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (inflictor && inflictor->player)
|
||||
{
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME);
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
}
|
||||
else if (source && source->player)
|
||||
{
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME);
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,14 +296,14 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, 0, V_70TRANS, va("CONF?"));
|
||||
V_DrawThinString(80, 0, V_70TRANS, va("GAP"));
|
||||
V_DrawThinString(120, 0, V_70TRANS, va("BORED"));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfo.cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfo.maxdist));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfosplit[0].cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfosplit[0].maxdist));
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
ytxt = 10 * (position + 1);
|
||||
leader = directorinfo.sortedplayers[position];
|
||||
follower = directorinfo.sortedplayers[position + 1];
|
||||
leader = directorinfosplit[0].sortedplayers[position];
|
||||
follower = directorinfosplit[0].sortedplayers[position + 1];
|
||||
|
||||
if (leader == -1 || follower == -1)
|
||||
break;
|
||||
@@ -301,15 +316,15 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, ytxt, V_70TRANS, va("NG"));
|
||||
}
|
||||
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfo.gap[position]));
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfosplit[0].gap[position]));
|
||||
|
||||
if (directorinfo.boredom[position] >= BOREDOMTIME)
|
||||
if (directorinfosplit[0].boredom[position] >= BOREDOMTIME)
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("BORED"));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfo.boredom[position]));
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfosplit[0].boredom[position]));
|
||||
}
|
||||
|
||||
V_DrawThinString(150, ytxt, V_70TRANS, va("%s", player_names[leader]));
|
||||
@@ -317,37 +332,38 @@ void K_DrawDirectorDebugger(void)
|
||||
}
|
||||
}
|
||||
|
||||
void K_UpdateDirector(void)
|
||||
void K_UpdateDirector(const UINT8 viewnum)
|
||||
{
|
||||
INT32 *displayplayerp = &displayplayers[0];
|
||||
INT32 targetposition;
|
||||
directorinfo.viewnum = viewnum;
|
||||
directorinfosplit[directorinfo.viewnum].viewplayer = &players[displayplayers[directorinfo.viewnum]];
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
K_UpdateDirectorPositions();
|
||||
K_UpdateDirectorPositions(directorinfo.viewnum);
|
||||
|
||||
if (directorinfo.cooldown > 0) {
|
||||
directorinfo.cooldown--;
|
||||
if (directorinfosplit[directorinfo.viewnum].cooldown > 0) {
|
||||
directorinfosplit[directorinfo.viewnum].cooldown--;
|
||||
}
|
||||
|
||||
// handle pending forced switches
|
||||
if (directorinfo.freeze > 0)
|
||||
if (directorinfosplit[directorinfo.viewnum].freeze > 0)
|
||||
{
|
||||
if (!(--directorinfo.freeze))
|
||||
K_DirectorSwitch(directorinfo.attacker, true);
|
||||
if (!(--directorinfosplit[directorinfo.viewnum].freeze))
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].attacker, true, directorinfo.viewnum);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if there's only one player left in the list, just switch to that player
|
||||
if (directorinfo.sortedplayers[0] != -1 && (directorinfo.sortedplayers[1] == -1 ||
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[0] != -1 && (directorinfosplit[directorinfo.viewnum].sortedplayers[1] == -1 ||
|
||||
// TODO: Battle; I just threw this together quick. Focus on leader.
|
||||
!race_rules()))
|
||||
{
|
||||
K_DirectorSwitch(directorinfo.sortedplayers[0], false);
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].sortedplayers[0], false, directorinfo.viewnum);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -359,76 +375,72 @@ void K_UpdateDirector(void)
|
||||
INT32 target;
|
||||
|
||||
// you are out of players, try again
|
||||
if (directorinfo.sortedplayers[targetposition] == -1)
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition] == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// pair too far apart? try the next one
|
||||
if (directorinfo.boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
if (directorinfosplit[directorinfo.viewnum].boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// pair finished? try the next one
|
||||
if (players[directorinfo.sortedplayers[targetposition]].exiting)
|
||||
if (players[directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition]].exiting)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't risk switching away from forward pairs at race end, might miss something!
|
||||
if (directorinfo.maxdist > PINCHDIST)
|
||||
if (directorinfosplit[directorinfo.viewnum].maxdist > PINCHDIST)
|
||||
{
|
||||
// if the "next" player is close enough, they should be able to see everyone fine!
|
||||
// walk back through the standings to find a vantage that gets everyone in frame.
|
||||
// (also creates a pretty cool effect w/ overtakes at speed)
|
||||
while (targetposition < MAXPLAYERS && directorinfo.gap[targetposition] < WALKBACKDIST)
|
||||
while (targetposition < MAXPLAYERS && directorinfosplit[directorinfo.viewnum].gap[targetposition] < WALKBACKDIST)
|
||||
{
|
||||
targetposition++;
|
||||
}
|
||||
}
|
||||
|
||||
target = directorinfo.sortedplayers[targetposition];
|
||||
target = directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition];
|
||||
|
||||
// stop here since we're already viewing this player
|
||||
if (*displayplayerp == target)
|
||||
if (displayplayers[directorinfo.viewnum] == target)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if this is a splitscreen player, try next pair
|
||||
if (P_IsDisplayPlayer(&players[target]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we're certain the back half of the pair is actually in this position, try to switch
|
||||
if (!players[target].kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
K_DirectorSwitch(target, false, directorinfo.viewnum);
|
||||
}
|
||||
|
||||
// even if we're not certain, if we're certain we're watching the WRONG player, try to switch
|
||||
if (players[*displayplayerp].kartstuff[k_position] != targetposition+1 && !players[*displayplayerp].kartstuff[k_positiondelay])
|
||||
// even if we're not certain, if we're cetain we're watching the WRONG player, try to switch
|
||||
if (directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_position] != targetposition+1 && !directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
K_DirectorSwitch(target, false, directorinfo.viewnum);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void K_ToggleDirector(void)
|
||||
void K_ToggleDirector(const UINT8 viewnum)
|
||||
{
|
||||
if (!directortextactive)
|
||||
if (!K_DirectorIsAvailable(viewnum))
|
||||
return;
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
G_AdjustView(viewnum+1, 1, true);
|
||||
|
||||
if (!K_DirectorIsEnabled(viewnum))
|
||||
{
|
||||
directorinfo.cooldown = 0; // switch immediately
|
||||
directorinfosplit[viewnum].cooldown = 0; // switch immediately
|
||||
}
|
||||
|
||||
directortoggletimer = 0;
|
||||
|
||||
COM_ImmedExecute("add director 1");
|
||||
CV_SetValue(&cv_director[viewnum], (cv_director[viewnum].value ^ 1));
|
||||
}
|
||||
+3
-2
@@ -10,8 +10,9 @@
|
||||
/// \file k_director.h
|
||||
/// \brief SRB2kart automatic spectator camera.
|
||||
|
||||
boolean K_DirectorIsAvailable(UINT8 viewnum);
|
||||
void K_InitDirector(void);
|
||||
void K_UpdateDirector(void);
|
||||
void K_UpdateDirector(UINT8 viewnum);
|
||||
void K_DrawDirectorDebugger(void);
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
|
||||
void K_ToggleDirector(void);
|
||||
void K_ToggleDirector(UINT8 viewnum);
|
||||
+316
-355
File diff suppressed because it is too large.
Load diff
+15
-3
@@ -1109,6 +1109,18 @@ static int lib_pCheckSight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// DONT USE THIS FOR ANYTHING GAMEPLAY, THIS WILL DESYNCH!
|
||||
static int lib_pCheckSightFast(lua_State *L)
|
||||
{
|
||||
mobj_t *t1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *t2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
//HUDSAFE?
|
||||
if (!t1 || !t2)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
lua_pushboolean(L, P_CheckSightFast(t1, t2));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pCheckHoopPosition(lua_State *L)
|
||||
{
|
||||
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
@@ -1817,7 +1829,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1919,7 +1931,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
|
||||
else
|
||||
#endif
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
|
||||
position = (UINT32)luaL_optinteger(L, 5, 0);
|
||||
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
|
||||
@@ -3154,7 +3166,6 @@ static luaL_Reg lib[] = {
|
||||
{"P_LookForEnemies",lib_pLookForEnemies},
|
||||
{"P_NukeEnemies",lib_pNukeEnemies},
|
||||
{"P_HomingAttack",lib_pHomingAttack},
|
||||
//{"P_SuperReady",lib_pSuperReady},
|
||||
{"P_Telekinesis",lib_pTelekinesis},
|
||||
|
||||
// p_map
|
||||
@@ -3167,6 +3178,7 @@ static luaL_Reg lib[] = {
|
||||
{"P_SlideMove",lib_pSlideMove},
|
||||
{"P_BounceMove",lib_pBounceMove},
|
||||
{"P_CheckSight", lib_pCheckSight},
|
||||
{"P_CheckSightFast", lib_pCheckSightFast},
|
||||
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
|
||||
{"P_RadiusAttack",lib_pRadiusAttack},
|
||||
{"P_FloorzAtPos",lib_pFloorzAtPos},
|
||||
|
||||
@@ -169,7 +169,7 @@ void COM_Lua_f(void)
|
||||
for (i = 0; i < argc; i++)
|
||||
WRITESTRINGN(p, COM_Argv(i), 255);
|
||||
if (flags & 2)
|
||||
SendNetXCmd2(XD_LUACMD, buf, p-buf);
|
||||
SendNetXCmdForPlayer(1, XD_LUACMD, buf, p-buf);
|
||||
else
|
||||
SendNetXCmd(XD_LUACMD, buf, p-buf);
|
||||
free(buf);
|
||||
|
||||
+116
-92
@@ -12,105 +12,129 @@
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "d_player.h"
|
||||
#include "s_sound.h"
|
||||
#include "lua_hudlib_drawlist.h"
|
||||
|
||||
enum hook {
|
||||
hook_NetVars=0,
|
||||
hook_MapChange,
|
||||
hook_MapLoad,
|
||||
hook_PlayerJoin,
|
||||
hook_PreThinkFrame,
|
||||
hook_ThinkFrame,
|
||||
hook_PostThinkFrame,
|
||||
hook_MobjSpawn,
|
||||
hook_MobjCollide,
|
||||
hook_MobjMoveCollide,
|
||||
hook_TouchSpecial,
|
||||
hook_MobjFuse,
|
||||
hook_MobjThinker,
|
||||
hook_BossThinker,
|
||||
hook_ShouldDamage,
|
||||
hook_MobjDamage,
|
||||
hook_MobjDeath,
|
||||
hook_BossDeath,
|
||||
hook_MobjRemoved,
|
||||
hook_JumpSpecial,
|
||||
hook_AbilitySpecial,
|
||||
hook_SpinSpecial,
|
||||
hook_JumpSpinSpecial,
|
||||
hook_BotTiccmd,
|
||||
hook_BotAI,
|
||||
hook_LinedefExecute,
|
||||
hook_PlayerMsg,
|
||||
hook_HurtMsg,
|
||||
hook_PlayerSpawn,
|
||||
hook_PlayerQuit,
|
||||
hook_PlayerThink,
|
||||
hook_MusicChange,
|
||||
hook_ShouldSpin, //SRB2KART
|
||||
hook_ShouldExplode, //SRB2KART
|
||||
hook_ShouldSquish, //SRB2KART
|
||||
hook_PlayerSpin, //SRB2KART
|
||||
hook_PlayerExplode, //SRB2KART
|
||||
hook_PlayerSquish, //SRB2KART
|
||||
hook_PlayerCmd, //SRB2KART
|
||||
hook_IntermissionThinker, //SRB2KART
|
||||
hook_VoteThinker, //SRB2KART
|
||||
hook_ServerJoin, // SRB2KART - Saturn 32p
|
||||
/*
|
||||
* Do you know what an 'X Macro' is? Such a macro is called over each element of
|
||||
* a list and expands the input. I use it for the hook lists because both an enum
|
||||
* and array of hook names need to be kept in order. The X Macro handles this
|
||||
* automatically.
|
||||
*/
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
extern const char *const hookNames[];
|
||||
#define MOBJ_HOOK_LIST(X) \
|
||||
X (MobjSpawn),/* P_SpawnMobj */\
|
||||
X (MobjCollide),/* PIT_CheckThing */\
|
||||
X (MobjMoveCollide),/* tritto */\
|
||||
X (TouchSpecial),/* P_TouchSpecialThing */\
|
||||
X (MobjFuse),/* when mobj->fuse runs out */\
|
||||
X (MobjThinker),/* P_MobjThinker, P_SceneryThinker */\
|
||||
X (BossThinker),/* P_GenericBossThinker */\
|
||||
X (ShouldDamage),/* P_DamageMobj (Should mobj take damage?) */\
|
||||
X (MobjDamage),/* P_DamageMobj (Mobj actually takes damage!) */\
|
||||
X (MobjDeath),/* P_KillMobj */\
|
||||
X (BossDeath),/* A_BossDeath */\
|
||||
X (MobjRemoved),/* P_RemoveMobj */\
|
||||
X (HurtMsg),/* imhurttin */\
|
||||
|
||||
#define HOOK_LIST(X) \
|
||||
X (NetVars),/* add to archive table (netsave) */\
|
||||
X (MapChange),/* (before map load) */\
|
||||
X (MapLoad),\
|
||||
X (PlayerJoin),/* Got_AddPlayer */\
|
||||
X (PreThinkFrame)/* frame (before mobj and player thinkers) */,\
|
||||
X (ThinkFrame),/* frame (after mobj and player thinkers) */\
|
||||
X (PostThinkFrame),/* frame (at end of tick, ie after overlays, precipitation, specials) */\
|
||||
X (JumpSpecial),/* P_DoJumpStuff (Any-jumping) */\
|
||||
X (AbilitySpecial),/* P_DoJumpStuff (Double-jumping) */\
|
||||
X (SpinSpecial),/* P_DoSpinAbility (Spin button effect) */\
|
||||
X (JumpSpinSpecial),/* P_DoJumpStuff (Spin button effect (mid-air)) */\
|
||||
X (BotTiccmd),/* B_BuildTiccmd */\
|
||||
X (PlayerMsg),/* chat messages */\
|
||||
X (PlayerSpawn),/* G_SpawnPlayer */\
|
||||
X (PlayerQuit),\
|
||||
X (PlayerThink),/* P_PlayerThink */\
|
||||
X (MusicChange),\
|
||||
X (ShouldSpin),/*SRB2KART*/\
|
||||
X (ShouldExplode),/*SRB2KART*/\
|
||||
X (ShouldSquish),/*SRB2KART*/\
|
||||
X (PlayerSpin),/*SRB2KART*/\
|
||||
X (PlayerExplode),/*SRB2KART*/\
|
||||
X (PlayerSquish),/*SRB2KART*/\
|
||||
X (PlayerCmd),/* building the player's ticcmd struct (Ported from SRB2Kart) */\
|
||||
X (IntermissionThinker),/* Y_Ticker */\
|
||||
X (VoteThinker),/*SRB2KART*/\
|
||||
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
|
||||
|
||||
#define STRING_HOOK_LIST(X) \
|
||||
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
|
||||
X (LinedefExecute),\
|
||||
|
||||
#define HUD_HOOK_LIST(X) \
|
||||
X (game),\
|
||||
X (scores),/* emblems/multiplayer list */\
|
||||
X (intermission),\
|
||||
X (vote),\
|
||||
|
||||
/*
|
||||
* I chose to access the hook enums through a macro as well. This could provide
|
||||
* a hint to lookup the macro's definition instead of the enum's definition.
|
||||
* (Since each enumeration is not defined in the source code, but by the list
|
||||
* macros above, it is not greppable.) The name passed to the macro can also be
|
||||
* grepped and found in the lists above.
|
||||
*/
|
||||
|
||||
#define MOBJ_HOOK(name) mobjhook_ ## name
|
||||
#define HOOK(name) hook_ ## name
|
||||
#define HUD_HOOK(name) hudhook_ ## name
|
||||
#define STRING_HOOK(name) stringhook_ ## name
|
||||
|
||||
#define ENUM(X) enum { X ## _LIST (X) X(MAX) }
|
||||
|
||||
ENUM (MOBJ_HOOK);
|
||||
ENUM (HOOK);
|
||||
ENUM (HUD_HOOK);
|
||||
ENUM (STRING_HOOK);
|
||||
|
||||
#undef ENUM
|
||||
|
||||
/* dead simple, LUA_HOOK(GameQuit) */
|
||||
#define LUA_HOOK(type) LUA_HookVoid(HOOK(type))
|
||||
#define LUA_HUDHOOK(type,drawlist) LUA_HookHUD(HUD_HOOK(type),(drawlist))
|
||||
|
||||
extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd.
|
||||
extern int hook_defrosting;
|
||||
|
||||
void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
|
||||
void LUAh_MapLoad(void); // Hook for map load
|
||||
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
|
||||
void LUAh_PreThinkFrame(void); // Hook for frame (before mobj and player thinkers)
|
||||
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
||||
void LUAh_PostThinkFrame(void); // Hook for frame (at end of tick, ie after overlays, precipitation, specials)
|
||||
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
||||
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
|
||||
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
||||
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
|
||||
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
|
||||
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
|
||||
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
|
||||
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
|
||||
boolean LUAh_MobjThinker(mobj_t *mo); // Hook for P_MobjThinker or P_SceneryThinker by mobj type
|
||||
#define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type
|
||||
UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?)
|
||||
boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!)
|
||||
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type
|
||||
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
|
||||
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
|
||||
#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping)
|
||||
#define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping)
|
||||
#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect)
|
||||
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
|
||||
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
||||
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
||||
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute); // Hook for chat messages
|
||||
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
||||
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
|
||||
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
||||
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping,
|
||||
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
|
||||
void LUA_HookVoid(int hook);
|
||||
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
|
||||
|
||||
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
|
||||
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
|
||||
UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
|
||||
int LUA_HookMobj(mobj_t *, int hook);
|
||||
int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook);
|
||||
void LUA_HookInt(INT32 integer, int hook);
|
||||
//void LUA_HookBool(boolean value, int hook);
|
||||
int LUA_HookPlayer(player_t *, int hook);
|
||||
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
|
||||
|
||||
boolean LUAh_PlayerSpin(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 LUAh_PlayerExplode(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 LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
void LUA_HookPreThinkFrame(void);
|
||||
void LUA_HookThinkFrame(void);
|
||||
void LUA_HookPostThinkFrame(void);
|
||||
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher);
|
||||
int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source);
|
||||
int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd);
|
||||
void LUA_HookLinedefExecute(line_t *, mobj_t *, sector_t *);
|
||||
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute);
|
||||
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source);
|
||||
int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
|
||||
void LUA_HookPlayerQuit(player_t *, int);
|
||||
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
|
||||
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
|
||||
|
||||
void LUAh_ServerJoin(void); // SRB2KART - Saturn 32p: called by client when joining a server, allows lua to load any sort of config file
|
||||
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
|
||||
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
|
||||
int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
|
||||
|
||||
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
|
||||
|
||||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
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.
|
||||
+1007
-1827
File diff suppressed because it is too large.
Load diff
+1
-4
@@ -50,9 +50,6 @@ extern boolean hud_interplatch; // string mode was toggled
|
||||
|
||||
boolean LUA_HudEnabled(enum hud option);
|
||||
|
||||
void LUAh_GameHUD(huddrawlist_h list);
|
||||
void LUAh_ScoresHUD(huddrawlist_h list);
|
||||
void LUAh_IntermissionHUD(huddrawlist_h list);
|
||||
void LUAh_VoteHUD(huddrawlist_h list);
|
||||
void LUA_SetHudHook(int hook, huddrawlist_h list);
|
||||
|
||||
#endif // __LUA_HUD_H__
|
||||
+64
-282
@@ -28,6 +28,7 @@
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_hud.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#define HUDONLY if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
||||
|
||||
@@ -40,8 +41,6 @@ boolean hud_interpstring = false;
|
||||
boolean hud_interplatch = false;
|
||||
static UINT8 hud_enabled[(hud_MAX/8)+1];
|
||||
|
||||
static UINT8 hudAvailable; // hud hooks field
|
||||
|
||||
static UINT8 camnum = 1;
|
||||
|
||||
// must match enum hud in lua_hud.h
|
||||
@@ -93,19 +92,6 @@ static const char *const patch_opt[] = {
|
||||
"topoffset",
|
||||
NULL};
|
||||
|
||||
enum hudhook {
|
||||
hudhook_game = 0,
|
||||
hudhook_scores = 1,
|
||||
hudhook_intermission = 2,
|
||||
hudhook_vote = 3,
|
||||
};
|
||||
static const char *const hudhook_opt[] = {
|
||||
"game",
|
||||
"scores",
|
||||
"intermission",
|
||||
"vote",
|
||||
NULL};
|
||||
|
||||
static int patch_fields_ref = LUA_NOREF;
|
||||
|
||||
// alignment types for v.drawString
|
||||
@@ -503,7 +489,7 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
angle = (angle & 7); // modulus angle by 8
|
||||
|
||||
// rotsprite?????
|
||||
if (lua_isnumber(L, 4) && (cv_spriteroll.value))
|
||||
if (lua_isnumber(L, 4) && cv_sloperoll.value)
|
||||
{
|
||||
angle_t rollangle = luaL_checkangle(L, 4);
|
||||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
@@ -591,26 +577,16 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
UINT8 *colormap = NULL; // do we want to colormap this patch?
|
||||
boolean centered; // the patch is centered and doesn't need readjusting on x/y coordinates.
|
||||
huddrawlist_h list;
|
||||
|
||||
// variables used to replicate k_kart's mmap drawer:
|
||||
INT32 lumpnum;
|
||||
patch_t *AutomapPic;
|
||||
INT32 mx, my;
|
||||
INT32 splitflags, minimaptrans;
|
||||
patch_t *AutomapPic = NULL;
|
||||
|
||||
// base position of the minimap which also takes splits into account:
|
||||
INT32 MM_X, MM_Y;
|
||||
|
||||
// variables used for actually drawing the icon:
|
||||
INT32 splitflags, minimaptrans;
|
||||
fixed_t amnumxpos, amnumypos;
|
||||
INT32 amxpos, amypos;
|
||||
|
||||
node_t *bsp = &nodes[numnodes-1];
|
||||
fixed_t maxx, minx, maxy, miny;
|
||||
|
||||
fixed_t mapwidth, mapheight;
|
||||
fixed_t xoffset, yoffset;
|
||||
fixed_t xscale, yscale, zoom;
|
||||
fixed_t amxpos, amypos;
|
||||
INT32 mm_x, mm_y;
|
||||
fixed_t patchw, patchh;
|
||||
|
||||
HUDONLY // only run this function in hud hooks
|
||||
@@ -622,8 +598,6 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||
centered = lua_optboolean(L, 6);
|
||||
|
||||
// replicate exactly what source does for its minimap drawer; AKA hardcoded garbo.
|
||||
|
||||
// first, check what position the mmap is supposed to be in (pasted from k_kart.c):
|
||||
MM_X = BASEVIDWIDTH - 50 + cv_mini_xoffset.value; // 270
|
||||
MM_Y = (BASEVIDHEIGHT/2)-16 + cv_mini_yoffset.value; // 84
|
||||
@@ -658,7 +632,6 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
||||
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
|
||||
splitflags |= minimaptrans;
|
||||
|
||||
@@ -676,100 +649,73 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return 0;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
if (stplyrnum != 0)
|
||||
return 0;
|
||||
|
||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
|
||||
AutomapPic = minimapinfo.minimap_pic;
|
||||
|
||||
if (lumpnum != -1)
|
||||
AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
|
||||
else
|
||||
if (!AutomapPic)
|
||||
{
|
||||
return 0; // no pic, just get outta here
|
||||
}
|
||||
|
||||
mx = MM_X - (AutomapPic->width/2);
|
||||
my = MM_Y - (AutomapPic->height/2);
|
||||
// Handle offsets and stuff.
|
||||
mm_x = MM_X - (SHORT(AutomapPic->width)/2);
|
||||
mm_y = MM_Y - (SHORT(AutomapPic->height)/2);
|
||||
|
||||
// let offsets transfer to the heads, too!
|
||||
if (encoremode)
|
||||
mx += SHORT(AutomapPic->leftoffset);
|
||||
{
|
||||
mm_x += SHORT(AutomapPic->leftoffset);
|
||||
}
|
||||
else
|
||||
mx -= SHORT(AutomapPic->leftoffset);
|
||||
my -= SHORT(AutomapPic->topoffset);
|
||||
{
|
||||
mm_x -= SHORT(AutomapPic->leftoffset);
|
||||
}
|
||||
|
||||
// now that we have replicated this behavior, we can draw an icon from our supplied x, y coordinates by replicating k_kart.c's totally understandable uncommented code!!!
|
||||
|
||||
// get map boundaries using nodes
|
||||
maxx = maxy = INT32_MAX;
|
||||
minx = miny = INT32_MIN;
|
||||
minx = bsp->bbox[0][BOXLEFT];
|
||||
maxx = bsp->bbox[0][BOXRIGHT];
|
||||
miny = bsp->bbox[0][BOXBOTTOM];
|
||||
maxy = bsp->bbox[0][BOXTOP];
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minx)
|
||||
minx = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > maxx)
|
||||
maxx = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < miny)
|
||||
miny = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > maxy)
|
||||
maxy = bsp->bbox[1][BOXTOP];
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
// these are our final map boundaries:
|
||||
mapwidth = maxx - minx;
|
||||
mapheight = maxy - miny;
|
||||
|
||||
// These should always be small enough to be bitshift back right now
|
||||
xoffset = (minx + mapwidth/2)<<FRACBITS;
|
||||
yoffset = (miny + mapheight/2)<<FRACBITS;
|
||||
|
||||
xscale = FixedDiv(AutomapPic->width, mapwidth);
|
||||
yscale = FixedDiv(AutomapPic->height, mapheight);
|
||||
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
|
||||
|
||||
amnumxpos = (FixedMul(x, zoom) - FixedMul(xoffset, zoom));
|
||||
amnumypos = -(FixedMul(y, zoom) - FixedMul(yoffset, zoom));
|
||||
|
||||
if (encoremode)
|
||||
amnumxpos = -amnumxpos;
|
||||
mm_y -= SHORT(AutomapPic->topoffset);
|
||||
|
||||
// scale patch coords
|
||||
patchw = patch->width*scale /2;
|
||||
patchh = patch->height*scale /2;
|
||||
patchw = (SHORT(patch->width) * scale / 2);
|
||||
patchh = (SHORT(patch->height) * scale / 2);
|
||||
|
||||
if (centered)
|
||||
{
|
||||
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
|
||||
}
|
||||
|
||||
amxpos = amnumxpos + ((mx + AutomapPic->width/2)<<FRACBITS) - patchw;
|
||||
amypos = amnumypos + ((my + AutomapPic->height/2)<<FRACBITS) - patchh;
|
||||
amnumxpos = (FixedMul(x, minimapinfo.zoom) - minimapinfo.offs_x);
|
||||
amnumypos = -(FixedMul(y, minimapinfo.zoom) - minimapinfo.offs_y);
|
||||
|
||||
if (encoremode)
|
||||
{
|
||||
amnumxpos = -amnumxpos;
|
||||
}
|
||||
|
||||
amxpos = amnumxpos + ((mm_x + SHORT(AutomapPic->width) / 2)<<FRACBITS) - patchw;
|
||||
amypos = amnumypos + ((mm_y + SHORT(AutomapPic->height) / 2)<<FRACBITS) - patchh;
|
||||
|
||||
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
list = (huddrawlist_h) lua_touserdata(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list)){
|
||||
if (cv_minihead.value)
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale/2, patch, splitflags, colormap);
|
||||
else
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
|
||||
}else{
|
||||
if (cv_minihead.value)
|
||||
V_DrawFixedPatch(amxpos, amypos, scale/2, splitflags, patch, colormap);
|
||||
else
|
||||
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
|
||||
if (cv_minihead.value)
|
||||
{
|
||||
amxpos += patchw / 2;
|
||||
amypos += patchh / 2;
|
||||
scale /= 2;
|
||||
}
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list))
|
||||
{
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1255,6 +1201,8 @@ static luaL_Reg lib_draw[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static int lib_draw_ref;
|
||||
|
||||
//
|
||||
// lib_hud
|
||||
//
|
||||
@@ -1288,25 +1236,7 @@ static int lib_hudenabled(lua_State *L)
|
||||
}
|
||||
|
||||
// add a HUD element for rendering
|
||||
static int lib_hudadd(lua_State *L)
|
||||
{
|
||||
enum hudhook field;
|
||||
|
||||
luaL_checktype(L, 1, LUA_TFUNCTION);
|
||||
field = luaL_checkoption(L, 2, "game", hudhook_opt);
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_rawgeti(L, -1, field+2); // HUD[2+]
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_remove(L, -2);
|
||||
|
||||
lua_pushvalue(L, 1);
|
||||
lua_rawseti(L, -2, (int)(lua_objlen(L, -2) + 1));
|
||||
|
||||
hudAvailable |= 1<<field;
|
||||
return 0;
|
||||
}
|
||||
extern int lib_hudadd(lua_State *L);
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
@@ -1391,23 +1321,9 @@ int LUA_HudLib(lua_State *L)
|
||||
{
|
||||
memset(hud_enabled, 0xff, (hud_MAX/8)+1);
|
||||
|
||||
lua_newtable(L); // HUD registry table
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
lua_rawseti(L, -2, 1); // HUD[1] = lib_draw
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 2); // HUD[2] = game rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 3); // HUD[3] = scores rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 5); // HUD[5] = vote rendering functions array
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
lib_draw_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
|
||||
luaL_newmetatable(L, META_HUDINFO);
|
||||
lua_pushcfunction(L, hudinfo_get);
|
||||
@@ -1463,153 +1379,19 @@ boolean LUA_HudEnabled(enum hud option)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Hook for HUD rendering
|
||||
void LUAh_GameHUD(huddrawlist_h list)
|
||||
void LUA_SetHudHook(int hook, huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_game)))
|
||||
return;
|
||||
|
||||
lua_getref(gL, lib_draw_ref);
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_game+2); // HUD[2] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
LUA_PushUserdata(gL, stplyr, META_PLAYER);
|
||||
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
|
||||
camnum = stplyrnum + 1;
|
||||
|
||||
hud_interpcounter = 0;
|
||||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -5) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -5); // graphics library (HUD[1])
|
||||
lua_pushvalue(gL, -5); // stplyr
|
||||
lua_pushvalue(gL, -5); // camera
|
||||
LUA_Call(gL, 3, 0, 1);
|
||||
// there used to be a switch statement here, its gone now.
|
||||
if (hook == HUD_HOOK(game))
|
||||
{
|
||||
LUA_PushUserdata(gL, stplyr, META_PLAYER);
|
||||
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
|
||||
camnum = stplyrnum + 1; // for compatibility
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_ScoresHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_scores)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_scores+2); // HUD[3] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_IntermissionHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_intermission)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_intermission+2); // HUD[4] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_VoteHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_vote)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_vote+2); // HUD[5] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
+3
-1
@@ -111,6 +111,8 @@ static void A_Lua(mobj_t *actor)
|
||||
lua_pushinteger(gL, var2);
|
||||
LUA_Call(gL, 3, 0, 1);
|
||||
|
||||
lua_pop(gL, 1); // pop error handler
|
||||
|
||||
if (found)
|
||||
{
|
||||
--superstack;
|
||||
@@ -940,7 +942,7 @@ static int lib_setSfxInfo(lua_State *L)
|
||||
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
int j = lua_tointeger(L, 2) - 1;
|
||||
int j = lua_tointeger(L, 2);
|
||||
|
||||
// Read and Write enums were combined, need to do this switch now
|
||||
switch (j)
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ static int lib_iterateSectorThinglist(lua_State *L)
|
||||
if (!lua_isnil(L, 1))
|
||||
{
|
||||
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
if (P_MobjWasRemoved(thing))
|
||||
if (!thing)
|
||||
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
|
||||
thing = thing->snext;
|
||||
}
|
||||
|
||||
+189
-573
File diff suppressed because it is too large.
Load diff
+5
-6
@@ -13,6 +13,7 @@
|
||||
#include "m_fixed.h"
|
||||
#include "doomtype.h"
|
||||
#include "d_player.h"
|
||||
#include "p_saveg.h"
|
||||
|
||||
#include "blua/lua.h"
|
||||
#include "blua/lualib.h"
|
||||
@@ -55,17 +56,15 @@ void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
void LUA_InvalidatePlayer(player_t *player);
|
||||
void LUA_Step(void);
|
||||
void LUA_Archive(void);
|
||||
void LUA_UnArchive(void);
|
||||
|
||||
void LUA_ArchiveDemo(void);
|
||||
void LUA_UnArchiveDemo(void);
|
||||
void LUA_Archive(savebuffer_t *save, boolean network);
|
||||
void LUA_UnArchive(savebuffer_t *save, boolean network);
|
||||
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||
int Lua_optoption(lua_State *L, int narg, int def, int list_ref);
|
||||
int Lua_CreateFieldTable(lua_State *L, const char *const lst[]);
|
||||
void LUAh_NetArchiveHook(lua_CFunction archFunc);
|
||||
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save);
|
||||
//void LUA_HookNetArchive(lua_CFunction archFunc);
|
||||
|
||||
// Console wrapper
|
||||
void COM_Lua_f(void);
|
||||
|
||||
@@ -37,8 +37,9 @@
|
||||
/*
|
||||
* Sacrifice very little compression quality in favour of compression speed.
|
||||
* This gives almost the same compression as the default code, and is
|
||||
* (very roughly) 15% faster. This is the preferred mode of operation.
|
||||
* (very roughly) 15% faster. This is the preferable mode of operation.
|
||||
*/
|
||||
|
||||
#ifndef VERY_FAST
|
||||
# define VERY_FAST 1
|
||||
#endif
|
||||
@@ -47,7 +48,7 @@
|
||||
* Sacrifice some more compression quality in favour of compression speed.
|
||||
* (roughly 1-2% worse compression for large blocks and
|
||||
* 9-10% for small, redundant, blocks and >>20% better speed in both cases)
|
||||
* In short: when in need for speed, enable this for binary data,
|
||||
* In INT16: when in need for speed, enable this for binary data,
|
||||
* possibly disable this for text data.
|
||||
*/
|
||||
#ifndef ULTRA_FAST
|
||||
@@ -65,10 +66,21 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use string functions to copy memory.
|
||||
* this is usually a loss, even with glibc's optimized memcpy
|
||||
*/
|
||||
#ifndef USE_MEMCPY
|
||||
#ifdef _MSC_VER
|
||||
# define USE_MEMCPY 0
|
||||
#else
|
||||
# define USE_MEMCPY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* You may choose to pre-set the hash table (might be faster on some
|
||||
* modern cpus and large (>>64k) blocks, and also makes compression
|
||||
* deterministic/repeatable when the configuration otherwise is the same).
|
||||
* modern cpus and large (>>64k) blocks)
|
||||
*/
|
||||
#ifndef INIT_HTAB
|
||||
# define INIT_HTAB 1
|
||||
@@ -76,15 +88,15 @@
|
||||
|
||||
/*
|
||||
* Avoid assigning values to errno variable? for some embedding purposes
|
||||
* (linux kernel for example), this is necessary. NOTE: this breaks
|
||||
* the documentation in lzf.h. Avoiding errno has no speed impact.
|
||||
* (linux kernel for example), this is neccessary. NOTE: this breaks
|
||||
* the documentation in lzf.h.
|
||||
*/
|
||||
#ifndef AVOID_ERRNO
|
||||
# define AVOID_ERRNO 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Whether to pass the LZF_STATE variable as argument, or allocate it
|
||||
* Wether to pass the LZF_STATE variable as argument, or allocate it
|
||||
* on the stack. For small-stack environments, define this to 1.
|
||||
* NOTE: this breaks the prototype in lzf.h.
|
||||
*/
|
||||
@@ -93,108 +105,50 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Whether to add extra checks for input validity in lzf_decompress
|
||||
* Wether to add extra checks for input validity in lzf_decompress
|
||||
* and return EINVAL if the input stream has been corrupted. This
|
||||
* only shields against overflowing the input buffer and will not
|
||||
* detect most corrupted streams.
|
||||
* This check is not normally noticeable on modern hardware
|
||||
* This check is not normally noticable on modern hardware
|
||||
* (<1% slowdown), but might slow down older cpus considerably.
|
||||
*/
|
||||
#ifndef CHECK_INPUT
|
||||
# define CHECK_INPUT 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Whether the target CPU has a slow multiplication. This affects
|
||||
* the default hash function for the compressor, and enables a slightly
|
||||
* worse hash function that needs only shifts.
|
||||
*/
|
||||
#ifndef MULTIPLICATION_IS_SLOW
|
||||
# define MULTIPLICATION_IS_SLOW 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If defined, then this data type will be used for storing offsets.
|
||||
* This can be useful if you want to use a huge hashtable, want to
|
||||
* conserve memory, or both, and your data fits into e.g. 64kb.
|
||||
* If instead you want to compress data > 4GB, then it's better to
|
||||
* to "#define LZF_USE_OFFSETS 0" instead.
|
||||
*/
|
||||
/*#define LZF_HSLOT unsigned short*/
|
||||
|
||||
/*
|
||||
* Whether to store pointers or offsets inside the hash table. On
|
||||
* 64 bit architetcures, pointers take up twice as much space,
|
||||
* and might also be slower. Default is to autodetect.
|
||||
*/
|
||||
/*#define LZF_USE_OFFSETS autodetect */
|
||||
|
||||
/*
|
||||
* Whether to optimise code for size, at the expense of speed. Use
|
||||
* this when you are extremely tight on memory, perhaps in combination
|
||||
* with AVOID_ERRNO 1 and CHECK_INPUT 0.
|
||||
*/
|
||||
#ifndef OPTIMISE_SIZE
|
||||
# ifdef __OPTIMIZE_SIZE__
|
||||
# define OPTIMISE_SIZE 1
|
||||
# else
|
||||
# define OPTIMISE_SIZE 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* nothing should be changed below */
|
||||
|
||||
# include <string.h>
|
||||
# include <limits.h>
|
||||
|
||||
#if ULTRA_FAST
|
||||
# undef VERY_FAST
|
||||
#endif
|
||||
|
||||
#ifndef LZF_USE_OFFSETS
|
||||
# ifdef _WIN32
|
||||
# define LZF_USE_OFFSETS defined(_M_X64)
|
||||
# else
|
||||
# include <stdint.h>
|
||||
# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char u8;
|
||||
|
||||
#ifdef LZF_HSLOT
|
||||
# define LZF_HSLOT_BIAS ((const u8 *)in_data)
|
||||
#else
|
||||
# ifdef LZF_USE_OFFSETS
|
||||
# define LZF_HSLOT_BIAS ((const u8 *)in_data)
|
||||
typedef unsigned int LZF_HSLOT;
|
||||
typedef const u8 *LZF_STATE[1 << (HLOG)];
|
||||
|
||||
#if !STRICT_ALIGN
|
||||
/* for unaligned accesses we need a 16 bit datatype. */
|
||||
# include <limits.h>
|
||||
# if USHRT_MAX == 65535
|
||||
typedef unsigned short u16;
|
||||
# elif UINT_MAX == 65535
|
||||
typedef unsigned int u16;
|
||||
# else
|
||||
# define LZF_HSLOT_BIAS 0
|
||||
typedef const u8 *LZF_HSLOT;
|
||||
# undef STRICT_ALIGN
|
||||
# define STRICT_ALIGN 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if USHRT_MAX == 65535
|
||||
typedef unsigned short u16;
|
||||
#elif UINT_MAX == 65535
|
||||
typedef unsigned int u16;
|
||||
#else
|
||||
# undef STRICT_ALIGN
|
||||
# define STRICT_ALIGN 1
|
||||
#if ULTRA_FAST
|
||||
# if defined(VERY_FAST)
|
||||
# undef VERY_FAST
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define LZF_MAX_LIT (1 << 5)
|
||||
#define LZF_MAX_OFF (1 << 13)
|
||||
#define LZF_MAX_REF ((1 << 8) + (1 << 3))
|
||||
|
||||
typedef LZF_HSLOT LZF_STATE[1 << (HLOG)];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const u8 *first [1 << (6+8)]; /* most recent occurance of a match */
|
||||
u16 prev [LZF_MAX_OFF]; /* how many bytes to go backwards for the next match */
|
||||
} LZF_STATE_BEST[1];
|
||||
#if USE_MEMCPY || INIT_HTAB
|
||||
# ifdef __cplusplus
|
||||
# include <cstring>
|
||||
# else
|
||||
# include <string.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -210,31 +164,14 @@ typedef struct
|
||||
# define SET_ERRNO(n) errno = (n)
|
||||
#endif
|
||||
|
||||
#ifndef USE_REP_MOVSB
|
||||
#if (defined (__i386) || defined (__amd64)) && __GNUC__ >= 3
|
||||
#define USE_REP_MOVSB 1
|
||||
#else
|
||||
#define USE_REP_MOVSB 0 // Default to 0 if not defined elsewhere
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if USE_REP_MOVSB /* small win on amd, big loss on intel */
|
||||
#if (defined (__i386) || defined (__amd64)) && __GNUC__ >= 3
|
||||
# define lzf_movsb(dst, src, len) \
|
||||
asm ("rep movsb" \
|
||||
: "=D" (dst), "=S" (src), "=c" (len) \
|
||||
: "0" (dst), "1" (src), "2" (len));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
size_t
|
||||
lzf_decompress (const void *const in_data, size_t in_len,
|
||||
void *out_data, size_t out_len)
|
||||
void *out_data, size_t out_len)
|
||||
{
|
||||
u8 const *ip = (const u8 *)in_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
u8 const *const in_end = ip + in_len;
|
||||
u8 *const out_end = op + out_len;
|
||||
u8 *const out_end = op + out_len;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -258,23 +195,14 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef lzf_movsb
|
||||
lzf_movsb (op, ip, ctrl);
|
||||
#elif OPTIMISE_SIZE
|
||||
while (ctrl--)
|
||||
*op++ = *ip++;
|
||||
#if USE_MEMCPY
|
||||
M_Memcpy (op, ip, ctrl);
|
||||
op += ctrl;
|
||||
ip += ctrl;
|
||||
#else
|
||||
switch (ctrl)
|
||||
{
|
||||
case 32: *op++ = *ip++; case 31: *op++ = *ip++; case 30: *op++ = *ip++; case 29: *op++ = *ip++;
|
||||
case 28: *op++ = *ip++; case 27: *op++ = *ip++; case 26: *op++ = *ip++; case 25: *op++ = *ip++;
|
||||
case 24: *op++ = *ip++; case 23: *op++ = *ip++; case 22: *op++ = *ip++; case 21: *op++ = *ip++;
|
||||
case 20: *op++ = *ip++; case 19: *op++ = *ip++; case 18: *op++ = *ip++; case 17: *op++ = *ip++;
|
||||
case 16: *op++ = *ip++; case 15: *op++ = *ip++; case 14: *op++ = *ip++; case 13: *op++ = *ip++;
|
||||
case 12: *op++ = *ip++; case 11: *op++ = *ip++; case 10: *op++ = *ip++; case 9: *op++ = *ip++;
|
||||
case 8: *op++ = *ip++; case 7: *op++ = *ip++; case 6: *op++ = *ip++; case 5: *op++ = *ip++;
|
||||
case 4: *op++ = *ip++; case 3: *op++ = *ip++; case 2: *op++ = *ip++; case 1: *op++ = *ip++;
|
||||
}
|
||||
do
|
||||
*op++ = *ip++;
|
||||
while (--ctrl);
|
||||
#endif
|
||||
}
|
||||
else /* back reference */
|
||||
@@ -316,49 +244,12 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef lzf_movsb
|
||||
len += 2;
|
||||
lzf_movsb (op, ref, len);
|
||||
#elif OPTIMISE_SIZE
|
||||
len += 2;
|
||||
*op++ = *ref++;
|
||||
*op++ = *ref++;
|
||||
|
||||
do
|
||||
*op++ = *ref++;
|
||||
while (--len);
|
||||
#else
|
||||
switch (len)
|
||||
{
|
||||
default:
|
||||
len += 2;
|
||||
|
||||
if (op >= ref + len)
|
||||
{
|
||||
/* disjunct areas */
|
||||
memcpy (op, ref, len);
|
||||
op += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* overlapping, use octet by octet copying */
|
||||
do
|
||||
*op++ = *ref++;
|
||||
while (--len);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: *op++ = *ref++;
|
||||
case 8: *op++ = *ref++;
|
||||
case 7: *op++ = *ref++;
|
||||
case 6: *op++ = *ref++;
|
||||
case 5: *op++ = *ref++;
|
||||
case 4: *op++ = *ref++;
|
||||
case 3: *op++ = *ref++;
|
||||
case 2: *op++ = *ref++;
|
||||
case 1: *op++ = *ref++;
|
||||
case 0: *op++ = *ref++; /* two octets more */
|
||||
*op++ = *ref++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
while (ip < in_end);
|
||||
@@ -375,29 +266,23 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
|
||||
/*
|
||||
* don't play with this unless you benchmark!
|
||||
* the data format is not dependent on the hash function.
|
||||
* the hash function might seem strange, just believe me,
|
||||
* decompression is not dependent on the hash function
|
||||
* the hashing function might seem strange, just believe me
|
||||
* it works ;)
|
||||
*/
|
||||
#ifndef FRST
|
||||
# define FRST(p) (((p[0]) << 8) | p[1])
|
||||
# define NEXT(v,p) (((v) << 8) | p[2])
|
||||
# if MULTIPLICATION_IS_SLOW
|
||||
# if ULTRA_FAST
|
||||
# define IDX(h) ((( h >> (3*8 - HLOG)) - h ) & (HSIZE - 1))
|
||||
# elif VERY_FAST
|
||||
# define IDX(h) ((( h >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
|
||||
# else
|
||||
# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
|
||||
# endif
|
||||
# else
|
||||
/* this one was developed with sesse,
|
||||
* and is very similar to the one in snappy.
|
||||
* it does need a modern enough cpu with a fast multiplication.
|
||||
*/
|
||||
# define IDX(h) (((h * 0x1e35a7bdU) >> (32 - HLOG - 8)) & (HSIZE - 1))
|
||||
# endif
|
||||
# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
|
||||
#endif
|
||||
/*
|
||||
* IDX works because it is very similar to a multiplicative hash, e.g.
|
||||
* ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1))
|
||||
* the latter is also quite fast on newer CPUs, and sligthly better
|
||||
*
|
||||
* the next one is also quite good, albeit slow ;)
|
||||
* (int)(cos(h & 0xffffff) * 1e6)
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* original lzv-like hash function, much worse and thus slower */
|
||||
@@ -406,214 +291,177 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
# define IDX(h) ((h) & (HSIZE - 1))
|
||||
#endif
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
# define expect(expr,value) __builtin_expect ((expr),(value))
|
||||
# define inline inline
|
||||
#else
|
||||
# define expect(expr,value) (expr)
|
||||
# define inline static
|
||||
#endif
|
||||
|
||||
#define expect_false(expr) expect ((expr) != 0, 0)
|
||||
#define expect_true(expr) expect ((expr) != 0, 1)
|
||||
#define MAX_LIT (1 << 5)
|
||||
#define MAX_OFF (1 << 13)
|
||||
#define MAX_REF ((1 << 8) + (1 << 3))
|
||||
|
||||
/*
|
||||
* compressed format
|
||||
*
|
||||
* 000LLLLL <L+1> ; literal, L+1=1..33 octets
|
||||
* LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset
|
||||
* 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset
|
||||
* 000LLLLL <L+1> ; literal
|
||||
* LLLooooo oooooooo ; backref L
|
||||
* 111ooooo LLLLLLLL oooooooo ; backref L+7
|
||||
*
|
||||
*/
|
||||
|
||||
size_t
|
||||
lzf_compress (const void *const in_data, size_t in_len,
|
||||
void *out_data, size_t out_len
|
||||
lzf_compress (const void *const in_data,size_t in_len,
|
||||
void *out_data, size_t out_len
|
||||
#if LZF_STATE_ARG
|
||||
, LZF_STATE htab
|
||||
, LZF_STATE *htab
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
#if !LZF_STATE_ARG
|
||||
LZF_STATE htab;
|
||||
#endif
|
||||
const u8 **hslot;
|
||||
const u8 *ip = (const u8 *)in_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
const u8 *in_end = ip + in_len;
|
||||
u8 *out_end = op + out_len;
|
||||
const u8 *ref;
|
||||
|
||||
/*
|
||||
* off requires a type wide enough to hold a general pointer difference.
|
||||
* ISO C doesn't have that (size_t might not be enough and ptrdiff_t only
|
||||
* works for differences within a single object). We also assume that
|
||||
* no bit pattern traps. Since the only platform that is both non-POSIX
|
||||
* and fails to support both assumptions is windows 64 bit, we make a
|
||||
* special workaround for it.
|
||||
*/
|
||||
u8 *out_end = op + out_len;
|
||||
const u8 *ref = NULL;
|
||||
|
||||
unsigned int hval = FRST (ip);
|
||||
size_t off;
|
||||
unsigned int hval;
|
||||
int lit;
|
||||
|
||||
if (!in_len || !out_len)
|
||||
return 0;
|
||||
int lit = 0;
|
||||
|
||||
#if INIT_HTAB
|
||||
# if USE_MEMCPY
|
||||
memset (htab, 0, sizeof (htab));
|
||||
# else
|
||||
for (hslot = htab; hslot < htab + HSIZE; hslot++)
|
||||
*hslot++ = ip;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
lit = 0; op++; /* start run */
|
||||
|
||||
hval = FRST (ip);
|
||||
while (ip < in_end - 2)
|
||||
for (;;)
|
||||
{
|
||||
LZF_HSLOT *hslot;
|
||||
|
||||
hval = NEXT (hval, ip);
|
||||
hslot = htab + IDX (hval);
|
||||
ref = *hslot + LZF_HSLOT_BIAS; *hslot = ip - LZF_HSLOT_BIAS;
|
||||
|
||||
if (1
|
||||
#if INIT_HTAB
|
||||
&& ref < ip /* the next test will actually take care of this, but this is faster */
|
||||
#endif
|
||||
&& (off = ip - ref - 1) < LZF_MAX_OFF
|
||||
&& ref > (const u8 *)in_data
|
||||
&& ref[2] == ip[2]
|
||||
#if STRICT_ALIGN
|
||||
&& ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0])
|
||||
#else
|
||||
&& *(const u16 *)ref == *(const u16 *)ip
|
||||
#endif
|
||||
)
|
||||
if (ip < in_end - 2)
|
||||
{
|
||||
/* match found at *ref++ */
|
||||
unsigned int len = 2;
|
||||
size_t maxlen = in_end - ip - len;
|
||||
maxlen = maxlen > LZF_MAX_REF ? LZF_MAX_REF : maxlen;
|
||||
hval = NEXT (hval, ip);
|
||||
hslot = htab + IDX (hval);
|
||||
ref = *hslot; *hslot = ip;
|
||||
|
||||
if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */
|
||||
if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */
|
||||
return 0;
|
||||
|
||||
op [- lit - 1] = lit - 1; /* stop run */
|
||||
op -= !lit; /* undo run if length is zero */
|
||||
|
||||
for (;;)
|
||||
if (
|
||||
#if INIT_HTAB && !USE_MEMCPY
|
||||
ref < ip /* the next test will actually take care of this, but this is faster */
|
||||
&&
|
||||
#endif
|
||||
(off = ip - ref - 1) < MAX_OFF
|
||||
&& ip + 4 < in_end
|
||||
&& ref > (const u8 *)in_data
|
||||
#if STRICT_ALIGN
|
||||
&& ref[0] == ip[0]
|
||||
&& ref[1] == ip[1]
|
||||
&& ref[2] == ip[2]
|
||||
#else
|
||||
&& *(const u16 *)ref == *(const u16 *)ip
|
||||
&& ref[2] == ip[2]
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (expect_true (maxlen > 16))
|
||||
{
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
/* match found at *ref++ */
|
||||
unsigned int len = 2;
|
||||
size_t maxlen = in_end - ip - len;
|
||||
maxlen = maxlen > MAX_REF ? MAX_REF : maxlen;
|
||||
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
}
|
||||
if (op + lit + 1 + 3 >= out_end)
|
||||
return 0;
|
||||
|
||||
do
|
||||
len++;
|
||||
while (len < maxlen && ref[len] == ip[len]);
|
||||
|
||||
break;
|
||||
}
|
||||
if (lit)
|
||||
{
|
||||
*op++ = (u8)(lit - 1);
|
||||
lit = -lit;
|
||||
do
|
||||
*op++ = ip[lit];
|
||||
while (++lit);
|
||||
}
|
||||
|
||||
len -= 2; /* len is now #octets - 1 */
|
||||
ip++;
|
||||
len -= 2;
|
||||
ip++;
|
||||
|
||||
if (len < 7)
|
||||
{
|
||||
*op++ = (off >> 8) + (len << 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
*op++ = (off >> 8) + ( 7 << 5);
|
||||
*op++ = len - 7;
|
||||
}
|
||||
if (len < 7)
|
||||
{
|
||||
*op++ = (u8)((off >> 8) + (len << 5));
|
||||
}
|
||||
else
|
||||
{
|
||||
*op++ = (u8)((off >> 8) + ( 7 << 5));
|
||||
*op++ = (u8)(len - 7);
|
||||
}
|
||||
|
||||
*op++ = off;
|
||||
|
||||
lit = 0; op++; /* start run */
|
||||
|
||||
ip += len + 1;
|
||||
|
||||
if (expect_false (ip >= in_end - 2))
|
||||
break;
|
||||
*op++ = (u8)off;
|
||||
|
||||
#if ULTRA_FAST || VERY_FAST
|
||||
--ip;
|
||||
# if VERY_FAST && !ULTRA_FAST
|
||||
--ip;
|
||||
# endif
|
||||
hval = FRST (ip);
|
||||
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
|
||||
ip++;
|
||||
|
||||
# if VERY_FAST && !ULTRA_FAST
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
|
||||
ip++;
|
||||
# endif
|
||||
#else
|
||||
ip -= len + 1;
|
||||
|
||||
do
|
||||
{
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
|
||||
ip++;
|
||||
}
|
||||
while (len--);
|
||||
ip += len;
|
||||
#if VERY_FAST && !ULTRA_FAST
|
||||
--ip;
|
||||
#endif
|
||||
hval = FRST (ip);
|
||||
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
ip++;
|
||||
|
||||
#if VERY_FAST && !ULTRA_FAST
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
ip++;
|
||||
#endif
|
||||
#else
|
||||
do
|
||||
{
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
ip++;
|
||||
}
|
||||
while (len--);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (ip == in_end)
|
||||
break;
|
||||
|
||||
/* one more literal byte we must copy */
|
||||
lit++;
|
||||
ip++;
|
||||
|
||||
if (lit == MAX_LIT)
|
||||
{
|
||||
/* one more literal byte we must copy */
|
||||
if (expect_false (op >= out_end))
|
||||
if (op + 1 + MAX_LIT >= out_end)
|
||||
return 0;
|
||||
|
||||
lit++; *op++ = *ip++;
|
||||
|
||||
if (expect_false (lit == LZF_MAX_LIT))
|
||||
{
|
||||
op [- lit - 1] = lit - 1; /* stop run */
|
||||
lit = 0; op++; /* start run */
|
||||
}
|
||||
*op++ = MAX_LIT - 1;
|
||||
#if USE_MEMCPY
|
||||
M_Memcpy (op, ip - MAX_LIT, MAX_LIT);
|
||||
op += MAX_LIT;
|
||||
lit = 0;
|
||||
#else
|
||||
lit = -lit;
|
||||
do
|
||||
*op++ = ip[lit];
|
||||
while (++lit);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (op + 3 > out_end) /* at most 3 bytes can be missing here */
|
||||
return 0;
|
||||
|
||||
while (ip < in_end)
|
||||
if (lit)
|
||||
{
|
||||
lit++; *op++ = *ip++;
|
||||
if (op + lit + 1 >= out_end)
|
||||
return 0;
|
||||
|
||||
if (expect_false (lit == LZF_MAX_LIT))
|
||||
{
|
||||
op [- lit - 1] = lit - 1; /* stop run */
|
||||
lit = 0; op++; /* start run */
|
||||
}
|
||||
*op++ = (u8)(lit - 1);
|
||||
lit = -lit;
|
||||
do
|
||||
*op++ = ip[lit];
|
||||
while (++lit);
|
||||
}
|
||||
|
||||
op [- lit - 1] = lit - 1; /* end run */
|
||||
op -= !lit; /* undo run if length is zero */
|
||||
|
||||
return op - (u8 *)out_data;
|
||||
return op - (u8 *) out_data;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
// Copyright (C) 2000-2005 by Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -22,7 +22,7 @@
|
||||
**
|
||||
***********************************************************************/
|
||||
|
||||
#define LZF_VERSION 0x0106 /* 1.6 */
|
||||
#define LZF_VERSION 0x0105 /* 1.5 */
|
||||
|
||||
/*
|
||||
* Compress in_len bytes stored at the memory block starting at
|
||||
|
||||
+1
-1
@@ -1091,7 +1091,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
|
||||
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
|
||||
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
|
||||
ticruned++;
|
||||
|
||||
@@ -247,6 +247,35 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
|
||||
return INT32_MAX;
|
||||
}
|
||||
|
||||
/** \brief The xs_CRoundToInt function
|
||||
|
||||
\param val double number
|
||||
|
||||
\return Round toward nearest, but ties round toward even
|
||||
*/
|
||||
#if defined(SRB2_BIG_ENDIAN)
|
||||
#define _xs_iexp_ 0
|
||||
#define _xs_iman_ 1
|
||||
#else
|
||||
#define _xs_iexp_ 1 //intel is little endian
|
||||
#define _xs_iman_ 0
|
||||
#endif //BigEndian_
|
||||
|
||||
typedef double real64;
|
||||
|
||||
typedef union _xs_doubleints
|
||||
{
|
||||
real64 val;
|
||||
unsigned ival[2];
|
||||
} _xs_doubleints;
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
|
||||
{
|
||||
_xs_doubleints uval;
|
||||
uval.val = val + 6755399441055744.0;
|
||||
return uval.ival[_xs_iman_];
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
|
||||
+452
-462
File diff suppressed because it is too large.
Load diff
@@ -299,6 +299,10 @@ void Bird_menu_Onchange(void);
|
||||
// Saturn Hud menu updating
|
||||
void SaturnHud_menu_Onchange(void);
|
||||
|
||||
#ifdef HWRENDER
|
||||
void M_UpdateOGLMenu(void);
|
||||
#endif
|
||||
|
||||
void M_ReplayHut(INT32 choice);
|
||||
void M_SetPlaybackMenuPointer(void);
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
// Extended map support.
|
||||
#include <ctype.h>
|
||||
|
||||
#include "am_map.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
#include "m_misc.h"
|
||||
@@ -1573,6 +1575,84 @@ boolean M_ScreenshotResponder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
void M_MinimapGenerate(void)
|
||||
{
|
||||
#ifdef USE_PNG
|
||||
char *filepath;
|
||||
boolean ret = false;
|
||||
minigen_t *minigen = NULL;
|
||||
size_t option_scale;
|
||||
INT32 mul = 1;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "You must be in a level to generate a preliminary minimap!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (automapactive)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "The automap is active! Please deactivate it and try again.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
option_scale = COM_CheckPartialParm("-m");
|
||||
|
||||
if (option_scale)
|
||||
{
|
||||
if (COM_Argc() < option_scale + 2)/* no argument after? */
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,
|
||||
"No multiplier follows parameter '%s'.\n",
|
||||
COM_Argv(option_scale));
|
||||
return;
|
||||
}
|
||||
|
||||
mul = atoi(COM_Argv(option_scale + 1));
|
||||
|
||||
if (mul < 1 || mul > 10)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,
|
||||
"Multiplier %d must be within range 1-10.\n",
|
||||
mul);
|
||||
return;
|
||||
}
|
||||
|
||||
filepath = va("%s" PATHSEP "%s-MINIMAP-%d.png", srb2home, G_BuildMapName(gamemap), mul);
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = va("%s" PATHSEP "%s-MINIMAP.png", srb2home, G_BuildMapName(gamemap));
|
||||
}
|
||||
|
||||
minigen = AM_MinimapGenerate(mul);
|
||||
|
||||
if (minigen == NULL || minigen->buf == NULL)
|
||||
goto failure;
|
||||
|
||||
M_CreateScreenShotPalette();
|
||||
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
|
||||
|
||||
failure:
|
||||
if (minigen->buf != NULL)
|
||||
free(minigen->buf);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
CONS_Printf(M_GetText("%s saved.\nRemember that this is not a complete minimap,\nand must be edited before putting in-game.\n"), filepath);
|
||||
if (mul != 1)
|
||||
{
|
||||
CONS_Printf("You should divide its size by %d!\n", mul);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
|
||||
}
|
||||
#endif //#ifdef USE_PNG
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// TRANSLATION FUNCTIONS
|
||||
// ==========================================================================
|
||||
|
||||
@@ -69,6 +69,8 @@ void M_ScreenShot(void);
|
||||
void M_DoScreenShot(void);
|
||||
boolean M_ScreenshotResponder(event_t *ev);
|
||||
|
||||
void M_MinimapGenerate(void);
|
||||
|
||||
void Command_SaveConfig_f(void);
|
||||
void Command_LoadConfig_f(void);
|
||||
void Command_ChangeConfig_f(void);
|
||||
|
||||
+4
-4
@@ -301,7 +301,7 @@ static boolean PS_IsRowValid(perfstatrow_t *row)
|
||||
|| (row->flags & PS_SW && rendermode != render_soft)
|
||||
|| (row->flags & PS_HW && rendermode != render_opengl)
|
||||
#ifdef HWRENDER
|
||||
|| (row->flags & PS_BATCHING && !cv_grbatching.value)
|
||||
|| (row->flags & PS_BATCHING && !cv_glbatching.value)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
@@ -518,7 +518,7 @@ static void PS_UpdateFrameStats(void)
|
||||
ps_hw_spritesorttime.value.p +
|
||||
ps_hw_spritedrawtime.value.p;
|
||||
|
||||
if (cv_grbatching.value)
|
||||
if (cv_glbatching.value)
|
||||
{
|
||||
ps_otherrendertime.value.p -=
|
||||
ps_hw_batchsorttime.value.p +
|
||||
@@ -547,7 +547,7 @@ static void PS_UpdateFrameStats(void)
|
||||
PS_UpdateRowHistories(interpolation_rows, true);*/
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && cv_grbatching.value)
|
||||
if (rendermode == render_opengl && cv_glbatching.value)
|
||||
{
|
||||
PS_UpdateRowHistories(batchcount_rows, true);
|
||||
PS_UpdateRowHistories(batchcalls_rows, true);
|
||||
@@ -760,7 +760,7 @@ static void PS_DrawRenderStats(void)
|
||||
/*cy = */PS_DrawPerfRows(x, 10, V_BLUEMAP, commoncounter_rows);// + half_row;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && cv_grbatching.value)
|
||||
if (rendermode == render_opengl && cv_glbatching.value)
|
||||
{
|
||||
x = hires ? 200 : 155;
|
||||
y = PS_DrawPerfRows(x, 10, V_PURPLEMAP, batchcount_rows);
|
||||
|
||||
+18
-5
@@ -118,6 +118,15 @@ static void M_TextInputToWordBegin(textinput_t *input, boolean move_sel)
|
||||
if (move_sel) input->select = input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputPaste(textinput_t *input)
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
if (input->select != input->cursor)
|
||||
M_TextInputDelSelection(input);
|
||||
if (paste != NULL)
|
||||
M_TextInputAddString(input, paste);
|
||||
}
|
||||
|
||||
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
|
||||
{
|
||||
input->buffer = buffer;
|
||||
@@ -131,6 +140,8 @@ void M_TextInputClear(textinput_t *input)
|
||||
input->cursor = 0;
|
||||
input->select = 0;
|
||||
input->length = 0;
|
||||
|
||||
input->buffer[0] = 0;
|
||||
}
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c)
|
||||
@@ -147,6 +158,12 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
||||
|| key == KEY_LALT || key == KEY_RALT)
|
||||
return false;
|
||||
|
||||
if (shiftdown && key == KEY_INS)
|
||||
{
|
||||
M_TextInputPaste(input);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
|
||||
{
|
||||
if (key == 'x' || key == 'X')
|
||||
@@ -168,11 +185,7 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
||||
}
|
||||
else if (key == 'v' || key == 'V')
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
if (input->select != input->cursor)
|
||||
M_TextInputDelSelection(input);
|
||||
if (paste != NULL)
|
||||
M_TextInputAddString(input, paste);
|
||||
M_TextInputPaste(input);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'w' || key == 'W')
|
||||
|
||||
+1
-78
@@ -165,9 +165,6 @@ void A_SpawnObjectAbsolute(mobj_t *actor);
|
||||
void A_SpawnObjectRelative(mobj_t *actor);
|
||||
void A_ChangeAngleRelative(mobj_t *actor);
|
||||
void A_ChangeAngleAbsolute(mobj_t *actor);
|
||||
void A_RollAngle(mobj_t *actor);
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor);
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor);
|
||||
void A_PlaySound(mobj_t *actor);
|
||||
void A_FindTarget(mobj_t *actor);
|
||||
void A_FindTracer(mobj_t *actor);
|
||||
@@ -2658,7 +2655,7 @@ void A_BossDeath(mobj_t *mo)
|
||||
}
|
||||
|
||||
bossjustdie:
|
||||
if (LUAh_BossDeath(mo))
|
||||
if (LUA_HookMobj(mo, MOBJ_HOOK(BossDeath)))
|
||||
return;
|
||||
else if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
@@ -7183,80 +7180,6 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
||||
actor->angle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_RollAngle
|
||||
//
|
||||
// Description: Changes the roll angle.
|
||||
//
|
||||
// var1 = angle
|
||||
// var2 = relative? (default)
|
||||
//
|
||||
void A_RollAngle(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const angle_t angle = FixedAngle(locvar1*FRACUNIT);
|
||||
|
||||
if (LUA_CallAction(A_ROLLANGLE, actor))
|
||||
return;
|
||||
|
||||
// relative (default)
|
||||
if (!locvar2)
|
||||
actor->rollangle += angle;
|
||||
// absolute
|
||||
else
|
||||
actor->rollangle = angle;
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleRelative
|
||||
//
|
||||
// Description: Changes the roll angle to a random relative value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLERELATIVE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleRelative: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle += FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleAbsolute
|
||||
//
|
||||
// Description: Changes the roll angle to a random absolute value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLEABSOLUTE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_PlaySound
|
||||
//
|
||||
// Description: Plays a sound
|
||||
|
||||
+36
-111
@@ -2119,10 +2119,11 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
sec = §ors[secnum];
|
||||
|
||||
FOFsector = false;
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5)
|
||||
if (special == 3 || special == 5)
|
||||
floortouch = true;
|
||||
else if (GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 8)
|
||||
else if (special >= 1 && special <= 8)
|
||||
floortouch = false;
|
||||
else
|
||||
continue;
|
||||
@@ -2254,7 +2255,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
continue;
|
||||
|
||||
if (!(players[i].mo->subsector->sector == sec
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec))
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, special) == sec))
|
||||
continue;
|
||||
|
||||
if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec))
|
||||
@@ -2298,7 +2299,9 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
|
||||
while ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1)
|
||||
{
|
||||
if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3)
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (special == 2 || special == 3)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
@@ -2507,123 +2510,44 @@ void T_CameraScanner(elevator_t *elevator)
|
||||
{
|
||||
// leveltime is compared to make multiple scanners in one map function correctly.
|
||||
static tic_t lastleveltime = 32000; // any number other than 0 should do here
|
||||
static boolean camerascanned, camerascanned2, camerascanned3, camerascanned4;
|
||||
static boolean camerascanned[MAXSPLITSCREENPLAYERS];
|
||||
static fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
static fixed_t t_cam_height[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
|
||||
if (leveltime != lastleveltime) // Back on the first camera scanner
|
||||
{
|
||||
camerascanned = camerascanned2 = camerascanned3 = camerascanned4 = false;
|
||||
memset(camerascanned, false, sizeof (camerascanned));
|
||||
lastleveltime = leveltime;
|
||||
}
|
||||
|
||||
if (players[displayplayers[0]].mo)
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (players[displayplayers[0]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam_dist == -42)
|
||||
t_cam_dist = cv_cam_dist.value;
|
||||
if (t_cam_height == -42)
|
||||
t_cam_height = cv_cam_height.value;
|
||||
if (t_cam_rotate == -42)
|
||||
t_cam_rotate = cv_cam_rotate.value;
|
||||
CV_SetValue(&cv_cam_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam_rotate, elevator->distance);
|
||||
camerascanned = true;
|
||||
}
|
||||
else if (!camerascanned)
|
||||
{
|
||||
if (t_cam_height != -42 && cv_cam_height.value != t_cam_height)
|
||||
CV_Set(&cv_cam_height, va("%f", (double)FIXED_TO_FLOAT(t_cam_height)));
|
||||
if (t_cam_dist != -42 && cv_cam_dist.value != t_cam_dist)
|
||||
CV_Set(&cv_cam_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam_dist)));
|
||||
if (t_cam_rotate != -42 && cv_cam_rotate.value != t_cam_rotate)
|
||||
CV_Set(&cv_cam_rotate, va("%f", (double)t_cam_rotate));
|
||||
if (!players[displayplayers[i]].mo || P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||
continue;
|
||||
|
||||
t_cam_dist = t_cam_height = t_cam_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen && players[displayplayers[1]].mo)
|
||||
{
|
||||
if (players[displayplayers[1]].mo->subsector->sector == elevator->actionsector)
|
||||
if (players[displayplayers[i]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_dist = cv_cam2_dist.value;
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_height = cv_cam2_height.value;
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_rotate = cv_cam2_rotate.value;
|
||||
CV_SetValue(&cv_cam2_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam2_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam2_rotate, elevator->distance);
|
||||
camerascanned2 = true;
|
||||
if (t_cam_dist[i] == -42)
|
||||
t_cam_dist[i] = cv_cam_dist[i].value;
|
||||
if (t_cam_height[i] == -42)
|
||||
t_cam_height[i] = cv_cam_height[i].value;
|
||||
if (t_cam_rotate[i] == -42)
|
||||
t_cam_rotate[i] = cv_cam_rotate[i].value;
|
||||
CV_SetValue(&cv_cam_height[i], FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam_dist[i], FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam_rotate[i], elevator->distance);
|
||||
camerascanned[i] = true;
|
||||
}
|
||||
else if (!camerascanned2)
|
||||
else if (!camerascanned[i])
|
||||
{
|
||||
if (t_cam2_height != -42 && cv_cam2_height.value != t_cam2_height)
|
||||
CV_Set(&cv_cam2_height, va("%f", (double)FIXED_TO_FLOAT(t_cam2_height)));
|
||||
if (t_cam2_dist != -42 && cv_cam2_dist.value != t_cam2_dist)
|
||||
CV_Set(&cv_cam2_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam2_dist)));
|
||||
if (t_cam2_rotate != -42 && cv_cam2_rotate.value != t_cam2_rotate)
|
||||
CV_Set(&cv_cam2_rotate, va("%f", (double)t_cam2_rotate));
|
||||
if (t_cam_height[i] != -42 && cv_cam_height[i].value != t_cam_height[i])
|
||||
CV_Set(&cv_cam_height[i], va("%f", (double)FIXED_TO_FLOAT(t_cam_height[i])));
|
||||
if (t_cam_dist[i] != -42 && cv_cam_dist[i].value != t_cam_dist[i])
|
||||
CV_Set(&cv_cam_dist[i], va("%f", (double)FIXED_TO_FLOAT(t_cam_dist[i])));
|
||||
if (t_cam_rotate[i] != -42 && cv_cam_rotate[i].value != t_cam_rotate[i])
|
||||
CV_Set(&cv_cam_rotate[i], va("%f", (double)t_cam_rotate[i]));
|
||||
|
||||
t_cam2_dist = t_cam2_height = t_cam2_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen > 1 && players[displayplayers[2]].mo)
|
||||
{
|
||||
if (players[displayplayers[2]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_dist = cv_cam3_dist.value;
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_height = cv_cam3_height.value;
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_rotate = cv_cam3_rotate.value;
|
||||
CV_SetValue(&cv_cam3_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam3_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam3_rotate, elevator->distance);
|
||||
camerascanned3 = true;
|
||||
}
|
||||
else if (!camerascanned3)
|
||||
{
|
||||
if (t_cam3_height != -42 && cv_cam3_height.value != t_cam3_height)
|
||||
CV_Set(&cv_cam3_height, va("%f", (double)FIXED_TO_FLOAT(t_cam3_height)));
|
||||
if (t_cam3_dist != -42 && cv_cam3_dist.value != t_cam3_dist)
|
||||
CV_Set(&cv_cam3_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam3_dist)));
|
||||
if (t_cam3_rotate != -42 && cv_cam3_rotate.value != t_cam3_rotate)
|
||||
CV_Set(&cv_cam3_rotate, va("%f", (double)t_cam3_rotate));
|
||||
|
||||
t_cam3_dist = t_cam3_height = t_cam3_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen > 2 && players[displayplayers[3]].mo)
|
||||
{
|
||||
if (players[displayplayers[3]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_dist = cv_cam4_dist.value;
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_height = cv_cam4_height.value;
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_rotate = cv_cam4_rotate.value;
|
||||
CV_SetValue(&cv_cam4_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam4_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam4_rotate, elevator->distance);
|
||||
camerascanned4 = true;
|
||||
}
|
||||
else if (!camerascanned4)
|
||||
{
|
||||
if (t_cam4_height != -42 && cv_cam4_height.value != t_cam4_height)
|
||||
CV_Set(&cv_cam4_height, va("%f", (double)FIXED_TO_FLOAT(t_cam4_height)));
|
||||
if (t_cam4_dist != -42 && cv_cam4_dist.value != t_cam4_dist)
|
||||
CV_Set(&cv_cam4_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam4_dist)));
|
||||
if (t_cam4_rotate != -42 && cv_cam4_rotate.value != t_cam4_rotate)
|
||||
CV_Set(&cv_cam4_rotate, va("%f", (double)t_cam4_rotate));
|
||||
|
||||
t_cam4_dist = t_cam4_height = t_cam4_rotate = -42;
|
||||
t_cam_dist[i] = t_cam_height[i] = t_cam_rotate[i] = -42;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2996,11 +2920,12 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
||||
fixed_t a, b, c;
|
||||
mobjtype_t type = MT_ROCKCRUMBLE1;
|
||||
const fixed_t spacing = 48*mapobjectscale;
|
||||
INT32 special = GETSECSPECIAL(rover->master->frontsector->special, 3);
|
||||
|
||||
// If the control sector has a special
|
||||
// of Section3:7-15, use the custom debris.
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 3) >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(GETSECSPECIAL(rover->master->frontsector->special, 3)-7);
|
||||
if (special >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(special-7);
|
||||
|
||||
// soundorg z height never gets set normally, so MEH.
|
||||
sec->soundorg.z = sec->floorheight;
|
||||
|
||||
+12
-16
@@ -284,7 +284,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
if (special->flags & MF_BOSS && special->flags2 & MF2_FRET)
|
||||
return;
|
||||
|
||||
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
if (LUA_HookTouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
return;
|
||||
|
||||
if (special->flags & MF_BOSS)
|
||||
@@ -976,11 +976,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
break;
|
||||
case MT_HOOPCOLLIDE:
|
||||
// This produces a kind of 'domino effect' with the hoop's pieces.
|
||||
if (!midgamejoin)
|
||||
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
|
||||
for (; !P_MobjWasRemoved(special->hprev); special = special->hprev); // Move to the first sprite in the hoop
|
||||
|
||||
i = 0;
|
||||
for (; special->type == MT_HOOP; special = special->hnext)
|
||||
for (; !P_MobjWasRemoved(special->hnext) && special->type == MT_HOOP; special = special->hnext)
|
||||
{
|
||||
special->fuse = 11;
|
||||
special->movedir = i;
|
||||
@@ -1641,7 +1640,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
|
||||
target->health = 0; // This makes it easy to check if something's dead elsewhere.
|
||||
|
||||
if (LUAh_MobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
|
||||
return;
|
||||
|
||||
// SRB2kart
|
||||
@@ -2397,11 +2396,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
// Everything above here can't be forced.
|
||||
if (!metalrecording)
|
||||
{
|
||||
UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage);
|
||||
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage);
|
||||
if (P_MobjWasRemoved(target))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
if (P_MobjWasRemoved(source))
|
||||
source = NULL;
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
@@ -2440,7 +2437,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (!force && target->fuse) // Invincible
|
||||
return false;
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
|
||||
if (target->health > 1)
|
||||
@@ -2466,7 +2463,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (!force && target->flags2 & MF2_FRET) // Currently flashing from being hit
|
||||
return false;
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
|
||||
if (target->health > 1)
|
||||
@@ -2474,7 +2471,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
}
|
||||
else if (target->flags & MF_ENEMY)
|
||||
{
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2503,14 +2500,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
}
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
P_NiGHTSDamage(target, source); // -5s :(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
if (!force && inflictor && (inflictor->flags & MF_FIRE))
|
||||
@@ -2638,6 +2635,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_ResetPlayer(target->player);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (target->type)
|
||||
{
|
||||
case MT_EGGMOBILE2: // egg slimer
|
||||
@@ -2651,9 +2649,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_SetMobjState(target, target->info->painstate);
|
||||
break;
|
||||
}
|
||||
|
||||
if (P_MobjWasRemoved(target))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!P_MobjWasRemoved(target))
|
||||
{
|
||||
|
||||
+36
-34
@@ -66,6 +66,7 @@
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
extern mobj_t *mobjcache;
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
@@ -78,8 +79,19 @@ void P_UnlinkThinker(thinker_t *thinker);
|
||||
typedef struct camera_s
|
||||
{
|
||||
boolean chase;
|
||||
boolean freecam;
|
||||
|
||||
angle_t localangle;
|
||||
INT32 localaiming;
|
||||
|
||||
angle_t aiming;
|
||||
|
||||
// Freecam: A button was held since entering from menu, so don't move camera
|
||||
UINT8 button_a_held;
|
||||
|
||||
// Freecam: aiming needs to be reset after switching from chasecam
|
||||
boolean reset_aiming;
|
||||
|
||||
// Things used by FS cameras.
|
||||
fixed_t viewheight;
|
||||
angle_t startangle;
|
||||
@@ -111,32 +123,15 @@ typedef struct camera_s
|
||||
fixed_t pan;
|
||||
} camera_t;
|
||||
|
||||
// demo freecam or something before i commit die
|
||||
struct demofreecam_s {
|
||||
|
||||
camera_t *cam; // this is useful when the game is paused, notably
|
||||
mobj_t *soundmobj; // mobj to play sound from, used in s_sound
|
||||
|
||||
angle_t localangle; // keeps track of the cam angle for cmds
|
||||
angle_t localaiming; // ditto with aiming
|
||||
boolean turnheld; // holding turn button for gradual turn speed
|
||||
boolean keyboardlook; // keyboard look
|
||||
};
|
||||
|
||||
extern struct demofreecam_s democam;
|
||||
|
||||
extern camera_t camera[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed;
|
||||
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_speed[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_cam2_dist, cv_cam2_still, cv_cam2_height;
|
||||
extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed;
|
||||
|
||||
extern consvar_t cv_cam3_dist, cv_cam3_still, cv_cam3_height;
|
||||
extern consvar_t cv_cam3_speed, cv_cam3_rotate, cv_cam3_rotspeed;
|
||||
|
||||
extern consvar_t cv_cam4_dist, cv_cam4_still, cv_cam4_height;
|
||||
extern consvar_t cv_cam4_speed, cv_cam4_rotate, cv_cam4_rotspeed;
|
||||
extern consvar_t cv_freecam_speed;
|
||||
|
||||
extern consvar_t cv_tilting;
|
||||
extern consvar_t cv_quaketilt;
|
||||
@@ -146,10 +141,7 @@ extern consvar_t cv_actionmovie;
|
||||
|
||||
extern consvar_t cv_lookbackmom;
|
||||
|
||||
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
||||
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
||||
extern fixed_t t_cam3_dist, t_cam3_height, t_cam3_rotate;
|
||||
extern fixed_t t_cam4_dist, t_cam4_height, t_cam4_rotate;
|
||||
extern fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
fixed_t P_GetPlayerHeight(player_t *player);
|
||||
fixed_t P_GetPlayerSpinHeight(player_t *player);
|
||||
@@ -157,10 +149,10 @@ void P_AddPlayerScore(player_t *player, UINT32 amount);
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam);
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
|
||||
void P_SlideCameraMove(camera_t *thiscam);
|
||||
void P_DemoCameraMovement(camera_t *cam);
|
||||
//void P_DemoCameraMovement(camera_t *cam, UINT8 num);
|
||||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
void P_ResetLocalCamAiming(player_t *player);
|
||||
void P_InitCameraCmd(void);
|
||||
void P_ToggleDemoCamera(UINT8 viewnum);
|
||||
boolean P_PlayerInPain(player_t *player);
|
||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void P_ResetPlayer(player_t *player);
|
||||
@@ -265,7 +257,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.acp1 != (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);
|
||||
@@ -298,7 +290,14 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
|
||||
#define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
|
||||
#endif
|
||||
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
|
||||
SINT8 P_MobjFlip(const mobj_t *mobj);
|
||||
|
||||
// P_MobjFlip
|
||||
// Special utility to return +1 or -1 depending on mobj's gravity
|
||||
FUNCINLINE static ATTRINLINE SINT8 P_MobjFlip(const mobj_t *mobj)
|
||||
{
|
||||
return (mobj && mobj->eflags & MFE_VERTICALFLIP) ? -1 : 1;
|
||||
}
|
||||
|
||||
fixed_t P_GetMobjGravity(mobj_t *mo);
|
||||
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
|
||||
|
||||
@@ -368,7 +367,11 @@ boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
|
||||
void P_SlideMove(mobj_t *mo, boolean forceslide);
|
||||
void P_BouncePlayerMove(mobj_t *mo);
|
||||
void P_BounceMove(mobj_t *mo);
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
|
||||
|
||||
#define P_CheckSight(t1, t2) P_CheckSight2(t1, t2, false)
|
||||
#define P_CheckSightFast(t1, t2) P_CheckSight2(t1, t2, true)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast);
|
||||
|
||||
void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius);
|
||||
|
||||
boolean P_CheckSector(sector_t *sector, boolean crunch);
|
||||
@@ -441,7 +444,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
|
||||
void P_PlayerFlagBurst(player_t *player, boolean toss);
|
||||
void P_CheckTimeLimit(void);
|
||||
void P_CheckPointLimit(void);
|
||||
//void P_CheckSurvivors(void);
|
||||
boolean P_CheckRacers(void);
|
||||
|
||||
boolean P_CanPickupItem(player_t *player, UINT8 weapon);
|
||||
|
||||
+9
-5
@@ -449,7 +449,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
}
|
||||
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
|
||||
UINT8 shouldCollide = LUA_Hook2Mobj(thing, tmthing, MOBJ_HOOK(MobjCollide)); // checks hook for thing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
@@ -458,7 +458,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
return true; // force no collide
|
||||
}
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
|
||||
UINT8 shouldCollide = LUA_Hook2Mobj(tmthing, thing, MOBJ_HOOK(MobjMoveCollide)); // checks hook for tmthing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
@@ -1727,6 +1727,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tmbbox[BOXLEFT] = x - tmthing->radius;
|
||||
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
// The base floor / ceiling is from the subsector
|
||||
@@ -2391,16 +2392,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
{
|
||||
//All things are affected by their scale.
|
||||
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
INT32 special = 0;
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
|
||||
// If using type Section1:13, double the maxstep.
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13)
|
||||
|| special == 13)
|
||||
maxstep <<= 1;
|
||||
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12)
|
||||
|| special == 12)
|
||||
maxstep = 0;
|
||||
}
|
||||
|
||||
@@ -2446,7 +2450,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
else if (maxstep > 0 && !(
|
||||
thing->player && (
|
||||
P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)
|
||||
|| special == 14)
|
||||
)) // Step down
|
||||
{
|
||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||
|
||||
+226
-181
@@ -48,6 +48,7 @@ actioncache_t actioncachehead;
|
||||
static mobj_t *overlaycap = NULL;
|
||||
static mobj_t *shadowcap = NULL;
|
||||
mobj_t *waypointcap = NULL;
|
||||
mobj_t *mobjcache = NULL;
|
||||
|
||||
void P_InitCachedActions(void)
|
||||
{
|
||||
@@ -91,6 +92,7 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
|
||||
// var2 determines delay between animation frames
|
||||
if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0)
|
||||
return;
|
||||
|
||||
mobj->anim_duration = (UINT16)mobj->state->var2;
|
||||
|
||||
// compare the current sprite frame to the one we started from
|
||||
@@ -351,18 +353,6 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// P_MobjFlip
|
||||
//
|
||||
// Special utility to return +1 or -1 depending on mobj's gravity
|
||||
//
|
||||
SINT8 P_MobjFlip(const mobj_t *mobj)
|
||||
{
|
||||
if (mobj && mobj->eflags & MFE_VERTICALFLIP)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_WeaponOrPanel
|
||||
//
|
||||
@@ -408,7 +398,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
||||
P_RadiusAttack(mo, mo, 96*FRACUNIT);
|
||||
|
||||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
if (explodemo)
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
explodemo->destscale = mo->destscale;
|
||||
@@ -417,7 +407,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
||||
S_StartSound(explodemo, sfx_pop);
|
||||
}
|
||||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
if (explodemo)
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
explodemo->destscale = mo->destscale;
|
||||
@@ -426,7 +416,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
||||
S_StartSound(explodemo, sfx_dmpain);
|
||||
}
|
||||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
if (explodemo)
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
explodemo->destscale = mo->destscale;
|
||||
@@ -435,7 +425,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
||||
S_StartSound(explodemo, sfx_pop);
|
||||
}
|
||||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
if (explodemo)
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
explodemo->destscale = mo->destscale;
|
||||
@@ -1892,12 +1882,13 @@ boolean P_CheckDeathPitCollide(mobj_t *mo)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
INT32 special = GETSECSPECIAL(mo->subsector->sector->special, 1);
|
||||
|
||||
if (((mo->z <= mo->subsector->sector->floorheight
|
||||
&& !(mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_FLOOR))
|
||||
|| (mo->z + mo->height >= mo->subsector->sector->ceilingheight
|
||||
&& (mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_CEILING)))
|
||||
&& (GETSECSPECIAL(mo->subsector->sector->special, 1) == 6
|
||||
|| GETSECSPECIAL(mo->subsector->sector->special, 1) == 7))
|
||||
&& (special == 6 || special == 7))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1908,16 +1899,14 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
{
|
||||
fixed_t topheight =
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
*rover->topheight;
|
||||
fixed_t topheight =
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
*rover->topheight;
|
||||
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
&& !(rover->master->flags & ML_BLOCKMONSTERS)
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
return true;
|
||||
}
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
&& !(rover->master->flags & ML_BLOCKMONSTERS)
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3242,20 +3231,68 @@ void P_DestroyRobots(void)
|
||||
}
|
||||
}
|
||||
|
||||
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
|
||||
static void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
UINT16 postimgflags = 0;
|
||||
UINT8 i;
|
||||
|
||||
if (encoremode)
|
||||
postimgflags |= POSTIMG_MIRROR;
|
||||
if (flipcam)
|
||||
postimgflags |= POSTIMG_FLIP;
|
||||
|
||||
if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
|
||||
{
|
||||
camera_t dummycam;
|
||||
|
||||
dummycam.subsector = player->awayviewmobj->subsector;
|
||||
dummycam.x = player->awayviewmobj->x;
|
||||
dummycam.y = player->awayviewmobj->y;
|
||||
dummycam.z = player->awayviewmobj->z;
|
||||
//dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
|
||||
dummycam.height = 0; // Why? Remote viewpoint cameras have no height.
|
||||
|
||||
// Are we in water?
|
||||
if (P_CameraCheckWater(&dummycam))
|
||||
postimgflags |= POSTIMG_WATER;
|
||||
if (P_CameraCheckHeat(&dummycam))
|
||||
postimgflags |= POSTIMG_HEAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Are we in water?
|
||||
if (P_CameraCheckWater(thiscam))
|
||||
postimgflags |= POSTIMG_WATER;
|
||||
if (P_CameraCheckHeat(thiscam))
|
||||
postimgflags |= POSTIMG_HEAT;
|
||||
}
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player != &players[displayplayers[i]])
|
||||
continue;
|
||||
|
||||
players[displayplayers[i]].postimgflags = postimgflags;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// P_CameraThinker
|
||||
//
|
||||
// Process the mobj-ish required functions of the camera
|
||||
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||
{
|
||||
boolean itsatwodlevel = false;
|
||||
boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
postimg_t postimg = postimg_none;
|
||||
UINT8 i;
|
||||
|
||||
// This can happen when joining
|
||||
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
|
||||
return true;
|
||||
|
||||
P_CalcChasePostImg(player, thiscam);
|
||||
|
||||
if (twodlevel)
|
||||
itsatwodlevel = true;
|
||||
else
|
||||
@@ -3271,64 +3308,27 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
}
|
||||
}
|
||||
|
||||
if (encoremode && !flipcam)
|
||||
postimg = postimg_mirror;
|
||||
else if (!encoremode && flipcam)
|
||||
postimg = postimg_flip;
|
||||
else if (encoremode && flipcam)
|
||||
postimg = postimg_mirrorflip;
|
||||
else if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
|
||||
{
|
||||
camera_t dummycam;
|
||||
dummycam.subsector = player->awayviewmobj->subsector;
|
||||
dummycam.x = player->awayviewmobj->x;
|
||||
dummycam.y = player->awayviewmobj->y;
|
||||
dummycam.z = player->awayviewmobj->z;
|
||||
//dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
|
||||
dummycam.height = 0; // Why? Remote viewpoint cameras have no height.
|
||||
// Are we in water?
|
||||
if (P_CameraCheckWater(&dummycam))
|
||||
postimg = postimg_water;
|
||||
else if (P_CameraCheckHeat(&dummycam))
|
||||
postimg = postimg_heat;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Are we in water?
|
||||
if (P_CameraCheckWater(thiscam))
|
||||
postimg = postimg_water;
|
||||
else if (P_CameraCheckHeat(thiscam))
|
||||
postimg = postimg_heat;
|
||||
}
|
||||
|
||||
if (postimg != postimg_none)
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player != &players[displayplayers[i]])
|
||||
continue;
|
||||
|
||||
postimgtype[i] = postimg;
|
||||
}
|
||||
}
|
||||
|
||||
if (thiscam->momx || thiscam->momy)
|
||||
{
|
||||
if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam))
|
||||
{ // Never fails for 2D mode.
|
||||
if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam)) // Never fails for 2D mode.
|
||||
{
|
||||
mobj_t dummy;
|
||||
|
||||
dummy.thinker.function.acp1 = (actionf_p1)P_MobjThinker;
|
||||
dummy.subsector = thiscam->subsector;
|
||||
dummy.x = thiscam->x;
|
||||
dummy.y = thiscam->y;
|
||||
dummy.z = thiscam->z;
|
||||
dummy.height = thiscam->height;
|
||||
|
||||
if (player->pflags & PF_TIMEOVER)
|
||||
player->kartstuff[k_timeovercam] = (2*TICRATE)+1;
|
||||
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
|
||||
|
||||
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSightFast(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
|
||||
P_ResetCamera(player, thiscam);
|
||||
else
|
||||
P_SlideCameraMove(thiscam);
|
||||
|
||||
if (resetcalled) // Okay this means the camera is fully reset.
|
||||
return true;
|
||||
}
|
||||
@@ -3337,7 +3337,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
if (!itsatwodlevel)
|
||||
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y);
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y);
|
||||
thiscam->floorz = tmfloorz;
|
||||
thiscam->ceilingz = tmceilingz;
|
||||
|
||||
@@ -3410,8 +3410,8 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(mobj->player != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mobj));
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
|
||||
if (!mobj)
|
||||
return;
|
||||
|
||||
P_MobjCheckWater(mobj);
|
||||
@@ -6030,41 +6030,38 @@ static void P_KoopaThinker(mobj_t *koopa)
|
||||
//
|
||||
void P_RollPitchMobj(mobj_t* mobj)
|
||||
{
|
||||
boolean usedist = false;
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
return;
|
||||
|
||||
if (cv_sloperolldist.value > 0)
|
||||
usedist = true;
|
||||
if (cv_sloperoll.value != 2)
|
||||
{
|
||||
mobj->sloperoll = FixedAngle(0);
|
||||
mobj->slopepitch = FixedAngle(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cv_spriteroll.value && cv_sloperoll.value == 2)
|
||||
{
|
||||
K_RollMobjBySlopes(mobj, usedist);
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj->sloperoll = FixedAngle(0);
|
||||
mobj->slopepitch = FixedAngle(0);
|
||||
}
|
||||
K_RollMobjBySlopes(mobj, cv_sloperolldist.value && !splitscreen);
|
||||
}
|
||||
|
||||
angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
{
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
angle_t camang = 0;
|
||||
angle_t return_angle = 0;
|
||||
|
||||
if (!cv_spriteroll.value)
|
||||
|
||||
if (!cv_sloperoll.value)
|
||||
return 0;
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return 0;
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return 0;
|
||||
|
||||
size_t rot = mobj->frame & FF_FRAMEMASK;
|
||||
boolean papersprite = (mobj->frame & FF_PAPERSPRITE);
|
||||
// if mobj doesent have any of those, no need to do the rest
|
||||
if (mobj->roll == 0 && mobj->pitch == 0 && mobj->sloperoll == 0 && mobj->slopepitch == 0)
|
||||
return 0;
|
||||
|
||||
size_t rot = (mobj->frame & FF_FRAMEMASK);
|
||||
|
||||
if (mobj->skin && mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -6081,7 +6078,7 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
if (rot >= sprdef->numframes)
|
||||
{
|
||||
sprdef = &sprites[states[S_UNKNOWN].sprite];
|
||||
rot = states[S_UNKNOWN].frame&FF_FRAMEMASK;
|
||||
rot = (states[S_UNKNOWN].frame & FF_FRAMEMASK);
|
||||
}
|
||||
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
@@ -6089,20 +6086,16 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
if (sprframe->rotate != SRF_SINGLE || (mobj->frame & FF_PAPERSPRITE))
|
||||
{
|
||||
ang = R_PointToAngle(mobj->x, mobj->y) - mobj->angle;
|
||||
camang = R_PointToAngle(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch);
|
||||
|
||||
if (cv_sloperoll.value)
|
||||
{
|
||||
return_angle += FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
}
|
||||
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
|
||||
return return_angle;
|
||||
}
|
||||
@@ -6189,7 +6182,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
// Special thinker for scenery objects
|
||||
if (mobj->flags & MF_SCENERY)
|
||||
{
|
||||
if (LUAh_MobjThinker(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjThinker)))
|
||||
return;
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
@@ -6263,7 +6256,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (cv_sloperoll.value == 2 && mobj->state == &states[S_SHADOW])
|
||||
{
|
||||
mobj->slopepitch = mobj->target->slopepitch;
|
||||
@@ -6286,6 +6279,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
|
||||
P_RollPitchMobj(mobj);
|
||||
break;
|
||||
case MT_SMOLDERING:
|
||||
@@ -6886,7 +6880,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
mobj->fuse--;
|
||||
if (!mobj->fuse)
|
||||
{
|
||||
if (!LUAh_MobjFuse(mobj))
|
||||
if (!LUA_HookMobj(mobj, MOBJ_HOOK(MobjFuse)))
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
@@ -6901,13 +6895,13 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
// Check for a Lua thinker first
|
||||
if (!mobj->player)
|
||||
{
|
||||
if (LUAh_MobjThinker(mobj) || P_MobjWasRemoved(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjThinker)) || P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
}
|
||||
else if (!mobj->player->spectator)
|
||||
{
|
||||
// You cannot short-circuit the player thinker like you can other thinkers.
|
||||
LUAh_MobjThinker(mobj);
|
||||
LUA_HookMobj(mobj, MOBJ_HOOK(MobjThinker));
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
}
|
||||
@@ -6916,7 +6910,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
// separate thinker
|
||||
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse))
|
||||
{
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
if (!mobj)
|
||||
return;
|
||||
|
||||
P_MobjCheckWater(mobj);
|
||||
@@ -6932,7 +6926,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
}
|
||||
else if (mobj->flags & MF_BOSS)
|
||||
{
|
||||
if (LUAh_BossThinker(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(BossThinker)))
|
||||
{
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
@@ -8899,7 +8893,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
fixed_t x, y, z;
|
||||
mobj_t *flagmo, *newmobj;
|
||||
|
||||
if (!LUAh_MobjFuse(mobj) && !P_MobjWasRemoved(mobj))
|
||||
if (!LUA_HookMobj(mobj, MOBJ_HOOK(MobjFuse)) && !P_MobjWasRemoved(mobj))
|
||||
{
|
||||
switch (mobj->type)
|
||||
{
|
||||
@@ -9234,7 +9228,6 @@ void P_PushableThinker(mobj_t *mobj)
|
||||
|
||||
if (GETSECSPECIAL(sec->special, 2) == 1 && mobj->z == sec->floorheight)
|
||||
P_LinedefExecute(sec->tag, mobj, sec);
|
||||
// else if (GETSECSPECIAL(sec->special, 2) == 8)
|
||||
{
|
||||
sector_t *sec2;
|
||||
|
||||
@@ -9385,7 +9378,18 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
{
|
||||
const mobjinfo_t *info = &mobjinfo[type];
|
||||
state_t *st;
|
||||
mobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
mobj_t *mobj;
|
||||
|
||||
if (mobjcache != NULL)
|
||||
{
|
||||
mobj = mobjcache;
|
||||
mobjcache = mobjcache->hnext;
|
||||
memset(mobj, 0, sizeof(*mobj));
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
}
|
||||
|
||||
// this is officially a mobj, declared as soon as possible.
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
|
||||
@@ -9434,11 +9438,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
mobj->destscale = mapobjectscale;
|
||||
mobj->scalespeed = mapobjectscale/12;
|
||||
}
|
||||
|
||||
|
||||
// Sprite rendering
|
||||
mobj->realxscale = mobj->realyscale = mobj->scale;
|
||||
mobj->realxscale = mobj->realyscale = mobj->scale;
|
||||
mobj->spritexscale = mobj->realxscale;
|
||||
mobj->spriteyscale = mobj->realyscale;
|
||||
mobj->spriteyscale = mobj->realyscale;
|
||||
mobj->spritexoffset = mobj->spriteyoffset = 0;
|
||||
|
||||
// Funni slam sound when landing
|
||||
@@ -9490,7 +9494,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
|
||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
||||
if (LUAh_MobjSpawn(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn)))
|
||||
{
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return NULL;
|
||||
@@ -9846,7 +9850,18 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
|
||||
{
|
||||
const mobjinfo_t *info = &mobjinfo[MT_SHADOW];
|
||||
state_t *st;
|
||||
mobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
mobj_t *mobj;
|
||||
|
||||
if (mobjcache != NULL)
|
||||
{
|
||||
mobj = mobjcache;
|
||||
mobjcache = mobjcache->hnext;
|
||||
memset(mobj, 0, sizeof(*mobj));
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
}
|
||||
|
||||
// this is officially a mobj, declared as soon as possible.
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
|
||||
@@ -9892,11 +9907,11 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
|
||||
mobj->destscale = mapobjectscale;
|
||||
mobj->scalespeed = mapobjectscale/12;
|
||||
}
|
||||
|
||||
|
||||
// Sprite rendering
|
||||
mobj->spritexscale = mobj->spriteyscale = mobj->scale;
|
||||
mobj->spritexscale = mobj->spriteyscale = mobj->scale;
|
||||
mobj->spritexoffset = mobj->spriteyoffset = 0;
|
||||
|
||||
|
||||
// set subsector and/or block links
|
||||
P_SetThingPosition(mobj);
|
||||
I_Assert(mobj->subsector != NULL);
|
||||
@@ -9994,10 +10009,13 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
||||
|
||||
if (mobj->floorz != starting_floorz)
|
||||
mobj->precipflags |= PCF_FOF;
|
||||
else if (GETSECSPECIAL(mobj->subsector->sector->special, 1) == 7
|
||||
|| GETSECSPECIAL(mobj->subsector->sector->special, 1) == 6
|
||||
|| mobj->subsector->sector->floorpic == skyflatnum)
|
||||
mobj->precipflags |= PCF_PIT;
|
||||
else
|
||||
{
|
||||
INT32 special = GETSECSPECIAL(mobj->subsector->sector->special, 1);
|
||||
|
||||
if (special == 7 || special == 6 || mobj->subsector->sector->floorpic == skyflatnum)
|
||||
mobj->precipflags |= PCF_PIT;
|
||||
}
|
||||
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
|
||||
@@ -10022,7 +10040,7 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
return; // something already removing this mobj.
|
||||
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing.
|
||||
LUAh_MobjRemoved(mobj);
|
||||
LUA_HookMobj(mobj, MOBJ_HOOK(MobjRemoved));
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work.
|
||||
|
||||
// Rings only, please!
|
||||
@@ -10100,7 +10118,7 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
P_SetTarget(&mobj->hprev->hnext, cachenext);
|
||||
P_SetTarget(&mobj->hprev, NULL);
|
||||
}
|
||||
|
||||
|
||||
// clear the reference from the mapthing
|
||||
if (mobj->spawnpoint)
|
||||
mobj->spawnpoint->mobj = NULL;
|
||||
@@ -10117,7 +10135,9 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset(mobj, 0xff, sizeof(mobj_t));
|
||||
#endif
|
||||
Z_Free(mobj); // No refrences? Can be removed immediately! :D
|
||||
// no references, dump it directly in the mobj cache
|
||||
mobj->hnext = mobjcache;
|
||||
mobjcache = mobj;
|
||||
}
|
||||
else
|
||||
{ // Add thinker just to delay removing it until refrences are gone.
|
||||
@@ -10210,19 +10230,26 @@ void P_SpawnPrecipitation(void)
|
||||
if (dedicated || !cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart
|
||||
return;
|
||||
|
||||
fixed_t density = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
|
||||
|
||||
if (cv_lessprecip.value)
|
||||
density *= 2; // just spawn half the precip
|
||||
|
||||
// Use the blockmap to narrow down our placing patterns
|
||||
for (i = 0; i < bmapwidth*bmapheight; ++i)
|
||||
{
|
||||
basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE;
|
||||
basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE;
|
||||
|
||||
for (j = 0; j < FRACUNIT; j += cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT)
|
||||
// If mobjscale < FRACUNIT, each blockmap cell covers
|
||||
// more area so spawn more precipitation in that area.
|
||||
for (j = 0; j < FRACUNIT; j += density)
|
||||
{
|
||||
INT32 floorz;
|
||||
INT32 ceilingz;
|
||||
|
||||
x = ((cv_lessprecip.value ? basex*1.5 : basex) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
|
||||
y = ((cv_lessprecip.value ? basey*1.5 : basey) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
|
||||
x = basex + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3);
|
||||
y = basey + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3);
|
||||
|
||||
precipsector = R_IsPointInSubsector(x, y);
|
||||
|
||||
@@ -10291,7 +10318,7 @@ void P_PrecipitationEffects(void)
|
||||
INT32 volume;
|
||||
size_t i;
|
||||
|
||||
boolean sounds_rain = true;
|
||||
boolean rainsfx = true;
|
||||
boolean sounds_thunder = true;
|
||||
boolean effects_lightning = true;
|
||||
boolean lightningStrike = false;
|
||||
@@ -10324,7 +10351,7 @@ void P_PrecipitationEffects(void)
|
||||
effects_lightning = false;
|
||||
break;
|
||||
case PRECIP_STORM_NORAIN: // no rain, lightning and thunder allowed
|
||||
sounds_rain = false;
|
||||
rainsfx = false;
|
||||
case PRECIP_STORM: // everything.
|
||||
break;
|
||||
default:
|
||||
@@ -10332,6 +10359,8 @@ void P_PrecipitationEffects(void)
|
||||
return;
|
||||
}
|
||||
|
||||
boolean sounds_rain = ((cv_drawdist_precip.value != 0) && rainsfx && (!leveltime || leveltime % 80 == 1));
|
||||
|
||||
// Currently thunderstorming with lightning, and we're sounding the thunder...
|
||||
// and where there's thunder, there's gotta be lightning!
|
||||
if (effects_lightning && lightningStrike)
|
||||
@@ -10351,38 +10380,57 @@ void P_PrecipitationEffects(void)
|
||||
if (sound_disabled)
|
||||
return; // Sound off? D'aw, no fun.
|
||||
|
||||
if (!sounds_rain && !sounds_thunder)
|
||||
return; // no need to calculate volume at ALL
|
||||
|
||||
if (players[displayplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum)
|
||||
volume = 255; // Sky above? We get it full blast.
|
||||
else
|
||||
{
|
||||
/* GCC is optimizing away y >= yl, FUCK YOU */
|
||||
volatile fixed_t x, y, yl, yh, xl, xh;
|
||||
INT64 x, y, yl, yh, xl, xh;
|
||||
fixed_t closedist, newdist;
|
||||
|
||||
// Essentially check in a 1024 unit radius of the player for an outdoor area.
|
||||
yl = players[displayplayers[0]].mo->y - 1024*FRACUNIT;
|
||||
yh = players[displayplayers[0]].mo->y + 1024*FRACUNIT;
|
||||
xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT;
|
||||
xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT;
|
||||
closedist = 2048*FRACUNIT;
|
||||
#define RADIUSSTEP (64*FRACUNIT)
|
||||
#define SEARCHRADIUS (16*RADIUSSTEP)
|
||||
yl = yh = players[displayplayers[0]].mo->y;
|
||||
yl -= SEARCHRADIUS;
|
||||
while (yl < INT32_MIN)
|
||||
yl += RADIUSSTEP;
|
||||
yh += SEARCHRADIUS;
|
||||
while (yh > INT32_MAX)
|
||||
yh -= RADIUSSTEP;
|
||||
|
||||
for (y = yl; y >= yl && y <= yh; y += FRACUNIT*64)
|
||||
for (x = xl; x >= xl && x <= xh; x += FRACUNIT*64)
|
||||
xl = xh = players[displayplayers[0]].mo->x;
|
||||
xl -= SEARCHRADIUS;
|
||||
while (xl < INT32_MIN)
|
||||
xl += RADIUSSTEP;
|
||||
xh += SEARCHRADIUS;
|
||||
while (xh > INT32_MAX)
|
||||
xh -= RADIUSSTEP;
|
||||
|
||||
closedist = SEARCHRADIUS*2;
|
||||
#undef SEARCHRADIUS
|
||||
for (y = yl; y <= yh; y += RADIUSSTEP)
|
||||
for (x = xl; x <= xh; x += RADIUSSTEP)
|
||||
{
|
||||
if (R_PointInSubsector(x, y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
|
||||
if (R_PointInSubsectorFast((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
|
||||
continue;
|
||||
|
||||
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0);
|
||||
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, (fixed_t)x, (fixed_t)y, 0);
|
||||
|
||||
if (newdist < closedist)
|
||||
closedist = newdist;
|
||||
}
|
||||
|
||||
volume = 255 - (closedist>>(FRACBITS+2));
|
||||
}
|
||||
#undef RADIUSSTEP
|
||||
|
||||
volume = CLAMP(volume, 0, 255);
|
||||
|
||||
if (sounds_rain && (!leveltime || leveltime % 80 == 1))
|
||||
if (sounds_rain)
|
||||
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_rainin, volume);
|
||||
|
||||
if (!sounds_thunder)
|
||||
@@ -10567,7 +10615,8 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
}
|
||||
|
||||
// spawn as spectator determination
|
||||
if (multiplayer && demo.playback); // Don't mess with spectator values since the demo setup handles them already.
|
||||
if (multiplayer && demo.playback)
|
||||
; // Don't mess with spectator values since the demo setup handles them already.
|
||||
else if (!G_GametypeHasSpectators())
|
||||
p->spectator = false;
|
||||
else if (netgame && p->jointime <= 1 && pcount)
|
||||
@@ -10634,15 +10683,8 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
// (usefulness: when body mobj is detached from player (who respawns),
|
||||
// the dead body mobj retains the skin through the 'spritedef' override).
|
||||
mobj->skin = &skins[p->skin];
|
||||
if (p->localskin > 0)
|
||||
{
|
||||
if (p->skinlocal)
|
||||
mobj->localskin = &localskins[p->localskin - 1];
|
||||
else
|
||||
mobj->localskin = & skins[p->localskin - 1];
|
||||
}
|
||||
else
|
||||
mobj->localskin = 0;
|
||||
|
||||
mobj->localskin = ((p->localskin > 0) ? (p->skinlocal ? &localskins[p->localskin - 1] : &skins[p->localskin - 1]) : 0);
|
||||
mobj->skinlocal = p->skinlocal;
|
||||
|
||||
mobj->health = p->health;
|
||||
@@ -10713,6 +10755,18 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
P_SetScale(karmahitbox, mobj->scale);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle splitscreen
|
||||
// Spectators can switch to freecam. This should be
|
||||
// disabled when they enter the race, or when the level
|
||||
// changes.
|
||||
if (!demo.playback)
|
||||
{
|
||||
if (!p->spectator)
|
||||
{
|
||||
camera[playernum].freecam = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void P_AfterPlayerSpawn(INT32 playernum)
|
||||
@@ -10755,15 +10809,18 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
||||
|
||||
SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle);
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
if (p->spectator == false)
|
||||
{
|
||||
if (!camera[i].chase)
|
||||
continue;
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (!camera[i].chase)
|
||||
continue;
|
||||
|
||||
if (displayplayers[i] != playernum)
|
||||
continue;
|
||||
if (displayplayers[i] != playernum)
|
||||
continue;
|
||||
|
||||
P_ResetCamera(p, &camera[i]);
|
||||
P_ResetCamera(p, &camera[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckForReverseGravity)
|
||||
@@ -11250,7 +11307,8 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
|
||||
mobj = P_SpawnMobj(x, y, z, i);
|
||||
|
||||
if (!mobj || P_MobjWasRemoved(mobj)) {
|
||||
if (!mobj || P_MobjWasRemoved(mobj))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Failed to spawn map thing #%d at %d, %d. This will crash vanilla clients!\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
|
||||
return;
|
||||
}
|
||||
@@ -11784,12 +11842,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
z = mthing->options << FRACBITS;
|
||||
|
||||
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
||||
|
||||
hoopcenter->spawnpoint = mthing;
|
||||
|
||||
// Screw these damn hoops, I need this thinker.
|
||||
//hoopcenter->flags |= MF_NOTHINK;
|
||||
|
||||
z +=
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
sec->floorheight;
|
||||
@@ -11835,10 +11889,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
|
||||
mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP);
|
||||
|
||||
//if (maptol & TOL_XMAS)
|
||||
//P_SetMobjState(mobj, mobj->info->seestate + (i & 1));
|
||||
|
||||
mobj->z -= mobj->height/2;
|
||||
|
||||
P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center.
|
||||
mobj->fuse = 0;
|
||||
|
||||
@@ -11975,9 +12027,6 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
|
||||
mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP);
|
||||
|
||||
//if (maptol & TOL_XMAS)
|
||||
//P_SetMobjState(mobj, mobj->info->seestate + (i & 1));
|
||||
|
||||
mobj->z -= mobj->height/2;
|
||||
P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center.
|
||||
mobj->fuse = 0;
|
||||
@@ -12348,10 +12397,6 @@ void P_ColorTeamMissile(mobj_t *missile, player_t *source)
|
||||
else if (source->ctfteam == 1)
|
||||
missile->color = skincolor_redring;
|
||||
}
|
||||
/*
|
||||
else
|
||||
missile->color = player->mo->color; //copy color
|
||||
*/
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+4
-5
@@ -261,6 +261,7 @@ typedef enum {
|
||||
PCF_SPLASH = 1<<4, // Splashed on the ground, return to the ceiling after the animation's over
|
||||
PCF_THUNK = 1<<5, // Ran the thinker this tic.
|
||||
} precipflag_t;
|
||||
|
||||
// Map Object definition.
|
||||
typedef struct mobj_s
|
||||
{
|
||||
@@ -287,8 +288,7 @@ typedef struct mobj_s
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT16 anim_duration; // for FF_ANIMATE states
|
||||
|
||||
UINT32 renderflags; // render flags
|
||||
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
@@ -440,8 +440,7 @@ typedef struct precipmobj_s
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT16 anim_duration; // for FF_ANIMATE states
|
||||
|
||||
UINT32 renderflags; // render flags
|
||||
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
@@ -450,7 +449,7 @@ typedef struct precipmobj_s
|
||||
fixed_t realxscale, realyscale; // funn-E streeetch
|
||||
|
||||
fixed_t stretchslam; // "squish" effect when you land
|
||||
|
||||
|
||||
//sloperollangle
|
||||
angle_t sloperoll, slopepitch;
|
||||
angle_t old_sloperoll, old_slopepitch;
|
||||
|
||||
@@ -153,6 +153,9 @@ FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
th->next = thinkercap.next;
|
||||
th->prev = &thinkercap;
|
||||
thinkercap.next = th;
|
||||
|
||||
th->references = 0;
|
||||
th->cachable = false; // not initialising this made the mobjcache die thx!
|
||||
}
|
||||
|
||||
static void FreeSideLists(void)
|
||||
|
||||
+991
-1022
File diff suppressed because it is too large.
Load diff
+16
-8
@@ -21,13 +21,6 @@
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(void);
|
||||
void P_SaveNetGame(boolean resending);
|
||||
boolean P_LoadGame(INT16 mapoverride);
|
||||
boolean P_LoadNetGame(boolean resending);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 skincolor;
|
||||
@@ -41,6 +34,21 @@ typedef struct
|
||||
} savedata_t;
|
||||
|
||||
extern savedata_t savedata;
|
||||
extern UINT8 *save_p;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 *buffer;
|
||||
UINT8 *p;
|
||||
} savebuffer_t;
|
||||
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(savebuffer_t *save);
|
||||
void P_SaveNetGame(savebuffer_t *save, boolean resending);
|
||||
boolean P_LoadGame(savebuffer_t *save, INT16 mapoverride);
|
||||
boolean P_LoadNetGame(savebuffer_t *save, boolean reloading);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
#endif
|
||||
+74
-66
@@ -63,7 +63,7 @@
|
||||
|
||||
#include "md5.h" // map MD5
|
||||
|
||||
// for LUAh_MapLoad
|
||||
// for MapLoad hook
|
||||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
@@ -460,7 +460,11 @@ FUNCINLINE static ATTRINLINE void P_LoadRawVertexes(UINT8 *data)
|
||||
* \param seg Seg to compute length for.
|
||||
* \return Length in fracunits.
|
||||
*/
|
||||
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
|
||||
fixed_t P_SegLength(seg_t *seg)
|
||||
#else
|
||||
static inline fixed_t P_SegLength(seg_t *seg)
|
||||
#endif
|
||||
{
|
||||
INT64 dx = (seg->v2->x - seg->v1->x)>>1;
|
||||
INT64 dy = (seg->v2->y - seg->v1->y)>>1;
|
||||
@@ -510,7 +514,7 @@ void P_UpdateSegLightOffset(seg_t *li)
|
||||
// Loads the SEGS resource from a level.
|
||||
static void P_LoadRawSegs(UINT8 *data)
|
||||
{
|
||||
INT32 linedef, side;
|
||||
INT32 rawlinedef, rawside;
|
||||
mapseg_t *ml = (mapseg_t*)data;
|
||||
seg_t *li = segs;
|
||||
line_t *ldef;
|
||||
@@ -530,14 +534,14 @@ static void P_LoadRawSegs(UINT8 *data)
|
||||
|
||||
li->angle = (SHORT(ml->angle))<<FRACBITS;
|
||||
li->offset = (SHORT(ml->offset))<<FRACBITS;
|
||||
linedef = SHORT(ml->linedef);
|
||||
ldef = &lines[linedef];
|
||||
rawlinedef = SHORT(ml->linedef);
|
||||
ldef = &lines[rawlinedef];
|
||||
li->linedef = ldef;
|
||||
li->side = side = SHORT(ml->side);
|
||||
li->sidedef = &sides[ldef->sidenum[side]];
|
||||
li->frontsector = sides[ldef->sidenum[side]].sector;
|
||||
li->side = rawside = SHORT(ml->side);
|
||||
li->sidedef = &sides[ldef->sidenum[rawside]];
|
||||
li->frontsector = sides[ldef->sidenum[rawside]].sector;
|
||||
if (ldef->flags & ML_TWOSIDED)
|
||||
li->backsector = sides[ldef->sidenum[side^1]].sector;
|
||||
li->backsector = sides[ldef->sidenum[rawside^1]].sector;
|
||||
else
|
||||
li->backsector = 0;
|
||||
|
||||
@@ -997,14 +1001,14 @@ void P_WriteThings(lumpnum_t lumpnum)
|
||||
size_t i, length;
|
||||
mapthing_t *mt;
|
||||
UINT8 *data;
|
||||
UINT8 *savebuffer, *savebuf_p;
|
||||
savebuffer_t save;
|
||||
INT16 temp;
|
||||
|
||||
data = W_CacheLumpNum(lumpnum, PU_LEVEL);
|
||||
|
||||
savebuf_p = savebuffer = (UINT8 *)malloc(nummapthings * sizeof (mapthing_t));
|
||||
save.p = save.buffer = (UINT8 *)malloc(nummapthings * sizeof (mapthing_t));
|
||||
|
||||
if (!savebuf_p)
|
||||
if (!save.p)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for thing writing!\n"));
|
||||
return;
|
||||
@@ -1013,23 +1017,23 @@ void P_WriteThings(lumpnum_t lumpnum)
|
||||
mt = mapthings;
|
||||
for (i = 0; i < nummapthings; i++, mt++)
|
||||
{
|
||||
WRITEINT16(savebuf_p, mt->x);
|
||||
WRITEINT16(savebuf_p, mt->y);
|
||||
WRITEINT16(save.p, mt->x);
|
||||
WRITEINT16(save.p, mt->y);
|
||||
|
||||
WRITEINT16(savebuf_p, mt->angle);
|
||||
WRITEINT16(save.p, mt->angle);
|
||||
|
||||
temp = (INT16)(mt->type + ((INT16)mt->extrainfo << 12));
|
||||
WRITEINT16(savebuf_p, temp);
|
||||
WRITEUINT16(savebuf_p, mt->options);
|
||||
WRITEINT16(save.p, temp);
|
||||
WRITEUINT16(save.p, mt->options);
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
|
||||
length = savebuf_p - savebuffer;
|
||||
length = save.p - save.buffer;
|
||||
|
||||
FIL_WriteFile(va("newthings%d.lmp", gamemap), savebuffer, length);
|
||||
free(savebuffer);
|
||||
savebuf_p = NULL;
|
||||
FIL_WriteFile(va("newthings%d.lmp", gamemap), save.buffer, length);
|
||||
free(save.buffer);
|
||||
save.p = NULL;
|
||||
|
||||
CONS_Printf(M_GetText("newthings%d.lmp saved.\n"), gamemap);
|
||||
}
|
||||
@@ -1542,16 +1546,23 @@ static void P_CreateBlockMap(void)
|
||||
// First find limits of map
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
{
|
||||
if (vertexes[i].x>>FRACBITS < minx)
|
||||
minx = vertexes[i].x>>FRACBITS;
|
||||
else if (vertexes[i].x>>FRACBITS > maxx)
|
||||
maxx = vertexes[i].x>>FRACBITS;
|
||||
if (vertexes[i].y>>FRACBITS < miny)
|
||||
miny = vertexes[i].y>>FRACBITS;
|
||||
else if (vertexes[i].y>>FRACBITS > maxy)
|
||||
maxy = vertexes[i].y>>FRACBITS;
|
||||
fixed_t t;
|
||||
|
||||
if ((t = vertexes[i].x) < minx)
|
||||
minx = t;
|
||||
else if (t > maxx)
|
||||
maxx = t;
|
||||
if ((t = vertexes[i].y) < miny)
|
||||
miny = t;
|
||||
else if (t > maxy)
|
||||
maxy = t;
|
||||
}
|
||||
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
// Save blockmap parameters
|
||||
bmaporgx = minx << FRACBITS;
|
||||
bmaporgy = miny << FRACBITS;
|
||||
@@ -2426,7 +2437,7 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = players[pnum].mo->y;
|
||||
cam->z = players[pnum].mo->z;
|
||||
cam->angle = players[pnum].mo->angle;
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2451,8 +2462,10 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = thing->y;
|
||||
cam->z = thing->z;
|
||||
cam->angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
|
||||
cam->chase = false; // tell camera to reset its position next tic
|
||||
}
|
||||
|
||||
static void P_InitCamera(void)
|
||||
@@ -2461,22 +2474,20 @@ static void P_InitCamera(void)
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
if (!demo.freecam)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (camera[i].freecam)
|
||||
continue;
|
||||
|
||||
P_SetupCamera(displayplayers[i], &camera[i]);
|
||||
}
|
||||
|
||||
// Though, I don't think anyone would care about cam_rotate being reset back to the only value that makes sense :P
|
||||
if (!cv_cam_rotate.changed)
|
||||
CV_Set(&cv_cam_rotate, cv_cam_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam2_rotate.changed)
|
||||
CV_Set(&cv_cam2_rotate, cv_cam2_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam3_rotate.changed)
|
||||
CV_Set(&cv_cam3_rotate, cv_cam3_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam4_rotate.changed)
|
||||
CV_Set(&cv_cam4_rotate, cv_cam4_rotate.defaultvalue);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!cv_cam_rotate[i].changed)
|
||||
CV_Set(&cv_cam_rotate[i], cv_cam_rotate[i].defaultvalue);
|
||||
}
|
||||
|
||||
displayplayers[0] = consoleplayer; // Start with your OWN view, please!
|
||||
}
|
||||
@@ -2494,6 +2505,9 @@ static void P_InitMinimapInfo(void)
|
||||
fixed_t a;
|
||||
fixed_t b;
|
||||
node_t *bsp = &nodes[numnodes-1];
|
||||
|
||||
minimapinfo.minimap_pic = NULL;
|
||||
|
||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
|
||||
|
||||
if (lumpnum != -1)
|
||||
@@ -2505,6 +2519,7 @@ static void P_InitMinimapInfo(void)
|
||||
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
|
||||
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
|
||||
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
|
||||
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
|
||||
@@ -2513,15 +2528,19 @@ static void P_InitMinimapInfo(void)
|
||||
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
|
||||
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minimapinfo.map_w = (minimapinfo.max_x >>= FRACBITS) - (minimapinfo.min_x >>= FRACBITS);
|
||||
minimapinfo.map_h = (minimapinfo.max_y >>= FRACBITS) - (minimapinfo.min_y >>= FRACBITS);
|
||||
|
||||
minimapinfo.minimap_w = minimapinfo.minimap_h = 100;
|
||||
|
||||
a = FixedDiv(minimapinfo.minimap_w<<FRACBITS, minimapinfo.map_w<<4);
|
||||
b = FixedDiv(minimapinfo.minimap_h<<FRACBITS, minimapinfo.map_h<<4);
|
||||
|
||||
if (a < b)
|
||||
{
|
||||
minimapinfo.minimap_h = FixedMul(a, minimapinfo.map_h)>>(FRACBITS-4);
|
||||
@@ -2535,8 +2554,10 @@ static void P_InitMinimapInfo(void)
|
||||
}
|
||||
minimapinfo.zoom = b;
|
||||
}
|
||||
|
||||
minimapinfo.zoom >>= (FRACBITS-4);
|
||||
minimapinfo.zoom -= (minimapinfo.zoom/20);
|
||||
|
||||
// These should always be small enough to be bitshift back right now
|
||||
minimapinfo.offs_x = FixedMul((minimapinfo.min_x + minimapinfo.map_w/2) << FRACBITS, minimapinfo.zoom);
|
||||
minimapinfo.offs_y = FixedMul((minimapinfo.min_y + minimapinfo.map_h/2) << FRACBITS, minimapinfo.zoom);
|
||||
@@ -2587,9 +2608,6 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
|
||||
P_LevelInitStuff(reloadinggamestate);
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
postimgtype[i] = postimg_none;
|
||||
|
||||
if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0'
|
||||
&& atoi(mapheaderinfo[gamemap-1]->forcecharacter) != 255)
|
||||
P_ForceCharacter(mapheaderinfo[gamemap-1]->forcecharacter);
|
||||
@@ -2600,18 +2618,11 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
if (!cv_chasecam.changed)
|
||||
CV_SetValue(&cv_chasecam, chase);
|
||||
|
||||
// same for second player
|
||||
if (!cv_chasecam2.changed)
|
||||
CV_SetValue(&cv_chasecam2, chase);
|
||||
|
||||
if (!cv_chasecam3.changed)
|
||||
CV_SetValue(&cv_chasecam3, chase);
|
||||
|
||||
if (!cv_chasecam4.changed)
|
||||
CV_SetValue(&cv_chasecam4, chase);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!cv_chasecam[i].changed)
|
||||
CV_SetValue(&cv_chasecam[i], chase);
|
||||
}
|
||||
}
|
||||
|
||||
// Initial height of PointOfView
|
||||
@@ -2742,6 +2753,8 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
R_ClearLevelSplats();
|
||||
#endif
|
||||
|
||||
mobjcache = NULL;
|
||||
|
||||
R_InitializeLevelInterpolators();
|
||||
|
||||
P_InitThinkers();
|
||||
@@ -2901,8 +2914,9 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
: mapheaderinfo[gamemap - 1]->numlaps);
|
||||
|
||||
// Start recording replay in multiplayer with a temp filename
|
||||
//Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
|
||||
if (!demo.playback && multiplayer && D_NumPlayers()) {
|
||||
// Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
|
||||
if (!demo.playback && multiplayer && D_NumPlayers())
|
||||
{
|
||||
static char buf[256];
|
||||
sprintf(buf, "replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap));
|
||||
|
||||
@@ -3006,12 +3020,11 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
}
|
||||
P_PreTicker(2);
|
||||
if (!reloadinggamestate)
|
||||
LUAh_MapLoad();
|
||||
LUA_HookInt(gamemap, HOOK(MapLoad));
|
||||
}
|
||||
|
||||
if (rendermode != render_none && !reloadinggamestate)
|
||||
{
|
||||
R_ResetViewInterpolation(0);
|
||||
R_ResetViewInterpolation(0);
|
||||
R_UpdateMobjInterpolators();
|
||||
}
|
||||
@@ -3157,11 +3170,6 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
S_LoadMusicDefs(wadnum);
|
||||
|
||||
//
|
||||
// edit music defs for stuff like musictest
|
||||
//
|
||||
S_LoadMTDefs(wadnum);
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
|
||||
@@ -88,6 +88,11 @@ SINT8 P_PartialAddGetStage(void);
|
||||
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_WriteThings(lumpnum_t lump);
|
||||
|
||||
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
|
||||
fixed_t P_SegLength(seg_t *seg);
|
||||
#endif
|
||||
|
||||
void P_UpdateSegLightOffset(seg_t *li);
|
||||
size_t P_PrecacheLevelFlats(void);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
+40
-80
@@ -38,66 +38,21 @@ static INT32 sightcounts[2];
|
||||
//
|
||||
// Returns side 0 (front), 1 (back), or 2 (on).
|
||||
//
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, divline_t *node)
|
||||
// killough 4/19/98: made static, cleaned up
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, const divline_t *node)
|
||||
{
|
||||
fixed_t dx, dy, left, right;
|
||||
|
||||
if (!node->dx)
|
||||
{
|
||||
if (x == node->x)
|
||||
return 2;
|
||||
|
||||
if (x <= node->x)
|
||||
return (node->dy > 0);
|
||||
|
||||
return (node->dy < 0);
|
||||
}
|
||||
|
||||
if (!node->dy)
|
||||
{
|
||||
if (y == node->y)
|
||||
return 2;
|
||||
|
||||
if (y <= node->y)
|
||||
return (node->dx < 0);
|
||||
|
||||
return (node->dx > 0);
|
||||
}
|
||||
|
||||
dx = x - node->x;
|
||||
dy = y - node->y;
|
||||
|
||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
|
||||
if (left == right)
|
||||
return 2;
|
||||
|
||||
return 1; // back side
|
||||
fixed_t left, right;
|
||||
return
|
||||
!node->dx ? x == node->x ? 2 : x <= node->x ? node->dy > 0 : node->dy < 0 :
|
||||
!node->dy ? y == node->y ? 2 : y <= node->y ? node->dx < 0 : node->dx > 0 :
|
||||
(right = ((y - node->y) >> FRACBITS) * (node->dx >> FRACBITS)) <
|
||||
(left = ((x - node->x) >> FRACBITS) * (node->dy >> FRACBITS)) ? 0 :
|
||||
right == left ? 2 : 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_InterceptVector2
|
||||
//
|
||||
// Returns the fractional intercept point along the first divline.
|
||||
// This is only called by the addthings and addlines traversers.
|
||||
//
|
||||
static fixed_t P_InterceptVector2(divline_t *v2, divline_t *v1)
|
||||
static INT32 P_DivlineCrossed(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, const divline_t *node)
|
||||
{
|
||||
fixed_t frac, num, den;
|
||||
|
||||
den = FixedMul(v1->dy>>8, v2->dx) - FixedMul(v1->dx>>8, v2->dy);
|
||||
|
||||
if (!den)
|
||||
return 0;
|
||||
|
||||
num = FixedMul((v1->x - v2->x)>>8, v1->dy) + FixedMul((v2->y - v1->y)>>8, v1->dx);
|
||||
frac = FixedDiv(num, den);
|
||||
|
||||
return frac;
|
||||
return (P_DivlineSide(x1, y1, node) == P_DivlineSide(x2, y2, node));
|
||||
}
|
||||
|
||||
static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
@@ -135,23 +90,21 @@ static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided
|
||||
//if (!(po->flags & POF_TESTHEIGHT))
|
||||
//return false;
|
||||
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
// get slopes of top and bottom of this polyobject line
|
||||
topslope = FixedDiv(polysec->ceilingheight - los->sightzstart , frac);
|
||||
@@ -232,16 +185,14 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
@@ -249,7 +200,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
return false;
|
||||
|
||||
// calculate fractional intercept (how far along we are divided by how far we are from t2)
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
front = seg->frontsector;
|
||||
back = seg->backsector;
|
||||
@@ -348,25 +299,34 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
// if strace crosses the given node successfully.
|
||||
//
|
||||
// killough 4/20/98: rewritten to remove tail recursion, clean up, and optimize
|
||||
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los, boolean fast)
|
||||
{
|
||||
while (!(bspnum & NF_SUBSECTOR))
|
||||
{
|
||||
register node_t *bsp = nodes + bspnum;
|
||||
INT32 side = P_DivlineSide(los->strace.x,los->strace.y,(divline_t *)bsp)&1;
|
||||
if (side == P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp))
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
else // the partition plane is crossed here
|
||||
|
||||
INT32 side = (fast ? R_PointOnSideFast(los->strace.x, los->strace.y, bsp) : (P_DivlineSide(los->strace.x,los->strace.y, (divline_t *)bsp) & 1));
|
||||
INT32 side2 = (fast ? R_PointOnSideFast(los->t2x, los->t2y, bsp) : P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp));
|
||||
|
||||
if (side == side2)
|
||||
{
|
||||
if (!P_CrossBSPNode(bsp->children[side], los))
|
||||
return 0; // cross the starting side
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
}
|
||||
else
|
||||
{
|
||||
// the partition plane is crossed here
|
||||
if (!P_CrossBSPNode(bsp->children[side], los, fast))
|
||||
{
|
||||
return false; // cross the starting side
|
||||
}
|
||||
else
|
||||
bspnum = bsp->children[side^1]; // cross the ending side
|
||||
{
|
||||
bspnum = bsp->children[side^1]; // cross the ending side
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
|
||||
return P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -375,7 +335,7 @@ static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
// Returns true if a straight line between t1 and t2 is unobstructed.
|
||||
// Uses REJECT.
|
||||
//
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast)
|
||||
{
|
||||
const sector_t *s1, *s2;
|
||||
size_t pnum;
|
||||
@@ -492,5 +452,5 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
}
|
||||
|
||||
// the head node is the last node output
|
||||
return P_CrossBSPNode((INT32)numnodes - 1, &los);
|
||||
}
|
||||
return (P_CrossBSPNode((INT32)numnodes - 1, &los, fast));
|
||||
}
|
||||
+34
-74
@@ -364,11 +364,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
// In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef
|
||||
|
||||
fslope = line->frontsector->f_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 1;
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 1;
|
||||
|
||||
// Now remember that f_slope IS a vector
|
||||
// fslope->o = origin 3D point 1 of the vector
|
||||
@@ -425,11 +425,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
cslope = line->frontsector->c_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 2;
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 2;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
@@ -494,11 +494,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
fslope = line->backsector->f_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 3;
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 3;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
@@ -531,6 +531,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
P_CalculateSlopeNormal(fslope);
|
||||
}
|
||||
|
||||
if (backceil)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
@@ -540,11 +541,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
cslope = line->backsector->c_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 4;
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 4;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
@@ -604,7 +605,8 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
||||
memset(ret->vertices, 0, 3*sizeof(mapthing_t));
|
||||
|
||||
// And... look for the vertices in question.
|
||||
for (i = 0; i < nummapthings; i++, mt++) {
|
||||
for (i = 0; i < nummapthings; i++, mt++)
|
||||
{
|
||||
if (mt->type != 750) // Haha, I'm hijacking the old Chaos Spawn thingtype for something!
|
||||
continue;
|
||||
|
||||
@@ -617,7 +619,8 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
||||
}
|
||||
|
||||
// Now set heights for each vertex, because they haven't been set yet
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
mt = ret->vertices[i];
|
||||
if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?)
|
||||
I_Error("P_NewVertexSlope: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
|
||||
@@ -649,23 +652,23 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
||||
//
|
||||
void P_CopySectorSlope(line_t *line)
|
||||
{
|
||||
sector_t *fsec = line->frontsector;
|
||||
int i, special = line->special;
|
||||
sector_t *fsec = line->frontsector;
|
||||
int i, special = line->special;
|
||||
|
||||
// Check for copy linedefs
|
||||
for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *srcsec = sectors + i;
|
||||
// Check for copy linedefs
|
||||
for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *srcsec = sectors + i;
|
||||
|
||||
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
|
||||
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
|
||||
}
|
||||
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
|
||||
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
|
||||
}
|
||||
|
||||
fsec->hasslope = true;
|
||||
fsec->hasslope = true;
|
||||
|
||||
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
|
||||
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
|
||||
}
|
||||
|
||||
//
|
||||
@@ -790,49 +793,6 @@ void P_ResetDynamicSlopes(void)
|
||||
// Various utilities related to slopes
|
||||
//
|
||||
|
||||
//
|
||||
// P_GetZAt
|
||||
//
|
||||
// Returns the height of the sloped plane at (x, y) as a fixed_t
|
||||
//
|
||||
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y)
|
||||
{
|
||||
fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) +
|
||||
FixedMul(y - slope->o.y, slope->d.y);
|
||||
|
||||
return slope->o.z + FixedMul(dist, slope->zdelta);
|
||||
}
|
||||
|
||||
// Returns the height of the sector floor at (x, y)
|
||||
fixed_t P_GetSectorFloorZAt(const sector_t *sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : sector->floorheight;
|
||||
}
|
||||
|
||||
// Returns the height of the sector ceiling at (x, y)
|
||||
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : sector->ceilingheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF top at (x, y)
|
||||
fixed_t P_GetFFloorTopZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *ffloor->t_slope ? P_GetZAt(*ffloor->t_slope, x, y) : *ffloor->topheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF bottom at (x, y)
|
||||
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *ffloor->b_slope ? P_GetZAt(*ffloor->b_slope, x, y) : *ffloor->bottomheight;
|
||||
}
|
||||
|
||||
// Returns the height of the light list at (x, y)
|
||||
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y)
|
||||
{
|
||||
return light->slope ? P_GetZAt(light->slope, x, y) : light->height;
|
||||
}
|
||||
|
||||
//
|
||||
// P_QuantizeMomentumToSlope
|
||||
//
|
||||
|
||||
+37
-8
@@ -13,9 +13,12 @@
|
||||
#ifndef P_SLOPES_H__
|
||||
#define P_SLOPES_H__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||
void P_ResetDynamicSlopes(void);
|
||||
void P_RunDynamicSlopes(void);
|
||||
|
||||
// P_SpawnSlope_Line
|
||||
// Creates one or more slopes based on the given line type and front/back
|
||||
// sectors.
|
||||
@@ -30,19 +33,45 @@ void P_CopySectorSlope(line_t *line);
|
||||
|
||||
pslope_t *P_SlopeById(UINT16 id);
|
||||
|
||||
//
|
||||
// P_GetZAt
|
||||
//
|
||||
|
||||
// Returns the height of the sloped plane at (x, y) as a fixed_t
|
||||
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetZAt(pslope_t *z_slope, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_slope->o.z + FixedMul((FixedMul(x - z_slope->o.x, z_slope->d.x) + FixedMul(y - z_slope->o.y, z_slope->d.y)), z_slope->zdelta);
|
||||
}
|
||||
|
||||
// Returns the height of the sector at (x, y)
|
||||
fixed_t P_GetSectorFloorZAt (const sector_t *sector, fixed_t x, fixed_t y);
|
||||
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y);
|
||||
// Returns the height of the sector floor at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetSectorFloorZAt(const sector_t *z_sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_sector->f_slope ? P_GetZAt(z_sector->f_slope, x, y) : z_sector->floorheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF at (x, y)
|
||||
fixed_t P_GetFFloorTopZAt (const ffloor_t *ffloor, fixed_t x, fixed_t y);
|
||||
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y);
|
||||
// Returns the height of the sector ceiling at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetSectorCeilingZAt(const sector_t *z_sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_sector->c_slope ? P_GetZAt(z_sector->c_slope, x, y) : z_sector->ceilingheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF top at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorTopZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *z_ffloor->t_slope ? P_GetZAt(*z_ffloor->t_slope, x, y) : *z_ffloor->topheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF bottom at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorBottomZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *z_ffloor->b_slope ? P_GetZAt(*z_ffloor->b_slope, x, y) : *z_ffloor->bottomheight;
|
||||
}
|
||||
|
||||
// Returns the height of the light list at (x, y)
|
||||
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y);
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetLightZAt(const lightlist_t *z_light, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_light->slope ? P_GetZAt(z_light->slope, x, y) : z_light->height;
|
||||
}
|
||||
|
||||
// Lots of physics-based bullshit
|
||||
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
|
||||
|
||||
+41
-65
@@ -35,7 +35,7 @@
|
||||
#include "hu_stuff.h"
|
||||
#include "m_misc.h"
|
||||
#include "m_cond.h" //unlock triggers
|
||||
#include "lua_hook.h" // LUAh_LinedefExecute
|
||||
#include "lua_hook.h" // LUA_HookLinedefExecute
|
||||
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "console.h" // CON_LogMessage
|
||||
@@ -1431,12 +1431,14 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
}
|
||||
else if (caller)
|
||||
{
|
||||
if (GETSECSPECIAL(caller->special, 2) == 6)
|
||||
INT32 special = GETSECSPECIAL(caller->special, 2);
|
||||
|
||||
if (special == 6)
|
||||
{
|
||||
if (!(ALL7EMERALDS(emeralds)))
|
||||
return false;
|
||||
}
|
||||
else if (GETSECSPECIAL(caller->special, 2) == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
else if (special == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
{
|
||||
UINT8 lap;
|
||||
|
||||
@@ -1470,7 +1472,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
// If we were not triggered by a sector type especially for the purpose,
|
||||
// a Linedef Executor linedef trigger is not handling sector triggers properly, return.
|
||||
|
||||
else if ((!GETSECSPECIAL(caller->special, 2) || GETSECSPECIAL(caller->special, 2) > 7) && (specialtype > 322))
|
||||
else if ((!special || special > 7) && (specialtype > 322))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,
|
||||
M_GetText("Linedef executor trigger isn't handling sector triggers properly!\nspecialtype = %d, if you are not a dev, report this warning instance\nalong with the wad that caused it!\n"),
|
||||
@@ -1805,27 +1807,23 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
||||
mobjtype_t type = 0;
|
||||
INT32 z = 0;
|
||||
|
||||
if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
precipmobj->precipflags |= PCF_INVISIBLE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (swap == PRECIP_RAIN) // Snow To Rain
|
||||
{
|
||||
precipmobj->type = MT_RAIN; // proper set the type
|
||||
precipmobj->info = &mobjinfo[MT_RAIN];
|
||||
precipmobj->flags = mobjinfo[MT_RAIN].flags;
|
||||
st = &states[mobjinfo[MT_RAIN].spawnstate];
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = cv_mobjscaleprecip.value ? FixedMul(mobjinfo[MT_RAIN].speed, mapobjectscale) : mobjinfo[MT_RAIN].speed;
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
type = MT_RAIN;
|
||||
}
|
||||
else if (swap == PRECIP_SNOW) // Rain To Snow
|
||||
{
|
||||
INT32 z;
|
||||
type = MT_SNOWFLAKE;
|
||||
|
||||
precipmobj->type = MT_SNOWFLAKE; // proper set the type
|
||||
precipmobj->info = &mobjinfo[MT_SNOWFLAKE];
|
||||
precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags;
|
||||
z = M_RandomByte();
|
||||
|
||||
if (z < 64)
|
||||
@@ -1834,92 +1832,69 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
z = 1;
|
||||
else
|
||||
z = 0;
|
||||
|
||||
st = &states[mobjinfo[MT_SNOWFLAKE].spawnstate+z];
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = cv_mobjscaleprecip.value ? FixedMul(mobjinfo[MT_SNOWFLAKE].speed, mapobjectscale) : mobjinfo[MT_SNOWFLAKE].speed;
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
}
|
||||
else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
precipmobj->precipflags |= PCF_INVISIBLE;
|
||||
}
|
||||
|
||||
precipmobj->type = type; // proper set the type
|
||||
precipmobj->info = &mobjinfo[type];
|
||||
precipmobj->flags = mobjinfo[type].flags;
|
||||
|
||||
st = &states[mobjinfo[type].spawnstate+z];
|
||||
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = (cv_mobjscaleprecip.value ? FixedMul(mobjinfo[type].speed, mapobjectscale) : mobjinfo[type].speed);
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
}
|
||||
}
|
||||
|
||||
boolean dontspawn = false;
|
||||
|
||||
switch (weathernum)
|
||||
{
|
||||
case PRECIP_SNOW: // snow
|
||||
curWeather = PRECIP_SNOW;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_RAIN: // rain
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_RAIN;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM: // storm
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM_NOSTRIKES: // storm w/o lightning
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM_NOSTRIKES;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM_NORAIN: // storm w/o rain
|
||||
curWeather = PRECIP_STORM_NORAIN;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_BLANK:
|
||||
curWeather = PRECIP_BLANK;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
default:
|
||||
dontspawn = true;
|
||||
curWeather = PRECIP_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
}
|
||||
|
||||
/** Gets an object.
|
||||
@@ -2084,6 +2059,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
mo->y += y;
|
||||
mo->z += z;
|
||||
P_SetThingPosition(mo);
|
||||
mo->old_x = mo->x;
|
||||
mo->old_y = mo->y;
|
||||
mo->old_z = mo->z;
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
@@ -2102,7 +2080,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
camera[i].reset = true;
|
||||
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
|
||||
R_RelativeTeleportViewInterpolation(i, x, y, z, 0);
|
||||
R_ResetViewInterpolation(i + 1); // reset view interp as well
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2520,7 +2497,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
if (displayplayers[i] == (mo->player - players))
|
||||
{
|
||||
R_ResetViewInterpolation(i + 1);
|
||||
R_ResetViewInterpolation(i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2855,7 +2831,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
|
||||
case 443: // Calls a named Lua function
|
||||
if (line->text)
|
||||
LUAh_LinedefExecute(line, mo, callsec);
|
||||
LUA_HookLinedefExecute(line, mo, callsec);
|
||||
else
|
||||
CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", sizeu1(line-lines));
|
||||
break;
|
||||
|
||||
+69
-34
@@ -196,6 +196,8 @@ void P_AddThinker(thinker_t *thinker)
|
||||
thinkercap.prev = thinker;
|
||||
|
||||
thinker->references = 0; // killough 11/98: init reference counter to 0
|
||||
|
||||
thinker->cachable = (thinker->function.acp1 == (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -235,7 +237,17 @@ void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
* thinker->prev->next = thinker->next */
|
||||
(next->prev = currentthinker = thinker->prev)->next = next;
|
||||
R_DestroyLevelInterpolators(thinker);
|
||||
Z_Free(thinker);
|
||||
|
||||
if (thinker->cachable == true)
|
||||
{
|
||||
// put cachable thinkers in the mobj cache, so we can avoid allocations
|
||||
((mobj_t *)thinker)->hnext = mobjcache;
|
||||
mobjcache = (mobj_t *)thinker;
|
||||
}
|
||||
else
|
||||
{
|
||||
Z_Free(thinker);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -250,9 +262,20 @@ void P_UnlinkThinker(thinker_t *thinker)
|
||||
I_Assert(thinker->references == 0);
|
||||
|
||||
(next->prev = thinker->prev)->next = next;
|
||||
Z_Free(thinker);
|
||||
|
||||
if (thinker->cachable == true)
|
||||
{
|
||||
// put cachable thinkers in the mobj cache, so we can avoid allocations
|
||||
((mobj_t *)thinker)->hnext = mobjcache;
|
||||
mobjcache = (mobj_t *)thinker;
|
||||
}
|
||||
else
|
||||
{
|
||||
Z_Free(thinker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_RemoveThinker
|
||||
//
|
||||
@@ -327,7 +350,7 @@ static inline void P_RunThinkers(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_DeviceRumbleTick(void)
|
||||
static void P_DeviceRumbleTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
@@ -345,7 +368,7 @@ static inline void P_DeviceRumbleTick(void)
|
||||
if (!P_IsLocalPlayer(player))
|
||||
continue;
|
||||
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (cv_usejoystick[i].value == 0)
|
||||
continue;
|
||||
|
||||
if (!playeringame[displayplayers[i]] || player->spectator)
|
||||
@@ -397,7 +420,7 @@ void P_RunChaseCameras(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_RunQuakes(void)
|
||||
static void P_RunQuakes(void)
|
||||
{
|
||||
fixed_t ir;
|
||||
|
||||
@@ -434,10 +457,21 @@ void P_Ticker(boolean run)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
//Increment jointime even if paused.
|
||||
// Increment jointime even if paused
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
++players[i].jointime;
|
||||
{
|
||||
players[i].jointime++;
|
||||
}
|
||||
}
|
||||
|
||||
if (run)
|
||||
{
|
||||
// Update old view state BEFORE ticking so resetting
|
||||
// the old interpolation state from game logic works.
|
||||
R_UpdateViewInterpolation();
|
||||
}
|
||||
|
||||
if (objectplacing)
|
||||
{
|
||||
@@ -463,15 +497,12 @@ void P_Ticker(boolean run)
|
||||
timeinmap = (timeinmap-1) & ~3;
|
||||
G_PreviewRewind(leveltime);
|
||||
}
|
||||
else if (demo.freecam && democam.cam) // special case: allow freecam to MOVE during pause!
|
||||
P_DemoCameraMovement(democam.cam);
|
||||
else
|
||||
P_RunChaseCameras(); // special case: allow freecam to MOVE during pause!
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
postimgtype[i] = postimg_none;
|
||||
|
||||
P_MapStart();
|
||||
|
||||
if (run)
|
||||
@@ -520,7 +551,7 @@ void P_Ticker(boolean run)
|
||||
ps_checkposition_calls.value.i = 0;
|
||||
|
||||
PS_START_TIMING(ps_lua_prethinkframe_time);
|
||||
LUAh_PreThinkFrame();
|
||||
LUA_HookPreThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_prethinkframe_time);
|
||||
|
||||
PS_START_TIMING(ps_playerthink_time);
|
||||
@@ -556,7 +587,7 @@ void P_Ticker(boolean run)
|
||||
}
|
||||
|
||||
PS_START_TIMING(ps_lua_thinkframe_time);
|
||||
LUAh_ThinkFrame();
|
||||
LUA_HookThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_thinkframe_time);
|
||||
}
|
||||
|
||||
@@ -632,14 +663,17 @@ void P_Ticker(boolean run)
|
||||
|
||||
G_WriteAllGhostTics();
|
||||
|
||||
if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick.value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
if (cv_recordmultiplayerdemos.value)
|
||||
{
|
||||
if (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
//if there are no players left at all, stop demo recording
|
||||
//Demos that that dont have any players crash during playback, which can happen with dedicated servers
|
||||
if (cv_recordmultiplayerdemos.value && demo.savemode == DSM_WILLAUTOSAVE && !D_NumPlayers())
|
||||
G_SaveDemo();
|
||||
// if there are no players left at all, stop demo recording
|
||||
// Demos that that dont have any players crash during playback, which can happen with dedicated servers
|
||||
if (demo.savemode == DSM_WILLAUTOSAVE && !D_NumPlayers())
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
}
|
||||
else if (demo.playback) // Use Ghost data for consistency checks.
|
||||
{
|
||||
@@ -660,11 +694,14 @@ void P_Ticker(boolean run)
|
||||
D_MapChange(gamemap, gametype, encoremode, true, 0, false, false);
|
||||
|
||||
PS_START_TIMING(ps_lua_postthinkframe_time);
|
||||
LUAh_PostThinkFrame();
|
||||
LUA_HookPostThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_postthinkframe_time);
|
||||
}
|
||||
|
||||
K_UpdateDirector();
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
K_UpdateDirector(i);
|
||||
}
|
||||
|
||||
// Always move the camera.
|
||||
P_RunChaseCameras();
|
||||
@@ -672,7 +709,6 @@ void P_Ticker(boolean run)
|
||||
if (run)
|
||||
{
|
||||
R_UpdateLevelInterpolators();
|
||||
R_UpdateViewInterpolation();
|
||||
|
||||
// Hack: ensure newview is assigned every tic.
|
||||
// Ensures view interpolation is T-1 to T in poor network conditions
|
||||
@@ -682,16 +718,18 @@ void P_Ticker(boolean run)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
boolean isSkyVisibleForPlayer = skyVisiblePerPlayer[i];
|
||||
|
||||
if (!player->mo)
|
||||
continue;
|
||||
|
||||
if (isSkyVisibleForPlayer && skyboxmo[0] && cv_skybox.value)
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
|
||||
if (skyVisiblePerPlayer[i] && skybox)
|
||||
{
|
||||
R_SkyboxFrame(player);
|
||||
R_SkyboxFrame(i);
|
||||
}
|
||||
R_SetupFrame(player, (skyboxmo[0] && cv_skybox.value));
|
||||
|
||||
R_SetupFrame(i, skybox);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,9 +746,6 @@ void P_PreTicker(INT32 frames)
|
||||
INT32 i;
|
||||
ticcmd_t temptic;
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
postimgtype[i] = postimg_none;
|
||||
|
||||
hook_defrosting = frames;
|
||||
|
||||
while (hook_defrosting)
|
||||
@@ -719,7 +754,7 @@ void P_PreTicker(INT32 frames)
|
||||
|
||||
R_UpdateMobjInterpolators();
|
||||
|
||||
LUAh_PreThinkFrame();
|
||||
LUA_HOOK(PreThinkFrame);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
@@ -748,7 +783,7 @@ void P_PreTicker(INT32 frames)
|
||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
P_PlayerAfterThink(&players[i]);
|
||||
|
||||
LUAh_ThinkFrame();
|
||||
LUA_HookThinkFrame();
|
||||
|
||||
P_RunOverlays();
|
||||
P_RunShadows();
|
||||
@@ -756,7 +791,7 @@ void P_PreTicker(INT32 frames)
|
||||
P_UpdateSpecials();
|
||||
P_RespawnSpecials();
|
||||
|
||||
LUAh_PostThinkFrame();
|
||||
LUA_HOOK(PostThinkFrame);
|
||||
|
||||
R_UpdateLevelInterpolators();
|
||||
R_UpdateViewInterpolation();
|
||||
|
||||
+335
-309
File diff suppressed because it is too large.
Load diff
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user