Compare commits
122
Commits
fastcmpstuff
...
v9.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcf876a4c4 | ||
|
|
8ab15b73a9 | ||
|
|
301d73a30e | ||
|
|
2ef4e7fcba | ||
|
|
7eb118920f | ||
|
|
2f0588355e | ||
|
|
3e6830fc70 | ||
|
|
2faf859e32 | ||
|
|
8c31fd8a34 | ||
|
|
4dd6d52550 | ||
|
|
8524465767 | ||
|
|
91530c61ad | ||
|
|
89f450db27 | ||
|
|
3e212ebaad | ||
|
|
14af9eb82a | ||
|
|
ed5dbf74f4 | ||
|
|
2bf0a24ab6 | ||
|
|
88a9d6c29e | ||
|
|
335b7ba737 | ||
|
|
37cd720dd6 | ||
|
|
a085abe538 | ||
|
|
57dc099641 | ||
|
|
84a3503262 | ||
|
|
5117bf1f85 | ||
|
|
d4a29f2a44 | ||
|
|
6129e7c864 | ||
|
|
51371dce80 | ||
|
|
4814088265 | ||
|
|
2344c391d2 | ||
|
|
105267612b | ||
|
|
69ef78b2e8 | ||
|
|
f4349988c4 | ||
|
|
1b42131c6f | ||
|
|
c8db86379d | ||
|
|
40d2bf816c | ||
|
|
ca3f40ddf1 | ||
|
|
38bfb58f78 | ||
|
|
1fa50e12a8 | ||
|
|
f73e616b97 | ||
|
|
fe0ade1d9c | ||
|
|
1fb60e8230 | ||
|
|
efe7009650 | ||
|
|
19a4e379d7 | ||
|
|
4e8865d495 | ||
|
|
dfca24b370 | ||
|
|
a4c2fd2414 | ||
|
|
aa985823ba | ||
|
|
b779c9e63d | ||
|
|
c58e54544d | ||
|
|
c080fc8732 | ||
|
|
24163a7c92 | ||
|
|
d934197246 | ||
|
|
76747b4677 | ||
|
|
5268fc2d19 | ||
|
|
bcd54110d5 | ||
|
|
83d538b16a | ||
|
|
2a6a7e1d2b | ||
|
|
c977c4fc45 | ||
|
|
87e0b55f01 | ||
|
|
54f5b5ebfb | ||
|
|
b421893646 | ||
|
|
237aeb7834 | ||
|
|
7dbd95d556 | ||
|
|
1e4ba39691 | ||
|
|
a7805ae3f0 | ||
|
|
325338bfbf | ||
|
|
01a54e4d0b | ||
|
|
e2df018e38 | ||
|
|
33b62cba33 | ||
|
|
29b4f78b64 | ||
|
|
bce18e3d61 | ||
|
|
e9c2b982c6 | ||
|
|
67e1793f49 | ||
|
|
80613a8a49 | ||
|
|
b017a72026 | ||
|
|
a7c5254a32 | ||
|
|
9dd1a47969 | ||
|
|
bbbd42e653 | ||
|
|
2b7f2da5ee | ||
|
|
23ba827726 | ||
|
|
326a28ec36 | ||
|
|
19d6a1600e | ||
|
|
3095303a4b | ||
|
|
2a1807422c | ||
|
|
30cea37248 | ||
|
|
080d3c6b18 | ||
|
|
ec757ceb2c | ||
|
|
e00783da82 | ||
|
|
52a9486974 | ||
|
|
26b26b8f25 | ||
|
|
81f7335b05 | ||
|
|
f603106ac8 | ||
|
|
5675eefeb2 | ||
|
|
1d0fb17da4 | ||
|
|
f53d37052a | ||
|
|
cae5e73d7d | ||
|
|
7325c8dbfd | ||
|
|
e5c18ae1f1 | ||
|
|
4bb5b8fa04 | ||
|
|
95d8864faa | ||
|
|
da67f6feb8 | ||
|
|
8cc73bc482 | ||
|
|
d4a130f1dc | ||
|
|
8ccf4eb9ba | ||
|
|
cdb7b6fede | ||
|
|
fcae072625 | ||
|
|
eb04271c83 | ||
|
|
54e7ad571e | ||
|
|
1d3dae01e9 | ||
|
|
736a626ccf | ||
|
|
a4cc8b0585 | ||
|
|
333c94be52 | ||
|
|
92ec4e65c1 | ||
|
|
a3e97b90f6 | ||
|
|
6f17ed0883 | ||
|
|
02d6fccfa9 | ||
|
|
0ceaca4b2f | ||
|
|
af9fa77501 | ||
|
|
21920112ee | ||
|
|
9b7bf5e7d8 | ||
|
|
524168b20b | ||
|
|
2049353647 |
No files matched your search
@@ -23,6 +23,7 @@ We also have a Flatpak available on [Flathub](https://flathub.org/en/apps/org.sr
|
||||
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2.
|
||||
|
||||
Currently only the Makefile build system with GCC or Clang compiler is supported.
|
||||
CMake is NOT supported at the moment, but will be availible again soon.
|
||||
|
||||
Visual C++ (MSVC) is unsupported.
|
||||
|
||||
|
||||
+20
-15
@@ -1,15 +1,20 @@
|
||||
# SDL Development Libaries
|
||||
|
||||
Download both the VC and MinGW packages and extract them here.
|
||||
|
||||
https://www.libsdl.org/download-2.0.php
|
||||
|
||||
## VC Package
|
||||
|
||||
* include
|
||||
* lib
|
||||
|
||||
## MinGW Package
|
||||
|
||||
* i686-w64-mingw32
|
||||
* x86_64-w64-mingw32
|
||||
# SDL Development Libaries
|
||||
|
||||
Download both the VC and MinGW packages and extract them here.
|
||||
|
||||
https://www.libsdl.org/download-2.0.php
|
||||
|
||||
## VC Package
|
||||
|
||||
* include
|
||||
* lib
|
||||
|
||||
## MinGW Package
|
||||
|
||||
* i686-w64-mingw32
|
||||
* x86_64-w64-mingw32
|
||||
|
||||
# SRB2Kart Saturn note:
|
||||
Due to a good amount of issues with newer SDL releases, we decided to ship our own Version of the library.
|
||||
This version is just the 2.28.5 release with a fix backported for non US keyboard layouts that prevented the right ALT GR key from working properly.
|
||||
It can be found under: https://github.com/alufolie91/SDL/tree/backportaltgrfix
|
||||
Binary file not shown.
@@ -1,65 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
Binary file not shown.
@@ -1,65 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
#!/bin/sh
|
||||
|
||||
# Get the canonical path of the folder containing this script
|
||||
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
# Calculate the canonical path of the prefix, relative to the folder of this script
|
||||
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
#usage="\
|
||||
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
|
||||
usage="\
|
||||
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo 2.28.5
|
||||
;;
|
||||
--cflags)
|
||||
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
|
||||
echo -L${exec_prefix}/lib $sdl_static_libs
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
Binary file not shown.
Binary file not shown.
@@ -30,7 +30,7 @@ sources+=sdl/ogl_sdl.c
|
||||
endif
|
||||
|
||||
ifdef NOMIXER
|
||||
sources+=sdl/sdl_sound.c
|
||||
sources+=sdl/dummy_sound.c
|
||||
else
|
||||
opts+=-DHAVE_MIXER
|
||||
sources+=sdl/mixer_sound.c
|
||||
|
||||
@@ -144,8 +144,10 @@ ifdef GCC81
|
||||
WFLAGS+=-Wno-error=multistatement-macros
|
||||
endif
|
||||
|
||||
ifeq ($(CC),clang)
|
||||
WFLAGS+= -Wno-unknown-pragmas -Wno-cast-align
|
||||
ifneq (,$(filter $(CC) $(CXX),clang clang++))
|
||||
WFLAGS+= -Wno-unknown-pragmas
|
||||
WFLAGS+= -Wno-cast-align
|
||||
WFLAGS+= -Wno-cast-qual # not a fan, but clang really hates our read macros
|
||||
endif
|
||||
|
||||
ifdef NONX86
|
||||
|
||||
+3
-3
@@ -48,13 +48,13 @@ v_video.c
|
||||
w_wad.c
|
||||
y_inter.c
|
||||
z_zone.cpp
|
||||
r_bsp.c
|
||||
r_bsp.cpp
|
||||
r_data.c
|
||||
r_draw.c
|
||||
r_draw.cpp
|
||||
r_fps.cpp
|
||||
r_main.cpp
|
||||
r_patch.cpp
|
||||
r_patchrotation.c
|
||||
r_patchrotation.cpp
|
||||
r_plane.cpp
|
||||
r_segs.cpp
|
||||
r_skins.c
|
||||
|
||||
+1
-1
@@ -434,7 +434,7 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
|
||||
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
|
||||
lua_lock(L);
|
||||
luaC_checkGC(L);
|
||||
setsvalue2s(L, L->top, luaS_newlstr(L, s, len));
|
||||
setsvalue2s(L, L->top, (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len));
|
||||
api_incr_top(L);
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
+33
-31
@@ -1,7 +1,8 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2025 by Sonic Team Junior.
|
||||
// Copyright (C) 2025 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.
|
||||
@@ -24,8 +25,9 @@ extern "C" {
|
||||
//
|
||||
// Little-endian machines
|
||||
//
|
||||
|
||||
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( SINT8)(b); memcpy(p, &tv, sizeof( SINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; const UINT16 tv = ( UINT16)(b); memcpy(p, &tv, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
#define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; const INT32 tv = ( INT32)(b); memcpy(p, &tv, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
@@ -36,25 +38,25 @@ extern "C" {
|
||||
|
||||
// what is this?
|
||||
#if defined (__GNUC__)
|
||||
#define READUINT8(p) ({ UINT8 *p_tmp = (UINT8 *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READSINT8(p) ({ SINT8 *p_tmp = (SINT8 *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READINT16(p) ({ INT16 *p_tmp = (INT16 *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READUINT16(p) ({ UINT16 *p_tmp = (UINT16 *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READINT32(p) ({ INT32 *p_tmp = (INT32 *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READUINT32(p) ({ UINT32 *p_tmp = (UINT32 *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READCHAR(p) ({ char *p_tmp = (char *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READUINT8(p) ({ const UINT8 *p_tmp = (const UINT8 *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READSINT8(p) ({ const SINT8 *p_tmp = (const SINT8 *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READINT16(p) ({ const INT16 *p_tmp = (const INT16 *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READUINT16(p) ({ const UINT16 *p_tmp = (const UINT16 *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READINT32(p) ({ const INT32 *p_tmp = (const INT32 *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READUINT32(p) ({ const UINT32 *p_tmp = (const UINT32 *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READCHAR(p) ({ const char *p_tmp = (const char *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READFIXED(p) ({ const fixed_t *p_tmp = (const fixed_t *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READANGLE(p) ({ const angle_t *p_tmp = (const angle_t *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#else
|
||||
#define READUINT8(p) ((UINT8*)(*(void**)(&(p)) = (void*)&((UINT8*)(p))[1]))[-1]
|
||||
#define READSINT8(p) ((SINT8*)(*(void**)(&(p)) = (void*)&((SINT8*)(p))[1]))[-1]
|
||||
#define READINT16(p) ((INT16*)(*(void**)(&(p)) = (void*)&((INT16*)(p))[1]))[-1]
|
||||
#define READUINT16(p) ((UINT16*)(*(void**)(&(p)) = (void*)&((UINT16*)(p))[1]))[-1]
|
||||
#define READINT32(p) ((INT32*)(*(void**)(&(p)) = (void*)&((INT32*)(p))[1]))[-1]
|
||||
#define READUINT32(p) ((UINT32*)(*(void**)(&(p)) = (void*)&((UINT32*)(p))[1]))[-1]
|
||||
#define READCHAR(p) ((char*)(*(void**)(&(p)) = (void*)&((char*)(p))[1]))[-1]
|
||||
#define READFIXED(p) ((fixed_t*)(*(void**)(&(p)) = (void*)&((fixed_t*)(p))[1]))[-1]
|
||||
#define READANGLE(p) ((angle_t*)(*(void**)(&(p)) = (void*)&((angle_t*)(p))[1]))[-1]
|
||||
#define READUINT8(p) ((const UINT8*) (*(const void**)(&(p)) = (const void*)&((const UINT8*) (p))[1]))[-1]
|
||||
#define READSINT8(p) ((const SINT8*) (*(const void**)(&(p)) = (const void*)&((const SINT8*) (p))[1]))[-1]
|
||||
#define READINT16(p) ((const INT16*) (*(const void**)(&(p)) = (const void*)&((const INT16*) (p))[1]))[-1]
|
||||
#define READUINT16(p) ((const UINT16*) (*(const void**)(&(p)) = (const void*)&((const UINT16*) (p))[1]))[-1]
|
||||
#define READINT32(p) ((const INT32*) (*(const void**)(&(p)) = (const void*)&((const INT32*) (p))[1]))[-1]
|
||||
#define READUINT32(p) ((const UINT32*) (*(const void**)(&(p)) = (const void*)&((const UINT32*) (p))[1]))[-1]
|
||||
#define READCHAR(p) ((const char*) (*(const void**)(&(p)) = (const void*)&((const char*) (p))[1]))[-1]
|
||||
#define READFIXED(p) ((const fixed_t*)(*(const void**)(&(p)) = (const void*)&((const fixed_t*)(p))[1]))[-1]
|
||||
#define READANGLE(p) ((const angle_t*)(*(const void**)(&(p)) = (const void*)&((const angle_t*)(p))[1]))[-1]
|
||||
#endif
|
||||
|
||||
#else //SRB2_BIG_ENDIAN
|
||||
@@ -117,15 +119,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
return (ucp[3] << 24) | (ucp[2] << 16) | (ucp[1] << 8) | ucp[0];
|
||||
}
|
||||
|
||||
#define READUINT8(p) ((UINT8*)(p = (void*)&((UINT8*)p)[1]))[-1]
|
||||
#define READSINT8(p) ((SINT8*)(p = (void*)&((SINT8*)p)[1]))[-1]
|
||||
#define READINT16(p) readshort(&((INT16*)(p = (void*)&((INT16*)p)[1]))[-1])
|
||||
#define READUINT16(p) readushort(&((UINT16*)(p = (void*)&((UINT16*)p)[1]))[-1])
|
||||
#define READINT32(p) readlong(&((INT32*)(p = (void*)&((INT32*)p)[1]))[-1])
|
||||
#define READUINT32(p) readulong(&((UINT32*)(p = (void*)&((UINT32*)p)[1]))
|
||||
#define READCHAR(p) ((char*)(p = (void*)&((char*)p)[1]))[-1]
|
||||
#define READFIXED(p) readlong(&((fixed_t*)(p = (void*)&((fixed_t*)p)[1]))[-1])
|
||||
#define READANGLE(p) readulong(&((angle_t*)(p = (void*)&((angle_t*)p)[1]))[-1])
|
||||
#define READUINT8(p) ((const UINT8*)(p = (const void*)&((const UINT8*)p)[1]))[-1]
|
||||
#define READSINT8(p) ((const SINT8*)(p = (const void*)&((const SINT8*)p)[1]))[-1]
|
||||
#define READINT16(p) readshort(&((const INT16*)(p = (const void*)&((const INT16*)p)[1]))[-1])
|
||||
#define READUINT16(p) readushort(&((const UINT16*)(p = (const void*)&((const UINT16*)p)[1]))[-1])
|
||||
#define READINT32(p) readlong(&((const INT32*)(p = (const void*)&((const INT32*)p)[1]))[-1])
|
||||
#define READUINT32(p) readulong(&((const UINT32*)(p = (const void*)&((const UINT32*)p)[1]))[-1])
|
||||
#define READCHAR(p) ((const char*)(p = (const void*)&((const char*)p)[1]))[-1]
|
||||
#define READFIXED(p) readlong(&((const fixed_t*)(p = (const void*)&((const fixed_t*)p)[1]))[-1])
|
||||
#define READANGLE(p) readulong(&((const angle_t*)(p = (const void*)&((const angle_t*)p)[1]))[-1])
|
||||
#endif //SRB2_BIG_ENDIAN
|
||||
|
||||
#define WRITESTRINGN(p, s, n) do { \
|
||||
|
||||
+18
-14
@@ -142,7 +142,7 @@ void COM_BufInsertText(const char *ptext)
|
||||
templen = com_text.cursize;
|
||||
if (templen)
|
||||
{
|
||||
temp = M_Memcpy(ZZ_Alloc(templen), com_text.data, templen);
|
||||
temp = memcpy(ZZ_Alloc(templen), com_text.data, templen);
|
||||
VS_Clear(&com_text);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ void COM_BufExecute(void)
|
||||
break;
|
||||
}
|
||||
|
||||
M_Memcpy(line, ptext, i);
|
||||
memcpy(line, ptext, i);
|
||||
line[i] = 0;
|
||||
|
||||
// flush the command text from the command buffer, _BEFORE_
|
||||
@@ -277,11 +277,11 @@ static xcommand_t *com_commands = NULL; // current commands
|
||||
|
||||
#define MAX_ARGS 80
|
||||
static size_t com_argc;
|
||||
char *com_argv[MAX_ARGS];
|
||||
char *com_argv[MAX_ARGS] = {};
|
||||
static const char *com_null_string = "";
|
||||
static char *com_args = NULL; // current command args or NULL
|
||||
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum);
|
||||
static void Got_NetVar(const UINT8 **p, INT32 playernum);
|
||||
|
||||
/** Initializes command buffer and adds basic commands.
|
||||
*/
|
||||
@@ -1129,7 +1129,7 @@ void *VS_GetSpace(vsbuf_t *buf, size_t length)
|
||||
*/
|
||||
void VS_Write(vsbuf_t *buf, const void *data, size_t length)
|
||||
{
|
||||
M_Memcpy(VS_GetSpace(buf, length), data, length);
|
||||
memcpy(VS_GetSpace(buf, length), data, length);
|
||||
}
|
||||
|
||||
/** Prints text in a variable buffer. Like VS_Write() plus a
|
||||
@@ -1146,9 +1146,9 @@ void VS_Print(vsbuf_t *buf, const char *data)
|
||||
len = strlen(data) + 1;
|
||||
|
||||
if (buf->data[buf->cursize-1])
|
||||
M_Memcpy((UINT8 *)VS_GetSpace(buf, len), data, len); // no trailing 0
|
||||
memcpy((UINT8 *)VS_GetSpace(buf, len), data, len); // no trailing 0
|
||||
else
|
||||
M_Memcpy((UINT8 *)VS_GetSpace(buf, len-1) - 1, data, len); // write over trailing 0
|
||||
memcpy((UINT8 *)VS_GetSpace(buf, len-1) - 1, data, len); // write over trailing 0
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -1474,7 +1474,7 @@ finish:
|
||||
var->flags |= CV_MODIFIED;
|
||||
|
||||
// raise 'on change' code
|
||||
LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
|
||||
LUA_CVarChanged(var); // let consolelib know what cvar this is.
|
||||
|
||||
if (var->flags & CV_CALL && !stealth)
|
||||
var->func();
|
||||
@@ -1500,11 +1500,11 @@ badinput:
|
||||
|
||||
static boolean serverloading = false;
|
||||
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
static void Got_NetVar(const UINT8 **p, INT32 playernum)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT16 netid;
|
||||
char *svalue;
|
||||
const char *svalue;
|
||||
UINT8 stealth = false;
|
||||
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum) && !serverloading)
|
||||
@@ -1518,9 +1518,10 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
netid = READUINT16(*p);
|
||||
cvar = CV_FindNetVar(netid);
|
||||
svalue = (char *)*p;
|
||||
svalue = (const char *)*p;
|
||||
SKIPSTRING(*p);
|
||||
stealth = READUINT8(*p);
|
||||
|
||||
@@ -1576,8 +1577,9 @@ void CV_SaveNetVars(UINT8 **p, boolean isdemorecording)
|
||||
WRITEUINT16(count_p, count);
|
||||
}
|
||||
|
||||
void CV_LoadNetVars(UINT8 **p)
|
||||
size_t CV_LoadNetVars(const UINT8 *bufstart)
|
||||
{
|
||||
const UINT8 *p = bufstart;
|
||||
consvar_t *cvar;
|
||||
UINT16 count;
|
||||
|
||||
@@ -1588,11 +1590,13 @@ void CV_LoadNetVars(UINT8 **p)
|
||||
if (cvar->flags & CV_NETVAR)
|
||||
Setvalue(cvar, cvar->defaultvalue, true);
|
||||
|
||||
count = READUINT16(*p);
|
||||
count = READUINT16(p);
|
||||
while (count--)
|
||||
Got_NetVar(p, 0);
|
||||
Got_NetVar(&p, 0);
|
||||
|
||||
serverloading = false;
|
||||
|
||||
return p - bufstart;
|
||||
}
|
||||
|
||||
static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth);
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ void CV_SaveVariables(FILE *f);
|
||||
|
||||
// load/save gamesate (load and save option and for network join in game)
|
||||
void CV_SaveNetVars(UINT8 **p, boolean isdemorecording);
|
||||
void CV_LoadNetVars(UINT8 **p);
|
||||
size_t CV_LoadNetVars(const UINT8 *p);
|
||||
|
||||
// reset cheat netvars after cheats is deactivated
|
||||
void CV_ResetCheatNetVars(void);
|
||||
|
||||
+6
-6
@@ -58,7 +58,7 @@ I_mutex con_mutex;
|
||||
static boolean con_started = false; // console has been initialised
|
||||
boolean con_startup = false; // true at game startup, screen need refreshing
|
||||
static boolean con_forcepic = true; // at startup toggle console translucency when first off
|
||||
boolean con_recalc; // set true when screen size has changed
|
||||
boolean con_recalc = false; // set true when screen size has changed
|
||||
|
||||
static tic_t con_tick; // console ticker for anim or blinking prompt cursor
|
||||
// con_scrollup should use time (currenttime - lasttime)..
|
||||
@@ -66,8 +66,8 @@ static tic_t con_tick; // console ticker for anim or blinking prompt cursor
|
||||
static boolean consoletoggle; // true when console key pushed, ticker will handle
|
||||
static boolean consoleready; // console prompt is ready
|
||||
|
||||
INT32 con_destlines; // vid lines used by console at final position
|
||||
static INT32 con_curlines; // vid lines currently used by console
|
||||
INT32 con_destlines = 0; // vid lines used by console at final position
|
||||
static INT32 con_curlines; // vid lines currently used by console
|
||||
|
||||
static UINT8 con_hudlines; // number of console heads up message lines
|
||||
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
||||
@@ -83,7 +83,7 @@ static size_t con_totallines; // lines of console text into the console buf
|
||||
static size_t con_width; // columns of chars, depend on vid mode width
|
||||
|
||||
static size_t con_scrollup; // how many rows of text to scroll up (pgup/pgdn)
|
||||
UINT32 con_scalefactor; // text size scale factor
|
||||
UINT32 con_scalefactor = 0; // text size scale factor
|
||||
|
||||
// hold 32 last lines of input for history
|
||||
#define CON_MAXPROMPTCHARS 256
|
||||
@@ -521,7 +521,7 @@ static void CON_RecalcSize(void)
|
||||
oldcon_width = con_width;
|
||||
oldnumlines = con_totallines;
|
||||
oldcon_cy = con_cy;
|
||||
M_Memcpy(tmp_buffer, con_buffer, CON_BUFFERSIZE);
|
||||
memcpy(tmp_buffer, con_buffer, CON_BUFFERSIZE);
|
||||
|
||||
if (conw < 1)
|
||||
con_width = (BASEVIDWIDTH>>3) - 2;
|
||||
@@ -547,7 +547,7 @@ static void CON_RecalcSize(void)
|
||||
{
|
||||
if (tmp_buffer[(i%oldnumlines)*oldcon_width])
|
||||
{
|
||||
M_Memcpy(string, &tmp_buffer[(i%oldnumlines)*oldcon_width], oldcon_width);
|
||||
memcpy(string, &tmp_buffer[(i%oldnumlines)*oldcon_width], oldcon_width);
|
||||
conw = oldcon_width - 1;
|
||||
while (string[conw] == ' ' && conw)
|
||||
conw--;
|
||||
|
||||
@@ -147,6 +147,51 @@ public:
|
||||
template <class T>
|
||||
NotNull(T) -> NotNull<T>;
|
||||
|
||||
// does a super safe cast from floating point to interger types
|
||||
// this prob could be better since i suck at ceepeepee
|
||||
// but atleast we can just template shit to our desired types
|
||||
template <typename FloatT, typename IntT>
|
||||
static inline IntT floattoint(FloatT val)
|
||||
{
|
||||
// :chaosleep:
|
||||
static_assert(std::is_floating_point_v<FloatT>, "Input must be a floating-point type");
|
||||
static_assert(std::is_integral_v<IntT>, "Output must be a integer type");
|
||||
|
||||
if (std::fpclassify(val) == FP_NAN)
|
||||
return 0; // if stuffs not a number we sure screwed up lmao
|
||||
|
||||
// treat inifinity as "int min/max"
|
||||
if (std::fpclassify(val) == FP_INFINITE)
|
||||
{
|
||||
// yes infinity can be signed kek
|
||||
if (std::signbit(val))
|
||||
return std::numeric_limits<IntT>::min(); // negative infinity, so return min
|
||||
else
|
||||
return std::numeric_limits<IntT>::max();
|
||||
}
|
||||
|
||||
// make sure we fit into our targettype uwu
|
||||
if (val > static_cast<FloatT>(std::numeric_limits<IntT>::max()))
|
||||
return std::numeric_limits<IntT>::max();
|
||||
else if (val < static_cast<FloatT>(std::numeric_limits<IntT>::min()))
|
||||
return std::numeric_limits<IntT>::min();
|
||||
|
||||
return static_cast<IntT>(val);
|
||||
}
|
||||
|
||||
// safe float to fixed
|
||||
// which handles nan and inf
|
||||
// pretty much the same stuff as the above, but uh, idk how id use the above with this
|
||||
template <typename FloatT> // can use both float and doubles yay
|
||||
static inline int32_t floattofixed(FloatT val)
|
||||
{
|
||||
// :chaosleep:
|
||||
static_assert(std::is_floating_point_v<FloatT>, "Input must be a floating-point type");
|
||||
|
||||
// fixed_t is just an int32_t, i dont wanna include doomtype here if it can be avoided
|
||||
return floattoint<FloatT, int32_t>(val * 65535.);
|
||||
}
|
||||
|
||||
} // namespace srb2
|
||||
|
||||
#endif // __SRB2_CXXUTIL_HPP__
|
||||
+97
-40
@@ -78,14 +78,14 @@
|
||||
#define MAX_REASONLENGTH 30
|
||||
#define FORCECLOSE 0x8000
|
||||
|
||||
static long long unsigned packetstat[NUMPACKETTYPE+1] = {0};
|
||||
static long long unsigned packetstat[NUMPACKETTYPE+1] = {};
|
||||
|
||||
boolean server = true; // true or false but !server == client
|
||||
#define client (!server)
|
||||
boolean nodownload = false;
|
||||
boolean serverrunning = false;
|
||||
INT32 serverplayer = 0;
|
||||
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
|
||||
char motd[254] = {}, server_context[8] = {}; // Message of the Day, Unique Context (even without Mumble support)
|
||||
|
||||
#define MAP_ICON_REQUEST_FREQUENCY 8
|
||||
|
||||
@@ -98,14 +98,13 @@ static int map_icon_request_count; // current count of icon requests sent
|
||||
static UINT8 *map_icon_data;
|
||||
static patch_t *map_icon;
|
||||
|
||||
plrinfo playerinfo[MAXPLAYERS];
|
||||
plrinfo playerinfo[MAXPLAYERS] = {};
|
||||
SINT8 joinnode = 0; // used for CL_VIEWSERVER
|
||||
|
||||
boolean player_muted[MAXPLAYERS] = {0};
|
||||
boolean player_muted[MAXPLAYERS] = {};
|
||||
|
||||
// Server specific vars
|
||||
UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
UINT8 playernode[MAXPLAYERS] = {};
|
||||
|
||||
// Minimum timeout for sending the savegame
|
||||
// The actual timeout will be longer depending on the savegame length
|
||||
@@ -118,15 +117,15 @@ static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can rese
|
||||
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
|
||||
|
||||
UINT16 pingmeasurecount = 1;
|
||||
UINT32 realpingtable[MAXPLAYERS]; //the base table of ping where an average will be sent to everyone.
|
||||
UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values.
|
||||
UINT32 realpingtable[MAXPLAYERS] = {}; //the base table of ping where an average will be sent to everyone.
|
||||
UINT32 playerpingtable[MAXPLAYERS] = {}; //table of player latency values.
|
||||
|
||||
#define GENTLEMANSMOOTHING (TICRATE)
|
||||
static tic_t reference_lag;
|
||||
static UINT8 spike_time;
|
||||
tic_t lowest_lag;
|
||||
tic_t simulated_lag;
|
||||
boolean server_lagless;
|
||||
tic_t lowest_lag = 0;
|
||||
tic_t simulated_lag = 0;
|
||||
boolean server_lagless = true;
|
||||
|
||||
static void Lagless_OnChange(void)
|
||||
{
|
||||
@@ -144,12 +143,17 @@ static CV_PossibleValue_t mindelay_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL
|
||||
consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz...
|
||||
|
||||
SINT8 nodetoplayer[MAXNETNODES];
|
||||
SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen)
|
||||
SINT8 nodetoplayer3[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 2)
|
||||
SINT8 nodetoplayer4[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 3)
|
||||
UINT8 playerpernode[MAXNETNODES]; // used specialy for splitscreen
|
||||
boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
|
||||
// allows a fake player to appear on the ms and serverlist when your dedi server is empty
|
||||
static void FakeSeed_OnChange(void);
|
||||
consvar_t cv_usefakeseed = {"fakeseed", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, FakeSeed_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fakeseedname = {"fakeseedname", "Player 1", CV_SAVE|CV_CALL|CV_NOINIT, NULL, FakeSeed_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
SINT8 nodetoplayer[MAXNETNODES] = {};
|
||||
SINT8 nodetoplayer2[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen)
|
||||
SINT8 nodetoplayer3[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 2)
|
||||
SINT8 nodetoplayer4[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 3)
|
||||
UINT8 playerpernode[MAXNETNODES] = {}; // used specialy for splitscreen
|
||||
boolean nodeingame[MAXNETNODES] = {}; // set false as nodes leave game
|
||||
|
||||
tic_t servermaxping = 20; // server's max delay, in frames. Defaults to 20
|
||||
static tic_t nettics[MAXNETNODES]; // what tic the client have received
|
||||
@@ -196,7 +200,7 @@ boolean is_client_saturn[MAXNETNODES];
|
||||
static UINT8 localtextcmd[MAXSPLITSCREENPLAYERS][MAXTEXTCMD];
|
||||
static tic_t neededtic;
|
||||
SINT8 servernode = 0; // the number of the server node
|
||||
char connectedservername[MAXSERVERNAME+1];
|
||||
char connectedservername[MAXSERVERNAME+1] = {};
|
||||
/// \brief do we accept new players?
|
||||
/// \todo WORK!
|
||||
boolean acceptnewnode = true;
|
||||
@@ -227,7 +231,7 @@ struct textcmdbuf_s
|
||||
static textcmdbuf_t *textcmdbuf[MAXSPLITSCREENPLAYERS] = {NULL};
|
||||
|
||||
static ticcmd_t playercmds[MAXPLAYERS];
|
||||
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
|
||||
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS] = {};
|
||||
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
|
||||
|
||||
consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -241,6 +245,13 @@ consvar_t cv_httpsource = {"http_source", "", CV_SAVE, NULL, NULL, 0, NULL, NULL
|
||||
|
||||
consvar_t cv_kicktime = {"kicktime", "10", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void FakeSeed_OnChange(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
Update_MS();
|
||||
#endif
|
||||
}
|
||||
|
||||
static boolean UseLocalDelay(void)
|
||||
{
|
||||
if (dedicated || (server && server_lagless && !cv_mindelay.value) || modeattacking == ATTACKING_RECORD)
|
||||
@@ -285,7 +296,7 @@ static inline void *G_ScpyTiccmd(ticcmd_t* dest, void* src, const size_t n)
|
||||
// Some software don't support largest packet
|
||||
// (original sersetup, not exactely, but the probability of sending a packet
|
||||
// of 512 bytes is like 0.1)
|
||||
UINT16 software_MAXPACKETLENGTH;
|
||||
UINT16 software_MAXPACKETLENGTH = 0;
|
||||
|
||||
/** Guesses the value of a tic from its lowest byte and from maketic
|
||||
*
|
||||
@@ -312,9 +323,9 @@ static inline tic_t ExpandTics(INT32 low, tic_t basetic)
|
||||
// Some extra data function for handle textcmd buffer
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
static void (*listnetxcmd[MAXNETXCMD])(UINT8 **p, INT32 playernum);
|
||||
static void (*listnetxcmd[MAXNETXCMD])(const UINT8 **p, INT32 playernum);
|
||||
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum))
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(const UINT8 **p, INT32 playernum))
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
if (id >= MAXNETXCMD)
|
||||
@@ -331,7 +342,7 @@ static void WriteNetXCmd(UINT8 *cmd, netxcmd_t id, const void *param, size_t npa
|
||||
cmd[cmd[0]] = (UINT8)id;
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&cmd[cmd[0]+1], param, nparam);
|
||||
memcpy(&cmd[cmd[0]+1], param, nparam);
|
||||
cmd[0] = (UINT8)(cmd[0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
@@ -460,12 +471,12 @@ static void ExtraDataTicker(void)
|
||||
{
|
||||
if (playeringame[i] || i == 0)
|
||||
{
|
||||
UINT8 *bufferstart = D_GetExistingTextcmd(gametic, i);
|
||||
const UINT8 *bufferstart = D_GetExistingTextcmd(gametic, i);
|
||||
|
||||
if (bufferstart)
|
||||
{
|
||||
UINT8 *curpos = bufferstart;
|
||||
UINT8 *bufferend = &curpos[curpos[0]+1];
|
||||
const UINT8 *curpos = bufferstart;
|
||||
const UINT8 *bufferend = &curpos[curpos[0]+1];
|
||||
|
||||
curpos++;
|
||||
while (curpos < bufferend)
|
||||
@@ -1545,6 +1556,12 @@ static boolean CL_SendJoin(void)
|
||||
return HSendPacket(servernode, false, 0, sizeof(clientconfig_pak));
|
||||
}
|
||||
|
||||
static boolean UseFakeSeed(void)
|
||||
{
|
||||
// due to complexity this will disable the moment a real player joins
|
||||
return (dedicated && cv_usefakeseed.value && D_NumPlayers() == 0);
|
||||
}
|
||||
|
||||
static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
{
|
||||
UINT8 *p;
|
||||
@@ -1567,7 +1584,12 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
netbuffer->u.serverinfo.time = (tic_t)LONG(servertime);
|
||||
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
|
||||
|
||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
|
||||
// force 1 player
|
||||
if (UseFakeSeed())
|
||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)1;
|
||||
else
|
||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
|
||||
|
||||
netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
|
||||
|
||||
// SRB2Kart: Vanilla's gametype constants for MS support
|
||||
@@ -1585,7 +1607,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
MAXSERVERNAME);
|
||||
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), sizeof(netbuffer->u.serverinfo.mapname)-1);
|
||||
|
||||
M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, sizeof(netbuffer->u.serverinfo.mapmd5));
|
||||
memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, sizeof(netbuffer->u.serverinfo.mapmd5));
|
||||
|
||||
netbuffer->u.serverinfo.iszone = 0;
|
||||
|
||||
@@ -1646,6 +1668,37 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
|
||||
netbuffer->packettype = PT_PLAYERINFO;
|
||||
|
||||
// send a fake player to trick ms and serverbrowser
|
||||
if (UseFakeSeed())
|
||||
{
|
||||
//printf("sending fake player lmao\n");
|
||||
netbuffer->u.playerinfo[0].node = 0;
|
||||
|
||||
// fallback to smth, make sure this is always set
|
||||
if (!cv_fakeseedname.string[0])
|
||||
CV_Set(&cv_fakeseedname, "Player 1");
|
||||
strlcpy(netbuffer->u.playerinfo[0].name, cv_fakeseedname.string, MAXPLAYERNAME+1);
|
||||
|
||||
memset(netbuffer->u.playerinfo[0].address, 0, 4);
|
||||
|
||||
// make it appear as spectator
|
||||
netbuffer->u.playerinfo[0].team = 255;
|
||||
|
||||
// doesent really matter what we put here lel
|
||||
netbuffer->u.playerinfo[0].score = LONG(42069);
|
||||
netbuffer->u.playerinfo[0].timeinserver = SHORT(42069);
|
||||
netbuffer->u.playerinfo[0].skin = (UINT8)1; // no clue wtf skin 1 is, tails maybe?
|
||||
|
||||
netbuffer->u.playerinfo[0].data = 0;
|
||||
|
||||
// mark every other slot as empty
|
||||
for (i = 1; i < MSCOMPAT_MAXPLAYERS; i++)
|
||||
netbuffer->u.playerinfo[i].node = 255;
|
||||
|
||||
HSendPacket(node, false, 0, sizeof(plrinfo) * MSCOMPAT_MAXPLAYERS);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MSCOMPAT_MAXPLAYERS; i++)
|
||||
{
|
||||
if ((i >= MAXPLAYERS) || !playeringame[i])
|
||||
@@ -3757,7 +3810,7 @@ static void Command_Kick(void)
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
}
|
||||
|
||||
static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
static void Got_KickCmd(const UINT8 **p, INT32 playernum)
|
||||
{
|
||||
INT32 pnum, msg;
|
||||
char buf[3 + MAX_REASONLENGTH];
|
||||
@@ -4147,8 +4200,8 @@ consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaitt
|
||||
|
||||
consvar_t cv_serverinfoscreen = {"serverinfoscreen", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void Got_AddPlayer(UINT8 **p, INT32 playernum);
|
||||
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
|
||||
static void Got_AddPlayer(const UINT8 **p, INT32 playernum);
|
||||
static void Got_RemovePlayer(const UINT8 **p, INT32 playernum);
|
||||
|
||||
static void Joinable_OnChange(void)
|
||||
{
|
||||
@@ -4400,7 +4453,7 @@ static inline void SV_AddNode(INT32 node)
|
||||
}
|
||||
|
||||
// Xcmd XD_ADDPLAYER
|
||||
static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||
static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
|
||||
{
|
||||
INT16 node, newplayernum;
|
||||
UINT8 splitscreenplayer = 0;
|
||||
@@ -4487,7 +4540,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||
}
|
||||
|
||||
// Xcmd XD_REMOVEPLAYER
|
||||
static void Got_RemovePlayer(UINT8 **p, INT32 playernum)
|
||||
static void Got_RemovePlayer(const UINT8 **p, INT32 playernum)
|
||||
{
|
||||
SINT8 pnum, reason;
|
||||
|
||||
@@ -4648,7 +4701,7 @@ void SV_StopServer(void)
|
||||
|
||||
if (gamestate == GS_INTERMISSION)
|
||||
Y_EndIntermission();
|
||||
if (gamestate == GS_VOTING)
|
||||
else if (gamestate == GS_VOTING)
|
||||
Y_EndVote();
|
||||
|
||||
G_SetGamestate(GS_NULL);
|
||||
@@ -4664,6 +4717,8 @@ void SV_StopServer(void)
|
||||
textcmdbuf[i] = textcmdbuf[i]->next;
|
||||
Z_Free(buf);
|
||||
}
|
||||
|
||||
textcmdbuf[i] = NULL;
|
||||
}
|
||||
|
||||
for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++)
|
||||
@@ -5227,7 +5282,7 @@ static void PT_ServerCFG(SINT8 node)
|
||||
|
||||
scp = netbuffer->u.servercfg.varlengthinputs;
|
||||
CV_LoadPlayerNames(&scp);
|
||||
CV_LoadNetVars(&scp);
|
||||
scp += CV_LoadNetVars(scp);
|
||||
|
||||
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
|
||||
/// Shouldn't them be downloaded even at intermission time?
|
||||
@@ -5687,7 +5742,7 @@ static void PT_TextCmd(INT32 netconsole, SINT8 node)
|
||||
DEBFILE(va("textcmd put in tic %u at position %d (player %d) ftts %u mk %u\n",
|
||||
tic, textcmd[0]+1, netconsole, firstticstosend, maketic));
|
||||
|
||||
M_Memcpy(&textcmd[textcmd[0]+1], netbuffer->u.textcmd+1, netbuffer->u.textcmd[0]);
|
||||
memcpy(&textcmd[textcmd[0]+1], netbuffer->u.textcmd+1, netbuffer->u.textcmd[0]);
|
||||
textcmd[0] += (UINT8)netbuffer->u.textcmd[0];
|
||||
}
|
||||
}
|
||||
@@ -5794,7 +5849,7 @@ static void PT_ServerTics(SINT8 node)
|
||||
}
|
||||
|
||||
if (i >= gametic) // Don't copy old net commands
|
||||
M_Memcpy(D_GetTextcmd(i, playernum), txtpak, txtsize);
|
||||
memcpy(D_GetTextcmd(i, playernum), txtpak, txtsize);
|
||||
txtpak += txtsize;
|
||||
}
|
||||
}
|
||||
@@ -5853,12 +5908,14 @@ static void PT_FileFragmentFromPlayer(SINT8 node)
|
||||
Got_Filetxpak();
|
||||
}
|
||||
|
||||
#ifdef SATURNPAK
|
||||
static void PT_ReceivedGamestate(SINT8 node)
|
||||
{
|
||||
sendingsavegame[node] = false;
|
||||
resendingsavegame[node] = 0;
|
||||
savegameresendcooldown[node] = I_GetTime() + cv_resynchcooldown.value * TICRATE; // I_GetTime() + 5 * TICRATE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Handles a packet received from a node that is in game
|
||||
*
|
||||
@@ -6332,7 +6389,7 @@ static void CL_SendClientCmd(void)
|
||||
break;
|
||||
}
|
||||
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd[i], localtextcmd[i][0]+1);
|
||||
memcpy(netbuffer->u.textcmd, localtextcmd[i], localtextcmd[i][0]+1);
|
||||
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd[i][0]+1)) // Send can fail...
|
||||
@@ -6342,7 +6399,7 @@ static void CL_SendClientCmd(void)
|
||||
if (textcmdbuf[i] != NULL)
|
||||
{
|
||||
textcmdbuf_t *buf = textcmdbuf[i];
|
||||
M_Memcpy(localtextcmd[i], textcmdbuf[i]->cmd, textcmdbuf[i]->cmd[0]+1);
|
||||
memcpy(localtextcmd[i], textcmdbuf[i]->cmd, textcmdbuf[i]->cmd[0]+1);
|
||||
textcmdbuf[i] = textcmdbuf[i]->next;
|
||||
Z_Free(buf);
|
||||
}
|
||||
@@ -6455,7 +6512,7 @@ static void SV_SendTics(void)
|
||||
{
|
||||
(*ntextcmd)++;
|
||||
WRITEUINT8(bufpos, j);
|
||||
M_Memcpy(bufpos, textcmd, size + 1);
|
||||
memcpy(bufpos, textcmd, size + 1);
|
||||
bufpos += size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -582,6 +582,8 @@ extern tic_t simulated_lag;
|
||||
extern tic_t lowest_lag;
|
||||
extern consvar_t cv_mindelay, cv_gentlemens;
|
||||
|
||||
extern consvar_t cv_usefakeseed, cv_fakeseedname;
|
||||
|
||||
extern consvar_t
|
||||
cv_netticbuffer, cv_allownewplayer,
|
||||
#ifdef SATURNJOIN
|
||||
@@ -604,7 +606,7 @@ extern consvar_t cv_serverinfoscreen;
|
||||
void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(const UINT8 **p, INT32 playernum));
|
||||
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
|
||||
void SendKick(UINT8 playernum, UINT8 msg);
|
||||
|
||||
+33
-79
@@ -142,8 +142,8 @@ static char addonsdir[MAX_WADPATH];
|
||||
// Events can be discarded if no responder claims them
|
||||
// referenced from i_system.c for I_GetKey()
|
||||
|
||||
event_t events[MAXEVENTS];
|
||||
INT32 eventhead, eventtail;
|
||||
event_t events[MAXEVENTS] = {};
|
||||
INT32 eventhead = 0, eventtail = 0;
|
||||
|
||||
boolean dedicated = false;
|
||||
|
||||
@@ -161,68 +161,17 @@ void D_PostEvent(const event_t *ev)
|
||||
|
||||
// modifier keys
|
||||
// Now handled in I_OsPolling
|
||||
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||
boolean capslock = 0; // gee i wonder what this does.
|
||||
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||
boolean capslock = 0; // gee i wonder what this does.
|
||||
|
||||
static void D_PadMenuScrollInput(UINT8 input)
|
||||
{
|
||||
event_t dpadev;
|
||||
memset(&dpadev, 0, sizeof(event_t));
|
||||
dpadev.type = ev_keydown;
|
||||
|
||||
switch (input)
|
||||
{
|
||||
case DPAD_UP:
|
||||
dpadev.data1 = KEY_UPARROW;
|
||||
break;
|
||||
case DPAD_DOWN:
|
||||
dpadev.data1 = KEY_DOWNARROW;
|
||||
break;
|
||||
case DPAD_LEFT:
|
||||
dpadev.data1 = KEY_LEFTARROW;
|
||||
break;
|
||||
case DPAD_RIGHT:
|
||||
dpadev.data1 = KEY_RIGHTARROW;
|
||||
break;
|
||||
}
|
||||
|
||||
D_PostEvent(&dpadev); // put into eventlist
|
||||
}
|
||||
|
||||
#define SCROLLDELAY 19
|
||||
|
||||
// Check if any dpad button is held
|
||||
// and pass it to the eventlist
|
||||
static void D_GamePadMenuScrollTicker(void)
|
||||
{
|
||||
UINT8 i;
|
||||
static UINT8 menuInputDelayTimer = 0;
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (dpadscrollstate[i])
|
||||
{
|
||||
if (menuInputDelayTimer < SCROLLDELAY)
|
||||
menuInputDelayTimer++;
|
||||
else if (menuInputDelayTimer == SCROLLDELAY)
|
||||
D_PadMenuScrollInput(i);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
menuInputDelayTimer = 0;
|
||||
}
|
||||
#undef SCROLLDELAY
|
||||
|
||||
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0};
|
||||
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {};
|
||||
|
||||
static void D_DeviceLEDTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0};
|
||||
static UINT16 color[MAXSPLITSCREENPLAYERS] = {};
|
||||
|
||||
if (numcontrollers == 0)
|
||||
{
|
||||
@@ -390,8 +339,7 @@ static void D_Renderview(void)
|
||||
}
|
||||
else if (rendermode == render_soft)
|
||||
#endif
|
||||
|
||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||
}
|
||||
|
||||
if (rendermode == render_soft)
|
||||
@@ -720,13 +668,14 @@ static boolean D_Display(void)
|
||||
// D_SRB2Loop
|
||||
// =========================================================================
|
||||
|
||||
tic_t rendergametic;
|
||||
tic_t rendergametic = 0;
|
||||
|
||||
void D_SRB2Loop(void)
|
||||
{
|
||||
tic_t entertic = 0, oldentertics = 0, realtics = 0, rendertimeout = INFTICS;
|
||||
double deltatics = 0.0;
|
||||
double deltasecs = 0.0;
|
||||
UINT64 precision;
|
||||
|
||||
boolean interp = false;
|
||||
boolean doDisplay = false;
|
||||
@@ -762,18 +711,23 @@ void D_SRB2Loop(void)
|
||||
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, W_CachePatchNum(W_GetNumForName("KARTKREW"), PU_PATCH_LOWPRIORITY), NULL);
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
|
||||
precision = I_GetPrecisePrecision();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
// capbudget is the minimum precise_t duration of a single loop iteration
|
||||
precise_t capbudget;
|
||||
precise_t enterprecise = I_GetPreciseTime();
|
||||
precise_t elapsed;
|
||||
precise_t enterprecise, finishprecise;
|
||||
|
||||
enterprecise = I_GetPreciseTime();
|
||||
|
||||
memset(&g_dc, 0, sizeof(g_dc));
|
||||
Z_Frame_Reset();
|
||||
|
||||
// Casting the return value of a function is bad practice (apparently)
|
||||
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
|
||||
capbudget = (precise_t)budget;
|
||||
const UINT32 framecap = R_GetFramerateCap();
|
||||
capbudget = (framecap == 0) ? 0 : (precise_t)((double)precision / (double)framecap + 0.5); // + 0.5 instead of round
|
||||
|
||||
boolean ranwipe = false;
|
||||
|
||||
@@ -845,18 +799,13 @@ void D_SRB2Loop(void)
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
if (menuactive)
|
||||
{
|
||||
D_GamePadMenuScrollTicker();
|
||||
}
|
||||
|
||||
D_DeviceLEDTick();
|
||||
}
|
||||
}
|
||||
|
||||
if (interp)
|
||||
{
|
||||
renderdeltatics = FloatToFixed(deltatics);
|
||||
renderdeltatics = DoubleToFixed(deltatics);
|
||||
|
||||
// I looked at the possibility of putting in a float drawer for
|
||||
// perfstats and it's very complicated, so we'll just do this instead...
|
||||
@@ -905,12 +854,13 @@ void D_SRB2Loop(void)
|
||||
}
|
||||
#endif
|
||||
// Fully completed frame made.
|
||||
precise_t finishprecise = I_GetPreciseTime();
|
||||
finishprecise = I_GetPreciseTime();
|
||||
|
||||
// Use the time before sleep for frameskip calculations:
|
||||
// post-sleep time is literally being intentionally wasted
|
||||
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
|
||||
deltatics = deltasecs * NEWTICRATE;
|
||||
elapsed = finishprecise - enterprecise;
|
||||
deltasecs = (double)elapsed / (double)precision;
|
||||
deltatics = deltasecs * (double)NEWTICRATE;
|
||||
|
||||
// If time spent this game loop exceeds a single tic,
|
||||
// it's probably because of rendering.
|
||||
@@ -938,12 +888,10 @@ void D_SRB2Loop(void)
|
||||
|
||||
if (!singletics)
|
||||
{
|
||||
INT64 elapsed = (INT64)(finishprecise - enterprecise);
|
||||
|
||||
// in the case of "match refresh rate" + vsync, don't sleep at all
|
||||
const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0;
|
||||
|
||||
if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh)
|
||||
if ((elapsed > 0) && (capbudget > elapsed) && !vsync_with_match_refresh)
|
||||
{
|
||||
I_SleepDuration(capbudget - elapsed);
|
||||
}
|
||||
@@ -951,8 +899,9 @@ void D_SRB2Loop(void)
|
||||
|
||||
// Capture the time once more to get the real delta time.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
|
||||
deltatics = deltasecs * NEWTICRATE;
|
||||
elapsed = finishprecise - enterprecise;
|
||||
deltasecs = (double)elapsed / (double)precision;
|
||||
deltatics = deltasecs * (double)NEWTICRATE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1977,6 +1926,10 @@ void D_SRB2Main(void)
|
||||
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
|
||||
R_Init();
|
||||
|
||||
#if SOUND==SOUND_DUMMY
|
||||
sound_disabled = true;
|
||||
music_disabled = true;
|
||||
#else
|
||||
// setting up sound
|
||||
if (dedicated || M_CheckParm("-noaudio")) // combines -nosound and -nomusic
|
||||
{
|
||||
@@ -1998,6 +1951,7 @@ void D_SRB2Main(void)
|
||||
I_InitMusic();
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
}
|
||||
#endif
|
||||
|
||||
S_InitMusicDefs();
|
||||
|
||||
|
||||
+12
-12
@@ -95,9 +95,9 @@ static INT32 sendackpacket = 0, getackpacket = 0;
|
||||
INT32 ticruned = 0, ticmiss = 0;
|
||||
|
||||
// globals
|
||||
INT32 getbps, sendbps;
|
||||
float lostpercent, duppercent, gamelostpercent;
|
||||
INT32 packetheaderlength;
|
||||
INT32 getbps = 0, sendbps = 0;
|
||||
float lostpercent = 0, duppercent = 0, gamelostpercent = 0;
|
||||
INT32 packetheaderlength = 0;
|
||||
|
||||
boolean Net_GetNetStat(void)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ static boolean GetFreeAcknum(UINT8 *freeack)
|
||||
ackpak[i].length = doomcom->datalength;
|
||||
ackpak[i].senttime = I_GetTime();
|
||||
ackpak[i].resentnum = 0;
|
||||
M_Memcpy(ackpak[i].pak.raw, netbuffer, ackpak[i].length);
|
||||
memcpy(ackpak[i].pak.raw, netbuffer, ackpak[i].length);
|
||||
|
||||
*freeack = ackpak[i].acknum;
|
||||
|
||||
@@ -412,7 +412,7 @@ void Net_SendAcks(INT32 node)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
netbuffer->packettype = PT_NOTHING;
|
||||
M_Memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
|
||||
memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
|
||||
HSendPacket(node, false, 0, MAXACKTOSEND);
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ void Net_AckTicker(void)
|
||||
}
|
||||
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
|
||||
NODETIMEOUT, I_GetTime()));
|
||||
M_Memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
|
||||
memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
|
||||
ackpak[i].senttime = I_GetTime();
|
||||
ackpak[i].resentnum++;
|
||||
ackpak[i].nextacknum = node->nextacknum;
|
||||
@@ -805,16 +805,16 @@ const char *packettypename[NUMPACKETTYPE] =
|
||||
"TELLFILESNEEDED",
|
||||
"MOREFILESNEEDED",
|
||||
|
||||
"PING"
|
||||
"PING",
|
||||
#ifdef SATURNPAK
|
||||
,
|
||||
|
||||
"WILLRESENDGAMESTATE",
|
||||
"CANRECEIVEGAMESTATE",
|
||||
"RECEIVEDGAMESTATE",
|
||||
|
||||
"ISSATURN" // special packet to identify saturn clients
|
||||
"ISSATURN", // special packet to identify saturn clients
|
||||
#endif
|
||||
"MAPICON", // Send map image icon (gamespy).
|
||||
"NEEDMAPICON" // Request missed map icon (gamespy).
|
||||
};
|
||||
|
||||
const char *Net_GetPacketName(UINT8 packettype)
|
||||
@@ -1021,7 +1021,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
return false;
|
||||
}
|
||||
netbuffer->ack = netbuffer->ackreturn = 0; // don't hold over values from last packet sent/received
|
||||
M_Memcpy(&reboundstore[rebound_head], netbuffer,
|
||||
memcpy(&reboundstore[rebound_head], netbuffer,
|
||||
doomcom->datalength);
|
||||
reboundsize[rebound_head] = doomcom->datalength;
|
||||
rebound_head = (rebound_head+1) % MAXREBOUND;
|
||||
@@ -1107,7 +1107,7 @@ boolean HGetPacket(void)
|
||||
// Get a packet from self
|
||||
if (rebound_tail != rebound_head)
|
||||
{
|
||||
M_Memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]);
|
||||
memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]);
|
||||
doomcom->datalength = reboundsize[rebound_tail];
|
||||
if (netbuffer->packettype == PT_NODETIMEOUT)
|
||||
doomcom->remotenode = netbuffer->u.textcmd[0];
|
||||
|
||||
+48
-43
@@ -68,22 +68,22 @@
|
||||
// protos
|
||||
// ------
|
||||
|
||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum);
|
||||
static void Got_WeaponPref(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Mapcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Pause(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Respawn(UINT8 **cp, INT32 playernum);
|
||||
static void Got_RandomSeed(UINT8 **cp, INT32 playernum);
|
||||
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Teamchange(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Clearscores(UINT8 **cp, INT32 playernum);
|
||||
static void Got_DiscordInfo(UINT8 **cp, INT32 playernum);
|
||||
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Mapcmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_PickVotecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Addfilecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Pause(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Respawn(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_RandomSeed(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_RunSOCcmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Teamchange(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Clearscores(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_DiscordInfo(const UINT8 **cp, INT32 playernum);
|
||||
|
||||
static void PointLimit_OnChange(void);
|
||||
static void TimeLimit_OnChange(void);
|
||||
@@ -178,13 +178,13 @@ static void Command_Clearscores_f(void);
|
||||
// Remote Administration
|
||||
static void Command_Changepassword_f(void);
|
||||
static void Command_Login_f(void);
|
||||
static void Got_Login(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Verification(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Removal(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Login(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Verification(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Removal(const UINT8 **cp, INT32 playernum);
|
||||
static void Command_Verify_f(void);
|
||||
static void Command_RemoveAdmin_f(void);
|
||||
static void Command_MotD_f(void);
|
||||
static void Got_MotD_f(UINT8 **cp, INT32 playernum);
|
||||
static void Got_MotD_f(const UINT8 **cp, INT32 playernum);
|
||||
|
||||
static void Command_ShowScores_f(void);
|
||||
static void Command_ShowTime_f(void);
|
||||
@@ -760,6 +760,9 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_showping);
|
||||
CV_RegisterVar(&cv_pingmeasurement);
|
||||
|
||||
CV_RegisterVar(&cv_usefakeseed);
|
||||
CV_RegisterVar(&cv_fakeseedname);
|
||||
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
#endif
|
||||
@@ -1913,7 +1916,7 @@ static void SendNameAndColor4(void)
|
||||
SendNetXCmdForPlayer(3, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
player_t *p = &players[playernum];
|
||||
char name[MAXPLAYERNAME+1];
|
||||
@@ -2041,15 +2044,17 @@ void SendWeaponPref4(void)
|
||||
SendNetXCmdForPlayer(3, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
|
||||
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
player_t *player = &players[playernum];
|
||||
|
||||
UINT8 prefs = READUINT8(*cp);
|
||||
|
||||
players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
|
||||
player->pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
|
||||
if (prefs & 1)
|
||||
players[playernum].pflags |= PF_FLIPCAM;
|
||||
player->pflags |= PF_FLIPCAM;
|
||||
if (prefs & 2)
|
||||
players[playernum].pflags |= PF_ANALOGMODE;
|
||||
player->pflags |= PF_ANALOGMODE;
|
||||
}
|
||||
|
||||
void D_SendPlayerConfig(void)
|
||||
@@ -2848,7 +2853,7 @@ static void Command_Map_f(void)
|
||||
* ::serverplayer or ::adminplayer.
|
||||
* \sa D_MapChange
|
||||
*/
|
||||
static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Mapcmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char mapname[MAX_WADPATH+1];
|
||||
UINT8 flags;
|
||||
@@ -2967,7 +2972,7 @@ static void Command_Pause(void)
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
}
|
||||
|
||||
static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Pause(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT8 dedicatedpause = false;
|
||||
const char *playername;
|
||||
@@ -3079,7 +3084,7 @@ static void Command_Respawn(void)
|
||||
SendNetXCmd(XD_RESPAWN, &buf, 4);
|
||||
}
|
||||
|
||||
static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Respawn(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT32 respawnplayer = READINT32(*cp);
|
||||
|
||||
@@ -3114,7 +3119,7 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
||||
* \param playernum Player responsible for the message. Must be ::serverplayer.
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
static void Got_RandomSeed(UINT8 **cp, INT32 playernum)
|
||||
static void Got_RandomSeed(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT32 seed;
|
||||
|
||||
@@ -3149,7 +3154,7 @@ static void Command_Clearscores_f(void)
|
||||
* \sa XD_CLEARSCORES, Command_Clearscores_f
|
||||
* \author SSNTails <http://www.ssntails.org>
|
||||
*/
|
||||
static void Got_Clearscores(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Clearscores(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
@@ -3666,7 +3671,7 @@ static void Command_ServerTeamChange_f(void)
|
||||
}
|
||||
|
||||
//todo: This and the other teamchange functions are getting too long and messy. Needs cleaning.
|
||||
static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Teamchange(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
changeteam_union NetPacket;
|
||||
boolean error = false, wasspectator = false;
|
||||
@@ -4023,7 +4028,7 @@ static void Command_Login_f(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Got_Login(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Login(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
#ifdef NOMD5
|
||||
// If we have no MD5 support then completely disable XD_LOGIN responses for security.
|
||||
@@ -4133,7 +4138,7 @@ static void Command_Verify_f(void)
|
||||
SendNetXCmd(XD_VERIFIED, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_Verification(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Verification(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT16 num = READUINT8(*cp);
|
||||
|
||||
@@ -4185,7 +4190,7 @@ static void Command_RemoveAdmin_f(void)
|
||||
SendNetXCmd(XD_DEMOTED, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_Removal(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Removal(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT16 num = READUINT8(*cp);
|
||||
|
||||
@@ -4261,7 +4266,7 @@ static void Command_MotD_f(void)
|
||||
Z_Free(mymotd);
|
||||
}
|
||||
|
||||
static void Got_MotD_f(UINT8 **cp, INT32 playernum)
|
||||
static void Got_MotD_f(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char *mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
|
||||
INT32 i;
|
||||
@@ -4328,7 +4333,7 @@ static void Command_RunSOC(void)
|
||||
SendNetXCmd(XD_RUNSOC, buf, length);
|
||||
}
|
||||
|
||||
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_RunSOCcmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[256];
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
@@ -4606,7 +4611,7 @@ static void Command_GLocalSkin (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
@@ -4665,7 +4670,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
COM_BufAddText(va("addfile %s\n", filename));
|
||||
}
|
||||
|
||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_Addfilecmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
@@ -5465,7 +5470,7 @@ static void Command_ExitLevel_f(void)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
|
||||
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
(void)cp;
|
||||
|
||||
@@ -5486,7 +5491,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
||||
G_ExitLevel();
|
||||
}
|
||||
|
||||
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 gt, secondgt;
|
||||
@@ -5538,7 +5543,7 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
|
||||
Y_StartVote();
|
||||
}
|
||||
|
||||
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
SINT8 voted = READSINT8(*cp);
|
||||
UINT8 p = READUINT8(*cp);
|
||||
@@ -5547,7 +5552,7 @@ static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum)
|
||||
votes[p] = voted;
|
||||
}
|
||||
|
||||
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
|
||||
static void Got_PickVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
SINT8 pick = READSINT8(*cp);
|
||||
SINT8 level = READSINT8(*cp);
|
||||
@@ -6187,7 +6192,7 @@ static void KartEliminateLast_OnChange(void)
|
||||
P_CheckRacers();
|
||||
}
|
||||
|
||||
void Got_DiscordInfo(UINT8 **p, INT32 playernum)
|
||||
void Got_DiscordInfo(const UINT8 **p, INT32 playernum)
|
||||
{
|
||||
if (playernum != serverplayer /*&& !IsPlayerAdmin(playernum)*/)
|
||||
{
|
||||
|
||||
+6
-6
@@ -110,14 +110,14 @@ static fileused_t transferFiles[UINT8_MAX + 1];
|
||||
// Write time of file: utime
|
||||
|
||||
// Receiver structure
|
||||
INT32 fileneedednum; // Number of files needed to join the server
|
||||
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
|
||||
INT32 fileneedednum = 0; // Number of files needed to join the server
|
||||
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
|
||||
#ifdef HAVE_THREADS
|
||||
static I_mutex downloadmutex;
|
||||
#endif
|
||||
char downloaddir[512] = "DOWNLOAD";
|
||||
|
||||
file_download_t filedownload;
|
||||
file_download_t filedownload = {};
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
static CURL *http_handle;
|
||||
@@ -131,7 +131,7 @@ static UINT32 curl_origfilesize;
|
||||
static UINT32 curl_origtotalfilesize;
|
||||
static char *curl_realname = NULL;
|
||||
fileneeded_t *curl_curfile = NULL;
|
||||
HTTP_login *curl_logins;
|
||||
HTTP_login *curl_logins = NULL;
|
||||
#endif
|
||||
|
||||
/** Fills a serverinfo packet with information about wad files loaded.
|
||||
@@ -902,7 +902,7 @@ void SV_FileSendTicker(void)
|
||||
|
||||
if (ram)
|
||||
{
|
||||
M_Memcpy(p->data, &f->id.ram[transfer[i].position], size);
|
||||
memcpy(p->data, &f->id.ram[transfer[i].position], size);
|
||||
}
|
||||
else if (fread(p->data, 1, size, transferFiles[f->fileid].file) != size)
|
||||
{
|
||||
@@ -1104,7 +1104,7 @@ void nameonly(char *s)
|
||||
ns = &(s[j+1]);
|
||||
len = strlen(ns);
|
||||
#if 0
|
||||
M_Memcpy(s, ns, len+1);
|
||||
memcpy(s, ns, len+1);
|
||||
#else
|
||||
memmove(s, ns, len+1);
|
||||
#endif
|
||||
|
||||
+24
-18
@@ -808,20 +808,23 @@ static void I_SetupMumble(void)
|
||||
void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
|
||||
{
|
||||
#ifdef HAVE_MUMBLE
|
||||
double angle;
|
||||
float angle;
|
||||
fixed_t anglef;
|
||||
|
||||
if (!mumble)
|
||||
return;
|
||||
|
||||
if (mumble->uiVersion != 2) {
|
||||
wcsncpy(mumble->name, L"SRB2Kart "VERSIONSTRINGW, 256);
|
||||
if (mumble->uiVersion != 2)
|
||||
{
|
||||
wcsncpy(mumble->name, L"SRB2Kart " VERSIONSTRINGW, 256);
|
||||
wcsncpy(mumble->description, L"Sonic Robo Blast 2 Kart with integrated Mumble Link support.", 2048);
|
||||
mumble->uiVersion = 2;
|
||||
}
|
||||
mumble->uiTick++;
|
||||
|
||||
if (!netgame || gamestate != GS_LEVEL) { // Zero out, but never delink.
|
||||
// Zero out, but never delink.
|
||||
if (!netgame || gamestate != GS_LEVEL)
|
||||
{
|
||||
mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
|
||||
mumble->fAvatarFront[0] = 1.0f;
|
||||
mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
|
||||
@@ -838,31 +841,34 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
|
||||
mumble->context_len = (UINT32)(p - mumble->context);
|
||||
}
|
||||
|
||||
if (mobj) {
|
||||
mumble->fAvatarPosition[0] = FIXED_TO_FLOAT(mobj->x) / MUMBLEUNIT;
|
||||
mumble->fAvatarPosition[1] = FIXED_TO_FLOAT(mobj->z) / MUMBLEUNIT;
|
||||
mumble->fAvatarPosition[2] = FIXED_TO_FLOAT(mobj->y) / MUMBLEUNIT;
|
||||
if (mobj)
|
||||
{
|
||||
mumble->fAvatarPosition[0] = FixedToFloat(mobj->x) / MUMBLEUNIT;
|
||||
mumble->fAvatarPosition[1] = FixedToFloat(mobj->z) / MUMBLEUNIT;
|
||||
mumble->fAvatarPosition[2] = FixedToFloat(mobj->y) / MUMBLEUNIT;
|
||||
|
||||
anglef = AngleFixed(mobj->angle);
|
||||
angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
|
||||
mumble->fAvatarFront[0] = (float)cos(angle);
|
||||
angle = (float)(FixedToFloat(anglef) * DEG2RAD);
|
||||
mumble->fAvatarFront[0] = cosf(angle);
|
||||
mumble->fAvatarFront[1] = 0.0f;
|
||||
mumble->fAvatarFront[2] = (float)sin(angle);
|
||||
} else {
|
||||
mumble->fAvatarFront[2] = sinf(angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
|
||||
mumble->fAvatarFront[0] = 1.0f;
|
||||
mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
|
||||
}
|
||||
|
||||
mumble->fCameraPosition[0] = FIXED_TO_FLOAT(listener.x) / MUMBLEUNIT;
|
||||
mumble->fCameraPosition[1] = FIXED_TO_FLOAT(listener.z) / MUMBLEUNIT;
|
||||
mumble->fCameraPosition[2] = FIXED_TO_FLOAT(listener.y) / MUMBLEUNIT;
|
||||
mumble->fCameraPosition[0] = FixedToFloat(listener.x) / MUMBLEUNIT;
|
||||
mumble->fCameraPosition[1] = FixedToFloat(listener.z) / MUMBLEUNIT;
|
||||
mumble->fCameraPosition[2] = FixedToFloat(listener.y) / MUMBLEUNIT;
|
||||
|
||||
anglef = AngleFixed(listener.angle);
|
||||
angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
|
||||
mumble->fCameraFront[0] = (float)cos(angle);
|
||||
angle = (float)(FixedToFloat(anglef) * DEG2RAD);
|
||||
mumble->fCameraFront[0] = cosf(angle);
|
||||
mumble->fCameraFront[1] = 0.0f;
|
||||
mumble->fCameraFront[2] = (float)sin(angle);
|
||||
mumble->fCameraFront[2] = sinf(angle);
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)listener;
|
||||
|
||||
@@ -155,7 +155,10 @@ boolean I_UseNativeKeyboard(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_HandleControllerHatRepeat(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_SetBorderlessWindow(void)
|
||||
{
|
||||
|
||||
}
|
||||
+3
-3
@@ -47,9 +47,9 @@
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
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.
|
||||
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);\
|
||||
|
||||
+8
-20
@@ -19,25 +19,18 @@
|
||||
// This should actually be in the makefile,
|
||||
// but I can't stand that gibberish. D:
|
||||
#define SOUND_DUMMY 0
|
||||
#define SOUND_SDL 1
|
||||
#define SOUND_MIXER 2
|
||||
#define SOUND_MIXER 1
|
||||
|
||||
#ifndef SOUND
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
// Use Mixer interface?
|
||||
#ifdef HAVE_MIXER
|
||||
#define SOUND SOUND_MIXER
|
||||
#else
|
||||
#define SOUND SOUND_DUMMY
|
||||
#endif
|
||||
|
||||
// Use generic SDL interface.
|
||||
#ifndef SOUND
|
||||
#define SOUND SOUND_SDL
|
||||
#endif
|
||||
|
||||
#else // No SDL.
|
||||
// No more interfaces. :(
|
||||
#define SOUND SOUND_DUMMY
|
||||
#else
|
||||
#define SOUND SOUND_DUMMY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -114,10 +107,10 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v9"
|
||||
#define VERSIONSTRINGW L"Saturn v9"
|
||||
#define VERSIONSTRING "Saturn v9.1"
|
||||
#define VERSIONSTRINGW L"Saturn v9.1"
|
||||
|
||||
#define SATURN_TESTING // comment out for saturn release builds!
|
||||
//#define SATURN_TESTING // comment out for saturn release builds!
|
||||
|
||||
// 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!
|
||||
@@ -453,11 +446,6 @@ extern char savegamename[256];
|
||||
//TODO: delet this
|
||||
#define M_GetText(x) (x)
|
||||
|
||||
FUNCINLINE static ATTRINLINE void *M_Memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
char *va(const char *format, ...) FUNCPRINTF;
|
||||
char *M_GetToken(const char *inputString);
|
||||
char *sizeu1(size_t num);
|
||||
|
||||
+1
-1
@@ -293,7 +293,7 @@ typedef struct
|
||||
UINT8 green;
|
||||
UINT8 blue;
|
||||
UINT8 alpha;
|
||||
} byteColor_t;
|
||||
} ATTRPACK byteColor_t;
|
||||
|
||||
union FColorRGBA
|
||||
{
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ static void F_SkyScroll(INT32 scrollspeed)
|
||||
INT32 intro_scenenum = 0;
|
||||
INT32 intro_curtime = 0;
|
||||
|
||||
const char *introtext[NUMINTROSCENES];
|
||||
const char *introtext[NUMINTROSCENES] = {};
|
||||
|
||||
static tic_t introscenetime[NUMINTROSCENES] =
|
||||
{
|
||||
|
||||
+8
-4
@@ -98,7 +98,8 @@ static fixed_t paldiv;
|
||||
* \param lump Lump name to get data from
|
||||
* \return fademask_t for lump
|
||||
*/
|
||||
static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
|
||||
static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum)
|
||||
{
|
||||
static char lumpname[9] = "FADEmmss";
|
||||
static fademask_t fm = {NULL,0,0,0,0,0};
|
||||
lumpnum_t lumpnum;
|
||||
@@ -148,6 +149,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
|
||||
case 0: // end marker (not bad!, but still need clearing)
|
||||
goto freemask;
|
||||
}
|
||||
|
||||
if (lsize != fm.size)
|
||||
fm.mask = Z_Realloc(fm.mask, lsize, PU_STATIC, NULL);
|
||||
fm.size = lsize;
|
||||
@@ -257,7 +259,7 @@ static void F_DoWipe(fademask_t *fademask)
|
||||
// shortcut - memcpy source to work
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
|
||||
memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
|
||||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +268,7 @@ static void F_DoWipe(fademask_t *fademask)
|
||||
// shortcut - memcpy target to work
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
|
||||
memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
|
||||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
@@ -361,6 +363,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||
{
|
||||
// get fademask first so we can tell if it exists or not
|
||||
fmask = F_GetFadeMask(wipetype, wipeframe++);
|
||||
|
||||
if (!fmask)
|
||||
break;
|
||||
|
||||
@@ -377,7 +380,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||
HWR_DoWipe(wipetype, wipeframe-1); // send in the wipe type and wipeframe because we need to cache the graphic
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none) //this allows F_RunWipe to be called in dedicated servers
|
||||
if (rendermode != render_none) // this allows F_RunWipe to be called in dedicated servers
|
||||
F_DoWipe(fmask);
|
||||
|
||||
I_OsPolling();
|
||||
@@ -401,6 +404,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||
|
||||
NetKeepAlive(); // Update the network so we don't cause timeouts
|
||||
}
|
||||
|
||||
WipeInAction = false;
|
||||
#endif
|
||||
}
|
||||
+5
-6
@@ -44,16 +44,16 @@ consvar_t cv_addons_search_case = {"addons_search_case", "No", CV_SAVE, CV_YesNo
|
||||
static CV_PossibleValue_t addons_search_type_cons_t[] = {{0, "Start"}, {1, "Anywhere"}, {0, NULL}};
|
||||
consvar_t cv_addons_search_type = {"addons_search_type", "Anywhere", CV_SAVE, addons_search_type_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
char menupath[MAXFILEPATH];
|
||||
size_t menupathindex[menudepth];
|
||||
char menupath[MAXFILEPATH] = {};
|
||||
size_t menupathindex[menudepth] = {};
|
||||
size_t menudepthleft = menudepth;
|
||||
|
||||
char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
textinput_t menusearch;
|
||||
|
||||
char **dirmenu, **coredirmenu; // core only local for this file
|
||||
size_t sizedirmenu, sizecoredirmenu; // ditto
|
||||
size_t dir_on[menudepth];
|
||||
char **dirmenu = NULL, **coredirmenu = NULL; // core only local for this file
|
||||
size_t sizedirmenu = 0, sizecoredirmenu = 0; // ditto
|
||||
size_t dir_on[menudepth] = {};
|
||||
UINT8 refreshdirmenu = 0;
|
||||
char *refreshdirname = NULL;
|
||||
|
||||
@@ -92,7 +92,6 @@ INT32 pathisdirectory(const char *path)
|
||||
// skip those folders, they will not have any addons
|
||||
static const char *exclude_paths[] = {
|
||||
"logs",
|
||||
"luafiles",
|
||||
"replay",
|
||||
"mdls",
|
||||
"gifs",
|
||||
|
||||
+43
-43
@@ -68,8 +68,8 @@ UINT8 numDemos = 0; //3; -- i'm FED UP of losing my skincolour to a broken
|
||||
UINT32 demoDelayTime = 15*TICRATE;
|
||||
UINT32 demoIdleTime = 3*TICRATE;
|
||||
|
||||
boolean nodrawers; // for comparative timing purposes
|
||||
boolean noblit; // for comparative timing purposes
|
||||
boolean nodrawers = false; // for comparative timing purposes
|
||||
boolean noblit = false; // for comparative timing purposes
|
||||
static tic_t demostarttime; // for comparative timing purposes
|
||||
|
||||
//@TODO put these all in a struct for namespacing purposes?
|
||||
@@ -80,7 +80,7 @@ static UINT8 *demoend;
|
||||
static UINT8 demoflags;
|
||||
static boolean demosynced = true; // console warning message
|
||||
|
||||
struct demovars_s demo;
|
||||
struct demovars_s demo = {};
|
||||
|
||||
consvar_t cv_resyncdemo = {"resyncdemo", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -257,7 +257,7 @@ void G_ReadDemoExtraData(void)
|
||||
UINT8 kartspeed, kartweight;
|
||||
|
||||
// Skin
|
||||
M_Memcpy(name, demobuf.p, 16);
|
||||
memcpy(name, demobuf.p, 16);
|
||||
demobuf.p += 16;
|
||||
SetPlayerSkin(p, name);
|
||||
|
||||
@@ -274,7 +274,7 @@ void G_ReadDemoExtraData(void)
|
||||
if (extradata & DXD_COLOR)
|
||||
{
|
||||
// Color
|
||||
M_Memcpy(name, demobuf.p, 16);
|
||||
memcpy(name, demobuf.p, 16);
|
||||
demobuf.p += 16;
|
||||
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||
if (fasticmp(KartColor_Names[i], name)) // SRB2kart
|
||||
@@ -289,7 +289,7 @@ void G_ReadDemoExtraData(void)
|
||||
if (extradata & DXD_NAME)
|
||||
{
|
||||
// Name
|
||||
M_Memcpy(player_names[p],demobuf.p,16);
|
||||
memcpy(player_names[p],demobuf.p,16);
|
||||
demobuf.p += 16;
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ void G_WriteDemoExtraData(void)
|
||||
// Skin
|
||||
memset(name, 0, 16);
|
||||
strncpy(name, skins[players[i].skin].name, 16);
|
||||
M_Memcpy(demobuf.p,name,16);
|
||||
memcpy(demobuf.p, name, 16);
|
||||
demobuf.p += 16;
|
||||
|
||||
WRITEUINT8(demobuf.p, skins[players[i].skin].kartspeed);
|
||||
@@ -407,7 +407,7 @@ void G_WriteDemoExtraData(void)
|
||||
// Color
|
||||
memset(name, 0, 16);
|
||||
strncpy(name, KartColor_Names[players[i].skincolor], 16);
|
||||
M_Memcpy(demobuf.p,name,16);
|
||||
memcpy(demobuf.p, name, 16);
|
||||
demobuf.p += 16;
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ void G_WriteDemoExtraData(void)
|
||||
// Name
|
||||
memset(name, 0, 16);
|
||||
memcpy(name, player_names[i], 15); // Keeping 1 null byte for safety, sorry players with name containing more than 15 characters
|
||||
M_Memcpy(demobuf.p,name,16);
|
||||
memcpy(demobuf.p, name, 16);
|
||||
demobuf.p += 16;
|
||||
}
|
||||
|
||||
@@ -1670,7 +1670,7 @@ void G_BeginRecording(void)
|
||||
demoflags |= DF_LUAVARS;
|
||||
|
||||
// Setup header.
|
||||
M_Memcpy(demobuf.p, DEMOHEADER, 12); demobuf.p += 12;
|
||||
memcpy(demobuf.p, DEMOHEADER, 12); demobuf.p += 12;
|
||||
WRITEUINT8(demobuf.p,VERSION);
|
||||
WRITEUINT8(demobuf.p,SUBVERSION);
|
||||
WRITEUINT16(demobuf.p,DEMOVERSION);
|
||||
@@ -1701,9 +1701,9 @@ void G_BeginRecording(void)
|
||||
demobuf.p += 16;
|
||||
|
||||
// game data
|
||||
M_Memcpy(demobuf.p, "PLAY", 4); demobuf.p += 4;
|
||||
memcpy(demobuf.p, "PLAY", 4); demobuf.p += 4;
|
||||
WRITEINT16(demobuf.p,gamemap);
|
||||
M_Memcpy(demobuf.p, mapmd5, 16); demobuf.p += 16;
|
||||
memcpy(demobuf.p, mapmd5, 16); demobuf.p += 16;
|
||||
|
||||
WRITEUINT8(demobuf.p, demoflags);
|
||||
WRITEUINT8(demobuf.p, gametype & 0xFF);
|
||||
@@ -1763,19 +1763,19 @@ void G_BeginRecording(void)
|
||||
// Name
|
||||
memset(name, 0, 16);
|
||||
memcpy(name, player_names[p], 15);
|
||||
M_Memcpy(demobuf.p,name,16);
|
||||
memcpy(demobuf.p, name, 16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Skin
|
||||
memset(name, 0, 16);
|
||||
strncpy(name, skins[player->skin].name, 16);
|
||||
M_Memcpy(demobuf.p,name,16);
|
||||
memcpy(demobuf.p, name, 16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Color
|
||||
memset(name, 0, 16);
|
||||
strncpy(name, KartColor_Names[player->skincolor], 16);
|
||||
M_Memcpy(demobuf.p,name,16);
|
||||
memcpy(demobuf.p, name, 16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Score, since Kart uses this to determine where you start on the map
|
||||
@@ -1834,19 +1834,19 @@ void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT
|
||||
// Name
|
||||
memset(temp, 0, 16);
|
||||
strncpy(temp, name, 16);
|
||||
M_Memcpy(demobuf.p,temp,16);
|
||||
memcpy(demobuf.p,temp,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Skin
|
||||
memset(temp, 0, 16);
|
||||
strncpy(temp, skins[skinnum].name, 16);
|
||||
M_Memcpy(demobuf.p,temp,16);
|
||||
memcpy(demobuf.p,temp,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Color
|
||||
memset(temp, 0, 16);
|
||||
strncpy(temp, KartColor_Names[color], 16);
|
||||
M_Memcpy(demobuf.p,temp,16);
|
||||
memcpy(demobuf.p,temp,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Score/time/whatever
|
||||
@@ -2212,7 +2212,7 @@ void G_LoadDemoInfo(menudemo_t *pdemo)
|
||||
{
|
||||
case DEMOVERSION: // latest always supported
|
||||
// demo title
|
||||
M_Memcpy(pdemo->title, info_p, 64);
|
||||
memcpy(pdemo->title, info_p, 64);
|
||||
info_p += 64;
|
||||
break;
|
||||
#ifdef DEMO_COMPAT_100
|
||||
@@ -2311,11 +2311,11 @@ void G_LoadDemoInfo(menudemo_t *pdemo)
|
||||
pdemo->standings[count].ranking = READUINT8(extrainfo_p);
|
||||
|
||||
// Name
|
||||
M_Memcpy(pdemo->standings[count].name, extrainfo_p, 16);
|
||||
memcpy(pdemo->standings[count].name, extrainfo_p, 16);
|
||||
extrainfo_p += 16;
|
||||
|
||||
// Skin
|
||||
M_Memcpy(temp,extrainfo_p,16);
|
||||
memcpy(temp,extrainfo_p,16);
|
||||
extrainfo_p += 16;
|
||||
pdemo->standings[count].skin = UINT8_MAX;
|
||||
|
||||
@@ -2329,7 +2329,7 @@ void G_LoadDemoInfo(menudemo_t *pdemo)
|
||||
}
|
||||
|
||||
// Color
|
||||
M_Memcpy(temp,extrainfo_p,16);
|
||||
memcpy(temp,extrainfo_p,16);
|
||||
extrainfo_p += 16;
|
||||
|
||||
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||
@@ -2494,7 +2494,7 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
{
|
||||
case DEMOVERSION: // latest always supported
|
||||
// demo title
|
||||
M_Memcpy(pdemo->title, info_p, 64);
|
||||
memcpy(pdemo->title, info_p, 64);
|
||||
|
||||
// demo date
|
||||
char *demodate;
|
||||
@@ -2627,7 +2627,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
case DEMOVERSION: // latest always supported
|
||||
// demo title
|
||||
M_Memcpy(demo.titlename, demobuf.p, 64);
|
||||
memcpy(demo.titlename, demobuf.p, 64);
|
||||
demobuf.p += 64;
|
||||
break;
|
||||
#ifdef DEMO_COMPAT_100
|
||||
@@ -2766,15 +2766,15 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
if (demo.version == 0x0001)
|
||||
{
|
||||
// Player name
|
||||
M_Memcpy(player_names[0],demobuf.p,16);
|
||||
memcpy(player_names[0],demobuf.p,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Skin
|
||||
M_Memcpy(skin,demobuf.p,16);
|
||||
memcpy(skin,demobuf.p,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Color
|
||||
M_Memcpy(color,demobuf.p,16);
|
||||
memcpy(color,demobuf.p,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
demobuf.p += 5; // Backwards compat - some stats
|
||||
@@ -2815,7 +2815,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
}
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demobuf.p);
|
||||
demobuf.p += CV_LoadNetVars(demobuf.p);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demobuf.p == DEMOMARKER)
|
||||
@@ -2853,7 +2853,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
#endif
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demobuf.p);
|
||||
demobuf.p += CV_LoadNetVars(demobuf.p);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demobuf.p == DEMOMARKER)
|
||||
@@ -2933,16 +2933,16 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
players[p].spectator = spectator;
|
||||
|
||||
// Name
|
||||
M_Memcpy(player_names[p],demobuf.p,16);
|
||||
memcpy(player_names[p],demobuf.p,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
// Skin
|
||||
M_Memcpy(skin,demobuf.p,16);
|
||||
memcpy(skin,demobuf.p,16);
|
||||
demobuf.p += 16;
|
||||
SetPlayerSkin(p, skin);
|
||||
|
||||
// Color
|
||||
M_Memcpy(color,demobuf.p,16);
|
||||
memcpy(color,demobuf.p,16);
|
||||
demobuf.p += 16;
|
||||
|
||||
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||
@@ -3101,7 +3101,7 @@ void G_AddGhost(char *defdemoname)
|
||||
return;
|
||||
}
|
||||
|
||||
M_Memcpy(md5, p, 16); p += 16; // demo checksum
|
||||
memcpy(md5, p, 16); p += 16; // demo checksum
|
||||
|
||||
for (gh = ghosts; gh; gh = gh->next)
|
||||
{
|
||||
@@ -3157,15 +3157,15 @@ void G_AddGhost(char *defdemoname)
|
||||
if (ghostversion == 0x0001)
|
||||
{
|
||||
// Player name (TODO: Display this somehow if it doesn't match cv_playername!)
|
||||
M_Memcpy(name, p,16);
|
||||
memcpy(name, p,16);
|
||||
p += 16;
|
||||
|
||||
// Skin
|
||||
M_Memcpy(skin, p,16);
|
||||
memcpy(skin, p,16);
|
||||
p += 16;
|
||||
|
||||
// Color
|
||||
M_Memcpy(color, p,16);
|
||||
memcpy(color, p,16);
|
||||
p += 16;
|
||||
|
||||
// Ghosts do not have a player structure to put this in.
|
||||
@@ -3215,15 +3215,15 @@ void G_AddGhost(char *defdemoname)
|
||||
}
|
||||
|
||||
// Player name (TODO: Display this somehow if it doesn't match cv_playername!)
|
||||
M_Memcpy(name, p, 16);
|
||||
memcpy(name, p, 16);
|
||||
p += 16;
|
||||
|
||||
// Skin
|
||||
M_Memcpy(skin, p, 16);
|
||||
memcpy(skin, p, 16);
|
||||
p += 16;
|
||||
|
||||
// Color
|
||||
M_Memcpy(color, p, 16);
|
||||
memcpy(color, p, 16);
|
||||
p += 16;
|
||||
|
||||
p += 4; // score
|
||||
@@ -3260,7 +3260,7 @@ void G_AddGhost(char *defdemoname)
|
||||
gh = Z_Calloc(sizeof(demoghost), PU_LEVEL, NULL);
|
||||
gh->next = ghosts;
|
||||
gh->buffer = buffer;
|
||||
M_Memcpy(gh->checksum, md5, 16);
|
||||
memcpy(gh->checksum, md5, 16);
|
||||
gh->p = p;
|
||||
buffer = NULL; // buffer can't be freed now!
|
||||
|
||||
@@ -3409,7 +3409,7 @@ void G_UpdateStaffGhostName(lumpnum_t l)
|
||||
if (ghostversion == 0x0001)
|
||||
{
|
||||
// Player name
|
||||
M_Memcpy(dummystaffname, p,16);
|
||||
memcpy(dummystaffname, p,16);
|
||||
dummystaffname[16] = '\0';
|
||||
return; // Not really a failure but whatever
|
||||
}
|
||||
@@ -3431,7 +3431,7 @@ void G_UpdateStaffGhostName(lumpnum_t l)
|
||||
if (READUINT8(p) != 0)
|
||||
return;
|
||||
|
||||
M_Memcpy(dummystaffname, p, 16);
|
||||
memcpy(dummystaffname, p, 16);
|
||||
dummystaffname[16] = '\0';
|
||||
|
||||
// Ok, no longer any reason to care, bye
|
||||
@@ -3625,7 +3625,7 @@ void G_SaveDemo(void)
|
||||
}
|
||||
WRITEUINT8(demobuf.p, DW_END); // Mark end of demo extra data.
|
||||
|
||||
M_Memcpy(p, demo.titlename, 64); // Write demo title here
|
||||
memcpy(p, demo.titlename, 64); // Write demo title here
|
||||
p += 64;
|
||||
|
||||
if (multiplayer)
|
||||
|
||||
+175
-167
@@ -59,15 +59,15 @@
|
||||
#include "discord.h"
|
||||
#endif
|
||||
|
||||
gameaction_t gameaction;
|
||||
gameaction_t gameaction = 0;
|
||||
gamestate_t gamestate = GS_NULL;
|
||||
UINT8 ultimatemode = false;
|
||||
|
||||
boolean botingame;
|
||||
UINT8 botskin;
|
||||
UINT8 botcolor;
|
||||
boolean botingame = false;
|
||||
UINT8 botskin = 0;
|
||||
UINT8 botcolor = 0;
|
||||
|
||||
JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
|
||||
JoyType_t Joystick[MAXSPLITSCREENPLAYERS] = {};
|
||||
|
||||
// 1024 bytes is plenty for a savegame
|
||||
#define SAVEGAMESIZE (1024)
|
||||
@@ -83,10 +83,10 @@ static void G_DoContinued(void);
|
||||
static void G_DoWorldDone(void);
|
||||
static void G_DoStartVote(void);
|
||||
|
||||
music_t mapmusic;
|
||||
music_t mapmusic = {};
|
||||
|
||||
INT16 gamemap = 1;
|
||||
INT16 maptol;
|
||||
INT16 maptol = 0;
|
||||
UINT8 globalweather = 0;
|
||||
INT32 curWeather = PRECIP_NONE;
|
||||
INT32 cursaveslot = -1; // Auto-save 1p savegame slot
|
||||
@@ -97,29 +97,29 @@ UINT16 mainwads = 0;
|
||||
boolean modifiedgame = false; // Set if homebrew PWAD stuff has been added.
|
||||
boolean majormods = false; // Set if Lua/Gameplay SOC/replacement map has been added.
|
||||
boolean savemoddata = false;
|
||||
UINT8 paused;
|
||||
UINT8 paused = 0;
|
||||
UINT8 modeattacking = ATTACKING_NONE;
|
||||
boolean imcontinuing = false;
|
||||
boolean runemeraldmanager = false;
|
||||
|
||||
boolean netgame; // only true if packets are broadcast
|
||||
boolean multiplayer;
|
||||
boolean playeringame[MAXPLAYERS];
|
||||
boolean addedtogame;
|
||||
player_t players[MAXPLAYERS];
|
||||
boolean netgame = false; // only true if packets are broadcast
|
||||
boolean multiplayer = false;
|
||||
boolean playeringame[MAXPLAYERS] = {};
|
||||
boolean addedtogame = false;
|
||||
player_t players[MAXPLAYERS] = {};
|
||||
|
||||
INT32 consoleplayer; // player taking events and displaying
|
||||
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {0}; // view being displayed
|
||||
INT32 consoleplayer = 0; // player taking events and displaying
|
||||
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {}; // view being displayed
|
||||
|
||||
tic_t gametic;
|
||||
tic_t levelstarttic; // gametic at level start
|
||||
UINT32 totalrings; // for intermission
|
||||
INT16 lastmap; // last level you were at (returning from special stages)
|
||||
tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
|
||||
tic_t gametic = 0;
|
||||
tic_t levelstarttic = 0; // gametic at level start
|
||||
UINT32 totalrings = 0; // for intermission
|
||||
INT16 lastmap = 0; // last level you were at (returning from special stages)
|
||||
tic_t timeinmap = 0; // Ticker for time spent in level (used for levelcard display)
|
||||
|
||||
INT16 spstage_start;
|
||||
INT16 sstage_start;
|
||||
INT16 sstage_end;
|
||||
INT16 spstage_start = 0;
|
||||
INT16 sstage_start = 0;
|
||||
INT16 sstage_end = 0;
|
||||
|
||||
boolean looptitle = true;
|
||||
boolean useNightsSS = false;
|
||||
@@ -134,42 +134,42 @@ boolean countdowntimeup = false;
|
||||
|
||||
cutscene_t *cutscenes[128];
|
||||
|
||||
INT16 nextmapoverride;
|
||||
boolean skipstats;
|
||||
INT16 nextmapoverride = 0;
|
||||
boolean skipstats = false;
|
||||
|
||||
// Pointers to each CTF flag
|
||||
mobj_t *redflag;
|
||||
mobj_t *blueflag;
|
||||
mobj_t *redflag = NULL;
|
||||
mobj_t *blueflag = NULL;
|
||||
// Pointers to CTF spawn location
|
||||
mapthing_t *rflagpoint;
|
||||
mapthing_t *bflagpoint;
|
||||
mapthing_t *rflagpoint = NULL;
|
||||
mapthing_t *bflagpoint = NULL;
|
||||
|
||||
struct quake quake;
|
||||
|
||||
// Map Header Information
|
||||
mapheader_t* mapheaderinfo[NUMMAPS] = {NULL};
|
||||
mapheader_t* mapheaderinfo[NUMMAPS] = {};
|
||||
|
||||
static boolean exitgame = false;
|
||||
static boolean retrying = false;
|
||||
|
||||
UINT8 stagefailed; // Used for GEMS BONUS? Also to see if you beat the stage.
|
||||
UINT8 stagefailed = 0; // Used for GEMS BONUS? Also to see if you beat the stage.
|
||||
|
||||
UINT16 emeralds;
|
||||
UINT32 token; // Number of tokens collected in a level
|
||||
UINT32 tokenlist; // List of tokens collected
|
||||
INT32 tokenbits; // Used for setting token bits
|
||||
UINT16 emeralds = 0;
|
||||
UINT32 token = 0; // Number of tokens collected in a level
|
||||
UINT32 tokenlist = 0; // List of tokens collected
|
||||
INT32 tokenbits = 0; // Used for setting token bits
|
||||
|
||||
// Old Special Stage
|
||||
INT32 sstimer; // Time allotted in the special stage
|
||||
INT32 sstimer = 0; // Time allotted in the special stage
|
||||
|
||||
boolean gamedataloaded = false;
|
||||
|
||||
// Time attack data for levels
|
||||
// These are dynamically allocated for space reasons now
|
||||
recorddata_t *mainrecords[NUMMAPS] = {NULL};
|
||||
UINT8 mapvisited[NUMMAPS];
|
||||
recorddata_t *mainrecords[NUMMAPS] = {};
|
||||
UINT8 mapvisited[NUMMAPS] = {};
|
||||
|
||||
UINT32 bluescore, redscore; // CTF and Team Match team scores
|
||||
UINT32 bluescore = 0, redscore = 0; // CTF and Team Match team scores
|
||||
|
||||
// ring count... for PERFECT!
|
||||
INT32 nummaprings = 0;
|
||||
@@ -179,12 +179,12 @@ INT32 nummapboxes = 0;
|
||||
INT32 numgotboxes = 0;
|
||||
|
||||
// Elminates unnecessary searching.
|
||||
boolean CheckForBustableBlocks;
|
||||
boolean CheckForBouncySector;
|
||||
boolean CheckForQuicksand;
|
||||
boolean CheckForMarioBlocks;
|
||||
boolean CheckForFloatBob;
|
||||
boolean CheckForReverseGravity;
|
||||
boolean CheckForBustableBlocks = false;
|
||||
boolean CheckForBouncySector = false;
|
||||
boolean CheckForQuicksand = false;
|
||||
boolean CheckForMarioBlocks = false;
|
||||
boolean CheckForFloatBob = false;
|
||||
boolean CheckForReverseGravity = false;
|
||||
|
||||
// Powerup durations
|
||||
UINT16 invulntics = 20*TICRATE;
|
||||
@@ -215,67 +215,66 @@ INT32 gameovertics = 15*TICRATE;
|
||||
UINT8 use1upSound = 0;
|
||||
UINT8 maxXtraLife = 2; // Max extra lives from rings
|
||||
|
||||
UINT8 introtoplay;
|
||||
UINT8 creditscutscene;
|
||||
UINT8 introtoplay = 0;
|
||||
UINT8 creditscutscene = 0;
|
||||
|
||||
// Emerald locations
|
||||
mobj_t *hunt1;
|
||||
mobj_t *hunt2;
|
||||
mobj_t *hunt3;
|
||||
mobj_t *hunt1 = NULL;
|
||||
mobj_t *hunt2 = NULL;
|
||||
mobj_t *hunt3 = NULL;
|
||||
|
||||
tic_t racecountdown, exitcountdown; // for racing
|
||||
tic_t racecountdown = 0, exitcountdown = 0; // for racing
|
||||
|
||||
fixed_t gravity;
|
||||
fixed_t mapobjectscale;
|
||||
fixed_t gravity = 0;
|
||||
fixed_t mapobjectscale = FRACUNIT;
|
||||
|
||||
struct maplighting maplighting;
|
||||
|
||||
INT16 autobalance; //for CTF team balance
|
||||
INT16 teamscramble; //for CTF team scramble
|
||||
INT16 scrambleplayers[MAXPLAYERS]; //for CTF team scramble
|
||||
INT16 scrambleteams[MAXPLAYERS]; //for CTF team scramble
|
||||
INT16 scrambletotal; //for CTF team scramble
|
||||
INT16 scramblecount; //for CTF team scramble
|
||||
INT16 autobalance = 0; //for CTF team balance
|
||||
INT16 teamscramble = 0; //for CTF team scramble
|
||||
INT16 scrambleplayers[MAXPLAYERS] = {}; //for CTF team scramble
|
||||
INT16 scrambleteams[MAXPLAYERS] = {}; //for CTF team scramble
|
||||
INT16 scrambletotal = 0; //for CTF team scramble
|
||||
INT16 scramblecount = 0; //for CTF team scramble
|
||||
|
||||
INT32 cheats; //for multiplayer cheat commands
|
||||
INT32 cheats = 0; //for multiplayer cheat commands
|
||||
|
||||
// SRB2Kart
|
||||
// Cvars that we don't want changed mid-game
|
||||
UINT8 gamespeed; // Game's current speed (or difficulty, or cc, or etc); 0 for easy, 1 for normal, 2 for hard
|
||||
UINT8 gamespeed = 0; // Game's current speed (or difficulty, or cc, or etc); 0 for easy, 1 for normal, 2 for hard
|
||||
boolean encoremode = false; // Encore Mode currently enabled?
|
||||
boolean prevencoremode;
|
||||
boolean franticitems; // Frantic items currently enabled?
|
||||
boolean comeback; // Battle Mode's karma comeback is on/off
|
||||
boolean prevencoremode = 0;
|
||||
boolean franticitems = 0; // Frantic items currently enabled?
|
||||
boolean comeback = 0; // Battle Mode's karma comeback is on/off
|
||||
|
||||
// Voting system
|
||||
INT16 votelevels[4][2]; // Levels that were rolled by the host
|
||||
SINT8 votes[MAXPLAYERS]; // Each player's vote
|
||||
SINT8 pickedvote; // What vote the host rolls
|
||||
INT16 votelevels[4][2] = {}; // Levels that were rolled by the host
|
||||
SINT8 votes[MAXPLAYERS] = {}; // Each player's vote
|
||||
SINT8 pickedvote = 0; // What vote the host rolls
|
||||
|
||||
// Server-sided, synched variables
|
||||
SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points
|
||||
tic_t wantedcalcdelay; // Time before it recalculates WANTED
|
||||
tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded
|
||||
tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled
|
||||
tic_t mapreset; // Map reset delay when enough players have joined an empty game
|
||||
UINT8 nospectategrief; // How many players need to be in-game to eliminate last; for preventing spectate griefing
|
||||
boolean thwompsactive; // Thwomps activate on lap 2
|
||||
SINT8 spbplace; // SPB exists, give the person behind better items
|
||||
boolean startedInFreePlay; // Map was started in free play
|
||||
SINT8 battlewanted[4] = {}; // WANTED players in battle, worth x2 points
|
||||
tic_t wantedcalcdelay = 0; // Time before it recalculates WANTED
|
||||
tic_t indirectitemcooldown = 0; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded
|
||||
tic_t hyubgone = 0; // Cooldown before hyudoro is allowed to be rerolled
|
||||
tic_t mapreset = 0; // Map reset delay when enough players have joined an empty game
|
||||
UINT8 nospectategrief = 0; // How many players need to be in-game to eliminate last; for preventing spectate griefing
|
||||
boolean thwompsactive = 0; // Thwomps activate on lap 2
|
||||
SINT8 spbplace = 0; // SPB exists, give the person behind better items
|
||||
boolean startedInFreePlay = false; // Map was started in free play
|
||||
|
||||
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
|
||||
boolean legitimateexit; // Did this client actually finish the match?
|
||||
boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message?
|
||||
static INT16 randmapbuffer[NUMMAPS+1]; // Buffer for maps RandMap is allowed to roll
|
||||
boolean legitimateexit = 0; // Did this client actually finish the match?
|
||||
boolean comebackshowninfo = 0; // Have you already seen the "ATTACK OR PROTECT" message?
|
||||
static INT16 randmapbuffer[NUMMAPS+1] = {}; // Buffer for maps RandMap is allowed to roll
|
||||
|
||||
tic_t hidetime;
|
||||
tic_t hidetime = 0;
|
||||
|
||||
// Grading
|
||||
UINT32 timesBeaten;
|
||||
UINT32 timesBeatenWithEmeralds;
|
||||
//UINT32 timesBeatenUltimate;
|
||||
UINT32 timesBeaten = 0;
|
||||
UINT32 timesBeatenWithEmeralds = 0;
|
||||
|
||||
INT16 prevmap, nextmap;
|
||||
INT16 prevmap = 0, nextmap = 0;
|
||||
|
||||
// Analog Control
|
||||
void SendWeaponPref(void);
|
||||
@@ -470,7 +469,7 @@ consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, cechotoggle_t, NULL, 0,
|
||||
#endif
|
||||
|
||||
#ifdef SEENAMES
|
||||
player_t *seenplayer; // player we're aiming at right now
|
||||
player_t *seenplayer = NULL; // player we're aiming at right now
|
||||
#endif
|
||||
|
||||
char player_names[MAXPLAYERS][MAXPLAYERNAME+1] =
|
||||
@@ -493,7 +492,7 @@ char player_names[MAXPLAYERS][MAXPLAYERNAME+1] =
|
||||
"Player 16"
|
||||
}; // SRB2kart - removed Players 17 through 32
|
||||
|
||||
INT32 player_name_changes[MAXPLAYERS];
|
||||
INT32 player_name_changes[MAXPLAYERS] = {};
|
||||
|
||||
INT16 rw_maximums[NUM_WEAPONS] =
|
||||
{
|
||||
@@ -570,6 +569,7 @@ static void G_SetSaveGameModified(void)
|
||||
{
|
||||
if (!unlockables[i].conditionset)
|
||||
continue;
|
||||
|
||||
if (!unlockables[i].unlocked)
|
||||
{
|
||||
unlockables[i].unlocked = true;
|
||||
@@ -595,7 +595,7 @@ void G_SetGameModified(boolean silent, boolean major)
|
||||
G_SetSaveGameModified();
|
||||
|
||||
if (!silent)
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Record Attack data will be saved to a seperate save file.\n"));
|
||||
CONS_Alert(CONS_NOTICE, "Record Attack data will be saved to a seperate save file.\n");
|
||||
|
||||
// If in record attack recording, cancel it.
|
||||
if (modeattacking)
|
||||
@@ -634,6 +634,7 @@ const char *G_BuildMapName(INT32 map)
|
||||
map = gamemap-1;
|
||||
else
|
||||
map = prevmap;
|
||||
|
||||
map = G_RandMap(G_TOLFlag(cv_newgametype.value), map, false, 0, false, NULL)+1;
|
||||
}
|
||||
|
||||
@@ -687,11 +688,12 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
{
|
||||
INT32 retaxis;
|
||||
INT32 axisval;
|
||||
INT32 deadzone;
|
||||
boolean flp = false;
|
||||
|
||||
UINT8 pnum = player-1;
|
||||
|
||||
//find what axis to get
|
||||
// find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
@@ -750,45 +752,33 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
{
|
||||
axisval /= 2;
|
||||
retaxis = joyxmove[pnum][axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[pnum].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (flp)
|
||||
retaxis = -retaxis; // flip it around
|
||||
|
||||
return retaxis;
|
||||
deadzone = cv_xdeadzone[pnum].value;
|
||||
}
|
||||
else
|
||||
{
|
||||
axisval--;
|
||||
axisval /= 2;
|
||||
retaxis = joyymove[pnum][axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[pnum].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (flp)
|
||||
retaxis = -retaxis; // flip it around
|
||||
|
||||
return retaxis;
|
||||
deadzone = cv_ydeadzone[pnum].value;
|
||||
}
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
|
||||
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * deadzone) >> FRACBITS;
|
||||
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (flp)
|
||||
retaxis = -retaxis; // flip it around
|
||||
|
||||
return retaxis;
|
||||
}
|
||||
|
||||
boolean InputDown(INT32 gc, UINT8 p)
|
||||
@@ -806,9 +796,9 @@ boolean InputDown(INT32 gc, UINT8 p)
|
||||
}
|
||||
}
|
||||
|
||||
INT32 localaiming[MAXSPLITSCREENPLAYERS];
|
||||
angle_t localangle[MAXSPLITSCREENPLAYERS];
|
||||
boolean camspin[MAXSPLITSCREENPLAYERS];
|
||||
INT32 localaiming[MAXSPLITSCREENPLAYERS] = {};
|
||||
angle_t localangle[MAXSPLITSCREENPLAYERS] = {};
|
||||
boolean camspin[MAXSPLITSCREENPLAYERS] = {};
|
||||
|
||||
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
|
||||
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
|
||||
@@ -1210,7 +1200,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
if (gamestate == GS_LEVEL)
|
||||
LUA_HookTiccmd(player, cmd, HOOK(PlayerCmd));
|
||||
|
||||
//Reset away view if a command is given.
|
||||
// Reset away view if a command is given.
|
||||
if (displayplayers[0] != consoleplayer && ssplayer == 1
|
||||
&& (cmd->forwardmove || cmd->sidemove || cmd->buttons))
|
||||
{
|
||||
@@ -1219,12 +1209,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
}
|
||||
}
|
||||
|
||||
ticcmd_t *G_CopyTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
|
||||
ticcmd_t *G_CopyTiccmd(ticcmd_t* restrict dest, const ticcmd_t* restrict src, const size_t n)
|
||||
{
|
||||
return M_Memcpy(dest, src, n*sizeof(*src));
|
||||
return memcpy(dest, src, n*sizeof(*src));
|
||||
}
|
||||
|
||||
ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
|
||||
ticcmd_t *G_MoveTiccmd(ticcmd_t* restrict dest, const ticcmd_t* restrict src, const size_t n)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < n; i++)
|
||||
@@ -1261,7 +1251,7 @@ static void G_DoLoadLevel(boolean resetplayer)
|
||||
|
||||
if (gamestate == GS_INTERMISSION)
|
||||
Y_EndIntermission();
|
||||
if (gamestate == GS_VOTING)
|
||||
else if (gamestate == GS_VOTING)
|
||||
Y_EndVote();
|
||||
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
@@ -2298,7 +2288,7 @@ void G_PlayerReborn(INT32 player)
|
||||
}
|
||||
|
||||
/* I'm putting this here because lol */
|
||||
fade = (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(p));
|
||||
fade = (cv_fading.value && P_IsLocalPlayer(p));
|
||||
|
||||
if (fade)
|
||||
{
|
||||
@@ -2329,12 +2319,6 @@ void G_PlayerReborn(INT32 player)
|
||||
|
||||
if (gametype == GT_COOP)
|
||||
P_FindEmerald(); // scan for emeralds to hunt for
|
||||
|
||||
// Reset Nights score and max link to 0 on death
|
||||
p->maxlink = 0;
|
||||
|
||||
// If NiGHTS, find lowest mare to start with.
|
||||
p->mare = 0;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2353,22 +2337,25 @@ static boolean G_CheckSpot(INT32 playernum, mapthing_t *mthing)
|
||||
if (!mthing)
|
||||
return false;
|
||||
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
|
||||
if (!players[playernum].mo)
|
||||
{
|
||||
// first spawn of level
|
||||
for (i = 0; i < playernum; i++)
|
||||
{
|
||||
if (playeringame[i] && players[i].mo
|
||||
&& players[i].mo->x == mthing->x << FRACBITS
|
||||
&& players[i].mo->y == mthing->y << FRACBITS)
|
||||
&& players[i].mo->x == x
|
||||
&& players[i].mo->y == y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
|
||||
if (!K_CheckPlayersRespawnColliding(playernum, x, y))
|
||||
return false;
|
||||
|
||||
@@ -2870,17 +2857,23 @@ UINT8 G_GetGametypeColor(INT16 gt)
|
||||
*/
|
||||
INT16 G_TOLFlag(INT32 pgametype)
|
||||
{
|
||||
if (!multiplayer) return TOL_SP;
|
||||
if (pgametype == GT_COOP) return TOL_RACE; // SRB2kart
|
||||
if (pgametype == GT_COMPETITION) return TOL_COMPETITION;
|
||||
if (pgametype == GT_RACE) return TOL_RACE;
|
||||
if (pgametype == GT_MATCH) return TOL_MATCH;
|
||||
if (pgametype == GT_TEAMMATCH) return TOL_MATCH;
|
||||
if (pgametype == GT_TAG) return TOL_TAG;
|
||||
if (pgametype == GT_HIDEANDSEEK) return TOL_TAG;
|
||||
if (pgametype == GT_CTF) return TOL_CTF;
|
||||
if (!multiplayer) return TOL_SP;
|
||||
|
||||
switch (pgametype)
|
||||
{
|
||||
case GT_COOP: return TOL_RACE; // SRB2kart
|
||||
case GT_COMPETITION: return TOL_COMPETITION;
|
||||
case GT_RACE: return TOL_RACE;
|
||||
case GT_MATCH: return TOL_MATCH;
|
||||
case GT_TEAMMATCH: return TOL_MATCH;
|
||||
case GT_TAG: return TOL_TAG;
|
||||
case GT_HIDEANDSEEK: return TOL_TAG;
|
||||
case GT_CTF: return TOL_CTF;
|
||||
default:
|
||||
CONS_Alert(CONS_ERROR, "Unknown gametype! %d\n", pgametype);
|
||||
break;
|
||||
}
|
||||
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Unknown gametype! %d\n"), pgametype);
|
||||
return INT16_MAX;
|
||||
}
|
||||
|
||||
@@ -3063,6 +3056,7 @@ static void G_DoCompleted(void)
|
||||
K_StatRound();
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
// SRB2Kart: exitlevel shouldn't get you the points
|
||||
@@ -3072,8 +3066,10 @@ static void G_DoCompleted(void)
|
||||
if (P_IsLocalPlayer(&players[i]))
|
||||
j++;
|
||||
}
|
||||
|
||||
G_PlayerFinishLevel(i); // take away cards and stuff
|
||||
}
|
||||
}
|
||||
|
||||
// play some generic music if there's no win/cool/lose music going on (for exitlevel commands)
|
||||
if (G_RaceGametype() && ((multiplayer && demo.playback) || j == splitscreen+1) && (cv_inttime.value > 0))
|
||||
@@ -3217,10 +3213,14 @@ void G_AfterIntermission(void)
|
||||
|
||||
return;
|
||||
}
|
||||
else if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING))
|
||||
G_SaveDemo();
|
||||
else if (demo.recording)
|
||||
G_ResetDemoRecording();
|
||||
|
||||
if (demo.recording)
|
||||
{
|
||||
if (modeattacking || demo.savemode != DSM_NOTSAVING)
|
||||
G_SaveDemo();
|
||||
else
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
|
||||
if (modeattacking) // End the run.
|
||||
{
|
||||
@@ -3229,7 +3229,9 @@ void G_AfterIntermission(void)
|
||||
}
|
||||
|
||||
if (mapheaderinfo[gamemap-1]->cutscenenum) // Start a custom cutscene.
|
||||
{
|
||||
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->cutscenenum-1, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nextmap < 1100-1)
|
||||
@@ -3366,10 +3368,13 @@ static void G_DoContinued(void)
|
||||
// when something new is added.
|
||||
void G_EndGame(void)
|
||||
{
|
||||
if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING))
|
||||
G_SaveDemo();
|
||||
else if (demo.recording)
|
||||
G_ResetDemoRecording();
|
||||
if (demo.recording)
|
||||
{
|
||||
if (modeattacking || demo.savemode != DSM_NOTSAVING)
|
||||
G_SaveDemo();
|
||||
else
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
|
||||
// Only do evaluation and credits in coop games.
|
||||
if (gametype == GT_COOP)
|
||||
@@ -3379,6 +3384,7 @@ void G_EndGame(void)
|
||||
F_StartCredits();
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextmap == 1101-1) // end game with evaluation
|
||||
{
|
||||
F_StartGameEvaluation();
|
||||
@@ -3478,9 +3484,8 @@ void G_LoadGameData(void)
|
||||
modded = READUINT8(save.p);
|
||||
|
||||
// Aha! Someone's been screwing with the save file!
|
||||
if ((modded && !savemoddata))
|
||||
goto datacorrupt;
|
||||
else if (modded != true && modded != false)
|
||||
if ((modded && !savemoddata) ||
|
||||
(modded != true && modded != false))
|
||||
goto datacorrupt;
|
||||
|
||||
// TODO put another cipher on these things? meh, I don't care...
|
||||
@@ -3545,7 +3550,7 @@ void G_LoadGameData(void)
|
||||
return;
|
||||
|
||||
// Landing point for corrupt gamedata
|
||||
datacorrupt:
|
||||
datacorrupt:
|
||||
{
|
||||
const char *gdfolder = "the SRB2Kart folder";
|
||||
|
||||
@@ -4266,18 +4271,21 @@ INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
|
||||
{
|
||||
if (mapname[0] == '*') // current map
|
||||
return gamemap;
|
||||
else if (mapname[0] == '?' && mapheaderinfo[gamemap-1])
|
||||
|
||||
if (mapname[0] == '?' && mapheaderinfo[gamemap-1])
|
||||
return G_RandMap(G_TOLFlag(gametype), gamemap-1, false, 0, false, NULL)+1;
|
||||
else if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map
|
||||
|
||||
if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map
|
||||
{
|
||||
newmapnum = mapheaderinfo[gamemap-1]->nextlevel;
|
||||
|
||||
if (newmapnum < 1 || newmapnum > NUMMAPS)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("NextLevel (%d) is not a valid map.\n"), newmapnum);
|
||||
CONS_Alert(CONS_ERROR, "NextLevel (%d) is not a valid map.\n", newmapnum);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return newmapnum;
|
||||
|
||||
return newmapnum;
|
||||
}
|
||||
}
|
||||
else if (mapnamelen == 2)/* maybe two digit code */
|
||||
|
||||
@@ -262,9 +262,6 @@ void G_ResetControls(void)
|
||||
|
||||
memset(joyxmove, 0, sizeof(joyxmove));
|
||||
memset(joyymove, 0, sizeof(joyymove));
|
||||
|
||||
// reset those just in case the game missed the keyup event
|
||||
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ typedef enum
|
||||
KEY_JOY1 = KEY_MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_HAT1 = KEY_JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_DBLMOUSE1 =KEY_HAT1 + JOYHATS*4, // double clicks
|
||||
KEY_DBLMOUSE1 = KEY_HAT1 + JOYHATS*4, // double clicks
|
||||
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
|
||||
|
||||
|
||||
+1
-104
@@ -80,14 +80,6 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
|
||||
return p;
|
||||
}
|
||||
|
||||
static polyvertex_t *HWR_AllocVertex(void)
|
||||
{
|
||||
polyvertex_t *p;
|
||||
size_t size = sizeof(polyvertex_t);
|
||||
p = Z_Malloc(size, PU_HWRPLANE, NULL);
|
||||
return p;
|
||||
}
|
||||
|
||||
/// \todo polygons should be freed in reverse order for efficiency,
|
||||
/// for now don't free because it doesn't free in reverse order
|
||||
static void HWR_FreePoly(poly_t *poly)
|
||||
@@ -637,7 +629,7 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
||||
WalkBSPNode(bsp->children[0], frontpoly, &bsp->children[0],bsp->bbox[0]);
|
||||
|
||||
// copy child bbox
|
||||
M_Memcpy(bbox, bsp->bbox[0], 4*sizeof (fixed_t));
|
||||
memcpy(bbox, bsp->bbox[0], 4*sizeof (fixed_t));
|
||||
}
|
||||
else
|
||||
I_Error("WalkBSPNode: no front poly?");
|
||||
@@ -855,100 +847,6 @@ static INT32 SolveTProblem(void)
|
||||
return numsplitpoly;
|
||||
}
|
||||
|
||||
#define NEARDIST (0.75f)
|
||||
#define MYMAX (10000000000000.0f)
|
||||
|
||||
/* Adjust true segs (from the segs lump) to be exactely the same as
|
||||
* plane polygone segs
|
||||
* This also convert fixed_t point of segs in float (in moste case
|
||||
* it share the same vertice
|
||||
*/
|
||||
static void AdjustSegs(void)
|
||||
{
|
||||
size_t i, count;
|
||||
INT32 j;
|
||||
seg_t *lseg;
|
||||
poly_t *p;
|
||||
INT32 v1found = 0, v2found = 0;
|
||||
float nearv1, nearv2;
|
||||
|
||||
for (i = 0; i < numsubsectors; i++)
|
||||
{
|
||||
count = subsectors[i].numlines;
|
||||
lseg = &segs[subsectors[i].firstline];
|
||||
p = extrasubsectors[i].planepoly;
|
||||
|
||||
if (!p)
|
||||
continue;
|
||||
|
||||
for (; count--; lseg++)
|
||||
{
|
||||
float distv1,distv2,tmp;
|
||||
nearv1 = nearv2 = MYMAX;
|
||||
|
||||
// Don't touch polyobject segs. We'll compensate
|
||||
// for this when we go about drawing them.
|
||||
if (lseg->polyseg)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < p->numpts; j++)
|
||||
{
|
||||
distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
|
||||
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
|
||||
distv1 = distv1*distv1+tmp*tmp;
|
||||
|
||||
if (distv1 <= nearv1)
|
||||
{
|
||||
v1found = j;
|
||||
nearv1 = distv1;
|
||||
}
|
||||
|
||||
// the same with v2
|
||||
distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
|
||||
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
|
||||
distv2 = distv2*distv2+tmp*tmp;
|
||||
|
||||
if (distv2 <= nearv2)
|
||||
{
|
||||
v2found = j;
|
||||
nearv2 = distv2;
|
||||
}
|
||||
}
|
||||
|
||||
if (nearv1 <= NEARDIST*NEARDIST)
|
||||
// share vertice with segs
|
||||
lseg->pv1 = &(p->pts[v1found]);
|
||||
else
|
||||
{
|
||||
// BP: here we can do better, using PointInSeg and compute
|
||||
// the right point position also split a polygone side to
|
||||
// solve a T-intersection, but too mush work
|
||||
|
||||
// convert fixed vertex to float vertex
|
||||
polyvertex_t *pv = HWR_AllocVertex();
|
||||
pv->x = FIXED_TO_FLOAT(lseg->v1->x);
|
||||
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
|
||||
lseg->pv1 = pv;
|
||||
}
|
||||
|
||||
if (nearv2 <= NEARDIST*NEARDIST)
|
||||
lseg->pv2 = &(p->pts[v2found]);
|
||||
else
|
||||
{
|
||||
polyvertex_t *pv = HWR_AllocVertex();
|
||||
pv->x = FIXED_TO_FLOAT(lseg->v2->x);
|
||||
pv->y = FIXED_TO_FLOAT(lseg->v2->y);
|
||||
lseg->pv2 = pv;
|
||||
}
|
||||
|
||||
lseg->pv1->x2 = FloatToFixed(lseg->pv1->x);
|
||||
lseg->pv1->y2 = FloatToFixed(lseg->pv1->y);
|
||||
lseg->pv2->x2 = FloatToFixed(lseg->pv2->x);
|
||||
lseg->pv2->y2 = FloatToFixed(lseg->pv2->y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// call this routine after the BSP of a Doom wad file is loaded,
|
||||
// and it will generate all the convex polys for the hardware renderer
|
||||
@@ -1017,7 +915,6 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||
#else
|
||||
SolveTProblem();
|
||||
#endif
|
||||
AdjustSegs();
|
||||
|
||||
#ifdef DEBUG_HWBSP
|
||||
//debug debug..
|
||||
|
||||
+13
-4
@@ -346,7 +346,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
|
||||
gltex->mipmap.colormap = Z_Calloc(sizeof(*gltex->mipmap.colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
||||
gltex->mipmap.colormap->source = colormap;
|
||||
M_Memcpy(gltex->mipmap.colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
memcpy(gltex->mipmap.colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
|
||||
blockwidth = texture->width;
|
||||
blockheight = texture->height;
|
||||
@@ -818,11 +818,20 @@ void HWR_PrecacheLevel(void)
|
||||
// Precache flats.
|
||||
HWR_PrecacheLevelFlats();
|
||||
|
||||
// prevent timeouts
|
||||
NetKeepAlive();
|
||||
|
||||
// Precache textures.
|
||||
HWR_PrecacheLevelTextures();
|
||||
|
||||
// prevent timeouts
|
||||
NetKeepAlive();
|
||||
|
||||
// Precache sprites.
|
||||
//HWR_PrecacheLevelSprites();
|
||||
|
||||
// prevent timeouts
|
||||
//NetKeepAlive();
|
||||
}
|
||||
|
||||
void HWR_LoadMapTextures(size_t pnumtextures)
|
||||
@@ -970,7 +979,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
#endif
|
||||
glMipmap->colormap = Z_Calloc(sizeof(*glMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
||||
glMipmap->colormap->source = colormap;
|
||||
M_Memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
}
|
||||
|
||||
if (!glMipmap->downloaded)
|
||||
@@ -1068,7 +1077,7 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
|
||||
{
|
||||
if (memcmp(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8)))
|
||||
{
|
||||
M_Memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
HWR_UpdatePatchMipmap(patch, glMipmap);
|
||||
}
|
||||
else
|
||||
@@ -1091,7 +1100,7 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
|
||||
|
||||
newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
||||
newMipmap->colormap->source = colormap;
|
||||
M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
|
||||
HWR_LoadPatchMipmap(patch, newMipmap);
|
||||
}
|
||||
|
||||
@@ -80,14 +80,13 @@
|
||||
|
||||
|
||||
typedef struct clipnode_s
|
||||
{
|
||||
struct clipnode_s *prev, *next;
|
||||
angle_t start, end;
|
||||
} clipnode_t;
|
||||
{
|
||||
struct clipnode_s *prev, *next;
|
||||
angle_t start, end;
|
||||
} clipnode_t;
|
||||
|
||||
clipnode_t *freelist;
|
||||
clipnode_t *clipnodes;
|
||||
clipnode_t *cliphead;
|
||||
static clipnode_t *freelist;
|
||||
static clipnode_t *cliphead;
|
||||
|
||||
static clipnode_t * gld_clipnode_GetNew(void);
|
||||
static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end);
|
||||
|
||||
@@ -117,7 +117,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FLOAT x,y,z; // position
|
||||
FLOAT x, y, z; // position
|
||||
FLOAT anglex, angley, anglez; // aimingangle / viewangle
|
||||
FLOAT scalex, scaley, scalez;
|
||||
FLOAT fovangle;
|
||||
|
||||
+241
-235
@@ -75,19 +75,19 @@ boolean gl_drawing_stencil = false;
|
||||
|
||||
static INT32 current_bsp_culling_distance = 0;
|
||||
|
||||
FTransform atransform;
|
||||
FTransform atransform = {};
|
||||
|
||||
// Float variants of viewx, viewy, viewz, etc.
|
||||
static float gl_viewx, gl_viewy, gl_viewz;
|
||||
float gl_viewsin, gl_viewcos;
|
||||
float gl_viewsin = 0.0f, gl_viewcos = 0.0f;
|
||||
static float gl_viewludsin, gl_viewludcos;
|
||||
static angle_t gl_aimingangle;
|
||||
|
||||
seg_t *gl_curline;
|
||||
side_t *gl_sidedef;
|
||||
line_t *gl_linedef;
|
||||
sector_t *gl_frontsector;
|
||||
sector_t *gl_backsector;
|
||||
seg_t *gl_curline = NULL;
|
||||
side_t *gl_sidedef = NULL;
|
||||
line_t *gl_linedef = NULL;
|
||||
sector_t *gl_frontsector = NULL;
|
||||
sector_t *gl_backsector = NULL;
|
||||
|
||||
// values for the far clipping plane
|
||||
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
|
||||
@@ -430,13 +430,13 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
||||
blue = (float)poly_color.s.blue;
|
||||
|
||||
// 48 is just an arbritrary value that looked relatively okay.
|
||||
tint_alpha = (float)(sqrt(tint_color.s.alpha) * 48) / 255.0f;
|
||||
tint_alpha = (sqrtf((float)tint_color.s.alpha) * 48.0f) / 255.0f;
|
||||
|
||||
// 8 is roughly the brightness of the "close" color in Software, and 16 the brightness of the "far" color.
|
||||
// 8 is too bright for dark levels, and 16 is too dark for bright levels.
|
||||
// 12 is the compromise value. It doesn't look especially good anywhere, but it's the most balanced.
|
||||
// (Also, as far as I can tell, fade_color's alpha is actually not used in Software, so we only use light level.)
|
||||
fade_alpha = (float)(sqrt(255-light_level) * 12) / 255.0f;
|
||||
fade_alpha = (sqrtf((float)(255-light_level)) * 12.0f) / 255.0f;
|
||||
|
||||
// Clamp the alpha values
|
||||
tint_alpha = CLAMP(tint_alpha, 0.0f, 1.0f);
|
||||
@@ -458,8 +458,8 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
||||
// in palette rendering mode, this is not needed since it properly takes the changes to the palette itself
|
||||
if (!HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
V_CubeApply(&tint_color.s.red, &tint_color.s.green, &tint_color.s.blue);
|
||||
V_CubeApply(&fade_color.s.red, &fade_color.s.green, &fade_color.s.blue);
|
||||
V_CubeApply(&tint_color);
|
||||
V_CubeApply(&fade_color);
|
||||
}
|
||||
|
||||
Surface->PolyColor.rgba = poly_color.rgba;
|
||||
@@ -557,7 +557,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
size_t len;
|
||||
|
||||
float tempxsow, tempytow;
|
||||
float scrollx = 0.0f, scrolly = 0.0f, anglef = 0.0f;
|
||||
float scrollx = 0.0f, scrolly = 0.0f;
|
||||
float anglef = 0.0f, cosangf = 0.0f, sinangf = 0.0f;
|
||||
angle_t angle = 0;
|
||||
|
||||
static FOutVector *planeVerts = NULL;
|
||||
@@ -571,7 +572,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
|
||||
nrPlaneVerts = planepoly->numpts;
|
||||
|
||||
if (nrPlaneVerts < 3) //not even a triangle ?
|
||||
if (nrPlaneVerts < 3) // not even a triangle ?
|
||||
return;
|
||||
|
||||
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
|
||||
@@ -654,8 +655,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
tempxsow = flatxref;
|
||||
tempytow = flatyref;
|
||||
anglef = ANG2RAD(InvAngle(angle));
|
||||
flatxref = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));
|
||||
flatyref = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));
|
||||
cosangf = cosf(anglef);
|
||||
sinangf = sinf(anglef);
|
||||
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
|
||||
flatyref = (tempxsow * sinangf) + (tempytow * cosangf);
|
||||
}
|
||||
|
||||
#define SETUP3DVERT(vert, vx, vy) {\
|
||||
@@ -668,8 +671,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
{\
|
||||
tempxsow = vert->s;\
|
||||
tempytow = vert->t;\
|
||||
vert->s = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));\
|
||||
vert->t = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));\
|
||||
vert->s = (tempxsow * cosangf) - (tempytow * sinangf);\
|
||||
vert->t = (tempxsow * sinangf) + (tempytow * cosangf);\
|
||||
}\
|
||||
\
|
||||
vert->x = (vx);\
|
||||
@@ -728,6 +731,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
|
||||
for (i = 0; i < subsector->numlines; i++, line++)
|
||||
{
|
||||
if (line->polyseg)
|
||||
continue;
|
||||
|
||||
line_t* ld = line->linedef;
|
||||
|
||||
// this check sucks and is a hotspot lel
|
||||
@@ -740,27 +746,11 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
P_ClosestPointOnLine(viewx, viewy, ld, &v);
|
||||
dist = FixedToFloat(R_PointToDist(v.x, v.y));
|
||||
|
||||
if (line->pv1)
|
||||
{
|
||||
x1 = line->pv1->x;
|
||||
y1 = line->pv1->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 = FixedToFloat(line->v1->x);
|
||||
y1 = FixedToFloat(line->v1->y);
|
||||
}
|
||||
x1 = (line->fv1.x);
|
||||
y1 = (line->fv1.y);
|
||||
|
||||
if (line->pv2)
|
||||
{
|
||||
xd = line->pv2->x - x1;
|
||||
yd = line->pv2->y - y1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xd = FixedToFloat(line->v2->x) - x1;
|
||||
yd = FixedToFloat(line->v2->y) - y1;
|
||||
}
|
||||
xd = (line->fv2.x) - x1;
|
||||
yd = (line->fv2.y) - y1;
|
||||
|
||||
// Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion
|
||||
dist = sqrtf((xd*xd) + (yd*yd)) / dist / 16.0f;
|
||||
@@ -824,11 +814,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
|
||||
|
||||
M_ClearBox(segbbox);
|
||||
M_AddToBox(segbbox,
|
||||
FloatToFixed(gl_curline->pv1->x),
|
||||
FloatToFixed(gl_curline->pv1->y));
|
||||
FloatToFixed(gl_curline->fv1.x),
|
||||
FloatToFixed(gl_curline->fv1.y));
|
||||
M_AddToBox(segbbox,
|
||||
FloatToFixed(gl_curline->pv2->x),
|
||||
FloatToFixed(gl_curline->pv2->y));
|
||||
FloatToFixed(gl_curline->fv2.x),
|
||||
FloatToFixed(gl_curline->fv2.y));
|
||||
|
||||
splat = (wallsplat_t *)gl_curline->linedef->splats;
|
||||
for (; splat; splat = splat->next)
|
||||
@@ -1163,11 +1153,11 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
// Additionally, to remove the need to draw the sky twice, drawing a plane at the far clip boundary to the stencil buffer after other
|
||||
// rendering will also allow stencil sky rendering to fill in any untouched pixels too.
|
||||
|
||||
FOutVector* skyWallVertexArray = NULL;
|
||||
int skyWallVertexArraySize = 0;
|
||||
int skyWallVertexArrayAllocSize = 65536;// what a mouthful
|
||||
static FOutVector* skyWallVertexArray = NULL;
|
||||
static int skyWallVertexArraySize = 0;
|
||||
static int skyWallVertexArrayAllocSize = 65536;// what a mouthful
|
||||
|
||||
boolean gl_collect_skywalls = false;
|
||||
static boolean gl_collect_skywalls = false;
|
||||
|
||||
static void HWR_SkyWallList_Clear(void)
|
||||
{
|
||||
@@ -1196,7 +1186,7 @@ static void HWR_SkyWallList_Add(FOutVector *wallVerts)
|
||||
static void HWR_DrawSkyWallList(void)
|
||||
{
|
||||
int i;
|
||||
FSurfaceInfo surf;
|
||||
FSurfaceInfo surf = {};
|
||||
|
||||
surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
@@ -1237,7 +1227,7 @@ static void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
|
||||
// Returns true if the midtexture is visible, and false if... it isn't...
|
||||
static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
{
|
||||
FUINT blendmode = PF_Masked;
|
||||
FUINT blendmode = PF_Masked | PF_Translucent;
|
||||
|
||||
pSurf->PolyColor.s.alpha = 0xFF;
|
||||
|
||||
@@ -1259,8 +1249,6 @@ static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
case 256:
|
||||
if (gl_linedef->blendmode)
|
||||
blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), pSurf);
|
||||
else
|
||||
blendmode = PF_Translucent;
|
||||
break;
|
||||
default:
|
||||
if (gl_linedef->blendmode)
|
||||
@@ -1272,8 +1260,6 @@ static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
}
|
||||
else if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT)
|
||||
blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), pSurf);
|
||||
else
|
||||
blendmode = PF_Masked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1285,8 +1271,8 @@ static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
pSurf->PolyColor.s.alpha = 0x00; // This shouldn't draw anything regardless of blendmode
|
||||
return false;
|
||||
}
|
||||
else
|
||||
blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, pSurf);
|
||||
|
||||
blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, pSurf);
|
||||
}
|
||||
|
||||
if (blendmode != PF_Masked && pSurf->PolyColor.s.alpha == 0x00)
|
||||
@@ -1323,34 +1309,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
const boolean noencore = (gl_linedef->flags & ML_TFERLINE);
|
||||
|
||||
if (LIKELY(gl_curline->pv1))
|
||||
{
|
||||
vs.x = gl_curline->pv1->x;
|
||||
vs.y = gl_curline->pv1->y;
|
||||
v1x = gl_curline->pv1->x2;
|
||||
v1y = gl_curline->pv1->y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
vs.x = FixedToFloat(gl_curline->v1->x);
|
||||
vs.y = FixedToFloat(gl_curline->v1->y);
|
||||
v1x = gl_curline->v1->x;
|
||||
v1y = gl_curline->v1->y;
|
||||
}
|
||||
v1x = gl_curline->v1->x;
|
||||
v1y = gl_curline->v1->y;
|
||||
v2x = gl_curline->v2->x;
|
||||
v2y = gl_curline->v2->y;
|
||||
|
||||
if (LIKELY(gl_curline->pv2))
|
||||
if (gl_curline->polyseg)
|
||||
{
|
||||
ve.x = gl_curline->pv2->x;
|
||||
ve.y = gl_curline->pv2->y;
|
||||
v2x = gl_curline->pv2->x2;
|
||||
v2y = gl_curline->pv2->y2;
|
||||
vs.x = FixedToFloat(v1x);
|
||||
vs.y = FixedToFloat(v1y);
|
||||
ve.x = FixedToFloat(v2x);
|
||||
ve.y = FixedToFloat(v2y);
|
||||
}
|
||||
else
|
||||
{
|
||||
ve.x = FixedToFloat(gl_curline->v2->x);
|
||||
ve.y = FixedToFloat(gl_curline->v2->y);
|
||||
v2x = gl_curline->v2->x;
|
||||
v2y = gl_curline->v2->y;
|
||||
vs.x = gl_curline->fv1.x;
|
||||
vs.y = gl_curline->fv1.y;
|
||||
ve.x = gl_curline->fv2.x;
|
||||
ve.y = gl_curline->fv2.y;
|
||||
}
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
@@ -1389,6 +1365,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||
GLMapTexture_t *glTex = NULL;
|
||||
|
||||
static constexpr float FLOATMAX = INT32_MAX / (float)FRACUNIT;
|
||||
static constexpr float FLOATMIN = INT32_MIN / (float)FRACUNIT;
|
||||
|
||||
// two sided line
|
||||
if (gl_backsector)
|
||||
{
|
||||
@@ -1403,7 +1382,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (!gl_curline->polyseg) // Don't do it for polyobjects
|
||||
{
|
||||
// Sky Ceilings
|
||||
wallVerts[3].y = wallVerts[2].y = FixedToFloat(INT32_MAX);
|
||||
wallVerts[3].y = wallVerts[2].y = FLOATMAX;
|
||||
|
||||
auto draw_sky_walls = [&](int vert1, int vert2, fixed_t world, fixed_t worldslope)
|
||||
{
|
||||
@@ -1438,7 +1417,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
|
||||
// Sky Floors
|
||||
wallVerts[0].y = wallVerts[1].y = FixedToFloat(INT32_MIN);
|
||||
wallVerts[0].y = wallVerts[1].y = FLOATMIN;
|
||||
|
||||
if (gl_frontsector->floorpic == skyflatnum)
|
||||
{
|
||||
@@ -1482,18 +1461,21 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
// check TOP TEXTURE
|
||||
if (gl_toptexture && (worldhighslope < worldtopslope || worldhigh < worldtop))
|
||||
{
|
||||
fixed_t texheight = textureheight[gl_toptexture];
|
||||
|
||||
// PEGGING
|
||||
// FIXME: This is probably not correct?
|
||||
if (gl_linedef->flags & ML_DONTPEGTOP)
|
||||
texturevpeg = 0;
|
||||
else if (gl_linedef->flags & ML_EFFECT1)
|
||||
texturevpeg = worldhigh + textureheight[gl_toptexture] - worldtop;
|
||||
texturevpeg = worldhigh + texheight - worldtop;
|
||||
else
|
||||
texturevpeg = gl_backsector->ceilingheight + textureheight[gl_toptexture] - gl_frontsector->ceilingheight;
|
||||
texturevpeg = gl_backsector->ceilingheight + texheight - gl_frontsector->ceilingheight;
|
||||
|
||||
texturevpeg += gl_sidedef->rowoffset;
|
||||
|
||||
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
||||
texturevpeg %= textureheight[gl_toptexture];
|
||||
texturevpeg %= texheight;
|
||||
|
||||
glTex = HWR_GetTexture(gl_toptexture, noencore);
|
||||
|
||||
@@ -1514,13 +1496,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else if (gl_linedef->flags & ML_DONTPEGTOP)
|
||||
{
|
||||
// Skewed by top
|
||||
wallVerts[0].t = (texturevpeg + worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + worldtopslope - worldhighslope) * glTex->scaleY;
|
||||
wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skewed by bottom
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
|
||||
}
|
||||
@@ -1560,7 +1542,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
glTex = HWR_GetTexture(gl_bottomtexture, noencore);
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_backsector->floorheight - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
|
||||
@@ -1576,14 +1558,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
// Skewed by bottom
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldlow - worldbottom) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skewed by top
|
||||
wallVerts[0].t = (texturevpeg + worldlow - worldbottom) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + worldlowslope - worldbottomslope) * glTex->scaleY;
|
||||
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
|
||||
}
|
||||
|
||||
// set top/bottom coords
|
||||
@@ -1615,6 +1597,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else
|
||||
back = gl_linedef->backsector;
|
||||
|
||||
fixed_t texheight = textureheight[gl_midtexture];
|
||||
|
||||
if (gl_sidedef->repeatcnt)
|
||||
repeats = 1 + gl_sidedef->repeatcnt;
|
||||
else if (gl_linedef->flags & ML_EFFECT5 || gl_portal_state == GLPORTAL_STENCIL || gl_portal_state == GLPORTAL_DEPTH)
|
||||
@@ -1631,8 +1615,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else
|
||||
low = back->floorheight;
|
||||
|
||||
repeats = (high - low) / textureheight[gl_midtexture];
|
||||
if ((high - low) % textureheight[gl_midtexture])
|
||||
repeats = (high - low) / texheight;
|
||||
if ((high - low) % texheight)
|
||||
repeats++; // tile an extra time to fill the gap -- Monster Iestyn
|
||||
}
|
||||
else
|
||||
@@ -1664,18 +1648,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
|
||||
// Find the wall's coordinates
|
||||
const fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
|
||||
const fixed_t midtexheight = texheight * repeats;
|
||||
|
||||
fixed_t rowoffset = gl_sidedef->rowoffset;
|
||||
|
||||
// Texture is not skewed
|
||||
if (gl_linedef->flags & ML_EFFECT2)
|
||||
{
|
||||
if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) // Peg it to the floor
|
||||
{
|
||||
polybottom = std::max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
polybottom = std::max(gl_frontsector->floorheight, gl_backsector->floorheight) + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
}
|
||||
else // Peg it to the ceiling
|
||||
// Peg it to the ceiling
|
||||
else
|
||||
{
|
||||
polytop = std::min(front->ceilingheight, back->ceilingheight) + gl_sidedef->rowoffset;
|
||||
polytop = std::min(gl_frontsector->ceilingheight, gl_backsector->ceilingheight) + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
}
|
||||
|
||||
@@ -1685,16 +1673,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) // Skew the texture, but peg it to the floor
|
||||
{
|
||||
polybottom = popenbottom + gl_sidedef->rowoffset;
|
||||
polybottom = popenbottom + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
polybottomslope = popenbottomslope + gl_sidedef->rowoffset;
|
||||
polybottomslope = popenbottomslope + rowoffset;
|
||||
polytopslope = polybottomslope + midtexheight;
|
||||
}
|
||||
else // Skew it according to the ceiling's slope
|
||||
{
|
||||
polytop = popentop + gl_sidedef->rowoffset;
|
||||
polytop = popentop + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
polytopslope = popentopslope + gl_sidedef->rowoffset;
|
||||
polytopslope = popentopslope + rowoffset;
|
||||
polybottomslope = polytopslope - midtexheight;
|
||||
}
|
||||
|
||||
@@ -1778,7 +1766,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
glTex = HWR_GetTexture(gl_midtexture, noencore);
|
||||
|
||||
fixed_t texturevpeg;
|
||||
fixed_t texturevpeg;
|
||||
|
||||
// PEGGING
|
||||
if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2))
|
||||
@@ -1803,13 +1791,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * glTex->scaleY;
|
||||
wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
|
||||
}
|
||||
|
||||
//Set textures properly on single sided walls that are sloped
|
||||
@@ -1846,7 +1834,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
if (gl_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector
|
||||
{
|
||||
wallVerts[2].y = wallVerts[3].y = FixedToFloat(INT32_MAX); // draw to top of map space
|
||||
wallVerts[2].y = wallVerts[3].y = FLOATMAX; // draw to top of map space
|
||||
wallVerts[0].y = FixedToFloat(worldtop);
|
||||
wallVerts[1].y = FixedToFloat(worldtopslope);
|
||||
|
||||
@@ -1856,7 +1844,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
wallVerts[3].y = FixedToFloat(worldbottom);
|
||||
wallVerts[2].y = FixedToFloat(worldbottomslope);
|
||||
wallVerts[0].y = wallVerts[1].y = FixedToFloat(INT32_MIN); // draw to bottom of map space
|
||||
wallVerts[0].y = wallVerts[1].y = FLOATMIN; // draw to bottom of map space
|
||||
|
||||
HWR_DrawSkyWall(wallVerts, &Surf);
|
||||
}
|
||||
@@ -1874,7 +1862,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
fixed_t high1, highslope1, low1, lowslope1;
|
||||
|
||||
INT32 texnum;
|
||||
line_t * newline = NULL; // Multi-Property FOF
|
||||
|
||||
lowcut = std::max(worldbottom, worldlow);
|
||||
highcut = std::min(worldtop, worldhigh);
|
||||
@@ -1909,14 +1896,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min((size_t)(gl_curline->linedef-gl_backsector->lines[0]), rover->master->frontsector->linecount);
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
|
||||
do_texture_skew = newline->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_texture_skew = rover->master->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
||||
texnum = R_GetTextureNum(side->midtexture);
|
||||
|
||||
h = P_GetFFloorTopZAt (rover, v1x, v1y);
|
||||
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
|
||||
@@ -1953,44 +1950,30 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t texturevpeg;
|
||||
boolean attachtobottom = false;
|
||||
boolean slopeskew = false; // skew FOF walls with slopes?
|
||||
|
||||
// Wow, how was this missing from OpenGL for so long?
|
||||
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
|
||||
// -- Monster Iestyn 26/06/18
|
||||
if (newline)
|
||||
{
|
||||
texturevpeg = sides[newline->sidenum[0]].rowoffset;
|
||||
attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM);
|
||||
slopeskew = !!(newline->flags & ML_DONTPEGTOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
texturevpeg = sides[rover->master->sidenum[0]].rowoffset;
|
||||
attachtobottom = !!(gl_linedef->flags & ML_DONTPEGBOTTOM);
|
||||
slopeskew = !!(rover->master->flags & ML_DONTPEGTOP);
|
||||
}
|
||||
fixed_t texturevpeg = side->rowoffset;
|
||||
|
||||
glTex = HWR_GetTexture(texnum, noencore);
|
||||
|
||||
if (!slopeskew) // no skewing
|
||||
if (!do_texture_skew) // no skewing
|
||||
{
|
||||
if (attachtobottom)
|
||||
texturevpeg -= *rover->topheight - *rover->bottomheight;
|
||||
wallVerts[3].t = (*rover->topheight - h + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = (*rover->topheight - hS + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = (*rover->topheight - l + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = (*rover->topheight - lS + texturevpeg) * glTex->scaleY;
|
||||
if (dont_peg_bottom)
|
||||
texturevpeg -= (*rover->topheight - *rover->bottomheight);
|
||||
|
||||
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!attachtobottom) // skew by top
|
||||
if (!dont_peg_bottom) // skew by top
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = (hS - lS + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else // skew by bottom
|
||||
{
|
||||
@@ -2059,7 +2042,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
break;
|
||||
}
|
||||
|
||||
if (bothsides) continue;
|
||||
if (bothsides)
|
||||
continue;
|
||||
|
||||
const ffloortype_e roverflags = rover->flags;
|
||||
|
||||
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES))
|
||||
@@ -2071,14 +2056,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min((size_t)(gl_curline->linedef-gl_backsector->lines[0]), rover->master->frontsector->linecount);
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
|
||||
do_texture_skew = newline->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_texture_skew = rover->master->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
||||
texnum = R_GetTextureNum(side->midtexture);
|
||||
|
||||
h = P_GetFFloorTopZAt (rover, v1x, v1y);
|
||||
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
|
||||
@@ -2115,17 +2110,37 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wow, how was this missing from OpenGL for so long?
|
||||
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
|
||||
// -- Monster Iestyn 26/06/18
|
||||
fixed_t texturevpeg = side->rowoffset;
|
||||
|
||||
glTex = HWR_GetTexture(texnum, noencore);
|
||||
|
||||
if (newline)
|
||||
if (!do_texture_skew) // no skewing
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset)) * glTex->scaleY;
|
||||
if (dont_peg_bottom)
|
||||
texturevpeg -= (*rover->topheight - *rover->bottomheight);
|
||||
|
||||
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset)) * glTex->scaleY;
|
||||
if (!dont_peg_bottom) // skew by top
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else // skew by bottom
|
||||
{
|
||||
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
|
||||
}
|
||||
}
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
@@ -2193,36 +2208,21 @@ boolean checkforemptylines = true;
|
||||
|
||||
static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
{
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t frontf1, frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
|
||||
|
||||
// GZDoom method of sloped line clipping
|
||||
|
||||
if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope)
|
||||
if (afrontsector->f_slope || afrontsector->c_slope
|
||||
|| abacksector->f_slope || abacksector->c_slope)
|
||||
{
|
||||
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
|
||||
|
||||
if (LIKELY(gl_curline->pv1))
|
||||
{
|
||||
v1x = gl_curline->pv1->x2;
|
||||
v1y = gl_curline->pv1->y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
v1x = gl_curline->v1->x;
|
||||
v1y = gl_curline->v1->y;
|
||||
}
|
||||
v1x = gl_curline->v1->x;
|
||||
v1y = gl_curline->v1->y;
|
||||
|
||||
if (LIKELY(gl_curline->pv2))
|
||||
{
|
||||
v2x = gl_curline->pv2->x2;
|
||||
v2y = gl_curline->pv2->y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
v2x = gl_curline->v2->x;
|
||||
v2y = gl_curline->v2->y;
|
||||
}
|
||||
v2x = gl_curline->v2->x;
|
||||
v2y = gl_curline->v2->y;
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
end1 = P_GetZAt(slope, v1x, v1y, normalheight); \
|
||||
@@ -2238,8 +2238,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
{
|
||||
frontf1 = frontf2 = afrontsector->floorheight;
|
||||
frontc1 = frontc2 = afrontsector->ceilingheight;
|
||||
backf1 = backf2 = abacksector->floorheight;
|
||||
backc1 = backc2 = abacksector->ceilingheight;
|
||||
backf1 = backf2 = abacksector->floorheight;
|
||||
backc1 = backc2 = abacksector->ceilingheight;
|
||||
}
|
||||
|
||||
// using this check with portals causes weird culling issues on ante-station
|
||||
@@ -2363,7 +2363,7 @@ static inline void DoAddLine(seg_t* line, angle_t angle1, angle_t angle2)
|
||||
|
||||
if constexpr (Type == AddLineType::kPortal)
|
||||
{
|
||||
if (gl_portal_state != GLPORTAL_SEARCH && !dontdraw)// no need to do this during the portal check
|
||||
if (gl_portal_state != GLPORTAL_SEARCH && !dontdraw) // no need to do this during the portal check
|
||||
HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D
|
||||
}
|
||||
else if constexpr (Type == AddLineType::kNormal)
|
||||
@@ -2427,27 +2427,11 @@ static void HWR_AddLine(seg_t *line)
|
||||
|
||||
gl_curline = line;
|
||||
|
||||
if (LIKELY(gl_curline->pv1))
|
||||
{
|
||||
v1x = gl_curline->pv1->x2;
|
||||
v1y = gl_curline->pv1->y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
v1x = gl_curline->v1->x;
|
||||
v1y = gl_curline->v1->y;
|
||||
}
|
||||
v1x = gl_curline->v1->x;
|
||||
v1y = gl_curline->v1->y;
|
||||
|
||||
if (LIKELY(gl_curline->pv2))
|
||||
{
|
||||
v2x = gl_curline->pv2->x2;
|
||||
v2y = gl_curline->pv2->y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
v2x = gl_curline->v2->x;
|
||||
v2y = gl_curline->v2->y;
|
||||
}
|
||||
v2x = gl_curline->v2->x;
|
||||
v2y = gl_curline->v2->y;
|
||||
|
||||
// OPTIMIZE: quickly reject orthogonal back sides.
|
||||
angle1 = R_PointToAngle64(v1x, v1y);
|
||||
@@ -2619,7 +2603,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||
|
||||
nrPlaneVerts = polysector->numVertices;
|
||||
|
||||
if (nrPlaneVerts < 3) //not even a triangle ?
|
||||
if (nrPlaneVerts < 3) // not even a triangle ?
|
||||
return;
|
||||
|
||||
if (nrPlaneVerts > INT16_MAX) // FIXME: exceeds plVerts size
|
||||
@@ -2777,7 +2761,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
||||
// Polyobject Planes need their own function for drawing because they don't have extrasubsectors by themselves
|
||||
// It should be okay because polyobjects should always be convex anyway
|
||||
|
||||
for (i = 0; i < numpolys; i++)
|
||||
for (i = 0; i < numpolys; i++)
|
||||
{
|
||||
polyobjsector = po_ptrs[i]->lines[0]->backsector; // the in-level polyobject sector
|
||||
|
||||
@@ -3533,7 +3517,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
|
||||
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
||||
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip, const boolean papersprite)
|
||||
{
|
||||
if (!cv_glspritebillboarding.value || papersprite)
|
||||
if (!cv_glspritebillboarding.value || cv_glshearing.value || papersprite)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4280,8 +4264,8 @@ static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, I
|
||||
{
|
||||
wallinfo_t *wallinfo = static_cast<wallinfo_t*>(HWR_CreateDrawNode(DRAWNODE_WALL));
|
||||
|
||||
M_Memcpy(wallinfo->wallVerts, wallVerts, sizeof (wallinfo->wallVerts));
|
||||
M_Memcpy(&wallinfo->Surf, pSurf, sizeof (FSurfaceInfo));
|
||||
memcpy(wallinfo->wallVerts, wallVerts, sizeof (wallinfo->wallVerts));
|
||||
memcpy(&wallinfo->Surf, pSurf, sizeof (FSurfaceInfo));
|
||||
wallinfo->texnum = texnum;
|
||||
wallinfo->noencore = noencore;
|
||||
wallinfo->blend = blend;
|
||||
@@ -4481,7 +4465,8 @@ static void HWR_DrawSprites(void)
|
||||
HWR_DrawPrecipitationSprite(spr);
|
||||
continue;
|
||||
}
|
||||
else if (spr->mobj)
|
||||
|
||||
if (spr->mobj)
|
||||
{
|
||||
if constexpr (Type == DrawSpritesType::kModels)
|
||||
{
|
||||
@@ -4534,7 +4519,7 @@ template <AddSpritesType Type>
|
||||
static void HWR_AddSprites(sector_t *sec)
|
||||
{
|
||||
mobj_t *thing;
|
||||
INT32 limit_dist;
|
||||
INT32 limit_dist = 0;
|
||||
|
||||
// BSP is traversed by subsector.
|
||||
// A sector might have been split into several
|
||||
@@ -4597,14 +4582,14 @@ static void HWR_AddPrecipitationSprites(void)
|
||||
return;
|
||||
}
|
||||
|
||||
drawdist = ((fixed_t)(cv_drawdist_precip.value) * mapobjectscale);
|
||||
|
||||
// No to infinite precipitation draw distance.
|
||||
if (cv_drawdist_precip.value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
drawdist = ((fixed_t)(cv_drawdist_precip.value) * mapobjectscale);
|
||||
|
||||
if (current_bsp_culling_distance)
|
||||
drawdist = std::min((fixed_t)current_bsp_culling_distance, drawdist);
|
||||
|
||||
@@ -5126,42 +5111,46 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
|
||||
static gl_sky_t gl_sky;
|
||||
|
||||
#define DEG2RADGL(a) ((a * M_PIl) / 180.0f)
|
||||
|
||||
static void HWR_SkyDomeVertex(gl_sky_t *sky, gl_skyvertex_t *vbo, int r, int c, signed char yflip, float delta, boolean foglayer)
|
||||
{
|
||||
static constexpr float radians = (float)(M_PIl / 180.0f);
|
||||
static constexpr float scale = 10000.0f;
|
||||
static constexpr float maxSideAngle = DEG2RADGL(60.0f);
|
||||
static constexpr float maxSideAngle = 60.0f * radians;
|
||||
|
||||
float topAngle = DEG2RADGL(c / (float)sky->columns * 360.0f);
|
||||
float topAngle = ((float)c / (float)sky->columns * 360.0f) * radians;
|
||||
float sideAngle = (maxSideAngle * (float)(sky->rows - r) / (float)sky->rows);
|
||||
float height = (float)(sin(sideAngle));
|
||||
float realRadius = (scale * (float)cos(sideAngle));
|
||||
float x = (realRadius * (float)cos(topAngle));
|
||||
float height = sinf(sideAngle);
|
||||
float realRadius = (scale * cosf(sideAngle));
|
||||
float x = (realRadius * cosf(topAngle));
|
||||
float y = (!yflip) ? scale * height : -scale * height;
|
||||
float z = (realRadius * (float)sin(topAngle));
|
||||
float timesRepeat = (4 * (256.0f / sky->width));
|
||||
|
||||
if (std::fpclassify(timesRepeat) == FP_ZERO)
|
||||
timesRepeat = 1.0f;
|
||||
float z = (realRadius * sinf(topAngle));
|
||||
float timesRepeat;
|
||||
|
||||
if (!foglayer)
|
||||
{
|
||||
timesRepeat = (4.0f * (256.0f / (float)sky->width));
|
||||
|
||||
if (std::fpclassify(timesRepeat) == FP_ZERO)
|
||||
timesRepeat = 1.0f;
|
||||
|
||||
vbo->r = 255;
|
||||
vbo->g = 255;
|
||||
vbo->b = 255;
|
||||
vbo->a = (r == 0 ? 0 : 255);
|
||||
|
||||
// And the texture coordinates.
|
||||
vbo->u = (-timesRepeat * c / (float)sky->columns);
|
||||
if (!yflip) // Flipped Y is for the lower hemisphere.
|
||||
vbo->v = (r / (float)sky->rows) + 0.5f;
|
||||
vbo->u = (-timesRepeat * (float)c / (float)sky->columns);
|
||||
|
||||
if (!yflip) // Flipped Y is for the lower hemisphere.
|
||||
vbo->v = ((float)r / (float)sky->rows) + 0.5f;
|
||||
else
|
||||
vbo->v = 1.0f + ((sky->rows - r) / (float)sky->rows) + 0.5f;
|
||||
vbo->v = 1.0f + ((float)(sky->rows - r) / (float)sky->rows) + 0.5f;
|
||||
}
|
||||
|
||||
if (r != 4)
|
||||
{
|
||||
y += 300.0f;
|
||||
}
|
||||
|
||||
// And finally the vertex.
|
||||
vbo->x = x;
|
||||
@@ -5313,7 +5302,7 @@ static inline void HWR_ClearView(void)
|
||||
viewwindowy,
|
||||
(viewwindowx + viewwidth),
|
||||
(viewwindowy + viewheight),
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GL_ClearBuffer(false, true, true, NULL);
|
||||
}
|
||||
|
||||
@@ -5369,8 +5358,12 @@ void HWR_SetTransform(float fpov)
|
||||
HWR_SetTransformAiming(&atransform);
|
||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
|
||||
|
||||
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
|
||||
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
|
||||
// only needed for sprite billboarding
|
||||
if (cv_glspritebillboarding.value && !cv_glshearing.value)
|
||||
{
|
||||
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
|
||||
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
|
||||
}
|
||||
|
||||
atransform.fovangle = fpov; // Tails
|
||||
HWR_RollTransform(&atransform, viewroll);
|
||||
@@ -5386,7 +5379,9 @@ void HWR_SetTransform(float fpov)
|
||||
atransform.fliptype = TRANSFORM_FLIP;
|
||||
}
|
||||
else if (postimg & POSTIMG_MIRROR)
|
||||
{
|
||||
atransform.fliptype = TRANSFORM_MIRROR;
|
||||
}
|
||||
|
||||
// Set transform.
|
||||
GL_SetTransform(&atransform);
|
||||
@@ -5589,14 +5584,16 @@ static void HWR_RenderFrame(player_t *player, boolean skybox)
|
||||
|
||||
current_bsp_culling_distance = 0;
|
||||
|
||||
if (!skybox && cv_glrenderdistance.value)
|
||||
const INT32 renderdist = cv_glrenderdistance.value;
|
||||
|
||||
if (!skybox && renderdist)
|
||||
{
|
||||
GL_GClipRect(viewwindowx,
|
||||
viewwindowy,
|
||||
(viewwindowx + viewwidth),
|
||||
(viewwindowy + viewheight),
|
||||
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
||||
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
|
||||
ZCLIP_PLANE, clipping_distances[renderdist - 1]);
|
||||
current_bsp_culling_distance = bsp_culling_distances[renderdist- 1];
|
||||
}
|
||||
|
||||
portalclipline = NULL;
|
||||
@@ -5962,7 +5959,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||
|
||||
V_CubeApply(&Surf.PolyColor.s.red, &Surf.PolyColor.s.green, &Surf.PolyColor.s.blue);
|
||||
V_CubeApply(&Surf.PolyColor);
|
||||
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
@@ -5989,31 +5986,33 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
|
||||
|
||||
UINT8 x, y;
|
||||
INT32 WAVELENGTH;
|
||||
INT32 AMPLITUDE;
|
||||
INT32 FREQUENCY;
|
||||
float WAVELENGTH;
|
||||
float AMPLITUDE;
|
||||
float FREQUENCY;
|
||||
|
||||
// Modifies the wave.
|
||||
if (thiscam->postimg & POSTIMG_WATER)
|
||||
{
|
||||
WAVELENGTH = 5;
|
||||
AMPLITUDE = 40;
|
||||
FREQUENCY = 8;
|
||||
WAVELENGTH = 5.0f;
|
||||
AMPLITUDE = 40.0f;
|
||||
FREQUENCY = 8.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
WAVELENGTH = 10;
|
||||
AMPLITUDE = 60;
|
||||
FREQUENCY = 4;
|
||||
WAVELENGTH = 10.0f;
|
||||
AMPLITUDE = 60.0f;
|
||||
FREQUENCY = 4.0f;
|
||||
}
|
||||
|
||||
//static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek
|
||||
|
||||
for (x = 0; x < SCREENVERTS; x++)
|
||||
{
|
||||
for (y = 0; y < SCREENVERTS; y++)
|
||||
{
|
||||
// Change X position based on its Y position.
|
||||
v[x][y][0] = (x/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f + (float)sin((disStart+(y*WAVELENGTH))/FREQUENCY)/AMPLITUDE;
|
||||
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
||||
v[x][y][0] = x-4.5f + sinf(((disStart+((float)y * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
|
||||
v[x][y][1] = y-4.5f; // (y / scale)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6039,20 +6038,27 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
}
|
||||
|
||||
if (wipenum > 99 || scrnnum > 99) // not a valid wipe number
|
||||
{
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // just draw a black screen instead of flashing and crap
|
||||
return; // shouldn't end up here really, the loop should've stopped running beforehand
|
||||
}
|
||||
|
||||
// puts the numbers into the lumpname
|
||||
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum);
|
||||
lumpnum = W_CheckNumForName(lumpname);
|
||||
|
||||
if (lumpnum == LUMPERROR) // again, shouldn't be here really
|
||||
{
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // just draw a black screen instead of flashing and crap
|
||||
return;
|
||||
}
|
||||
|
||||
lsize = W_LumpLength(lumpnum);
|
||||
|
||||
if (!(lsize == 256000 || lsize == 64000 || lsize == 16000 || lsize == 4000))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", lumpname);
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // just draw a black screen instead of flashing and crap
|
||||
return; // again, shouldn't get here if it is a bad size
|
||||
}
|
||||
|
||||
|
||||
@@ -72,10 +72,9 @@
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
md2_t md2_models[NUMSPRITES];
|
||||
md2_t md2_playermodels[MAXSKINS];
|
||||
md2_t md2_localplayermodels[MAXLOCALSKINS];
|
||||
|
||||
md2_t md2_models[NUMSPRITES] = {};
|
||||
md2_t md2_playermodels[MAXSKINS] = {};
|
||||
md2_t md2_localplayermodels[MAXLOCALSKINS] = {};
|
||||
|
||||
/*
|
||||
* free model
|
||||
@@ -417,7 +416,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
size = w*h;
|
||||
while (size--)
|
||||
{
|
||||
V_CubeApply(&image->s.red, &image->s.green, &image->s.blue);
|
||||
V_CubeApply(image);
|
||||
image++;
|
||||
}
|
||||
}
|
||||
@@ -1058,7 +1057,7 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
|
||||
{
|
||||
if (memcmp(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8)))
|
||||
{
|
||||
M_Memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
HWR_CreateBlendedTexture(patch, blendgpatch, glMipmap, skinnum, color);
|
||||
GL_UpdateTexture(glMipmap);
|
||||
}
|
||||
@@ -1085,7 +1084,7 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
|
||||
|
||||
newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
||||
newMipmap->colormap->source = colormap;
|
||||
M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
|
||||
HWR_CreateBlendedTexture(patch, blendgpatch, newMipmap, skinnum, color);
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ void GenerateVertexNormals(model_t *model)
|
||||
float *vertPtr = frame->vertices;
|
||||
float *oldNormals;
|
||||
|
||||
M_Memcpy(newNormals, frame->normals, sizeof(float)*3*mesh->numTriangles*3);
|
||||
memcpy(newNormals, frame->normals, sizeof(float)*3*mesh->numTriangles*3);
|
||||
|
||||
for (k = 0; k < mesh->numVertices; k++)
|
||||
{
|
||||
@@ -402,7 +402,7 @@ void Optimize(model_t *model)
|
||||
char *destByte;
|
||||
char *srcByte;
|
||||
|
||||
M_Memcpy(&newMesh->uvs[uvCount],
|
||||
memcpy(&newMesh->uvs[uvCount],
|
||||
curMesh->uvs,
|
||||
sizeof(float)*2*curMesh->numTriangles*3);
|
||||
|
||||
@@ -410,13 +410,13 @@ void Optimize(model_t *model)
|
||||
|
||||
dest = (float*)newMesh->frames[0].vertices;
|
||||
src = (float*)curMesh->frames[0].vertices;
|
||||
M_Memcpy(&dest[vertCount],
|
||||
memcpy(&dest[vertCount],
|
||||
src,
|
||||
sizeof(float)*3*curMesh->numTriangles*3);
|
||||
|
||||
dest = (float*)newMesh->frames[0].normals;
|
||||
src = (float*)curMesh->frames[0].normals;
|
||||
M_Memcpy(&dest[vertCount],
|
||||
memcpy(&dest[vertCount],
|
||||
src,
|
||||
sizeof(float)*3*curMesh->numTriangles*3);
|
||||
|
||||
@@ -427,7 +427,7 @@ void Optimize(model_t *model)
|
||||
|
||||
if (srcByte)
|
||||
{
|
||||
M_Memcpy(&destByte[colorCount],
|
||||
memcpy(&destByte[colorCount],
|
||||
srcByte,
|
||||
sizeof(char)*4*curMesh->numTriangles*3);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
SINT8 gl_portal_state = GLPORTAL_OFF;
|
||||
|
||||
gl_portallist_t *currentportallist;
|
||||
gl_portallist_t *currentportallist = NULL;
|
||||
|
||||
// clip the area outside the portal destination window
|
||||
void HWR_PortalClipping(gl_portal_t *portal)
|
||||
@@ -168,8 +168,10 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float
|
||||
|
||||
// go to portal frame lmao
|
||||
HWR_PortalFrame(portal);
|
||||
|
||||
// call HWR_RenderViewpoint
|
||||
HWR_RenderPortalViewpoint(portal, player, stencil_level + 1, true);
|
||||
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
HWR_PortalFrame(rootportal);
|
||||
|
||||
@@ -201,7 +201,7 @@ static char *HWR_PreprocessShader(char *original)
|
||||
CONS_Alert(CONS_ERROR, "HWR_PreprocessShader: Syntax error in #version. Expected version with 3 digits, but got %d digits.\n", version_number_len);
|
||||
return NULL;
|
||||
}
|
||||
M_Memcpy(shader_glsl_version, read_pos, 3);
|
||||
memcpy(shader_glsl_version, read_pos, 3);
|
||||
ADVANCE(version_number_len)
|
||||
version_len = (read_pos - original) - version_pos;
|
||||
whitespace_len = strspn(read_pos, WHITESPACE_CHARS);
|
||||
@@ -304,7 +304,7 @@ static char *HWR_PreprocessShader(char *original)
|
||||
{
|
||||
strcpy(write_pos, VERSION_PART);
|
||||
write_pos += sizeof(VERSION_PART) - 1;
|
||||
M_Memcpy(write_pos, shader_glsl_version, 3);
|
||||
memcpy(write_pos, shader_glsl_version, 3);
|
||||
write_pos += 3;
|
||||
strcpy(write_pos, line_ending);
|
||||
write_pos += line_ending_len;
|
||||
@@ -344,7 +344,7 @@ static char *HWR_PreprocessShader(char *original)
|
||||
}
|
||||
|
||||
// Copy the original shader.
|
||||
M_Memcpy(write_pos, read_pos, original_len);
|
||||
memcpy(write_pos, read_pos, original_len);
|
||||
|
||||
// Erase the original #version directive, if it exists and was copied.
|
||||
if (new_len != original_len && version_pos != -1)
|
||||
@@ -573,7 +573,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
size = W_LumpLengthPwad(wadnum, lump);
|
||||
|
||||
line = Z_Malloc(size+1, PU_STATIC, NULL);
|
||||
M_Memcpy(line, shaderdef, size);
|
||||
memcpy(line, shaderdef, size);
|
||||
line[size] = '\0';
|
||||
|
||||
stoken = strtok(line, "\r\n ");
|
||||
|
||||
+128
-108
@@ -25,7 +25,7 @@
|
||||
|
||||
// Eeeeh not sure is this right way, but it works < sry :c < sry again it had to go :c
|
||||
|
||||
#if defined (HWRENDER) && !defined (NOROPENGL)
|
||||
#if defined (HWRENDER)
|
||||
|
||||
#include "../../r_fps.h" // For R_GetTimeFrac, used for the leveltime shader uniform
|
||||
|
||||
@@ -101,7 +101,7 @@ static LTListItem *LightTablesHead = NULL;
|
||||
static RGBA_t screenPalette[256] = {0}; // the palette for the postprocessing step in palette rendering
|
||||
static GLuint screenPaletteTex = 0; // 1D texture containing the screen palette
|
||||
static GLuint paletteLookupTex = 0; // 3D texture containing RGB -> palette index lookup table
|
||||
RGBA_t myPaletteData[256]; // the palette for converting textures to RGBA
|
||||
RGBA_t myPaletteData[256] = {0}; // the palette for converting textures to RGBA
|
||||
|
||||
static GLint gltexformat = GL_RGB5_A1;
|
||||
GLint screen_width = 0; // used by Draw2DLine()
|
||||
@@ -110,6 +110,7 @@ GLint screen_texsizew = 512; // Power-of-two screen texture render resolution
|
||||
GLint screen_texsizeh = 512; // Power-of-two screen texture render resolution
|
||||
GLbyte screen_depth = 0;
|
||||
GLint maximumAnisotropy = 0;
|
||||
boolean supportNPO2tex = false;
|
||||
static GLboolean MipMap = GL_FALSE;
|
||||
static GLint min_filter = GL_LINEAR;
|
||||
static GLint mag_filter = GL_LINEAR;
|
||||
@@ -127,7 +128,7 @@ int majorGL = 0, minorGL = 0;
|
||||
|
||||
//Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-)
|
||||
static GLfloat modelMatrix[16];
|
||||
GLfloat projMatrix[16];
|
||||
GLfloat projMatrix[16] = {0};
|
||||
static GLint viewport[4];
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
@@ -215,7 +216,7 @@ static const GLfloat byte2float[256] = {
|
||||
// -----------------+
|
||||
|
||||
#ifdef DEBUG_TO_FILE
|
||||
FILE *gllogstream;
|
||||
FILE *gllogstream = NULL;
|
||||
#endif
|
||||
|
||||
FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
|
||||
@@ -1137,7 +1138,6 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect)
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
|
||||
const GLfloat focallength = (GLfloat)(1.0f / (GLfloat)tan(fovy * (GLfloat)M_PIl / 360.0f));
|
||||
const GLfloat deltaZ = FAR_CLIPPING_PLANE - NEAR_CLIPPING_PLANE;
|
||||
|
||||
if ((fabsf((float)deltaZ) < 1.0E-36f) || fpclassify(aspect) == FP_ZERO)
|
||||
@@ -1145,6 +1145,8 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect)
|
||||
return;
|
||||
}
|
||||
|
||||
const GLfloat focallength = (GLfloat)(1.0f / (GLfloat)tan(fovy * (GLfloat)M_PIl / 360.0f));
|
||||
|
||||
m[0][0] = focallength / aspect;
|
||||
m[1][1] = focallength;
|
||||
m[2][2] = -(FAR_CLIPPING_PLANE + NEAR_CLIPPING_PLANE) / deltaZ;
|
||||
@@ -1176,12 +1178,20 @@ void GL_SetModelView(GLint w, GLint h)
|
||||
|
||||
screen_texsizew = screen_texsizeh = 512;
|
||||
|
||||
// look for power of two that is large enough for the screen
|
||||
while (screen_texsizew < w)
|
||||
screen_texsizew <<= 1;
|
||||
if (supportNPO2tex)
|
||||
{
|
||||
screen_texsizew = screen_width;
|
||||
screen_texsizeh = screen_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
// look for power of two that is large enough for the screen
|
||||
while (screen_texsizew < w)
|
||||
screen_texsizew <<= 1;
|
||||
|
||||
while (screen_texsizeh < h)
|
||||
screen_texsizeh <<= 1;
|
||||
while (screen_texsizeh < h)
|
||||
screen_texsizeh <<= 1;
|
||||
}
|
||||
|
||||
pglGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize); // Get the maximum supported texture size
|
||||
if ((screen_texsizew > maxtexsize || screen_texsizeh > maxtexsize) && maxtexsize > 0)
|
||||
@@ -1489,14 +1499,14 @@ void GL_ReadScreenTexture(int tex, UINT8 *restrict dest, INT32 scale)
|
||||
// -----------------+
|
||||
void GL_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
INT32 i;
|
||||
const size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
// on a palette change, you have to reload all of the textures
|
||||
if (memcmp(myPaletteData, palette, palsize))
|
||||
{
|
||||
myPaletteData[i].s = palette[i].s;
|
||||
memcpy(myPaletteData, palette, palsize);
|
||||
GL_Flush();
|
||||
}
|
||||
|
||||
GL_Flush();
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1573,11 +1583,11 @@ void GL_Draw2DLine(F2DCoord * v1, F2DCoord * v2, RGBA_t Color)
|
||||
|
||||
// This is the preferred, 'modern' way of rendering lines -- creating a polygon.
|
||||
if (fabsf(v2->x - v1->x) > FLT_EPSILON)
|
||||
angle = (float)atan((v2->y-v1->y)/(v2->x-v1->x));
|
||||
angle = atanf((v2->y-v1->y)/(v2->x-v1->x));
|
||||
else
|
||||
angle = (float)N_PI_DEMI;
|
||||
dx = (float)sin(angle) / (float)screen_width;
|
||||
dy = (float)cos(angle) / (float)screen_height;
|
||||
dx = sinf(angle) / (float)screen_width;
|
||||
dy = cosf(angle) / (float)screen_height;
|
||||
|
||||
p[0] = v1->x - dx; p[1] = -(v1->y + dy); p[2] = 1;
|
||||
p[3] = v2->x - dx; p[4] = -(v2->y + dy); p[5] = 1;
|
||||
@@ -1814,47 +1824,72 @@ static void GL_AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
}
|
||||
}
|
||||
|
||||
#define PADDING_CHECK(offset, alphaCheck) { from = to + (offset); if ((alphaCheck)) from = NULL; else goto foundFrom; }
|
||||
|
||||
static void PadRGBABitmap(RGBA_t *tex, UINT16 w, UINT16 h)
|
||||
static void PadRGBABitmap(RGBA_t *tex, UINT16 w, UINT16 h, UINT32 flags)
|
||||
{
|
||||
INT32 i;
|
||||
boolean notLeft, notRight, notTop, notBottom;
|
||||
RGBA_t *to = tex - 1, *from;
|
||||
INT32 i, c1, c2, idxAdd;
|
||||
UINT16 c1size, c2size;
|
||||
RGBA_t *current, *prev, *next, *first;
|
||||
boolean ignorePrev, wrap;
|
||||
|
||||
for (i = 0; i < w * h; i++)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
to++;
|
||||
if (to->rgba != 0)
|
||||
continue;
|
||||
from = NULL;
|
||||
c1size = i ? h : w;
|
||||
c2size = i ? w : h;
|
||||
idxAdd = i ? 1 : w;
|
||||
wrap = i ? flags & TF_WRAPX : flags & TF_WRAPY;
|
||||
|
||||
notLeft = i % w != 0;
|
||||
notRight = i % w != w - 1;
|
||||
notTop = i / w != 0;
|
||||
notBottom = i / w != h - 1;
|
||||
|
||||
if (notRight) PADDING_CHECK(1, from->s.alpha == 0) // Check +X
|
||||
if (notBottom) PADDING_CHECK(w, from->s.alpha == 0) // Check +Y
|
||||
if (notLeft) PADDING_CHECK(-1, from->s.alpha == 0) // Check -X
|
||||
if (notTop) PADDING_CHECK(-w, from->s.alpha == 0) // Check -Y
|
||||
if (notRight && notBottom) PADDING_CHECK(1 + w, from->s.alpha == 0) // Check +X+Y
|
||||
if (notLeft && notBottom) PADDING_CHECK(-1 + w, from->s.alpha == 0) // Check -X+Y
|
||||
if (notLeft && notTop) PADDING_CHECK(-1 - w, from->s.alpha == 0) // Check -X-Y
|
||||
if (notRight && notTop) PADDING_CHECK(1 - w, from->s.alpha == 0) // Check +X-Y
|
||||
|
||||
foundFrom:
|
||||
if (from != NULL)
|
||||
for (c1 = 0; c1 < c1size; c1++)
|
||||
{
|
||||
*to = *from;
|
||||
to->s.alpha = 0;
|
||||
if (i)
|
||||
{
|
||||
first = current = tex + (c1 * w);
|
||||
prev = wrap ? tex + (w - 1 + c1 * w) : current;
|
||||
next = tex + (1 + c1 * w);
|
||||
}
|
||||
else
|
||||
{
|
||||
first = current = tex + c1;
|
||||
prev = wrap ? tex + (c1 + (h - 1) * w) : current;
|
||||
next = tex + (c1 + w);
|
||||
}
|
||||
|
||||
ignorePrev = false;
|
||||
|
||||
for (c2 = 0; c2 < c2size; c2++)
|
||||
{
|
||||
if (c2 == c2size - 1)
|
||||
next = wrap ? first : current;
|
||||
|
||||
if (current->rgba)
|
||||
{
|
||||
ignorePrev = false;
|
||||
}
|
||||
else if (prev->rgba && !ignorePrev)
|
||||
{
|
||||
*current = *prev;
|
||||
current->s.alpha = 0;
|
||||
ignorePrev = true;
|
||||
}
|
||||
else if (next->rgba)
|
||||
{
|
||||
*current = *next;
|
||||
current->s.alpha = 0;
|
||||
ignorePrev = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ignorePrev = false;
|
||||
}
|
||||
|
||||
prev = current;
|
||||
current = next;
|
||||
next += idxAdd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef PADDING_CHECK
|
||||
|
||||
static void GenerateMipmaps(INT32 w, INT32 h, RGBA_t *tex, INT32 maxLOD)
|
||||
static void GenerateMipmaps(INT32 w, INT32 h, RGBA_t *tex, INT32 maxLOD, UINT32 flags)
|
||||
{
|
||||
if (tex == NULL)
|
||||
{
|
||||
@@ -1916,7 +1951,7 @@ static void GenerateMipmaps(INT32 w, INT32 h, RGBA_t *tex, INT32 maxLOD)
|
||||
h /= 2;
|
||||
|
||||
if (padTexture)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
PadRGBABitmap(tex, w, h, flags);
|
||||
|
||||
pglTexSubImage2D(GL_TEXTURE_2D, m + 1, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, tex);
|
||||
}
|
||||
@@ -1970,7 +2005,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (chromakeyed && (*pImgData == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
{
|
||||
tex[idx].s = (byteColor_t){0, 0, 0, 0};
|
||||
memset(&tex[idx].s, 0, sizeof(byteColor_t));
|
||||
pTexInfo->flags |= TF_TRANSPARENT; // there is a hole in it
|
||||
}
|
||||
else
|
||||
@@ -1982,16 +2017,15 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
|
||||
if (texinfoformat != GL_TEXFMT_AP_88)
|
||||
continue;
|
||||
if (chromakeyed)
|
||||
continue;
|
||||
|
||||
tex[idx].s.alpha = *pImgData;
|
||||
if (!chromakeyed)
|
||||
tex[idx].s.alpha = *pImgData;
|
||||
pImgData++;
|
||||
}
|
||||
}
|
||||
|
||||
if (applyPadding)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
PadRGBABitmap(tex, w, h, pTexInfo->flags);
|
||||
|
||||
break;
|
||||
case GL_TEXFMT_RGBA:
|
||||
@@ -2007,7 +2041,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
ptex = tex;
|
||||
|
||||
if (applyPadding)
|
||||
PadRGBABitmap(tex, w, h);
|
||||
PadRGBABitmap(tex, w, h, pTexInfo->flags);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -2020,9 +2054,9 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
for (i = 0; i < w; i++, idx++)
|
||||
{
|
||||
tex[idx].s.red = *pImgData;
|
||||
tex[idx].s.green = *pImgData;
|
||||
tex[idx].s.blue = *pImgData;
|
||||
tex[idx].s.red =
|
||||
tex[idx].s.green =
|
||||
tex[idx].s.blue = *pImgData;
|
||||
pImgData++;
|
||||
tex[idx].s.alpha = *pImgData;
|
||||
pImgData++;
|
||||
@@ -2052,21 +2086,10 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
pglBindTexture(GL_TEXTURE_2D, num);
|
||||
tex_downloaded = num;
|
||||
|
||||
const int transparent = (pTexInfo->flags & TF_TRANSPARENT);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
|
||||
|
||||
// disable texture filtering on any texture that has holes so there's no dumb borders or blending issues
|
||||
if (transparent)
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
}
|
||||
else
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
|
||||
}
|
||||
|
||||
if (MipMap && !transparent) // No mipmaps on transparent stuff
|
||||
if (MipMap)
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
|
||||
@@ -2077,8 +2100,16 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
|
||||
// Control the mipmap level of detail
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
|
||||
GenerateMipmaps(w, h, tex, 5);
|
||||
|
||||
if (pTexInfo->flags & TF_TRANSPARENT)
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mipmaps on transparent stuff
|
||||
}
|
||||
else
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
|
||||
GenerateMipmaps(w, h, tex, 4, pTexInfo->flags);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2459,12 +2490,10 @@ void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT i
|
||||
// the DrawPolygon variant of this has some code about polyflags and wrapping here but havent noticed any problems from omitting it?
|
||||
}
|
||||
|
||||
static const boolean gl_ext_arb_vertex_buffer_object = true;
|
||||
|
||||
#define NULL_VBO_VERTEX ((gl_skyvertex_t*)NULL)
|
||||
#define sky_vbo_x (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->x : &sky->data[0].x)
|
||||
#define sky_vbo_u (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->u : &sky->data[0].u)
|
||||
#define sky_vbo_r (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->r : &sky->data[0].r)
|
||||
//#define NULL_VBO_VERTEX ((gl_skyvertex_t*)NULL)
|
||||
#define sky_vbo_x ((void*)offsetof(gl_skyvertex_t, x))
|
||||
#define sky_vbo_u ((void*)offsetof(gl_skyvertex_t, u))
|
||||
#define sky_vbo_r ((void*)offsetof(gl_skyvertex_t, r))
|
||||
|
||||
void GL_RenderSkyDome(gl_sky_t *sky)
|
||||
{
|
||||
@@ -2476,30 +2505,23 @@ void GL_RenderSkyDome(gl_sky_t *sky)
|
||||
if (sky->rebuild)
|
||||
{
|
||||
// delete VBO when already exists
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
{
|
||||
if (sky->vbo)
|
||||
pglDeleteBuffers(1, &sky->vbo);
|
||||
}
|
||||
if (sky->vbo)
|
||||
pglDeleteBuffers(1, &sky->vbo);
|
||||
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
{
|
||||
// generate a new VBO and get the associated ID
|
||||
pglGenBuffers(1, &sky->vbo);
|
||||
// generate a new VBO and get the associated ID
|
||||
pglGenBuffers(1, &sky->vbo);
|
||||
|
||||
// bind VBO in order to use
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, sky->vbo);
|
||||
// bind VBO in order to use
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, sky->vbo);
|
||||
|
||||
// upload data to VBO
|
||||
pglBufferData(GL_ARRAY_BUFFER, sky->vertex_count * sizeof(sky->data[0]), sky->data, GL_STATIC_DRAW);
|
||||
}
|
||||
// upload data to VBO
|
||||
pglBufferData(GL_ARRAY_BUFFER, sky->vertex_count * sizeof(sky->data[0]), sky->data, GL_STATIC_DRAW);
|
||||
|
||||
sky->rebuild = false;
|
||||
}
|
||||
|
||||
// bind VBO in order to use
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, sky->vbo);
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, sky->vbo);
|
||||
|
||||
// activate and specify pointers to arrays
|
||||
pglVertexPointer(3, GL_FLOAT, sizeof(sky->data[0]), sky_vbo_x);
|
||||
@@ -2543,8 +2565,7 @@ void GL_RenderSkyDome(gl_sky_t *sky)
|
||||
pglColor4ubv(white);
|
||||
|
||||
// bind with 0, so, switch back to normal pointer operation
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// deactivate color array
|
||||
pglDisableClientState(GL_COLOR_ARRAY);
|
||||
@@ -3115,8 +3136,8 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
|
||||
void GL_SetTransform(FTransform *stransform)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
GLdouble used_fov;
|
||||
boolean shearing = false;
|
||||
float used_fov;
|
||||
|
||||
pglLoadIdentity();
|
||||
|
||||
@@ -3166,7 +3187,8 @@ void GL_SetTransform(FTransform *stransform)
|
||||
{
|
||||
float dy = stransform->viewaiming * 2;
|
||||
|
||||
if (stransform->fliptype == TRANSFORM_FLIP || stransform->fliptype == TRANSFORM_MIRRORFLIP)
|
||||
if (stransform->fliptype == TRANSFORM_FLIP
|
||||
|| stransform->fliptype == TRANSFORM_MIRRORFLIP)
|
||||
dy *= -1.0f;
|
||||
|
||||
pglTranslatef(0.0f, -dy/BASEVIDHEIGHT, 0.0f);
|
||||
@@ -3174,11 +3196,11 @@ void GL_SetTransform(FTransform *stransform)
|
||||
|
||||
if (special_splitscreen)
|
||||
{
|
||||
used_fov = (float)(atan(tan(used_fov * M_PIl / 360) * 0.8) * 360 / M_PIl);
|
||||
GL_Perspective((GLfloat)used_fov, 2*ASPECT_RATIO);
|
||||
used_fov = (atanf(tanf(used_fov * (float)M_PI / 360.0f) * 0.8f) * 360.0f / (float)M_PI);
|
||||
GL_Perspective(used_fov, 2*ASPECT_RATIO);
|
||||
}
|
||||
else
|
||||
GL_Perspective((GLfloat)used_fov, ASPECT_RATIO);
|
||||
GL_Perspective(used_fov, ASPECT_RATIO);
|
||||
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
@@ -3692,7 +3714,6 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen
|
||||
FRGBAFloat clearColour;
|
||||
|
||||
static float off[12];
|
||||
static float fix[8];
|
||||
@@ -3743,8 +3764,7 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
|
||||
|
||||
pglViewport(0, 0, width, height);
|
||||
|
||||
clearColour.red = clearColour.green = clearColour.blue = 0;
|
||||
clearColour.alpha = 1;
|
||||
FRGBAFloat clearColour = {0, 0, 0, 1};
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
GL_SetBlend(PF_NoDepthTest);
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ extern GLint screen_width;
|
||||
extern GLint screen_height;
|
||||
extern GLbyte screen_depth;
|
||||
extern GLint maximumAnisotropy;
|
||||
extern boolean supportNPO2tex;
|
||||
extern boolean supportMipMap;
|
||||
|
||||
/** \brief OpenGL flags for video driver
|
||||
|
||||
+27
-26
@@ -68,32 +68,32 @@
|
||||
//-------------------------------------------
|
||||
// heads up font
|
||||
//-------------------------------------------
|
||||
patch_t *hu_font[HU_FONTSIZE];
|
||||
patch_t *kart_font[KART_FONTSIZE]; // SRB2kart
|
||||
patch_t *tny_font[HU_FONTSIZE];
|
||||
patch_t *tallnum[10]; // 0-9
|
||||
patch_t *hu_font[HU_FONTSIZE] = {};
|
||||
patch_t *kart_font[KART_FONTSIZE] = {}; // SRB2kart
|
||||
patch_t *tny_font[HU_FONTSIZE] = {};
|
||||
patch_t *tallnum[10] = {}; // 0-9
|
||||
|
||||
// Level title and credits fonts
|
||||
patch_t *lt_font[LT_FONTSIZE];
|
||||
patch_t *cred_font[CRED_FONTSIZE];
|
||||
patch_t *lt_font[LT_FONTSIZE] = {};
|
||||
patch_t *cred_font[CRED_FONTSIZE] = {};
|
||||
|
||||
// ping font
|
||||
// Note: I'd like to adress that at this point we might *REALLY* want to work towards a common drawString function that can take any font we want because this is really turning into a MESS. :V -Lat'
|
||||
patch_t *pingnum[10];
|
||||
patch_t *pinggfx[5]; // small ping graphic
|
||||
patch_t *pingmeasure[2]; // ping measurement graphic
|
||||
patch_t *pingnum[10] = {};
|
||||
patch_t *pinggfx[5] = {}; // small ping graphic
|
||||
patch_t *pingmeasure[2] = {}; // ping measurement graphic
|
||||
|
||||
patch_t *ranknum[10]; // rank numbers
|
||||
patch_t *ranknum[10] = {}; // rank numbers
|
||||
|
||||
patch_t *framecounter;
|
||||
patch_t *frameslash; // framerate stuff. Used in screen.c
|
||||
patch_t *framecounter = NULL;
|
||||
patch_t *frameslash = NULL; // framerate stuff. Used in screen.c
|
||||
|
||||
static player_t *plr;
|
||||
boolean chat_on; // entering a chat message?
|
||||
static player_t *plr = NULL;
|
||||
boolean chat_on = false; // entering a chat message?
|
||||
static char w_chat_buf[HU_MAXMSGLEN + 1];
|
||||
static textinput_t w_chat;
|
||||
static boolean headsupactive = false;
|
||||
boolean hu_showscores; // draw rankings
|
||||
boolean hu_showscores = false; // draw rankings
|
||||
static char hu_tick;
|
||||
static tic_t hu_emoteanim = 0;
|
||||
#define MAXEMOTESUGGESTIONS 8
|
||||
@@ -101,14 +101,14 @@ static emote_t *emote_suggestions[MAXEMOTESUGGESTIONS] = {0};
|
||||
|
||||
static huddrawlist_h luahuddrawlist_scores;
|
||||
|
||||
patch_t *rflagico;
|
||||
patch_t *bflagico;
|
||||
patch_t *rmatcico;
|
||||
patch_t *bmatcico;
|
||||
patch_t *tallminus;
|
||||
patch_t *rflagico = NULL;
|
||||
patch_t *bflagico = NULL;
|
||||
patch_t *rmatcico = NULL;
|
||||
patch_t *bmatcico = NULL;
|
||||
patch_t *tallminus = NULL;
|
||||
|
||||
// song credits
|
||||
static patch_t *songcreditbg;
|
||||
static patch_t *songcreditbg = NULL;
|
||||
|
||||
// -------
|
||||
// protos.
|
||||
@@ -122,7 +122,7 @@ consvar_t cv_showspecstuff = {"showspecstuff", "No", CV_SAVE, CV_YesNo, NULL, 0,
|
||||
// KEYBOARD LAYOUTS FOR ENTERING TEXT
|
||||
//======================================================================
|
||||
|
||||
char *shiftxform;
|
||||
char *shiftxform = NULL;
|
||||
|
||||
char english_shiftxform[] =
|
||||
{
|
||||
@@ -280,7 +280,7 @@ static void Command_Say_f(void);
|
||||
static void Command_Sayto_f(void);
|
||||
static void Command_Sayteam_f(void);
|
||||
static void Command_CSay_f(void);
|
||||
static void Got_Saycmd(UINT8 **p, INT32 playernum);
|
||||
static void Got_Saycmd(const UINT8 **p, INT32 playernum);
|
||||
|
||||
void HU_LoadGraphics(void)
|
||||
{
|
||||
@@ -879,11 +879,12 @@ const char *HU_SkinColorToConsoleColor(skincolors_t color)
|
||||
* \sa DoSayCommand
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
{
|
||||
SINT8 target;
|
||||
UINT8 flags;
|
||||
const char *dispname;
|
||||
char buf[HU_MAXMSGLEN + 1];
|
||||
char *msg;
|
||||
boolean action = false;
|
||||
char *ptr;
|
||||
@@ -893,8 +894,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
|
||||
target = READSINT8(*p);
|
||||
flags = READUINT8(*p);
|
||||
msg = (char *)*p;
|
||||
SKIPSTRINGL(*p, HU_MAXMSGLEN + 1);
|
||||
msg = buf;
|
||||
READSTRINGL(*p, msg, HU_MAXMSGLEN + 1);
|
||||
|
||||
if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
|
||||
{
|
||||
|
||||
@@ -41,11 +41,6 @@ typedef enum {
|
||||
*/
|
||||
extern UINT8 sound_started;
|
||||
|
||||
/** \brief info of samplerate
|
||||
*/
|
||||
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||
extern consvar_t cv_samplerate;
|
||||
#endif
|
||||
|
||||
/** \brief The I_GetSfx function
|
||||
|
||||
|
||||
@@ -61,10 +61,6 @@ precise_t I_GetPreciseTime(void);
|
||||
*/
|
||||
UINT64 I_GetPrecisePrecision(void);
|
||||
|
||||
/** \brief Get the current time in rendering tics, including fractions.
|
||||
*/
|
||||
double I_GetFrameTime(void);
|
||||
|
||||
/** \brief Sleeps for the given duration in milliseconds. Depending on the
|
||||
operating system's scheduler, the calling thread may give up its
|
||||
time slice for a longer duration. The implementation should give a
|
||||
@@ -221,10 +217,6 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
|
||||
*/
|
||||
const char *I_LocateWad(void);
|
||||
|
||||
/** \brief Joystick events
|
||||
*/
|
||||
void I_GetJoystickEvents(UINT8 index);
|
||||
|
||||
char *I_GetEnv(const char *name);
|
||||
|
||||
INT32 I_PutEnv(char *variable);
|
||||
|
||||
+3
-4
@@ -635,7 +635,7 @@ static boolean SOCK_Get(void)
|
||||
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
|
||||
(void *)&fromaddress, &fromlen);
|
||||
|
||||
if (c != ERRSOCKET)
|
||||
if (c > 0)
|
||||
{
|
||||
#ifdef USE_STUN
|
||||
if (STUN_got_response(doomcom->data, c))
|
||||
@@ -649,7 +649,6 @@ static boolean SOCK_Get(void)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// find remote node number
|
||||
for (j = 1; j <= MAXNETNODES; j++) // include LAN
|
||||
{
|
||||
@@ -670,7 +669,7 @@ static boolean SOCK_Get(void)
|
||||
{
|
||||
const time_t curTime = time(NULL);
|
||||
|
||||
M_Memcpy(&clientaddress[j], &fromaddress, fromlen);
|
||||
memcpy(&clientaddress[j], &fromaddress, fromlen);
|
||||
nodesocket[j] = mysockets[n];
|
||||
DEBFILE(va("New node detected: node:%d address:%s\n", j,
|
||||
SOCK_GetNodeAddress(j)));
|
||||
@@ -1485,7 +1484,7 @@ static boolean SOCK_Ban(INT32 node)
|
||||
ban = numbans;
|
||||
AddBannedIndex();
|
||||
|
||||
M_Memcpy(&banned[ban].address, &clientaddress[node], sizeof (mysockaddr_t));
|
||||
memcpy(&banned[ban].address, &clientaddress[node], sizeof (mysockaddr_t));
|
||||
|
||||
if (banned[ban].address.any.sa_family == AF_INET)
|
||||
{
|
||||
|
||||
+4
-1
@@ -63,7 +63,10 @@ void I_UpdateTime(fixed_t timescale)
|
||||
ticratescaled = (double)((float)TICRATE * FixedToFloat(timescale));
|
||||
|
||||
enterprecise = I_GetPreciseTime();
|
||||
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();
|
||||
const precise_t elapsed = enterprecise - oldenterprecise;
|
||||
const UINT64 precision = I_GetPrecisePrecision();
|
||||
// explictily do this in double precision
|
||||
elapsedseconds = (double)elapsed / (double)precision;
|
||||
tictimer += elapsedseconds;
|
||||
while (tictimer > 1.0/ticratescaled)
|
||||
{
|
||||
|
||||
@@ -143,6 +143,8 @@ boolean I_CheckNativeRes(void);
|
||||
|
||||
void I_SetBorderlessWindow(void);
|
||||
|
||||
void I_HandleControllerHatRepeat(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
|
||||
+4
-4
@@ -2860,9 +2860,9 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
|
||||
v[3] = FRACUNIT;
|
||||
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
|
||||
finalx = x + v[0];
|
||||
finaly = y + v[1];
|
||||
@@ -6479,7 +6479,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
}
|
||||
player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds
|
||||
|
||||
if (P_IsLocalPlayer(player) && cv_supermusic.value == 1 && cv_birdmusic.value)
|
||||
if (cv_supermusic.value == 1 && P_IsLocalPlayer(player))
|
||||
S_ChangeMusicSpecial("kinvnc");
|
||||
|
||||
P_RestoreMusic(player);
|
||||
@@ -6683,7 +6683,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
|
||||
player->mo->destscale = (6*player->mo->destscale)/8;
|
||||
player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds
|
||||
if (P_IsLocalPlayer(player) && cv_growmusic.value == 1 && cv_birdmusic.value )
|
||||
if (cv_growmusic.value == 1 && P_IsLocalPlayer(player))
|
||||
S_ChangeMusicSpecial("kgrow");
|
||||
P_RestoreMusic(player);
|
||||
S_StartSound(player->mo, sfx_kc5a);
|
||||
|
||||
+64
-43
@@ -45,27 +45,33 @@ boolean luaL_checkboolean(lua_State *L, int narg) {
|
||||
// String concatination
|
||||
static int lib_concat(lua_State *L)
|
||||
{
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
int i;
|
||||
char *r = NULL;
|
||||
size_t rl = 0,sl;
|
||||
lua_getglobal(L, "tostring");
|
||||
for (i=1; i<=n; i++) {
|
||||
const char *s;
|
||||
lua_pushvalue(L, -1); /* function to be called */
|
||||
lua_pushvalue(L, i); /* value to print */
|
||||
lua_call(L, 1, 1);
|
||||
s = lua_tolstring(L, -1, &sl); /* get result */
|
||||
if (s == NULL)
|
||||
return luaL_error(L, LUA_QL("tostring") " must return a string to "
|
||||
LUA_QL("__add"));
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
int i;
|
||||
char *r = NULL;
|
||||
size_t rl = 0, sl;
|
||||
lua_getglobal(L, "tostring");
|
||||
for (i=1; i<=n; i++) {
|
||||
const char *s;
|
||||
lua_pushvalue(L, -1); /* function to be called */
|
||||
lua_pushvalue(L, i); /* value to print */
|
||||
lua_call(L, 1, 1);
|
||||
s = lua_tolstring(L, -1, &sl); /* get result */
|
||||
|
||||
if (sl == 0) {
|
||||
lua_pop(L, 1); /* pop result */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (s == NULL)
|
||||
return luaL_error(L, LUA_QL("tostring") " must return a string to "
|
||||
LUA_QL("__add"));
|
||||
r = Z_Realloc(r, rl+sl, PU_STATIC, NULL);
|
||||
M_Memcpy(r+rl, s, sl);
|
||||
memcpy(r+rl, s, sl);
|
||||
rl += sl;
|
||||
lua_pop(L, 1); /* pop result */
|
||||
}
|
||||
lua_pushlstring(L, r, rl);
|
||||
Z_Free(r);
|
||||
lua_pop(L, 1); /* pop result */
|
||||
}
|
||||
lua_pushlstring(L, r, rl);
|
||||
Z_Free(r);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -73,23 +79,24 @@ static int lib_concat(lua_State *L)
|
||||
// Copied from base Lua code
|
||||
static int lib_print(lua_State *L)
|
||||
{
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
int i;
|
||||
//HUDSAFE
|
||||
lua_getglobal(L, "tostring");
|
||||
for (i=1; i<=n; i++) {
|
||||
const char *s;
|
||||
lua_pushvalue(L, -1); /* function to be called */
|
||||
lua_pushvalue(L, i); /* value to print */
|
||||
lua_call(L, 1, 1);
|
||||
s = lua_tostring(L, -1); /* get result */
|
||||
if (s == NULL)
|
||||
return luaL_error(L, LUA_QL("tostring") " must return a string to "
|
||||
LUA_QL("print"));
|
||||
if (i>1) CONS_Printf("\n");
|
||||
CONS_Printf("%s", s);
|
||||
lua_pop(L, 1); /* pop result */
|
||||
}
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
int i;
|
||||
//HUDSAFE
|
||||
lua_getglobal(L, "tostring");
|
||||
for (i=1; i<=n; i++) {
|
||||
const char *s;
|
||||
lua_pushvalue(L, -1); /* function to be called */
|
||||
lua_pushvalue(L, i); /* value to print */
|
||||
lua_call(L, 1, 1);
|
||||
s = lua_tostring(L, -1); /* get result */
|
||||
|
||||
if (s == NULL)
|
||||
return luaL_error(L, LUA_QL("tostring") " must return a string to "
|
||||
LUA_QL("print"));
|
||||
if (i>1) CONS_Printf("\n");
|
||||
CONS_Printf("%s", s);
|
||||
lua_pop(L, 1); /* pop result */
|
||||
}
|
||||
CONS_Printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -377,7 +384,9 @@ static int lib_pSpawnMobj(lua_State *L)
|
||||
NOHUD
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
|
||||
mobj_t *th = P_SpawnMobj(x, y, z, type);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -403,7 +412,9 @@ static int lib_pSpawnMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ);
|
||||
mobj_t *th = P_SpawnMissile(source, dest, type);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -420,7 +431,9 @@ static int lib_pSpawnXYZMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ);
|
||||
mobj_t *th = P_SpawnXYZMissile(source, dest, type, x, y, z);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -439,7 +452,9 @@ static int lib_pSpawnPointMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ);
|
||||
mobj_t *th = P_SpawnPointMissile(source, xa, ya, za, type, x, y, z);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -456,7 +471,9 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ);
|
||||
mobj_t *th = P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -485,7 +502,9 @@ static int lib_pSPMAngle(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ);
|
||||
mobj_t *th = P_SPMAngle(source, type, angle, allowaim, flags2);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -499,7 +518,9 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ);
|
||||
mobj_t *th = P_SpawnPlayerMissile(source, type, flags2);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+61
-56
@@ -28,13 +28,29 @@
|
||||
|
||||
#define NOHUD if (hud_running) return luaL_error(L, "HUD rendering code should not call this function!");
|
||||
|
||||
static const char *cvname = NULL;
|
||||
static consvar_t *this_cvar;
|
||||
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
||||
static void clear_lua_stack(void)
|
||||
{
|
||||
if (gL) // check if Lua is actually turned on first, you dummmy -- Monster Iestyn 04/07/18
|
||||
lua_settop(gL, 0); // clear stack
|
||||
}
|
||||
|
||||
void Got_Luacmd(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT8 i, argc, flags;
|
||||
const char *argv[256];
|
||||
char buf[256];
|
||||
|
||||
argc = READUINT8(*cp);
|
||||
argv[0] = (const char*)*cp;
|
||||
SKIPSTRINGN(*cp, 255);
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
argv[i] = (const char*)*cp;
|
||||
SKIPSTRINGN(*cp, 255);
|
||||
}
|
||||
|
||||
// don't use I_Assert here, goto the deny code below
|
||||
// to clean up and kick people who try nefarious exploits
|
||||
// like sending random junk lua commands to crash the server
|
||||
@@ -47,8 +63,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "COM_Command"); // push COM_Command
|
||||
if (!lua_istable(gL, -1)) goto deny;
|
||||
|
||||
argc = READUINT8(*cp);
|
||||
READSTRINGN(*cp, buf, 255);
|
||||
strlcpy(buf, argv[0], 255);
|
||||
strlwr(buf); // must lowercase buffer
|
||||
lua_getfield(gL, -1, buf); // push command info table
|
||||
if (!lua_istable(gL, -1)) goto deny;
|
||||
@@ -74,10 +89,17 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
lua_remove(gL, -2); // pop command info table
|
||||
|
||||
if (!lua_checkstack(gL, argc)) // player + command arguments
|
||||
{
|
||||
clear_lua_stack();
|
||||
CONS_Alert(CONS_WARNING, "lua command stack overflow from %s (%d, need %d more)\n", player_names[playernum], lua_gettop(gL), argc);
|
||||
return;
|
||||
}
|
||||
|
||||
LUA_PushUserdata(gL, &players[playernum], META_PLAYER);
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
READSTRINGN(*cp, buf, 255);
|
||||
strlcpy(buf, argv[i], 255);
|
||||
lua_pushstring(gL, buf);
|
||||
}
|
||||
LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too.
|
||||
@@ -88,8 +110,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
deny:
|
||||
//must be hacked/buggy client
|
||||
if (gL) // check if Lua is actually turned on first, you dummmy -- Monster Iestyn 04/07/18
|
||||
lua_settop(gL, 0); // clear stack
|
||||
clear_lua_stack();
|
||||
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
@@ -133,7 +154,7 @@ void COM_Lua_f(void)
|
||||
{
|
||||
if (!splitscreen)
|
||||
{
|
||||
lua_pop(gL, 1); // pop command info table
|
||||
lua_pop(gL, 2); // pop command info table and LUA_GetErrorMessage
|
||||
return; // can't execute splitscreen command without player 2!
|
||||
}
|
||||
|
||||
@@ -178,6 +199,13 @@ void COM_Lua_f(void)
|
||||
I_Assert(lua_isfunction(gL, -1));
|
||||
lua_remove(gL, -2); // pop command info table
|
||||
|
||||
if (!lua_checkstack(gL, COM_Argc() + 1))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "lua command stack overflow (%d, need %s more)\n", lua_gettop(gL), sizeu1(COM_Argc() + 1));
|
||||
lua_pop(gL, 2); // pop function and LUA_GetErrorMessage
|
||||
return;
|
||||
}
|
||||
|
||||
LUA_PushUserdata(gL, &players[playernum], META_PLAYER);
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
lua_pushstring(gL, COM_Argv(i));
|
||||
@@ -284,16 +312,13 @@ static int lib_comBufInsertText(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LUA_CVarChanged(const char *name)
|
||||
void LUA_CVarChanged(void *cvar)
|
||||
{
|
||||
cvname = name;
|
||||
this_cvar = cvar;
|
||||
}
|
||||
|
||||
static void Lua_OnChange(void)
|
||||
{
|
||||
I_Assert(gL != NULL);
|
||||
I_Assert(cvname != NULL);
|
||||
|
||||
/// \todo Network this! XD_LUAVAR
|
||||
|
||||
// Why?..
|
||||
@@ -305,13 +330,10 @@ static void Lua_OnChange(void)
|
||||
// From CV_OnChange registry field, get the function for this cvar by name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "CV_OnChange");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_getfield(gL, -1, cvname); // get function
|
||||
lua_pushlightuserdata(gL, this_cvar);
|
||||
lua_rawget(gL, -2); // get function
|
||||
|
||||
// From the CV_Vars registry field, get the cvar's userdata by name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "CV_Vars");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_getfield(gL, -1, cvname); // get consvar_t* userdata.
|
||||
lua_remove(gL, -2); // pop the CV_Vars table.
|
||||
LUA_RawPushUserdata(gL, this_cvar);
|
||||
|
||||
LUA_Call(gL, 1, 0, error_handler_i); // call function(cvar)
|
||||
lua_pop(gL, 2); // pop CV_OnChange table and error handler
|
||||
@@ -329,9 +351,8 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one.
|
||||
NOHUD
|
||||
cvar = lua_newuserdata(L, sizeof(consvar_t));
|
||||
luaL_getmetatable(L, META_CVAR);
|
||||
lua_setmetatable(L, -2);
|
||||
cvar = ZZ_Calloc(sizeof(consvar_t));
|
||||
LUA_PushUserdata(L, cvar, META_CVAR);
|
||||
|
||||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e);
|
||||
#define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1)))
|
||||
@@ -384,7 +405,7 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "CV_PossibleValue");
|
||||
I_Assert(lua_istable(L, 5));
|
||||
lua_pushvalue(L, 2); // cvar userdata
|
||||
lua_pushlightuserdata(L, cvar);
|
||||
cvpv = lua_newuserdata(L, sizeof(CV_PossibleValue_t) * (count+1));
|
||||
lua_rawset(L, 5);
|
||||
lua_pop(L, 1); // pop CV_PossibleValue registry table
|
||||
@@ -412,13 +433,14 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
TYPEERROR("func", LUA_TFUNCTION)
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "CV_OnChange");
|
||||
I_Assert(lua_istable(L, 5));
|
||||
lua_pushlightuserdata(L, cvar);
|
||||
lua_pushvalue(L, 4);
|
||||
lua_setfield(L, 5, cvar->name);
|
||||
lua_rawset(L, 5);
|
||||
lua_pop(L, 1);
|
||||
cvar->func = Lua_OnChange;
|
||||
}
|
||||
else if (((i == 5 && !(cvar->flags & CV_CALL))
|
||||
|| (cvar->flags & CV_CALL && i == 6))
|
||||
|| (cvar->flags & CV_CALL && i == 6))
|
||||
|| (k && fasticmp(k, "category")))
|
||||
{
|
||||
category = lua_isnoneornil(L, 4) ? NULL : lua_tostring(L, 4);
|
||||
@@ -434,18 +456,12 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
#undef FIELDERROR
|
||||
#undef TYPEERROR
|
||||
|
||||
// stack: cvar table, cvar userdata
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars");
|
||||
I_Assert(lua_istable(L, 3));
|
||||
|
||||
lua_getfield(L, 3, cvar->name);
|
||||
if (lua_type(L, -1) != LUA_TNIL)
|
||||
return luaL_error(L, M_GetText("Variable %s is already defined\n"), cvar->name);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushvalue(L, 2);
|
||||
lua_setfield(L, 3, cvar->name);
|
||||
lua_pop(L, 1);
|
||||
if (!cvar->name)
|
||||
return luaL_error(L, M_GetText("Variable has no name!\n"));
|
||||
if ((cvar->flags & CV_NOINIT) && !(cvar->flags & CV_CALL))
|
||||
return luaL_error(L, M_GetText("Variable %s has CV_NOINIT without CV_CALL\n"), cvar->name);
|
||||
if ((cvar->flags & CV_CALL) && !cvar->func)
|
||||
return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name);
|
||||
|
||||
// actually time to register it to the console now! Finally!
|
||||
cvar->flags |= CV_MODIFIED;
|
||||
@@ -477,22 +493,9 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
|
||||
static int lib_cvFindVar(lua_State *L)
|
||||
{
|
||||
consvar_t *cv;
|
||||
if (( cv = CV_FindVar(luaL_checkstring(L,1)) ))
|
||||
{
|
||||
lua_settop(L,1);/* We only want one argument in the stack. */
|
||||
lua_pushlightuserdata(L, cv);/* Now the second value on stack. */
|
||||
luaL_getmetatable(L, META_CVAR);
|
||||
/*
|
||||
The metatable is the last value on the stack, so this
|
||||
applies it to the second value, which is the cvar.
|
||||
*/
|
||||
lua_setmetatable(L,2);
|
||||
lua_pushvalue(L,2);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
const char *name = luaL_checkstring(L, 1);
|
||||
LUA_PushUserdata(L, CV_FindVar(name), META_CVAR);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int CVarSetFunction
|
||||
@@ -501,7 +504,7 @@ static int CVarSetFunction
|
||||
void (*Set)(consvar_t *, const char *),
|
||||
void (*SetValue)(consvar_t *, INT32)
|
||||
){
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
||||
|
||||
switch (lua_type(L, 2))
|
||||
{
|
||||
@@ -530,7 +533,8 @@ static int lib_cvStealthSet(lua_State *L)
|
||||
|
||||
static int lib_cvAddValue(lua_State *L)
|
||||
{
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
||||
|
||||
CV_AddValue(cvar, (INT32)luaL_checknumber(L, 2));
|
||||
return 0;
|
||||
}
|
||||
@@ -545,6 +549,7 @@ static int lib_consPrintf(lua_State *L)
|
||||
if (n < 2)
|
||||
return luaL_error(L, "CONS_Printf requires at least two arguments: player and text.");
|
||||
//HUDSAFE
|
||||
|
||||
plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!plr)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
@@ -605,7 +610,7 @@ static int cvar_fields_ref = LUA_NOREF;
|
||||
|
||||
static int cvar_get(lua_State *L)
|
||||
{
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
||||
enum cvar_e field = Lua_optoption(L, 2, -1, cvar_fields_ref);
|
||||
|
||||
switch (field)
|
||||
|
||||
@@ -109,6 +109,7 @@ ENUM (STRING_HOOK);
|
||||
|
||||
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;
|
||||
extern bool hook_important;
|
||||
|
||||
void LUA_HookVoid(int hook);
|
||||
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
|
||||
|
||||
+26
-4
@@ -19,6 +19,7 @@
|
||||
#include "b_bot.h"
|
||||
#include "z_zone.h"
|
||||
#include "m_perfstats.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
@@ -39,14 +40,20 @@ LIST (stringHookNames, STRING_HOOK_LIST);
|
||||
|
||||
#undef LIST
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
bool important;
|
||||
} hookinfo_t;
|
||||
|
||||
typedef struct {
|
||||
int numHooks;
|
||||
int *ids;
|
||||
hookinfo_t *ids;
|
||||
} hook_t;
|
||||
|
||||
typedef struct {
|
||||
int numGeneric;
|
||||
int ref;
|
||||
bool important;
|
||||
} stringhook_t;
|
||||
|
||||
static hook_t hookIds[HOOK(MAX)];
|
||||
@@ -56,6 +63,8 @@ static hook_t mobjHookIds[NUMMOBJTYPES][MOBJ_HOOK(MAX)];
|
||||
// Lua tables are used to lookup string hook ids.
|
||||
static stringhook_t stringHooks[STRING_HOOK(MAX)];
|
||||
|
||||
bool hook_important = true;
|
||||
|
||||
// This will be indexed by hook id, the value of which fetches the registry.
|
||||
static int * hookRefs;
|
||||
static int nextid;
|
||||
@@ -109,7 +118,11 @@ static void get_table(lua_State *L)
|
||||
|
||||
FUNCINLINE static ATTRINLINE void add_hook_to_table(lua_State *L, int n)
|
||||
{
|
||||
lua_newtable(L);
|
||||
lua_pushnumber(L, nextid);
|
||||
lua_rawseti(L, -2, 1);
|
||||
lua_pushboolean(L, wadfiles[numwadfiles-1]->important);
|
||||
lua_rawseti(L, -2, 2);
|
||||
lua_rawseti(L, -2, n);
|
||||
}
|
||||
|
||||
@@ -180,7 +193,8 @@ FUNCINLINE static ATTRINLINE void add_hook(hook_t *map)
|
||||
{
|
||||
Z_Realloc(map->ids, (map->numHooks + 1) * sizeof *map->ids,
|
||||
PU_STATIC, &map->ids);
|
||||
map->ids[map->numHooks++] = nextid;
|
||||
map->ids[map->numHooks].important = wadfiles[numwadfiles-1]->important;
|
||||
map->ids[map->numHooks++].id = nextid;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void add_mobj_hook(lua_State *L, int hook_type)
|
||||
@@ -287,6 +301,7 @@ struct Hook_State {
|
||||
const char * string;/* used to fetch table, ran first if set */
|
||||
int top;/* index of last argument passed to hook */
|
||||
int id;/* id to fetch ref */
|
||||
boolean important;/* is this hook from local addon */
|
||||
int values;/* num arguments passed to hook */
|
||||
int results;/* num values returned by hook */
|
||||
Hook_Callback results_handler;/* callback when hook successfully returns */
|
||||
@@ -416,22 +431,29 @@ FUNCINLINE static ATTRINLINE void init_hook_call
|
||||
hook->results_handler = results_handler;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void get_hook(Hook_State *hook, const int *ids, int n)
|
||||
FUNCINLINE static ATTRINLINE void get_hook(Hook_State *hook, const hookinfo_t *ids, int n)
|
||||
{
|
||||
hook->id = ids[n];
|
||||
hook->id = ids[n].id;
|
||||
hook->important = ids[n].important;
|
||||
lua_getref(gL, hookRefs[hook->id]);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void get_hook_from_table(Hook_State *hook, int n)
|
||||
{
|
||||
lua_rawgeti(gL, -1, n);
|
||||
lua_rawgeti(gL, -1, 1);
|
||||
hook->id = lua_tonumber(gL, -1);
|
||||
lua_pop(gL, 1);
|
||||
lua_rawgeti(gL, -2, 2);
|
||||
hook->important = lua_toboolean(gL, -1);
|
||||
lua_pop(gL, 2);
|
||||
lua_getref(gL, hookRefs[hook->id]);
|
||||
}
|
||||
|
||||
static int call_single_hook_no_copy(Hook_State *hook)
|
||||
{
|
||||
hook_important = hook->important;
|
||||
|
||||
if (lua_pcall(gL, hook->values, hook->results, EINDEX) == 0)
|
||||
{
|
||||
if (hook->results > 0)
|
||||
|
||||
+23
-4
@@ -41,7 +41,7 @@ lua_State *gL = NULL;
|
||||
// Mathlib global state
|
||||
static lua_State *mL = NULL;
|
||||
|
||||
int hook_defrosting;
|
||||
int hook_defrosting = 0;
|
||||
|
||||
// List of internal libraries to load from SRB2
|
||||
static lua_CFunction liblist[] = {
|
||||
@@ -492,25 +492,37 @@ void LUA_InvalidateMathlibCache(const char *name)
|
||||
// Pushes it to the stack and stores it in the registry.
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta)
|
||||
{
|
||||
if (LUA_RawPushUserdata(L, data) == LPUSHED_NEW)
|
||||
{
|
||||
luaL_getmetatable(L, meta);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
}
|
||||
|
||||
// Same as LUA_PushUserdata but don't set a metatable yet.
|
||||
lpushed_t LUA_RawPushUserdata(lua_State *L, void *data)
|
||||
{
|
||||
lpushed_t status = LPUSHED_NIL;
|
||||
|
||||
void **userdata;
|
||||
|
||||
if (!data) { // push a NULL
|
||||
lua_pushnil(L);
|
||||
return;
|
||||
return status;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_VALID);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
||||
lua_pushlightuserdata(L, data);
|
||||
lua_rawget(L, -2);
|
||||
|
||||
if (lua_isnil(L, -1)) { // no userdata? deary me, we'll have to make one.
|
||||
lua_pop(L, 1); // pop the nil
|
||||
|
||||
// create the userdata
|
||||
userdata = lua_newuserdata(L, sizeof(void *));
|
||||
*userdata = data;
|
||||
luaL_getmetatable(L, meta);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
// Set it in the registry so we can find it again
|
||||
lua_pushlightuserdata(L, data); // k (store the userdata via the data's pointer)
|
||||
@@ -518,8 +530,15 @@ void LUA_PushUserdata(lua_State *L, void *data, const char *meta)
|
||||
lua_rawset(L, -4);
|
||||
|
||||
// stack is left with the userdata on top, as if getting it had originally succeeded.
|
||||
|
||||
status = LPUSHED_NEW;
|
||||
}
|
||||
else
|
||||
status = LPUSHED_EXISTING;
|
||||
|
||||
lua_remove(L, -2); // remove LREG_VALID
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// When userdata is freed, use this function to remove it from Lua.
|
||||
|
||||
+10
-2
@@ -59,7 +59,15 @@ fixed_t LUA_GetConstant(const char *word);
|
||||
// Need better name for this ;-;
|
||||
void LUA_InvalidateMathlibCache(const char *name);
|
||||
|
||||
typedef enum {
|
||||
LPUSHED_NIL,
|
||||
LPUSHED_NEW,
|
||||
LPUSHED_EXISTING,
|
||||
} lpushed_t;
|
||||
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta);
|
||||
lpushed_t LUA_RawPushUserdata(lua_State *L, void *data);
|
||||
|
||||
void LUA_InvalidateUserdata(void *data);
|
||||
void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
@@ -68,8 +76,8 @@ void LUA_InvalidatePlayer(player_t *player);
|
||||
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
|
||||
void Got_Luacmd(const UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(void *cvar); // 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 LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save);
|
||||
|
||||
@@ -192,7 +192,7 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
#endif
|
||||
|
||||
#if USE_MEMCPY
|
||||
M_Memcpy (op, ip, ctrl);
|
||||
memcpy(op, ip, ctrl);
|
||||
op += ctrl;
|
||||
ip += ctrl;
|
||||
#else
|
||||
@@ -435,7 +435,7 @@ lzf_compress (const void *const in_data,size_t in_len,
|
||||
|
||||
*op++ = MAX_LIT - 1;
|
||||
#if USE_MEMCPY
|
||||
M_Memcpy (op, ip - MAX_LIT, MAX_LIT);
|
||||
memcpy(op, ip - MAX_LIT, MAX_LIT);
|
||||
op += MAX_LIT;
|
||||
lit = 0;
|
||||
#else
|
||||
|
||||
+2
-2
@@ -20,11 +20,11 @@
|
||||
|
||||
/** \brief number of arg
|
||||
*/
|
||||
INT32 myargc;
|
||||
INT32 myargc = 0;
|
||||
|
||||
/** \brief string table
|
||||
*/
|
||||
char **myargv;
|
||||
char **myargv = NULL;
|
||||
|
||||
/** \brief did we alloc myargv ourselves?
|
||||
*/
|
||||
|
||||
+2
-2
@@ -25,10 +25,10 @@
|
||||
|
||||
// Map triggers for linedef executors
|
||||
// 32 triggers, one bit each
|
||||
UINT32 unlocktriggers;
|
||||
UINT32 unlocktriggers = 0;
|
||||
|
||||
// The meat of this system lies in condition sets
|
||||
conditionset_t conditionSets[MAXCONDITIONSETS];
|
||||
conditionset_t conditionSets[MAXCONDITIONSETS] = {};
|
||||
|
||||
// Default Emblem locations
|
||||
emblem_t emblemlocations[MAXEMBLEMS] =
|
||||
|
||||
+3
-3
@@ -101,7 +101,7 @@ vector2_t *FV2_UnLoad(vector2_t *vec, fixed_t *x, fixed_t *y)
|
||||
|
||||
vector2_t *FV2_Copy(vector2_t *a_o, const vector2_t *a_i)
|
||||
{
|
||||
return M_Memcpy(a_o, a_i, sizeof(vector2_t));
|
||||
return memcpy(a_o, a_i, sizeof(vector2_t));
|
||||
}
|
||||
|
||||
vector2_t *FV2_AddEx(const vector2_t *a_i, const vector2_t *a_c, vector2_t *a_o)
|
||||
@@ -250,7 +250,7 @@ vector3_t *FV3_UnLoad(vector3_t *vec, fixed_t *x, fixed_t *y, fixed_t *z)
|
||||
|
||||
vector3_t *FV3_Copy(vector3_t *a_o, const vector3_t *a_i)
|
||||
{
|
||||
return M_Memcpy(a_o, a_i, sizeof(vector3_t));
|
||||
return memcpy(a_o, a_i, sizeof(vector3_t));
|
||||
}
|
||||
|
||||
vector3_t *FV3_AddEx(const vector3_t *a_i, const vector3_t *a_c, vector3_t *a_o)
|
||||
@@ -813,7 +813,7 @@ void FM_MultMatrix(matrix_t *dest, const matrix_t *multme)
|
||||
R(i, j) = FixedMul(D(i, 0), M(0, j)) + FixedMul(D(i, 1), M(1, j)) + FixedMul(D(i, 2), M(2, j)) + FixedMul(D(i, 3), M(3, j));
|
||||
}
|
||||
|
||||
M_Memcpy(dest, &result, sizeof(matrix_t));
|
||||
memcpy(dest, &result, sizeof(matrix_t));
|
||||
|
||||
#undef R
|
||||
#undef D
|
||||
|
||||
+7
-33
@@ -145,19 +145,19 @@ I_mutex m_menu_mutex;
|
||||
|
||||
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
|
||||
|
||||
const char *quitmsg[NUM_QUITMESSAGES];
|
||||
const char *quitmsg[NUM_QUITMESSAGES] = {};
|
||||
|
||||
// Stuff for customizing the player select screen Tails 09-22-2003
|
||||
description_t description[MAXSKINS];
|
||||
description_t description[MAXSKINS] = {};
|
||||
|
||||
INT32 mapwads[NUMMAPS];
|
||||
INT32 mapwads[NUMMAPS] = {};
|
||||
|
||||
boolean browselocalskins = false;
|
||||
|
||||
boolean menuactive = false;
|
||||
boolean fromlevelselect = false;
|
||||
|
||||
char menu_text_input_buf[MAXSTRINGLENGTH];
|
||||
char menu_text_input_buf[MAXSTRINGLENGTH] = {};
|
||||
static textinput_t menuinput;
|
||||
|
||||
static INT32 coolalphatimer = 9;
|
||||
@@ -171,7 +171,6 @@ typedef enum
|
||||
} levellist_mode_t;
|
||||
|
||||
levellist_mode_t levellistmode = LLM_CREATESERVER;
|
||||
UINT8 maplistoption = 0;
|
||||
|
||||
static char joystickInfo[8][29];
|
||||
|
||||
@@ -181,10 +180,6 @@ static float serverlistslidex;
|
||||
static INT32 serverlistsearched[MAXSERVERLIST] = {0};
|
||||
static UINT32 serverlistsearchedcount = 0;
|
||||
|
||||
//static saveinfo_t savegameinfo[MAXSAVEGAMES]; // Extra info about the save games.
|
||||
|
||||
INT16 startmap; // Mario, NiGHTS, or just a plain old normal game?
|
||||
|
||||
static INT16 itemOn = 1; // menu item skull is on, Hack by Tails 09-18-2002
|
||||
static INT16 skullAnimCounter = 10; // skull animation counter
|
||||
static boolean interpTimerHackAllow = 0;
|
||||
@@ -759,8 +754,6 @@ static void Command_Manual_f(void)
|
||||
itemOn = 0;
|
||||
}
|
||||
|
||||
boolean dpadscrollstate[4] = {false, false, false, false};
|
||||
|
||||
//
|
||||
// M_Responder
|
||||
//
|
||||
@@ -807,19 +800,15 @@ boolean M_Responder(event_t *ev)
|
||||
break;
|
||||
case KEY_HAT1:
|
||||
ch = KEY_UPARROW;
|
||||
dpadscrollstate[DPAD_UP] = true;
|
||||
break;
|
||||
case KEY_HAT1 + 1:
|
||||
ch = KEY_DOWNARROW;
|
||||
dpadscrollstate[DPAD_DOWN] = true;
|
||||
break;
|
||||
case KEY_HAT1 + 2:
|
||||
ch = KEY_LEFTARROW;
|
||||
dpadscrollstate[DPAD_LEFT] = true;
|
||||
break;
|
||||
case KEY_HAT1 + 3:
|
||||
ch = KEY_RIGHTARROW;
|
||||
dpadscrollstate[DPAD_RIGHT] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -835,24 +824,6 @@ boolean M_Responder(event_t *ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev->type == ev_keyup)
|
||||
{
|
||||
switch (ev->data1) // if you let go of those set those to false
|
||||
{
|
||||
case KEY_HAT1:
|
||||
dpadscrollstate[DPAD_UP] = false;
|
||||
break;
|
||||
case KEY_HAT1 + 1:
|
||||
dpadscrollstate[DPAD_DOWN] = false;
|
||||
break;
|
||||
case KEY_HAT1 + 2:
|
||||
dpadscrollstate[DPAD_LEFT] = false;
|
||||
break;
|
||||
case KEY_HAT1 + 3:
|
||||
dpadscrollstate[DPAD_RIGHT] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (menuactive)
|
||||
{
|
||||
tic_t thistime = I_GetTime();
|
||||
@@ -1731,6 +1702,9 @@ void M_Ticker(void)
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
if (menuactive)
|
||||
I_HandleControllerHatRepeat();
|
||||
|
||||
if (--skullAnimCounter <= 0)
|
||||
skullAnimCounter = 8;
|
||||
|
||||
|
||||
@@ -38,16 +38,6 @@ extern boolean forceshowhud;
|
||||
// Does all the real work of the menu interaction.
|
||||
boolean M_Responder(event_t *ev);
|
||||
|
||||
// for scrolling through menus with controllers
|
||||
extern boolean dpadscrollstate[4];
|
||||
enum
|
||||
{
|
||||
DPAD_UP,
|
||||
DPAD_DOWN,
|
||||
DPAD_LEFT,
|
||||
DPAD_RIGHT
|
||||
};
|
||||
|
||||
// Called by main loop, runs for demo playback. If this returns true, nullify any further user input.
|
||||
boolean M_DemoResponder(event_t *ev);
|
||||
|
||||
@@ -282,9 +272,6 @@ extern CV_PossibleValue_t gametype_cons_t[];
|
||||
|
||||
extern char dummystaffname[22];
|
||||
|
||||
extern INT16 startmap;
|
||||
extern INT32 ultimate_selectable;
|
||||
|
||||
#define MAXSAVEGAMES 31 //note: last save game is "no save"
|
||||
#define NOSAVESLOT MAXSAVEGAMES-1 //slot where Play Without Saving appears
|
||||
|
||||
|
||||
+47
-49
@@ -818,26 +818,31 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 20},
|
||||
#endif
|
||||
#ifdef BACKWARDSCOMPATCORRECTION
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Brightness", &cv_globalgamma, 30},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Saturation", &cv_globalsaturation , 40},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Advanced Color Settings...", &OP_ColorOptionsDef, 50},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Weather Draw Distance", &cv_drawdist_precip, 75},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 115},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift spark pulse size", &cv_driftsparkpulse, 125},
|
||||
{IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_vhseffect, 135},
|
||||
#ifdef HWRENDER
|
||||
{IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 145},
|
||||
NULL, "Gamma", &cv_globalgamma, 30},
|
||||
#endif
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Advanced Video Options...", &OP_ExpOptionsDef, 155},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Brightness", &cv_globalbrightness, 40},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
|
||||
NULL, "Saturation", &cv_globalsaturation , 50},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Advanced Color Settings...", &OP_ColorOptionsDef, 60},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Weather Draw Distance", &cv_drawdist_precip, 85},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 115},
|
||||
{IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 125},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift spark pulse size", &cv_driftsparkpulse, 135},
|
||||
{IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_vhseffect, 145},
|
||||
#ifdef HWRENDER
|
||||
{IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 155},
|
||||
#endif
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Advanced Video Options...", &OP_ExpOptionsDef, 165},
|
||||
};
|
||||
|
||||
static const char* OP_VideoTooltips[] =
|
||||
@@ -846,11 +851,12 @@ static const char* OP_VideoTooltips[] =
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
"Enable fullscreen.",
|
||||
#endif
|
||||
"Gamma (brightness) of the game.",
|
||||
"Saturation of the game.",
|
||||
"Increase the gamma of the displayed image.",
|
||||
"Increase or decrease the brightness of the displayed image.",
|
||||
"Reduce the saturation of the displayed image.",
|
||||
"Advanced color settings of the game.",
|
||||
"How far away objects are drawn.",
|
||||
"How far away weather is drawn.",
|
||||
"How far objects can be drawn.",
|
||||
"Affects how far weather visuals can be drawn.",
|
||||
"Show current game framerate and select the style.",
|
||||
"Sync game framerate to refresh rate of monitor.",
|
||||
"Set manual framerate cap.",
|
||||
@@ -869,7 +875,10 @@ enum
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
op_video_fullscreen,
|
||||
#endif
|
||||
#ifdef BACKWARDSCOMPATCORRECTION
|
||||
op_video_gamma,
|
||||
#endif
|
||||
op_video_bright,
|
||||
op_video_sat,
|
||||
op_video_color,
|
||||
op_video_dd,
|
||||
@@ -898,37 +907,37 @@ static menuitem_t OP_ColorOptionsMenu[] =
|
||||
{IT_DISABLED, NULL, NULL, NULL, 35},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_rhue, 15},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_rsaturation, 20},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_rgamma, 25},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_rbrightness, 25},
|
||||
|
||||
{IT_HEADER, NULL, "Yellow", NULL, 34},
|
||||
{IT_DISABLED, NULL, NULL, NULL, 73},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_yhue, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_ysaturation, 45},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_ygamma, 50},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_ybrightness, 50},
|
||||
|
||||
{IT_HEADER, NULL, "Green", NULL, 59},
|
||||
{IT_DISABLED, NULL, NULL, NULL, 112},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_ghue, 65},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_gsaturation, 70},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_ggamma, 75},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_gbrightness, 75},
|
||||
|
||||
{IT_HEADER, NULL, "Cyan", NULL, 84},
|
||||
{IT_DISABLED, NULL, NULL, NULL, 255},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_chue, 90},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_csaturation, 95},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_cgamma, 100},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_cbrightness, 100},
|
||||
|
||||
{IT_HEADER, NULL, "Blue", NULL, 109},
|
||||
{IT_DISABLED, NULL, NULL, NULL, 152},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_bhue, 115},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_bsaturation, 120},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_bgamma, 125},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_bbrightness, 125},
|
||||
|
||||
{IT_HEADER, NULL, "Magenta", NULL, 134},
|
||||
{IT_DISABLED, NULL, NULL, NULL, 181},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_mhue, 140},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_msaturation, 145},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_mgamma, 150},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_mbrightness, 150},
|
||||
};
|
||||
|
||||
static menuitem_t OP_ExpOptionsMenu[] =
|
||||
@@ -1153,8 +1162,10 @@ static menuitem_t OP_SoundAdvancedMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Keep Map Music", &cv_keepmusic, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Skip Intro Music", &cv_skipintromusic, 85},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Audio Buffer Size", &cv_audbuffersize, 90},
|
||||
{IT_DISABLED, NULL, "", NULL, 100}, // dummy text
|
||||
{IT_STRING | IT_CVAR, NULL, "Cache Sound", &cv_cachesound, 90},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Audio Buffer Size", &cv_audbuffersize, 95},
|
||||
{IT_DISABLED, NULL, "", NULL, 105}, // dummy text
|
||||
};
|
||||
|
||||
static const char* OP_SoundAdvancedTooltips[] =
|
||||
@@ -1175,7 +1186,10 @@ static const char* OP_SoundAdvancedTooltips[] =
|
||||
"Should the Invulnerability music be on or off?",
|
||||
"Should music be kept when restarting the map?",
|
||||
"Should the Intro fanfare be skipped\nand map music be played on map start?",
|
||||
"Controls Sound effects caching.\nKeep will retain previously played sound effects in cache." // man idk how to describe this in a non awful way lmao
|
||||
"\nOn will preload all sound effects.\nEliminates sound-related lag and stutters but increases memory usage.",
|
||||
"Size of the Audio Buffer\nreducing it will result in less sound latency\nbut may cause issues such as crackling or distorted Sound.",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static menuitem_t OP_FocusOptionsMenu[] =
|
||||
@@ -2012,11 +2026,10 @@ static menuitem_t OP_BirdMenu[] =
|
||||
//{IT_STRING | IT_CVAR, NULL, "Encore Choices", &cv_encorevotes, 90},
|
||||
|
||||
{IT_HEADER, NULL, "Music", NULL, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Music Features", &cv_birdmusic, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Resume Level Music", &cv_resume, 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Restart Special Music", &cv_resetspecialmusic, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Resume Level Music", &cv_resume, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Restart Special Music", &cv_resetspecialmusic, 95},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 130},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120},
|
||||
};
|
||||
|
||||
static const char* OP_BirdTooltips[] =
|
||||
@@ -2030,7 +2043,6 @@ static const char* OP_BirdTooltips[] =
|
||||
//"Only show one battle choice in map vote",
|
||||
//"Amount of encore choices in map vote.",
|
||||
NULL,
|
||||
"Global toggle for all bird music features.",
|
||||
"Resume level music from last position after music change.",
|
||||
"Restart Special music if item is used again.",
|
||||
"Options for advanced music settings.",
|
||||
@@ -2044,7 +2056,6 @@ enum
|
||||
viewpointext,
|
||||
freeplaytext,
|
||||
headermusic,
|
||||
birdmusic,
|
||||
lvlresum,
|
||||
spclresum,
|
||||
advmusic,
|
||||
@@ -2871,19 +2882,6 @@ void Bird_menu_Onchange(void)
|
||||
OP_AdvancedBirdMenu[fadegrow].status = status;
|
||||
OP_AdvancedBirdMenu[respawnfadeout].status = status;
|
||||
OP_AdvancedBirdMenu[respawnfadein].status = status;
|
||||
|
||||
if (cv_birdmusic.value)
|
||||
{
|
||||
OP_BirdMenu[lvlresum].status = IT_STRING | IT_CVAR;
|
||||
OP_BirdMenu[spclresum].status = IT_STRING | IT_CVAR;
|
||||
OP_BirdMenu[advmusic].status = IT_STRING | IT_SUBMENU;
|
||||
}
|
||||
else
|
||||
{
|
||||
OP_BirdMenu[lvlresum].status = IT_GRAYEDOUT;
|
||||
OP_BirdMenu[spclresum].status = IT_GRAYEDOUT;
|
||||
OP_BirdMenu[advmusic].status = IT_GRAYEDOUT;
|
||||
}
|
||||
}
|
||||
|
||||
//menu code is nice
|
||||
|
||||
+1
-1
@@ -1686,7 +1686,7 @@ char *M_GetToken(const char *inputString)
|
||||
// Assign the memory. Don't forget an extra byte for the end of the string!
|
||||
texturesToken = (char *)Z_Malloc((texturesTokenLength+1)*sizeof(char),PU_STATIC,NULL);
|
||||
// Copy the string.
|
||||
M_Memcpy(texturesToken, stringToUse+startPos, (size_t)texturesTokenLength);
|
||||
memcpy(texturesToken, stringToUse+startPos, (size_t)texturesTokenLength);
|
||||
// Make the final character NUL.
|
||||
texturesToken[texturesTokenLength] = '\0';
|
||||
return texturesToken;
|
||||
|
||||
+10
-3
@@ -89,10 +89,10 @@ consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAV
|
||||
|
||||
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
int ms_QueryId;
|
||||
int ms_QueryId = 0;
|
||||
I_mutex ms_QueryId_mutex;
|
||||
|
||||
msg_server_t *ms_ServerList;
|
||||
msg_server_t *ms_ServerList = NULL;
|
||||
I_mutex ms_ServerList_mutex;
|
||||
#endif
|
||||
|
||||
@@ -608,10 +608,17 @@ Update_parameters (void)
|
||||
}
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
void Update_MS(void)
|
||||
{
|
||||
Update_parameters();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
static void MasterServer_OnChange(void)
|
||||
{
|
||||
|
||||
UnregisterServer();
|
||||
|
||||
Set_api(cv_masterserver.string);
|
||||
|
||||
@@ -88,6 +88,8 @@ char *GetMODVersion(int id);
|
||||
#endif
|
||||
|
||||
char *GetMasterServerRules(void);
|
||||
|
||||
void Update_MS(void);
|
||||
#endif
|
||||
|
||||
void AddMServCommands(void);
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
// CEILINGS
|
||||
// ==========================================================================
|
||||
|
||||
// the list of ceilings moving currently, including crushers
|
||||
INT32 ceilmovesound = sfx_None;
|
||||
|
||||
/** Moves a moving ceiling.
|
||||
*
|
||||
* \param ceiling Thinker for the ceiling to be moved.
|
||||
|
||||
+8
-8
@@ -28,8 +28,8 @@
|
||||
|
||||
boolean LUA_CallAction(enum actionnum actionnum, void *thing);
|
||||
|
||||
INT32 var1;
|
||||
INT32 var2;
|
||||
INT32 var1 = 0;
|
||||
INT32 var2 = 0;
|
||||
|
||||
//
|
||||
// P_NewChaseDir related LUT.
|
||||
@@ -945,9 +945,9 @@ void A_PointyThink(void *thing)
|
||||
v[3] = FRACUNIT;
|
||||
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->lastlook+i)));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(actor->angle+ANGLE_180));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
|
||||
P_UnsetThingPosition(ball);
|
||||
ball->x = actor->x + v[0];
|
||||
@@ -4929,9 +4929,9 @@ void A_MaceRotate(void *thing)
|
||||
|
||||
// Calculate the angle matrixes for the link.
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->threshold)));
|
||||
M_Memcpy(&v, res, sizeof(v));
|
||||
memcpy(&v, res, sizeof(v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(actor->target->health << ANGLETOFINESHIFT));
|
||||
M_Memcpy(&v, res, sizeof(v));
|
||||
memcpy(&v, res, sizeof(v));
|
||||
}
|
||||
// Rotating Chain.
|
||||
else
|
||||
@@ -4950,9 +4950,9 @@ void A_MaceRotate(void *thing)
|
||||
|
||||
// Calculate the angle matrixes for the link.
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(actor->target->threshold << ANGLETOFINESHIFT));
|
||||
M_Memcpy(&v, res, sizeof(v));
|
||||
memcpy(&v, res, sizeof(v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(actor->target->health << ANGLETOFINESHIFT));
|
||||
M_Memcpy(&v, res, sizeof(v));
|
||||
memcpy(&v, res, sizeof(v));
|
||||
}
|
||||
|
||||
// Add on the appropriate distances to the actor's co-ordinates.
|
||||
|
||||
+2
-2
@@ -869,7 +869,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
toucher->angle = special->angle;
|
||||
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == P_GetLocalPlayerForNum(i))
|
||||
{
|
||||
@@ -1605,7 +1605,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
|
||||
target->player->playerstate = PST_DEAD;
|
||||
|
||||
if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player))
|
||||
if (cv_fading.value && P_IsLocalPlayer(target->player))
|
||||
{
|
||||
if (netgame || multiplayer)
|
||||
ms = cv_respawntime.value * 1000;
|
||||
|
||||
@@ -474,8 +474,6 @@ void P_DoNightsScore(player_t *player);
|
||||
//
|
||||
#include "p_spec.h"
|
||||
|
||||
extern INT32 ceilmovesound;
|
||||
|
||||
// Factor to scale scrolling effect into mobj-carrying properties = 3/32.
|
||||
// (This is so scrolling floors and objects on them can move at same speed.)
|
||||
#define CARRYFACTOR (FRACUNIT-ORIG_FRICTION)
|
||||
|
||||
+13
-13
@@ -41,32 +41,32 @@
|
||||
|
||||
#include "m_perfstats.h" // ps_checkposition_calls
|
||||
|
||||
fixed_t tmbbox[4];
|
||||
mobj_t *tmthing;
|
||||
fixed_t tmbbox[4] = {};
|
||||
mobj_t *tmthing = NULL;
|
||||
static INT32 tmflags;
|
||||
fixed_t tmx;
|
||||
fixed_t tmy;
|
||||
fixed_t tmx = 0;
|
||||
fixed_t tmy = 0;
|
||||
|
||||
// If "floatok" true, move would be ok
|
||||
// if within "tmfloorz - tmceilingz".
|
||||
boolean floatok;
|
||||
boolean floatok = false;
|
||||
|
||||
fixed_t tmfloorz, tmceilingz;
|
||||
static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
|
||||
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
||||
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||
pslope_t *tmfloorslope, *tmceilingslope;
|
||||
fixed_t tmfloorz = 0, tmceilingz = 0;
|
||||
static fixed_t tmdropoffz = 0, tmdrpoffceilz = 0; // drop-off floor/ceiling heights
|
||||
mobj_t *tmfloorthing = NULL; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
||||
mobj_t *tmhitthing = NULL; // the solid thing you bumped into (for collisions)
|
||||
pslope_t *tmfloorslope = NULL, *tmceilingslope = NULL;
|
||||
|
||||
// keep track of the line that lowers the ceiling,
|
||||
// so missiles don't explode against sky hack walls
|
||||
line_t *ceilingline;
|
||||
line_t *ceilingline = NULL;
|
||||
|
||||
// set by PIT_CheckLine() for any line that stopped the PIT_CheckLine()
|
||||
// that is, for any line which is 'solid'
|
||||
line_t *blockingline;
|
||||
line_t *blockingline = NULL;
|
||||
|
||||
msecnode_t *sector_list = NULL;
|
||||
camera_t *mapcampointer;
|
||||
camera_t *mapcampointer = NULL;
|
||||
|
||||
//
|
||||
// TELEPORT MOVE
|
||||
|
||||
+14
-19
@@ -43,7 +43,7 @@
|
||||
consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
actioncache_t actioncachehead;
|
||||
actioncache_t actioncachehead = {};
|
||||
|
||||
static mobj_t *overlaycap = NULL;
|
||||
static mobj_t *shadowcap = NULL;
|
||||
@@ -5459,9 +5459,9 @@ static void P_MoveHoop(mobj_t *mobj)
|
||||
v[3] = FRACUNIT;
|
||||
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(mobj->target->movedir*FRACUNIT)));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(FixedAngle(mobj->target->movecount*FRACUNIT)));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
|
||||
finalx = x + v[0];
|
||||
finaly = y + v[1];
|
||||
@@ -5527,9 +5527,9 @@ void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT
|
||||
v[3] = FRACUNIT;
|
||||
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
|
||||
finalx = x + v[0];
|
||||
finaly = y + v[1];
|
||||
@@ -5566,9 +5566,9 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
|
||||
v[3] = FRACUNIT;
|
||||
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
|
||||
finalx = x + v[0];
|
||||
finaly = y + v[1];
|
||||
@@ -10758,7 +10758,7 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
{
|
||||
if (!p->spectator)
|
||||
{
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (playernum == P_GetLocalPlayerNumForNum(i))
|
||||
{
|
||||
@@ -10776,17 +10776,12 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
||||
mobj_t *mobj = p->mo;
|
||||
UINT8 i;
|
||||
|
||||
if (playernum == consoleplayer)
|
||||
localangle[0] = mobj->angle;
|
||||
else if (splitscreen)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
for (i = 1; i <= splitscreen; i++)
|
||||
if (playernum == P_GetLocalPlayerNumForNum(i))
|
||||
{
|
||||
if (playernum == displayplayers[i])
|
||||
{
|
||||
localangle[i] = mobj->angle;
|
||||
break;
|
||||
}
|
||||
localangle[i] = mobj->angle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11815,9 +11810,9 @@ static void P_SpawnNiGHTSHoop(fixed_t x, fixed_t y, fixed_t z, fixed_t hoopsize,
|
||||
v[3] = FRACUNIT;
|
||||
|
||||
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(spewangle)));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
|
||||
M_Memcpy(&v, res, sizeof (v));
|
||||
memcpy(&v, res, sizeof (v));
|
||||
|
||||
mobj = P_SpawnMobj(x + v[0], y + v[1], z + v[2], type);
|
||||
|
||||
|
||||
+5
-5
@@ -90,14 +90,14 @@
|
||||
//
|
||||
|
||||
// The Polyobjects
|
||||
polyobj_t *PolyObjects;
|
||||
INT32 numPolyObjects;
|
||||
polyobj_t *PolyObjects = NULL;
|
||||
INT32 numPolyObjects = 0;
|
||||
|
||||
// Polyobject Blockmap -- initialized in P_LoadBlockMap
|
||||
polymaplink_t **polyblocklinks;
|
||||
polymaplink_t **polyblocklinks = NULL;
|
||||
|
||||
static size_t *KnownPolySides;
|
||||
static size_t KnownPolySidesCount;
|
||||
static size_t *KnownPolySides = NULL;
|
||||
static size_t KnownPolySidesCount = 0;
|
||||
|
||||
//
|
||||
// Static Data
|
||||
|
||||
+5
-27
@@ -35,7 +35,7 @@
|
||||
#include "lua_script.h"
|
||||
#include "p_slopes.h"
|
||||
|
||||
savedata_t savedata;
|
||||
savedata_t savedata = {};
|
||||
|
||||
// Block UINT32s to attempt to ensure that the correct data is
|
||||
// being sent and received
|
||||
@@ -1203,7 +1203,7 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
|
||||
if (diff & MD_MORE)
|
||||
WRITEUINT16(save->p, diff2);
|
||||
|
||||
// save pointer, at load time we will search this pointer to reinitilize pointers
|
||||
// keep here for vanilla compat
|
||||
WRITEUINT32(save->p, (size_t)mobj);
|
||||
|
||||
WRITEFIXED(save->p, mobj->z); // Force this so 3dfloor problems don't arise.
|
||||
@@ -1982,7 +1982,6 @@ static void CalculateDoomednumToMobjtype(void)
|
||||
|
||||
static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
{
|
||||
thinker_t *next;
|
||||
mobj_t *mobj;
|
||||
UINT32 diff;
|
||||
UINT16 diff2;
|
||||
@@ -1995,7 +1994,8 @@ static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
else
|
||||
diff2 = 0;
|
||||
|
||||
next = (void *)(size_t)READUINT32(save->p);
|
||||
// here for vanilla compat
|
||||
save->p += sizeof(UINT32);
|
||||
|
||||
z = READFIXED(save->p); // Force this so 3dfloor problems don't arise.
|
||||
floorz = READFIXED(save->p);
|
||||
@@ -2234,8 +2234,6 @@ static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
if (diff2 & MD2_WAYPOINTCAP)
|
||||
P_SetTarget(&waypointcap, mobj);
|
||||
|
||||
mobj->info = (mobjinfo_t *)next; // temporarily, set when leave this function
|
||||
|
||||
R_AddMobjInterpolator(mobj);
|
||||
}
|
||||
|
||||
@@ -3200,25 +3198,6 @@ FUNCINLINE static ATTRINLINE void P_UnArchivePolyObjects(savebuffer_t *save)
|
||||
for (i = 0; i < numSavedPolys; ++i)
|
||||
P_UnArchivePolyObj(save, &PolyObjects[i]);
|
||||
}
|
||||
//
|
||||
// P_FinishMobjs
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE void P_FinishMobjs(void)
|
||||
{
|
||||
thinker_t *currentthinker;
|
||||
mobj_t *mobj;
|
||||
|
||||
// put info field there real value
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
mobj->info = &mobjinfo[mobj->type];
|
||||
}
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE mobj_t *RelinkMobj(mobj_t **ptr)
|
||||
{
|
||||
@@ -3793,7 +3772,7 @@ boolean P_LoadGame(savebuffer_t *save, INT16 mapoverride)
|
||||
|
||||
boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
||||
{
|
||||
CV_LoadNetVars(&save->p);
|
||||
save->p += CV_LoadNetVars(save->p);
|
||||
|
||||
if (!P_NetUnArchiveMisc(save, reloading))
|
||||
return false;
|
||||
@@ -3807,7 +3786,6 @@ boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
||||
P_NetUnArchiveThinkers(save);
|
||||
P_NetUnArchiveSpecials(save);
|
||||
P_RelinkPointers();
|
||||
P_FinishMobjs();
|
||||
}
|
||||
|
||||
LUA_UnArchive(save, true);
|
||||
|
||||
+62
-49
@@ -92,7 +92,7 @@
|
||||
// Map MD5, calculated on level load.
|
||||
// Sent to clients in PT_SERVERINFO.
|
||||
//
|
||||
unsigned char mapmd5[16];
|
||||
unsigned char mapmd5[16] = {};
|
||||
|
||||
// true when level was loaded from netsave
|
||||
boolean midgamejoin = false;
|
||||
@@ -102,22 +102,22 @@ boolean midgamejoin = false;
|
||||
// Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
|
||||
//
|
||||
|
||||
size_t numvertexes, numsegs, numsectors, numsubsectors, numnodes, numlines, numsides, nummapthings;
|
||||
vertex_t *vertexes;
|
||||
seg_t *segs;
|
||||
sector_t *sectors;
|
||||
subsector_t *subsectors;
|
||||
node_t *nodes;
|
||||
line_t *lines;
|
||||
side_t *sides;
|
||||
mapthing_t *mapthings;
|
||||
sector_t *spawnsectors;
|
||||
line_t *spawnlines;
|
||||
side_t *spawnsides;
|
||||
INT32 numstarposts;
|
||||
boolean levelloading;
|
||||
size_t numvertexes = 0, numsegs = 0, numsectors = 0, numsubsectors = 0, numnodes = 0, numlines = 0, numsides = 0, nummapthings = 0;
|
||||
vertex_t *vertexes = NULL;
|
||||
seg_t *segs = NULL;
|
||||
sector_t *sectors = NULL;
|
||||
subsector_t *subsectors = NULL;
|
||||
node_t *nodes = NULL;
|
||||
line_t *lines = NULL;
|
||||
side_t *sides = NULL;
|
||||
mapthing_t *mapthings = NULL;
|
||||
sector_t *spawnsectors = NULL;
|
||||
line_t *spawnlines = NULL;
|
||||
side_t *spawnsides = NULL;
|
||||
INT32 numstarposts = 0;
|
||||
boolean levelloading = false;
|
||||
|
||||
virtres_t *curmapvirt;
|
||||
virtres_t *curmapvirt = NULL;
|
||||
|
||||
// BLOCKMAP
|
||||
// Created from axis aligned bounding box
|
||||
@@ -127,32 +127,32 @@ virtres_t *curmapvirt;
|
||||
// by spatial subdivision in 2D.
|
||||
//
|
||||
// Blockmap size.
|
||||
INT32 bmapwidth, bmapheight; // size in mapblocks
|
||||
INT32 bmapwidth = 0, bmapheight = 0; // size in mapblocks
|
||||
|
||||
INT32 *blockmap; // INT32 for large maps
|
||||
INT32 *blockmap = NULL; // INT32 for large maps
|
||||
// offsets in blockmap are from here
|
||||
INT32 *blockmaplump; // Big blockmap
|
||||
INT32 *blockmaplump = NULL; // Big blockmap
|
||||
|
||||
// origin of block map
|
||||
fixed_t bmaporgx, bmaporgy;
|
||||
fixed_t bmaporgx = 0, bmaporgy = 0;
|
||||
// for thing chains
|
||||
mobj_t **blocklinks;
|
||||
precipmobj_t **precipblocklinks;
|
||||
mobj_t **blocklinks = NULL;
|
||||
precipmobj_t **precipblocklinks = NULL;
|
||||
|
||||
// REJECT
|
||||
// For fast sight rejection.
|
||||
// Speeds up enemy AI by skipping detailed LineOf Sight calculation.
|
||||
// Without special effect, this could be used as a PVS lookup as well.
|
||||
//
|
||||
UINT8 *rejectmatrix;
|
||||
UINT8 *rejectmatrix = NULL;
|
||||
|
||||
// Maintain single and multi player starting spots.
|
||||
INT32 numdmstarts, numcoopstarts, numredctfstarts, numbluectfstarts;
|
||||
INT32 numdmstarts = 0, numcoopstarts = 0, numredctfstarts = 0, numbluectfstarts = 0;
|
||||
|
||||
mapthing_t *deathmatchstarts[MAX_DM_STARTS];
|
||||
mapthing_t *playerstarts[MAXPLAYERS];
|
||||
mapthing_t *bluectfstarts[MAXPLAYERS];
|
||||
mapthing_t *redctfstarts[MAXPLAYERS];
|
||||
mapthing_t *deathmatchstarts[MAX_DM_STARTS] = {};
|
||||
mapthing_t *playerstarts[MAXPLAYERS] = {};
|
||||
mapthing_t *bluectfstarts[MAXPLAYERS] = {};
|
||||
mapthing_t *redctfstarts[MAXPLAYERS] = {};
|
||||
|
||||
// Global state for PartialAddWadFile/MultiSetupWadFiles
|
||||
// Might be replacable with parameters, but non-trivial when the functions are called on separate tics
|
||||
@@ -544,7 +544,18 @@ static void P_LoadSegs(UINT8 *data)
|
||||
{
|
||||
li->v1 = &vertexes[SHORT(ml->v1)];
|
||||
li->v2 = &vertexes[SHORT(ml->v2)];
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
li->fv1.x = FixedToFloat(li->v1->x);
|
||||
li->fv1.y = FixedToFloat(li->v1->y);
|
||||
//li->fv1.z = FixedToFloat(li->v1->z); // z is unused in gl
|
||||
|
||||
li->fv2.x = FixedToFloat(li->v2->x);
|
||||
li->fv2.y = FixedToFloat(li->v2->y);
|
||||
//li->fv2.z = FixedToFloat(li->v2->z);
|
||||
}
|
||||
#endif
|
||||
li->length = P_SegLength(li);
|
||||
li->angle = (SHORT(ml->angle))<<FRACBITS;
|
||||
li->offset = (SHORT(ml->offset))<<FRACBITS;
|
||||
@@ -806,7 +817,7 @@ static void P_LoadSectors(UINT8 *data)
|
||||
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
|
||||
|
||||
// copy table for global usage
|
||||
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
|
||||
levelflats = memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
|
||||
free(foundflats);
|
||||
|
||||
// search for animated flats and set up
|
||||
@@ -1177,10 +1188,10 @@ static void P_LoadLineDefs2(void)
|
||||
len += strlen(sides[ld->sidenum[1]].text);
|
||||
|
||||
ld->text = Z_Malloc(len, PU_LEVEL, NULL);
|
||||
M_Memcpy(ld->text, sides[ld->sidenum[0]].text, strlen(sides[ld->sidenum[0]].text)+1);
|
||||
memcpy(ld->text, sides[ld->sidenum[0]].text, strlen(sides[ld->sidenum[0]].text)+1);
|
||||
|
||||
if (ld->sidenum[1] != 0xffff && sides[ld->sidenum[1]].text)
|
||||
M_Memcpy(ld->text+strlen(ld->text)+1, sides[ld->sidenum[1]].text, strlen(sides[ld->sidenum[1]].text)+1);
|
||||
memcpy(ld->text+strlen(ld->text)+1, sides[ld->sidenum[1]].text, strlen(sides[ld->sidenum[1]].text)+1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1309,14 +1320,14 @@ static void P_LoadSideChangeMusic(boolean firstside, mapsidedef_t *msd, side_t *
|
||||
|
||||
if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')
|
||||
{
|
||||
M_Memcpy(process,msd->bottomtexture,8);
|
||||
memcpy(process,msd->bottomtexture,8);
|
||||
process[8] = '\0';
|
||||
sd->bottomtexture = get_number(process);
|
||||
}
|
||||
|
||||
if (!(msd->midtexture[0] == '-' && msd->midtexture[1] == '\0') || msd->midtexture[1] != '\0')
|
||||
{
|
||||
M_Memcpy(process,msd->midtexture,8);
|
||||
memcpy(process,msd->midtexture,8);
|
||||
process[8] = '\0';
|
||||
sd->midtexture = get_number(process);
|
||||
}
|
||||
@@ -1326,15 +1337,15 @@ static void P_LoadSideChangeMusic(boolean firstside, mapsidedef_t *msd, side_t *
|
||||
|
||||
if (firstside || msd->toptexture[0] != '-' || msd->toptexture[1] != '\0')
|
||||
{
|
||||
M_Memcpy(process,msd->toptexture,8);
|
||||
memcpy(process,msd->toptexture,8);
|
||||
process[8] = '\0';
|
||||
|
||||
// If they type in O_ or D_ and their music name, just shrug,
|
||||
// then copy the rest instead.
|
||||
if ((process[0] == 'O' || process[0] == 'D') && process[7])
|
||||
M_Memcpy(sd->text, process+2, 6);
|
||||
memcpy(sd->text, process+2, 6);
|
||||
else // Assume it's a proper music name.
|
||||
M_Memcpy(sd->text, process, 6);
|
||||
memcpy(sd->text, process, 6);
|
||||
sd->text[6] = 0;
|
||||
}
|
||||
else
|
||||
@@ -1382,7 +1393,7 @@ static void P_LoadSidedefs(void *data)
|
||||
if (msd->toptexture[0] != '-' || msd->toptexture[1] != '\0')
|
||||
{
|
||||
char process[8+1];
|
||||
M_Memcpy(process,msd->toptexture,8);
|
||||
memcpy(process,msd->toptexture,8);
|
||||
process[8] = '\0';
|
||||
sd->toptexture = get_number(process);
|
||||
}
|
||||
@@ -1401,11 +1412,11 @@ static void P_LoadSidedefs(void *data)
|
||||
if (msd->toptexture[0] == '-' && msd->toptexture[1] == '\0')
|
||||
break;
|
||||
else
|
||||
M_Memcpy(process,msd->toptexture,8);
|
||||
memcpy(process,msd->toptexture,8);
|
||||
if (msd->midtexture[0] != '-' || msd->midtexture[1] != '\0')
|
||||
M_Memcpy(process+strlen(process), msd->midtexture, 8);
|
||||
memcpy(process+strlen(process), msd->midtexture, 8);
|
||||
if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')
|
||||
M_Memcpy(process+strlen(process), msd->bottomtexture, 8);
|
||||
memcpy(process+strlen(process), msd->bottomtexture, 8);
|
||||
sd->toptexture = get_number(process);
|
||||
|
||||
break;
|
||||
@@ -1418,13 +1429,13 @@ static void P_LoadSidedefs(void *data)
|
||||
if (msd->toptexture[0] == '-' && msd->toptexture[1] == '\0')
|
||||
break;
|
||||
else
|
||||
M_Memcpy(process,msd->toptexture,8);
|
||||
memcpy(process,msd->toptexture,8);
|
||||
if (msd->midtexture[0] != '-' || msd->midtexture[1] != '\0')
|
||||
M_Memcpy(process+strlen(process), msd->midtexture, 8);
|
||||
memcpy(process+strlen(process), msd->midtexture, 8);
|
||||
if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')
|
||||
M_Memcpy(process+strlen(process), msd->bottomtexture, 8);
|
||||
memcpy(process+strlen(process), msd->bottomtexture, 8);
|
||||
sd->text = Z_Malloc(strlen(process)+1, PU_LEVEL, NULL);
|
||||
M_Memcpy(sd->text, process, strlen(process)+1);
|
||||
memcpy(sd->text, process, strlen(process)+1);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1887,7 +1898,7 @@ static void P_LoadReject(UINT8 *data, size_t count)
|
||||
else
|
||||
{
|
||||
rejectmatrix = Z_Malloc(count, PU_LEVEL, NULL); // allocate memory for the reject matrix
|
||||
M_Memcpy(rejectmatrix, data, count); // copy the data into it
|
||||
memcpy(rejectmatrix, data, count); // copy the data into it
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2201,7 +2212,7 @@ static void P_MakeMapMD5(virtres_t *virt, void *dest)
|
||||
for (i = 0; i < 16; i++)
|
||||
resmd5[i] = (linemd5[i] + sectormd5[i] + thingmd5[i] + sidedefmd5[i]) & 0xFF;
|
||||
|
||||
M_Memcpy(dest, &resmd5, 16);
|
||||
memcpy(dest, &resmd5, 16);
|
||||
}
|
||||
|
||||
static void P_LoadMapFromFile(void)
|
||||
@@ -2642,7 +2653,8 @@ static void P_SetupPlayer(void)
|
||||
spbplace = -1;
|
||||
|
||||
startedInFreePlay = true;
|
||||
for (UINT8 nump = 0, i = 0; i < MAXPLAYERS; i++)
|
||||
UINT8 nump = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
{
|
||||
@@ -2766,7 +2778,8 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
// Make sure all sounds are stopped before Z_FreeTags.
|
||||
S_StopSounds();
|
||||
|
||||
if (!S_PrecacheSound())
|
||||
// if we dont intend to cache our sound effects, wipe them
|
||||
if (S_CacheSound() == SOUNDCACHE_OFF)
|
||||
S_ClearSfx();
|
||||
|
||||
// As oddly named as this is, this handles music only.
|
||||
@@ -3034,7 +3047,7 @@ static boolean P_CheckSoundReplacements(UINT16 wadnum, char *name, size_t i)
|
||||
I_FreeSfx(&S_sfx[j]);
|
||||
|
||||
// Re-cache it
|
||||
if (S_PrecacheSound())
|
||||
if (S_CacheSound() == SOUNDCACHE_PRECACHE)
|
||||
S_sfx[j].data = I_GetSfx(&S_sfx[j]);
|
||||
|
||||
sreplaces++;
|
||||
|
||||
+1
-2
@@ -38,7 +38,6 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope)
|
||||
fixed_t light = FRACUNIT;
|
||||
fixed_t extralight = 0;
|
||||
|
||||
|
||||
if (slope->normal.z == 0)
|
||||
{
|
||||
slope->lightOffset = 0;
|
||||
@@ -296,7 +295,7 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line)
|
||||
|
||||
// Find furthest vertex from the reference line. It, along with the two ends
|
||||
// of the line, will define the plane.
|
||||
for(i = 0; i < sector->linecount; i++)
|
||||
for (i = 0; i < sector->linecount; i++)
|
||||
{
|
||||
line_t *li = sector->lines[i];
|
||||
vertex_t tempv;
|
||||
|
||||
+6
-7
@@ -44,7 +44,7 @@
|
||||
// Not sure if this is necessary, but it was in w_wad.c, so I'm putting it here too -Shadow Hog
|
||||
#include <errno.h>
|
||||
|
||||
mobj_t *skyboxmo[2];
|
||||
mobj_t *skyboxmo[2] = {};
|
||||
|
||||
// Amount (dx, dy) vector linedef is shifted right to get scroll amount
|
||||
#define SCROLL_SHIFT 5
|
||||
@@ -93,7 +93,7 @@ static void P_AddSpikeThinker(sector_t *sec, INT32 referrer);
|
||||
|
||||
|
||||
//SoM: 3/7/2000: New sturcture without limits.
|
||||
anim_t *lastanim;
|
||||
anim_t *lastanim = NULL;
|
||||
anim_t *anims = NULL; /// \todo free leak
|
||||
static size_t maxanims;
|
||||
|
||||
@@ -252,10 +252,10 @@ void P_InitPicAnims(void)
|
||||
// Populate the new array
|
||||
for (currentPos = animatedLump; *currentPos != UINT8_MAX; i++, currentPos+=23)
|
||||
{
|
||||
M_Memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
|
||||
M_Memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
|
||||
M_Memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes
|
||||
M_Memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
|
||||
memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
|
||||
memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
|
||||
memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes
|
||||
memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
|
||||
}
|
||||
|
||||
Z_Free(animatedLump);
|
||||
@@ -4798,7 +4798,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
ffloor->master = master;
|
||||
ffloor->norender = INFTICS;
|
||||
|
||||
|
||||
// Scan the thinkers to check for special conditions applying to this FOF.
|
||||
// If we have thinkers sorted by sector, just check the relevant ones;
|
||||
// otherwise, check them all. Apologies for the ugly loop...
|
||||
|
||||
+3
-3
@@ -44,7 +44,7 @@
|
||||
// Dynamic slopes
|
||||
#include "p_slopes.h"
|
||||
|
||||
tic_t leveltime;
|
||||
tic_t leveltime = 0;
|
||||
|
||||
//
|
||||
// THINKERS
|
||||
@@ -55,8 +55,8 @@ tic_t leveltime;
|
||||
//
|
||||
|
||||
// Both the head and tail of the thinker list.
|
||||
thinker_t thinkercap;
|
||||
thinker_t precipcap;
|
||||
thinker_t thinkercap = {};
|
||||
thinker_t precipcap = {};
|
||||
|
||||
void Command_Numthinkers_f(void)
|
||||
{
|
||||
|
||||
+2
-1
@@ -700,6 +700,7 @@ void P_RestoreMusic(player_t *player)
|
||||
if (P_EndingMusic(player))
|
||||
return;
|
||||
|
||||
// Event - Level Start
|
||||
if (leveltime < MUSICSTARTTIME)
|
||||
S_StartMapMusic();
|
||||
else // see also where time overs are handled - search for "lives = 2" in this file
|
||||
@@ -5193,7 +5194,7 @@ void P_PlayerAfterThink(player_t *player)
|
||||
player->mo->tracer->target->health += cmd->sidemove;
|
||||
player->mo->angle += cmd->sidemove << ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
|
||||
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == P_GetLocalPlayerForNum(i))
|
||||
{
|
||||
|
||||
+20
-11
@@ -26,11 +26,11 @@
|
||||
|
||||
#include "qs22j.h"
|
||||
|
||||
seg_t *curline;
|
||||
side_t *sidedef;
|
||||
line_t *linedef;
|
||||
sector_t *frontsector;
|
||||
sector_t *backsector;
|
||||
seg_t *curline = NULL;
|
||||
side_t *sidedef = NULL;
|
||||
line_t *linedef = NULL;
|
||||
sector_t *frontsector = NULL;
|
||||
sector_t *backsector = NULL;
|
||||
|
||||
// very ugly realloc() of drawsegs at run-time, I upped it to 512
|
||||
// instead of 256.. and someone managed to send me a level with
|
||||
@@ -40,29 +40,38 @@ drawseg_t *drawsegs = NULL;
|
||||
drawseg_t *ds_p = NULL;
|
||||
|
||||
// indicates doors closed wrt automap bugfix:
|
||||
INT32 doorclosed;
|
||||
INT32 doorclosed = 0;
|
||||
|
||||
// A wall was drawn covering the whole screen, which means we
|
||||
// can block off the BSP across that seg.
|
||||
boolean g_walloffscreen;
|
||||
boolean g_walloffscreen = false;
|
||||
|
||||
boolean R_NoEncore(sector_t *sector, boolean ceiling)
|
||||
{
|
||||
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 12 || GETSECSPECIAL(sector->special, 2) == 15); // keeping this incase its used
|
||||
const INT32 invspecial = GETSECSPECIAL(sector->special, 2);
|
||||
boolean invertencore = (invspecial == 12 || invspecial == 15); // keeping this incase its used
|
||||
|
||||
#if 0 // perfect implementation
|
||||
INT32 val = GETSECSPECIAL(sector->special, 3);
|
||||
if (val != 1 && val != 3 // spring panel
|
||||
const INT32 sprnspecial = GETSECSPECIAL(sector->special, 3);
|
||||
if (sprnspecial != 1 && sprnspecial != 3 // spring panel
|
||||
#else // optimised, see #define GETSECSPECIAL(i,j) ((i >> ((j-1)*4))&15)
|
||||
if ((!(sector->special & (1<<8)) || (sector->special & ((4|8)<<8))) // spring panel
|
||||
#endif
|
||||
&& GETSECSPECIAL(sector->special, 4) != 6) // sneaker panel
|
||||
return invertencore;
|
||||
{
|
||||
return invertencore;
|
||||
}
|
||||
|
||||
if (invertencore)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ceiling)
|
||||
{
|
||||
return ((boolean)(sector->flags & SF_FLIPSPECIAL_CEILING));
|
||||
}
|
||||
|
||||
return ((boolean)(sector->flags & SF_FLIPSPECIAL_FLOOR));
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -83,7 +83,7 @@ typedef struct
|
||||
// a patch or sprite is composed of zero or more columns.
|
||||
//
|
||||
|
||||
size_t numspritelumps, max_spritelumps;
|
||||
size_t numspritelumps = 0, max_spritelumps = 0;
|
||||
|
||||
// textures
|
||||
INT32 numtextures = 0; // total number of textures found,
|
||||
@@ -110,7 +110,7 @@ UINT8 invertmap[256];
|
||||
#endif
|
||||
|
||||
// for debugging/info purposes
|
||||
size_t flatmemory, spritememory, texturememory; // gotta play by 2.2 rules to get this to work
|
||||
static size_t flatmemory = 0, spritememory = 0, texturememory = 0; // gotta play by 2.2 rules to get this to work
|
||||
|
||||
// Blends two pixels together, using the equation
|
||||
// that matches the specified alpha style.
|
||||
@@ -269,7 +269,7 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, texpatch_t
|
||||
count = cacheheight - position;
|
||||
|
||||
if (count > 0)
|
||||
M_Memcpy(cache + position, source, count);
|
||||
memcpy(cache + position, source, count);
|
||||
|
||||
patch = (column_t *)((UINT8 *)patch + patch->length + 4);
|
||||
}
|
||||
@@ -412,7 +412,7 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||
texture->holes = true;
|
||||
blocksize = lumplength;
|
||||
block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]); // will change tag at end of this function
|
||||
M_Memcpy(block, realpatch, blocksize);
|
||||
memcpy(block, realpatch, blocksize);
|
||||
texturememory += blocksize;
|
||||
|
||||
// use the patch's column lookup
|
||||
@@ -621,7 +621,7 @@ Rloadtextures (INT32 i, INT32 w)
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||
memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||
texture->hash = quickncasehash(texture->name, 8);
|
||||
|
||||
texture->width = SHORT(patchlump.width);
|
||||
@@ -854,7 +854,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
||||
Z_Free(patchName);
|
||||
}
|
||||
patchName = (char *)Z_Malloc((texturesTokenLength+1)*sizeof(char),PU_STATIC,NULL);
|
||||
M_Memcpy(patchName,texturesToken,texturesTokenLength*sizeof(char));
|
||||
memcpy(patchName,texturesToken,texturesTokenLength*sizeof(char));
|
||||
patchName[texturesTokenLength] = '\0';
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
||||
else
|
||||
{
|
||||
memset(&newTextureName, 0, 9);
|
||||
M_Memcpy(newTextureName, texturesToken, texturesTokenLength);
|
||||
memcpy(newTextureName, texturesToken, texturesTokenLength);
|
||||
// ^^ we've confirmed that the token is <= 8 characters so it will never overflow a 9 byte char buffer
|
||||
strupr(newTextureName); // Just do this now so we don't have to worry about it
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
||||
{
|
||||
// Allocate memory for a zero-patch texture. Obviously, we'll be adding patches momentarily.
|
||||
resultTexture = (texture_t *)Z_Calloc(sizeof(texture_t), PU_STATIC, NULL);
|
||||
M_Memcpy(resultTexture->name, newTextureName, 8);
|
||||
memcpy(resultTexture->name, newTextureName, 8);
|
||||
resultTexture->hash = quickncasehash(newTextureName, 8);
|
||||
resultTexture->width = newTextureWidth;
|
||||
resultTexture->height = newTextureHeight;
|
||||
@@ -1104,7 +1104,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
||||
// Make room for the new patch
|
||||
resultTexture = Z_Realloc(resultTexture, sizeof(texture_t) + (resultTexture->patchcount+1)*sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
// Populate the uninitialized values in the new patch entry of our array
|
||||
M_Memcpy(&resultTexture->patches[resultTexture->patchcount], newPatch, sizeof(texpatch_t));
|
||||
memcpy(&resultTexture->patches[resultTexture->patchcount], newPatch, sizeof(texpatch_t));
|
||||
// Account for the new number of patches in the texture
|
||||
resultTexture->patchcount++;
|
||||
// Then free up the memory assigned to R_ParsePatch, as it's unneeded now
|
||||
|
||||
@@ -91,8 +91,6 @@ UINT8 *R_GetFlat(lumpnum_t flatnum);
|
||||
void R_InitData(void);
|
||||
void R_PrecacheLevel(void);
|
||||
|
||||
extern size_t flatmemory, spritememory, texturememory;
|
||||
|
||||
// Retrieval.
|
||||
// Floor/ceiling opaque texture tiles,
|
||||
// lookup by name. For animation?
|
||||
|
||||
+8
-4
@@ -114,6 +114,11 @@ typedef struct
|
||||
fixed_t x, y, z;
|
||||
} vertex_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x, y/*, z*/;
|
||||
} floatvertex_t;
|
||||
|
||||
// Forward of linedefs, for sectors.
|
||||
struct line_s;
|
||||
|
||||
@@ -543,12 +548,11 @@ typedef struct seg_s
|
||||
sector_t *frontsector;
|
||||
sector_t *backsector;
|
||||
|
||||
fixed_t length; // precalculated seg length
|
||||
fixed_t length; // precalculated seg length
|
||||
|
||||
#ifdef HWRENDER
|
||||
// new pointers so that AdjustSegs doesn't mess with v1/v2
|
||||
polyvertex_t *pv1;
|
||||
polyvertex_t *pv2;
|
||||
floatvertex_t fv1;
|
||||
floatvertex_t fv2;
|
||||
#endif
|
||||
|
||||
polyobj_t *polyseg;
|
||||
|
||||
+33
-22
@@ -41,40 +41,40 @@
|
||||
|
||||
/** \brief view info
|
||||
*/
|
||||
INT32 viewwidth, viewheight, viewwindowx, viewwindowy;
|
||||
INT32 viewwidth = 0, viewheight = 0, viewwindowx = 0, viewwindowy = 0;
|
||||
|
||||
// =========================================================================
|
||||
// COLUMN DRAWING CODE STUFF
|
||||
// =========================================================================
|
||||
|
||||
drawcolumndata_t g_dc;
|
||||
drawcolumndata_t g_dc = {};
|
||||
|
||||
// -----------------------
|
||||
// translucency stuff here
|
||||
// -----------------------
|
||||
#define NUMTRANSTABLES 9 // how many translucency tables are used
|
||||
|
||||
UINT8 *transtables; // translucency tables
|
||||
UINT8 *blendtables[NUMBLENDMAPS];
|
||||
UINT8 *transtables = NULL; // translucency tables
|
||||
UINT8 *blendtables[NUMBLENDMAPS] = {};
|
||||
|
||||
// --------------------------------------------
|
||||
// c drawer routines
|
||||
// --------------------------------------------
|
||||
|
||||
coldrawfunc_t *colfunc;
|
||||
coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX];
|
||||
int colfunctype;
|
||||
coldrawfunc_t *colfunc = NULL;
|
||||
coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX] = {};
|
||||
int colfunctype = 0;
|
||||
|
||||
// =========================================================================
|
||||
// SPAN DRAWING CODE STUFF
|
||||
// =========================================================================
|
||||
|
||||
drawspandata_t g_ds;
|
||||
drawspandata_t g_ds = {};
|
||||
|
||||
// Vectors for Software's tilted slope drawers
|
||||
floatv3_t *ds_su, *ds_sv, *ds_sz;
|
||||
floatv3_t *ds_su = NULL, *ds_sv = NULL, *ds_sz = NULL;
|
||||
|
||||
float focallengthf;
|
||||
float focallengthf = 0.0f;
|
||||
|
||||
// For, uh, tilted lighting, duh.
|
||||
//static INT32 *tiltlighting;
|
||||
@@ -83,8 +83,8 @@ float focallengthf;
|
||||
// c drawer routines
|
||||
// --------------------------------------------
|
||||
|
||||
spandrawfunc_t *spanfunc;
|
||||
spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
|
||||
spandrawfunc_t *spanfunc = NULL;
|
||||
spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX] = {};
|
||||
|
||||
// ==========================================================================
|
||||
// OLD DOOM FUZZY EFFECT
|
||||
@@ -105,14 +105,15 @@ spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
|
||||
#define DEFAULT_STARTTRANSCOLOR 160
|
||||
#define NUM_PALETTE_ENTRIES 256
|
||||
|
||||
static UINT8 **translationtablecache[TT_CACHE_SIZE] = {NULL};
|
||||
static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {NULL};
|
||||
static UINT8 **translationtablecache[TT_CACHE_SIZE] = {};
|
||||
static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {};
|
||||
|
||||
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
|
||||
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1] = {};
|
||||
|
||||
struct GenerateBlendTables_State
|
||||
{
|
||||
RGBA_t *LocalPalette;
|
||||
RGBA_t *gammaCorrectedPalette;
|
||||
};
|
||||
|
||||
static void R_GenerateBlendTables_Core(struct GenerateBlendTables_State *state);
|
||||
@@ -126,6 +127,7 @@ static void R_GenerateBlendTables_Thread(void *userdata)
|
||||
R_GenerateBlendTables_Core(state);
|
||||
|
||||
free(state->LocalPalette);
|
||||
free(state->gammaCorrectedPalette);
|
||||
free(state);
|
||||
}
|
||||
#endif
|
||||
@@ -154,26 +156,33 @@ void R_InitTranslucencyTables(void)
|
||||
}
|
||||
|
||||
static colorlookup_t transtab_lut;
|
||||
static colorlookup_t transtab_lut_corrected;
|
||||
|
||||
static void BlendTab_Translucent(UINT8 *table, int style, UINT8 blendamt)
|
||||
{
|
||||
INT16 bg, fg;
|
||||
RGBA_t backrgba, frontrgba, result;
|
||||
|
||||
if (table == NULL)
|
||||
I_Error("BlendTab_Translucent: input table was NULL!");
|
||||
|
||||
for (bg = 0; bg < 0x100; bg++)
|
||||
{
|
||||
backrgba = pGammaCorrectedPalette[bg];
|
||||
|
||||
for (fg = 0; fg < 0x100; fg++)
|
||||
{
|
||||
RGBA_t backrgba = V_GetColor(bg);
|
||||
RGBA_t frontrgba = V_GetColor(fg);
|
||||
RGBA_t result;
|
||||
frontrgba = pGammaCorrectedPalette[fg];
|
||||
|
||||
#if 0 // perfect implementation
|
||||
result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF);
|
||||
result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt);
|
||||
|
||||
table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue);
|
||||
#else // performance scrabbler
|
||||
result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF);
|
||||
result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt);
|
||||
table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut_corrected, result.s.red, result.s.green, result.s.blue); // pGammaCorrectedPalette
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,7 +233,7 @@ static void BlendTab_Modulative(UINT8 *table)
|
||||
RGBA_t frontrgba = V_GetColor(fg);
|
||||
RGBA_t result;
|
||||
result.rgba = ASTBlendPixel(backrgba, frontrgba, AST_MODULATE, 0);
|
||||
table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue);
|
||||
table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut_corrected, result.s.red, result.s.green, result.s.blue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -278,11 +287,12 @@ void R_GenerateBlendTables(void)
|
||||
size_t palsize = 256 * sizeof(RGBA_t);
|
||||
|
||||
state->LocalPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pLocalPalette, palsize));
|
||||
state->gammaCorrectedPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pGammaCorrectedPalette, palsize));
|
||||
|
||||
I_spawn_thread("blend-tables",
|
||||
R_GenerateBlendTables_Thread, state);
|
||||
#else
|
||||
struct GenerateBlendTables_State state = {pLocalPalette};
|
||||
struct GenerateBlendTables_State state = {pLocalPalette, pGammaCorrectedPalette};
|
||||
R_GenerateBlendTables_Core(&state);
|
||||
#endif
|
||||
}
|
||||
@@ -290,6 +300,7 @@ void R_GenerateBlendTables(void)
|
||||
static void R_GenerateBlendTables_Core(struct GenerateBlendTables_State *state)
|
||||
{
|
||||
InitColorLUT(&transtab_lut, state->LocalPalette, false);
|
||||
InitColorLUT(&transtab_lut_corrected, state->gammaCorrectedPalette, false);
|
||||
|
||||
// Additive
|
||||
BlendTab_GenerateMaps(blendtab_add, AST_ADD, BlendTab_Translucent);
|
||||
@@ -655,7 +666,7 @@ void R_VideoErase(size_t ofs, INT32 count)
|
||||
// is not optimal, e.g. byte by byte on
|
||||
// a 32bit CPU, as GNU GCC/Linux libc did
|
||||
// at one point.
|
||||
M_Memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count);
|
||||
memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
+12
-10
@@ -28,6 +28,8 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "cxxutil.hpp"
|
||||
|
||||
// ==========================================================================
|
||||
// SPANS
|
||||
// ==========================================================================
|
||||
@@ -315,10 +317,10 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
endz = 1.f/iz;
|
||||
endu = uz*endz;
|
||||
endv = vz*endz;
|
||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
stepu = srb2::floattoint<float, INT64>((endu - startu) * INVSPAN);
|
||||
stepv = srb2::floattoint<float, INT64>((endv - startv) * INVSPAN);
|
||||
u = srb2::floattoint<float, INT64>(startu);
|
||||
v = srb2::floattoint<float, INT64>(startv);
|
||||
|
||||
const INT32 x1 = ds->x1;
|
||||
|
||||
@@ -345,8 +347,8 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
{
|
||||
if (width == 1)
|
||||
{
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
u = srb2::floattoint<float, INT64>(startu);
|
||||
v = srb2::floattoint<float, INT64>(startv);
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
@@ -366,10 +368,10 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
endu = uz*endz;
|
||||
endv = vz*endz;
|
||||
left = 1.f/left;
|
||||
stepu = (INT64)((endu - startu) * left);
|
||||
stepv = (INT64)((endv - startv) * left);
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
stepu = srb2::floattoint<float, INT64>((endu - startu) * left);
|
||||
stepv = srb2::floattoint<float, INT64>((endv - startv) * left);
|
||||
u = srb2::floattoint<float, INT64>(startu);
|
||||
v = srb2::floattoint<float, INT64>(startv);
|
||||
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
|
||||
+47
-25
@@ -49,54 +49,54 @@
|
||||
// increment every time a check is made
|
||||
size_t validcount = 1;
|
||||
|
||||
INT32 centerx, centery;
|
||||
INT32 centerx = 0, centery = 0;
|
||||
|
||||
fixed_t centerxfrac, centeryfrac;
|
||||
fixed_t projection;
|
||||
fixed_t projectiony; // aspect ratio
|
||||
fixed_t fovtan; // field of view
|
||||
fixed_t centerxfrac = 0, centeryfrac = 0;
|
||||
fixed_t projection = 0;
|
||||
fixed_t projectiony = 0; // aspect ratio
|
||||
fixed_t fovtan = 0; // field of view
|
||||
|
||||
// just for profiling purposes
|
||||
size_t framecount;
|
||||
size_t framecount = 0;
|
||||
|
||||
size_t loopcount;
|
||||
size_t loopcount = 0;
|
||||
|
||||
fixed_t viewx, viewy, viewz;
|
||||
angle_t viewangle, aimingangle, viewroll;
|
||||
fixed_t viewx = 0, viewy = 0, viewz = 0;
|
||||
angle_t viewangle = 0, aimingangle = 0, viewroll = 0;
|
||||
UINT8 viewssnum = 0;
|
||||
fixed_t viewcos, viewsin;
|
||||
boolean skyVisible;
|
||||
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player
|
||||
sector_t *viewsector;
|
||||
player_t *viewplayer;
|
||||
fixed_t viewcos = 0, viewsin = 0;
|
||||
boolean skyVisible = 0;
|
||||
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS] = {}; // saved values of skyVisible for each splitscreen player
|
||||
sector_t *viewsector = NULL;
|
||||
player_t *viewplayer = NULL;
|
||||
|
||||
fixed_t renderdeltatics;
|
||||
boolean renderisnewtic;
|
||||
fixed_t renderdeltatics = 0;
|
||||
boolean renderisnewtic = true;
|
||||
|
||||
//
|
||||
// precalculated math tables
|
||||
//
|
||||
angle_t clipangle;
|
||||
angle_t doubleclipangle;
|
||||
angle_t clipangle = 0;
|
||||
angle_t doubleclipangle = 0;
|
||||
|
||||
// The viewangletox[viewangle + FINEANGLES/4] lookup
|
||||
// maps the visible view angles to screen X coordinates,
|
||||
// flattening the arc to a flat projection plane.
|
||||
// There will be many angles mapped to the same X.
|
||||
INT32 viewangletox[FINEANGLES/2];
|
||||
INT32 viewangletox[FINEANGLES/2] = {};
|
||||
|
||||
// The xtoviewangleangle[] table maps a screen pixel
|
||||
// to the lowest viewangle that maps back to x ranges
|
||||
// from clipangle to -clipangle.
|
||||
angle_t *xtoviewangle = NULL;
|
||||
|
||||
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
||||
lighttable_t *scalelightfixed[MAXLIGHTSCALE];
|
||||
lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE] = {};
|
||||
lighttable_t *scalelightfixed[MAXLIGHTSCALE] = {};
|
||||
lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ] = {};
|
||||
|
||||
// Hack to support extra boom colormaps.
|
||||
size_t num_extra_colormaps;
|
||||
extracolormap_t extra_colormaps[MAXCOLORMAPS];
|
||||
size_t num_extra_colormaps = 0;
|
||||
extracolormap_t extra_colormaps[MAXCOLORMAPS] = {};
|
||||
|
||||
// Performance stats
|
||||
precise_t ps_prevframetime = 0;
|
||||
@@ -187,7 +187,7 @@ consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL,
|
||||
consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ffloorclip = {"r_ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_spriteclip = {"r_spriteclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_softcyancut = {"softwarecyancut", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_softcyancut = {"softwarecyancut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE|CV_CALL|CV_NOINIT, drawdist_precip_cons_t, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -442,6 +442,28 @@ fixed_t R_ScaleFromGlobalAngle(angle_t visangle)
|
||||
return 64*FRACUNIT;
|
||||
}
|
||||
|
||||
line_t *R_GetFFloorLine(const line_t *line, const ffloor_t *pfloor, const sector_t *sector)
|
||||
{
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min<size_t>((size_t)(line - sector->lines[0]), pfloor->master->frontsector->linecount);
|
||||
return pfloor->master->frontsector->lines[0] + linenum;
|
||||
}
|
||||
else
|
||||
return pfloor->master;
|
||||
}
|
||||
|
||||
side_t *R_GetFFloorSide(const line_t *line, const ffloor_t *pfloor, const sector_t *sector)
|
||||
{
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
line_t *newline = R_GetFFloorLine(line, pfloor, sector);
|
||||
return &sides[newline->sidenum[0]];
|
||||
}
|
||||
else
|
||||
return &sides[pfloor->master->sidenum[0]];
|
||||
}
|
||||
|
||||
//
|
||||
// R_DoCulling
|
||||
// Checks viewz and top/bottom heights of an item against culling planes
|
||||
|
||||
@@ -150,6 +150,9 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
|
||||
#define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y)
|
||||
#define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2))
|
||||
|
||||
line_t *R_GetFFloorLine(const line_t *line, const ffloor_t *pfloor, const sector_t *sector);
|
||||
side_t *R_GetFFloorSide(const line_t *line, const ffloor_t *pfloor, const sector_t *sector);
|
||||
|
||||
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
|
||||
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh);
|
||||
|
||||
|
||||
+5
-5
@@ -147,7 +147,7 @@ static void R_ParseSpriteInfo(boolean spr2)
|
||||
else
|
||||
{
|
||||
memset(&newSpriteName, 0, 5);
|
||||
M_Memcpy(newSpriteName, sprinfoToken, sprinfoTokenLength);
|
||||
memcpy(newSpriteName, sprinfoToken, sprinfoTokenLength);
|
||||
// ^^ we've confirmed that the token is == 4 characters so it will never overflow a 5 byte char buffer
|
||||
strupr(newSpriteName); // Just do this now so we don't have to worry about it
|
||||
}
|
||||
@@ -211,7 +211,7 @@ static void R_ParseSpriteInfo(boolean spr2)
|
||||
// copy skin name yada yada
|
||||
sprinfoTokenLength = strlen(sprinfoToken);
|
||||
skinName = (char *)Z_Malloc((sprinfoTokenLength+1)*sizeof(char),PU_STATIC,NULL);
|
||||
M_Memcpy(skinName,sprinfoToken,sprinfoTokenLength*sizeof(char));
|
||||
memcpy(skinName,sprinfoToken,sprinfoTokenLength*sizeof(char));
|
||||
skinName[sprinfoTokenLength] = '\0';
|
||||
strlwr(skinName);
|
||||
Z_Free(sprinfoToken);
|
||||
@@ -240,11 +240,11 @@ static void R_ParseSpriteInfo(boolean spr2)
|
||||
skin = &localskins[allskins[skinnum].localnum];
|
||||
else
|
||||
skin = &skins[allskins[skinnum].localnum];
|
||||
M_Memcpy(&skin->sprinfo, info, sizeof(spriteinfo_t));
|
||||
memcpy(&skin->sprinfo, info, sizeof(spriteinfo_t));
|
||||
}
|
||||
}
|
||||
else
|
||||
M_Memcpy(&spriteinfo[sprnum], info, sizeof(spriteinfo_t));
|
||||
memcpy(&spriteinfo[sprnum], info, sizeof(spriteinfo_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -371,7 +371,7 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
||||
I_Error("Patch_Create: no column data!");
|
||||
|
||||
patch->columns = static_cast<UINT8*>(Z_Calloc(colsize, PU_PATCH_DATA, NULL));
|
||||
M_Memcpy(patch->columns, ((UINT8 *)source + LONG(source->columnofs[0])), colsize);
|
||||
memcpy(patch->columns, ((UINT8 *)source + LONG(source->columnofs[0])), colsize);
|
||||
}
|
||||
|
||||
return patch;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
//
|
||||
// Angles precalculated in R_InitSprites.
|
||||
//
|
||||
fixed_t rollcosang[ROTANGLES];
|
||||
fixed_t rollsinang[ROTANGLES];
|
||||
fixed_t rollcosang[ROTANGLES] = {};
|
||||
fixed_t rollsinang[ROTANGLES] = {};
|
||||
|
||||
INT32 R_GetRollAngle(angle_t rollangle)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
||||
|
||||
while (dy--)
|
||||
{
|
||||
M_Memcpy(dest, src, width * sizeof(UINT16));
|
||||
memcpy(dest, src, width * sizeof(UINT16));
|
||||
dest += width;
|
||||
src += newwidth;
|
||||
}
|
||||
|
||||
+2
-2
@@ -720,7 +720,7 @@ void R_DrawPlanes(void)
|
||||
srb2::ThreadPool::Sema tp_sema;
|
||||
srb2::g_main_threadpool->begin_sema();
|
||||
#endif
|
||||
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
||||
for (i = 0; i < MAXVISPLANES; i++)
|
||||
{
|
||||
for (pl = visplanes[i]; pl; pl = pl->next)
|
||||
{
|
||||
@@ -755,7 +755,7 @@ void R_DrawSkyPlanes(void)
|
||||
srb2::ThreadPool::Sema tp_sema;
|
||||
srb2::g_main_threadpool->begin_sema();
|
||||
#endif
|
||||
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
||||
for (i = 0; i < MAXVISPLANES; i++)
|
||||
{
|
||||
for (pl = visplanes[i]; pl; pl = pl->next)
|
||||
{
|
||||
|
||||
+6
-6
@@ -21,16 +21,16 @@
|
||||
#include "r_things.h"
|
||||
#include "r_sky.h"
|
||||
|
||||
UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
|
||||
UINT8 portalrender = 0; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
|
||||
|
||||
// Linked list for portals.
|
||||
portal_t *portal_base, *portal_cap;
|
||||
portal_t *portal_base = NULL, *portal_cap = NULL;
|
||||
|
||||
line_t *portalclipline;
|
||||
sector_t *portalcullsector;
|
||||
INT32 portalclipstart, portalclipend;
|
||||
line_t *portalclipline = NULL;
|
||||
sector_t *portalcullsector = NULL;
|
||||
INT32 portalclipstart = 0, portalclipend = 0;
|
||||
|
||||
portal_t *g_portal; // is curline a portal seg?
|
||||
portal_t *g_portal = NULL; // is curline a portal seg?
|
||||
|
||||
void Portal_InitList (void)
|
||||
{
|
||||
|
||||
+47
-54
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "core/memory.h"
|
||||
|
||||
#include "cxxutil.hpp"
|
||||
|
||||
#define HEIGHTBITS 12
|
||||
#define HEIGHTUNIT (1<<HEIGHTBITS)
|
||||
|
||||
@@ -45,10 +47,10 @@ static INT32 toptexture, bottomtexture, midtexture;
|
||||
static bool topremap, bottomremap, midremap;
|
||||
static INT32 numthicksides, numbackffloors;
|
||||
|
||||
angle_t rw_normalangle;
|
||||
angle_t rw_normalangle = 0;
|
||||
// angle to line origin
|
||||
angle_t rw_angle1;
|
||||
fixed_t rw_distance;
|
||||
angle_t rw_angle1 = 0;
|
||||
fixed_t rw_distance = 0;
|
||||
|
||||
//
|
||||
// regular wall
|
||||
@@ -615,6 +617,11 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor)
|
||||
return false;
|
||||
}
|
||||
|
||||
static fixed_t R_GetSlopeTextureSlide(pslope_t *slope, angle_t lineangle)
|
||||
{
|
||||
return FixedMul(slope->zdelta, FINECOSINE((lineangle-slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
}
|
||||
|
||||
//
|
||||
// R_RenderThickSideRange
|
||||
// Renders all the thick sides in the given range.
|
||||
@@ -631,16 +638,15 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
lightlist_t *light;
|
||||
r_lightlist_t *rlight;
|
||||
INT32 range;
|
||||
line_t *newline = NULL;
|
||||
// Render FOF sides kinda like normal sides, with the frac and step and everything
|
||||
// NOTE: INT64 instead of fixed_t because overflow concerns
|
||||
INT64 top_frac, top_step, bottom_frac, bottom_step;
|
||||
// skew FOF walls with slopes?
|
||||
boolean slopeskew = false;
|
||||
fixed_t ffloortextureslide = 0;
|
||||
INT32 oldx = -1;
|
||||
fixed_t oldtexturecolumn = -1;
|
||||
fixed_t left_top, left_bottom; // needed here for slope skewing
|
||||
pslope_t *skewslope = NULL;
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
boolean fog = false;
|
||||
boolean fuzzy = false;
|
||||
|
||||
@@ -648,7 +654,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
|
||||
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
|
||||
|
||||
|
||||
// Calculate light table.
|
||||
// Use different light tables
|
||||
// for horizontal / vertical / diagonal. Diagonal?
|
||||
@@ -657,16 +662,23 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
curline = drawseg->curline;
|
||||
backsector = pfloor->target;
|
||||
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
|
||||
texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture);
|
||||
sidedef = R_GetFFloorSide(curline->linedef, pfloor, pfloor->target);
|
||||
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min((size_t)(curline->linedef-backsector->lines[0]), pfloor->master->frontsector->linecount);
|
||||
newline = pfloor->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
line_t *newline = R_GetFFloorLine(curline->linedef, pfloor, pfloor->target);
|
||||
do_texture_skew = newline->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_texture_skew = pfloor->master->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
||||
texnum = R_GetTextureNum(sidedef->midtexture);
|
||||
|
||||
if (pfloor->flags & FF_TRANSLUCENT)
|
||||
{
|
||||
@@ -826,54 +838,35 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
mceilingclip = drawseg->sprtopclip;
|
||||
dc->texheight = textureheight[texnum]>>FRACBITS;
|
||||
|
||||
// calculate both left endrawseg
|
||||
// calculate both left ends
|
||||
left_top = P_GetFFloorTopZAt (pfloor, drawseg->leftpos.x, drawseg->leftpos.y) - viewz;
|
||||
left_bottom = P_GetFFloorBottomZAt(pfloor, drawseg->leftpos.x, drawseg->leftpos.y) - viewz;
|
||||
|
||||
skewslope = *pfloor->t_slope; // skew using top slope by default
|
||||
|
||||
if (newline)
|
||||
if (do_texture_skew)
|
||||
{
|
||||
if (newline->flags & ML_DONTPEGTOP)
|
||||
slopeskew = true;
|
||||
}
|
||||
else if (pfloor->master->flags & ML_DONTPEGTOP)
|
||||
slopeskew = true;
|
||||
|
||||
if (slopeskew)
|
||||
skewslope = *pfloor->t_slope; // skew using top slope by default
|
||||
dc->texturemid = left_top;
|
||||
}
|
||||
else
|
||||
dc->texturemid = *pfloor->topheight - viewz;
|
||||
|
||||
if (newline)
|
||||
offsetvalue = sidedef->rowoffset;
|
||||
|
||||
if (dont_peg_bottom)
|
||||
{
|
||||
offsetvalue = sides[newline->sidenum[0]].rowoffset;
|
||||
if (newline->flags & ML_DONTPEGBOTTOM)
|
||||
if (do_texture_skew)
|
||||
{
|
||||
skewslope = *pfloor->b_slope; // skew using bottom slope
|
||||
if (slopeskew)
|
||||
dc->texturemid = left_bottom;
|
||||
else
|
||||
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
|
||||
dc->texturemid = left_bottom;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offsetvalue = sides[pfloor->master->sidenum[0]].rowoffset;
|
||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
skewslope = *pfloor->b_slope; // skew using bottom slope
|
||||
if (slopeskew)
|
||||
dc->texturemid = left_bottom;
|
||||
else
|
||||
else
|
||||
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
|
||||
}
|
||||
}
|
||||
|
||||
if (slopeskew && skewslope)
|
||||
if (skewslope)
|
||||
{
|
||||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
ffloortextureslide = FixedMul(skewslope->zdelta, FINECOSINE((lineangle-skewslope->xydirection)>>ANGLETOFINESHIFT));
|
||||
ffloortextureslide = R_GetSlopeTextureSlide(skewslope, lineangle);
|
||||
}
|
||||
|
||||
dc->texturemid += offsetvalue;
|
||||
@@ -919,9 +912,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
// skew FOF walls
|
||||
if (ffloortextureslide)
|
||||
{
|
||||
if (oldx != -1)
|
||||
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x]));
|
||||
oldx = dc->x;
|
||||
if (oldtexturecolumn != -1)
|
||||
dc->texturemid += FixedMul(ffloortextureslide, (oldtexturecolumn-maskedtexturecol[dc->x]));
|
||||
oldtexturecolumn = drawseg->thicksidecol[dc->x];
|
||||
}
|
||||
|
||||
// Calculate bounds
|
||||
@@ -1718,7 +1711,7 @@ static void R_AllocClippingTables(size_t range)
|
||||
{
|
||||
// Check if it's in range of the openings
|
||||
#define CHECK(which) \
|
||||
if (which + drawseg->x1 >= oldopenings && which + drawseg->x1 <= oldlast) \
|
||||
if (which != NULL && which + drawseg->x1 >= oldopenings && which + drawseg->x1 <= oldlast) \
|
||||
which = (which - oldopenings) + openings
|
||||
CHECK(drawseg->sprtopclip);
|
||||
CHECK(drawseg->sprbottomclip);
|
||||
@@ -1752,7 +1745,7 @@ static void R_AllocTextureColumnTables(size_t range)
|
||||
{
|
||||
// Check if it's in range of the tables
|
||||
#define CHECK(which) \
|
||||
if (which + drawseg->x1 >= oldtable && which + drawseg->x1 <= oldlast) \
|
||||
if (which != NULL && which + drawseg->x1 >= oldtable && which + drawseg->x1 <= oldlast) \
|
||||
which = (which - oldtable) + texturecolumntable
|
||||
CHECK(drawseg->maskedtexturecol);
|
||||
CHECK(drawseg->thicksidecol);
|
||||
@@ -1890,8 +1883,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
det = a1*b2 - a2*b1;
|
||||
|
||||
ds_p->leftpos.x = segleft.x = DoubleToFixed((b2*c1 - b1*c2)/det);
|
||||
ds_p->leftpos.y = segleft.y = DoubleToFixed((a1*c2 - a2*c1)/det);
|
||||
ds_p->leftpos.x = segleft.x = srb2::floattofixed<double>((b2*c1 - b1*c2)/det);
|
||||
ds_p->leftpos.y = segleft.y = srb2::floattofixed<double>((a1*c2 - a2*c1)/det);
|
||||
|
||||
// right
|
||||
temp = xtoviewangle[stop]+viewangle;
|
||||
@@ -1902,8 +1895,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
det = a1*b2 - a2*b1;
|
||||
|
||||
ds_p->rightpos.x = segright.x = DoubleToFixed((b2*c1 - b1*c2)/det);
|
||||
ds_p->rightpos.y = segright.y = DoubleToFixed((a1*c2 - a2*c1)/det);
|
||||
ds_p->rightpos.x = segright.x = srb2::floattofixed<double>((b2*c1 - b1*c2)/det);
|
||||
ds_p->rightpos.y = segright.y = srb2::floattofixed<double>((a1*c2 - a2*c1)/det);
|
||||
}
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
@@ -3001,14 +2994,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
||||
{
|
||||
M_Memcpy(lastopening, ceilingclip + start, 2*(rw_stopx - start));
|
||||
memcpy(lastopening, ceilingclip + start, 2*(rw_stopx - start));
|
||||
ds_p->sprtopclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
|
||||
if (((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && !ds_p->sprbottomclip)
|
||||
{
|
||||
M_Memcpy(lastopening, floorclip + start, 2*(rw_stopx - start));
|
||||
memcpy(lastopening, floorclip + start, 2*(rw_stopx - start));
|
||||
ds_p->sprbottomclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
|
||||
+7
-7
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "qs22j.h"
|
||||
|
||||
CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2]; // huehuehuehuehue
|
||||
CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2] = {}; // huehuehuehuehue
|
||||
|
||||
#include "discord.h"
|
||||
|
||||
@@ -55,15 +55,15 @@ UINT8 skinstatscount[9][9] = {
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
UINT8 skinsorted[MAXSKINS];
|
||||
skin_t localskins[MAXLOCALSKINS];
|
||||
skin_t allskins[MAXSKINS+MAXLOCALSKINS];
|
||||
UINT8 skinsorted[MAXSKINS] = {};
|
||||
skin_t localskins[MAXLOCALSKINS] = {};
|
||||
skin_t allskins[MAXSKINS+MAXLOCALSKINS] = {};
|
||||
|
||||
// FIXTHIS: don't work because it must be inistilised before the config load
|
||||
//#define SKINVALUES
|
||||
#ifdef SKINVALUES
|
||||
CV_PossibleValue_t skin_cons_t[MAXSKINS+1];
|
||||
CV_PossibleValue_t localskin_cons_t[MAXLOCALSKINS+1];
|
||||
CV_PossibleValue_t skin_cons_t[MAXSKINS+1] = {};
|
||||
CV_PossibleValue_t localskin_cons_t[MAXLOCALSKINS+1] = {};
|
||||
#endif
|
||||
|
||||
static void Sk_SetDefaultValue(skin_t *skin, boolean local)
|
||||
@@ -520,7 +520,7 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
||||
buf2 = malloc(size+1);
|
||||
if (!buf2)
|
||||
I_Error("R_AddSkins: No more free memory\n");
|
||||
M_Memcpy(buf2,buf,size);
|
||||
memcpy(buf2,buf,size);
|
||||
buf2[size] = '\0';
|
||||
|
||||
// set defaults
|
||||
|
||||
+7
-9
@@ -22,8 +22,6 @@
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "p_maputl.h" // P_PointOnLineSide
|
||||
|
||||
//
|
||||
// sky mapping
|
||||
//
|
||||
@@ -31,28 +29,28 @@
|
||||
/** \brief Needed to store the number of the dummy sky flat.
|
||||
Used for rendering, as well as tracking projectiles etc.
|
||||
*/
|
||||
INT32 skyflatnum;
|
||||
INT32 skyflatnum = 0;
|
||||
|
||||
/** \brief the lump number of the sky texture
|
||||
*/
|
||||
INT32 skytexture;
|
||||
INT32 skytexture = 0;
|
||||
|
||||
/** \brief the horizon line in a 256x128 sky texture
|
||||
*/
|
||||
INT32 skytexturemid;
|
||||
INT32 skytexturemid = 0;
|
||||
|
||||
/** \brief the x offset of the sky texture
|
||||
*/
|
||||
INT32 skytextureoffset;
|
||||
INT32 skytextureoffset = 0;
|
||||
|
||||
/** \brief the scale of the sky
|
||||
*/
|
||||
fixed_t skyscale;
|
||||
fixed_t skyscale = 0;
|
||||
|
||||
/** \brief used for keeping track of the current sky
|
||||
*/
|
||||
INT32 levelskynum;
|
||||
INT32 globallevelskynum;
|
||||
INT32 levelskynum = 0;
|
||||
INT32 globallevelskynum = 0;
|
||||
|
||||
|
||||
/** \brief The R_SetupSkyDraw function
|
||||
|
||||
+7
-7
@@ -95,15 +95,15 @@ static INT32 drawsegs_xrange_count = 0;
|
||||
// There was a lot of stuff grabbed wrong, so I changed it...
|
||||
//
|
||||
|
||||
spriteinfo_t spriteinfo[NUMSPRITES];
|
||||
spriteinfo_t spriteinfo[NUMSPRITES] = {};
|
||||
|
||||
//
|
||||
// INITIALIZATION FUNCTIONS
|
||||
//
|
||||
|
||||
// variables used to look up and range check thing_t sprites patches
|
||||
spritedef_t *sprites;
|
||||
size_t numsprites;
|
||||
spritedef_t *sprites = NULL;
|
||||
size_t numsprites = 0;
|
||||
|
||||
static spriteframe_t sprtemp[64];
|
||||
static size_t maxframe;
|
||||
@@ -112,7 +112,7 @@ static const char *spritename;
|
||||
//
|
||||
// GAME FUNCTIONS
|
||||
//
|
||||
UINT32 visspritecount, numvisiblesprites;
|
||||
UINT32 visspritecount = 0, numvisiblesprites = 0;
|
||||
|
||||
static UINT32 clippedvissprites;
|
||||
static vissprite_t *visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL};
|
||||
@@ -267,7 +267,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
||||
if (spritedef->numframes) // (then spriteframes is not null)
|
||||
{
|
||||
// copy the already defined sprite frames
|
||||
M_Memcpy(sprtemp, spritedef->spriteframes,
|
||||
memcpy(sprtemp, spritedef->spriteframes,
|
||||
spritedef->numframes * sizeof (spriteframe_t));
|
||||
maxframe = spritedef->numframes - 1;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
||||
spritedef->spriteframes = static_cast<spriteframe_t*>(Z_Malloc(maxframe * sizeof (*spritedef->spriteframes), PU_STATIC, NULL));
|
||||
|
||||
spritedef->numframes = maxframe;
|
||||
M_Memcpy(spritedef->spriteframes, sprtemp, maxframe*sizeof (spriteframe_t));
|
||||
memcpy(spritedef->spriteframes, sprtemp, maxframe*sizeof (spriteframe_t));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1019,7 +1019,7 @@ static void R_SplitSprite(vissprite_t *sprite)
|
||||
INT16 *cliptop = newsprite->cliptop;
|
||||
INT16 *clipbot = newsprite->clipbot;
|
||||
|
||||
M_Memcpy(newsprite, sprite, sizeof (vissprite_t));
|
||||
memcpy(newsprite, sprite, sizeof (vissprite_t));
|
||||
|
||||
newsprite->cliptop = cliptop;
|
||||
newsprite->clipbot = clipbot;
|
||||
|
||||
+64
-51
@@ -45,7 +45,7 @@ static void Command_ShowMusicCredit_f(void);
|
||||
static void GameSounds_OnChange(void);
|
||||
static void GameMusic_OnChange(void);
|
||||
|
||||
static void SoundPrecache_OnChange(void);
|
||||
static void SoundCache_OnChange(void);
|
||||
static void BufferSize_OnChange(void);
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
@@ -57,10 +57,6 @@ static void AmigaType_OnChange(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||
consvar_t cv_samplerate = {"samplerate", "44100", 0, CV_Unsigned, NULL, 22050, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t audbuffersize_cons_t[] = {{128, "128"}, {256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}};
|
||||
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -68,7 +64,8 @@ consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL, audbuf
|
||||
consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// if true, all sounds are loaded at game startup
|
||||
consvar_t precachesound = {"precachesound", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, SoundPrecache_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t cachesounds_cons_t[] = {{0, "Off"}, {1, "Keep"}, {2, "On"}, {0, NULL}};
|
||||
consvar_t cv_cachesound = {"cachesound", "1", CV_SAVE|CV_CALL|CV_NOINIT, cachesounds_cons_t, SoundCache_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// actual general (maximum) sound & music volume, saved into the config
|
||||
static CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}};
|
||||
@@ -113,7 +110,6 @@ consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_
|
||||
consvar_t cv_resetspecialmusic = {"resetspecialmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_birdmusic = {"birdmusicstuff", "No", CV_SAVE|CV_CALL, CV_YesNo, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_keepmusic = {"keepmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skipintromusic = {"skipintromusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -214,26 +210,33 @@ static INT32 S_getChannel(const void *origin, sfxinfo_t *sfxinfo)
|
||||
if (!channels[cnum].sfxinfo)
|
||||
break;
|
||||
|
||||
const boolean samesoundplaying = channels[cnum].sfxinfo == sfxinfo;
|
||||
|
||||
// Now checks if same sound is being played, rather
|
||||
// than just one sound per mobj
|
||||
else if (sfxinfo == channels[cnum].sfxinfo && (sfxinfo->pitch & SF_NOMULTIPLESOUND))
|
||||
if (samesoundplaying && (sfxinfo->pitch & SF_NOMULTIPLESOUND))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (sfxinfo == channels[cnum].sfxinfo && sfxinfo->singularity == true)
|
||||
|
||||
if (samesoundplaying && sfxinfo->singularity == true)
|
||||
{
|
||||
S_StopChannel(cnum);
|
||||
break;
|
||||
}
|
||||
else if (origin && channels[cnum].origin == origin && channels[cnum].sfxinfo == sfxinfo)
|
||||
|
||||
const boolean sameorigin = origin && channels[cnum].origin == origin;
|
||||
|
||||
if (sameorigin && samesoundplaying)
|
||||
{
|
||||
if (sfxinfo->pitch & SF_NOINTERRUPT)
|
||||
return -1;
|
||||
else
|
||||
S_StopChannel(cnum);
|
||||
|
||||
S_StopChannel(cnum);
|
||||
break;
|
||||
}
|
||||
else if (origin && channels[cnum].origin == origin
|
||||
|
||||
if (sameorigin
|
||||
&& channels[cnum].sfxinfo->name != sfxinfo->name
|
||||
&& (channels[cnum].sfxinfo->pitch & SF_TOTALLYSINGLE) && (sfxinfo->pitch & SF_TOTALLYSINGLE))
|
||||
{
|
||||
@@ -274,11 +277,8 @@ void S_RegisterSoundStuff(void)
|
||||
}
|
||||
|
||||
CV_RegisterVar(&stereoreverse);
|
||||
CV_RegisterVar(&precachesound);
|
||||
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
|
||||
CV_RegisterVar(&cv_samplerate);
|
||||
#endif
|
||||
//CV_RegisterVar(&cv_resetmusic);
|
||||
CV_RegisterVar(&cv_cachesound);
|
||||
|
||||
CV_RegisterVar(&cv_gamesounds);
|
||||
CV_RegisterVar(&cv_gamedigimusic);
|
||||
|
||||
@@ -302,7 +302,6 @@ void S_RegisterSoundStuff(void)
|
||||
|
||||
CV_RegisterVar(&cv_resume);
|
||||
CV_RegisterVar(&cv_fading);
|
||||
CV_RegisterVar(&cv_birdmusic);
|
||||
// bird music stuff end
|
||||
|
||||
CV_RegisterVar(&cv_keepmusic);
|
||||
@@ -362,9 +361,15 @@ boolean S_SoundDisabled(void)
|
||||
return (sound_disabled || (window_notinfocus && !cv_playsoundifunfocused.value));
|
||||
}
|
||||
|
||||
boolean S_PrecacheSound(void)
|
||||
int S_CacheSound(void)
|
||||
{
|
||||
return (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value));
|
||||
if (sound_disabled)
|
||||
return SOUNDCACHE_OFF;
|
||||
|
||||
if (M_CheckParm("-precachesound"))
|
||||
return SOUNDCACHE_PRECACHE;
|
||||
|
||||
return cv_cachesound.value;
|
||||
}
|
||||
|
||||
// Stop all sounds, load level info, THEN start sounds.
|
||||
@@ -1150,28 +1155,35 @@ void S_InitSfxChannels(INT32 sfxVolume)
|
||||
|
||||
SetChannelsNum();
|
||||
|
||||
// Note that sounds have not been cached (yet).
|
||||
for (i = 1; i < NUMSFX; i++)
|
||||
{
|
||||
S_sfx[i].lumpnum = LUMPERROR;
|
||||
}
|
||||
|
||||
// Precache sounds if requested
|
||||
if (S_PrecacheSound())
|
||||
if (S_CacheSound() == SOUNDCACHE_PRECACHE)
|
||||
{
|
||||
// Initialize external data (all sounds) at start, keep static.
|
||||
CONS_Printf(M_GetText("Pre-caching sounds..."));
|
||||
|
||||
for (i = 1; i < sfx_freeslot0; i++)
|
||||
if (S_sfx[i].name && !S_sfx[i].data)
|
||||
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
|
||||
// NUMSFX is a big number, so merge the loops
|
||||
for (i = 1; i < NUMSFX; i++)
|
||||
{
|
||||
S_sfx[i].lumpnum = LUMPERROR;
|
||||
|
||||
for (i = sfx_freeslot0; i < NUMSFX; i++)
|
||||
if (S_sfx[i].priority && !S_sfx[i].data)
|
||||
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
|
||||
if (S_sfx[i].data)
|
||||
continue;
|
||||
|
||||
if ((i < sfx_freeslot0 && S_sfx[i].name) ||
|
||||
(i >= sfx_freeslot0 && S_sfx[i].priority))
|
||||
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
|
||||
}
|
||||
|
||||
CONS_Printf(M_GetText("...pre-cached all sound data\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Note that sounds have not been cached (yet).
|
||||
for (i = 1; i < NUMSFX; i++)
|
||||
{
|
||||
S_sfx[i].lumpnum = LUMPERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
@@ -1262,8 +1274,7 @@ static musicdef_t *S_AddMusicCredit(void)
|
||||
|
||||
struct cursongcredit cursongcredit = {0}; // Currently displayed song credit info
|
||||
|
||||
static boolean
|
||||
ReadMusicDefFields (UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
|
||||
static boolean ReadMusicDefFields(UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
|
||||
{
|
||||
musicdef_t *def;
|
||||
|
||||
@@ -1409,7 +1420,7 @@ void S_LoadMusicDefs(UINT16 wadnum)
|
||||
musdeftext = malloc(size+1);
|
||||
if (!musdeftext)
|
||||
I_Error("S_LoadMusicDefs: No more free memory for the parser\n");
|
||||
M_Memcpy(musdeftext, lump, size);
|
||||
memcpy(musdeftext, lump, size);
|
||||
musdeftext[size] = '\0';
|
||||
|
||||
// Find music def
|
||||
@@ -1474,7 +1485,7 @@ void S_InitMusicDefs(void)
|
||||
//
|
||||
musicdef_t *S_FindMusicCredit(const char *musname)
|
||||
{
|
||||
UINT32 hash = quickncasehash (musname, 6);
|
||||
UINT32 hash = quickncasehash(musname, 6);
|
||||
musicdef_t *def;
|
||||
|
||||
for (INT32 i = 0; i < nummusicdefs; ++i)
|
||||
@@ -1633,7 +1644,8 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname)
|
||||
{
|
||||
if (S_MusicExists(mname, false, true)) // check non midis first
|
||||
return W_GetNumForName(va("o_%s", mname));
|
||||
else if (S_MusicExists(mname, true, false))
|
||||
|
||||
if (S_MusicExists(mname, true, false))
|
||||
{
|
||||
#ifdef NO_MIDI
|
||||
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
|
||||
@@ -1673,8 +1685,8 @@ static boolean S_LoadMusic(const char *mname)
|
||||
music.data = mdata;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void S_UnloadMusic(void)
|
||||
@@ -1818,7 +1830,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
||||
}
|
||||
}
|
||||
|
||||
void S_ChangeMusicSpecial (const char *mmusic)
|
||||
void S_ChangeMusicSpecial(const char *mmusic)
|
||||
{
|
||||
if (cv_resetspecialmusic.value)
|
||||
S_ChangeMusic(mmusic, MUSIC_FORCERESET, true);
|
||||
@@ -1833,7 +1845,7 @@ void S_StopMusic(void)
|
||||
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
||||
return;
|
||||
|
||||
mapmusic.resume = (cv_birdmusic.value && fasticmp(music.name, mapmusic.name)) ? I_GetSongPosition() : 0;
|
||||
mapmusic.resume = (cv_resume.value && fasticmp(music.name, mapmusic.name)) ? I_GetSongPosition() : 0;
|
||||
|
||||
S_SetKeepMusResume();
|
||||
|
||||
@@ -1885,7 +1897,7 @@ void S_SetMusicVolume(INT32 volume)
|
||||
|
||||
void S_SetRestoreMusicFadeInCvar(consvar_t *cv)
|
||||
{
|
||||
music_refade_cv = cv_birdmusic.value ? cv : 0;
|
||||
music_refade_cv = cv;
|
||||
}
|
||||
|
||||
int S_GetRestoreMusicFadeIn(void)
|
||||
@@ -1914,8 +1926,8 @@ boolean S_FadeMusicFromVolume(UINT8 target_volume, INT16 source_volume, UINT32 m
|
||||
{
|
||||
if (source_volume < 0)
|
||||
return I_FadeSong(target_volume, ms, NULL);
|
||||
else
|
||||
return I_FadeSongFromVolume(target_volume, source_volume, ms, NULL);
|
||||
|
||||
return I_FadeSongFromVolume(target_volume, source_volume, ms, NULL);
|
||||
}
|
||||
|
||||
boolean S_FadeOutStopMusic(UINT32 ms)
|
||||
@@ -2067,6 +2079,7 @@ void S_InitMapMusic(void)
|
||||
{
|
||||
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, keepmusic.resume, 0, 500);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2080,7 +2093,7 @@ void S_InitMapMusic(void)
|
||||
return;
|
||||
|
||||
if (leveltime < MUSICSTARTTIME) // SRB2Kart
|
||||
S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic();
|
||||
S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); // S_StopMusic();
|
||||
}
|
||||
|
||||
void S_StartMapMusic(void)
|
||||
@@ -2277,13 +2290,13 @@ static void GameSounds_OnChange(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void SoundPrecache_OnChange(void)
|
||||
static void SoundCache_OnChange(void)
|
||||
{
|
||||
if (S_PrecacheSound())
|
||||
if (S_CacheSound() != SOUNDCACHE_OFF)
|
||||
{
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
}
|
||||
else if (!S_PrecacheSound())
|
||||
else
|
||||
{
|
||||
S_ClearSfx();
|
||||
|
||||
@@ -2348,7 +2361,7 @@ static void AmigaType_OnChange(void)
|
||||
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga_type", cv_amigatype.string);
|
||||
|
||||
if (sound_started)
|
||||
S_RestartMusic(); //need to restart the music system or else it wont work
|
||||
S_RestartMusic(); // need to restart the music system or else it wont work
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+10
-3
@@ -68,16 +68,16 @@ extern consvar_t cv_resetspecialmusic;
|
||||
|
||||
extern consvar_t cv_resume;
|
||||
extern consvar_t cv_fading;
|
||||
extern consvar_t cv_birdmusic;
|
||||
|
||||
extern consvar_t cv_keepmusic;
|
||||
extern consvar_t cv_skipintromusic;
|
||||
//extern consvar_t cv_ignoremusicchanges;
|
||||
extern boolean keepmapmusic;
|
||||
extern boolean skipintromus;
|
||||
|
||||
#define MUSICSTARTTIME (starttime + (TICRATE/2))
|
||||
|
||||
extern consvar_t precachesound;
|
||||
extern consvar_t cv_cachesound;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -148,11 +148,18 @@ void S_StopSound(void *origin);
|
||||
// Music Status
|
||||
//
|
||||
|
||||
enum
|
||||
{
|
||||
SOUNDCACHE_OFF,
|
||||
SOUNDCACHE_KEEP,
|
||||
SOUNDCACHE_PRECACHE
|
||||
};
|
||||
|
||||
boolean S_MusicDisabled(void);
|
||||
boolean S_MusicPlaying(void);
|
||||
boolean S_MusicPaused(void);
|
||||
boolean S_MusicNotInFocus(void);
|
||||
boolean S_PrecacheSound(void);
|
||||
int S_CacheSound(void);
|
||||
musictype_t S_MusicType(void);
|
||||
const char *S_MusicName(void);
|
||||
boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping);
|
||||
|
||||
Loaded 100 of 120 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user