Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e13ba89f1a | ||
|
|
d8b2134aef | ||
|
|
c168832f8e | ||
|
|
448a603a56 | ||
|
|
2a95201c6d | ||
|
|
a73de55f96 | ||
|
|
e4a4496be6 | ||
|
|
a8f3a8dfb0 | ||
|
|
e19b9d1c60 | ||
|
|
e28ec4e7cb | ||
|
|
d0f09b467b |
No files matched your search
+7
-8
@@ -13,17 +13,16 @@ Win32_LIB_ASM_Release
|
|||||||
*.dgb
|
*.dgb
|
||||||
*.debug
|
*.debug
|
||||||
*.debug.txt
|
*.debug.txt
|
||||||
|
/bin/VC10/
|
||||||
|
/objs/VC10/
|
||||||
*.user
|
*.user
|
||||||
*.db
|
*.db
|
||||||
*.opendb
|
*.opendb
|
||||||
/.vs
|
/.vs
|
||||||
/debian
|
/debian
|
||||||
/assets/debian
|
/assets/debian
|
||||||
/make
|
compile.sh
|
||||||
/bin
|
*.gz
|
||||||
/build
|
.vscode/
|
||||||
/build/*
|
out
|
||||||
/CMakeUserPresets.json
|
build
|
||||||
/out
|
|
||||||
/objs/VC10
|
|
||||||
*.kate-swp
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/lsdlsrb2
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/lsdlsrb2
|
||||||
|
/pnd
|
||||||
|
/*.mo
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/lsdlsrb2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/lsdl2srb2kart
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
*.exe
|
||||||
|
*.mo
|
||||||
|
r_opengl.dll
|
||||||
|
*.bat
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
*.exe
|
||||||
|
*.mo
|
||||||
|
r_opengl.dll
|
||||||
|
*.bat
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/srb2sdl.exe
|
||||||
|
/srb2win.exe
|
||||||
|
/r_opengl.dll
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
*.exe
|
||||||
|
*.mo
|
||||||
|
r_opengl.dll
|
||||||
|
*.bat
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#All folders
|
||||||
|
SRB2.res
|
||||||
|
depend.dep
|
||||||
|
depend.ped
|
||||||
|
*.o
|
||||||
|
#VC9 folder only
|
||||||
|
/VC9/Win32
|
||||||
|
/VC9/x64
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# DON'T REMOVE
|
||||||
|
# This keeps the folder from disappearing
|
||||||
+1
-13
@@ -228,14 +228,6 @@ set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
|||||||
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
||||||
set(SRB2_CONFIG_USE_FBO_OGL ON CACHE BOOL
|
set(SRB2_CONFIG_USE_FBO_OGL ON CACHE BOOL
|
||||||
"Enable OpenGL FBO Downsampling support.")
|
"Enable OpenGL FBO Downsampling support.")
|
||||||
set(SRB2_CONFIG_DEDICATED OFF CACHE BOOL
|
|
||||||
"Build a dedicated server.")
|
|
||||||
|
|
||||||
if(${SRB2_CONFIG_DEDICATED})
|
|
||||||
set(SRB2_CONFIG_HAVE_GME NO)
|
|
||||||
set(SRB2_CONFIG_HAVE_OPENMPT NO)
|
|
||||||
set(SRB2_CONFIG_HWRENDER NO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
### use internal libraries?
|
### use internal libraries?
|
||||||
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
||||||
@@ -562,11 +554,7 @@ add_definitions(-DCMAKECONFIG)
|
|||||||
# ${SRB2_BLUA_HEADERS}
|
# ${SRB2_BLUA_HEADERS}
|
||||||
#)
|
#)
|
||||||
|
|
||||||
if(${SRB2_CONFIG_DEDICATED})
|
add_subdirectory(sdl)
|
||||||
add_subdirectory(dedicated)
|
|
||||||
else()
|
|
||||||
add_subdirectory(sdl)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
||||||
message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(")
|
message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(")
|
||||||
|
|||||||
+709
-344
File diff suppressed because it is too large.
Load diff
@@ -1,19 +0,0 @@
|
|||||||
makedir:=$(makedir)/Dedicated
|
|
||||||
|
|
||||||
sources+=$(call List,dedicated/Sourcefile)
|
|
||||||
|
|
||||||
opts+=-DDEDICATED
|
|
||||||
|
|
||||||
ifdef MINGW
|
|
||||||
libs+=-mconsole
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOTHREADS
|
|
||||||
opts+=-DHAVE_THREADS
|
|
||||||
sources+=dedicated/i_threads.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
NOOPENMPT=1
|
|
||||||
NOGME=1
|
|
||||||
NOHW=1
|
|
||||||
NOUPNP=1
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
#
|
|
||||||
# Detect the host system and compiler version.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Previously featured:\
|
|
||||||
PANDORA\
|
|
||||||
DUMMY\
|
|
||||||
DJGPPDOS\
|
|
||||||
SOLARIS\
|
|
||||||
MACOSX\
|
|
||||||
|
|
||||||
all_systems:=\
|
|
||||||
LINUX64\
|
|
||||||
MINGW64\
|
|
||||||
MINGW\
|
|
||||||
UNIX\
|
|
||||||
LINUX\
|
|
||||||
FREEBSD\
|
|
||||||
HAIKU\
|
|
||||||
|
|
||||||
# check for user specified system
|
|
||||||
ifeq (,$(filter $(all_systems),$(.VARIABLES)))
|
|
||||||
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
|
|
||||||
|
|
||||||
ifeq ($(shell uname -s | grep -o MINGW64),MINGW64) # 64-bit MinGW
|
|
||||||
_m=Detected a Windows system,\
|
|
||||||
compiling for 64-bit MinGW SDL...)
|
|
||||||
$(call Print,$(_m))
|
|
||||||
MINGW64=1
|
|
||||||
else # 32-bit MinGW
|
|
||||||
_m=Detected a Windows system,\
|
|
||||||
compiling for 32-bit MinGW SDL...)
|
|
||||||
$(call Print,$(_m))
|
|
||||||
MINGW=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
NOOBJDUMP=1
|
|
||||||
else # if you on the *nix
|
|
||||||
|
|
||||||
system:=$(shell uname -s)
|
|
||||||
|
|
||||||
ifeq ($(system),Linux)
|
|
||||||
new_system:=LINUX
|
|
||||||
else ifeq ($(system),Haiku)
|
|
||||||
new_system:=HAIKU
|
|
||||||
else
|
|
||||||
|
|
||||||
$(error \
|
|
||||||
Could not automatically detect your system,\
|
|
||||||
try specifying a system manually)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(shell getconf LONG_BIT),64)
|
|
||||||
system+=64-bit
|
|
||||||
new_system:=$(new_system)64
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(call Print,Detected $(system) ($(new_system))...)
|
|
||||||
$(new_system):=1
|
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# This must have high to low order.
|
|
||||||
gcc_versions:=\
|
|
||||||
151 150 15\
|
|
||||||
142 141 140 14\
|
|
||||||
132 131 130 13\
|
|
||||||
123 122 121 120 12\
|
|
||||||
114 113 112 111 110 11\
|
|
||||||
105 104 103 102 101 100 10\
|
|
||||||
95 94 93 92 91 90\
|
|
||||||
85 84 83 82 81 80\
|
|
||||||
75 74 73 72 71 70\
|
|
||||||
64 63 62 61 60\
|
|
||||||
55 54 53 52 51 50\
|
|
||||||
49 48 47 46 45 44 43 42 41 40
|
|
||||||
|
|
||||||
latest_gcc_version:=15.1.1
|
|
||||||
|
|
||||||
# Automatically set version flag, but not if one was
|
|
||||||
# manually set. And don't bother if this is a clean only
|
|
||||||
# run.
|
|
||||||
ifeq (,$(call Wildvar,GCC% destructive))
|
|
||||||
|
|
||||||
# can't use $(CC) --version here since that uses argv[0] to display the name
|
|
||||||
# also gcc outputs the information to stderr, so I had to do 2>&1
|
|
||||||
# this program really doesn't like identifying itself
|
|
||||||
shellversion:=$(shell $(CC) -v 2>&1)
|
|
||||||
# Try to remove "-win32"
|
|
||||||
version:=$(subst -win32,.0,$(shellversion))
|
|
||||||
|
|
||||||
# check if this is in fact GCC
|
|
||||||
ifneq (,$(findstring gcc version,$(version)))
|
|
||||||
|
|
||||||
# in stark contrast to the name, gcc will give me a nicely formatted version number for free
|
|
||||||
shellversion:=$(shell $(CC) -dumpfullversion)
|
|
||||||
|
|
||||||
# Try to remove "-win32"
|
|
||||||
version:=$(subst -win32,.0,$(shellversion))
|
|
||||||
|
|
||||||
# Turn version into words of major, minor
|
|
||||||
v:=$(subst ., ,$(version))
|
|
||||||
# concat. major minor
|
|
||||||
v:=$(word 1,$(v))$(word 2,$(v))
|
|
||||||
|
|
||||||
# If this version is not in the list,
|
|
||||||
# default to the latest supported
|
|
||||||
ifeq (,$(filter $(v),$(gcc_versions)))
|
|
||||||
define line =
|
|
||||||
Your compiler version, GCC $(version), \
|
|
||||||
is not supported by the Makefile.
|
|
||||||
The Makefile will assume GCC $(latest_gcc_version).
|
|
||||||
endef
|
|
||||||
$(call Print,$(line))
|
|
||||||
GCC$(subst .,,$(latest_gcc_version)):=1
|
|
||||||
else
|
|
||||||
$(call Print,Detected GCC $(version) (GCC$(v)))
|
|
||||||
GCC$(v):=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile for feature flags.
|
|
||||||
#
|
|
||||||
|
|
||||||
passthru_opts+=\
|
|
||||||
NOHW NOMD5 NOPOSTPROCESSING\
|
|
||||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
|
||||||
HAVE_MINIUPNPC\
|
|
||||||
HAVE_DISCORDRPC DEVELOP\
|
|
||||||
NOBLUAJIT
|
|
||||||
|
|
||||||
# build with debugging information
|
|
||||||
ifdef DEBUGMODE
|
|
||||||
PACKETDROP=1
|
|
||||||
opts+=-DPARANOIA -DRANGECHECK
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOHW
|
|
||||||
opts+=-DHWRENDER
|
|
||||||
|
|
||||||
ifndef NOSCREENFBO
|
|
||||||
opts+=-DUSE_FBO_OGL
|
|
||||||
endif
|
|
||||||
|
|
||||||
sources+=$(call List,hardware/Sourcefile)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOMD5
|
|
||||||
sources+=md5.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NONET
|
|
||||||
ifndef NOSATURNJOIN
|
|
||||||
opts+=-DDOSATURNJOIN
|
|
||||||
endif
|
|
||||||
ifndef NOSATURNPAK
|
|
||||||
opts+=-DDOSATURNPAK
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOZLIB
|
|
||||||
ifndef NOPNG
|
|
||||||
ifdef PNG_PKGCONFIG
|
|
||||||
$(eval $(call Use_pkg_config,PNG_PKGCONFIG))
|
|
||||||
else
|
|
||||||
PNG_CONFIG?=$(call Prefix,libpng-config)
|
|
||||||
$(eval $(call Configure,PNG,$(PNG_CONFIG) \
|
|
||||||
$(if $(PNG_STATIC),--static),,--ldflags))
|
|
||||||
endif
|
|
||||||
ifdef LINUX
|
|
||||||
opts+=-D_LARGEFILE64_SOURCE
|
|
||||||
endif
|
|
||||||
opts+=-DHAVE_PNG
|
|
||||||
sources+=apng.c
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOCURL
|
|
||||||
CURLCONFIG?=curl-config
|
|
||||||
$(eval $(call Configure,CURL,$(CURLCONFIG)))
|
|
||||||
opts+=-DHAVE_CURL
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef HAVE_MINIUPNPC
|
|
||||||
MINIUPNPC_PKGCONFIG?=miniupnpc
|
|
||||||
$(eval $(call Use_pkg_config,MINIUPNPC))
|
|
||||||
HAVE_MINIUPNPC=1
|
|
||||||
opts+=-DHAVE_MINIUPNPC
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOLIBBACKTRACE
|
|
||||||
$(eval $(call Propogate_flags,LIBBACKTRACE))
|
|
||||||
libs+=-lbacktrace
|
|
||||||
opts+=-DHAVE_LIBBACKTRACE
|
|
||||||
endif
|
|
||||||
|
|
||||||
#windoze hack
|
|
||||||
ifdef MINGW
|
|
||||||
ifndef NODISCORDRPC
|
|
||||||
HAVE_DISCORDRPC=1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef HAVE_DISCORDRPC
|
|
||||||
$(eval $(call Propogate_flags,DISCORDRPC))
|
|
||||||
libs+=-ldiscord-rpc
|
|
||||||
opts+=-DUSE_STUN
|
|
||||||
sources+=discord.c stun.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
# (Valgrind is a memory debugger.)
|
|
||||||
ifdef VALGRIND
|
|
||||||
VALGRIND_PKGCONFIG?=valgrind
|
|
||||||
VALGRIND_LDFLAGS=
|
|
||||||
$(eval $(call Use_pkg_config,VALGRIND))
|
|
||||||
ZDEBUG=1
|
|
||||||
opts+=-DHAVE_VALGRIND
|
|
||||||
endif
|
|
||||||
|
|
||||||
default_packages:=\
|
|
||||||
GME/libgme/LIBGME\
|
|
||||||
OPENMPT/libopenmpt/LIBOPENMPT\
|
|
||||||
ZLIB/zlib\
|
|
||||||
|
|
||||||
$(foreach p,$(default_packages),\
|
|
||||||
$(eval $(call Check_pkg_config,$(p))))
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile options for Haiku
|
|
||||||
#
|
|
||||||
|
|
||||||
opts+=-DUNIXCOMMON -DLUA_USE_POSIX
|
|
||||||
|
|
||||||
ifndef DEDICATED
|
|
||||||
ifndef DUMMY
|
|
||||||
SDL?=1
|
|
||||||
DEDICATED?=0
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
NOEXECINFO=1
|
|
||||||
|
|
||||||
ifeq (${SDL},1)
|
|
||||||
EXENAME?=srb2haiku
|
|
||||||
else ifeq (${DEDICATED},1)
|
|
||||||
EXENAME?=srb2haikud
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NONET
|
|
||||||
libs+=-lnetwork
|
|
||||||
endif
|
|
||||||
|
|
||||||
define _set =
|
|
||||||
$(1)_CFLAGS?=$($(1)_opts)
|
|
||||||
$(1)_LDFLAGS?=$($(1)_libs)
|
|
||||||
endef
|
|
||||||
|
|
||||||
lib:=../libs/gme
|
|
||||||
LIBGME_opts:=-I$(lib)/include
|
|
||||||
LIBGME_libs:=-l:libgme.so.0
|
|
||||||
$(eval $(call _set,LIBGME))
|
|
||||||
|
|
||||||
lib:=../libs/libopenmpt
|
|
||||||
LIBOPENMPT_opts:=-I$(lib)/inc
|
|
||||||
LIBOPENMPT_libs:=-l:libopenmpt.so.0
|
|
||||||
$(eval $(call _set,LIBOPENMPT))
|
|
||||||
|
|
||||||
ifdef SDL
|
|
||||||
lib:=../libs/SDL2_mixer
|
|
||||||
mixer_opts:=-I$(lib)/include
|
|
||||||
mixer_libs:=-l:libSDL2_mixer-2.0.so.0
|
|
||||||
|
|
||||||
lib:=../libs/SDL2
|
|
||||||
SDL_opts:=-I$(lib)/include $(mixer_opts)
|
|
||||||
SDL_libs:=$(mixer_libs) -l:libSDL2-2.0.so.0
|
|
||||||
$(eval $(call _set,SDL))
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib:=../libs/zlib
|
|
||||||
ZLIB_opts:=-I$(lib)
|
|
||||||
ZLIB_libs:=-l:libz.so.1
|
|
||||||
$(eval $(call _set,ZLIB))
|
|
||||||
|
|
||||||
ifndef PNG_CONFIG
|
|
||||||
PNG_opts:=
|
|
||||||
PNG_libs:=-l:libpng16.so.16
|
|
||||||
$(eval $(call _set,PNG))
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib:=../libs/curl
|
|
||||||
CURL_opts:=-I$(lib)/include
|
|
||||||
CURL_libs:=-l:libcurl.so.4
|
|
||||||
$(eval $(call _set,CURL))
|
|
||||||
|
|
||||||
lib:=../libs/miniupnpc
|
|
||||||
MINIUPNPC_opts:=-I$(lib)/include
|
|
||||||
MINIUPNPC_libs:=-l:libminiupnpc.so.17
|
|
||||||
$(eval $(call _set,MINIUPNPC))
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile options for unices (linux, bsd...)
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
opts+=-DUNIXCOMMON -DLUA_USE_POSIX
|
|
||||||
# Use -rdynamic so a backtrace log shows function names
|
|
||||||
# instead of addresses
|
|
||||||
libs+=-lm -rdynamic
|
|
||||||
|
|
||||||
ifndef NOHW
|
|
||||||
opts+=-I/usr/X11R6/include
|
|
||||||
libs+=-L/usr/X11R6/lib
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef DEDICATED
|
|
||||||
SDL?=1
|
|
||||||
DEDICATED?=0
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (${SDL},1)
|
|
||||||
EXENAME?=lsdl2srb2kart
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (${DEDICATED},1)
|
|
||||||
EXENAME?=lsrb2kartd
|
|
||||||
endif
|
|
||||||
|
|
||||||
# In common usage.
|
|
||||||
ifdef LINUX
|
|
||||||
libs+=-lrt
|
|
||||||
passthru_opts+=NOTERMIOS
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Tested by Steel, as of release 2.2.8.
|
|
||||||
ifdef FREEBSD
|
|
||||||
opts+=-I/usr/X11R6/include -DLINUX -DFREEBSD
|
|
||||||
libs+=-L/usr/X11R6/lib -lkvm -lexecinfo
|
|
||||||
endif
|
|
||||||
|
|
||||||
# FIXME: UNTESTED
|
|
||||||
#ifdef SOLARIS
|
|
||||||
#NOIPX=1
|
|
||||||
#opts+=-I/usr/local/include -I/opt/sfw/include \
|
|
||||||
# -DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
|
|
||||||
#libs+=-L/opt/sfw/lib -lsocket -lnsl
|
|
||||||
#endif
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#
|
|
||||||
# Warn about old build directories and offer to purge.
|
|
||||||
#
|
|
||||||
|
|
||||||
_old:=$(wildcard $(addprefix ../bin/,FreeBSD Linux \
|
|
||||||
Linux64 Mingw Mingw64 SDL dummy) ../objs ../dep)
|
|
||||||
|
|
||||||
ifdef _old
|
|
||||||
$(foreach v,$(_old),$(info $(abspath $(v))))
|
|
||||||
$(info )
|
|
||||||
$(info These directories are no longer\
|
|
||||||
required and should be removed.)
|
|
||||||
$(info You may remove them manually or\
|
|
||||||
by using 'make distclean')
|
|
||||||
$(error )
|
|
||||||
endif
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#
|
|
||||||
# Platform specific options.
|
|
||||||
#
|
|
||||||
|
|
||||||
PKG_CONFIG?=pkg-config
|
|
||||||
|
|
||||||
ifdef WINDOWSHELL
|
|
||||||
rmrf=-2>NUL DEL /S /Q
|
|
||||||
mkdir=-2>NUL MD
|
|
||||||
cat=TYPE
|
|
||||||
else
|
|
||||||
rmrf=rm -rf
|
|
||||||
mkdir=mkdir -p
|
|
||||||
cat=cat
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef LINUX64
|
|
||||||
LINUX=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef MINGW64
|
|
||||||
MINGW=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef LINUX
|
|
||||||
UNIX=1
|
|
||||||
ifdef LINUX64
|
|
||||||
NONX86=1
|
|
||||||
# LINUX64 does not imply X86_64=1;
|
|
||||||
# could mean ARM64 or Itanium
|
|
||||||
platform=linux/64
|
|
||||||
else
|
|
||||||
platform=linux
|
|
||||||
endif
|
|
||||||
else ifdef FREEBSD
|
|
||||||
UNIX=1
|
|
||||||
platform=freebsd
|
|
||||||
else ifdef HAIKU
|
|
||||||
# Give Haiku its own configuration, since it
|
|
||||||
# isn't actually UNIX.
|
|
||||||
include Makefile.d/haiku.mk
|
|
||||||
else ifdef SOLARIS # FIXME: UNTESTED
|
|
||||||
UNIX=1
|
|
||||||
platform=solaris
|
|
||||||
else ifdef CYGWIN32 # FIXME: UNTESTED
|
|
||||||
platform=cygwin
|
|
||||||
else ifdef MINGW
|
|
||||||
ifdef MINGW64
|
|
||||||
NONX86=1
|
|
||||||
NOASM=1
|
|
||||||
# MINGW64 should not necessarily imply X86_64=1,
|
|
||||||
# but we make that assumption elsewhere
|
|
||||||
# Once that changes, remove this
|
|
||||||
X86_64=1
|
|
||||||
platform=mingw/64
|
|
||||||
else
|
|
||||||
platform=mingw
|
|
||||||
endif
|
|
||||||
include Makefile.d/win32.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef platform
|
|
||||||
makedir:=$(makedir)/$(platform)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef UNIX
|
|
||||||
include Makefile.d/nix.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(SDL), 1)
|
|
||||||
include Makefile.d/sdl.mk
|
|
||||||
else ifeq ($(DEDICATED), 1)
|
|
||||||
include Makefile.d/dedicated.mk
|
|
||||||
else
|
|
||||||
include Makefile.d/dummy.mk
|
|
||||||
endif
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile options for SDL2 backend.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# SDL...., *looks at Alam*, THIS IS A MESS!
|
|
||||||
#
|
|
||||||
# ...a little bird flexes its muscles...
|
|
||||||
#
|
|
||||||
|
|
||||||
makedir:=$(makedir)/SDL
|
|
||||||
|
|
||||||
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
|
|
||||||
sources+=$(call List,sdl/Sourcefile)
|
|
||||||
|
|
||||||
NOUPNP=1
|
|
||||||
|
|
||||||
# FIXME: UNTESTED
|
|
||||||
#ifdef PANDORA
|
|
||||||
#include sdl/SRB2Pandora/Makefile.cfg
|
|
||||||
#endif #ifdef PANDORA
|
|
||||||
|
|
||||||
# FIXME: UNTESTED
|
|
||||||
#ifdef CYGWIN32
|
|
||||||
#include sdl/MakeCYG.cfg
|
|
||||||
#endif #ifdef CYGWIN32
|
|
||||||
|
|
||||||
ifndef NOHW
|
|
||||||
sources+=sdl/ogl_sdl.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef NOMIXER
|
|
||||||
sources+=sdl/sdl_sound.c
|
|
||||||
else
|
|
||||||
opts+=-DHAVE_MIXER
|
|
||||||
sources+=sdl/mixer_sound.c
|
|
||||||
|
|
||||||
ifndef HAIKU # Haiku has a special import path
|
|
||||||
libs+=-lSDL2_mixer
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOTHREADS
|
|
||||||
opts+=-DHAVE_THREADS
|
|
||||||
sources+=sdl/i_threads.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef SDL_PKGCONFIG
|
|
||||||
$(eval $(call Use_pkg_config,SDL))
|
|
||||||
else
|
|
||||||
SDL_CONFIG?=$(call Prefix,sdl2-config)
|
|
||||||
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
|
|
||||||
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
|
|
||||||
$(if $(STATIC),--static-libs,--libs))
|
|
||||||
$(eval $(call Propogate_flags,SDL))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef MINGW
|
|
||||||
ifndef NOSDLMAIN
|
|
||||||
SDLMAIN=1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef SDLMAIN
|
|
||||||
opts+=-DSDLMAIN
|
|
||||||
else
|
|
||||||
ifdef MINGW
|
|
||||||
opts+=-Umain
|
|
||||||
libs+=-mconsole
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
#
|
|
||||||
# Utility macros for the rest of the Makefiles.
|
|
||||||
#
|
|
||||||
|
|
||||||
Ifnot=$(if $(1),$(3),$(2))
|
|
||||||
Ifndef=$(call Ifnot,$($(1)),$(2),$(3))
|
|
||||||
|
|
||||||
# Match and expand a list of variables by pattern.
|
|
||||||
Wildvar=$(foreach v,$(filter $(1),$(.VARIABLES)),$($(v)))
|
|
||||||
|
|
||||||
# Read a list of words from file and prepend each with the
|
|
||||||
# directory of the file.
|
|
||||||
_cat=$(shell $(cat) $(call Windows_path,$(1)))
|
|
||||||
List=$(addprefix $(dir $(1)),$(call _cat,$(1)))
|
|
||||||
|
|
||||||
# Convert path separators to backslash on Windows.
|
|
||||||
Windows_path=$(if $(WINDOWSHELL),$(subst /,\,$(1)),$(1))
|
|
||||||
|
|
||||||
define Propogate_flags =
|
|
||||||
opts+=$$($(1)_CFLAGS)
|
|
||||||
libs+=$$($(1)_LDFLAGS)
|
|
||||||
endef
|
|
||||||
|
|
||||||
# Set library's _CFLAGS and _LDFLAGS from some command.
|
|
||||||
# Automatically propogates the flags too.
|
|
||||||
# 1: variable prefix (e.g. CURL)
|
|
||||||
# 2: start of command (e.g. curl-config)
|
|
||||||
# --- optional ----
|
|
||||||
# 3: CFLAGS command arguments, default '--cflags'
|
|
||||||
# 4: LDFLAGS command arguments, default '--libs'
|
|
||||||
# 5: common command arguments at the end of command
|
|
||||||
define Configure =
|
|
||||||
$(1)_CFLAGS?=$$(shell $(2) $(or $(3),--cflags) $(5))
|
|
||||||
$(1)_LDFLAGS?=$$(shell $(2) $(or $(4),--libs) $(5))
|
|
||||||
$(call Propogate_flags,$(1))
|
|
||||||
endef
|
|
||||||
|
|
||||||
# Configure library with pkg-config. The package name is
|
|
||||||
# taken from a _PKGCONFIG variable.
|
|
||||||
# 1: variable prefix
|
|
||||||
#
|
|
||||||
# LIBGME_PKGCONFIG=libgme
|
|
||||||
# $(eval $(call Use_pkg_config,LIBGME))
|
|
||||||
define Use_pkg_config =
|
|
||||||
$(call Configure,$(1),$(PKG_CONFIG),,,$($(1)_PKGCONFIG))
|
|
||||||
endef
|
|
||||||
|
|
||||||
# Check disabling flag and configure package in one step
|
|
||||||
# according to delimited argument.
|
|
||||||
# (There is only one argument, but it split by slash.)
|
|
||||||
# 1/: short form library name (uppercase). This is
|
|
||||||
# prefixed with 'NO' and 'HAVE_'. E.g. NOGME, HAVE_GME
|
|
||||||
# /2: package name (e.g. libgme)
|
|
||||||
# /3: variable prefix
|
|
||||||
#
|
|
||||||
# The following example would check if NOGME is not
|
|
||||||
# defined before attempting to define LIBGME_CFLAGS and
|
|
||||||
# LIBGME_LDFLAGS as with Use_pkg_config.
|
|
||||||
#
|
|
||||||
# $(eval $(call Check_pkg_config,GME/libgme/LIBGME))
|
|
||||||
define Check_pkg_config =
|
|
||||||
_p:=$(subst /, ,$(1))
|
|
||||||
_v1:=$$(word 1,$$(_p))
|
|
||||||
_v2:=$$(or $$(word 3,$$(_p)),$$(_v1))
|
|
||||||
ifndef NO$$(_v1)
|
|
||||||
$$(_v2)_PKGCONFIG?=$$(word 2,$$(_p))
|
|
||||||
$$(eval $$(call Use_pkg_config,$$(_v2)))
|
|
||||||
opts+=-DHAVE_$$(_v1)
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
|
|
||||||
# $(call Prefix,gcc)
|
|
||||||
Prefix=$(if $(PREFIX),$(PREFIX)-)$(1)
|
|
||||||
|
|
||||||
Echo=
|
|
||||||
Echo_name=
|
|
||||||
Print=
|
|
||||||
|
|
||||||
ifndef SILENT
|
|
||||||
Echo=@echo $(1)
|
|
||||||
ifndef ECHO
|
|
||||||
ifndef NOECHOFILENAMES
|
|
||||||
Echo_name=$(call Echo,-- $(1) ...)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifndef MAKE_RESTARTS
|
|
||||||
ifndef destructive
|
|
||||||
Print=$(info $(1))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.=$(call Ifndef,ECHO,@)
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
#
|
|
||||||
# Flags to put a sock in GCC!
|
|
||||||
#
|
|
||||||
|
|
||||||
# See the versions list in detect.mk
|
|
||||||
# This will define all version flags going backward.
|
|
||||||
# Yes, it's magic.
|
|
||||||
define _predecessor =
|
|
||||||
ifdef GCC$(firstword $(1))
|
|
||||||
GCC$(lastword $(1)):=1
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
_n:=$(words $(gcc_versions))
|
|
||||||
$(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
|
|
||||||
$(addprefix =,$(wordlist 2,$(_n),$(gcc_versions)))),\
|
|
||||||
$(and $(findstring =,$(v)),\
|
|
||||||
$(eval $(call _predecessor,$(subst =, ,$(v))))))
|
|
||||||
|
|
||||||
# aggregate returns seem to happen alot in c++ so just supress em lel
|
|
||||||
CXXFLAGS+= -Wno-aggregate-return
|
|
||||||
|
|
||||||
# -W -Wno-unused
|
|
||||||
|
|
||||||
ifdef GCC150
|
|
||||||
opts+=-std=gnu17
|
|
||||||
endif
|
|
||||||
WFLAGS:=-Wall -Wno-trigraphs
|
|
||||||
ifndef GCC295
|
|
||||||
#WFLAGS+=-Wno-packed
|
|
||||||
endif
|
|
||||||
ifndef RELAXWARNINGS
|
|
||||||
WFLAGS+=-W
|
|
||||||
#WFLAGS+=-Wno-sign-compare
|
|
||||||
ifndef GCC295
|
|
||||||
WFLAGS+=-Wno-div-by-zero
|
|
||||||
endif
|
|
||||||
#WFLAGS+=-Wsystem-headers
|
|
||||||
WFLAGS+=-Wfloat-equal
|
|
||||||
#WFLAGS+=-Wtraditional
|
|
||||||
WFLAGS+=-Wundef
|
|
||||||
ifndef GCC295
|
|
||||||
WFLAGS+=-Wendif-labels
|
|
||||||
endif
|
|
||||||
ifdef GCC41
|
|
||||||
WFLAGS+=-Wshadow
|
|
||||||
endif
|
|
||||||
#WFLAGS+=-Wlarger-than-%len%
|
|
||||||
WFLAGS+=-Wpointer-arith -Wbad-function-cast
|
|
||||||
ifdef GCC45
|
|
||||||
#WFLAGS+=-Wc++-compat
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Wcast-qual
|
|
||||||
ifndef NOCASTALIGNWARN
|
|
||||||
WFLAGS+=-Wcast-align
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Wwrite-strings
|
|
||||||
ifndef ERRORMODE
|
|
||||||
#WFLAGS+=-Wconversion
|
|
||||||
ifdef GCC43
|
|
||||||
#WFLAGS+=-Wno-sign-conversion
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Wsign-compare
|
|
||||||
ifdef GCC91
|
|
||||||
WFLAGS+=-Wno-error=address-of-packed-member
|
|
||||||
endif
|
|
||||||
ifdef GCC45
|
|
||||||
WFLAGS+=-Wlogical-op
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Waggregate-return
|
|
||||||
ifdef HAIKU
|
|
||||||
ifdef GCC41
|
|
||||||
#WFLAGS+=-Wno-attributes
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
#WFLAGS+=-Wstrict-prototypes
|
|
||||||
ifdef GCC40
|
|
||||||
WFLAGS+=-Wold-style-definition
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
|
|
||||||
ifdef GCC40
|
|
||||||
WFLAGS+=-Wmissing-field-initializers
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Wmissing-noreturn
|
|
||||||
#WFLAGS+=-Wmissing-format-attribute
|
|
||||||
#WFLAGS+=-Wno-multichar
|
|
||||||
#WFLAGS+=-Wno-deprecated-declarations
|
|
||||||
#WFLAGS+=-Wpacked
|
|
||||||
#WFLAGS+=-Wpadded
|
|
||||||
#WFLAGS+=-Wredundant-decls
|
|
||||||
WFLAGS+=-Wnested-externs
|
|
||||||
#WFLAGS+=-Wunreachable-code
|
|
||||||
WFLAGS+=-Winline
|
|
||||||
ifdef DEBUGMODE
|
|
||||||
WFLAGS+=-Wno-error=inline
|
|
||||||
endif
|
|
||||||
ifdef GCC43
|
|
||||||
WFLAGS+=-funit-at-a-time
|
|
||||||
WFLAGS+=-Wlogical-op
|
|
||||||
endif
|
|
||||||
ifndef GCC295
|
|
||||||
WFLAGS+=-Wdisabled-optimization
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Wformat-y2k
|
|
||||||
ifdef GCC71
|
|
||||||
WFLAGS+=-Wno-error=format-overflow=2
|
|
||||||
endif
|
|
||||||
WFLAGS+=-Wformat-security
|
|
||||||
ifndef GCC29
|
|
||||||
#WFLAGS+=-Winit-self
|
|
||||||
endif
|
|
||||||
ifdef GCC46
|
|
||||||
WFLAGS+=-Wno-suggest-attribute=noreturn
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef NOLDWARNING
|
|
||||||
LDFLAGS+=-Wl,--as-needed
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef ERRORMODE
|
|
||||||
WFLAGS+=-Werror
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef GCC43
|
|
||||||
#WFLAGS+=-Wno-error=clobbered
|
|
||||||
endif
|
|
||||||
ifdef GCC44
|
|
||||||
#WFLAGS+=-Wno-error=array-bounds
|
|
||||||
endif
|
|
||||||
ifdef GCC46
|
|
||||||
WFLAGS+=-Wno-error=suggest-attribute=noreturn
|
|
||||||
endif
|
|
||||||
ifdef GCC54
|
|
||||||
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
|
|
||||||
endif
|
|
||||||
ifdef GCC61
|
|
||||||
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
|
|
||||||
endif
|
|
||||||
ifdef GCC71
|
|
||||||
WFLAGS+=-Wimplicit-fallthrough=4
|
|
||||||
endif
|
|
||||||
ifdef GCC81
|
|
||||||
WFLAGS+=-Wno-error=format-overflow
|
|
||||||
WFLAGS+=-Wno-format-overflow
|
|
||||||
WFLAGS+=-Wno-error=multistatement-macros
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef NONX86
|
|
||||||
ifdef X86_64 # yeah that SEEMS contradictory
|
|
||||||
opts+=-march=nocona
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
ifndef GCC29
|
|
||||||
opts+=-msse3 -mfpmath=sse
|
|
||||||
else
|
|
||||||
opts+=-mpentium
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef DEBUGMODE
|
|
||||||
ifdef GCC48
|
|
||||||
opts+=-Og
|
|
||||||
else
|
|
||||||
opts+=-O0
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef VALGRIND
|
|
||||||
ifdef GCC46
|
|
||||||
WFLAGS+=-Wno-error=unused-but-set-variable
|
|
||||||
WFLAGS+=-Wno-unused-but-set-variable
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Lua
|
|
||||||
ifdef GCC43
|
|
||||||
ifndef GCC44
|
|
||||||
WFLAGS+=-Wno-logical-op
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
#
|
|
||||||
# Mingw, if you don't know, that's Win32/Win64
|
|
||||||
#
|
|
||||||
|
|
||||||
ifndef MINGW64
|
|
||||||
EXENAME?=srb2kart-saturn_32bit.exe
|
|
||||||
else
|
|
||||||
EXENAME?=srb2kart-saturn_64bit.exe
|
|
||||||
endif
|
|
||||||
|
|
||||||
# disable dynamicbase if under msys2
|
|
||||||
ifdef MSYSTEM
|
|
||||||
libs+=-Wl,--disable-dynamicbase
|
|
||||||
endif
|
|
||||||
|
|
||||||
sources+=win32/Srb2win.rc
|
|
||||||
opts+=-DSTDC_HEADERS
|
|
||||||
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
|
|
||||||
|
|
||||||
ifndef DEDICATED
|
|
||||||
ifndef DUMMY
|
|
||||||
SDL?=1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOHW
|
|
||||||
opts+=-DUSE_WGL_SWAP
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef MINGW64
|
|
||||||
libs+=-lws2_32
|
|
||||||
else
|
|
||||||
#ifndef HAVE_IPV6
|
|
||||||
#libs+=-lwsock32
|
|
||||||
#else
|
|
||||||
libs+=-lws2_32
|
|
||||||
#endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef MINGW64
|
|
||||||
libs+=-Wl,--large-address-aware
|
|
||||||
NOLIBBACKTRACE=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef MINGW64
|
|
||||||
32=32
|
|
||||||
x86=x86
|
|
||||||
i686=i686
|
|
||||||
else
|
|
||||||
32=64
|
|
||||||
x86=x86_64
|
|
||||||
i686=x86_64
|
|
||||||
endif
|
|
||||||
|
|
||||||
mingw:=$(i686)-w64-mingw32
|
|
||||||
|
|
||||||
define _set =
|
|
||||||
$(1)_CFLAGS?=$($(1)_opts)
|
|
||||||
$(1)_LDFLAGS?=$($(1)_libs)
|
|
||||||
endef
|
|
||||||
|
|
||||||
lib:=../libs/gme
|
|
||||||
LIBGME_opts:=-I$(lib)/include
|
|
||||||
LIBGME_libs:=-L$(lib)/win$(32) -lgme
|
|
||||||
$(eval $(call _set,LIBGME))
|
|
||||||
|
|
||||||
lib:=../libs/libopenmpt
|
|
||||||
LIBOPENMPT_opts:=-I$(lib)/inc
|
|
||||||
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86)/mingw -lopenmpt
|
|
||||||
$(eval $(call _set,LIBOPENMPT))
|
|
||||||
|
|
||||||
lib:=../libs/SDL2_mixer/$(mingw)
|
|
||||||
|
|
||||||
ifdef SDL
|
|
||||||
mixer_opts:=-I$(lib)/include/SDL2
|
|
||||||
mixer_libs:=-L$(lib)/lib
|
|
||||||
|
|
||||||
lib:=../libs/SDL2/$(mingw)
|
|
||||||
SDL_opts:=-I$(lib)/include/SDL2\
|
|
||||||
$(mixer_opts) -Dmain=SDL_main
|
|
||||||
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
|
|
||||||
-lmingw32 -lSDL2main -lSDL2 -mwindows
|
|
||||||
$(eval $(call _set,SDL))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef MINGW64
|
|
||||||
lib:=../libs/libbacktrace
|
|
||||||
LIBBACKTRACE_opts:=-I$(lib)/include
|
|
||||||
LIBBACKTRACE_libs:=-L$(lib)/lib/x86_64 -lbacktrace
|
|
||||||
$(eval $(call _set,LIBBACKTRACE))
|
|
||||||
else
|
|
||||||
lib:=../libs/drmingw
|
|
||||||
opts+=-I$(lib)/include
|
|
||||||
libs+=-L$(lib)/lib/win32 -lmgwhelp -lexchndl
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib:=../libs/zlib
|
|
||||||
ZLIB_opts:=-I$(lib)
|
|
||||||
ZLIB_libs:=-L$(lib)/win32 -l:libz$(32).a
|
|
||||||
$(eval $(call _set,ZLIB))
|
|
||||||
|
|
||||||
ifndef PNG_CONFIG
|
|
||||||
lib:=../libs/libpng-src
|
|
||||||
PNG_opts:=-I$(lib)
|
|
||||||
PNG_libs:=-L$(lib)/projects -lpng$(32)
|
|
||||||
$(eval $(call _set,PNG))
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib:=../libs/curl
|
|
||||||
CURL_opts:=-I$(lib)/include
|
|
||||||
CURL_libs:=-L$(lib)/lib$(32) -lcurl
|
|
||||||
$(eval $(call _set,CURL))
|
|
||||||
|
|
||||||
ifndef MINGW64 # miniupnc is broken with MINGW64
|
|
||||||
lib:=../libs/miniupnpc
|
|
||||||
MINIUPNPC_opts:=-I$(lib)/include -DMINIUPNP_STATICLIB
|
|
||||||
MINIUPNPC_libs:=-L$(lib)/mingw$(32) -lminiupnpc -lws2_32 -liphlpapi
|
|
||||||
$(eval $(call _set,MINIUPNPC))
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib:=../libs/discord-rpc/win$(32)-dynamic
|
|
||||||
DISCORDRPC_opts+=-I$(lib)/include
|
|
||||||
DISCORDRPC_libs+=-L$(lib)/lib -ldiscord-rpc
|
|
||||||
$(eval $(call _set,DISCORDRPC))
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
am_map.c
|
|
||||||
b_bot.c
|
|
||||||
command.c
|
|
||||||
console.c
|
|
||||||
d_clisrv.c
|
|
||||||
d_main.c
|
|
||||||
d_net.c
|
|
||||||
d_netcmd.c
|
|
||||||
d_netfil.c
|
|
||||||
d_protocol.c
|
|
||||||
dehacked.c
|
|
||||||
f_finale.c
|
|
||||||
f_wipe.c
|
|
||||||
filesrch.c
|
|
||||||
g_game.c
|
|
||||||
g_input.c
|
|
||||||
hu_stuff.c
|
|
||||||
i_tcp.c
|
|
||||||
i_time.c
|
|
||||||
info.c
|
|
||||||
lzf.c
|
|
||||||
m_aatree.c
|
|
||||||
m_anigif.c
|
|
||||||
m_argv.c
|
|
||||||
m_bbox.c
|
|
||||||
m_cheat.c
|
|
||||||
m_cond.c
|
|
||||||
m_fixed.c
|
|
||||||
m_menu.c
|
|
||||||
m_textinput.c
|
|
||||||
m_misc.c
|
|
||||||
m_perfstats.c
|
|
||||||
m_queue.c
|
|
||||||
m_random.c
|
|
||||||
mserv.c
|
|
||||||
http-mserv.c
|
|
||||||
qs22j.c
|
|
||||||
s_sound.c
|
|
||||||
screen.c
|
|
||||||
sounds.c
|
|
||||||
st_stuff.c
|
|
||||||
string.c
|
|
||||||
tables.c
|
|
||||||
v_video.c
|
|
||||||
w_wad.c
|
|
||||||
y_inter.c
|
|
||||||
z_zone.c
|
|
||||||
r_bsp.c
|
|
||||||
r_data.c
|
|
||||||
r_draw.c
|
|
||||||
r_fps.c
|
|
||||||
r_main.cpp
|
|
||||||
r_patch.c
|
|
||||||
r_patchrotation.c
|
|
||||||
r_plane.cpp
|
|
||||||
r_segs.cpp
|
|
||||||
r_skins.c
|
|
||||||
r_sky.c
|
|
||||||
r_splats.c
|
|
||||||
r_things.cpp
|
|
||||||
r_portal.c
|
|
||||||
p_ceilng.c
|
|
||||||
p_enemy.c
|
|
||||||
p_floor.c
|
|
||||||
p_inter.c
|
|
||||||
p_lights.c
|
|
||||||
p_map.c
|
|
||||||
p_maputl.c
|
|
||||||
p_mobj.c
|
|
||||||
p_polyobj.c
|
|
||||||
p_saveg.c
|
|
||||||
p_setup.c
|
|
||||||
p_sight.c
|
|
||||||
p_slopes.c
|
|
||||||
p_spec.c
|
|
||||||
p_telept.c
|
|
||||||
p_tick.c
|
|
||||||
p_user.c
|
|
||||||
k_director.c
|
|
||||||
k_kart.c
|
|
||||||
k_stats.c
|
|
||||||
lua_baselib.c
|
|
||||||
lua_blockmaplib.c
|
|
||||||
lua_consolelib.c
|
|
||||||
lua_hooklib.c
|
|
||||||
lua_hudlib.c
|
|
||||||
lua_hudlib_drawlist.c
|
|
||||||
lua_infolib.c
|
|
||||||
lua_maplib.c
|
|
||||||
lua_mathlib.c
|
|
||||||
lua_mobjlib.c
|
|
||||||
lua_playerlib.c
|
|
||||||
lua_script.c
|
|
||||||
lua_skinlib.c
|
|
||||||
lua_thinkerlib.c
|
|
||||||
lua_udatalib.c
|
|
||||||
lua_glib.c
|
|
||||||
+1
-1
@@ -341,7 +341,7 @@ static void AM_FrameBufferInit(void)
|
|||||||
f_x = f_y = 0;
|
f_x = f_y = 0;
|
||||||
f_w = vid.width;
|
f_w = vid.width;
|
||||||
f_h = vid.height;
|
f_h = vid.height;
|
||||||
am_buf = vid.screens[0];
|
am_buf = screens[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ INT32 VID_SetMode(INT32 modenum)
|
|||||||
vid.modenum = 0;
|
vid.modenum = 0;
|
||||||
vid.width = 320;
|
vid.width = 320;
|
||||||
vid.height = 240;
|
vid.height = 240;
|
||||||
|
vid.bpp = 1;
|
||||||
vid.buffer = android_surface;
|
vid.buffer = android_surface;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
ifdef UNIXCOMMON
|
||||||
|
LUA_CFLAGS+=-DLUA_USE_POSIX
|
||||||
|
endif
|
||||||
|
ifdef LINUX
|
||||||
|
LUA_CFLAGS+=-DLUA_USE_POSIX
|
||||||
|
endif
|
||||||
|
ifdef GCC43
|
||||||
|
ifndef GCC44
|
||||||
|
WFLAGS+=-Wno-logical-op
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
OBJS:=$(OBJS) \
|
||||||
|
$(OBJDIR)/lapi.o \
|
||||||
|
$(OBJDIR)/lbaselib.o \
|
||||||
|
$(OBJDIR)/ldo.o \
|
||||||
|
$(OBJDIR)/ldblib.o \
|
||||||
|
$(OBJDIR)/lfunc.o \
|
||||||
|
$(OBJDIR)/linit.o \
|
||||||
|
$(OBJDIR)/liolib.o \
|
||||||
|
$(OBJDIR)/llex.o \
|
||||||
|
$(OBJDIR)/lmem.o \
|
||||||
|
$(OBJDIR)/lobject.o \
|
||||||
|
$(OBJDIR)/lstate.o \
|
||||||
|
$(OBJDIR)/lstrlib.o \
|
||||||
|
$(OBJDIR)/ltablib.o \
|
||||||
|
$(OBJDIR)/lundump.o \
|
||||||
|
$(OBJDIR)/lzio.o \
|
||||||
|
$(OBJDIR)/lauxlib.o \
|
||||||
|
$(OBJDIR)/lcode.o \
|
||||||
|
$(OBJDIR)/ldebug.o \
|
||||||
|
$(OBJDIR)/ldump.o \
|
||||||
|
$(OBJDIR)/lgc.o \
|
||||||
|
$(OBJDIR)/lopcodes.o \
|
||||||
|
$(OBJDIR)/lparser.o \
|
||||||
|
$(OBJDIR)/lstring.o \
|
||||||
|
$(OBJDIR)/ltable.o \
|
||||||
|
$(OBJDIR)/ltm.o \
|
||||||
|
$(OBJDIR)/lvm.o \
|
||||||
|
$(OBJDIR)/lua_script.o \
|
||||||
|
$(OBJDIR)/lua_baselib.o \
|
||||||
|
$(OBJDIR)/lua_blockmaplib.o \
|
||||||
|
$(OBJDIR)/lua_mathlib.o \
|
||||||
|
$(OBJDIR)/lua_hooklib.o \
|
||||||
|
$(OBJDIR)/lua_consolelib.o \
|
||||||
|
$(OBJDIR)/lua_infolib.o \
|
||||||
|
$(OBJDIR)/lua_mobjlib.o \
|
||||||
|
$(OBJDIR)/lua_playerlib.o \
|
||||||
|
$(OBJDIR)/lua_skinlib.o \
|
||||||
|
$(OBJDIR)/lua_thinkerlib.o \
|
||||||
|
$(OBJDIR)/lua_maplib.o \
|
||||||
|
$(OBJDIR)/lua_hudlib.o \
|
||||||
|
$(OBJDIR)/lua_hudlib_drawlist.o \
|
||||||
|
$(OBJDIR)/lua_udatalib.o \
|
||||||
|
$(OBJDIR)/lua_glib.o
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
lapi.c
|
|
||||||
lauxlib.c
|
|
||||||
lbaselib.c
|
|
||||||
ldblib.c
|
|
||||||
lcode.c
|
|
||||||
ldebug.c
|
|
||||||
ldo.c
|
|
||||||
ldump.c
|
|
||||||
lfunc.c
|
|
||||||
lgc.c
|
|
||||||
linit.c
|
|
||||||
liolib.c
|
|
||||||
llex.c
|
|
||||||
lmem.c
|
|
||||||
lobject.c
|
|
||||||
lopcodes.c
|
|
||||||
lparser.c
|
|
||||||
lstate.c
|
|
||||||
lstring.c
|
|
||||||
lstrlib.c
|
|
||||||
ltable.c
|
|
||||||
ltablib.c
|
|
||||||
ltm.c
|
|
||||||
lundump.c
|
|
||||||
lvm.c
|
|
||||||
lzio.c
|
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = (void *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = (void *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITESINT8(p,b) do { SINT8 *p_tmp = (void *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITESINT8(p,b) do { SINT8 *p_tmp = (void *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEINT16(p,b) do { INT16 *p_tmp = (void *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEINT16(p,b) do { INT16 *p_tmp = (void *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEINT16_2(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) // dumb hack for mumble
|
|
||||||
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = (void *)p; const UINT16 tv = ( UINT16)(b); memcpy(p, &tv, sizeof( UINT16)); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = (void *)p; const UINT16 tv = ( UINT16)(b); memcpy(p, &tv, sizeof( UINT16)); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEINT32(p,b) do { INT32 *p_tmp = (void *)p; const INT32 tv = ( INT32)(b); memcpy(p, &tv, sizeof( INT32)); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEINT32(p,b) do { INT32 *p_tmp = (void *)p; const INT32 tv = ( INT32)(b); memcpy(p, &tv, sizeof( INT32)); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEUINT32(p,b) do { UINT32 *p_tmp = (void *)p; const UINT32 tv = ( UINT32)(b); memcpy(p, &tv, sizeof( UINT32)); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEUINT32(p,b) do { UINT32 *p_tmp = (void *)p; const UINT32 tv = ( UINT32)(b); memcpy(p, &tv, sizeof( UINT32)); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
@@ -39,7 +38,6 @@
|
|||||||
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; *p_tmp = ( UINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; *p_tmp = ( UINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; *p_tmp = ( SINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; *p_tmp = ( SINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; *p_tmp = ( INT16)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; *p_tmp = ( INT16)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEINT16_2(p,b) do { INT16 *p_tmp = ( INT16 *)p; *p_tmp = ( INT16)(b); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) // dumb hack for mumble
|
|
||||||
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; *p_tmp = ( UINT16)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; *p_tmp = ( UINT16)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; *p_tmp = ( INT32)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; *p_tmp = ( INT32)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
#define WRITEUINT32(p,b) do { UINT32 *p_tmp = ( UINT32 *)p; *p_tmp = ( UINT32)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
#define WRITEUINT32(p,b) do { UINT32 *p_tmp = ( UINT32 *)p; *p_tmp = ( UINT32)(b); p_tmp++; p = (void *)p_tmp; } while (0)
|
||||||
|
|||||||
+14
-35
@@ -816,17 +816,12 @@ static void COM_Help_f(void)
|
|||||||
cvar = CV_FindVar(help);
|
cvar = CV_FindVar(help);
|
||||||
if (cvar)
|
if (cvar)
|
||||||
{
|
{
|
||||||
boolean floatmode = false;
|
|
||||||
const char *cvalue = NULL;
|
|
||||||
CONS_Printf("\x82""Variable %s:\n", cvar->name);
|
CONS_Printf("\x82""Variable %s:\n", cvar->name);
|
||||||
CONS_Printf(M_GetText(" flags: "));
|
CONS_Printf(M_GetText(" flags: "));
|
||||||
if (cvar->flags & CV_SAVE)
|
if (cvar->flags & CV_SAVE)
|
||||||
CONS_Printf("AUTOSAVE ");
|
CONS_Printf("AUTOSAVE ");
|
||||||
if (cvar->flags & CV_FLOAT)
|
if (cvar->flags & CV_FLOAT)
|
||||||
{
|
|
||||||
CONS_Printf("FLOAT ");
|
CONS_Printf("FLOAT ");
|
||||||
floatmode = true;
|
|
||||||
}
|
|
||||||
if (cvar->flags & CV_NETVAR)
|
if (cvar->flags & CV_NETVAR)
|
||||||
CONS_Printf("NETVAR ");
|
CONS_Printf("NETVAR ");
|
||||||
if (cvar->flags & CV_CALL)
|
if (cvar->flags & CV_CALL)
|
||||||
@@ -836,43 +831,30 @@ static void COM_Help_f(void)
|
|||||||
CONS_Printf("\n");
|
CONS_Printf("\n");
|
||||||
if (cvar->PossibleValue)
|
if (cvar->PossibleValue)
|
||||||
{
|
{
|
||||||
|
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
|
||||||
{
|
{
|
||||||
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
|
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value,
|
||||||
{
|
cvar->PossibleValue[1].value);
|
||||||
if (floatmode)
|
i = 2;
|
||||||
{
|
}
|
||||||
float fu = FIXED_TO_FLOAT(cvar->PossibleValue[0].value);
|
|
||||||
float ck = FIXED_TO_FLOAT(cvar->PossibleValue[1].value);
|
|
||||||
CONS_Printf(" range from %ld%s to %ld%s\n",
|
|
||||||
(long)fu, M_Ftrim(fu),
|
|
||||||
(long)ck, M_Ftrim(ck));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value,
|
|
||||||
cvar->PossibleValue[1].value);
|
|
||||||
i = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
{
|
||||||
|
const char *cvalue = NULL;
|
||||||
//CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name);
|
//CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name);
|
||||||
while (cvar->PossibleValue[i].strvalue)
|
while (cvar->PossibleValue[i].strvalue)
|
||||||
{
|
{
|
||||||
if (floatmode)
|
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
||||||
CONS_Printf(" %-2f : %s\n", FIXED_TO_FLOAT(cvar->PossibleValue[i].value),
|
cvar->PossibleValue[i].strvalue);
|
||||||
cvar->PossibleValue[i].strvalue);
|
|
||||||
else
|
|
||||||
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
|
||||||
cvar->PossibleValue[i].strvalue);
|
|
||||||
if (cvar->PossibleValue[i].value == cvar->value)
|
if (cvar->PossibleValue[i].value == cvar->value)
|
||||||
cvalue = cvar->PossibleValue[i].strvalue;
|
cvalue = cvar->PossibleValue[i].strvalue;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
if (cvalue)
|
||||||
|
CONS_Printf(" Current value: %s\n", cvalue);
|
||||||
|
else
|
||||||
|
CONS_Printf(" Current value: %d\n", cvar->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cvalue)
|
|
||||||
CONS_Printf(" Current value: %s\n", cvalue);
|
|
||||||
else if (cvar->string)
|
|
||||||
CONS_Printf(" Current value: %s\n", cvar->string);
|
|
||||||
else
|
else
|
||||||
CONS_Printf(" Current value: %d\n", cvar->value);
|
CONS_Printf(" Current value: %d\n", cvar->value);
|
||||||
}
|
}
|
||||||
@@ -1043,10 +1025,7 @@ static void COM_Add_f(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (( cvar->flags & CV_FLOAT ))
|
if (( cvar->flags & CV_FLOAT ))
|
||||||
{
|
CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2))));
|
||||||
float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2));
|
|
||||||
CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n)));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
CV_AddValue(cvar, atoi(COM_Argv(2)));
|
CV_AddValue(cvar, atoi(COM_Argv(2)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
#ifndef __COMMAND_H__
|
#ifndef __COMMAND_H__
|
||||||
#define __COMMAND_H__
|
#define __COMMAND_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
||||||
@@ -193,8 +189,4 @@ UINT8 CV_CheatsEnabled(void);
|
|||||||
// Returns cvar by name. Exposed here for Lua.
|
// Returns cvar by name. Exposed here for Lua.
|
||||||
consvar_t *CV_FindVar(const char *name);
|
consvar_t *CV_FindVar(const char *name);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __COMMAND_H__
|
#endif // __COMMAND_H__
|
||||||
@@ -1321,6 +1321,13 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
|||||||
//
|
//
|
||||||
void CONS_Error(const char *msg)
|
void CONS_Error(const char *msg)
|
||||||
{
|
{
|
||||||
|
#ifdef RPC_NO_WINDOWS_H
|
||||||
|
if (!graphics_started)
|
||||||
|
{
|
||||||
|
MessageBoxA(vid.WndParent, msg, "SRB2Kart Warning", MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CONS_Printf("\x82%s", msg); // write error msg in different colour
|
CONS_Printf("\x82%s", msg); // write error msg in different colour
|
||||||
CONS_Printf(M_GetText("Press ENTER to continue\n"));
|
CONS_Printf(M_GetText("Press ENTER to continue\n"));
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
target_sourcefile(cpp)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
memory.cpp
|
|
||||||
thread_pool.cpp
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
// BLANKART
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
|
||||||
// Copyright (C) 2024 by Kart Krew
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "memory.h"
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
#include "../z_zone.h"
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
class LinearMemory
|
|
||||||
{
|
|
||||||
size_t size_;
|
|
||||||
size_t height_;
|
|
||||||
void* memory_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
constexpr explicit LinearMemory(size_t size) noexcept;
|
|
||||||
|
|
||||||
void* allocate(size_t size);
|
|
||||||
void reset() noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr LinearMemory::LinearMemory(size_t size) noexcept : size_(size), height_{0}, memory_{nullptr} {}
|
|
||||||
|
|
||||||
void* LinearMemory::allocate(size_t size)
|
|
||||||
{
|
|
||||||
size_t aligned_size = (size + 15) & ~15;
|
|
||||||
if (height_ + aligned_size > size_)
|
|
||||||
{
|
|
||||||
throw std::bad_alloc();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memory_ == nullptr)
|
|
||||||
{
|
|
||||||
memory_ = Z_Malloc(size_, PU_STATIC, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* ptr = (void*)((uintptr_t)(memory_) + height_);
|
|
||||||
height_ += aligned_size;
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LinearMemory::reset() noexcept
|
|
||||||
{
|
|
||||||
height_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
static LinearMemory g_frame_memory {4 * 1024 * 1024};
|
|
||||||
|
|
||||||
void* Z_Frame_Alloc(size_t size)
|
|
||||||
{
|
|
||||||
return g_frame_memory.allocate(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Z_Frame_Reset()
|
|
||||||
{
|
|
||||||
g_frame_memory.reset();
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
// BLANKART
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
|
||||||
// Copyright (C) 2024 by Kart Krew
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef __SRB2_CORE_MEMORY_H__
|
|
||||||
#define __SRB2_CORE_MEMORY_H__
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif // __cpluspplus
|
|
||||||
|
|
||||||
/// @brief Allocate a block of memory with a lifespan of the current main-thread frame.
|
|
||||||
/// This function is NOT thread-safe, but the allocated memory may be used across threads.
|
|
||||||
/// @return a pointer to a block of memory aligned with libc malloc alignment, or null if allocation fails
|
|
||||||
void* Z_Frame_Alloc(size_t size);
|
|
||||||
|
|
||||||
/// @brief Resets per-frame memory. Not thread safe.
|
|
||||||
void Z_Frame_Reset(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#endif // __SRB2_CORE_MEMORY_H__
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// This class is derived from Conor Williams' implementation of a concurrent deque
|
|
||||||
// https://github.com/ConorWilliams/ConcurrentDeque
|
|
||||||
// Copyright (C) 2021 Conor Williams
|
|
||||||
|
|
||||||
// The original version was for C++23. This one has been shrunk slightly and adapted to our conventions.
|
|
||||||
|
|
||||||
#ifndef __SRB2_CORE_SPMC_QUEUE_HPP__
|
|
||||||
#define __SRB2_CORE_SPMC_QUEUE_HPP__
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <atomic>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <memory>
|
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
//#include <tracy/tracy/Tracy.hpp>
|
|
||||||
|
|
||||||
#include "../cxxutil.hpp"
|
|
||||||
|
|
||||||
namespace srb2
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class SpMcQueue
|
|
||||||
{
|
|
||||||
struct RingBuff {
|
|
||||||
public:
|
|
||||||
explicit RingBuff(int64_t cap) : _cap{cap}, _mask{cap - 1}
|
|
||||||
{
|
|
||||||
SRB2_ASSERT(cap && (!(cap & (cap - 1))) && "Capacity must be buf power of 2!");
|
|
||||||
_buff = std::unique_ptr<T[]>(new T[_cap]);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::int64_t capacity() const noexcept { return _cap; }
|
|
||||||
|
|
||||||
// Store (copy) at modulo index
|
|
||||||
void store(int64_t i, T&& x) noexcept
|
|
||||||
{
|
|
||||||
_buff[i & _mask] = std::move(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load (copy) at modulo index
|
|
||||||
T load(int64_t i) const noexcept
|
|
||||||
{
|
|
||||||
return _buff[i & _mask];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocates and returns a new ring buffer, copies elements in range [b, t) into the new buffer.
|
|
||||||
RingBuff* resize(std::int64_t b, std::int64_t t) const
|
|
||||||
{
|
|
||||||
//ZoneScoped;
|
|
||||||
RingBuff* ptr = new RingBuff{2 * _cap};
|
|
||||||
for (std::int64_t i = t; i != b; ++i) {
|
|
||||||
ptr->store(i, load(i));
|
|
||||||
}
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
int64_t _cap; // Capacity of the buffer
|
|
||||||
int64_t _mask; // Bit mask to perform modulo capacity operations
|
|
||||||
|
|
||||||
std::unique_ptr<T[]> _buff;
|
|
||||||
};
|
|
||||||
|
|
||||||
alignas(64) std::atomic<int64_t> bottom_;
|
|
||||||
alignas(64) std::atomic<int64_t> top_;
|
|
||||||
alignas(64) std::atomic<RingBuff*> buffer_;
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<RingBuff>> garbage_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
SpMcQueue(size_t capacity) : bottom_(0), top_(0), buffer_(new RingBuff(capacity))
|
|
||||||
{
|
|
||||||
garbage_.reserve(32);
|
|
||||||
}
|
|
||||||
~SpMcQueue() noexcept
|
|
||||||
{
|
|
||||||
delete buffer_.load(std::memory_order_relaxed);
|
|
||||||
};
|
|
||||||
|
|
||||||
size_t size() const noexcept
|
|
||||||
{
|
|
||||||
int64_t bottom = bottom_.load(std::memory_order_relaxed);
|
|
||||||
int64_t top = top_.load(std::memory_order_relaxed);
|
|
||||||
return static_cast<size_t>(bottom >= top ? bottom - top : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool empty() const noexcept
|
|
||||||
{
|
|
||||||
return size() == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void push(T&& v) noexcept
|
|
||||||
{
|
|
||||||
int64_t bottom = bottom_.load(std::memory_order_relaxed);
|
|
||||||
int64_t top = top_.load(std::memory_order_acquire);
|
|
||||||
RingBuff* buf = buffer_.load(std::memory_order_relaxed);
|
|
||||||
|
|
||||||
if (buf->capacity() < (bottom - top) + 1)
|
|
||||||
{
|
|
||||||
// Queue is full, build a new one
|
|
||||||
RingBuff* newbuf = buf->resize(bottom, top);
|
|
||||||
garbage_.emplace_back(buf);
|
|
||||||
buffer_.store(newbuf, std::memory_order_relaxed);
|
|
||||||
buf = newbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct new object, this does not have to be atomic as no one can steal this item until after we
|
|
||||||
// store the new value of bottom, ordering is maintained by surrounding atomics.
|
|
||||||
buf->store(bottom, std::move(v));
|
|
||||||
|
|
||||||
std::atomic_thread_fence(std::memory_order_release);
|
|
||||||
bottom_.store(bottom + 1, std::memory_order_relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<T> pop() noexcept
|
|
||||||
{
|
|
||||||
int64_t bottom = bottom_.load(std::memory_order_relaxed) - 1;
|
|
||||||
RingBuff* buf = buffer_.load(std::memory_order_relaxed);
|
|
||||||
|
|
||||||
bottom_.store(bottom, std::memory_order_relaxed); // Stealers can no longer steal
|
|
||||||
|
|
||||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
|
||||||
int64_t top = top_.load(std::memory_order_relaxed);
|
|
||||||
|
|
||||||
if (top <= bottom)
|
|
||||||
{
|
|
||||||
// Non-empty deque
|
|
||||||
if (top == bottom)
|
|
||||||
{
|
|
||||||
// The last item could get stolen, by a stealer that loaded bottom before our write above
|
|
||||||
if (!top_.compare_exchange_strong(top, top + 1, std::memory_order_seq_cst, std::memory_order_relaxed))
|
|
||||||
{
|
|
||||||
// Failed race, thief got the last item.
|
|
||||||
bottom_.store(bottom + 1, std::memory_order_relaxed);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
bottom_.store(bottom + 1, std::memory_order_relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Can delay load until after acquiring slot as only this thread can push(), this load is not
|
|
||||||
// required to be atomic as we are the exclusive writer.
|
|
||||||
return buf->load(bottom);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bottom_.store(bottom + 1, std::memory_order_relaxed);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<T> steal() noexcept
|
|
||||||
{
|
|
||||||
int64_t top = top_.load(std::memory_order_acquire);
|
|
||||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
|
||||||
int64_t bottom = bottom_.load(std::memory_order_acquire);
|
|
||||||
|
|
||||||
if (top < bottom)
|
|
||||||
{
|
|
||||||
// Must load *before* acquiring the slot as slot may be overwritten immediately after acquiring.
|
|
||||||
// This load is NOT required to be atomic even-though it may race with an overrite as we only
|
|
||||||
// return the value if we win the race below garanteeing we had no race during our read. If we
|
|
||||||
// loose the race then 'x' could be corrupt due to read-during-write race but as T is trivially
|
|
||||||
// destructible this does not matter.
|
|
||||||
T x = buffer_.load(std::memory_order_consume)->load(top);
|
|
||||||
|
|
||||||
if (!top_.compare_exchange_strong(top, top + 1, std::memory_order_seq_cst, std::memory_order_relaxed))
|
|
||||||
{
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return x;
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace srb2
|
|
||||||
|
|
||||||
#endif // __SRB2_CORE_SPMC_QUEUE_HPP__
|
|
||||||
@@ -1,255 +0,0 @@
|
|||||||
// BLANKART
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
|
||||||
// Copyright (C) 2024 by Kart Krew
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef __SRB2_CORE_STATIC_VEC_HPP__
|
|
||||||
#define __SRB2_CORE_STATIC_VEC_HPP__
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <functional>
|
|
||||||
#include <initializer_list>
|
|
||||||
#include <iterator>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include "../cxxutil.hpp"
|
|
||||||
|
|
||||||
namespace srb2
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename T, size_t Limit>
|
|
||||||
class StaticVec;
|
|
||||||
|
|
||||||
template <typename T, size_t Limit>
|
|
||||||
class StaticVec
|
|
||||||
{
|
|
||||||
std::array<T, Limit> arr_ {{}};
|
|
||||||
size_t size_ = 0;
|
|
||||||
|
|
||||||
public:
|
|
||||||
using value_type = T;
|
|
||||||
|
|
||||||
constexpr StaticVec() {}
|
|
||||||
|
|
||||||
StaticVec(const StaticVec& rhs)
|
|
||||||
{
|
|
||||||
for (size_t i = size_; i > 0; i--)
|
|
||||||
{
|
|
||||||
arr_[i] = T();
|
|
||||||
}
|
|
||||||
size_ = rhs.size();
|
|
||||||
for (size_t i = 0; i < size_; i++)
|
|
||||||
{
|
|
||||||
arr_[i] = rhs.arr_[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StaticVec(StaticVec&& rhs) noexcept(std::is_nothrow_move_assignable_v<T>)
|
|
||||||
{
|
|
||||||
for (size_t i = size_; i > 0; i--)
|
|
||||||
{
|
|
||||||
arr_[i] = T();
|
|
||||||
}
|
|
||||||
size_ = rhs.size();
|
|
||||||
for (size_t i = 0; i < size_; i++)
|
|
||||||
{
|
|
||||||
arr_[i] = std::move(rhs.arr_[i]);
|
|
||||||
}
|
|
||||||
while (rhs.size() > 0)
|
|
||||||
{
|
|
||||||
rhs.pop_back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr StaticVec(std::initializer_list<T> list) noexcept(std::is_nothrow_move_assignable_v<T>)
|
|
||||||
{
|
|
||||||
size_ = list.size();
|
|
||||||
size_t i = 0;
|
|
||||||
for (auto itr = list.begin(); itr != list.end(); itr++)
|
|
||||||
{
|
|
||||||
arr_[i] = *itr;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~StaticVec() = default;
|
|
||||||
|
|
||||||
StaticVec& operator=(const StaticVec& rhs)
|
|
||||||
{
|
|
||||||
for (size_t i = size_; i > 0; i--)
|
|
||||||
{
|
|
||||||
arr_[i] = T();
|
|
||||||
}
|
|
||||||
size_ = rhs.size();
|
|
||||||
for (size_t i = 0; i < size_; i++)
|
|
||||||
{
|
|
||||||
arr_[i] = rhs.arr_[i];
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
StaticVec& operator=(StaticVec&& rhs) noexcept(std::is_nothrow_move_constructible_v<T>)
|
|
||||||
{
|
|
||||||
for (size_t i = size_; i > 0; i--)
|
|
||||||
{
|
|
||||||
arr_[i] = T();
|
|
||||||
}
|
|
||||||
size_ = rhs.size();
|
|
||||||
for (size_t i = 0; i < size_; i++)
|
|
||||||
{
|
|
||||||
arr_[i] = std::move(rhs.arr_[i]);
|
|
||||||
}
|
|
||||||
while (rhs.size() > 0)
|
|
||||||
{
|
|
||||||
rhs.pop_back();
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void push_back(const T& value) { arr_[size_++] = value; }
|
|
||||||
|
|
||||||
void pop_back() { arr_[--size_] = T(); }
|
|
||||||
|
|
||||||
void resize(size_t size, T value = T())
|
|
||||||
{
|
|
||||||
if (size >= Limit)
|
|
||||||
{
|
|
||||||
throw std::length_error("new size >= Capacity");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size == size_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (size < size_)
|
|
||||||
{
|
|
||||||
while (size_ > size)
|
|
||||||
{
|
|
||||||
pop_back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (size_ < size)
|
|
||||||
{
|
|
||||||
push_back(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear()
|
|
||||||
{
|
|
||||||
arr_ = {{}};
|
|
||||||
size_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
using iterator = typename std::array<T, Limit>::iterator;
|
|
||||||
using const_iterator = typename std::array<T, Limit>::const_iterator;
|
|
||||||
|
|
||||||
constexpr iterator begin() noexcept { return arr_.begin(); }
|
|
||||||
|
|
||||||
constexpr const_iterator begin() const noexcept { return arr_.cbegin(); }
|
|
||||||
|
|
||||||
constexpr const_iterator cbegin() const noexcept { return arr_.cbegin(); }
|
|
||||||
|
|
||||||
constexpr iterator end() noexcept { return std::next(arr_.begin(), size_); }
|
|
||||||
|
|
||||||
constexpr const_iterator end() const noexcept { return cend(); }
|
|
||||||
|
|
||||||
constexpr const_iterator cend() const noexcept { return std::next(arr_.cbegin(), size_); }
|
|
||||||
|
|
||||||
constexpr std::reverse_iterator<iterator> rbegin() noexcept { return std::reverse_iterator(this->end()); }
|
|
||||||
|
|
||||||
constexpr std::reverse_iterator<const_iterator> crbegin() const noexcept { return std::reverse_iterator(this->cend()); }
|
|
||||||
|
|
||||||
constexpr std::reverse_iterator<iterator> rend() noexcept { return std::reverse_iterator(this->begin()); }
|
|
||||||
|
|
||||||
constexpr std::reverse_iterator<const_iterator> crend() const noexcept { return std::reverse_iterator(this->cbegin()); }
|
|
||||||
|
|
||||||
constexpr bool empty() const noexcept { return size_ == 0; }
|
|
||||||
|
|
||||||
constexpr size_t size() const noexcept { return size_; }
|
|
||||||
|
|
||||||
constexpr size_t capacity() const noexcept { return Limit; }
|
|
||||||
|
|
||||||
constexpr size_t max_size() const noexcept { return Limit; }
|
|
||||||
|
|
||||||
constexpr T& operator[](size_t index) noexcept { return arr_[index]; }
|
|
||||||
|
|
||||||
T& at(size_t index)
|
|
||||||
{
|
|
||||||
if (index >= size_)
|
|
||||||
{
|
|
||||||
throw std::out_of_range("index >= size");
|
|
||||||
}
|
|
||||||
return this[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr const T& operator[](size_t index) const noexcept { return arr_[index]; }
|
|
||||||
|
|
||||||
const T& at(size_t index) const
|
|
||||||
{
|
|
||||||
if (index >= size_)
|
|
||||||
{
|
|
||||||
throw std::out_of_range("index >= size");
|
|
||||||
}
|
|
||||||
return this[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
T& front() { return *arr_[0]; }
|
|
||||||
|
|
||||||
T& back() { return *arr_[size_ - 1]; }
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace srb2
|
|
||||||
|
|
||||||
template <typename T, size_t L1, size_t L2>
|
|
||||||
bool operator==(const srb2::StaticVec<T, L1>& lhs, const srb2::StaticVec<T, L2>& rhs)
|
|
||||||
{
|
|
||||||
const size_t size = lhs.size();
|
|
||||||
if (size != rhs.size())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < lhs; i++)
|
|
||||||
{
|
|
||||||
if (rhs[i] != lhs[i])
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, size_t L1, size_t L2>
|
|
||||||
bool operator!=(const srb2::StaticVec<T, L1>& lhs, const srb2::StaticVec<T, L2>& rhs)
|
|
||||||
{
|
|
||||||
return !(lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, size_t Limit>
|
|
||||||
struct std::hash<srb2::StaticVec<T, Limit>>
|
|
||||||
{
|
|
||||||
size_t operator()(const srb2::StaticVec<T, Limit>& input) const
|
|
||||||
{
|
|
||||||
constexpr size_t prime = sizeof(size_t) == 8 ? 0x00000100000001B3 : 0x01000193;
|
|
||||||
constexpr size_t basis = sizeof(size_t) == 8 ? 0xcbf29ce484222325 : 0x811c9dc5;
|
|
||||||
|
|
||||||
size_t ret = basis;
|
|
||||||
for (auto itr = input.begin(); itr != input.end(); itr++)
|
|
||||||
{
|
|
||||||
ret = (ret * prime) ^ std::hash<T>(*itr);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __SRB2_CORE_STATIC_VEC_HPP__
|
|
||||||
@@ -1,346 +0,0 @@
|
|||||||
// BLANKART
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
|
||||||
// Copyright (C) 2024 by Kart Krew
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "thread_pool.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <exception>
|
|
||||||
#include <mutex>
|
|
||||||
#include <string>
|
|
||||||
#include <system_error>
|
|
||||||
|
|
||||||
//#include <fmt/format.h>
|
|
||||||
//#include <tracy/tracy/Tracy.hpp>
|
|
||||||
|
|
||||||
#include "../cxxutil.hpp"
|
|
||||||
#include "../m_argv.h"
|
|
||||||
|
|
||||||
using namespace srb2;
|
|
||||||
|
|
||||||
static void do_work(ThreadPool::Task& work)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//ZoneScoped;
|
|
||||||
(work.thunk)(work.raw.data());
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
// can't do anything
|
|
||||||
}
|
|
||||||
|
|
||||||
(work.deleter)(work.raw.data());
|
|
||||||
if (work.pseudosema)
|
|
||||||
{
|
|
||||||
work.pseudosema->fetch_sub(1, std::memory_order_relaxed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pool_executor(
|
|
||||||
//int thread_index,
|
|
||||||
std::shared_ptr<std::atomic<bool>> pool_alive,
|
|
||||||
std::shared_ptr<std::mutex> worker_ready_mutex,
|
|
||||||
std::shared_ptr<std::condition_variable> worker_ready_condvar,
|
|
||||||
std::shared_ptr<ThreadPool::Queue> my_wq,
|
|
||||||
std::vector<std::shared_ptr<ThreadPool::Queue>> other_wqs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
//std::string thread_name = fmt::format("Thread Pool Thread {}", thread_index);
|
|
||||||
//tracy::SetThreadName(thread_name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
int spins = 0;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
std::optional<ThreadPool::Task> work = my_wq->steal();
|
|
||||||
bool did_work = false;
|
|
||||||
if (work)
|
|
||||||
{
|
|
||||||
do_work(*work);
|
|
||||||
|
|
||||||
did_work = true;
|
|
||||||
spins = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (auto& q : other_wqs)
|
|
||||||
{
|
|
||||||
work = q->steal();
|
|
||||||
if (work)
|
|
||||||
{
|
|
||||||
do_work(*work);
|
|
||||||
|
|
||||||
did_work = true;
|
|
||||||
spins = 0;
|
|
||||||
|
|
||||||
// We only want to steal one work item at a time, to prioritize our own queue
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!did_work)
|
|
||||||
{
|
|
||||||
// Spin a few loops to avoid yielding, then wait for the ready lock
|
|
||||||
spins += 1;
|
|
||||||
if (spins > 100)
|
|
||||||
{
|
|
||||||
std::unique_lock<std::mutex> ready_lock {*worker_ready_mutex};
|
|
||||||
while (my_wq->empty() && pool_alive->load())
|
|
||||||
{
|
|
||||||
worker_ready_condvar->wait(ready_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool_alive->load())
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadPool::ThreadPool()
|
|
||||||
{
|
|
||||||
immediate_mode_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadPool::ThreadPool(size_t threads)
|
|
||||||
{
|
|
||||||
next_queue_index_ = 0;
|
|
||||||
pool_alive_ = std::make_shared<std::atomic<bool>>(true);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < threads; i++)
|
|
||||||
{
|
|
||||||
std::shared_ptr<Queue> wsq = std::make_shared<Queue>(2048);
|
|
||||||
work_queues_.push_back(wsq);
|
|
||||||
|
|
||||||
std::shared_ptr<std::mutex> mutex = std::make_shared<std::mutex>();
|
|
||||||
worker_ready_mutexes_.push_back(std::move(mutex));
|
|
||||||
std::shared_ptr<std::condition_variable> condvar = std::make_shared<std::condition_variable>();
|
|
||||||
worker_ready_condvars_.push_back(std::move(condvar));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < threads; i++)
|
|
||||||
{
|
|
||||||
std::shared_ptr<Queue> my_queue = work_queues_[i];
|
|
||||||
std::vector<std::shared_ptr<Queue>> other_queues;
|
|
||||||
for (size_t j = 0; j < threads; j++)
|
|
||||||
{
|
|
||||||
// Order the other queues starting from the next adjacent worker
|
|
||||||
// i.e. if this is worker 2 of 8, then other queues is 3, 4, 5, 6, 7, 0, 1
|
|
||||||
// This tries to balance out work stealing behavior
|
|
||||||
|
|
||||||
size_t other_index = j + i;
|
|
||||||
if (other_index >= threads)
|
|
||||||
{
|
|
||||||
other_index -= threads;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (other_index != i)
|
|
||||||
{
|
|
||||||
other_queues.push_back(work_queues_[other_index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::thread thread;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
thread = std::thread
|
|
||||||
{
|
|
||||||
pool_executor,
|
|
||||||
//i,
|
|
||||||
pool_alive_,
|
|
||||||
worker_ready_mutexes_[i],
|
|
||||||
worker_ready_condvars_[i],
|
|
||||||
my_queue,
|
|
||||||
other_queues
|
|
||||||
};
|
|
||||||
}
|
|
||||||
catch (const std::system_error& error)
|
|
||||||
{
|
|
||||||
// Safe shutdown and rethrow
|
|
||||||
pool_alive_->store(false);
|
|
||||||
for (auto& t : threads_)
|
|
||||||
{
|
|
||||||
t.join();
|
|
||||||
}
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
threads_.push_back(std::move(thread));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadPool::ThreadPool(ThreadPool&&) = default;
|
|
||||||
ThreadPool::~ThreadPool() = default;
|
|
||||||
|
|
||||||
ThreadPool& ThreadPool::operator=(ThreadPool&&) = default;
|
|
||||||
|
|
||||||
void ThreadPool::begin_sema()
|
|
||||||
{
|
|
||||||
sema_begun_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadPool::Sema ThreadPool::end_sema()
|
|
||||||
{
|
|
||||||
Sema ret = Sema(std::move(cur_sema_));
|
|
||||||
cur_sema_ = nullptr;
|
|
||||||
sema_begun_ = false;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThreadPool::notify()
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < work_queues_.size(); i++)
|
|
||||||
{
|
|
||||||
auto& q = work_queues_[i];
|
|
||||||
size_t count = q->size();
|
|
||||||
if (count > 0)
|
|
||||||
{
|
|
||||||
worker_ready_condvars_[i]->notify_one();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThreadPool::notify_sema(const ThreadPool::Sema& sema)
|
|
||||||
{
|
|
||||||
if (!sema.pseudosema_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
notify();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThreadPool::wait_idle()
|
|
||||||
{
|
|
||||||
if (immediate_mode_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ZoneScoped;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < work_queues_.size(); i++)
|
|
||||||
{
|
|
||||||
auto& q = work_queues_[i];
|
|
||||||
|
|
||||||
std::optional<Task> work;
|
|
||||||
while ((work = q->pop()).has_value())
|
|
||||||
{
|
|
||||||
do_work(*work);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThreadPool::wait_sema(const Sema& sema)
|
|
||||||
{
|
|
||||||
if (!sema.pseudosema_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ZoneScoped;
|
|
||||||
|
|
||||||
while (sema.pseudosema_->load(std::memory_order_seq_cst) > 0)
|
|
||||||
{
|
|
||||||
// spin to win
|
|
||||||
for (size_t i = 0; i < work_queues_.size(); i++)
|
|
||||||
{
|
|
||||||
auto& q = work_queues_[i];
|
|
||||||
|
|
||||||
std::optional<Task> work;
|
|
||||||
if ((work = q->pop()).has_value())
|
|
||||||
{
|
|
||||||
do_work(*work);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sema.pseudosema_->load(std::memory_order_seq_cst) != 0)
|
|
||||||
{
|
|
||||||
throw std::exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThreadPool::shutdown()
|
|
||||||
{
|
|
||||||
if (immediate_mode_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_idle();
|
|
||||||
|
|
||||||
pool_alive_->store(false);
|
|
||||||
|
|
||||||
for (auto& condvar : worker_ready_condvars_)
|
|
||||||
{
|
|
||||||
condvar->notify_all();
|
|
||||||
}
|
|
||||||
for (auto& t : threads_)
|
|
||||||
{
|
|
||||||
t.join();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<ThreadPool> srb2::g_main_threadpool;
|
|
||||||
|
|
||||||
void I_ThreadPoolInit(void)
|
|
||||||
{
|
|
||||||
SRB2_ASSERT(g_main_threadpool == nullptr);
|
|
||||||
size_t thread_count = std::min(static_cast<unsigned int>(9), std::thread::hardware_concurrency());
|
|
||||||
if (thread_count > 1)
|
|
||||||
{
|
|
||||||
// The main thread will act as a worker when waiting for pool idle
|
|
||||||
// Make one less worker thread to avoid unnecessary context switching
|
|
||||||
thread_count -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (M_CheckParm("-singlethreaded"))
|
|
||||||
{
|
|
||||||
g_main_threadpool = std::make_unique<ThreadPool>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_main_threadpool = std::make_unique<ThreadPool>(thread_count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_ThreadPoolShutdown(void)
|
|
||||||
{
|
|
||||||
if (!g_main_threadpool)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_main_threadpool->shutdown();
|
|
||||||
g_main_threadpool = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_ThreadPoolSubmit(srb2cthunk_t thunk, void* data)
|
|
||||||
{
|
|
||||||
SRB2_ASSERT(g_main_threadpool != nullptr);
|
|
||||||
|
|
||||||
g_main_threadpool->schedule([=]() {
|
|
||||||
(thunk)(data);
|
|
||||||
});
|
|
||||||
g_main_threadpool->notify();
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_ThreadPoolWaitIdle(void)
|
|
||||||
{
|
|
||||||
SRB2_ASSERT(g_main_threadpool != nullptr);
|
|
||||||
|
|
||||||
g_main_threadpool->wait_idle();
|
|
||||||
}
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
// BLANKART
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
|
||||||
// Copyright (C) 2024 by Kart Krew
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef __SRB2_CORE_THREAD_POOL_H__
|
|
||||||
#define __SRB2_CORE_THREAD_POOL_H__
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
#include <mutex>
|
|
||||||
#include <thread>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "spmc_queue.hpp"
|
|
||||||
|
|
||||||
namespace srb2
|
|
||||||
{
|
|
||||||
|
|
||||||
class ThreadPool
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct Task
|
|
||||||
{
|
|
||||||
void (*thunk)(void*);
|
|
||||||
void (*deleter)(void*);
|
|
||||||
std::shared_ptr<std::atomic<uint32_t>> pseudosema;
|
|
||||||
std::array<std::byte, 512 - sizeof(void(*)(void*)) * 2 - sizeof(std::shared_ptr<std::atomic<uint32_t>>)> raw;
|
|
||||||
};
|
|
||||||
|
|
||||||
using Queue = SpMcQueue<Task>;
|
|
||||||
|
|
||||||
class Sema
|
|
||||||
{
|
|
||||||
std::shared_ptr<std::atomic<uint32_t>> pseudosema_;
|
|
||||||
|
|
||||||
explicit Sema(std::shared_ptr<std::atomic<uint32_t>> sema) : pseudosema_(sema) {}
|
|
||||||
|
|
||||||
friend class ThreadPool;
|
|
||||||
public:
|
|
||||||
Sema() = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::shared_ptr<std::atomic<bool>> pool_alive_;
|
|
||||||
std::vector<std::shared_ptr<std::mutex>> worker_ready_mutexes_;
|
|
||||||
std::vector<std::shared_ptr<std::condition_variable>> worker_ready_condvars_;
|
|
||||||
std::vector<std::shared_ptr<Queue>> work_queues_;
|
|
||||||
std::vector<std::thread> threads_;
|
|
||||||
size_t next_queue_index_ = 0;
|
|
||||||
std::shared_ptr<std::atomic<uint32_t>> cur_sema_;
|
|
||||||
|
|
||||||
bool immediate_mode_ = false;
|
|
||||||
bool sema_begun_ = false;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ThreadPool();
|
|
||||||
explicit ThreadPool(size_t threads);
|
|
||||||
ThreadPool(const ThreadPool&) = delete;
|
|
||||||
ThreadPool(ThreadPool&&);
|
|
||||||
~ThreadPool();
|
|
||||||
|
|
||||||
ThreadPool& operator=(const ThreadPool&) = delete;
|
|
||||||
ThreadPool& operator=(ThreadPool&&);
|
|
||||||
|
|
||||||
void begin_sema();
|
|
||||||
ThreadPool::Sema end_sema();
|
|
||||||
|
|
||||||
/// Enqueue but don't notify
|
|
||||||
template <typename T> void schedule(T&& thunk);
|
|
||||||
/// Notify threads after several schedules
|
|
||||||
void notify();
|
|
||||||
void notify_sema(const Sema& sema);
|
|
||||||
void wait_idle();
|
|
||||||
void wait_sema(const Sema& sema);
|
|
||||||
void shutdown();
|
|
||||||
};
|
|
||||||
|
|
||||||
extern std::unique_ptr<ThreadPool> g_main_threadpool;
|
|
||||||
|
|
||||||
template <typename F>
|
|
||||||
void callable_caller(F* f)
|
|
||||||
{
|
|
||||||
(*f)();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename F>
|
|
||||||
void callable_destroyer(F* f)
|
|
||||||
{
|
|
||||||
f->~F();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void ThreadPool::schedule(T&& thunk)
|
|
||||||
{
|
|
||||||
static_assert(sizeof(T) <= sizeof(std::declval<Task>().raw));
|
|
||||||
|
|
||||||
if (immediate_mode_)
|
|
||||||
{
|
|
||||||
(thunk)();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sema_begun_)
|
|
||||||
{
|
|
||||||
if (cur_sema_ == nullptr)
|
|
||||||
{
|
|
||||||
cur_sema_ = std::make_shared<std::atomic<uint32_t>>(0);
|
|
||||||
}
|
|
||||||
cur_sema_->fetch_add(1, std::memory_order_relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t qi = next_queue_index_;
|
|
||||||
|
|
||||||
{
|
|
||||||
std::shared_ptr<Queue> q = work_queues_[qi];
|
|
||||||
Task task;
|
|
||||||
task.thunk = reinterpret_cast<void(*)(void*)>(callable_caller<T>);
|
|
||||||
task.deleter = reinterpret_cast<void(*)(void*)>(callable_destroyer<T>);
|
|
||||||
task.pseudosema = cur_sema_;
|
|
||||||
new (reinterpret_cast<T*>(task.raw.data())) T(std::move(thunk));
|
|
||||||
|
|
||||||
q->push(std::move(task));
|
|
||||||
}
|
|
||||||
// worker_ready_condvars_[qi]->notify_one();
|
|
||||||
|
|
||||||
next_queue_index_ += 1;
|
|
||||||
if (next_queue_index_ >= threads_.size())
|
|
||||||
{
|
|
||||||
next_queue_index_ = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace srb2
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
typedef void (*srb2cthunk_t)(void*);
|
|
||||||
|
|
||||||
void I_ThreadPoolInit(void);
|
|
||||||
void I_ThreadPoolShutdown(void);
|
|
||||||
void I_ThreadPoolSubmit(srb2cthunk_t thunk, void* data);
|
|
||||||
void I_ThreadPoolWaitIdle(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __SRB2_CORE_THREAD_POOL_H__
|
|
||||||
-152
@@ -1,152 +0,0 @@
|
|||||||
#ifndef __SRB2_CXXUTIL_HPP__
|
|
||||||
#define __SRB2_CXXUTIL_HPP__
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include "doomdef.h"
|
|
||||||
|
|
||||||
namespace srb2 {
|
|
||||||
|
|
||||||
template <class F>
|
|
||||||
class Finally {
|
|
||||||
public:
|
|
||||||
explicit Finally(const F& f) noexcept : f_(f) {}
|
|
||||||
explicit Finally(F&& f) noexcept : f_(f) {}
|
|
||||||
|
|
||||||
Finally(Finally&& from) noexcept : f_(std::move(from.f_)), call_(std::exchange(from.call_, false)) {}
|
|
||||||
|
|
||||||
Finally(const Finally& from) = delete;
|
|
||||||
void operator=(const Finally& from) = delete;
|
|
||||||
void operator=(Finally&& from) = delete;
|
|
||||||
|
|
||||||
~Finally() noexcept {
|
|
||||||
if (call_)
|
|
||||||
f_();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
F f_;
|
|
||||||
bool call_ = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class F>
|
|
||||||
Finally<std::decay_t<F>> finally(F&& f) noexcept {
|
|
||||||
return Finally {std::forward<F>(f)};
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SourceLocation {
|
|
||||||
const char* file_name;
|
|
||||||
unsigned int line_number;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define SRB2_SOURCE_LOCATION \
|
|
||||||
srb2::SourceLocation { __FILE__, __LINE__ }
|
|
||||||
|
|
||||||
#ifndef SRB2_ASSERT_HANDLER
|
|
||||||
#define SRB2_ASSERT_HANDLER srb2::IErrorAssertHandler
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(NDEBUG) || defined(PARANOIA)
|
|
||||||
// An assertion level of 2 will activate all invocations of the SRB2_ASSERT macro
|
|
||||||
#define SRB2_ASSERTION_LEVEL 2
|
|
||||||
#else
|
|
||||||
// The minimum assertion level is 1
|
|
||||||
#define SRB2_ASSERTION_LEVEL 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Assert a precondition expression in debug builds.
|
|
||||||
#define SRB2_ASSERT(expr) srb2::do_assert<2, SRB2_ASSERT_HANDLER>([&] { return (expr); }, SRB2_SOURCE_LOCATION, #expr)
|
|
||||||
|
|
||||||
class IErrorAssertHandler {
|
|
||||||
public:
|
|
||||||
static void handle(const SourceLocation& source_location, const char* expression) {
|
|
||||||
I_Error("Assertion failed at %s:%u: %s != true",
|
|
||||||
source_location.file_name,
|
|
||||||
source_location.line_number,
|
|
||||||
expression);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class NoOpAssertHandler {
|
|
||||||
public:
|
|
||||||
static void handle(const SourceLocation& source_location, const char* expression) {(void)source_location; (void)expression;}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @brief Assert a precondition expression, aborting the application if it fails.
|
|
||||||
/// @tparam Expr
|
|
||||||
/// @tparam Level the level of this assertion; if it is less than or equal to SRB2_ASSERTION_LEVEL, this overload will
|
|
||||||
/// activate.
|
|
||||||
/// @param expr a callable which returns a bool
|
|
||||||
/// @param source_location a struct containing the source location of the assertion, e.g. SRB2_SOURCE_LOCATION
|
|
||||||
/// @param expression the expression evaluated in the expression callable
|
|
||||||
/// @param message an optional message to display for the assertion
|
|
||||||
template <unsigned int Level, class Handler, class Expr>
|
|
||||||
std::enable_if_t<(Level <= SRB2_ASSERTION_LEVEL), void>
|
|
||||||
do_assert(const Expr& expr, const SourceLocation& source_location, const char* expression = "") noexcept {
|
|
||||||
static_assert(Level > 0, "level of an assertion must not be 0");
|
|
||||||
if (!expr()) {
|
|
||||||
Handler::handle(source_location, expression);
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unsigned int Level, class, class Expr>
|
|
||||||
std::enable_if_t<(Level > SRB2_ASSERTION_LEVEL), void>
|
|
||||||
do_assert(const Expr&, const SourceLocation&, const char* = "") noexcept {
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class NotNull final {
|
|
||||||
T ptr_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static_assert(std::is_convertible_v<decltype(std::declval<T>() != nullptr), bool>,
|
|
||||||
"T is not comparable with nullptr_t");
|
|
||||||
|
|
||||||
/// @brief Move-construct from the pointer value U, asserting that it is not null. Allows construction of a
|
|
||||||
/// NotNull<T> from any compatible pointer U, for example with polymorphic classes.
|
|
||||||
template <typename U, typename = std::enable_if_t<std::is_convertible_v<U, T>>>
|
|
||||||
constexpr NotNull(U&& rhs) : ptr_(std::forward<U>(rhs)) {
|
|
||||||
SRB2_ASSERT(ptr_ != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Wrap the pointer type T, asserting that the pointer is not null.
|
|
||||||
template <typename = std::enable_if_t<!std::is_same_v<std::nullptr_t, T>>>
|
|
||||||
constexpr NotNull(T rhs) : ptr_(std::move(rhs)) {
|
|
||||||
SRB2_ASSERT(ptr_ != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Copy construction from NotNull of convertible type U. Only if the incoming pointer is NotNull already.
|
|
||||||
template <typename U, typename = std::enable_if_t<std::is_convertible_v<U, T>>>
|
|
||||||
constexpr NotNull(const NotNull<U>& rhs) : NotNull(rhs.get()) {
|
|
||||||
// Value is guaranteed to be not null by construction; no assertion necessary
|
|
||||||
}
|
|
||||||
|
|
||||||
NotNull(const NotNull& rhs) = default;
|
|
||||||
NotNull& operator=(const NotNull& rhs) = default;
|
|
||||||
|
|
||||||
/// @brief Get the stored pointer.
|
|
||||||
constexpr T get() const { return ptr_; }
|
|
||||||
|
|
||||||
/// @brief Convert to T (the pointer type).
|
|
||||||
constexpr operator T() const { return get(); }
|
|
||||||
|
|
||||||
/// @brief Arrow-dereference to *T (the actual value pointed to).
|
|
||||||
constexpr decltype(auto) operator->() const { return get(); }
|
|
||||||
|
|
||||||
/// @brief Dereference to *T (the actual value pointed to).
|
|
||||||
constexpr decltype(auto) operator*() const { return *get(); }
|
|
||||||
|
|
||||||
// It is not allowed to construct NotNull<T> with nullptr regardless of T.
|
|
||||||
NotNull(std::nullptr_t) = delete;
|
|
||||||
NotNull& operator=(std::nullptr_t) = delete;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
NotNull(T) -> NotNull<T>;
|
|
||||||
|
|
||||||
} // namespace srb2
|
|
||||||
|
|
||||||
#endif // __SRB2_CXXUTIL_HPP__
|
|
||||||
+11
-139
@@ -87,9 +87,6 @@ boolean serverrunning = false;
|
|||||||
INT32 serverplayer = 0;
|
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)
|
||||||
|
|
||||||
plrinfo playerinfo[MAXPLAYERS];
|
|
||||||
SINT8 joinnode = 0; // used for CL_VIEWSERVER
|
|
||||||
|
|
||||||
// Server specific vars
|
// Server specific vars
|
||||||
UINT8 playernode[MAXPLAYERS];
|
UINT8 playernode[MAXPLAYERS];
|
||||||
|
|
||||||
@@ -98,7 +95,7 @@ UINT8 playernode[MAXPLAYERS];
|
|||||||
tic_t jointimeout = (3*TICRATE);
|
tic_t jointimeout = (3*TICRATE);
|
||||||
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
|
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
|
||||||
#ifdef SATURNPAK
|
#ifdef SATURNPAK
|
||||||
static tic_t resendingsavegame[MAXNETNODES]; // Are we resending the savegame?
|
static boolean resendingsavegame[MAXNETNODES]; // Are we resending the savegame?
|
||||||
static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can resend again?
|
static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can resend again?
|
||||||
#endif
|
#endif
|
||||||
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
|
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
|
||||||
@@ -1188,7 +1185,6 @@ typedef enum
|
|||||||
#endif
|
#endif
|
||||||
CL_CONNECTED,
|
CL_CONNECTED,
|
||||||
CL_ABORTED,
|
CL_ABORTED,
|
||||||
CL_VIEWSERVER,
|
|
||||||
CL_ASKFULLFILELIST,
|
CL_ASKFULLFILELIST,
|
||||||
CL_CONFIRMCONNECT,
|
CL_CONFIRMCONNECT,
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
@@ -1252,7 +1248,7 @@ static inline void CL_DrawConnectionStatus(void)
|
|||||||
if (!menuactive) // menu already draws its own fade
|
if (!menuactive) // menu already draws its own fade
|
||||||
V_DrawFadeScreen(0xFF00, 16); // force default
|
V_DrawFadeScreen(0xFF00, 16); // force default
|
||||||
|
|
||||||
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES && cl_mode != CL_VIEWSERVER
|
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
&& cl_mode != CL_DOWNLOADHTTPFILES
|
&& cl_mode != CL_DOWNLOADHTTPFILES
|
||||||
#endif
|
#endif
|
||||||
@@ -1372,78 +1368,6 @@ static inline void CL_DrawConnectionStatus(void)
|
|||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||||
va(" %2u/%2u Files",loadcompletednum,fileneedednum));
|
va(" %2u/%2u Files",loadcompletednum,fileneedednum));
|
||||||
}
|
}
|
||||||
else if (cl_mode == CL_VIEWSERVER)
|
|
||||||
{
|
|
||||||
V_DrawFill(8, 16, BASEVIDWIDTH - 16, 54, 239);
|
|
||||||
|
|
||||||
V_DrawThinString(12 + 80, 18, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.servername));
|
|
||||||
|
|
||||||
const char *map = va("%sP", serverlist[joinnode].info.mapname);
|
|
||||||
patch_t *current_map = W_LumpExists(map) ? W_CachePatchName(map, PU_CACHE) : W_CachePatchName("BLANKLVL", PU_CACHE);
|
|
||||||
V_DrawSmallScaledPatch(10, 18, 0, current_map);
|
|
||||||
|
|
||||||
V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.maptitle));
|
|
||||||
V_DrawThinString(12 + 80, 48, V_ALLOWLOWERCASE, va("%s", Gametype_Names[serverlist[joinnode].info.gametype]));
|
|
||||||
|
|
||||||
if (fileneedednum > 0)
|
|
||||||
{
|
|
||||||
V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_ORANGEMAP, va("%i Addons", fileneedednum));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_YELLOWMAP, "Vanilla");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serverlist[joinnode].info.cheatsenabled)
|
|
||||||
{
|
|
||||||
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, 58, V_ALLOWLOWERCASE|V_GREENMAP, "Cheats");
|
|
||||||
}
|
|
||||||
|
|
||||||
V_DrawFill(8, 72, BASEVIDWIDTH - 16, 112, 239);
|
|
||||||
|
|
||||||
V_DrawString(12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, "Players");
|
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH - 12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, va("%i / %i", serverlist[joinnode].info.numberofplayer, serverlist[joinnode].info.maxplayer));
|
|
||||||
|
|
||||||
INT32 i;
|
|
||||||
INT32 count = 0;
|
|
||||||
INT32 x = 14;
|
|
||||||
INT32 y = 84;
|
|
||||||
INT32 statuscolor = 1;
|
|
||||||
char player_name[MAXPLAYERNAME+1];
|
|
||||||
if (serverlist[joinnode].info.numberofplayer > 0)
|
|
||||||
{
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (playerinfo[i].node < 255)
|
|
||||||
{
|
|
||||||
strncpy(player_name, playerinfo[i].name, MAXPLAYERNAME);
|
|
||||||
V_DrawThinString(x + 10, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, player_name);
|
|
||||||
|
|
||||||
if (playerinfo[i].team == 0) { statuscolor = 184; } // playing
|
|
||||||
if (playerinfo[i].data & 0x20) { statuscolor = 86; } // tag IT
|
|
||||||
if (playerinfo[i].team == 1) { statuscolor = 128; } // ctf red team
|
|
||||||
if (playerinfo[i].team == 2) { statuscolor = 232; } // ctf blue team
|
|
||||||
if (playerinfo[i].team == 255) { statuscolor = 16; } // spectator or non-team
|
|
||||||
|
|
||||||
V_DrawFill(x, y, 7, 7, 31);
|
|
||||||
V_DrawFill(x, y, 6, 6, statuscolor);
|
|
||||||
|
|
||||||
y += 9;
|
|
||||||
count++;
|
|
||||||
if ((count == 11) || (count == 22))
|
|
||||||
{
|
|
||||||
x += 104;
|
|
||||||
y = 84;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Buttons
|
|
||||||
V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239);
|
|
||||||
V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80"));
|
|
||||||
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80"));
|
|
||||||
}
|
|
||||||
else if (filedownload.current != -1)
|
else if (filedownload.current != -1)
|
||||||
{
|
{
|
||||||
INT32 dldlength;
|
INT32 dldlength;
|
||||||
@@ -2545,7 +2469,6 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
|||||||
if (i < 0)
|
if (i < 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
joinnode = i;
|
|
||||||
|
|
||||||
// Quit here rather than downloading files and being refused later.
|
// Quit here rather than downloading files and being refused later.
|
||||||
if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer)
|
if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer)
|
||||||
@@ -2572,7 +2495,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
|
cl_mode = CL_CHECKFILES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2626,7 +2549,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||||||
|
|
||||||
case CL_ASKFULLFILELIST:
|
case CL_ASKFULLFILELIST:
|
||||||
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
|
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
|
||||||
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
|
cl_mode = CL_CHECKFILES;
|
||||||
else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
|
else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
|
||||||
{
|
{
|
||||||
if (CL_AskFileList(fileneedednum))
|
if (CL_AskFileList(fileneedednum))
|
||||||
@@ -2792,15 +2715,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||||||
D_ProcessEvents(); //needed for menu system to receive inputs
|
D_ProcessEvents(); //needed for menu system to receive inputs
|
||||||
|
|
||||||
key = I_GetKey();
|
key = I_GetKey();
|
||||||
|
|
||||||
if (cl_mode == CL_VIEWSERVER)
|
|
||||||
{
|
|
||||||
if (key == KEY_ENTER || key == KEY_JOY1)
|
|
||||||
cl_mode = CL_CHECKFILES;
|
|
||||||
else if (key == KEY_ESCAPE || key == KEY_JOY1+1)
|
|
||||||
cl_mode = CL_ABORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only ESC and non-keyboard keys abort connection
|
// Only ESC and non-keyboard keys abort connection
|
||||||
if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED))
|
if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED))
|
||||||
{
|
{
|
||||||
@@ -4228,8 +4142,6 @@ consvar_t cv_downloadspeed = {"downloadspeed", "300", CV_SAVE, downloadspeed_con
|
|||||||
static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}};
|
static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}};
|
||||||
consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
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_AddPlayer(UINT8 **p, INT32 playernum);
|
||||||
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
|
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
|
||||||
|
|
||||||
@@ -4332,7 +4244,7 @@ static void ResetNode(INT32 node)
|
|||||||
// SATURN
|
// SATURN
|
||||||
#ifdef SATURNPAK
|
#ifdef SATURNPAK
|
||||||
is_client_saturn[node] = false;
|
is_client_saturn[node] = false;
|
||||||
resendingsavegame[node] = 0;
|
resendingsavegame[node] = false;
|
||||||
savegameresendcooldown[node] = 0;
|
savegameresendcooldown[node] = 0;
|
||||||
gamestate_resend_counter[node] = 0;
|
gamestate_resend_counter[node] = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -4997,16 +4909,6 @@ static void HandleServerInfo(SINT8 node)
|
|||||||
if (client && cl_mode > CL_SEARCHING && node == servernode)
|
if (client && cl_mode > CL_SEARCHING && node == servernode)
|
||||||
memcpy(connectedservername, netbuffer->u.serverinfo.servername, MAXSERVERNAME);
|
memcpy(connectedservername, netbuffer->u.serverinfo.servername, MAXSERVERNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void HandlePlayerInfo(SINT8 node)
|
|
||||||
{
|
|
||||||
(void)node;
|
|
||||||
|
|
||||||
INT32 i;
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
playerinfo[i] = netbuffer->u.playerinfo[i];
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SATURNPAK
|
#ifdef SATURNPAK
|
||||||
@@ -5043,7 +4945,7 @@ static void PT_CanReceiveGamestate(SINT8 node)
|
|||||||
CONS_Printf(M_GetText("Resending game state to %s...\n"), player_names[nodetoplayer[node]]);
|
CONS_Printf(M_GetText("Resending game state to %s...\n"), player_names[nodetoplayer[node]]);
|
||||||
|
|
||||||
SV_SendSaveGame(node, true); // Resend a complete game state
|
SV_SendSaveGame(node, true); // Resend a complete game state
|
||||||
resendingsavegame[node] = 1;
|
resendingsavegame[node] = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -5295,10 +5197,6 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
|||||||
|
|
||||||
case PT_CLIENTCMD:
|
case PT_CLIENTCMD:
|
||||||
break; // This is not an "unknown packet"
|
break; // This is not an "unknown packet"
|
||||||
|
|
||||||
case PT_PLAYERINFO:
|
|
||||||
HandlePlayerInfo(node);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PT_SERVERTICS:
|
case PT_SERVERTICS:
|
||||||
// Do not remove my own server (we have just get a out of order packet)
|
// Do not remove my own server (we have just get a out of order packet)
|
||||||
@@ -5494,7 +5392,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
|
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
|
||||||
&& (!UseSaturnSynch(node) || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
&& (!UseSaturnSynch(node) || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||||
{
|
{
|
||||||
resendingsavegame[node] = 0; // reset this before just in case
|
resendingsavegame[node] = false; // reset this before just in case
|
||||||
|
|
||||||
// Check if a client is saturn before sending ANYTHING!
|
// Check if a client is saturn before sending ANYTHING!
|
||||||
// this way we only send stuff to clients we know can use the gamestate resend
|
// this way we only send stuff to clients we know can use the gamestate resend
|
||||||
@@ -5504,7 +5402,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||||||
// Tell the client we are about to resend them the gamestate
|
// Tell the client we are about to resend them the gamestate
|
||||||
netbuffer->packettype = PT_WILLRESENDGAMESTATE;
|
netbuffer->packettype = PT_WILLRESENDGAMESTATE;
|
||||||
HSendPacket(node, true, 0, 0);
|
HSendPacket(node, true, 0, 0);
|
||||||
resendingsavegame[node] = 1;
|
resendingsavegame[node] = true;
|
||||||
}
|
}
|
||||||
else if (UseVanillaSynch(node))
|
else if (UseVanillaSynch(node))
|
||||||
{
|
{
|
||||||
@@ -5834,7 +5732,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||||||
break;
|
break;
|
||||||
case PT_RECEIVEDGAMESTATE:
|
case PT_RECEIVEDGAMESTATE:
|
||||||
sendingsavegame[node] = false;
|
sendingsavegame[node] = false;
|
||||||
resendingsavegame[node] = 0;
|
resendingsavegame[node] = false;
|
||||||
savegameresendcooldown[node] = I_GetTime() + cv_resynchcooldown.value * TICRATE; // I_GetTime() + 5 * TICRATE;
|
savegameresendcooldown[node] = I_GetTime() + cv_resynchcooldown.value * TICRATE; // I_GetTime() + 5 * TICRATE;
|
||||||
break;
|
break;
|
||||||
case PT_WILLRESENDGAMESTATE:
|
case PT_WILLRESENDGAMESTATE:
|
||||||
@@ -5894,9 +5792,8 @@ static void GetPackets(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*if (netbuffer->packettype == PT_PLAYERINFO)
|
if (netbuffer->packettype == PT_PLAYERINFO)
|
||||||
continue; // We do nothing with PLAYERINFO, that's for the MS browser. Not quite true anymore :p*/
|
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
|
||||||
|
|
||||||
|
|
||||||
// We also count unknown packets, hence "<="
|
// We also count unknown packets, hence "<="
|
||||||
if (netbuffer->packettype <= NUMPACKETTYPE)
|
if (netbuffer->packettype <= NUMPACKETTYPE)
|
||||||
@@ -6465,35 +6362,10 @@ static void SV_Maketic(void)
|
|||||||
maketic++;
|
maketic++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SATURNPAK
|
|
||||||
static void SV_UpdateResendGamestateTimeout(void)
|
|
||||||
{
|
|
||||||
for (INT32 i = 0; i < MAXNETNODES; ++i)
|
|
||||||
{
|
|
||||||
if (!resendingsavegame[i])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
resendingsavegame[i]++;
|
|
||||||
|
|
||||||
// Resending savegame took too long
|
|
||||||
if (resendingsavegame[i] > (tic_t)TICRATE*cv_pingtimeout.value)
|
|
||||||
{
|
|
||||||
resendingsavegame[i] = 0;
|
|
||||||
SendKick(i, KICK_MSG_CON_FAIL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
boolean TryRunTics(tic_t realtics)
|
boolean TryRunTics(tic_t realtics)
|
||||||
{
|
{
|
||||||
boolean ticking;
|
boolean ticking;
|
||||||
|
|
||||||
#ifdef SATURNPAK
|
|
||||||
if (server)
|
|
||||||
SV_UpdateResendGamestateTimeout();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// the machine has lagged but it is not so bad
|
// the machine has lagged but it is not so bad
|
||||||
if (realtics > TICRATE/7) // FIXME: consistency failure!!
|
if (realtics > TICRATE/7) // FIXME: consistency failure!!
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
#ifndef __D_CLISRV__
|
#ifndef __D_CLISRV__
|
||||||
#define __D_CLISRV__
|
#define __D_CLISRV__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "d_ticcmd.h"
|
#include "d_ticcmd.h"
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
#include "d_netcmd.h"
|
#include "d_netcmd.h"
|
||||||
@@ -581,9 +577,6 @@ extern boolean acceptnewnode;
|
|||||||
extern SINT8 servernode;
|
extern SINT8 servernode;
|
||||||
extern char connectedservername[MAXSERVERNAME+1];
|
extern char connectedservername[MAXSERVERNAME+1];
|
||||||
|
|
||||||
extern plrinfo playerinfo[MAXPLAYERS];
|
|
||||||
extern SINT8 joinnode;
|
|
||||||
|
|
||||||
void Command_Ping_f(void);
|
void Command_Ping_f(void);
|
||||||
extern tic_t connectiontimeout;
|
extern tic_t connectiontimeout;
|
||||||
extern tic_t jointimeout;
|
extern tic_t jointimeout;
|
||||||
@@ -615,8 +608,6 @@ extern consvar_t cv_connectawaittime;
|
|||||||
|
|
||||||
extern consvar_t cv_discordinvites;
|
extern consvar_t cv_discordinvites;
|
||||||
|
|
||||||
extern consvar_t cv_serverinfoscreen;
|
|
||||||
|
|
||||||
// Used in d_net, the only dependence
|
// Used in d_net, the only dependence
|
||||||
//tic_t ExpandTics(INT32 low, tic_t basetic);
|
//tic_t ExpandTics(INT32 low, tic_t basetic);
|
||||||
void D_ClientServerInit(void);
|
void D_ClientServerInit(void);
|
||||||
@@ -698,9 +689,4 @@ typedef struct rewind_s {
|
|||||||
void CL_ClearRewinds(void);
|
void CL_ClearRewinds(void);
|
||||||
rewind_t *CL_SaveRewindPoint(size_t demopos);
|
rewind_t *CL_SaveRewindPoint(size_t demopos);
|
||||||
rewind_t *CL_RewindToTime(tic_t time);
|
rewind_t *CL_RewindToTime(tic_t time);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+17
-45
@@ -73,8 +73,6 @@
|
|||||||
#include "m_perfstats.h"
|
#include "m_perfstats.h"
|
||||||
#include "k_kart.h"
|
#include "k_kart.h"
|
||||||
|
|
||||||
#include "core/memory.h"
|
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
|
|
||||||
#ifdef CMAKECONFIG
|
#ifdef CMAKECONFIG
|
||||||
@@ -327,39 +325,6 @@ static void D_Renderview(void)
|
|||||||
|
|
||||||
R_ApplyLevelInterpolators(rendertimefrac);
|
R_ApplyLevelInterpolators(rendertimefrac);
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
// if this is display player 1
|
|
||||||
if (cv_homremoval.value)
|
|
||||||
{
|
|
||||||
if (cv_homremoval.value == 1)
|
|
||||||
{
|
|
||||||
// Clear the software screen buffer to remove HOM
|
|
||||||
memset(vid.screens[0], 31, vid.width * vid.height);
|
|
||||||
}
|
|
||||||
else if (cv_homremoval.value == 2)
|
|
||||||
{
|
|
||||||
//'development' HOM removal -- makes it blindingly obvious if HOM is spotted.
|
|
||||||
memset(vid.screens[0], 32+(timeinmap&15), vid.width * vid.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw over the fourth screen so you don't have to stare at a HOM :V
|
|
||||||
if (splitscreen == 2)
|
|
||||||
{
|
|
||||||
// V_DrawPatchFill, but for the fourth screen only
|
|
||||||
patch_t *pat = W_CachePatchName("SRB2BACK", PU_CACHE);
|
|
||||||
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
|
||||||
INT32 x, y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz;
|
|
||||||
|
|
||||||
for (x = vid.width>>1; x < vid.width; x += pw)
|
|
||||||
{
|
|
||||||
for (y = vid.height>>1; y < vid.height; y += ph)
|
|
||||||
V_DrawScaledPatch(x, y, V_NOSCALESTART, pat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
for (i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
const boolean issplitscreen = (i > 0);
|
const boolean issplitscreen = (i > 0);
|
||||||
@@ -371,6 +336,7 @@ static void D_Renderview(void)
|
|||||||
if (!issplitscreen) // Initialize for P1
|
if (!issplitscreen) // Initialize for P1
|
||||||
{
|
{
|
||||||
viewwindowy = viewwindowx = 0;
|
viewwindowy = viewwindowx = 0;
|
||||||
|
topleft = screens[0];
|
||||||
objectsdrawn = 0;
|
objectsdrawn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,11 +345,13 @@ static void D_Renderview(void)
|
|||||||
{
|
{
|
||||||
HWR_RenderPlayerView();
|
HWR_RenderPlayerView();
|
||||||
R_RestoreLevelInterpolators();
|
R_RestoreLevelInterpolators();
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (issplitscreen) // Splitscreen-specific
|
if (issplitscreen) // Splitscreen-specific
|
||||||
{
|
{
|
||||||
|
const INT32 len = viewheight*sizeof(ylookup[0]);
|
||||||
|
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@@ -397,20 +365,28 @@ static void D_Renderview(void)
|
|||||||
viewwindowx = 0;
|
viewwindowx = 0;
|
||||||
viewwindowy = viewheight;
|
viewwindowy = viewheight;
|
||||||
}
|
}
|
||||||
|
M_Memcpy(ylookup, ylookup2, len);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
viewwindowx = 0;
|
viewwindowx = 0;
|
||||||
viewwindowy = viewheight;
|
viewwindowy = viewheight;
|
||||||
|
M_Memcpy(ylookup, ylookup3, len);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
viewwindowx = viewwidth;
|
viewwindowx = viewwidth;
|
||||||
viewwindowy = viewheight;
|
viewwindowy = viewheight;
|
||||||
|
M_Memcpy(ylookup, ylookup4, len);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||||
|
|
||||||
|
if (issplitscreen)
|
||||||
|
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!issplitscreen)
|
if (!issplitscreen)
|
||||||
@@ -608,7 +584,7 @@ static boolean D_Display(void)
|
|||||||
{
|
{
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.rowbytes);
|
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastdraw = false;
|
lastdraw = false;
|
||||||
@@ -642,7 +618,7 @@ static boolean D_Display(void)
|
|||||||
V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM);
|
V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM);
|
||||||
|
|
||||||
// vid size change is now finished if it was on...
|
// vid size change is now finished if it was on...
|
||||||
vid.recalc = false;
|
vid.recalc = 0;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
@@ -774,8 +750,6 @@ void D_SRB2Loop(void)
|
|||||||
precise_t enterprecise = I_GetPreciseTime();
|
precise_t enterprecise = I_GetPreciseTime();
|
||||||
precise_t finishprecise = enterprecise;
|
precise_t finishprecise = enterprecise;
|
||||||
|
|
||||||
Z_Frame_Reset();
|
|
||||||
|
|
||||||
// Casting the return value of a function is bad practice (apparently)
|
// Casting the return value of a function is bad practice (apparently)
|
||||||
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
|
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
|
||||||
capbudget = (precise_t)budget;
|
capbudget = (precise_t)budget;
|
||||||
@@ -952,7 +926,7 @@ void D_SRB2Loop(void)
|
|||||||
|
|
||||||
if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh)
|
if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh)
|
||||||
{
|
{
|
||||||
I_SleepDuration(capbudget - elapsed);
|
I_SleepDuration(capbudget - (finishprecise - enterprecise));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Capture the time once more to get the real delta time.
|
// Capture the time once more to get the real delta time.
|
||||||
@@ -1636,9 +1610,7 @@ void D_SRB2Main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for dedicated server
|
// for dedicated server
|
||||||
#if !defined (DEDICATED)
|
|
||||||
dedicated = M_CheckParm("-dedicated") != 0;
|
dedicated = M_CheckParm("-dedicated") != 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
strcpy(title, "SRB2Kart");
|
strcpy(title, "SRB2Kart");
|
||||||
strcpy(srb2, "SRB2Kart");
|
strcpy(srb2, "SRB2Kart");
|
||||||
@@ -1840,7 +1812,7 @@ void D_SRB2Main(void)
|
|||||||
{
|
{
|
||||||
name = lumpinfo->name;
|
name = lumpinfo->name;
|
||||||
|
|
||||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||||
{
|
{
|
||||||
INT16 num;
|
INT16 num;
|
||||||
if (name[5] != '\0')
|
if (name[5] != '\0')
|
||||||
@@ -1870,7 +1842,7 @@ void D_SRB2Main(void)
|
|||||||
{
|
{
|
||||||
name = lumpinfo->name;
|
name = lumpinfo->name;
|
||||||
|
|
||||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||||
{
|
{
|
||||||
INT16 num;
|
INT16 num;
|
||||||
if (name[5] != '\0')
|
if (name[5] != '\0')
|
||||||
|
|||||||
@@ -14,10 +14,6 @@
|
|||||||
#ifndef __D_MAIN__
|
#ifndef __D_MAIN__
|
||||||
#define __D_MAIN__
|
#define __D_MAIN__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "w_wad.h" // for MAX_WADFILES
|
#include "w_wad.h" // for MAX_WADFILES
|
||||||
|
|
||||||
@@ -94,8 +90,4 @@ const char *D_Home(void);
|
|||||||
//
|
//
|
||||||
void D_StartTitle(void);
|
void D_StartTitle(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //__D_MAIN__
|
#endif //__D_MAIN__
|
||||||
+2
-8
@@ -18,10 +18,6 @@
|
|||||||
#ifndef __D_NET__
|
#ifndef __D_NET__
|
||||||
#define __D_NET__
|
#define __D_NET__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Max computers in a game
|
// Max computers in a game
|
||||||
// 127 is probably as high as this can go, because
|
// 127 is probably as high as this can go, because
|
||||||
// SINT8 is used for nodes sometimes >:(
|
// SINT8 is used for nodes sometimes >:(
|
||||||
@@ -47,6 +43,8 @@ extern SINT8 nodetoplayer4[MAXNETNODES]; // Say the numplayer for this node if a
|
|||||||
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
||||||
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
||||||
|
|
||||||
|
extern boolean serverrunning;
|
||||||
|
|
||||||
void Net_AckTicker(void);
|
void Net_AckTicker(void);
|
||||||
|
|
||||||
// If reliable return true if packet sent, 0 else
|
// If reliable return true if packet sent, 0 else
|
||||||
@@ -67,8 +65,4 @@ void Net_SendAcks(INT32 node);
|
|||||||
void Net_WaitAllAckReceived(UINT32 timeout);
|
void Net_WaitAllAckReceived(UINT32 timeout);
|
||||||
const char *Net_GetPacketName(UINT8 packettype);
|
const char *Net_GetPacketName(UINT8 packettype);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+7
-3
@@ -204,6 +204,11 @@ static void Command_Archivetest_f(void);
|
|||||||
// CLIENT VARIABLES
|
// CLIENT VARIABLES
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
|
void SendWeaponPref(void);
|
||||||
|
void SendWeaponPref2(void);
|
||||||
|
void SendWeaponPref3(void);
|
||||||
|
void SendWeaponPref4(void);
|
||||||
|
|
||||||
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
|
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
|
||||||
|
|
||||||
static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}};
|
||||||
@@ -297,12 +302,14 @@ consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
|
|||||||
{"verticallook4", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
{"verticallook4", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||||
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
|
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
|
||||||
{"use_joystick", "1", CV_SAVE|CV_CALL, NULL, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
{"use_joystick", "1", CV_SAVE|CV_CALL, NULL, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
||||||
{"use_joystick2", "2", CV_SAVE|CV_CALL, NULL, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
{"use_joystick2", "2", CV_SAVE|CV_CALL, NULL, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
||||||
{"use_joystick3", "3", CV_SAVE|CV_CALL, NULL, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
{"use_joystick3", "3", CV_SAVE|CV_CALL, NULL, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
||||||
{"use_joystick4", "4", CV_SAVE|CV_CALL, NULL, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
{"use_joystick4", "4", CV_SAVE|CV_CALL, NULL, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_SDL)
|
#if defined (HAVE_SDL)
|
||||||
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = {
|
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = {
|
||||||
@@ -895,7 +902,6 @@ void D_RegisterClientCommands(void)
|
|||||||
CV_RegisterVar(&cv_netticbuffer);
|
CV_RegisterVar(&cv_netticbuffer);
|
||||||
CV_RegisterVar(&cv_mindelay);
|
CV_RegisterVar(&cv_mindelay);
|
||||||
CV_RegisterVar(&cv_gentlemens);
|
CV_RegisterVar(&cv_gentlemens);
|
||||||
CV_RegisterVar(&cv_serverinfoscreen);
|
|
||||||
|
|
||||||
#ifdef NETGAME_DEVMODE
|
#ifdef NETGAME_DEVMODE
|
||||||
CV_RegisterVar(&cv_fishcake);
|
CV_RegisterVar(&cv_fishcake);
|
||||||
@@ -1025,8 +1031,6 @@ void D_RegisterClientCommands(void)
|
|||||||
CV_RegisterVar(&cv_scr_width);
|
CV_RegisterVar(&cv_scr_width);
|
||||||
CV_RegisterVar(&cv_scr_height);
|
CV_RegisterVar(&cv_scr_height);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_parallelsoftware);
|
|
||||||
|
|
||||||
CV_RegisterVar(&cv_soundtest);
|
CV_RegisterVar(&cv_soundtest);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_perfstats);
|
CV_RegisterVar(&cv_perfstats);
|
||||||
|
|||||||
@@ -15,17 +15,8 @@
|
|||||||
#ifndef __D_NETCMD__
|
#ifndef __D_NETCMD__
|
||||||
#define __D_NETCMD__
|
#define __D_NETCMD__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
void SendWeaponPref(void);
|
|
||||||
void SendWeaponPref2(void);
|
|
||||||
void SendWeaponPref3(void);
|
|
||||||
void SendWeaponPref4(void);
|
|
||||||
|
|
||||||
// console vars
|
// console vars
|
||||||
extern consvar_t cv_playername;
|
extern consvar_t cv_playername;
|
||||||
extern consvar_t cv_playercolor;
|
extern consvar_t cv_playercolor;
|
||||||
@@ -327,8 +318,4 @@ void D_SetPassword(const char *pw);
|
|||||||
// used for the player setup menu
|
// used for the player setup menu
|
||||||
UINT8 CanChangeSkin(INT32 playernum);
|
UINT8 CanChangeSkin(INT32 playernum);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -111,9 +111,7 @@ static fileused_t transferFiles[UINT8_MAX + 1];
|
|||||||
// Receiver structure
|
// Receiver structure
|
||||||
INT32 fileneedednum; // Number of files needed to join the server
|
INT32 fileneedednum; // Number of files needed to join the server
|
||||||
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
|
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
static I_mutex downloadmutex;
|
static I_mutex downloadmutex;
|
||||||
#endif
|
|
||||||
char downloaddir[512] = "DOWNLOAD";
|
char downloaddir[512] = "DOWNLOAD";
|
||||||
|
|
||||||
file_download_t filedownload;
|
file_download_t filedownload;
|
||||||
@@ -1353,18 +1351,14 @@ void CURLAbortFile(void)
|
|||||||
{
|
{
|
||||||
filedownload.http_running = false;
|
filedownload.http_running = false;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
// lock and unlock to wait for the download thread to exit
|
// lock and unlock to wait for the download thread to exit
|
||||||
I_lock_mutex(&downloadmutex);
|
I_lock_mutex(&downloadmutex);
|
||||||
I_unlock_mutex(downloadmutex);
|
I_unlock_mutex(downloadmutex);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CURLGetFile(void)
|
void CURLGetFile(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
I_lock_mutex(&downloadmutex);
|
I_lock_mutex(&downloadmutex);
|
||||||
#endif
|
|
||||||
CURLMcode mc; /* return code used by curl_multi_wait() */
|
CURLMcode mc; /* return code used by curl_multi_wait() */
|
||||||
CURLcode easyres; /* Return from easy interface */
|
CURLcode easyres; /* Return from easy interface */
|
||||||
CURLMsg *m; /* for picking up messages with the transfer status */
|
CURLMsg *m; /* for picking up messages with the transfer status */
|
||||||
@@ -1459,9 +1453,7 @@ void CURLGetFile(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
filedownload.http_running = false;
|
filedownload.http_running = false;
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
I_unlock_mutex(downloadmutex);
|
I_unlock_mutex(downloadmutex);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTTP_login *
|
HTTP_login *
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
#ifndef __D_NETFIL__
|
#ifndef __D_NETFIL__
|
||||||
#define __D_NETFIL__
|
#define __D_NETFIL__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "d_clisrv.h"
|
#include "d_clisrv.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
|
||||||
@@ -129,8 +125,4 @@ HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next);
|
|||||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __D_NETFIL__
|
#endif // __D_NETFIL__
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
# Declare dedicated interface sources
|
|
||||||
|
|
||||||
target_sourcefile(c)
|
|
||||||
|
|
||||||
target_sources(SRB2SDL2 PRIVATE)
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
|
||||||
target_sources(SRB2SDL2 PRIVATE
|
|
||||||
../win32/win_dbg.c
|
|
||||||
../win32/Srb2win.rc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2legacy)
|
|
||||||
elseif(${CMAKE_SYSTEM} MATCHES Linux)
|
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME lsrb2dlegacy)
|
|
||||||
else()
|
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2legacy)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
|
||||||
find_library(CORE_LIB CoreFoundation)
|
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
|
||||||
${CORE_LIB}
|
|
||||||
${PNG_LIBRARIES}
|
|
||||||
${ZLIB_LIBRARIES}
|
|
||||||
)
|
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
|
||||||
else()
|
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
|
||||||
${PNG_LIBRARIES}
|
|
||||||
${ZLIB_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
|
||||||
m
|
|
||||||
rt
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
|
|
||||||
|
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION})
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
|
||||||
ws2_32
|
|
||||||
)
|
|
||||||
target_compile_options(SRB2SDL2 PRIVATE
|
|
||||||
-U_WINDOWS
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(SRB2SDL2 PRIVATE
|
|
||||||
${PNG_INCLUDE_DIRS}
|
|
||||||
${ZLIB_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(SRB2SDL2 PRIVATE
|
|
||||||
-DDEDICATED
|
|
||||||
)
|
|
||||||
|
|
||||||
## strip debug symbols into separate file when using gcc
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
|
||||||
message(STATUS "Will make separate debug symbols in *.debug")
|
|
||||||
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
|
||||||
COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
|
|
||||||
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
|
|
||||||
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#### Installation ####
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
|
||||||
install(TARGETS SRB2SDL2
|
|
||||||
BUNDLE DESTINATION .
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
install(TARGETS SRB2SDL2 SRB2SDL2
|
|
||||||
RUNTIME DESTINATION .
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Mac bundle fixup
|
|
||||||
# HACK: THIS IS IMPORTANT! See the escaped \${CMAKE_INSTALL_PREFIX}? This
|
|
||||||
# makes it so that var is evaluated LATER during cpack, not right now!
|
|
||||||
# This fixes the quirk where the bundled libraries don't land in the final package
|
|
||||||
# https://cmake.org/pipermail/cmake/2011-March/043532.html
|
|
||||||
#
|
|
||||||
# HOWEVER: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} is NOT escaped, because that var
|
|
||||||
# is only available to us at this step. Read the link: ${CMAKE_INSTALL_PREFIX} at
|
|
||||||
# this current step points to the CMAKE build folder, NOT the folder that CPACK uses.
|
|
||||||
# Therefore, it makes sense to escape that var, but not the other.
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
|
||||||
install(CODE "
|
|
||||||
include(BundleUtilities)
|
|
||||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CPACK_PACKAGE_DESCRIPTION_SUMMARY}.app\"
|
|
||||||
\"\"
|
|
||||||
/Library/Frameworks
|
|
||||||
)"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SRB2_SDL2_AVAILABLE YES PARENT_SCOPE)
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
i_system.c
|
|
||||||
i_main.c
|
|
||||||
i_video.c
|
|
||||||
i_sound.c
|
|
||||||
i_threads.c
|
|
||||||
dosstr.c
|
|
||||||
endtxt.c
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// This file is in the public domain.
|
|
||||||
// (Re)written by Graue in 2006.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief String uppercasing/lowercasing functions for non-DOS non-Win32
|
|
||||||
/// systems
|
|
||||||
|
|
||||||
#include "../doomtype.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_DOSSTR_FUNCS
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
int strupr(char *n)
|
|
||||||
{
|
|
||||||
while (*n != '\0')
|
|
||||||
{
|
|
||||||
*n = toupper(*n);
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int strlwr(char *n)
|
|
||||||
{
|
|
||||||
while (*n != '\0')
|
|
||||||
{
|
|
||||||
*n = tolower(*n);
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,234 +0,0 @@
|
|||||||
/*
|
|
||||||
* Function to write the SRB2 end message text
|
|
||||||
*
|
|
||||||
* Copyright (C) 1998 by Udo Munk <udo@umserver.umnet.de>
|
|
||||||
*
|
|
||||||
* This code is provided AS IS and there are no guarantees, none.
|
|
||||||
* Feel free to share and modify.
|
|
||||||
*/
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief Support to show ENDOOM text
|
|
||||||
///
|
|
||||||
/// Loads the lump ENDOOM, set up the console to print
|
|
||||||
/// out the colors and text
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
// need this 19990118 by Kin
|
|
||||||
#include "../doomdef.h"
|
|
||||||
#include "../w_wad.h"
|
|
||||||
#include "../z_zone.h"
|
|
||||||
#include "endtxt.h"
|
|
||||||
/** \brief The ShowEndTxt function
|
|
||||||
|
|
||||||
|
|
||||||
Prints out the ENDOOM the way DOOM.EXE/DOOM2.EXE did for Win32 or Linux/GNU
|
|
||||||
|
|
||||||
\return void
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ShowEndTxt(void)
|
|
||||||
{
|
|
||||||
INT32 i;
|
|
||||||
UINT16 j, att = 0;
|
|
||||||
INT32 nlflag = 1;
|
|
||||||
#ifdef _WIN32
|
|
||||||
HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
||||||
DWORD mode, bytesWritten;
|
|
||||||
CONSOLE_SCREEN_BUFFER_INFO backupcon;
|
|
||||||
COORD resizewin = {80,-1};
|
|
||||||
CHAR let = 0;
|
|
||||||
#endif
|
|
||||||
UINT16 *ptext;
|
|
||||||
void *data;
|
|
||||||
lumpnum_t endoomnum = W_GetNumForName("ENDOOM");
|
|
||||||
//char *col;
|
|
||||||
|
|
||||||
/* if the xterm has more then 80 columns we need to add nl's */
|
|
||||||
/* doesn't work, COLUMNS is not in the environment at this time ???
|
|
||||||
col = I_getenv("COLUMNS");
|
|
||||||
if (col) {
|
|
||||||
if (atoi(col) > 80)
|
|
||||||
nlflag++;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* get the lump with the text */
|
|
||||||
data = ptext = W_CacheLumpNum(endoomnum, PU_CACHE);
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
if (co == INVALID_HANDLE_VALUE || GetFileType(co) != FILE_TYPE_CHAR || !GetConsoleMode(co, &mode)) // test if it a good handle
|
|
||||||
{
|
|
||||||
Z_Free(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
backupcon.wAttributes = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE; // Just in case
|
|
||||||
GetConsoleScreenBufferInfo(co, &backupcon); //Store old state
|
|
||||||
resizewin.Y = backupcon.dwSize.Y;
|
|
||||||
if (backupcon.dwSize.X < resizewin.X)
|
|
||||||
SetConsoleScreenBufferSize(co, resizewin);
|
|
||||||
|
|
||||||
for (i=1; i<=80*25; i++) // print 80x25 text and deal with the attributes too
|
|
||||||
{
|
|
||||||
j = (UINT16)(*ptext >> 8); // attribute first
|
|
||||||
let = (char)(*ptext & 0xff); // text second
|
|
||||||
if (j != att) // attribute changed?
|
|
||||||
{
|
|
||||||
att = j; // save current attribute
|
|
||||||
SetConsoleTextAttribute(co, j); //set fg and bg color for buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteConsoleA(co, &let, 1, &bytesWritten, NULL); // now the text
|
|
||||||
|
|
||||||
if (nlflag && !(i % 80) && backupcon.dwSize.X > resizewin.X) // do we need a nl?
|
|
||||||
{
|
|
||||||
att = backupcon.wAttributes;
|
|
||||||
SetConsoleTextAttribute(co, att); // all attributes off
|
|
||||||
WriteConsoleA(co, "\n", 1, &bytesWritten, NULL); // newline to console
|
|
||||||
}
|
|
||||||
ptext++;
|
|
||||||
}
|
|
||||||
SetConsoleTextAttribute(co, backupcon.wAttributes); // all attributes off
|
|
||||||
#else
|
|
||||||
/* print 80x25 text and deal with the attributes too */
|
|
||||||
for (i=1; i<=80*25; i++) {
|
|
||||||
/* attribute first */
|
|
||||||
/* attribute changed? */
|
|
||||||
if ((j = *ptext >> 8) != att) {
|
|
||||||
/* save current attribute */
|
|
||||||
att = j;
|
|
||||||
/* set new attribute, forground color first */
|
|
||||||
printf("\033[");
|
|
||||||
switch (j & 0x0f) {
|
|
||||||
case 0: /* black */
|
|
||||||
printf("30");
|
|
||||||
break;
|
|
||||||
case 1: /* blue */
|
|
||||||
printf("34");
|
|
||||||
break;
|
|
||||||
case 2: /* green */
|
|
||||||
printf("32");
|
|
||||||
break;
|
|
||||||
case 3: /* cyan */
|
|
||||||
printf("36");
|
|
||||||
break;
|
|
||||||
case 4: /* red */
|
|
||||||
printf("31");
|
|
||||||
break;
|
|
||||||
case 5: /* magenta */
|
|
||||||
printf("35");
|
|
||||||
break;
|
|
||||||
case 6: /* brown */
|
|
||||||
printf("33");
|
|
||||||
break;
|
|
||||||
case 7: /* bright grey */
|
|
||||||
printf("37");
|
|
||||||
break;
|
|
||||||
case 8: /* dark grey */
|
|
||||||
printf("1;30");
|
|
||||||
break;
|
|
||||||
case 9: /* bright blue */
|
|
||||||
printf("1;34");
|
|
||||||
break;
|
|
||||||
case 10: /* bright green */
|
|
||||||
printf("1;32");
|
|
||||||
break;
|
|
||||||
case 11: /* bright cyan */
|
|
||||||
printf("1;36");
|
|
||||||
break;
|
|
||||||
case 12: /* bright red */
|
|
||||||
printf("1;31");
|
|
||||||
break;
|
|
||||||
case 13: /* bright magenta */
|
|
||||||
printf("1;35");
|
|
||||||
break;
|
|
||||||
case 14: /* yellow */
|
|
||||||
printf("1;33");
|
|
||||||
break;
|
|
||||||
case 15: /* white */
|
|
||||||
printf("1;37");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("m");
|
|
||||||
/* now background color */
|
|
||||||
printf("\033[");
|
|
||||||
switch ((j >> 4) & 0x0f) {
|
|
||||||
case 0: /* black */
|
|
||||||
printf("40");
|
|
||||||
break;
|
|
||||||
case 1: /* blue */
|
|
||||||
printf("44");
|
|
||||||
break;
|
|
||||||
case 2: /* green */
|
|
||||||
printf("42");
|
|
||||||
break;
|
|
||||||
case 3: /* cyan */
|
|
||||||
printf("46");
|
|
||||||
break;
|
|
||||||
case 4: /* red */
|
|
||||||
printf("41");
|
|
||||||
break;
|
|
||||||
case 5: /* magenta */
|
|
||||||
printf("45");
|
|
||||||
break;
|
|
||||||
case 6: /* brown */
|
|
||||||
printf("43");
|
|
||||||
break;
|
|
||||||
case 7: /* bright grey */
|
|
||||||
printf("47");
|
|
||||||
break;
|
|
||||||
case 8: /* dark grey */
|
|
||||||
printf("1;40");
|
|
||||||
break;
|
|
||||||
case 9: /* bright blue */
|
|
||||||
printf("1;44");
|
|
||||||
break;
|
|
||||||
case 10: /* bright green */
|
|
||||||
printf("1;42");
|
|
||||||
break;
|
|
||||||
case 11: /* bright cyan */
|
|
||||||
printf("1;46");
|
|
||||||
break;
|
|
||||||
case 12: /* bright red */
|
|
||||||
printf("1;41");
|
|
||||||
break;
|
|
||||||
case 13: /* bright magenta */
|
|
||||||
printf("1;45");
|
|
||||||
break;
|
|
||||||
case 14: /* yellow */
|
|
||||||
printf("1;43");
|
|
||||||
break;
|
|
||||||
case 15: /* white */
|
|
||||||
printf("1;47");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("m");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now the text */
|
|
||||||
printf("%c",*ptext++ & 0xff);
|
|
||||||
|
|
||||||
/* do we need a nl? */
|
|
||||||
if (nlflag)
|
|
||||||
{
|
|
||||||
if (!(i % 80))
|
|
||||||
{
|
|
||||||
printf("\033[0m");
|
|
||||||
att = 0;
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* all attributes off */
|
|
||||||
printf("\033[0m");
|
|
||||||
#endif
|
|
||||||
if (nlflag)
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
Z_Free(data);
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief Support to show ENDOOM text
|
|
||||||
|
|
||||||
#ifndef __ENDTXT__
|
|
||||||
#define __ENDTXT__
|
|
||||||
|
|
||||||
void ShowEndTxt (void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,238 +0,0 @@
|
|||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief Main program, simply calls D_SRB2Main and D_SRB2Loop, the high level loop.
|
|
||||||
|
|
||||||
#include "../doomdef.h"
|
|
||||||
#include "../m_argv.h"
|
|
||||||
#include "../d_main.h"
|
|
||||||
#include "../m_misc.h" /* path shit */
|
|
||||||
#include "../i_system.h"
|
|
||||||
#include "../d_clisrv.h"
|
|
||||||
|
|
||||||
#if defined (__GNUC__) || defined (__unix__)
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __unix__
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "time.h" // For log timestamps
|
|
||||||
|
|
||||||
#ifdef HAVE_TTF
|
|
||||||
#include "i_ttf.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBBACKTRACE
|
|
||||||
#include <backtrace.h>
|
|
||||||
|
|
||||||
struct backtrace_state *bt_state = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
|
||||||
FILE *logstream = NULL;
|
|
||||||
char logfilename[1024];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DOXYGEN
|
|
||||||
#ifndef O_TEXT
|
|
||||||
#define O_TEXT 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef O_SEQUENTIAL
|
|
||||||
#define O_SEQUENTIAL 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef _AMD64_
|
|
||||||
#include "exchndl.h"
|
|
||||||
#define DRMINGW
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (_WIN32)
|
|
||||||
#include "../win32/win_dbg.h"
|
|
||||||
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
static void
|
|
||||||
ChDirToExe (void)
|
|
||||||
{
|
|
||||||
CHAR path[MAX_PATH];
|
|
||||||
if (GetModuleFileNameA(NULL, path, MAX_PATH) > 0)
|
|
||||||
{
|
|
||||||
strrchr(path, '\\')[0] = '\0';
|
|
||||||
SetCurrentDirectoryA(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** \brief The main function
|
|
||||||
|
|
||||||
\param argc number of arg
|
|
||||||
\param *argv string table
|
|
||||||
|
|
||||||
\return int
|
|
||||||
*/
|
|
||||||
#if defined (__GNUC__) && (__GNUC__ >= 4)
|
|
||||||
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
|
||||||
static void InitLogging(void)
|
|
||||||
{
|
|
||||||
const char *logdir = NULL;
|
|
||||||
time_t my_time;
|
|
||||||
struct tm * timeinfo;
|
|
||||||
const char *format;
|
|
||||||
const char *reldir;
|
|
||||||
int left;
|
|
||||||
boolean fileabs;
|
|
||||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
|
||||||
const char *link;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
logdir = D_Home();
|
|
||||||
|
|
||||||
my_time = time(NULL);
|
|
||||||
timeinfo = localtime(&my_time);
|
|
||||||
|
|
||||||
if (M_CheckParm("-logfile") && M_IsNextParm())
|
|
||||||
{
|
|
||||||
format = M_GetNextParm();
|
|
||||||
fileabs = M_IsPathAbsolute(format);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
format = "log-%Y-%m-%d_%H-%M-%S.txt";
|
|
||||||
fileabs = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileabs)
|
|
||||||
{
|
|
||||||
strftime(logfilename, sizeof logfilename, format, timeinfo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (M_CheckParm("-logdir") && M_IsNextParm())
|
|
||||||
reldir = M_GetNextParm();
|
|
||||||
else
|
|
||||||
reldir = "logs";
|
|
||||||
|
|
||||||
if (M_IsPathAbsolute(reldir))
|
|
||||||
{
|
|
||||||
left = snprintf(logfilename, sizeof logfilename,
|
|
||||||
"%s"PATHSEP, reldir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#ifdef DEFAULTDIR
|
|
||||||
if (logdir)
|
|
||||||
{
|
|
||||||
left = snprintf(logfilename, sizeof logfilename,
|
|
||||||
"%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif/*DEFAULTDIR*/
|
|
||||||
{
|
|
||||||
left = snprintf(logfilename, sizeof logfilename,
|
|
||||||
"."PATHSEP"%s"PATHSEP, reldir);
|
|
||||||
}
|
|
||||||
|
|
||||||
strftime(&logfilename[left], sizeof logfilename - left,
|
|
||||||
format, timeinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
M_MkdirEachUntil(logfilename,
|
|
||||||
M_PathParts(logdir) - 1,
|
|
||||||
M_PathParts(logfilename) - 1, 0755);
|
|
||||||
|
|
||||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
|
||||||
logstream = fopen(logfilename, "w");
|
|
||||||
#ifdef DEFAULTDIR
|
|
||||||
if (logdir)
|
|
||||||
link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir);
|
|
||||||
else
|
|
||||||
#endif/*DEFAULTDIR*/
|
|
||||||
link = "latest-log.txt";
|
|
||||||
unlink(link);
|
|
||||||
if (symlink(logfilename, link) == -1)
|
|
||||||
{
|
|
||||||
I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno));
|
|
||||||
}
|
|
||||||
#else/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
|
|
||||||
logstream = fopen("latest-log.txt", "wt+");
|
|
||||||
#endif/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
myargc = argc;
|
|
||||||
myargv = argv; /// \todo pull out path to exe from this string
|
|
||||||
|
|
||||||
dedicated = true;
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBBACKTRACE
|
|
||||||
bt_state = backtrace_create_state(
|
|
||||||
argv[0],
|
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
1,
|
|
||||||
#else
|
|
||||||
0,
|
|
||||||
#endif
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
ChDirToExe();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
|
||||||
if (!M_CheckParm("-nolog"))
|
|
||||||
InitLogging();
|
|
||||||
#endif/*LOGMESSAGES*/
|
|
||||||
|
|
||||||
//I_OutputMsg("I_StartupSystem() ...\n");
|
|
||||||
I_StartupSystem();
|
|
||||||
#if defined (_WIN32)
|
|
||||||
{
|
|
||||||
#ifdef DRMINGW
|
|
||||||
ExcHndlInit();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// startup SRB2
|
|
||||||
CONS_Printf("Setting up SRB2Kart...\n");
|
|
||||||
D_SRB2Main();
|
|
||||||
CONS_Printf("Entering main game loop...\n");
|
|
||||||
// never return
|
|
||||||
D_SRB2Loop();
|
|
||||||
|
|
||||||
#ifdef BUGTRAP
|
|
||||||
// This is safe even if BT didn't start.
|
|
||||||
ShutdownBugTrap();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// return to OS
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,339 +0,0 @@
|
|||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// The source is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief SDL interface for sound
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include "../doomdef.h"
|
|
||||||
#include "../i_sound.h"
|
|
||||||
#include "../s_sound.h"
|
|
||||||
|
|
||||||
/** \brief Sound subsystem runing and waiting
|
|
||||||
*/
|
|
||||||
UINT8 sound_started = false;
|
|
||||||
|
|
||||||
/** \brief The I_GetSfx function
|
|
||||||
|
|
||||||
\param sfx sfx to setup
|
|
||||||
|
|
||||||
\return data for sfx
|
|
||||||
*/
|
|
||||||
void *I_GetSfx(sfxinfo_t *sfx)
|
|
||||||
{
|
|
||||||
(void)sfx;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The I_FreeSfx function
|
|
||||||
|
|
||||||
\param sfx sfx to be freed up
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void I_FreeSfx(sfxinfo_t *sfx)
|
|
||||||
{
|
|
||||||
(void)sfx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief Init at program start...
|
|
||||||
*/
|
|
||||||
void I_StartupSound(void){}
|
|
||||||
|
|
||||||
/** \brief ... shut down and relase at program termination.
|
|
||||||
*/
|
|
||||||
void I_ShutdownSound(void){}
|
|
||||||
|
|
||||||
/// ------------------------
|
|
||||||
/// SFX I/O
|
|
||||||
/// ------------------------
|
|
||||||
|
|
||||||
/** \brief Starts a sound in a particular sound channel.
|
|
||||||
\param id sfxid
|
|
||||||
\param vol volume for sound
|
|
||||||
\param sep left-right balancle
|
|
||||||
\param pitch not used
|
|
||||||
\param priority not used
|
|
||||||
|
|
||||||
\return sfx handle
|
|
||||||
*/
|
|
||||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
|
||||||
{
|
|
||||||
(void)id;
|
|
||||||
(void)vol;
|
|
||||||
(void)sep;
|
|
||||||
(void)pitch;
|
|
||||||
(void)priority;
|
|
||||||
(void)channel;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief Stops a sound channel.
|
|
||||||
|
|
||||||
\param handle stop sfx handle
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void I_StopSound(INT32 handle)
|
|
||||||
{
|
|
||||||
(void)handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief Some digital sound drivers need this.
|
|
||||||
*/
|
|
||||||
void I_UpdateSound(void){}
|
|
||||||
|
|
||||||
/** \brief Called by S_*() functions to see if a channel is still playing.
|
|
||||||
|
|
||||||
\param handle sfx handle
|
|
||||||
|
|
||||||
\return 0 if no longer playing, 1 if playing.
|
|
||||||
*/
|
|
||||||
boolean I_SoundIsPlaying(INT32 handle)
|
|
||||||
{
|
|
||||||
(void)handle;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief Updates the sfx handle
|
|
||||||
|
|
||||||
\param handle sfx handle
|
|
||||||
\param vol volume
|
|
||||||
\param sep separation
|
|
||||||
\param pitch ptich
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
|
|
||||||
{
|
|
||||||
(void)handle;
|
|
||||||
(void)vol;
|
|
||||||
(void)sep;
|
|
||||||
(void)pitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The I_SetSfxVolume function
|
|
||||||
|
|
||||||
\param volume volume to set at
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void I_SetSfxVolume(UINT8 volume)
|
|
||||||
{
|
|
||||||
(void)volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ------------------------
|
|
||||||
// MUSIC SYSTEM
|
|
||||||
/// ------------------------
|
|
||||||
|
|
||||||
/** \brief Init the music systems
|
|
||||||
*/
|
|
||||||
void I_InitMusic(void){}
|
|
||||||
|
|
||||||
/** \brief Shutdown the music systems
|
|
||||||
*/
|
|
||||||
void I_ShutdownMusic(void){}
|
|
||||||
|
|
||||||
/// ------------------------
|
|
||||||
// MUSIC PROPERTIES
|
|
||||||
/// ------------------------
|
|
||||||
|
|
||||||
musictype_t I_SongType(void)
|
|
||||||
{
|
|
||||||
return MU_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_SongPlaying(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_SongPaused(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ------------------------
|
|
||||||
// MUSIC EFFECTS
|
|
||||||
/// ------------------------
|
|
||||||
|
|
||||||
boolean I_SetSongSpeed(float speed)
|
|
||||||
{
|
|
||||||
(void)speed;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ------------------------
|
|
||||||
// MUSIC SEEKING
|
|
||||||
/// ------------------------
|
|
||||||
|
|
||||||
UINT32 I_GetSongLength(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
|
||||||
{
|
|
||||||
(void)looppoint;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT32 I_GetSongLoopPoint(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_SetSongPosition(UINT32 position)
|
|
||||||
{
|
|
||||||
(void)position;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT32 I_GetSongPosition(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ------------------------
|
|
||||||
// MUSIC PLAYBACK
|
|
||||||
/// ------------------------
|
|
||||||
|
|
||||||
/** \brief Registers a song handle to song data.
|
|
||||||
|
|
||||||
\param data pointer to song data
|
|
||||||
\param len len of data
|
|
||||||
|
|
||||||
\return song handle
|
|
||||||
|
|
||||||
\todo Remove this
|
|
||||||
*/
|
|
||||||
boolean I_LoadSong(char *data, size_t len)
|
|
||||||
{
|
|
||||||
(void)data;
|
|
||||||
(void)len;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief See ::I_LoadSong, then think backwards
|
|
||||||
|
|
||||||
\param handle song handle
|
|
||||||
|
|
||||||
\sa I_LoadSong
|
|
||||||
\todo remove midi handle
|
|
||||||
*/
|
|
||||||
void I_UnloadSong(void){}
|
|
||||||
|
|
||||||
/** \brief Called by anything that wishes to start music
|
|
||||||
|
|
||||||
\param handle Song handle
|
|
||||||
\param looping looping it if true
|
|
||||||
|
|
||||||
\return if true, it's playing the song
|
|
||||||
|
|
||||||
\todo pass music name, not handle
|
|
||||||
*/
|
|
||||||
boolean I_PlaySong(boolean looping)
|
|
||||||
{
|
|
||||||
(void)looping;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief Stops a song over 3 seconds
|
|
||||||
|
|
||||||
\param handle Song handle
|
|
||||||
\return void
|
|
||||||
|
|
||||||
/todo drop handle
|
|
||||||
*/
|
|
||||||
void I_StopSong(void){}
|
|
||||||
|
|
||||||
/** \brief PAUSE game handling.
|
|
||||||
|
|
||||||
\param handle song handle
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void I_PauseSong(void){}
|
|
||||||
|
|
||||||
/** \brief RESUME game handling
|
|
||||||
|
|
||||||
\param handle song handle
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void I_ResumeSong(void){}
|
|
||||||
|
|
||||||
/** \brief The I_SetMusicVolume function
|
|
||||||
|
|
||||||
\param volume volume to set at
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void I_SetMusicVolume(UINT8 volume)
|
|
||||||
{
|
|
||||||
(void)volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_SetSongTrack(INT32 track)
|
|
||||||
{
|
|
||||||
(void)track;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ------------------------
|
|
||||||
/// MUSIC FADING
|
|
||||||
/// ------------------------
|
|
||||||
|
|
||||||
void I_SetInternalMusicVolume(UINT8 volume)
|
|
||||||
{
|
|
||||||
(void)volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_StopFadingSong(void){}
|
|
||||||
|
|
||||||
boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void))
|
|
||||||
{
|
|
||||||
(void)target_volume;
|
|
||||||
(void)source_volume;
|
|
||||||
(void)ms;
|
|
||||||
(void)callback;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
|
|
||||||
{
|
|
||||||
(void)target_volume;
|
|
||||||
(void)ms;
|
|
||||||
(void)callback;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_FadeOutStopSong(UINT32 ms)
|
|
||||||
{
|
|
||||||
(void)ms;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
|
||||||
{
|
|
||||||
(void)ms;
|
|
||||||
(void)looping;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_UpdateSongLagThreshold(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,364 +0,0 @@
|
|||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2020-2023 by James R.
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file i_threads.c
|
|
||||||
/// \brief Multithreading abstraction
|
|
||||||
|
|
||||||
#if defined (__unix__) || (!defined(__APPLE__) && defined (UNIXCOMMON))
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include "../i_threads.h"
|
|
||||||
#include "../doomdef.h"
|
|
||||||
|
|
||||||
typedef struct thread_s thread_t;
|
|
||||||
|
|
||||||
struct thread_s
|
|
||||||
{
|
|
||||||
thread_t *next;
|
|
||||||
void *userdata;
|
|
||||||
I_thread_fn func;
|
|
||||||
pthread_t thread;
|
|
||||||
};
|
|
||||||
|
|
||||||
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
|
||||||
static thread_t *thread_list;
|
|
||||||
static pthread_mutex_t thread_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
|
|
||||||
static void *HandleThread(void *data)
|
|
||||||
{
|
|
||||||
thread_t *thread = data;
|
|
||||||
thread->func(thread->userdata);
|
|
||||||
|
|
||||||
pthread_mutex_lock(&thread_lock);
|
|
||||||
thread->func = NULL;
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_spawn_thread (
|
|
||||||
const char * name,
|
|
||||||
I_thread_fn entry,
|
|
||||||
void * userdata
|
|
||||||
)
|
|
||||||
{
|
|
||||||
thread_t *thread;
|
|
||||||
(void)name;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&thread_lock);
|
|
||||||
thread = thread_list;
|
|
||||||
while (thread != NULL)
|
|
||||||
{
|
|
||||||
if (thread->func == NULL)
|
|
||||||
{
|
|
||||||
// join with the exited thread to release it's resources.
|
|
||||||
pthread_join(thread->thread, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
thread = thread->next;
|
|
||||||
}
|
|
||||||
if (thread == NULL)
|
|
||||||
{
|
|
||||||
thread = malloc(sizeof(thread_t));
|
|
||||||
thread->next = thread_list;
|
|
||||||
thread_list = thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
thread->func = entry;
|
|
||||||
thread->userdata = userdata;
|
|
||||||
pthread_create(&thread->thread, NULL, HandleThread, thread);
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
int I_thread_is_stopped(void)
|
|
||||||
{
|
|
||||||
thread_t *thread;
|
|
||||||
pthread_mutex_lock(&thread_lock);
|
|
||||||
thread = thread_list;
|
|
||||||
while (thread != NULL)
|
|
||||||
{
|
|
||||||
if (thread->func != NULL)
|
|
||||||
{
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
thread = thread->next;
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_start_threads(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_stop_threads(void)
|
|
||||||
{
|
|
||||||
thread_t *thread = thread_list;
|
|
||||||
while (thread != NULL)
|
|
||||||
{
|
|
||||||
// join with all threads here, since finished threads haven't been awaited yet.
|
|
||||||
pthread_join(thread->thread, NULL);
|
|
||||||
thread = thread->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_lock_mutex(I_mutex *anchor)
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&thread_lock);
|
|
||||||
if (*anchor == NULL)
|
|
||||||
{
|
|
||||||
pthread_mutexattr_t attr;
|
|
||||||
pthread_mutexattr_init(&attr);
|
|
||||||
|
|
||||||
// SRB2 relies on lock recursion, so we need a mutex configured for that.
|
|
||||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
|
||||||
*anchor = malloc(sizeof(pthread_mutex_t));
|
|
||||||
pthread_mutex_init(*anchor, &attr);
|
|
||||||
pthread_mutexattr_destroy(&attr);
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
pthread_mutex_lock(*anchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_unlock_mutex(I_mutex id)
|
|
||||||
{
|
|
||||||
pthread_mutex_unlock(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
|
||||||
{
|
|
||||||
I_Assert(mutex_id != NULL);
|
|
||||||
pthread_mutex_lock(&thread_lock);
|
|
||||||
if (*cond_anchor == NULL)
|
|
||||||
{
|
|
||||||
*cond_anchor = malloc(sizeof(pthread_cond_t));
|
|
||||||
pthread_cond_init(*cond_anchor, NULL);
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
pthread_cond_wait(*cond_anchor, mutex_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_wake_one_cond(I_cond *anchor)
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&thread_lock);
|
|
||||||
if (*anchor == NULL)
|
|
||||||
{
|
|
||||||
*anchor = malloc(sizeof(pthread_cond_t));
|
|
||||||
pthread_cond_init(*anchor, NULL);
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
pthread_cond_signal(*anchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_wake_all_cond(I_cond *anchor)
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&thread_lock);
|
|
||||||
if (*anchor == NULL)
|
|
||||||
{
|
|
||||||
*anchor = malloc(sizeof(pthread_cond_t));
|
|
||||||
pthread_cond_init(*anchor, NULL);
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&thread_lock);
|
|
||||||
pthread_cond_broadcast(*anchor);
|
|
||||||
}
|
|
||||||
#elif defined (_WIN32)
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "../i_threads.h"
|
|
||||||
#include "../doomdef.h"
|
|
||||||
#include "../doomtype.h"
|
|
||||||
|
|
||||||
typedef struct thread_s thread_t;
|
|
||||||
|
|
||||||
struct thread_s
|
|
||||||
{
|
|
||||||
thread_t *next;
|
|
||||||
void *userdata;
|
|
||||||
I_thread_fn func;
|
|
||||||
HANDLE thread;
|
|
||||||
DWORD thread_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
|
||||||
static thread_t *thread_list;
|
|
||||||
static CRITICAL_SECTION thread_lock;
|
|
||||||
|
|
||||||
static DWORD __stdcall HandleThread(void *data)
|
|
||||||
{
|
|
||||||
thread_t *thread = data;
|
|
||||||
thread->func(thread->userdata);
|
|
||||||
|
|
||||||
EnterCriticalSection(&thread_lock);
|
|
||||||
thread->func = NULL;
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
|
||||||
{
|
|
||||||
thread_t *thread;
|
|
||||||
(void)name;
|
|
||||||
EnterCriticalSection(&thread_lock);
|
|
||||||
thread = thread_list;
|
|
||||||
while (thread != NULL)
|
|
||||||
{
|
|
||||||
if (thread->func == NULL)
|
|
||||||
{
|
|
||||||
CloseHandle(thread->thread);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
thread = thread->next;
|
|
||||||
}
|
|
||||||
if (thread == NULL)
|
|
||||||
{
|
|
||||||
thread = malloc(sizeof(thread_t));
|
|
||||||
thread->next = thread_list;
|
|
||||||
thread_list = thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
thread->func = entry;
|
|
||||||
thread->userdata = userdata;
|
|
||||||
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->thread_id);
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
int I_thread_is_stopped(void)
|
|
||||||
{
|
|
||||||
thread_t *thread;
|
|
||||||
EnterCriticalSection(&thread_lock);
|
|
||||||
thread = thread_list;
|
|
||||||
while (thread != NULL)
|
|
||||||
{
|
|
||||||
if (thread->func != NULL)
|
|
||||||
{
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
thread = thread->next;
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_start_threads(void)
|
|
||||||
{
|
|
||||||
InitializeCriticalSection(&thread_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_stop_threads(void)
|
|
||||||
{
|
|
||||||
thread_t *thread = thread_list;
|
|
||||||
while (thread != NULL)
|
|
||||||
{
|
|
||||||
WaitForSingleObject(thread->thread, INFINITE);
|
|
||||||
CloseHandle(thread->thread);
|
|
||||||
thread = thread->next;
|
|
||||||
}
|
|
||||||
DeleteCriticalSection(&thread_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_lock_mutex(I_mutex *anchor)
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&thread_lock);
|
|
||||||
if (*anchor == NULL)
|
|
||||||
{
|
|
||||||
*anchor = malloc(sizeof(CRITICAL_SECTION));
|
|
||||||
InitializeCriticalSection(*anchor);
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
EnterCriticalSection(*anchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_unlock_mutex(I_mutex id)
|
|
||||||
{
|
|
||||||
LeaveCriticalSection(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
|
||||||
{
|
|
||||||
I_Assert(mutex_id != NULL);
|
|
||||||
EnterCriticalSection(&thread_lock);
|
|
||||||
if (*cond_anchor == NULL)
|
|
||||||
{
|
|
||||||
*cond_anchor = malloc(sizeof(CONDITION_VARIABLE));
|
|
||||||
InitializeConditionVariable(*cond_anchor);
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
SleepConditionVariableCS(*cond_anchor, mutex_id, INFINITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_wake_one_cond(I_cond *anchor)
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&thread_lock);
|
|
||||||
if (*anchor == NULL)
|
|
||||||
{
|
|
||||||
*anchor = malloc(sizeof(CONDITION_VARIABLE));
|
|
||||||
InitializeConditionVariable(*anchor);
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
WakeConditionVariable(*anchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_wake_all_cond(I_cond *anchor)
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&thread_lock);
|
|
||||||
if (*anchor == NULL)
|
|
||||||
{
|
|
||||||
*anchor = malloc(sizeof(CONDITION_VARIABLE));
|
|
||||||
InitializeConditionVariable(*anchor);
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&thread_lock);
|
|
||||||
WakeAllConditionVariable(*anchor);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
|
||||||
{
|
|
||||||
(void)name;
|
|
||||||
entry(userdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
int I_thread_is_stopped(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_start_threads(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_stop_threads(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_lock_mutex(I_mutex *anchor)
|
|
||||||
{
|
|
||||||
(void)anchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_unlock_mutex(I_mutex id)
|
|
||||||
{
|
|
||||||
(void)id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
|
||||||
{
|
|
||||||
(void)cond_anchor;
|
|
||||||
(void)mutex_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_wake_one_cond(I_cond *anchor)
|
|
||||||
{
|
|
||||||
(void)anchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_wake_all_cond(I_cond *anchor)
|
|
||||||
{
|
|
||||||
(void)anchor;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
||||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief SRB2 graphics stuff for dedicated
|
|
||||||
|
|
||||||
#include "../doomdef.h"
|
|
||||||
#include "../i_system.h"
|
|
||||||
#include "../i_video.h"
|
|
||||||
#include "../console.h"
|
|
||||||
#include "../command.h"
|
|
||||||
#include "../i_system.h"
|
|
||||||
#include "../screen.h"
|
|
||||||
|
|
||||||
rendermode_t rendermode = render_none;
|
|
||||||
|
|
||||||
boolean highcolor = false;
|
|
||||||
|
|
||||||
// synchronize page flipping with screen refresh
|
|
||||||
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
static CV_PossibleValue_t keyboardlayout_cons_t[] = {{1,"Default US"}, {2, "Native"}, {3, "AZERTY"}, {0, NULL}};
|
|
||||||
consvar_t cv_keyboardlayout = {"keyboardlayout", "Default US", CV_SAVE, keyboardlayout_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
consvar_t cv_alwaysgrabmouse = {"alwaysgrabmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
INT32 numcontrollers = 0;
|
|
||||||
|
|
||||||
UINT8 graphics_started = 0; // Is used in console.c and screen.c
|
|
||||||
|
|
||||||
// To disable fullscreen at startup; is set in VID_PrepareModeList
|
|
||||||
boolean allow_fullscreen = false;
|
|
||||||
UINT16 realwidth = BASEVIDWIDTH;
|
|
||||||
UINT16 realheight = BASEVIDHEIGHT;
|
|
||||||
|
|
||||||
extern boolean consolevent;
|
|
||||||
|
|
||||||
void I_GetConsoleEvents(void);
|
|
||||||
|
|
||||||
void I_GetEvent(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_StartupMouse(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// I_OsPolling
|
|
||||||
//
|
|
||||||
void I_OsPolling(void)
|
|
||||||
{
|
|
||||||
if (consolevent)
|
|
||||||
I_GetConsoleEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// I_UpdateNoBlit
|
|
||||||
//
|
|
||||||
void I_UpdateNoBlit(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// I_FinishUpdate
|
|
||||||
//
|
|
||||||
void I_FinishUpdate(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// I_UpdateNoVsync
|
|
||||||
//
|
|
||||||
void I_UpdateNoVsync(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// I_ReadScreen
|
|
||||||
//
|
|
||||||
void I_ReadScreen(UINT8 *scr)
|
|
||||||
{
|
|
||||||
(void)scr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// I_SetPalette
|
|
||||||
//
|
|
||||||
void I_SetPalette(RGBA_t *palette)
|
|
||||||
{
|
|
||||||
(void)palette;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return number of fullscreen + X11 modes
|
|
||||||
INT32 VID_NumModes(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *VID_GetModeName(INT32 modenum)
|
|
||||||
{
|
|
||||||
(void)modenum;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
|
||||||
{
|
|
||||||
(void)w;
|
|
||||||
(void)h;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VID_PrepareModeList(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
INT32 VID_SetMode(INT32 modeNum)
|
|
||||||
{
|
|
||||||
(void)modeNum;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_StartupGraphics(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_ShutdownGraphics(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT32 I_GetRefreshRate(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean I_UseNativeKeyboard(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -58,9 +58,6 @@
|
|||||||
// warning C4152: nonstandard extension, function/data pointer conversion in expression
|
// warning C4152: nonstandard extension, function/data pointer conversion in expression
|
||||||
// warning C4213: nonstandard extension used : cast on l-value
|
// warning C4213: nonstandard extension used : cast on l-value
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
@@ -527,15 +524,12 @@ UINT32 quickncasehash (const char *p, size_t n)
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#ifndef min // Double-Check with WATTCP-32's cdefs.h
|
#ifndef min // Double-Check with WATTCP-32's cdefs.h
|
||||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||||
#endif
|
#endif
|
||||||
#ifndef max // Double-Check with WATTCP-32's cdefs.h
|
#ifndef max // Double-Check with WATTCP-32's cdefs.h
|
||||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CLAMP
|
#ifndef CLAMP
|
||||||
#define CLAMP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
|
#define CLAMP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
|
||||||
#endif
|
#endif
|
||||||
@@ -566,14 +560,6 @@ UINT32 quickncasehash (const char *p, size_t n)
|
|||||||
#define UNLIKELY(x) (x)
|
#define UNLIKELY(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
|
|
||||||
#define restrict __restrict
|
|
||||||
#else
|
|
||||||
#define restrict
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// An assert-type mechanism.
|
// An assert-type mechanism.
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
#define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
|
#define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
|
||||||
@@ -671,8 +657,4 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||||||
#undef UPDATE_ALERT
|
#undef UPDATE_ALERT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __DOOMDEF__
|
#endif // __DOOMDEF__
|
||||||
+1
-1
@@ -125,7 +125,7 @@ extern boolean lastdraw;
|
|||||||
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
extern INT32 viewwindowx, viewwindowy;
|
extern INT32 viewwindowx, viewwindowy;
|
||||||
extern INT32 viewwidth;
|
extern INT32 viewwidth, scaledviewwidth;
|
||||||
|
|
||||||
extern boolean gamedataloaded;
|
extern boolean gamedataloaded;
|
||||||
|
|
||||||
|
|||||||
+16
-23
@@ -17,10 +17,6 @@
|
|||||||
#ifndef __DOOMTYPE__
|
#ifndef __DOOMTYPE__
|
||||||
#define __DOOMTYPE__
|
#define __DOOMTYPE__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
//#define WIN32_LEAN_AND_MEAN
|
//#define WIN32_LEAN_AND_MEAN
|
||||||
#define RPC_NO_WINDOWS_H
|
#define RPC_NO_WINDOWS_H
|
||||||
@@ -104,10 +100,8 @@ typedef long ssize_t;
|
|||||||
#define strnicmp(x,y,n) strncasecmp(x,y,n)
|
#define strnicmp(x,y,n) strncasecmp(x,y,n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
char *strcasestr(const char *in, const char *what);
|
char *strcasestr(const char *in, const char *what);
|
||||||
#define stristr strcasestr
|
#define stristr strcasestr
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (macintosh) //|| defined (__APPLE__) //skip all boolean/Boolean crap
|
#if defined (macintosh) //|| defined (__APPLE__) //skip all boolean/Boolean crap
|
||||||
#define true 1
|
#define true 1
|
||||||
@@ -162,19 +156,22 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
|||||||
|
|
||||||
/* Boolean type definition */
|
/* Boolean type definition */
|
||||||
|
|
||||||
#ifndef _WIN32
|
// \note __BYTEBOOL__ used to be set above if "macintosh" was defined,
|
||||||
#include <stdbool.h>
|
// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now?
|
||||||
// dont use stdbools _BOOL type
|
#ifndef __BYTEBOOL__
|
||||||
// its smaller (1 byte) than the old interger bool (4 bytes)
|
#define __BYTEBOOL__
|
||||||
// which results in packed struct sizes being mismatched between vanilla and this
|
|
||||||
// however we gotta still include stdbool cause since c23 true and false are keywords
|
//faB: clean that up !!
|
||||||
// which we cant use as enumeration constants
|
#if defined( _MSC_VER) && (_MSC_VER >= 1800) // MSVC 2013 and forward
|
||||||
typedef int32_t boolean;
|
#include "stdbool.h"
|
||||||
#else
|
#elif defined (_WIN32)
|
||||||
#define false FALSE
|
#define false FALSE // use windows types
|
||||||
#define true TRUE
|
#define true TRUE
|
||||||
#define boolean BOOL
|
#define boolean BOOL
|
||||||
#endif
|
#else
|
||||||
|
typedef enum {false, true} boolean;
|
||||||
|
#endif
|
||||||
|
#endif // __BYTEBOOL__
|
||||||
|
|
||||||
/* 7.18.2.1 Limits of exact-width integer types */
|
/* 7.18.2.1 Limits of exact-width integer types */
|
||||||
#ifndef INT8_MIN
|
#ifndef INT8_MIN
|
||||||
@@ -388,8 +385,4 @@ unset_bit_array (bitarray_t * const array, const int value)
|
|||||||
|
|
||||||
typedef UINT64 precise_t;
|
typedef UINT64 precise_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //__DOOMTYPE__
|
#endif //__DOOMTYPE__
|
||||||
+2
-3
@@ -531,8 +531,8 @@ static const char *credits[] = {
|
|||||||
"\"Xyzzy\"",
|
"\"Xyzzy\"",
|
||||||
"\"Chearii\"",
|
"\"Chearii\"",
|
||||||
" ",
|
" ",
|
||||||
"\"Sunflower\"",
|
"\"Sunflower\" aka \"AnimeSonic\"",
|
||||||
"\"Yuz\"",
|
"\"Yuz\" aka \"Yuzler\"",
|
||||||
"\"Democrab\"",
|
"\"Democrab\"",
|
||||||
"\"EXpand\"",
|
"\"EXpand\"",
|
||||||
"\"Nexit\"",
|
"\"Nexit\"",
|
||||||
@@ -543,7 +543,6 @@ static const char *credits[] = {
|
|||||||
"\"Achii\"",
|
"\"Achii\"",
|
||||||
"\"Anonimus\"",
|
"\"Anonimus\"",
|
||||||
"\"scizor300\"",
|
"\"scizor300\"",
|
||||||
"\"Lugent\"",
|
|
||||||
"",
|
"",
|
||||||
"\1Special Thanks",
|
"\1Special Thanks",
|
||||||
"SEGA",
|
"SEGA",
|
||||||
|
|||||||
+3
-3
@@ -313,7 +313,7 @@ void F_WipeStartScreen(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wipe_scr_start = vid.screens[3];
|
wipe_scr_start = screens[3];
|
||||||
I_ReadScreen(wipe_scr_start);
|
I_ReadScreen(wipe_scr_start);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ void F_WipeEndScreen(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wipe_scr_end = vid.screens[4];
|
wipe_scr_end = screens[4];
|
||||||
I_ReadScreen(wipe_scr_end);
|
I_ReadScreen(wipe_scr_end);
|
||||||
V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start);
|
V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start);
|
||||||
#endif
|
#endif
|
||||||
@@ -353,7 +353,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||||||
|
|
||||||
// Init the wipe
|
// Init the wipe
|
||||||
WipeInAction = true;
|
WipeInAction = true;
|
||||||
wipe_scr = vid.screens[0];
|
wipe_scr = screens[0];
|
||||||
|
|
||||||
// lastwipetic should either be 0 or the tic we last wiped
|
// lastwipetic should either be 0 or the tic we last wiped
|
||||||
// on for fade-to-black
|
// on for fade-to-black
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
#ifndef __FILESRCH_H__
|
#ifndef __FILESRCH_H__
|
||||||
#define __FILESRCH_H__
|
#define __FILESRCH_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "d_netfil.h"
|
#include "d_netfil.h"
|
||||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||||
@@ -100,8 +96,4 @@ void closefilemenu(boolean validsize);
|
|||||||
void searchfilemenu(char *tempname);
|
void searchfilemenu(char *tempname);
|
||||||
boolean preparefilemenu(boolean samedepth, boolean replayhut);
|
boolean preparefilemenu(boolean samedepth, boolean replayhut);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __FILESRCH_H__
|
#endif // __FILESRCH_H__
|
||||||
+31
-37
@@ -385,8 +385,7 @@ consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, N
|
|||||||
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// Display song credits
|
// Display song credits
|
||||||
static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}};
|
consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
// Show "FREE PLAY" when you're alone. :(
|
// Show "FREE PLAY" when you're alone. :(
|
||||||
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
@@ -5465,36 +5464,33 @@ void G_GhostTicker(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type != -1)
|
if (type == MT_GHOST)
|
||||||
{
|
{
|
||||||
if (type == MT_GHOST)
|
mobj = P_SpawnGhostMobj(g->mo); // does a large portion of the work for us
|
||||||
{
|
mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|tr_trans60<<FF_TRANSSHIFT; // P_SpawnGhostMobj sets trans50, we want trans60
|
||||||
mobj = P_SpawnGhostMobj(g->mo); // does a large portion of the work for us
|
|
||||||
mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|tr_trans60<<FF_TRANSSHIFT; // P_SpawnGhostMobj sets trans50, we want trans60
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mobj = P_SpawnMobj(g->mo->x, g->mo->y, g->mo->z - FixedDiv(FixedMul(g->mo->info->height, g->mo->scale) - g->mo->height,3*FRACUNIT), MT_THOK);
|
|
||||||
mobj->sprite = states[mobjinfo[type].spawnstate].sprite;
|
|
||||||
mobj->frame = (states[mobjinfo[type].spawnstate].frame & FF_FRAMEMASK) | tr_trans60<<FF_TRANSSHIFT;
|
|
||||||
mobj->tics = -1; // nope.
|
|
||||||
mobj->color = g->mo->color;
|
|
||||||
if (g->mo->eflags & MFE_VERTICALFLIP)
|
|
||||||
{
|
|
||||||
mobj->flags2 |= MF2_OBJECTFLIP;
|
|
||||||
mobj->eflags |= MFE_VERTICALFLIP;
|
|
||||||
}
|
|
||||||
P_SetScale(mobj, g->mo->scale);
|
|
||||||
mobj->destscale = g->mo->scale;
|
|
||||||
}
|
|
||||||
mobj->floorz = mobj->z;
|
|
||||||
mobj->ceilingz = mobj->z+mobj->height;
|
|
||||||
P_UnsetThingPosition(mobj);
|
|
||||||
mobj->flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY; // make an ATTEMPT to curb crazy SOCs fucking stuff up...
|
|
||||||
P_SetThingPosition(mobj);
|
|
||||||
mobj->fuse = 8;
|
|
||||||
P_SetTarget(&mobj->target, g->mo);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mobj = P_SpawnMobj(g->mo->x, g->mo->y, g->mo->z - FixedDiv(FixedMul(g->mo->info->height, g->mo->scale) - g->mo->height,3*FRACUNIT), MT_THOK);
|
||||||
|
mobj->sprite = states[mobjinfo[type].spawnstate].sprite;
|
||||||
|
mobj->frame = (states[mobjinfo[type].spawnstate].frame & FF_FRAMEMASK) | tr_trans60<<FF_TRANSSHIFT;
|
||||||
|
mobj->tics = -1; // nope.
|
||||||
|
mobj->color = g->mo->color;
|
||||||
|
if (g->mo->eflags & MFE_VERTICALFLIP)
|
||||||
|
{
|
||||||
|
mobj->flags2 |= MF2_OBJECTFLIP;
|
||||||
|
mobj->eflags |= MFE_VERTICALFLIP;
|
||||||
|
}
|
||||||
|
P_SetScale(mobj, g->mo->scale);
|
||||||
|
mobj->destscale = g->mo->scale;
|
||||||
|
}
|
||||||
|
mobj->floorz = mobj->z;
|
||||||
|
mobj->ceilingz = mobj->z+mobj->height;
|
||||||
|
P_UnsetThingPosition(mobj);
|
||||||
|
mobj->flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY; // make an ATTEMPT to curb crazy SOCs fucking stuff up...
|
||||||
|
P_SetThingPosition(mobj);
|
||||||
|
mobj->fuse = 8;
|
||||||
|
P_SetTarget(&mobj->target, g->mo);
|
||||||
}
|
}
|
||||||
if (ziptic & EZT_HIT)
|
if (ziptic & EZT_HIT)
|
||||||
{ // Spawn hit poofs for killing things!
|
{ // Spawn hit poofs for killing things!
|
||||||
@@ -8124,6 +8120,9 @@ void G_SaveDemo(void)
|
|||||||
|
|
||||||
UINT8 *p = demobuf.buffer+16; // after version
|
UINT8 *p = demobuf.buffer+16; // after version
|
||||||
UINT32 length;
|
UINT32 length;
|
||||||
|
#ifdef NOMD5
|
||||||
|
UINT8 i;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Ensure extrainfo pointer is always available, even if no info is present.
|
// Ensure extrainfo pointer is always available, even if no info is present.
|
||||||
if (demoinfo_p && *(UINT32 *)demoinfo_p == 0)
|
if (demoinfo_p && *(UINT32 *)demoinfo_p == 0)
|
||||||
@@ -8144,7 +8143,7 @@ void G_SaveDemo(void)
|
|||||||
size_t i, strindex = 0;
|
size_t i, strindex = 0;
|
||||||
boolean dash = true;
|
boolean dash = true;
|
||||||
|
|
||||||
for (i = 0; demo.titlename[i] && i < 127; i++)
|
for (i = 0; i < 127 && demo.titlename[i]; i++)
|
||||||
{
|
{
|
||||||
if ((demo.titlename[i] >= 'a' && demo.titlename[i] <= 'z') ||
|
if ((demo.titlename[i] >= 'a' && demo.titlename[i] <= 'z') ||
|
||||||
(demo.titlename[i] >= '0' && demo.titlename[i] <= '9'))
|
(demo.titlename[i] >= '0' && demo.titlename[i] <= '9'))
|
||||||
@@ -8178,7 +8177,7 @@ void G_SaveDemo(void)
|
|||||||
length = *(UINT32 *)demoinfo_p;
|
length = *(UINT32 *)demoinfo_p;
|
||||||
WRITEUINT32(demoinfo_p, length);
|
WRITEUINT32(demoinfo_p, length);
|
||||||
#ifdef NOMD5
|
#ifdef NOMD5
|
||||||
for (UINT8 k = 0; k < 16; k++, p++)
|
for (i = 0; i < 16; i++, p++)
|
||||||
*p = M_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
*p = M_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
||||||
#else
|
#else
|
||||||
// Make a checksum of everything after the checksum in the file up to the end of the standard data. Extrainfo is freely modifiable.
|
// Make a checksum of everything after the checksum in the file up to the end of the standard data. Extrainfo is freely modifiable.
|
||||||
@@ -8235,11 +8234,6 @@ boolean G_DemoTitleResponder(event_t *ev)
|
|||||||
void G_SetGamestate(gamestate_t newstate)
|
void G_SetGamestate(gamestate_t newstate)
|
||||||
{
|
{
|
||||||
gamestate = newstate;
|
gamestate = newstate;
|
||||||
|
|
||||||
//HACK: reset musiccredits whenever we change gamestate
|
|
||||||
// since we allow them to run everywhere now
|
|
||||||
S_ResetMusicCredit();
|
|
||||||
|
|
||||||
#ifdef HAVE_DISCORDRPC
|
#ifdef HAVE_DISCORDRPC
|
||||||
DRPC_UpdatePresence();
|
DRPC_UpdatePresence();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,10 +14,6 @@
|
|||||||
#ifndef __G_GAME__
|
#ifndef __G_GAME__
|
||||||
#define __G_GAME__
|
#define __G_GAME__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
@@ -488,8 +484,4 @@ void G_AddMapToBuffer(INT16 map);
|
|||||||
|
|
||||||
void G_FixCamera(UINT8 view);
|
void G_FixCamera(UINT8 view);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+1
-1
@@ -1030,7 +1030,7 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
|||||||
if (!keystr[0])
|
if (!keystr[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
|
if (!keystr[0] || (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z'))
|
||||||
return keystr[0];
|
return keystr[0];
|
||||||
|
|
||||||
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
hw_bsp.c
|
|
||||||
hw_draw.c
|
|
||||||
hw_main.c
|
|
||||||
hw_clip.c
|
|
||||||
hw_md2.c
|
|
||||||
hw_cache.c
|
|
||||||
hw_md2load.c
|
|
||||||
hw_md3load.c
|
|
||||||
hw_model.c
|
|
||||||
hw_portal.c
|
|
||||||
hw_batching.c
|
|
||||||
hw_shaders.c
|
|
||||||
u_list.c
|
|
||||||
r_opengl/r_opengl.c
|
|
||||||
+31
-12
@@ -89,23 +89,32 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
|||||||
{
|
{
|
||||||
if (!pSurf)
|
if (!pSurf)
|
||||||
{
|
{
|
||||||
I_Error("Got a null FSurfaceInfo in batching"); // nulls should not come in the stuff that batching currently applies to
|
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polygonArraySize == polygonArrayAllocSize)
|
if (polygonArraySize == polygonArrayAllocSize)
|
||||||
{
|
{
|
||||||
// ran out of space, double the array size
|
PolygonArrayEntry* new_array;
|
||||||
|
// ran out of space, make new array double the size
|
||||||
polygonArrayAllocSize *= 2;
|
polygonArrayAllocSize *= 2;
|
||||||
polygonArray = realloc(polygonArray, polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
new_array = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||||
|
memcpy(new_array, polygonArray, polygonArraySize * sizeof(PolygonArrayEntry));
|
||||||
|
free(polygonArray);
|
||||||
|
polygonArray = new_array;
|
||||||
// also need to redo the index array, dont need to copy it though
|
// also need to redo the index array, dont need to copy it though
|
||||||
polygonArraySorted = realloc(polygonArraySorted, polygonArrayAllocSize * sizeof(PolygonArrayEntry*));
|
free(polygonArraySorted);
|
||||||
|
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
|
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
|
||||||
{
|
{
|
||||||
|
FOutVector* new_array;
|
||||||
// need more space for vertices in unsortedVertexArray
|
// need more space for vertices in unsortedVertexArray
|
||||||
unsortedVertexArrayAllocSize *= 2;
|
unsortedVertexArrayAllocSize *= 2;
|
||||||
unsortedVertexArray = realloc(unsortedVertexArray, unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
new_array = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||||
|
memcpy(new_array, unsortedVertexArray, unsortedVertexArraySize * sizeof(FOutVector));
|
||||||
|
free(unsortedVertexArray);
|
||||||
|
unsortedVertexArray = new_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the polygon data to the arrays
|
// add the polygon data to the arrays
|
||||||
@@ -131,8 +140,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
|||||||
|
|
||||||
static int comparePolygons(const void *p1, const void *p2)
|
static int comparePolygons(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
|
PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
|
||||||
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
|
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
|
||||||
int diff;
|
int diff;
|
||||||
INT64 diff64;
|
INT64 diff64;
|
||||||
|
|
||||||
@@ -168,7 +177,9 @@ static int comparePolygons(const void *p1, const void *p2)
|
|||||||
diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end;
|
diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end;
|
||||||
if (diff != 0) return diff;
|
if (diff != 0) return diff;
|
||||||
|
|
||||||
return poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional;
|
diff = poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional;
|
||||||
|
|
||||||
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||||
@@ -317,11 +328,19 @@ void HWR_RenderBatches(void)
|
|||||||
// probably never will this loop run more than once though
|
// probably never will this loop run more than once though
|
||||||
while (finalVertexWritePos + numVerts > finalVertexArrayAllocSize)
|
while (finalVertexWritePos + numVerts > finalVertexArrayAllocSize)
|
||||||
{
|
{
|
||||||
|
FOutVector* new_array;
|
||||||
|
unsigned int* new_index_array;
|
||||||
finalVertexArrayAllocSize *= 2;
|
finalVertexArrayAllocSize *= 2;
|
||||||
finalVertexArray = realloc(finalVertexArray, finalVertexArrayAllocSize * sizeof(FOutVector));
|
new_array = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||||
|
memcpy(new_array, finalVertexArray, finalVertexWritePos * sizeof(FOutVector));
|
||||||
|
free(finalVertexArray);
|
||||||
|
finalVertexArray = new_array;
|
||||||
// also increase size of index array, 3x of vertex array since
|
// also increase size of index array, 3x of vertex array since
|
||||||
// going from fans to triangles increases vertex count to 3x
|
// going from fans to triangles increases vertex count to 3x
|
||||||
finalVertexIndexArray = realloc(finalVertexIndexArray, finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
new_index_array = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
||||||
|
memcpy(new_index_array, finalVertexIndexArray, finalIndexWritePos * sizeof(UINT32));
|
||||||
|
free(finalVertexIndexArray);
|
||||||
|
finalVertexIndexArray = new_index_array;
|
||||||
}
|
}
|
||||||
// write the vertices of the polygon
|
// write the vertices of the polygon
|
||||||
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex],
|
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex],
|
||||||
@@ -377,8 +396,8 @@ void HWR_RenderBatches(void)
|
|||||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
|
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
|
||||||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
|
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
|
||||||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
|
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
|
||||||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
|
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
|
||||||
currentSurfaceInfo.LightInfo.directional != nextSurfaceInfo.LightInfo.directional)
|
currentSurfaceInfo.LightInfo.directional != nextSurfaceInfo.LightInfo.directional)
|
||||||
{
|
{
|
||||||
changeState = true;
|
changeState = true;
|
||||||
|
|||||||
+25
-34
@@ -96,12 +96,12 @@ void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|||||||
pdupx = pdupy = 2.0f;
|
pdupx = pdupy = 2.0f;
|
||||||
break;
|
break;
|
||||||
case V_SMALLSCALEPATCH:
|
case V_SMALLSCALEPATCH:
|
||||||
pdupx = 2.0f * FIXED_TO_FLOAT(vid.smalldupx*FRACUNIT);
|
pdupx = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupx);
|
||||||
pdupy = 2.0f * FIXED_TO_FLOAT(vid.smalldupy*FRACUNIT);
|
pdupy = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupy);
|
||||||
break;
|
break;
|
||||||
case V_MEDSCALEPATCH:
|
case V_MEDSCALEPATCH:
|
||||||
pdupx = 2.0f * FIXED_TO_FLOAT(vid.meddupx*FRACUNIT);
|
pdupx = 2.0f * FIXED_TO_FLOAT(vid.fmeddupx);
|
||||||
pdupy = 2.0f * FIXED_TO_FLOAT(vid.meddupx*FRACUNIT);
|
pdupy = 2.0f * FIXED_TO_FLOAT(vid.fmeddupy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,16 +241,16 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||||||
if (option & V_SNAPTORIGHT)
|
if (option & V_SNAPTORIGHT)
|
||||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||||
else if (!(option & V_SNAPTOLEFT))
|
else if (!(option & V_SNAPTOLEFT))
|
||||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f;
|
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
|
||||||
}
|
}
|
||||||
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
|
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
||||||
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy));
|
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
|
||||||
else if (option & V_SNAPTOBOTTOM)
|
else if (option & V_SNAPTOBOTTOM)
|
||||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||||
else if (!(option & V_SNAPTOTOP))
|
else if (!(option & V_SNAPTOTOP))
|
||||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f;
|
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,13 +305,10 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||||
|
|
||||||
switch (alphalevel)
|
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
|
||||||
{
|
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
|
||||||
case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break;
|
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||||
case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break;
|
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||||
case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break;
|
|
||||||
default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
flags |= PF_Modulated;
|
flags |= PF_Modulated;
|
||||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||||
@@ -395,16 +392,16 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||||||
if (option & V_SNAPTORIGHT)
|
if (option & V_SNAPTORIGHT)
|
||||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||||
else if (!(option & V_SNAPTOLEFT))
|
else if (!(option & V_SNAPTOLEFT))
|
||||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f;
|
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
|
||||||
}
|
}
|
||||||
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
|
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
||||||
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy));
|
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
|
||||||
else if (option & V_SNAPTOBOTTOM)
|
else if (option & V_SNAPTOBOTTOM)
|
||||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||||
else if (!(option & V_SNAPTOTOP))
|
else if (!(option & V_SNAPTOTOP))
|
||||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f;
|
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -470,13 +467,10 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||||
|
|
||||||
switch (alphalevel)
|
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value];
|
||||||
{
|
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value];
|
||||||
case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; break;
|
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||||
case 14: Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; break;
|
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||||
case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; break;
|
|
||||||
default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
flags |= PF_Modulated;
|
flags |= PF_Modulated;
|
||||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||||
@@ -493,7 +487,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Fills a box of pixels using a flat texture as a pattern
|
// Fills a box of pixels using a flat texture as a pattern
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
|
void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
|
||||||
{
|
{
|
||||||
FOutVector v[4];
|
FOutVector v[4];
|
||||||
double dflatsize;
|
double dflatsize;
|
||||||
@@ -846,7 +840,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
|||||||
if (color & V_SNAPTORIGHT)
|
if (color & V_SNAPTORIGHT)
|
||||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||||
else if (!(color & V_SNAPTOLEFT))
|
else if (!(color & V_SNAPTOLEFT))
|
||||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2.0f;
|
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
|
||||||
}
|
}
|
||||||
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
@@ -854,7 +848,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
|||||||
if (color & V_SNAPTOBOTTOM)
|
if (color & V_SNAPTOBOTTOM)
|
||||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||||
else if (!(color & V_SNAPTOTOP))
|
else if (!(color & V_SNAPTOTOP))
|
||||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2.0f;
|
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1128,13 +1122,10 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||||||
|
|
||||||
if (alphalevel)
|
if (alphalevel)
|
||||||
{
|
{
|
||||||
switch (alphalevel)
|
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
|
||||||
{
|
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
|
||||||
case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break;
|
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||||
case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break;
|
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||||
case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break;
|
|
||||||
default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||||
|
|||||||
+30
-15
@@ -548,7 +548,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
float tempxsow, tempytow;
|
float tempxsow, tempytow;
|
||||||
float scrollx = 0.0f, scrolly = 0.0f, anglef = 0.0f;
|
float scrollx = 0.0f, scrolly = 0.0f;
|
||||||
angle_t angle = 0;
|
angle_t angle = 0;
|
||||||
|
|
||||||
static FOutVector *planeVerts = NULL;
|
static FOutVector *planeVerts = NULL;
|
||||||
@@ -668,11 +668,14 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||||||
|
|
||||||
if (angle) // Only needs to be done if there's an altered angle
|
if (angle) // Only needs to be done if there's an altered angle
|
||||||
{
|
{
|
||||||
tempxsow = flatxref;
|
angle = InvAngle(angle)>>ANGLETOFINESHIFT;
|
||||||
tempytow = flatyref;
|
|
||||||
anglef = ANG2RAD(InvAngle(angle));
|
// This needs to be done so everything aligns after rotation
|
||||||
flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
|
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
|
||||||
flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
|
tempxsow = FloatToFixed(flatxref);
|
||||||
|
tempytow = FloatToFixed(flatyref);
|
||||||
|
flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
||||||
|
flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SETUP3DVERT(vert, vx, vy) {\
|
#define SETUP3DVERT(vert, vx, vy) {\
|
||||||
@@ -683,10 +686,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||||||
/* Need to rotate before translate */\
|
/* Need to rotate before translate */\
|
||||||
if (angle) /* Only needs to be done if there's an altered angle */\
|
if (angle) /* Only needs to be done if there's an altered angle */\
|
||||||
{\
|
{\
|
||||||
tempxsow = vert->s;\
|
tempxsow = FloatToFixed(vert->s);\
|
||||||
tempytow = vert->t;\
|
tempytow = FloatToFixed(vert->t);\
|
||||||
vert->s = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));\
|
vert->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));\
|
||||||
vert->t = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));\
|
vert->t = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
vert->x = (vx);\
|
vert->x = (vx);\
|
||||||
@@ -4461,10 +4464,7 @@ static void HWR_DrawModels(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!spr->mobj)
|
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||||
continue;
|
|
||||||
|
|
||||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
|
||||||
{
|
{
|
||||||
md2_t *md2;
|
md2_t *md2;
|
||||||
|
|
||||||
@@ -5564,12 +5564,28 @@ static void HWR_RenderFrame(player_t *player, boolean skybox)
|
|||||||
gl_viewwindowx += gl_viewwidth;
|
gl_viewwindowx += gl_viewwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (splitscreen == 2 && player == &players[displayplayers[2]])
|
||||||
|
{
|
||||||
|
// V_DrawPatchFill, but for the fourth screen only
|
||||||
|
patch_t *gpatch = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||||
|
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||||
|
INT32 x, y, pw = (gpatch->width * dupz), ph = (gpatch->height * dupz);
|
||||||
|
|
||||||
|
for (x = vid.width >> 1; x < vid.width; x += pw)
|
||||||
|
{
|
||||||
|
for (y = vid.height >> 1; y < vid.height; y += ph)
|
||||||
|
HWR_DrawStretchyFixedPatch(gpatch, (x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, FRACUNIT, V_NOSCALESTART, NULL, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check for new console commands.
|
// check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
// Clear view, set viewport (glViewport), set perspective...
|
// Clear view, set viewport (glViewport), set perspective...
|
||||||
HWR_ClearView();
|
HWR_ClearView();
|
||||||
|
|
||||||
|
ST_doPaletteStuff();
|
||||||
|
|
||||||
// Draw the sky background.
|
// Draw the sky background.
|
||||||
HWR_DrawSkyBackground();
|
HWR_DrawSkyBackground();
|
||||||
if (skybox)
|
if (skybox)
|
||||||
@@ -5726,7 +5742,6 @@ void HWR_LoadLevel(boolean reloadinggamestate)
|
|||||||
static void HWR_TogglePaletteRendering(void)
|
static void HWR_TogglePaletteRendering(void)
|
||||||
{
|
{
|
||||||
V_ResetPaletteCVars(); // dont carry over changed palettes
|
V_ResetPaletteCVars(); // dont carry over changed palettes
|
||||||
ST_ResetPaletteStuff();
|
|
||||||
|
|
||||||
// which state should we go to?
|
// which state should we go to?
|
||||||
if (HWR_ShouldUsePaletteRendering())
|
if (HWR_ShouldUsePaletteRendering())
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
|
|
||||||
#define GLENCORE
|
#define GLENCORE
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Startup & Shutdown the hardware mode renderer
|
// Startup & Shutdown the hardware mode renderer
|
||||||
void HWR_Startup(void);
|
void HWR_Startup(void);
|
||||||
void HWR_Shutdown(void);
|
void HWR_Shutdown(void);
|
||||||
@@ -232,8 +228,4 @@ FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
|
|||||||
return (cv_glflashpal.value && HWR_ShouldUsePaletteRendering());
|
return (cv_glflashpal.value && HWR_ShouldUsePaletteRendering());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}// extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -15,10 +15,6 @@
|
|||||||
#ifndef _HW_MD2_H_
|
#ifndef _HW_MD2_H_
|
||||||
#define _HW_MD2_H_
|
#define _HW_MD2_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
#include "hw_model.h"
|
#include "hw_model.h"
|
||||||
|
|
||||||
@@ -50,8 +46,4 @@ void HWR_DrawMD2(gl_vissprite_t *spr);
|
|||||||
void HWR_AddPlayerMD2(INT32 skin, boolean local);
|
void HWR_AddPlayerMD2(INT32 skin, boolean local);
|
||||||
void HWR_AddSpriteMD2(size_t spritenum);
|
void HWR_AddSpriteMD2(size_t spritenum);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _HW_MD2_H_
|
#endif // _HW_MD2_H_
|
||||||
Loaded 100 of 192 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user