Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d1eb398cf | ||
|
|
97df54a760 | ||
|
|
2edada8ce3 | ||
|
|
17e85df813 | ||
|
|
a3b5c4dff8 |
No files matched your search
+7
-8
@@ -13,17 +13,16 @@ Win32_LIB_ASM_Release
|
||||
*.dgb
|
||||
*.debug
|
||||
*.debug.txt
|
||||
/bin/VC10/
|
||||
/objs/VC10/
|
||||
*.user
|
||||
*.db
|
||||
*.opendb
|
||||
/.vs
|
||||
/debian
|
||||
/assets/debian
|
||||
/make
|
||||
/bin
|
||||
/build
|
||||
/build/*
|
||||
/CMakeUserPresets.json
|
||||
/out
|
||||
/objs/VC10
|
||||
*.kate-swp
|
||||
compile.sh
|
||||
*.gz
|
||||
.vscode/
|
||||
out
|
||||
build
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
|
||||
# Version change is fine.
|
||||
project(SRB2
|
||||
|
||||
@@ -156,11 +156,6 @@ Add Gamepad Rumble support for things.
|
||||
To be used with Displayplayers.
|
||||
Duration is in milliseconds and is optional to set, default value is 84ms.
|
||||
|
||||
## P_CheckSightFast(mo1, mo2)
|
||||
|
||||
Exactly same as P_CheckSight but uses cheaper algorithm, useful for things like nametags. Doesn't work exactly
|
||||
like P_CheckSight so don't use it for anything gameplay-related.
|
||||
|
||||
# Other changes
|
||||
|
||||
## P_PlayRinglossSound(source, damager)
|
||||
|
||||
@@ -1726,6 +1726,11 @@ HW3SOUND for 3D hardware sound support
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/r_draw.h" />
|
||||
<Unit filename="src/r_draw16.c">
|
||||
<Option compilerVar="CC" />
|
||||
<Option compile="0" />
|
||||
<Option link="0" />
|
||||
</Unit>
|
||||
<Unit filename="src/r_draw8.c">
|
||||
<Option compilerVar="CC" />
|
||||
<Option compile="0" />
|
||||
|
||||
@@ -773,6 +773,16 @@ Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit79]
|
||||
FileName=src\r_draw16.c
|
||||
Folder=R_Rend
|
||||
Compile=0
|
||||
CompileCpp=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit80]
|
||||
FileName=src\r_draw8.c
|
||||
Folder=R_Rend
|
||||
|
||||
@@ -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
|
||||
+32
-32
@@ -1,32 +1,32 @@
|
||||
@echo off
|
||||
set BRA=Unknown
|
||||
set REV=illegal
|
||||
|
||||
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
||||
move tmp.$$$ %1\comptime.c > nul
|
||||
|
||||
if exist .git goto gitrev
|
||||
if exist ..\.git goto gitrev
|
||||
if exist .svn goto svnrev
|
||||
goto filwri
|
||||
|
||||
:gitrev
|
||||
set GIT=%2
|
||||
if "%GIT%"=="" set GIT=git
|
||||
for /f "usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s
|
||||
for /f "usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s
|
||||
set REV=%REV:~0,8%
|
||||
goto filwri
|
||||
|
||||
:svnrev
|
||||
set BRA=Subversion
|
||||
for /f "usebackq" %%s in (`svnversion .`) do @set REV=%%s
|
||||
set REV=r%REV%
|
||||
goto filwri
|
||||
|
||||
:filwri
|
||||
echo // Do not edit! This file was autogenerated > %1\comptime.h
|
||||
echo // by the %0 batch file >> %1\comptime.h
|
||||
echo // >> %1\comptime.h
|
||||
echo const char* compbranch = "%BRA%"; >> %1\comptime.h
|
||||
echo const char* comprevision = "%REV%"; >> %1\comptime.h
|
||||
@echo off
|
||||
set BRA=Unknown
|
||||
set REV=illegal
|
||||
|
||||
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
||||
move tmp.$$$ %1\comptime.c > nul
|
||||
|
||||
if exist .git goto gitrev
|
||||
if exist ..\.git goto gitrev
|
||||
if exist .svn goto svnrev
|
||||
goto filwri
|
||||
|
||||
:gitrev
|
||||
set GIT=%2
|
||||
if "%GIT%"=="" set GIT=git
|
||||
for /f "usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s
|
||||
for /f "usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s
|
||||
set REV=%REV:~0,8%
|
||||
goto filwri
|
||||
|
||||
:svnrev
|
||||
set BRA=Subversion
|
||||
for /f "usebackq" %%s in (`svnversion .`) do @set REV=%%s
|
||||
set REV=r%REV%
|
||||
goto filwri
|
||||
|
||||
:filwri
|
||||
echo // Do not edit! This file was autogenerated > %1\comptime.h
|
||||
echo // by the %0 batch file >> %1\comptime.h
|
||||
echo // >> %1\comptime.h
|
||||
echo const char* compbranch = "%BRA%"; >> %1\comptime.h
|
||||
echo const char* comprevision = "%REV%"; >> %1\comptime.h
|
||||
+1
-1
@@ -17,7 +17,7 @@ EOF
|
||||
|
||||
versiongit() {
|
||||
gitbranch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
gitversion="$(git show --pretty=format:'%h %s' -s HEAD | sed 's/"/\\"/g')"
|
||||
gitversion="$(git rev-parse HEAD | cut -c -8)"
|
||||
version "$gitbranch" "$gitversion";
|
||||
exit 0
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* backtrace.h -- Public header file for stack backtrace library.
|
||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2020 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -54,14 +54,13 @@ struct backtrace_state;
|
||||
invalid after this function returns.
|
||||
|
||||
As a special case, the ERRNUM argument will be passed as -1 if no
|
||||
debug info can be found for the executable, or if the debug info
|
||||
exists but has an unsupported version, but the function requires
|
||||
debug info (e.g., backtrace_full, backtrace_pcinfo). The MSG in
|
||||
this case will be something along the lines of "no debug info".
|
||||
Similarly, ERRNUM will be passed as -1 if there is no symbol table,
|
||||
but the function requires a symbol table (e.g., backtrace_syminfo).
|
||||
This may be used as a signal that some other approach should be
|
||||
tried. */
|
||||
debug info can be found for the executable, but the function
|
||||
requires debug info (e.g., backtrace_full, backtrace_pcinfo). The
|
||||
MSG in this case will be something along the lines of "no debug
|
||||
info". Similarly, ERRNUM will be passed as -1 if there is no
|
||||
symbol table, but the function requires a symbol table (e.g.,
|
||||
backtrace_syminfo). This may be used as a signal that some other
|
||||
approach should be tried. */
|
||||
|
||||
typedef void (*backtrace_error_callback) (void *data, const char *msg,
|
||||
int errnum);
|
||||
|
||||
Binary file not shown.
@@ -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
-2
@@ -1,3 +1,2 @@
|
||||
/cscope.out
|
||||
*.json
|
||||
*.idx
|
||||
/srb2wii
|
||||
+2
-18
@@ -129,7 +129,6 @@ set(SRB2_CORE_RENDER_SOURCES
|
||||
r_fps.c
|
||||
r_main.c
|
||||
r_patch.c
|
||||
r_patchrotation.c
|
||||
r_plane.c
|
||||
r_segs.c
|
||||
r_sky.c
|
||||
@@ -144,8 +143,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
||||
r_fps.h
|
||||
r_local.h
|
||||
r_main.h
|
||||
r_patch.h
|
||||
r_patchrotation.h
|
||||
r_patch
|
||||
r_plane.h
|
||||
r_segs.h
|
||||
r_sky.h
|
||||
@@ -175,7 +173,6 @@ set(SRB2_CORE_GAME_SOURCES
|
||||
p_user.c
|
||||
k_director.c
|
||||
k_kart.c
|
||||
k_stats.c
|
||||
i_time.c
|
||||
|
||||
p_local.h
|
||||
@@ -190,7 +187,6 @@ set(SRB2_CORE_GAME_SOURCES
|
||||
p_tick.h
|
||||
k_director.h
|
||||
k_kart.h
|
||||
k_stats.h
|
||||
)
|
||||
|
||||
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
@@ -228,14 +224,6 @@ set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
||||
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
||||
set(SRB2_CONFIG_USE_FBO_OGL ON CACHE BOOL
|
||||
"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?
|
||||
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
||||
@@ -562,11 +550,7 @@ add_definitions(-DCMAKECONFIG)
|
||||
# ${SRB2_BLUA_HEADERS}
|
||||
#)
|
||||
|
||||
if(${SRB2_CONFIG_DEDICATED})
|
||||
add_subdirectory(dedicated)
|
||||
else()
|
||||
add_subdirectory(sdl)
|
||||
endif()
|
||||
add_subdirectory(sdl)
|
||||
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
||||
message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(")
|
||||
|
||||
+736
-352
File diff suppressed because it is too large.
Load diff
+11
-13
@@ -12,7 +12,6 @@
|
||||
# to avoid a false positive with the version detection...
|
||||
|
||||
SUPPORTED_GCC_VERSIONS:=\
|
||||
151 150 15\
|
||||
142 141 140 14\
|
||||
132 131 130 13\
|
||||
123 122 121 120 12\
|
||||
@@ -79,18 +78,6 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef GCC151
|
||||
GCC150=1
|
||||
endif
|
||||
|
||||
ifdef GCC15
|
||||
GCC150=1
|
||||
endif
|
||||
|
||||
ifdef GCC150
|
||||
GCC142=1
|
||||
endif
|
||||
|
||||
ifdef GCC142
|
||||
GCC141=1
|
||||
endif
|
||||
@@ -482,6 +469,7 @@ ifdef GCC81
|
||||
WFLAGS+=-Wno-error=multistatement-macros
|
||||
endif
|
||||
|
||||
|
||||
#indicate platform and what interface use with
|
||||
ifndef LINUX
|
||||
ifndef FREEBSD
|
||||
@@ -489,6 +477,7 @@ ifndef CYGWIN32
|
||||
ifndef MINGW
|
||||
ifndef MINGW64
|
||||
ifndef SDL
|
||||
ifndef DUMMY
|
||||
$(error No interface or platform flag defined)
|
||||
endif
|
||||
endif
|
||||
@@ -496,6 +485,7 @@ endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#determine the interface directory (where you put all i_*.c)
|
||||
i_net_o=$(OBJDIR)/i_net.o
|
||||
@@ -520,6 +510,11 @@ UPX_OPTS+=-q
|
||||
endif
|
||||
|
||||
#Interface Setup
|
||||
ifdef DUMMY
|
||||
INTERFACE=dummy
|
||||
OBJDIR:=$(OBJDIR)/dummy
|
||||
BIN:=$(BIN)/dummy
|
||||
else
|
||||
ifdef LINUX
|
||||
SDL=1
|
||||
ifdef LINUX64
|
||||
@@ -566,6 +561,7 @@ endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ARCHNAME
|
||||
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
|
||||
@@ -580,6 +576,7 @@ ifdef SDL
|
||||
OBJDIR:=$(OBJDIR)/SDL
|
||||
endif
|
||||
|
||||
ifndef DUMMY
|
||||
ifdef DEBUGMODE
|
||||
OBJDIR:=$(OBJDIR)/Debug
|
||||
BIN:=$(BIN)/Debug
|
||||
@@ -587,3 +584,4 @@ else
|
||||
OBJDIR:=$(OBJDIR)/Release
|
||||
BIN:=$(BIN)/Release
|
||||
endif
|
||||
endif
|
||||
@@ -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
|
||||
+72
-155
@@ -28,15 +28,14 @@
|
||||
#endif
|
||||
|
||||
// For use if I do walls with outsides/insides
|
||||
static const UINT8 REDS = (8*16);
|
||||
static const UINT8 REDS = (2*16);
|
||||
static const UINT8 REDRANGE = 16;
|
||||
static const UINT8 GRAYS = (1*16);
|
||||
static const UINT8 GRAYSRANGE = 16;
|
||||
static const UINT8 BROWNS = (3*16);
|
||||
static const UINT8 YELLOWS = (7*16);
|
||||
static const UINT8 GREENS = (10*16);
|
||||
//static const UINT8 CYANS = (13*16);
|
||||
static const UINT8 BLUES = (14*16);
|
||||
static const UINT8 BROWNS = (15*16);
|
||||
static const UINT8 YELLOWS = (5*16)+8;
|
||||
static const UINT8 GREENS = (6*16);
|
||||
static const UINT8 BLUES = (9*16);
|
||||
static const UINT8 DBLACK = 31;
|
||||
static const UINT8 DWHITE = 0;
|
||||
|
||||
@@ -47,7 +46,7 @@ static const UINT8 DWHITE = 0;
|
||||
#define THOKWALLCOLORS REDS
|
||||
#define THOKWALLRANGE REDRANGE
|
||||
#define TSWALLCOLORS DWHITE
|
||||
#define TSFINISHLINE (GREENS + 2)
|
||||
#define TSFINISHLINE GRAYS
|
||||
#define TSFOFINFO (BLUES + 4)
|
||||
#define FDWALLCOLORS BROWNS
|
||||
#define CDWALLCOLORS YELLOWS
|
||||
@@ -197,7 +196,7 @@ static fixed_t scale_mtof = (fixed_t)INITSCALEMTOF;
|
||||
// used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof)
|
||||
static fixed_t scale_ftom;
|
||||
|
||||
static player_t *plr = NULL; // the player represented by an arrow
|
||||
static player_t *plr; // the player represented by an arrow
|
||||
|
||||
static boolean followplayer = true; // specifies whether to follow the player around
|
||||
|
||||
@@ -237,7 +236,7 @@ static inline void AM_restoreScaleAndLoc(void)
|
||||
m_x = old_m_x;
|
||||
m_y = old_m_y;
|
||||
}
|
||||
else if (plr && plr->mo)
|
||||
else
|
||||
{
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
@@ -265,6 +264,9 @@ static void AM_findMinMaxBoundaries(void)
|
||||
max_w = minimapinfo.map_w << MAPBITS;
|
||||
max_h = minimapinfo.map_h << MAPBITS;
|
||||
|
||||
max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS);
|
||||
max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS);
|
||||
|
||||
a = FixedDiv(f_w<<FRACBITS, max_w);
|
||||
b = FixedDiv(f_h<<FRACBITS, max_h);
|
||||
|
||||
@@ -318,8 +320,7 @@ static void AM_initVariables(void)
|
||||
break;
|
||||
|
||||
plr = &players[pnum];
|
||||
|
||||
if (plr && plr->mo)
|
||||
if (plr != NULL && plr->mo != NULL)
|
||||
{
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
@@ -341,7 +342,7 @@ static void AM_FrameBufferInit(void)
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
am_buf = vid.screens[0];
|
||||
am_buf = screens[0];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -423,7 +424,6 @@ static void AM_setWindowPanning(void)
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.y = 0;
|
||||
|
||||
// left and right
|
||||
if (m_keydown[0]) // pan right
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
@@ -598,9 +598,6 @@ static inline void AM_changeWindowScale(void)
|
||||
|
||||
static inline void AM_doFollowPlayer(void)
|
||||
{
|
||||
if (!plr || !plr->mo)
|
||||
return;
|
||||
|
||||
if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y)
|
||||
{
|
||||
m_x = FTOM(MTOF(plr->mo->x >> FRACTOMAPBITS)) - m_w/2;
|
||||
@@ -902,74 +899,38 @@ static void AM_drawGrid(INT32 color)
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 GetDamage(INT32 special)
|
||||
{
|
||||
switch (special)
|
||||
{
|
||||
case 1: // Damage (Generic)
|
||||
return 1;
|
||||
case 6: // Death Pit (Camera Tilt)
|
||||
return 6;
|
||||
case 7: // Death Pit (No Camera Tilt)
|
||||
return 7;
|
||||
case 8: // Instant Kill
|
||||
return 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 GetOffroad(INT32 special)
|
||||
{
|
||||
switch (special)
|
||||
{
|
||||
case 2: // Offroad (Weak)
|
||||
return 2;
|
||||
case 3: // Offroad
|
||||
return 3;
|
||||
case 4: // Offroad (Strong)
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y, ((normalheight + FRACUNIT/2) >> FRACBITS)) + FRACUNIT/2) >> FRACBITS; \
|
||||
end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y, ((normalheight + FRACUNIT/2) >> FRACBITS)) + FRACUNIT/2) >> FRACBITS;
|
||||
if (slope) { \
|
||||
end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
} else \
|
||||
end1 = end2 = (normalheight + FRACUNIT/2) >> FRACBITS;
|
||||
|
||||
static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondarystore)
|
||||
{
|
||||
ffloor_t *secondaryrover = NULL;
|
||||
|
||||
for (; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t rovt1, rovt2;
|
||||
fixed_t rovb1, rovb2;
|
||||
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
|
||||
SLOPEPARAMS(*rover->t_slope, rovt1, rovt2, *rover->topheight)
|
||||
SLOPEPARAMS(*rover->b_slope, rovb1, rovb2, *rover->bottomheight)
|
||||
|
||||
for (secondaryrover = secondarystore; secondaryrover; secondaryrover = secondaryrover->next)
|
||||
{
|
||||
fixed_t sect1, sect2;
|
||||
fixed_t secb1, secb2;
|
||||
|
||||
if (!(secondaryrover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(secondaryrover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
if (secondaryrover->secnum == rover->secnum)
|
||||
break;
|
||||
|
||||
SLOPEPARAMS(*secondaryrover->t_slope, sect1, sect2, *secondaryrover->topheight)
|
||||
SLOPEPARAMS(*secondaryrover->b_slope, secb1, secb2, *secondaryrover->bottomheight)
|
||||
|
||||
if (rovt1 != sect1)
|
||||
continue;
|
||||
if (rovt2 != sect2)
|
||||
@@ -978,27 +939,8 @@ static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondaryst
|
||||
continue;
|
||||
if (rovb2 != secb2)
|
||||
continue;
|
||||
|
||||
// this is fucking horrible
|
||||
INT32 damage1, damage2;
|
||||
INT32 offroad1, offroad2;
|
||||
INT32 special1, special2;
|
||||
special1 = GETSECSPECIAL(sectors[rover->secnum].special, 1);
|
||||
special2 = GETSECSPECIAL(sectors[secondaryrover->secnum].special, 1);
|
||||
|
||||
damage1 = GetDamage(special1);
|
||||
damage2 = GetDamage(special2);
|
||||
offroad1 = GetOffroad(special1);
|
||||
offroad2 = GetOffroad(special2);
|
||||
|
||||
if (damage1 != damage2
|
||||
//|| sectors[rover->secnum].friction != sectors[secondaryrover->secnum].friction
|
||||
|| offroad1 != offroad2)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (secondaryrover == NULL)
|
||||
break;
|
||||
}
|
||||
@@ -1041,10 +983,8 @@ static void AM_drawWalls(UINT8 pass)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
|
||||
if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||
{
|
||||
@@ -1063,28 +1003,29 @@ static void AM_drawWalls(UINT8 pass)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lines[i].flags & ML_IMPASSIBLE) // (ML_IMPASSABLE|ML_BLOCKPLAYERS)
|
||||
//dont think kart even supports those idk?
|
||||
/*if (lines[i].flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // Completely solid course boundary
|
||||
}
|
||||
else if ((lines[i].flags & ML_EFFECT4) // ML_MIDSOLID
|
||||
else if ((lines[i].flags & ML_MIDSOLID)
|
||||
&& sides[lines->sidenum[0]].midtexture)
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // solid midtexture, likely a course boundary
|
||||
}
|
||||
}*/
|
||||
if ((backf1 != frontf1 && abs(backf1 - frontf1) > maxstep)
|
||||
|| (backf2 != frontf2 && abs(backf2 - frontf2) > maxstep))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // floor-wall, likely a course boundary
|
||||
}
|
||||
else if (GETSECSPECIAL(lines[i].frontsector->special, 4) == 10 || GETSECSPECIAL(lines[i].backsector->special, 4) == 10)
|
||||
/*else if (lines[i].special == 2001) // guh its a sector effect in kart idk how to make it work tbh lol
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSFINISHLINE); // finish line
|
||||
}
|
||||
}*/
|
||||
else if (backf1 != frontf1 || backf2 != frontf2)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
@@ -1106,52 +1047,54 @@ static void AM_drawWalls(UINT8 pass)
|
||||
}
|
||||
else
|
||||
{
|
||||
ffloor_t *rover = NULL;
|
||||
{
|
||||
ffloor_t *rover = NULL;
|
||||
|
||||
if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors)
|
||||
{
|
||||
if (lines[i].backsector->ffloors == NULL)
|
||||
if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors)
|
||||
{
|
||||
// Check frontside for one solid
|
||||
for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next)
|
||||
if (lines[i].backsector->ffloors == NULL)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
// Check frontside for one solid
|
||||
for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (lines[i].frontsector->ffloors == NULL)
|
||||
{
|
||||
// Check backside for one solid
|
||||
for (rover = lines[i].backsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check to see if any secnums exist in one but not the other.
|
||||
rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors);
|
||||
if (rover == NULL)
|
||||
rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors);
|
||||
}
|
||||
}
|
||||
else if (lines[i].frontsector->ffloors == NULL)
|
||||
if (rover != NULL)
|
||||
{
|
||||
// Check backside for one solid
|
||||
for (rover = lines[i].backsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (pass & PASS_FOF)
|
||||
AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet
|
||||
}
|
||||
else
|
||||
else if (!am_minigen)
|
||||
{
|
||||
// Check to see if any secnums exist in one but not the other.
|
||||
rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors);
|
||||
if (rover == NULL)
|
||||
rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors);
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line
|
||||
}
|
||||
}
|
||||
if (rover != NULL)
|
||||
{
|
||||
if (pass & PASS_FOF)
|
||||
AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet
|
||||
}
|
||||
else if (!am_minigen)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1229,11 +1172,18 @@ static inline void AM_drawPlayers(void)
|
||||
player_t *p;
|
||||
INT32 color = GREENS;
|
||||
|
||||
if (!multiplayer)
|
||||
{
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
return;
|
||||
}
|
||||
|
||||
// multiplayer (how??)
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
|
||||
@@ -1255,36 +1205,7 @@ static inline void AM_drawThings(UINT8 colors)
|
||||
t = sectors[i].thinglist;
|
||||
while (t)
|
||||
{
|
||||
if (!t->player)
|
||||
AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<<FRACBITS, t->angle, colors, t->x, t->y);
|
||||
t = t->snext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void AM_drawSpecialThingsOnly(UINT8 colors)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
mobj_t *t = NULL;
|
||||
|
||||
// this is fucking horrible
|
||||
const INT32 special = GETSECSPECIAL(sectors[i].special, 1);
|
||||
|
||||
if (GetDamage(special) != 0
|
||||
//|| sectors[i].friction < ORIG_FRICTION
|
||||
|| GetOffroad(special) != 0)
|
||||
continue;
|
||||
|
||||
t = sectors[i].thinglist;
|
||||
while (t)
|
||||
{
|
||||
if (t->type == MT_RANDOMITEM
|
||||
|| t->type == MT_STARPOST
|
||||
|| (t->flags & MF_SPRING))
|
||||
AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<<FRACBITS, t->angle, colors, t->x, t->y);
|
||||
AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<<FRACBITS, t->angle, colors, t->x, t->y);
|
||||
t = t->snext;
|
||||
}
|
||||
}
|
||||
@@ -1299,19 +1220,16 @@ static inline void AM_drawCrosshair(UINT8 color)
|
||||
const fixed_t scale = 4<<FRACBITS;
|
||||
size_t i;
|
||||
fline_t fl;
|
||||
|
||||
for (i = 0; i < NUMCROSSMARKLINES; i++)
|
||||
{
|
||||
fl.a.x = FixedMul(cross_mark[i].a.x, scale) >> FRACBITS;
|
||||
fl.a.y = FixedMul(cross_mark[i].a.y, scale) >> FRACBITS;
|
||||
fl.b.x = FixedMul(cross_mark[i].b.x, scale) >> FRACBITS;
|
||||
fl.b.y = FixedMul(cross_mark[i].b.y, scale) >> FRACBITS;
|
||||
|
||||
fl.a.x += f_x + (f_w / 2);
|
||||
fl.a.y += f_y + (f_h / 2);
|
||||
fl.b.x += f_x + (f_w / 2);
|
||||
fl.b.y += f_y + (f_h / 2);
|
||||
|
||||
AM_drawFline(&fl, color);
|
||||
}
|
||||
}
|
||||
@@ -1332,8 +1250,8 @@ void AM_Drawer(void)
|
||||
AM_clearFB(BACKGROUND);
|
||||
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||
AM_drawWalls(PASS_FOF|PASS_INTANGIBLE|PASS_SOLID);
|
||||
AM_drawThings(THINGCOLORS);
|
||||
AM_drawPlayers();
|
||||
AM_drawThings(THINGCOLORS);
|
||||
|
||||
if (!followplayer) AM_drawCrosshair(XHAIRCOLORS);
|
||||
}
|
||||
@@ -1389,7 +1307,6 @@ minigen_t *AM_MinimapGenerate(INT32 mul)
|
||||
|
||||
//AM_clearFB(BACKGROUND);
|
||||
memset(am_buf, 0xff, (f_w*f_h));
|
||||
AM_drawSpecialThingsOnly(BACKGROUND);
|
||||
AM_drawWalls(PASS_FOF);
|
||||
AM_drawWalls(PASS_INTANGIBLE);
|
||||
AM_drawWalls(PASS_SOLID);
|
||||
|
||||
@@ -46,6 +46,7 @@ INT32 VID_SetMode(INT32 modenum)
|
||||
vid.modenum = 0;
|
||||
vid.width = 320;
|
||||
vid.height = 240;
|
||||
vid.bpp = 1;
|
||||
vid.buffer = android_surface;
|
||||
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 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_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 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)
|
||||
@@ -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 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_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 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)
|
||||
|
||||
+30
-37
@@ -240,6 +240,7 @@ void COM_ImmedExecute(const char *ptext)
|
||||
|
||||
while (i < strlen(ptext))
|
||||
{
|
||||
|
||||
quotes = 0;
|
||||
for (j = 0; i < strlen(ptext); i++,j++)
|
||||
{
|
||||
@@ -816,17 +817,12 @@ static void COM_Help_f(void)
|
||||
cvar = CV_FindVar(help);
|
||||
if (cvar)
|
||||
{
|
||||
boolean floatmode = false;
|
||||
const char *cvalue = NULL;
|
||||
CONS_Printf("\x82""Variable %s:\n", cvar->name);
|
||||
CONS_Printf(M_GetText(" flags: "));
|
||||
if (cvar->flags & CV_SAVE)
|
||||
CONS_Printf("AUTOSAVE ");
|
||||
if (cvar->flags & CV_FLOAT)
|
||||
{
|
||||
CONS_Printf("FLOAT ");
|
||||
floatmode = true;
|
||||
}
|
||||
if (cvar->flags & CV_NETVAR)
|
||||
CONS_Printf("NETVAR ");
|
||||
if (cvar->flags & CV_CALL)
|
||||
@@ -836,43 +832,30 @@ static void COM_Help_f(void)
|
||||
CONS_Printf("\n");
|
||||
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"))
|
||||
{
|
||||
if (floatmode)
|
||||
{
|
||||
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;
|
||||
}
|
||||
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);
|
||||
while (cvar->PossibleValue[i].strvalue)
|
||||
{
|
||||
if (floatmode)
|
||||
CONS_Printf(" %-2f : %s\n", FIXED_TO_FLOAT(cvar->PossibleValue[i].value),
|
||||
cvar->PossibleValue[i].strvalue);
|
||||
else
|
||||
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
||||
cvar->PossibleValue[i].strvalue);
|
||||
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
|
||||
cvar->PossibleValue[i].strvalue);
|
||||
if (cvar->PossibleValue[i].value == cvar->value)
|
||||
cvalue = cvar->PossibleValue[i].strvalue;
|
||||
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
|
||||
CONS_Printf(" Current value: %d\n", cvar->value);
|
||||
}
|
||||
@@ -1043,10 +1026,7 @@ static void COM_Add_f(void)
|
||||
}
|
||||
|
||||
if (( cvar->flags & CV_FLOAT ))
|
||||
{
|
||||
float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2));
|
||||
CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n)));
|
||||
}
|
||||
CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2))));
|
||||
else
|
||||
CV_AddValue(cvar, atoi(COM_Argv(2)));
|
||||
}
|
||||
@@ -1513,7 +1493,11 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2004,7 +1988,7 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Block the Xbox DInput default axes and reset to the current defaults
|
||||
// Block the Xbox DInput default axes and reset to the current defaults
|
||||
static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr)
|
||||
{
|
||||
if (!stricmp(v->name, "joyaxis_turn") && !stricmp(valstr, "X-Axis"))
|
||||
@@ -2061,6 +2045,15 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
|
||||
|
||||
if (GETMAJOREXECVERSION(cv_execversion.value) < 2) // 2 = 1.0.2
|
||||
{
|
||||
#if 0
|
||||
// We don't have changed saved cvars yet
|
||||
if (!stricmp(v->name, "alwaysmlook")
|
||||
|| !stricmp(v->name, "alwaysmlook2")
|
||||
|| !stricmp(v->name, "mousemove")
|
||||
|| !stricmp(v->name, "mousemove2"))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// axis defaults were changed to be friendly to 360 controllers
|
||||
// if ALL axis settings are defaults, then change them to new values
|
||||
if (!CV_FilterJoyAxisVars(v, valstr))
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
#ifndef __COMMAND_H__
|
||||
#define __COMMAND_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "doomdef.h"
|
||||
|
||||
@@ -193,8 +189,4 @@ UINT8 CV_CheatsEnabled(void);
|
||||
// Returns cvar by name. Exposed here for Lua.
|
||||
consvar_t *CV_FindVar(const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __COMMAND_H__
|
||||
+39
-36
@@ -275,28 +275,29 @@ void CON_SetupBackColormap(void)
|
||||
|
||||
switch (cons_backcolor.value)
|
||||
{
|
||||
case 0: palindex = 15; break; // White
|
||||
case 1: palindex = 31; break; // Gray
|
||||
case 2: palindex = 47; break; // Sepia
|
||||
case 3: palindex = 63; break; // Brown
|
||||
case 4: palindex = 150; shift = 7; break; // Pink
|
||||
case 5: palindex = 127; shift = 7; break; // Raspberry
|
||||
case 6: palindex = 143; break; // Red
|
||||
case 7: palindex = 86; shift = 7; break; // Creamsicle
|
||||
case 8: palindex = 95; break; // Orange
|
||||
case 9: palindex = 119; shift = 7; break; // Gold
|
||||
case 10: palindex = 111; break; // Yellow
|
||||
case 11: palindex = 191; shift = 7; break; // Emerald
|
||||
case 12: palindex = 175; break; // Green
|
||||
case 13: palindex = 219; break; // Cyan
|
||||
case 14: palindex = 207; shift = 7; break; // Steel
|
||||
case 15: palindex = 230; shift = 7; break; // Periwinkle
|
||||
case 16: palindex = 239; break; // Blue
|
||||
case 17: palindex = 199; shift = 7; break; // Purple
|
||||
case 18: palindex = 255; shift = 7; break; // Lavender
|
||||
case 0: palindex = 15; break; // White
|
||||
case 1: palindex = 31; break; // Gray
|
||||
case 2: palindex = 47; break; // Sepia
|
||||
case 3: palindex = 63; break; // Brown
|
||||
case 4: palindex = 150; shift = 7; break; // Pink
|
||||
case 5: palindex = 127; shift = 7; break; // Raspberry
|
||||
case 6: palindex = 143; break; // Red
|
||||
case 7: palindex = 86; shift = 7; break; // Creamsicle
|
||||
case 8: palindex = 95; break; // Orange
|
||||
case 9: palindex = 119; shift = 7; break; // Gold
|
||||
case 10: palindex = 111; break; // Yellow
|
||||
case 11: palindex = 191; shift = 7; break; // Emerald
|
||||
case 12: palindex = 175; break; // Green
|
||||
case 13: palindex = 219; break; // Cyan
|
||||
case 14: palindex = 207; shift = 7; break; // Steel
|
||||
case 15: palindex = 230; shift = 7; break; // Periwinkle
|
||||
case 16: palindex = 239; break; // Blue
|
||||
case 17: palindex = 199; shift = 7; break; // Purple
|
||||
case 18: palindex = 255; shift = 7; break; // Lavender
|
||||
// Default green
|
||||
default: palindex = 175; break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// setup background colormap
|
||||
for (i = 0, j = 0; i < 768; i += 3, j++)
|
||||
@@ -620,11 +621,11 @@ static void CON_MoveConsole(void)
|
||||
con_curlines -= FixedInt(fracmovement);
|
||||
if (con_curlines < con_destlines)
|
||||
con_curlines = con_destlines;
|
||||
|
||||
|
||||
if (con_destlines == 0) // If the console is being closed, not just moved up...
|
||||
con_tick = 0; // ...don't show the blinking cursor
|
||||
}
|
||||
|
||||
|
||||
fracmovement %= FRACUNIT; // Reset fracmovement's integer value, but keep the fraction
|
||||
|
||||
Unlock_state();
|
||||
@@ -634,7 +635,7 @@ INT32 CON_ShiftChar(INT32 ch)
|
||||
{
|
||||
if (I_UseNativeKeyboard())
|
||||
return ch;
|
||||
|
||||
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
|
||||
{
|
||||
if (cv_keyboardlayout.value == 3)
|
||||
@@ -826,7 +827,7 @@ boolean CON_Responder(event_t *ev)
|
||||
// let go keyup events, don't eat them
|
||||
if (ev->type != ev_keydown && ev->type != ev_console)
|
||||
{
|
||||
if (ev->data1 == gamecontrol[0][gc_console][0] || ev->data1 == gamecontrol[0][gc_console][1])
|
||||
if (ev->data1 == gamecontrol[gc_console][0] || ev->data1 == gamecontrol[gc_console][1])
|
||||
consdown = false;
|
||||
return false;
|
||||
}
|
||||
@@ -844,7 +845,7 @@ boolean CON_Responder(event_t *ev)
|
||||
INT32 i;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
{
|
||||
if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1)
|
||||
if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -852,7 +853,7 @@ boolean CON_Responder(event_t *ev)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (key == gamecontrol[0][gc_console][0] || key == gamecontrol[0][gc_console][1])
|
||||
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1])
|
||||
{
|
||||
if (consdown) // ignore repeat
|
||||
return true;
|
||||
@@ -1243,7 +1244,7 @@ void CONS_Printf(const char *fmt, ...)
|
||||
|
||||
if (con_started)
|
||||
CON_Print(txt);
|
||||
|
||||
|
||||
CON_LogMessage(txt);
|
||||
|
||||
Lock_state();
|
||||
@@ -1321,17 +1322,19 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
||||
//
|
||||
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(M_GetText("Press ENTER to continue\n"));
|
||||
|
||||
// dirty quick hack, but for the good cause
|
||||
while (I_GetKey() != KEY_ENTER)
|
||||
{
|
||||
// Sleep so we don't take too much of cpu usage
|
||||
I_Sleep(1.f/TICRATE*1000);
|
||||
|
||||
I_OsPolling();
|
||||
}
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
@@ -1471,7 +1474,7 @@ static void CON_DrawHudlines(void)
|
||||
;//charwidth = 4 * con_scalefactor;
|
||||
else
|
||||
{
|
||||
//charwidth = hu_font['A'-HU_FONTSTART]->width * con_scalefactor;
|
||||
//charwidth = SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
}
|
||||
}
|
||||
@@ -1506,7 +1509,7 @@ static void CON_DrawConsole(void)
|
||||
// draw console background
|
||||
if (cons_backpic.value || con_forcepic)
|
||||
{
|
||||
patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_PATCH_LOWPRIORITY);
|
||||
patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
|
||||
@@ -1574,11 +1577,11 @@ void CON_Drawer(void)
|
||||
if (con_recalc)
|
||||
{
|
||||
CON_RecalcSize();
|
||||
|
||||
|
||||
if (con_curlines <= 0)
|
||||
CON_ClearHUD();
|
||||
}
|
||||
|
||||
|
||||
// console movement
|
||||
if (con_curlines != con_destlines)
|
||||
CON_MoveConsole();
|
||||
|
||||
@@ -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__
|
||||
+296
-347
File diff suppressed because it is too large.
Load diff
+5
-23
@@ -13,10 +13,6 @@
|
||||
#ifndef __D_CLISRV__
|
||||
#define __D_CLISRV__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "d_ticcmd.h"
|
||||
#include "d_net.h"
|
||||
#include "d_netcmd.h"
|
||||
@@ -112,11 +108,12 @@ typedef enum
|
||||
|
||||
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
||||
|
||||
#ifdef SATURNPAK
|
||||
#ifdef SATURNSYNCH
|
||||
PT_WILLRESENDGAMESTATE, // Hey Client, I am about to resend you the gamestate!
|
||||
PT_CANRECEIVEGAMESTATE, // Okay Server, I'm ready to receive it, you can go ahead.
|
||||
PT_RECEIVEDGAMESTATE, // Thank you Server, I am ready to play again!
|
||||
|
||||
// we will reserve this for now even if unused, so order wont get mangled
|
||||
PT_ISSATURN, // Saturn specific identifier packet
|
||||
#endif
|
||||
|
||||
@@ -397,7 +394,6 @@ typedef struct
|
||||
#define MAXSERVERNAME 32
|
||||
#define MAXFILENEEDED 915
|
||||
#define MAX_MIRROR_LENGTH 256
|
||||
|
||||
// This packet is too large
|
||||
typedef struct
|
||||
{
|
||||
@@ -581,9 +577,6 @@ extern boolean acceptnewnode;
|
||||
extern SINT8 servernode;
|
||||
extern char connectedservername[MAXSERVERNAME+1];
|
||||
|
||||
extern plrinfo playerinfo[MAXPLAYERS];
|
||||
extern SINT8 joinnode;
|
||||
|
||||
void Command_Ping_f(void);
|
||||
extern tic_t connectiontimeout;
|
||||
extern tic_t jointimeout;
|
||||
@@ -595,7 +588,7 @@ extern tic_t servermaxping;
|
||||
extern boolean server_lagless;
|
||||
extern tic_t simulated_lag;
|
||||
extern tic_t lowest_lag;
|
||||
extern consvar_t cv_mindelay, cv_gentlemens;
|
||||
extern consvar_t cv_mindelay, cv_lagless;
|
||||
|
||||
extern consvar_t
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
@@ -606,7 +599,7 @@ extern consvar_t
|
||||
cv_allownewsaturnplayer,
|
||||
#endif
|
||||
cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts,
|
||||
#ifdef SATURNPAK
|
||||
#ifdef SATURNSYNCH
|
||||
cv_resynchcooldown, cv_gamestateattempts,
|
||||
#endif
|
||||
cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
@@ -615,8 +608,6 @@ extern consvar_t cv_connectawaittime;
|
||||
|
||||
extern consvar_t cv_discordinvites;
|
||||
|
||||
extern consvar_t cv_serverinfoscreen;
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
//tic_t ExpandTics(INT32 low, tic_t basetic);
|
||||
void D_ClientServerInit(void);
|
||||
@@ -625,7 +616,6 @@ void D_ClientServerInit(void);
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
|
||||
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
|
||||
void SendKick(UINT8 playernum, UINT8 msg);
|
||||
|
||||
// Create any new ticcmds and broadcast to other players.
|
||||
void NetKeepAlive(void);
|
||||
@@ -644,9 +634,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason);
|
||||
void CL_QueryServerList(msg_server_t *list);
|
||||
void CL_UpdateServerList(void);
|
||||
void CL_TimeoutServerList(void);
|
||||
|
||||
void CL_AbortConnection(void);
|
||||
|
||||
// Is there a game running
|
||||
boolean Playing(void);
|
||||
|
||||
@@ -679,7 +666,7 @@ tic_t GetLag(INT32 node);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNPAK
|
||||
#ifdef SATURNSYNCH
|
||||
extern UINT8 hu_redownloadinggamestate;
|
||||
#endif
|
||||
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||
@@ -698,9 +685,4 @@ typedef struct rewind_s {
|
||||
void CL_ClearRewinds(void);
|
||||
rewind_t *CL_SaveRewindPoint(size_t demopos);
|
||||
rewind_t *CL_RewindToTime(tic_t time);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+296
-455
File diff suppressed because it is too large.
Load diff
+2
-17
@@ -14,16 +14,12 @@
|
||||
#ifndef __D_MAIN__
|
||||
#define __D_MAIN__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "d_event.h"
|
||||
#include "w_wad.h" // for MAX_WADFILES
|
||||
|
||||
// make sure not to write back the config until it's been correctly loaded
|
||||
extern tic_t rendergametic;
|
||||
|
||||
// make sure not to write back the config until it's been correctly loaded
|
||||
extern boolean loaded_config;
|
||||
|
||||
extern char srb2home[256]; //Alam: My Home
|
||||
@@ -42,22 +38,15 @@ extern boolean xtra_speedo3; // 80x11 extra speedometer check
|
||||
extern boolean xtra_speedo_clr3; // 80x11 extra speedometer colour check
|
||||
extern boolean achi_speedo; // achiiro speedometer check
|
||||
extern boolean achi_speedo_clr; // extra speedometer colour check
|
||||
extern boolean dial_speedo; // dial speedometer check
|
||||
extern boolean dial_speedo_clr; // dial speedometer colour check
|
||||
extern boolean kartz_speedo; // kartZ speedo
|
||||
extern boolean kartz_speedo_smol; // kartZ speedo but smol
|
||||
extern boolean kartz_speedo; // kartZ speedo
|
||||
|
||||
extern boolean clr_hud; // colour hud check
|
||||
extern boolean driftgaugegfx_clr; // driftgauge colour check
|
||||
extern boolean big_lap; // bigger lap counter
|
||||
extern boolean big_lap_color; // bigger lap counter but colour
|
||||
extern boolean statdp; // stat display for extended player setup
|
||||
extern boolean nametaggfx; // Nametag stuffs
|
||||
extern boolean driftgaugegfx; // Driftgauge stuffs
|
||||
extern boolean multiitem_icon; // Extra icons for Sneakers, Banana and Jawz
|
||||
extern boolean joystickicon; // Extra icons for the joystick input display
|
||||
extern boolean minidoticon; // Dot icon for minimap player angle display
|
||||
extern boolean minilighticon; // mkwii-style minimap headlight
|
||||
//
|
||||
|
||||
// autoload stuff
|
||||
@@ -94,8 +83,4 @@ const char *D_Home(void);
|
||||
//
|
||||
void D_StartTitle(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif //__D_MAIN__
|
||||
+69
-63
@@ -109,24 +109,20 @@ boolean Net_GetNetStat(void)
|
||||
{
|
||||
const tic_t t = I_GetTime();
|
||||
static INT64 oldsendbyte = 0;
|
||||
|
||||
if (statstarttic+STATLENGTH <= t)
|
||||
{
|
||||
const tic_t df = t-statstarttic;
|
||||
const INT64 newsendbyte = sendbytes - oldsendbyte;
|
||||
sendbps = (INT32)(newsendbyte*TICRATE)/df;
|
||||
getbps = (getbytes*TICRATE)/df;
|
||||
|
||||
if (sendackpacket)
|
||||
lostpercent = 100.0f*(float)retransmit/(float)sendackpacket;
|
||||
else
|
||||
lostpercent = 0.0f;
|
||||
|
||||
if (getackpacket)
|
||||
duppercent = 100.0f*(float)duppacket/(float)getackpacket;
|
||||
else
|
||||
duppercent = 0.0f;
|
||||
|
||||
if (ticruned)
|
||||
gamelostpercent = 100.0f*(float)ticmiss/(float)ticruned;
|
||||
else
|
||||
@@ -224,7 +220,7 @@ FUNCMATH static INT32 cmpack(UINT8 a, UINT8 b)
|
||||
* \param lowtimer ???
|
||||
* \return True if a free acknum was found
|
||||
*/
|
||||
static boolean GetFreeAcknum(UINT8 *freeack)
|
||||
static boolean GetFreeAcknum(UINT8 *freeack, boolean lowtimer)
|
||||
{
|
||||
node_t *node = &nodes[doomcom->remotenode];
|
||||
INT32 i, numfreeslot = 0;
|
||||
@@ -236,7 +232,6 @@ static boolean GetFreeAcknum(UINT8 *freeack)
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
if (!ackpak[i].acknum)
|
||||
{
|
||||
// For low priority packets, make sure to let freeslots so urgent packets can be sent
|
||||
@@ -254,8 +249,17 @@ static boolean GetFreeAcknum(UINT8 *freeack)
|
||||
node->nextacknum++;
|
||||
ackpak[i].destinationnode = (UINT8)(node - nodes);
|
||||
ackpak[i].length = doomcom->datalength;
|
||||
ackpak[i].senttime = I_GetTime();
|
||||
ackpak[i].resentnum = 0;
|
||||
if (lowtimer)
|
||||
{
|
||||
// Lowtime means can't be sent now so try it as soon as possible
|
||||
ackpak[i].senttime = 0;
|
||||
ackpak[i].resentnum = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ackpak[i].senttime = I_GetTime();
|
||||
ackpak[i].resentnum = 0;
|
||||
}
|
||||
M_Memcpy(ackpak[i].pak.raw, netbuffer, ackpak[i].length);
|
||||
|
||||
*freeack = ackpak[i].acknum;
|
||||
@@ -264,17 +268,46 @@ static boolean GetFreeAcknum(UINT8 *freeack)
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PARANOIA
|
||||
CONS_Debug(DBG_NETPLAY, "No more free ackpacket\n");
|
||||
#endif
|
||||
if (netbuffer->packettype < PT_CANFAIL)
|
||||
I_Error("Connection lost\n");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Counts how many acks are free
|
||||
*
|
||||
* \param urgent True if the type of the packet meant to
|
||||
* use an ack is lower than PT_CANFAIL
|
||||
* If for some reason you don't want use it
|
||||
* for any packet type in particular,
|
||||
* just set to false
|
||||
* \return The number of free acks
|
||||
*
|
||||
*/
|
||||
INT32 Net_GetFreeAcks(boolean urgent)
|
||||
{
|
||||
INT32 i, numfreeslot = 0;
|
||||
INT32 n = 0; // Number of free acks found
|
||||
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
if (!ackpak[i].acknum)
|
||||
{
|
||||
// For low priority packets, make sure to let freeslots so urgent packets can be sent
|
||||
if (!urgent)
|
||||
{
|
||||
numfreeslot++;
|
||||
if (numfreeslot <= URGENTFREESLOTNUM)
|
||||
continue;
|
||||
}
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
// Get a ack to send in the queue of this node
|
||||
static UINT8 GetAcktosend(INT32 node)
|
||||
{
|
||||
@@ -287,7 +320,6 @@ static void RemoveAck(INT32 i)
|
||||
INT32 node = ackpak[i].destinationnode;
|
||||
DEBFILE(va("Remove ack %d\n",ackpak[i].acknum));
|
||||
ackpak[i].acknum = 0;
|
||||
|
||||
if (nodes[node].flags & NF_CLOSE)
|
||||
Net_CloseConnection(node);
|
||||
}
|
||||
@@ -303,16 +335,13 @@ static boolean Processackpak(void)
|
||||
if (netbuffer->ackreturn && cmpack(node->remotefirstack, netbuffer->ackreturn) < 0)
|
||||
{
|
||||
node->remotefirstack = netbuffer->ackreturn;
|
||||
|
||||
// Search the ackbuffer and free it
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
if (ackpak[i].acknum && ackpak[i].destinationnode == node - nodes
|
||||
&& cmpack(ackpak[i].acknum, netbuffer->ackreturn) <= 0)
|
||||
{
|
||||
RemoveAck(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Received a packet with ack, queue it to send the ack back
|
||||
@@ -320,7 +349,6 @@ static boolean Processackpak(void)
|
||||
{
|
||||
UINT8 ack = netbuffer->ack;
|
||||
getackpacket++;
|
||||
|
||||
if (cmpack(ack, node->firstacktosend) <= 0)
|
||||
{
|
||||
DEBFILE(va("Discard(1) ack %d (duplicated)\n", ack));
|
||||
@@ -331,7 +359,6 @@ static boolean Processackpak(void)
|
||||
{
|
||||
// Check if it is not already in the queue
|
||||
for (i = node->acktosend_tail; i != node->acktosend_head; i = (i+1) % MAXACKTOSEND)
|
||||
{
|
||||
if (node->acktosend[i] == ack)
|
||||
{
|
||||
DEBFILE(va("Discard(2) ack %d (duplicated)\n", ack));
|
||||
@@ -339,14 +366,11 @@ static boolean Processackpak(void)
|
||||
goodpacket = false; // Discard packet (duplicate)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (goodpacket)
|
||||
{
|
||||
// Is a good packet so increment the acknowledge number,
|
||||
// Then search for a "hole" in the queue
|
||||
UINT8 nextfirstack = (UINT8)(node->firstacktosend + 1);
|
||||
|
||||
if (!nextfirstack)
|
||||
nextfirstack = 1;
|
||||
|
||||
@@ -359,11 +383,9 @@ static boolean Processackpak(void)
|
||||
if (!nextfirstack)
|
||||
nextfirstack = 1;
|
||||
hm1 = (UINT8)((node->acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND);
|
||||
|
||||
while (change)
|
||||
{
|
||||
change = false;
|
||||
|
||||
for (i = node->acktosend_tail; i != node->acktosend_head;
|
||||
i = (i+1) % MAXACKTOSEND)
|
||||
{
|
||||
@@ -376,7 +398,6 @@ static boolean Processackpak(void)
|
||||
nextfirstack = 1;
|
||||
change = true;
|
||||
}
|
||||
|
||||
if (i == node->acktosend_tail)
|
||||
{
|
||||
node->acktosend[node->acktosend_tail] = 0;
|
||||
@@ -398,7 +419,6 @@ static boolean Processackpak(void)
|
||||
// Will be incremented when the nextfirstack comes (code above)
|
||||
UINT8 newhead = (UINT8)((node->acktosend_head+1) % MAXACKTOSEND);
|
||||
DEBFILE(va("out of order packet (%d expected)\n", nextfirstack));
|
||||
|
||||
if (newhead != node->acktosend_tail)
|
||||
{
|
||||
node->acktosend[node->acktosend_head] = ack;
|
||||
@@ -435,11 +455,8 @@ static void GotAcks(void)
|
||||
INT32 i, j;
|
||||
|
||||
for (j = 0; j < MAXACKTOSEND; j++)
|
||||
{
|
||||
if (netbuffer->u.textcmd[j])
|
||||
{
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
if (ackpak[i].acknum && ackpak[i].destinationnode == doomcom->remotenode)
|
||||
{
|
||||
if (ackpak[i].acknum == netbuffer->u.textcmd[j])
|
||||
@@ -454,9 +471,6 @@ static void GotAcks(void)
|
||||
ackpak[i].senttime--; // hurry up
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -491,7 +505,6 @@ void Net_AckTicker(void)
|
||||
{
|
||||
const INT32 nodei = ackpak[i].destinationnode;
|
||||
node_t *node = &nodes[nodei];
|
||||
|
||||
if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime())
|
||||
{
|
||||
if (ackpak[i].resentnum > 10 && (node->flags & NF_CLOSE))
|
||||
@@ -544,10 +557,8 @@ void Net_UnAcknowledgePacket(INT32 node)
|
||||
#else
|
||||
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
|
||||
DEBFILE(va("UnAcknowledge node %d\n", node));
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (nodes[node].acktosend[hm1] == netbuffer->ack)
|
||||
{
|
||||
nodes[node].acktosend[hm1] = 0;
|
||||
@@ -571,7 +582,6 @@ void Net_UnAcknowledgePacket(INT32 node)
|
||||
if (!nodes[node].firstacktosend)
|
||||
nodes[node].firstacktosend = UINT8_MAX;
|
||||
}
|
||||
|
||||
nodes[node].firstacktosend++;
|
||||
if (!nodes[node].firstacktosend)
|
||||
nodes[node].firstacktosend = 1;
|
||||
@@ -590,10 +600,8 @@ static boolean Net_AllAcksReceived(void)
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
if (ackpak[i].acknum)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -613,7 +621,6 @@ void Net_WaitAllAckReceived(UINT32 timeout)
|
||||
timeout = tictac + timeout*NEWTICRATE;
|
||||
|
||||
HGetPacket();
|
||||
|
||||
while (timeout > I_GetTime() && !Net_AllAcksReceived())
|
||||
{
|
||||
while (tictac == I_GetTime())
|
||||
@@ -621,7 +628,6 @@ void Net_WaitAllAckReceived(UINT32 timeout)
|
||||
I_Sleep(cv_sleep.value);
|
||||
I_UpdateTime(cv_timescale.value);
|
||||
}
|
||||
|
||||
tictac = I_GetTime();
|
||||
HGetPacket();
|
||||
Net_AckTicker();
|
||||
@@ -662,14 +668,13 @@ void Net_AbortPacketType(UINT8 packettype)
|
||||
#ifdef NONET
|
||||
(void)packettype;
|
||||
#else
|
||||
for (INT32 i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
if (ackpak[i].acknum && (ackpak[i].pak.data.packettype == packettype
|
||||
|| packettype == UINT8_MAX))
|
||||
{
|
||||
ackpak[i].acknum = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -714,7 +719,6 @@ void Net_CloseConnection(INT32 node)
|
||||
|
||||
// check if we are waiting for an ack from this node
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
if (ackpak[i].acknum && ackpak[i].destinationnode == node)
|
||||
{
|
||||
if (!forceclose)
|
||||
@@ -722,7 +726,6 @@ void Net_CloseConnection(INT32 node)
|
||||
else
|
||||
ackpak[i].acknum = 0;
|
||||
}
|
||||
}
|
||||
|
||||
InitNode(&nodes[node]);
|
||||
SV_AbortSendFiles(node);
|
||||
@@ -739,8 +742,9 @@ static UINT32 NetbufferChecksum(void)
|
||||
UINT32 c = 0x1234567;
|
||||
const INT32 l = doomcom->datalength - 4;
|
||||
const UINT8 *buf = (UINT8 *)netbuffer + 4;
|
||||
INT32 i;
|
||||
|
||||
for (INT32 i = 0; i < l; i++, buf++)
|
||||
for (i = 0; i < l; i++, buf++)
|
||||
c += (*buf) * (i+1);
|
||||
|
||||
return LONG(c);
|
||||
@@ -755,7 +759,6 @@ static void fprintfstring(char *s, size_t len)
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (s[i] < 32)
|
||||
{
|
||||
if (!mode)
|
||||
@@ -775,8 +778,6 @@ static void fprintfstring(char *s, size_t len)
|
||||
}
|
||||
fprintf(debugfile, "%c", s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (mode)
|
||||
fprintf(debugfile, "]");
|
||||
}
|
||||
@@ -831,14 +832,15 @@ const char *packettypename[NUMPACKETTYPE] =
|
||||
"MOREFILESNEEDED",
|
||||
|
||||
"PING"
|
||||
#ifdef SATURNPAK
|
||||
#ifdef SATURNSYNCH
|
||||
,
|
||||
|
||||
"WILLRESENDGAMESTATE",
|
||||
"CANRECEIVEGAMESTATE",
|
||||
"RECEIVEDGAMESTATE",
|
||||
|
||||
"ISSATURN" // special packet to identify saturn clients
|
||||
// we will reserve this for now even if unused, so order wont get mangled
|
||||
"ISSATURN"
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1033,7 +1035,6 @@ static boolean ShouldDropPacket(void)
|
||||
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlength)
|
||||
{
|
||||
doomcom->datalength = (INT16)(packetlength + BASEPACKETSIZE);
|
||||
|
||||
if (node == 0) // Packet is to go back to us
|
||||
{
|
||||
if ((rebound_head+1) % MAXREBOUND == rebound_tail)
|
||||
@@ -1069,7 +1070,6 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
// do this before GetFreeAcknum because this function backups
|
||||
// the current packet
|
||||
doomcom->remotenode = (INT16)node;
|
||||
|
||||
if (doomcom->datalength <= 0)
|
||||
{
|
||||
DEBFILE("HSendPacket: nothing to send\n");
|
||||
@@ -1084,10 +1084,9 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
netbuffer->ackreturn = GetAcktosend(node);
|
||||
else
|
||||
netbuffer->ackreturn = 0;
|
||||
|
||||
if (reliable)
|
||||
{
|
||||
if (!GetFreeAcknum(&netbuffer->ack))
|
||||
if (!GetFreeAcknum(&netbuffer->ack, false))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1159,6 +1158,7 @@ boolean HGetPacket(void)
|
||||
|
||||
while(true)
|
||||
{
|
||||
//nodejustjoined = I_NetGet();
|
||||
I_NetGet();
|
||||
|
||||
if (doomcom->remotenode == -1) // No packet received
|
||||
@@ -1187,6 +1187,21 @@ boolean HGetPacket(void)
|
||||
DebugPrintpacket("GET");
|
||||
#endif
|
||||
|
||||
/*// If a new node sends an unexpected packet, just ignore it
|
||||
if (nodejustjoined && server
|
||||
&& !(netbuffer->packettype == PT_ASKINFO
|
||||
|| netbuffer->packettype == PT_SERVERINFO
|
||||
|| netbuffer->packettype == PT_PLAYERINFO
|
||||
|| netbuffer->packettype == PT_REQUESTFILE
|
||||
|| netbuffer->packettype == PT_ASKINFOVIAMS
|
||||
|| netbuffer->packettype == PT_CLIENTJOIN))
|
||||
{
|
||||
DEBFILE(va("New node sent an unexpected %s packet\n", packettypename[netbuffer->packettype]));
|
||||
//CONS_Alert(CONS_NOTICE, "New node sent an unexpected %s packet\n", packettypename[netbuffer->packettype]);
|
||||
Net_CloseConnection(doomcom->remotenode | FORCECLOSE);
|
||||
continue;
|
||||
}*/
|
||||
|
||||
// Proceed the ack and ackreturn field
|
||||
if (!Processackpak())
|
||||
continue; // discarded (duplicated)
|
||||
@@ -1223,7 +1238,6 @@ static void Internal_FreeNodenum(INT32 nodenum)
|
||||
SINT8 I_NetMakeNode(const char *hostname)
|
||||
{
|
||||
SINT8 newnode = -1;
|
||||
|
||||
if (I_NetMakeNodewPort)
|
||||
{
|
||||
char *localhostname = strdup(hostname);
|
||||
@@ -1250,10 +1264,7 @@ void D_SetDoomcom(void)
|
||||
{
|
||||
if (doomcom) return;
|
||||
doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
|
||||
doomcom->id = DOOMCOM_ID;
|
||||
doomcom->numslots = doomcom->numnodes = 1;
|
||||
doomcom->gametype = 0;
|
||||
doomcom->consoleplayer = 0;
|
||||
doomcom->extratics = 0;
|
||||
}
|
||||
|
||||
@@ -1277,7 +1288,6 @@ boolean D_CheckNetGame(void)
|
||||
I_NetMakeNodewPort = NULL;
|
||||
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
|
||||
// I_InitNetwork sets doomcom and netgame
|
||||
// check and initialize the network driver
|
||||
multiplayer = false;
|
||||
@@ -1297,7 +1307,6 @@ boolean D_CheckNetGame(void)
|
||||
server = true; // WTF? server always true???
|
||||
// no! The deault mode is server. Client is set elsewhere
|
||||
// when the client executes connect command.
|
||||
doomcom->ticdup = 1;
|
||||
|
||||
if (M_CheckParm("-extratic"))
|
||||
{
|
||||
@@ -1327,8 +1336,6 @@ boolean D_CheckNetGame(void)
|
||||
if (netgame)
|
||||
multiplayer = true;
|
||||
|
||||
if (doomcom->id != DOOMCOM_ID)
|
||||
I_Error("Doomcom buffer invalid!");
|
||||
if (doomcom->numnodes > MAXNETNODES)
|
||||
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
|
||||
|
||||
@@ -1341,7 +1348,7 @@ boolean D_CheckNetGame(void)
|
||||
if (M_CheckParm("-debugfile"))
|
||||
{
|
||||
char filename[21];
|
||||
INT32 k = doomcom->consoleplayer - 1;
|
||||
INT32 k = consoleplayer - 1;
|
||||
if (M_IsNextParm())
|
||||
k = atoi(M_GetNextParm()) - 1;
|
||||
while (!debugfile && k < MAXPLAYERS)
|
||||
@@ -1397,7 +1404,6 @@ void Command_Ping_f(void)
|
||||
INT32 i;
|
||||
|
||||
pingc = 0;
|
||||
|
||||
for (i = 1; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (playeringame[i])
|
||||
|
||||
+5
-9
@@ -18,10 +18,6 @@
|
||||
#ifndef __D_NET__
|
||||
#define __D_NET__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Max computers in a game
|
||||
// 127 is probably as high as this can go, because
|
||||
// SINT8 is used for nodes sometimes >:(
|
||||
@@ -47,10 +43,14 @@ extern SINT8 nodetoplayer4[MAXNETNODES]; // Say the numplayer for this node if a
|
||||
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
||||
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
||||
|
||||
extern boolean serverrunning;
|
||||
|
||||
INT32 Net_GetFreeAcks(boolean urgent);
|
||||
void Net_AckTicker(void);
|
||||
|
||||
// If reliable return true if packet sent, 0 else
|
||||
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlength);
|
||||
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum,
|
||||
size_t packetlength);
|
||||
boolean HGetPacket(void);
|
||||
void D_SetDoomcom(void);
|
||||
#ifndef NONET
|
||||
@@ -67,8 +67,4 @@ void Net_SendAcks(INT32 node);
|
||||
void Net_WaitAllAckReceived(UINT32 timeout);
|
||||
const char *Net_GetPacketName(UINT8 packettype);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+308
-147
@@ -39,7 +39,6 @@
|
||||
#include "d_main.h"
|
||||
#include "m_random.h"
|
||||
#include "f_finale.h"
|
||||
#include "v_video.h"
|
||||
#include "filesrch.h"
|
||||
#include "mserv.h"
|
||||
#include "md5.h"
|
||||
@@ -204,15 +203,31 @@ static void Command_Archivetest_f(void);
|
||||
// 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}};
|
||||
|
||||
#ifdef LJOYSTICK
|
||||
static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, {3, "/dev/js2"},
|
||||
{4, "/dev/js3"}, {0, NULL}};
|
||||
#else
|
||||
// accept whatever value - it is in fact the joystick device number
|
||||
#define usejoystick_cons_t NULL
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"}, {3, "None"}, {0, NULL}};
|
||||
static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Non-Random"}, {3, "None"}, {0, NULL}};
|
||||
static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"},
|
||||
{3, "None"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Non-Random"},
|
||||
{3, "None"}, {0, NULL}};
|
||||
|
||||
//static CV_PossibleValue_t chances_cons_t[] = {{0, "MIN"}, {9, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t match_scoring_cons_t[] = {{0, "Normal"}, {1, "Classic"}, {0, NULL}};
|
||||
@@ -275,48 +290,40 @@ consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0,
|
||||
|
||||
INT32 cv_debug;
|
||||
|
||||
static void UseMouse_OnChange(void);
|
||||
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, UseMouse_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void UseMouse_OnChange(void)
|
||||
{
|
||||
GameFocus_menu_Onchange();
|
||||
I_StartupMouse();
|
||||
}
|
||||
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
//WTF
|
||||
consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Lagless camera! Yay!
|
||||
consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_laglesscam = {"laglesscamera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
|
||||
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"verticallook3", "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}
|
||||
};
|
||||
consvar_t cv_verticallook = {"verticallook", "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] = {
|
||||
{"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_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_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_SDL)
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
#ifdef LJOYSTICK
|
||||
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
|
||||
#endif
|
||||
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#else
|
||||
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = { //Alam: Dummy for save
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale3", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale4", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
consvar_t cv_joyscale[2] = { //Alam: Dummy for save
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -324,6 +331,19 @@ consvar_t cv_matchboxes = {"matchboxes", "Normal", CV_NETVAR|CV_CHEAT|CV_NOSHOWH
|
||||
consvar_t cv_specialrings = {"specialrings", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_powerstones = {"powerstones", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
/*consvar_t cv_recycler = {"tv_recycler", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_teleporters = {"tv_teleporter", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_superring = {"tv_superring", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_supersneakers = {"tv_supersneaker", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_invincibility = {"tv_invincibility", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_jumpshield = {"tv_jumpshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_watershield = {"tv_watershield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ringshield = {"tv_ringshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_forceshield = {"tv_forceshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_bombshield = {"tv_bombshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_1up = {"tv_1up", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_eggmanbox = {"tv_eggman", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};*/
|
||||
|
||||
// SRB2kart
|
||||
consvar_t cv_sneaker = {"sneaker", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_rocketsneaker = {"rocketsneaker", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -439,6 +459,7 @@ consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_On
|
||||
consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics
|
||||
static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_nettimeout = {"nettimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
//static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_jointimeout = {"jointimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_maxping = {"maxdelay", "20", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -631,6 +652,7 @@ void D_RegisterServerCommands(void)
|
||||
COM_AddCommand("addfilelocal", Command_Addfilelocal);
|
||||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
|
||||
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
|
||||
@@ -695,7 +717,7 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_competitionboxes);
|
||||
CV_RegisterVar(&cv_matchboxes);
|
||||
|
||||
K_RegisterServerKartStuff(); // SRB2kart
|
||||
K_RegisterKartStuff(); // SRB2kart
|
||||
|
||||
CV_RegisterVar(&cv_ringslinger);
|
||||
|
||||
@@ -719,14 +741,9 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_killingdead);
|
||||
|
||||
// d_clisrv
|
||||
#ifndef NONET
|
||||
#ifdef SATURNJOIN
|
||||
CV_RegisterVar(&cv_allownewsaturnplayer); // need to register it before cv_maxplayers && cv_allownewplayer
|
||||
#endif
|
||||
#endif
|
||||
CV_RegisterVar(&cv_maxplayers);
|
||||
CV_RegisterVar(&cv_resynchattempts);
|
||||
#ifdef SATURNPAK
|
||||
#ifdef SATURNSYNCH
|
||||
CV_RegisterVar(&cv_gamestateattempts);
|
||||
CV_RegisterVar(&cv_resynchcooldown);
|
||||
#endif
|
||||
@@ -737,7 +754,9 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_httpsource);
|
||||
#ifndef NONET
|
||||
CV_RegisterVar(&cv_allownewplayer);
|
||||
|
||||
#ifdef SATURNJOIN
|
||||
CV_RegisterVar(&cv_allownewsaturnplayer);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_joinrefusemessage);
|
||||
CV_RegisterVar(&cv_chatlogsize);
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
@@ -776,6 +795,8 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_netdemosyncquality);
|
||||
CV_RegisterVar(&cv_maxdemosize);
|
||||
CV_RegisterVar(&cv_demochangemap);
|
||||
|
||||
CV_RegisterVar(&cv_keyboardlayout);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -834,10 +855,6 @@ void D_RegisterClientCommands(void)
|
||||
COM_AddCommand("stopmovie", Command_StopMovie_f);
|
||||
COM_AddCommand("minigen", M_MinimapGenerate);
|
||||
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
|
||||
K_RegisterClientKartStuff(); // SRB2kart
|
||||
|
||||
CV_RegisterVar(&cv_screenshot_option);
|
||||
CV_RegisterVar(&cv_screenshot_folder);
|
||||
CV_RegisterVar(&cv_moviemode);
|
||||
@@ -888,14 +905,11 @@ void D_RegisterClientCommands(void)
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_seenames);
|
||||
#endif
|
||||
|
||||
CV_RegisterVar(&cv_rollingdemos);
|
||||
|
||||
CV_RegisterVar(&cv_netstat);
|
||||
CV_RegisterVar(&cv_netticbuffer);
|
||||
CV_RegisterVar(&cv_mindelay);
|
||||
CV_RegisterVar(&cv_gentlemens);
|
||||
CV_RegisterVar(&cv_serverinfoscreen);
|
||||
CV_RegisterVar(&cv_lagless);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
CV_RegisterVar(&cv_fishcake);
|
||||
@@ -910,8 +924,6 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_cechotoggle);
|
||||
|
||||
CV_RegisterVar(&cv_keyboardlayout);
|
||||
|
||||
// time attack ghost options are also saved to config
|
||||
CV_RegisterVar(&cv_ghost_besttime);
|
||||
CV_RegisterVar(&cv_ghost_bestlap);
|
||||
@@ -921,10 +933,7 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
||||
|
||||
CV_RegisterVar(&cv_audbuffersize);
|
||||
|
||||
CV_RegisterVar(&cv_palette);
|
||||
CV_RegisterVar(&cv_palettenum);
|
||||
CV_RegisterVar(&cv_audbuffersize);
|
||||
|
||||
// m_menu.c
|
||||
CV_RegisterVar(&cv_chatheight);
|
||||
@@ -935,10 +944,10 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_chatnotifications);
|
||||
CV_RegisterVar(&cv_chatbacktint);
|
||||
CV_RegisterVar(&cv_songcredits);
|
||||
CV_RegisterVar(&cv_showfreeplay);
|
||||
CV_RegisterVar(&cv_showfreeplay);
|
||||
CV_RegisterVar(&cv_skinselectspin);
|
||||
CV_RegisterVar(&cv_showallmaps);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_growmusic);
|
||||
CV_RegisterVar(&cv_supermusic);
|
||||
|
||||
@@ -959,18 +968,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_showfocuslost);
|
||||
CV_RegisterVar(&cv_pauseifunfocused);
|
||||
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
CV_RegisterVar(&cv_addons_folder);
|
||||
CV_RegisterVar(&cv_addons_md5);
|
||||
CV_RegisterVar(&cv_addons_showall);
|
||||
CV_RegisterVar(&cv_addons_search_type);
|
||||
CV_RegisterVar(&cv_addons_search_case);
|
||||
|
||||
// g_input.c
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
CV_RegisterVar(&cv_turnsmooth);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_turnaxis[i]);
|
||||
@@ -988,17 +986,45 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_custom3axis[i]);
|
||||
CV_RegisterVar(&cv_xdeadzone[i]);
|
||||
CV_RegisterVar(&cv_ydeadzone[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
CV_RegisterVar(&cv_addons_folder);
|
||||
CV_RegisterVar(&cv_addons_md5);
|
||||
CV_RegisterVar(&cv_addons_showall);
|
||||
CV_RegisterVar(&cv_addons_search_type);
|
||||
CV_RegisterVar(&cv_addons_search_case);
|
||||
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
CV_RegisterVar(&cv_turnsmooth);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_rumble[i]);
|
||||
CV_RegisterVar(&cv_gamepadled[i]);
|
||||
CV_RegisterVar(&cv_ledpowerup[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_invertmouse);
|
||||
CV_RegisterVar(&cv_mousesens);
|
||||
CV_RegisterVar(&cv_mouseysens);
|
||||
//CV_RegisterVar(&cv_mousemove);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
}
|
||||
#ifdef LJOYSTICK
|
||||
CV_RegisterVar(&cv_joyport);
|
||||
CV_RegisterVar(&cv_joyport2);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
}
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
@@ -1007,7 +1033,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_midimusicvolume);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_numChannels);
|
||||
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
CV_RegisterVar(&cv_modfilter);
|
||||
CV_RegisterVar(&cv_stereosep);
|
||||
@@ -1022,11 +1048,10 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_vhseffect);
|
||||
CV_RegisterVar(&cv_shittyscreen);
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
CV_RegisterVar(&cv_scr_width);
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
||||
CV_RegisterVar(&cv_parallelsoftware);
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
CV_RegisterVar(&cv_perfstats);
|
||||
@@ -1043,13 +1068,7 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_laglesscam);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_verticallook[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_demodateformat);
|
||||
CV_RegisterVar(&cv_showspecstuff);
|
||||
CV_RegisterVar(&cv_verticallook);
|
||||
|
||||
// ingame object placing
|
||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||
@@ -1084,6 +1103,8 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_discordasks);
|
||||
#endif
|
||||
|
||||
CV_RegisterVar(&cv_showspecstuff);
|
||||
|
||||
COM_AddCommand("listskins", Command_ListSkins);
|
||||
COM_AddCommand("skinsearch", Command_SkinSearch);
|
||||
}
|
||||
@@ -1392,10 +1413,13 @@ static void SetPlayerName(INT32 playernum, char *newname)
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1);
|
||||
|
||||
if (server && netgame)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1750,8 +1774,24 @@ static void SendNameAndColor3(void)
|
||||
|
||||
if ((foundskin = R_SkinAvailable(cv_skin3.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin3.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin3.value != players[thirdplaya].skin);
|
||||
|
||||
SetPlayerSkin(thirdplaya, cv_skin3.string);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor3, skins[players[thirdplaya].skin].prefcolor);
|
||||
|
||||
players[thirdplaya].skincolor = (cv_playercolor3.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[thirdplaya].mo)
|
||||
players[thirdplaya].mo->color = players[thirdplaya].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1973,8 +2013,12 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
|
||||
if (kick)
|
||||
{
|
||||
UINT8 buf[2];
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2063,7 +2107,6 @@ void D_SendPlayerConfig(void)
|
||||
SendNameAndColor3();
|
||||
if (splitscreen > 2)
|
||||
SendNameAndColor4();
|
||||
|
||||
SendWeaponPref();
|
||||
if (splitscreen)
|
||||
SendWeaponPref2();
|
||||
@@ -2087,7 +2130,7 @@ static INT32 LookupPlayer(const char *s)
|
||||
if (*s == '0')/* clever way to bypass atoi */
|
||||
return 0;
|
||||
|
||||
if ((playernum = atoi(s)))
|
||||
if (( playernum = atoi(s) ))
|
||||
{
|
||||
playernum = max(min(playernum, MAXPLAYERS-1), 0);/* not out of range */
|
||||
return playernum;
|
||||
@@ -2168,7 +2211,8 @@ static void Command_View_f(void)
|
||||
|
||||
if (viewnum > 1 && !( multiplayer && demo.playback ))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "You must be viewing a multiplayer replay to use this.\n");
|
||||
CONS_Alert(CONS_NOTICE,
|
||||
"You must be viewing a multiplayer replay to use this.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2180,16 +2224,13 @@ static void Command_View_f(void)
|
||||
if (COM_Argc() > 1)/* switch to player */
|
||||
{
|
||||
playerparam = COM_Argv(1);
|
||||
|
||||
if (playerparam[0] == '#')/* search by placement */
|
||||
{
|
||||
placenum = atoi(&playerparam[1]);
|
||||
playernum = FindPlayerByPlace(placenum);
|
||||
|
||||
if (playernum == -1 || !G_CouldView(playernum))
|
||||
{
|
||||
GetViewablePlayerPlaceRange(&firstplace, &lastplace);
|
||||
|
||||
if (playernum == -1)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "There is no player in that place! ");
|
||||
@@ -2201,7 +2242,6 @@ static void Command_View_f(void)
|
||||
"The first player that you can view is \x82#%d\x80; ",
|
||||
firstplace);
|
||||
}
|
||||
|
||||
CONS_Printf("Last place is \x82#%d\x80.\n", lastplace);
|
||||
return;
|
||||
}
|
||||
@@ -2250,9 +2290,10 @@ static void Command_SetViews_f(void)
|
||||
UINT8 splits;
|
||||
UINT8 newsplits;
|
||||
|
||||
if (!(demo.playback && multiplayer))
|
||||
if (!( demo.playback && multiplayer ))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "You must be viewing a multiplayer replay to use this.\n");
|
||||
CONS_Alert(CONS_NOTICE,
|
||||
"You must be viewing a multiplayer replay to use this.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2471,8 +2512,18 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
|
||||
// Kick bot from special stages
|
||||
if (botskin)
|
||||
{
|
||||
if (!botingame)
|
||||
if (G_IsSpecialStage(mapnum))
|
||||
{
|
||||
if (botingame)
|
||||
{
|
||||
//CL_RemoveSplitscreenPlayer();
|
||||
botingame = false;
|
||||
playeringame[1] = false;
|
||||
}
|
||||
}
|
||||
else if (!botingame)
|
||||
{
|
||||
//CL_AddSplitscreenPlayer();
|
||||
botingame = true;
|
||||
displayplayers[1] = 1;
|
||||
playeringame[1] = true;
|
||||
@@ -2545,7 +2596,6 @@ void D_PickVote(void)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
if (votes[i] != -1)
|
||||
{
|
||||
temppicks[numvotes] = i;
|
||||
@@ -2621,8 +2671,7 @@ static tic_t last_map_cmd = 0;
|
||||
//
|
||||
static void Command_Map_f(void)
|
||||
{
|
||||
if (I_GetTime() - last_map_cmd < 20)
|
||||
{
|
||||
if (I_GetTime() - last_map_cmd < 20) {
|
||||
CONS_Alert(CONS_WARNING, "Map command is used too frequently!\n");
|
||||
return;
|
||||
}
|
||||
@@ -2680,7 +2729,8 @@ static void Command_Map_f(void)
|
||||
{
|
||||
if (!multiplayer)
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't switch gametypes in single player!\n"));
|
||||
CONS_Printf(M_GetText(
|
||||
"You can't switch gametypes in single player!\n"));
|
||||
return;
|
||||
}
|
||||
else if (COM_Argc() < option_gametype + 2)/* no argument after? */
|
||||
@@ -2770,7 +2820,7 @@ static void Command_Map_f(void)
|
||||
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||
else
|
||||
{
|
||||
if (!mapheaderinfo[newmapnum-1])
|
||||
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
|
||||
Z_Free(realmapname);
|
||||
@@ -2849,7 +2899,11 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal map change received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2890,6 +2944,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
CON_LogMessage(M_GetText("Speeding off to level...\n"));
|
||||
}
|
||||
|
||||
if (demo.playback && !demo.timing)
|
||||
precache = false;
|
||||
|
||||
if (resetplayer)
|
||||
{
|
||||
if (!FLS || (netgame || multiplayer))
|
||||
@@ -2905,7 +2962,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
demo.savebutton = 0;
|
||||
G_InitNew(pencoremode, mapname, resetplayer, skipprecutscene);
|
||||
|
||||
if (demo.playback && !demo.timing)
|
||||
precache = true;
|
||||
if (demo.timing)
|
||||
G_DoneLevelLoad();
|
||||
|
||||
@@ -2964,7 +3022,11 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal pause command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -3009,30 +3071,18 @@ static void Command_ReplayMarker(void)
|
||||
CONS_Printf(M_GetText("You must be in a level to use this.\n"));
|
||||
return;
|
||||
}
|
||||
if (demo.savemode == DSM_WILLAUTOSAVE)
|
||||
{
|
||||
if (demo.savemode == DSM_WILLAUTOSAVE) {
|
||||
demo.savemode = DSM_NOTSAVING;
|
||||
CONS_Printf("Replay unmarked.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
demo.savemode = DSM_WILLAUTOSAVE;
|
||||
|
||||
} else {
|
||||
int adjustedleveltime = leveltime - starttime;
|
||||
|
||||
demo.savemode = DSM_WILLAUTOSAVE;
|
||||
if (adjustedleveltime < 0)
|
||||
adjustedleveltime = 0;
|
||||
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
if (title)
|
||||
{
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
snprintf(demo.titlename, 64, "[%i:%02d/%.5s]", G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
|
||||
CONS_Printf("Replay will be saved!\n");
|
||||
}
|
||||
}
|
||||
@@ -3063,6 +3113,20 @@ static void Command_Respawn(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (!G_RaceGametype()) // srb2kart: not necessary, respawning makes you lose a bumper in battle, so it's not desirable to use as a way to escape a hit
|
||||
{
|
||||
CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n"));
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Retry is quicker. Probably should force people to use it.
|
||||
// nope, this is srb2kart - a complete retry is overkill
|
||||
/*if (!(netgame || multiplayer))
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't use this in Single Player! Use \"retry\" instead.\n"));
|
||||
return;
|
||||
}*/
|
||||
|
||||
SendNetXCmd(XD_RESPAWN, &buf, 4);
|
||||
}
|
||||
|
||||
@@ -3076,7 +3140,11 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -3146,7 +3214,11 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal clear scores command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -3665,7 +3737,11 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3676,7 +3752,11 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -3710,7 +3790,11 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -3759,8 +3843,12 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
|
||||
if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error))
|
||||
{
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
|
||||
//Safety first!
|
||||
@@ -4129,7 +4217,11 @@ static void Got_Verification(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal verification received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -4181,7 +4273,11 @@ static void Got_Removal(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal demotion received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -4257,7 +4353,11 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal motd change received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
|
||||
Z_Free(mymotd);
|
||||
@@ -4316,7 +4416,11 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal runsoc command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -4370,7 +4474,7 @@ static void Command_Addfilelocal(void)
|
||||
// Add any wad file, ignoring checks for if it contains complex things like
|
||||
// lua. Great for complex but client-side customizations, like different
|
||||
// level cards or anything like that.
|
||||
P_AddWadFile(fn, true);
|
||||
P_AddWadFileLocal(fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -4465,9 +4569,38 @@ static void Command_Addfile(void)
|
||||
|
||||
/** Adds something at runtime.
|
||||
*/
|
||||
static void Command_Addskins(void)
|
||||
static void
|
||||
Command_Addskins (void)
|
||||
{
|
||||
CONS_Printf("addskins has been deprecated\nuse addfilelocal instead!\n");
|
||||
if (COM_Argc() > 3)
|
||||
{
|
||||
CONS_Printf(
|
||||
"addskins <file>: Load a skin file.\n");
|
||||
return;
|
||||
}
|
||||
// no forcing?
|
||||
/*
|
||||
if (fasticmp(COM_Argv(2), "-force") || fasticmp(COM_Argv(2), "-f")) {
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Adding file %s. May or may not be a skin.\n"), COM_Argv(1));
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else {
|
||||
if (DumbStartsWith("KC_", COM_Argv(1))) {
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else if (DumbStartsWith("KCL_", COM_Argv(1))) {
|
||||
if (!demo.playback) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is a skin with lua. Include -force or -f to force it to load.\n"), COM_Argv(1));
|
||||
return;
|
||||
} else {
|
||||
*/
|
||||
P_AddWadFile(COM_Argv(1), true);
|
||||
/*
|
||||
}
|
||||
} else {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is not a skin.\n"), COM_Argv(1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static void Command_GLocalSkin (void)
|
||||
@@ -4483,7 +4616,7 @@ static void Command_GLocalSkin (void)
|
||||
|
||||
char* fuck; // local skin name
|
||||
|
||||
if (!(first_option = COM_FirstOption()))
|
||||
if (!( first_option = COM_FirstOption() ))
|
||||
first_option = COM_Argc();
|
||||
|
||||
if (first_option < 2)
|
||||
@@ -4491,14 +4624,14 @@ static void Command_GLocalSkin (void)
|
||||
/* holy fucking shit */
|
||||
CONS_Printf("localskin <name> [-player <name>] [-display <number>] [-all]:\n");
|
||||
CONS_Printf(M_GetText("Set a localskin via its internal name (usually printed on the console).\n\n\
|
||||
* Using \"-player\" will set a localskin to a specified player.\n\
|
||||
Defaults to yourself.\n\
|
||||
* Using \"-display\" will set a localskin to the displayed player.\n\
|
||||
Defaults to 0, which is the first player displayed.\n\
|
||||
Can go up to 3 for splitscreen.\n\
|
||||
* Using \"-all\" will set a localskin to ALL players.\n\
|
||||
* \"localskin none\" removes the localskin, just like how\n\
|
||||
\"forceskin none\" does.\n"));
|
||||
* Using \"-player\" will set a localskin to a specified player.\n\
|
||||
Defaults to yourself.\n\
|
||||
* Using \"-display\" will set a localskin to the displayed player.\n\
|
||||
Defaults to 0, which is the first player displayed.\n\
|
||||
Can go up to 3 for splitscreen.\n\
|
||||
* Using \"-all\" will set a localskin to ALL players.\n\
|
||||
* \"localskin none\" removes the localskin, just like how\n\
|
||||
\"forceskin none\" does.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4529,7 +4662,7 @@ static void Command_GLocalSkin (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
@@ -4596,8 +4729,13 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
if ((playernum != serverplayer && !IsPlayerAdmin(playernum)) || kick)
|
||||
{
|
||||
UINT8 buf[2];
|
||||
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4646,7 +4784,11 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -5456,7 +5598,11 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal exitlevel command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -5474,7 +5620,11 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -5535,7 +5685,11 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -5578,7 +5732,6 @@ void Command_ExitGame_f(void)
|
||||
botskin = 0;
|
||||
cv_debug = 0;
|
||||
emeralds = 0;
|
||||
automapactive = false;
|
||||
|
||||
if (dirmenu)
|
||||
closefilemenu(true);
|
||||
@@ -5625,8 +5778,12 @@ static void Fishcake_OnChange(void)
|
||||
*/
|
||||
static void Command_Isgamemodified_f(void)
|
||||
{
|
||||
if (majormods || modifiedgame)
|
||||
CONS_Printf("The game has been modified, Record Attack data will be saved to a seperate savegame.\n");
|
||||
if (majormods)
|
||||
CONS_Printf("The game has been modified with major addons, so you cannot play Record Attack.\n");
|
||||
else if (savemoddata)
|
||||
CONS_Printf("The game has been modified with an addon with its own save data, so you can play Record Attack and earn medals.\n");
|
||||
else if (modifiedgame)
|
||||
CONS_Printf("The game has been modified with only minor addons. You can play Record Attack, earn medals and unlock extras.\n");
|
||||
else
|
||||
CONS_Printf("The game has not been modified. You can play Record Attack, earn medals and unlock extras.\n");
|
||||
}
|
||||
@@ -5916,7 +6073,7 @@ static void Command_ListSkins(void)
|
||||
}
|
||||
|
||||
static void Command_SkinSearch(void)
|
||||
{
|
||||
{
|
||||
size_t i;
|
||||
UINT16 s;
|
||||
UINT16 ic = 0;
|
||||
@@ -5926,7 +6083,7 @@ static void Command_SkinSearch(void)
|
||||
{
|
||||
skin_t *skininput = &skins[s];
|
||||
if (strcasestr(skininput->realname,COM_Argv(i)))
|
||||
{
|
||||
{
|
||||
ic++;
|
||||
CONS_Printf("%d. %s%s:\x80 %s\n", ic,HU_SkinColorToConsoleColor(skininput->prefcolor),skininput->realname,skininput->name);
|
||||
}
|
||||
@@ -6171,7 +6328,11 @@ void Got_DiscordInfo(UINT8 **p, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal Discord info command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-15
@@ -15,17 +15,8 @@
|
||||
#ifndef __D_NETCMD__
|
||||
#define __D_NETCMD__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "command.h"
|
||||
|
||||
void SendWeaponPref(void);
|
||||
void SendWeaponPref2(void);
|
||||
void SendWeaponPref3(void);
|
||||
void SendWeaponPref4(void);
|
||||
|
||||
// console vars
|
||||
extern consvar_t cv_playername;
|
||||
extern consvar_t cv_playercolor;
|
||||
@@ -158,9 +149,8 @@ extern consvar_t cv_pingstyle;
|
||||
//extern consvar_t cv_smallpos;
|
||||
extern consvar_t cv_showminimapnames;
|
||||
extern consvar_t cv_minihead;
|
||||
extern consvar_t cv_showminimapangle;
|
||||
|
||||
extern consvar_t cv_showlapemblem;
|
||||
extern consvar_t cv_showlapemblem;
|
||||
|
||||
extern consvar_t cv_showviewpointtext;
|
||||
extern consvar_t cv_showdownloadprompt;
|
||||
@@ -208,6 +198,8 @@ extern consvar_t cv_betainterscreen;
|
||||
|
||||
extern consvar_t cv_laglesscam;
|
||||
|
||||
extern consvar_t cv_verticallook;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SKINMENUTYPE_SCROLL = 0,
|
||||
@@ -327,8 +319,4 @@ void D_SetPassword(const char *pw);
|
||||
// used for the player setup menu
|
||||
UINT8 CanChangeSkin(INT32 playernum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+60
-79
@@ -64,11 +64,11 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
#if (LIBCURL_VERSION_MAJOR <= 7) && (LIBCURL_VERSION_MINOR < 35)
|
||||
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
#else
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 35, 0)
|
||||
static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
#define XFERINFOFUNCTION
|
||||
#else
|
||||
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -111,19 +111,27 @@ static fileused_t transferFiles[UINT8_MAX + 1];
|
||||
// Receiver structure
|
||||
INT32 fileneedednum; // Number of files needed to join the server
|
||||
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
|
||||
#ifdef HAVE_THREADS
|
||||
static I_mutex downloadmutex;
|
||||
#endif
|
||||
char downloaddir[512] = "DOWNLOAD";
|
||||
|
||||
file_download_t filedownload;
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// for cl loading screen
|
||||
INT32 lastfilenum = -1;
|
||||
INT32 downloadcompletednum = 0;
|
||||
UINT32 downloadcompletedsize = 0;
|
||||
INT32 totalfilesrequestednum = 0;
|
||||
UINT32 totalfilesrequestedsize = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
static CURL *http_handle;
|
||||
static CURLM *multi_handle;
|
||||
static UINT32 curl_dlnow;
|
||||
static UINT32 curl_dltotal;
|
||||
boolean curl_running = false;
|
||||
boolean curl_failedwebdownload = false;
|
||||
static double curl_dlnow;
|
||||
static double curl_dltotal;
|
||||
static time_t curl_starttime;
|
||||
INT32 curl_transfers = 0;
|
||||
static int curl_runninghandles = 0;
|
||||
static UINT32 curl_origfilesize;
|
||||
static UINT32 curl_origtotalfilesize;
|
||||
@@ -214,7 +222,6 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
||||
for (i = firstfile; i < fileneedednum; i++)
|
||||
{
|
||||
fileneeded[i].status = FS_NOTCHECKED; // We haven't even started looking for the file yet
|
||||
fileneeded[i].justdownloaded = false;
|
||||
filestatus = READUINT8(p); // The first byte is the file status
|
||||
fileneeded[i].willsend = (UINT8)(filestatus >> 4);
|
||||
fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size
|
||||
@@ -227,11 +234,10 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
||||
void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
||||
{
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
filedownload.current = -1;
|
||||
lastfilenum = -1;
|
||||
#endif
|
||||
fileneedednum = 1;
|
||||
fileneeded[0].status = FS_REQUESTED;
|
||||
fileneeded[0].justdownloaded = false;
|
||||
fileneeded[0].totalsize = UINT32_MAX;
|
||||
fileneeded[0].file = NULL;
|
||||
memset(fileneeded[0].md5sum, 0, 16);
|
||||
@@ -546,13 +552,13 @@ INT32 CL_CheckFiles(void)
|
||||
{
|
||||
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD || fileneeded[i].status == FS_FALLBACK)
|
||||
downloadrequired = true;
|
||||
|
||||
|
||||
if (fileneeded[i].status != FS_OPEN)
|
||||
filestoload++;
|
||||
|
||||
if (fileneeded[i].status != FS_NOTCHECKED) //since we're running this over multiple tics now, its possible for us to come across files checked in previous tics
|
||||
continue;
|
||||
|
||||
|
||||
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
||||
|
||||
// Check in already loaded files
|
||||
@@ -656,10 +662,13 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
||||
q = &((*q)->next);
|
||||
|
||||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)calloc(1, sizeof(filetx_t)); // Initialise with zeros
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("SV_SendFile: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
||||
// Allocate the file name
|
||||
p->id.filename = (char *)malloc(MAX_WADPATH);
|
||||
if (!p->id.filename)
|
||||
@@ -738,10 +747,13 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI
|
||||
q = &((*q)->next);
|
||||
|
||||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)calloc(1, sizeof(filetx_t)); // Initialise with zeros
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("SV_SendRam: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
||||
p->ram = freemethod; // Remember how to free the memory block for when we're done sending it
|
||||
p->id.ram = data;
|
||||
p->size = (UINT32)size;
|
||||
@@ -825,7 +837,6 @@ void SV_FileSendTicker(void)
|
||||
|
||||
netbuffer->packettype = PT_FILEFRAGMENT;
|
||||
|
||||
// (((sendbytes-nowsentbyte)*TICRATE)/(I_GetTime()-starttime)<(UINT32)net_bandwidth)
|
||||
while (packetsent-- && filestosend != 0)
|
||||
{
|
||||
for (i = currentnode, j = 0; j < MAXNETNODES;
|
||||
@@ -856,12 +867,8 @@ void SV_FileSendTicker(void)
|
||||
|
||||
if (!transferFiles[f->fileid].file)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Can't open file %s: %s\n",
|
||||
I_Error("Can't open file %s: %s",
|
||||
f->id.filename, strerror(errno));
|
||||
|
||||
SV_EndFileSend(i);
|
||||
HSendPacket(i, true, 0, PT_SERVERREFUSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -966,7 +973,7 @@ void Got_Filetxpak(void)
|
||||
|
||||
if (filenum >= fileneedednum)
|
||||
{
|
||||
DEBFILE(va("filefragment not needed %d>%d\n", filenum, fileneedednum));
|
||||
DEBFILE(va("fileframent not needed %d>%d\n", filenum, fileneedednum));
|
||||
//I_Error("Received an unneeded file fragment (file id received: %d, file id needed: %d)\n", filenum, fileneedednum);
|
||||
return;
|
||||
}
|
||||
@@ -987,7 +994,6 @@ void Got_Filetxpak(void)
|
||||
{
|
||||
UINT32 pos = LONG(netbuffer->u.filetxpak.position);
|
||||
UINT16 size = SHORT(netbuffer->u.filetxpak.size);
|
||||
|
||||
// Use a special trick to know when the file is complete (not always used)
|
||||
// WARNING: file fragments can arrive out of order so don't stop yet!
|
||||
if (pos & 0x80000000)
|
||||
@@ -1007,16 +1013,15 @@ void Got_Filetxpak(void)
|
||||
fclose(file->file);
|
||||
file->file = NULL;
|
||||
file->status = FS_FOUND;
|
||||
file->justdownloaded = true;
|
||||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||
filename);
|
||||
#ifndef NONET
|
||||
filedownload.completednum++;
|
||||
filedownload.completedsize += file->totalsize;
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += file->totalsize;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (!file->justdownloaded)
|
||||
else
|
||||
{
|
||||
const char *s;
|
||||
switch(file->status)
|
||||
@@ -1039,7 +1044,6 @@ void Got_Filetxpak(void)
|
||||
}
|
||||
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
||||
}
|
||||
|
||||
// Send ack back quickly
|
||||
if (++filetime == 3)
|
||||
{
|
||||
@@ -1048,7 +1052,7 @@ void Got_Filetxpak(void)
|
||||
}
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
filedownload.current = filenum;
|
||||
lastfilenum = filenum;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1197,7 +1201,9 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
||||
#ifdef HAVE_CURL
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
{
|
||||
return fwrite(ptr, size, nmemb, stream);
|
||||
size_t written;
|
||||
written = fwrite(ptr, size, nmemb, stream);
|
||||
return written;
|
||||
}
|
||||
|
||||
#ifdef XFERINFOFUNCTION
|
||||
@@ -1211,12 +1217,12 @@ static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t
|
||||
|
||||
curtime = time(NULL);
|
||||
|
||||
curl_dlnow = (UINT32)dlnow;
|
||||
curl_dltotal = (UINT32)dltotal;
|
||||
curl_dlnow = dlnow;
|
||||
curl_dltotal = dltotal;
|
||||
|
||||
if (curtime > curl_starttime)
|
||||
{
|
||||
getbytes = ((double)dlnow) / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1236,12 +1242,12 @@ static int curlprogress_callback(void *clientp, double dltotal, double dlnow, do
|
||||
|
||||
curtime = time(NULL);
|
||||
|
||||
curl_dlnow = (UINT32)dlnow;
|
||||
curl_dltotal = (UINT32)dltotal;
|
||||
curl_dlnow = dlnow;
|
||||
curl_dltotal = dltotal;
|
||||
|
||||
if (curtime > curl_starttime)
|
||||
{
|
||||
getbytes = ((double)dlnow) / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1283,10 +1289,10 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname));
|
||||
|
||||
// Only allow HTTP and HTTPS
|
||||
#if (LIBCURL_VERSION_MAJOR <= 7) && (LIBCURL_VERSION_MINOR < 85)
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
|
||||
#else
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 85, 0)
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
|
||||
#else
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
|
||||
#endif
|
||||
|
||||
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
|
||||
@@ -1308,21 +1314,6 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
|
||||
strcatbf(curl_curfile->filename, downloaddir, "/");
|
||||
curl_curfile->file = fopen(curl_curfile->filename, "wb");
|
||||
|
||||
if (!curl_curfile->file)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Couldnt open %s for writing!\nAborting file download.\nCheck if you have write access to your download folder!\n", curl_curfile->filename);
|
||||
CL_AbortConnection();
|
||||
M_StartMessage(M_GetText(
|
||||
"An error occured when trying to\n"
|
||||
"download missing addons.\n"
|
||||
"See the console or log file\n"
|
||||
"for additional details.\n\n"
|
||||
"Press ESC\n"
|
||||
), NULL, MM_NOTHING);
|
||||
return;
|
||||
}
|
||||
|
||||
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
|
||||
curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
|
||||
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
|
||||
@@ -1333,38 +1324,32 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
#endif
|
||||
|
||||
curl_curfile->status = FS_DOWNLOADING;
|
||||
lastfilenum = dfilenum;
|
||||
curl_multi_add_handle(multi_handle, http_handle);
|
||||
|
||||
curl_multi_perform(multi_handle, &curl_runninghandles);
|
||||
curl_starttime = time(NULL);
|
||||
|
||||
filedownload.current = dfilenum;
|
||||
filedownload.http_running = true;
|
||||
curl_running = true;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
filedownload.http_running = false;
|
||||
}
|
||||
|
||||
void CURLAbortFile(void)
|
||||
{
|
||||
filedownload.http_running = false;
|
||||
curl_running = false;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
// lock and unlock to wait for the download thread to exit
|
||||
I_lock_mutex(&downloadmutex);
|
||||
I_unlock_mutex(downloadmutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CURLGetFile(void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_lock_mutex(&downloadmutex);
|
||||
#endif
|
||||
CURLMcode mc; /* return code used by curl_multi_wait() */
|
||||
CURLcode easyres; /* Return from easy interface */
|
||||
CURLMsg *m; /* for picking up messages with the transfer status */
|
||||
@@ -1372,8 +1357,10 @@ void CURLGetFile(void)
|
||||
int msgs_left; /* how many messages are left */
|
||||
const char *easy_handle_error;
|
||||
boolean running = true;
|
||||
long response_code = 0;
|
||||
static char *filename;
|
||||
|
||||
while (running && filedownload.http_running)
|
||||
while (running && curl_running)
|
||||
{
|
||||
if (curl_runninghandles)
|
||||
{
|
||||
@@ -1387,7 +1374,6 @@ void CURLGetFile(void)
|
||||
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc);
|
||||
continue;
|
||||
}
|
||||
|
||||
curl_curfile->currentsize = curl_dlnow;
|
||||
curl_curfile->totalsize = curl_dltotal;
|
||||
}
|
||||
@@ -1401,13 +1387,11 @@ void CURLGetFile(void)
|
||||
e = m->easy_handle;
|
||||
easyres = m->data.result;
|
||||
|
||||
char *filename = Z_StrDup(curl_realname);
|
||||
filename = Z_StrDup(curl_realname);
|
||||
nameonly(filename);
|
||||
|
||||
if (easyres != CURLE_OK)
|
||||
{
|
||||
long response_code = 0;
|
||||
|
||||
if (easyres == CURLE_HTTP_RETURNED_ERROR)
|
||||
curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
|
||||
@@ -1415,7 +1399,7 @@ void CURLGetFile(void)
|
||||
curl_curfile->status = FS_FALLBACK;
|
||||
curl_curfile->currentsize = curl_origfilesize;
|
||||
curl_curfile->totalsize = curl_origtotalfilesize;
|
||||
filedownload.http_failed = true;
|
||||
curl_failedwebdownload = true;
|
||||
fclose(curl_curfile->file);
|
||||
remove(curl_curfile->filename);
|
||||
CONS_Printf(M_GetText("Failed to download %s (%s)\n"), filename, easy_handle_error);
|
||||
@@ -1428,40 +1412,37 @@ void CURLGetFile(void)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("HTTP Download of %s finished but is corrupt or has been modified\n"), filename);
|
||||
curl_curfile->status = FS_FALLBACK;
|
||||
filedownload.http_failed = true;
|
||||
curl_failedwebdownload = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Finished HTTP download of %s\n"), filename);
|
||||
filedownload.completednum++;
|
||||
filedownload.completedsize += curl_curfile->totalsize;
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += curl_curfile->totalsize;
|
||||
curl_curfile->status = FS_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
Z_Free(filename);
|
||||
curl_curfile->file = NULL;
|
||||
filedownload.remaining--;
|
||||
curl_transfers--;
|
||||
curl_multi_remove_handle(multi_handle, e);
|
||||
curl_easy_cleanup(e);
|
||||
|
||||
if (!filedownload.remaining)
|
||||
if (!curl_transfers)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!filedownload.remaining || !filedownload.http_running)
|
||||
if (!curl_transfers || !curl_running)
|
||||
{
|
||||
curl_multi_cleanup(multi_handle);
|
||||
curl_global_cleanup();
|
||||
multi_handle = NULL;
|
||||
}
|
||||
|
||||
filedownload.http_running = false;
|
||||
#ifdef HAVE_THREADS
|
||||
curl_running = false;
|
||||
I_unlock_mutex(downloadmutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
HTTP_login *
|
||||
|
||||
+8
-28
@@ -13,11 +13,6 @@
|
||||
#ifndef __D_NETFIL__
|
||||
#define __D_NETFIL__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "d_clisrv.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
typedef enum
|
||||
@@ -50,35 +45,24 @@ typedef struct
|
||||
UINT32 currentsize;
|
||||
UINT32 totalsize;
|
||||
filestatus_t status; // The value returned by recsearch
|
||||
boolean justdownloaded; // To prevent late fragments from causing an I_Error
|
||||
} fileneeded_t;
|
||||
|
||||
extern INT32 fileneedednum;
|
||||
extern fileneeded_t fileneeded[MAX_WADFILES];
|
||||
extern char downloaddir[512];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
INT32 current;
|
||||
INT32 completednum;
|
||||
UINT32 completedsize;
|
||||
INT32 totalnum;
|
||||
UINT32 totalsize;
|
||||
extern INT32 lastfilenum;
|
||||
extern INT32 downloadcompletednum;
|
||||
extern UINT32 downloadcompletedsize;
|
||||
extern INT32 totalfilesrequestednum;
|
||||
extern UINT32 totalfilesrequestedsize;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
INT32 remaining;
|
||||
boolean http_failed;
|
||||
boolean http_running;
|
||||
|
||||
char http_source[MAX_MIRROR_LENGTH+1];
|
||||
#endif
|
||||
} file_download_t;
|
||||
|
||||
extern file_download_t filedownload;
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
extern boolean curl_failedwebdownload;
|
||||
extern boolean curl_running;
|
||||
extern INT32 curl_transfers;
|
||||
|
||||
typedef struct HTTP_login HTTP_login;
|
||||
|
||||
@@ -129,8 +113,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);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __D_NETFIL__
|
||||
+1
-13
@@ -356,16 +356,6 @@ typedef enum
|
||||
LAP__MAX
|
||||
} laptime_e;
|
||||
|
||||
// yes i made a whole struct for this :chonkbuncle:
|
||||
typedef struct squishdance_s
|
||||
{
|
||||
tic_t countdown; // hold "custom 3" for 2 seconds to engange le dance
|
||||
tic_t time;
|
||||
fixed_t work;
|
||||
fixed_t ang;
|
||||
fixed_t bounce; // hehe squishy
|
||||
} squishdance_t;
|
||||
|
||||
// ========================================================================
|
||||
// PLAYER STRUCTURE
|
||||
// ========================================================================
|
||||
@@ -412,7 +402,7 @@ typedef struct player_s
|
||||
INT32 kartstuff[NUMKARTSTUFF];
|
||||
angle_t frameangle; // for the player add the ability to have the sprite only face other angles
|
||||
angle_t old_frameangle, old_frameangle2;
|
||||
|
||||
|
||||
// SRB2Kart CEP: Sliptide rolling
|
||||
angle_t sliproll;
|
||||
|
||||
@@ -565,8 +555,6 @@ typedef struct player_s
|
||||
|
||||
fixed_t spinoutrot; // When a player spins out, this value increments modulus 360.
|
||||
|
||||
squishdance_t squishdance;
|
||||
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
} player_t;
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#ifndef __D_THINK__
|
||||
#define __D_THINK__
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
@@ -52,10 +50,6 @@ typedef struct thinker_s
|
||||
// this one using pointers. Used for garbage collection.
|
||||
INT32 references;
|
||||
boolean cachable;
|
||||
#ifdef PARANOIA
|
||||
INT32 debug_mobjtype;
|
||||
tic_t debug_time;
|
||||
#endif
|
||||
} thinker_t;
|
||||
|
||||
#endif
|
||||
@@ -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,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;
|
||||
}
|
||||
+6
-6
@@ -28,7 +28,7 @@
|
||||
#include "p_local.h" // for var1 and var2, and some constants
|
||||
#include "p_setup.h"
|
||||
#include "r_data.h"
|
||||
#include "r_fps.h"
|
||||
#include "r_patch.h"
|
||||
#include "r_sky.h"
|
||||
#include "r_draw.h" // translation colormap consts (for lua)
|
||||
#include "fastcmp.h"
|
||||
@@ -1799,7 +1799,7 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
|
||||
* \sa readmaincfg()
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
/*static boolean GoodDataFileName(const char *s)
|
||||
static boolean GoodDataFileName(const char *s)
|
||||
{
|
||||
const char *p;
|
||||
const char *tail = ".dat";
|
||||
@@ -1819,7 +1819,7 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
|
||||
if (fasticmp(s, "online.dat")) return false; // SRB2Kart online replay folder
|
||||
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
|
||||
static void reademblemdata(MYFILE *f, INT32 num)
|
||||
{
|
||||
@@ -2597,10 +2597,10 @@ static void readmaincfg(MYFILE *f)
|
||||
{
|
||||
maxXtraLife = (UINT8)get_number(word2);
|
||||
}
|
||||
|
||||
else if (fastcmp(word, "GAMEDATA"))
|
||||
{
|
||||
// just ignore it but dont throw a warning
|
||||
/*size_t filenamelen;
|
||||
size_t filenamelen;
|
||||
|
||||
// Check the data filename so that mods
|
||||
// can't write arbitrary files.
|
||||
@@ -2624,7 +2624,7 @@ static void readmaincfg(MYFILE *f)
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
|
||||
refreshdirmenu |= REFRESHDIR_GAMEDATA;*/
|
||||
refreshdirmenu |= REFRESHDIR_GAMEDATA;
|
||||
}
|
||||
else if (fastcmp(word, "RESETDATA"))
|
||||
{
|
||||
|
||||
+4
-10
@@ -388,7 +388,7 @@ static void DRPC_GotServerIP(UINT32 address)
|
||||
--------------------------------------------------*/
|
||||
static const char *DRPC_GetServerIP(void)
|
||||
{
|
||||
const char *address;
|
||||
const char *address;
|
||||
|
||||
// If you're connected
|
||||
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
|
||||
@@ -489,7 +489,7 @@ void DRPC_UpdatePresence(void)
|
||||
{
|
||||
#endif
|
||||
discordPresence.state = "Private";
|
||||
#ifdef MASTERSERVER
|
||||
#ifdef MASTERSERVER
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -571,15 +571,9 @@ void DRPC_UpdatePresence(void)
|
||||
{
|
||||
// Map name on tool tip
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
if (title)
|
||||
{
|
||||
snprintf(mapname, 48, "Map: %s", title);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
snprintf(mapname, 48, "Map: UNKNOWN");
|
||||
|
||||
snprintf(mapname, 48, "Map: %s", title);
|
||||
discordPresence.largeImageText = mapname;
|
||||
Z_Free(title);
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL && Playing())
|
||||
|
||||
+10
-35
@@ -58,9 +58,6 @@
|
||||
// warning C4152: nonstandard extension, function/data pointer conversion in expression
|
||||
// warning C4213: nonstandard extension used : cast on l-value
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
@@ -116,8 +113,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v8.2"
|
||||
#define VERSIONSTRINGW L"Saturn v8.2"
|
||||
#define VERSIONSTRING "Saturn v7.2"
|
||||
#define VERSIONSTRINGW L"Saturn v7.2"
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
// AND appveyor.yml, for the build bots!
|
||||
@@ -527,15 +524,12 @@ UINT32 quickncasehash (const char *p, size_t n)
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef min // Double-Check with WATTCP-32's cdefs.h
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
#ifndef max // Double-Check with WATTCP-32's cdefs.h
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
|
||||
#endif
|
||||
@@ -553,27 +547,6 @@ UINT32 quickncasehash (const char *p, size_t n)
|
||||
#define DBL_EPSILON 2.2204460492503131e-16l
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#ifndef LIKELY
|
||||
#define LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
#endif
|
||||
|
||||
#ifndef UNLIKELY
|
||||
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
#endif
|
||||
#else
|
||||
#define LIKELY(x) (x)
|
||||
#define UNLIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
|
||||
#define restrict __restrict
|
||||
#else
|
||||
#define restrict
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// An assert-type mechanism.
|
||||
#ifdef PARANOIA
|
||||
#define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
|
||||
@@ -598,15 +571,21 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
#ifndef NONET
|
||||
//-- SATURN __
|
||||
/// Enable gamestate resynching between Saturn servers and clients
|
||||
/// Like SRB2 and RR does
|
||||
/// Still highly experimental
|
||||
#ifdef DOSATURNSYNCH
|
||||
#define SATURNSYNCH
|
||||
|
||||
/// Detect if a client is on Saturn in the clientconfig.
|
||||
/// To seperately allow them to join or block joining from vanilla clients.
|
||||
#ifdef DOSATURNJOIN
|
||||
#define SATURNJOIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// Server detection for if a connecting client is on Saturn.
|
||||
/// This also enables gamestate resynching between Saturn servers and clients
|
||||
/// Like SRB2 and RR does
|
||||
/// For stuff like extra synching, etc.
|
||||
#ifdef DOSATURNPAK
|
||||
#define SATURNPAK
|
||||
#endif
|
||||
@@ -671,8 +650,4 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
#undef UPDATE_ALERT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
Loaded 100 of 341 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user