Merge remote-tracking branch 'origin/Saturn-Next' into unnestmothink

This commit is contained in:
Alug committed 2025-06-19 15:56:32 +02:00
commit 83bb908ff0
112 files changed
+6181 -1805

No files matched your search

+8 -7
View File
@@ -13,16 +13,17 @@ Win32_LIB_ASM_Release
*.dgb
*.debug
*.debug.txt
/bin/VC10/
/objs/VC10/
*.user
*.db
*.opendb
/.vs
/debian
/assets/debian
compile.sh
*.gz
.vscode/
out
build
/make
/bin
/build
/build/*
/CMakeUserPresets.json
/out
/objs/VC10
*.kate-swp
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-1
View File
@@ -1 +0,0 @@
/lsdlsrb2
-3
View File
@@ -1,3 +0,0 @@
/lsdlsrb2
/pnd
/*.mo
-1
View File
@@ -1 +0,0 @@
/lsdlsrb2
-1
View File
@@ -1 +0,0 @@
/lsdl2srb2kart
-4
View File
@@ -1,4 +0,0 @@
*.exe
*.mo
r_opengl.dll
*.bat
-4
View File
@@ -1,4 +0,0 @@
*.exe
*.mo
r_opengl.dll
*.bat
-3
View File
@@ -1,3 +0,0 @@
/srb2sdl.exe
/srb2win.exe
/r_opengl.dll
-4
View File
@@ -1,4 +0,0 @@
*.exe
*.mo
r_opengl.dll
*.bat
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
+9 -8
View File
@@ -1,5 +1,5 @@
/* backtrace.h -- Public header file for stack backtrace library.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Copyright (C) 2012-2024 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
@@ -54,13 +54,14 @@ 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, 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, 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. */
typedef void (*backtrace_error_callback) (void *data, const char *msg,
int errnum);
Binary file not shown.
-8
View File
@@ -1,8 +0,0 @@
#All folders
SRB2.res
depend.dep
depend.ped
*.o
#VC9 folder only
/VC9/Win32
/VC9/x64
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
-2
View File
@@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing
+13 -1
View File
@@ -228,6 +228,14 @@ 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
@@ -554,7 +562,11 @@ add_definitions(-DCMAKECONFIG)
# ${SRB2_BLUA_HEADERS}
#)
add_subdirectory(sdl)
if(${SRB2_CONFIG_DEDICATED})
add_subdirectory(dedicated)
else()
add_subdirectory(sdl)
endif()
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(")
+357 -710
View File
File diff suppressed because it is too large. Load diff
+21
View File
@@ -0,0 +1,21 @@
makedir:=$(makedir)/Dedicated
sources+=$(call List,dedicated/Sourcefile)
opts+=-DDEDICATED
libs+=-lpthread
ifdef MINGW
libs+=-mconsole
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=dedicated/i_threads.c
endif
NOOPENMPT=1
NOGME=1
NOHW=1
NOUPNP=1
+124
View File
@@ -0,0 +1,124 @@
#
# 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
+106
View File
@@ -0,0 +1,106 @@
#
# 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))))
+71
View File
@@ -0,0 +1,71 @@
#
# 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))
+47
View File
@@ -0,0 +1,47 @@
#
# 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
+16
View File
@@ -0,0 +1,16 @@
#
# 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
+76
View File
@@ -0,0 +1,76 @@
#
# 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
+71
View File
@@ -0,0 +1,71 @@
#
# Makefile options for SDL2 backend.
#
#
# SDL...., *looks at Alam*, THIS IS A MESS!
#
# ...a little bird flexes its muscles...
#
makedir:=$(makedir)/SDL
sources+=$(call List,sdl/Sourcefile)
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
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
+93
View File
@@ -0,0 +1,93 @@
#
# 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,@)
+178
View File
@@ -0,0 +1,178 @@
#
# 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))))))
# -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
+124
View File
@@ -0,0 +1,124 @@
#
# 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))
+96
View File
@@ -0,0 +1,96 @@
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.c
r_patch.c
r_patchrotation.c
r_plane.c
r_segs.c
r_sky.c
r_splats.c
r_things.c
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
+7 -3
View File
@@ -197,7 +197,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; // the player represented by an arrow
static player_t *plr = NULL; // the player represented by an arrow
static boolean followplayer = true; // specifies whether to follow the player around
@@ -237,7 +237,7 @@ static inline void AM_restoreScaleAndLoc(void)
m_x = old_m_x;
m_y = old_m_y;
}
else
else if (plr && plr->mo)
{
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
@@ -318,7 +318,8 @@ static void AM_initVariables(void)
break;
plr = &players[pnum];
if (plr != NULL && plr->mo != NULL)
if (plr && plr->mo)
{
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
@@ -597,6 +598,9 @@ 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;
-55
View File
@@ -1,55 +0,0 @@
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
+26
View File
@@ -0,0 +1,26 @@
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
+35 -15
View File
@@ -240,7 +240,6 @@ void COM_ImmedExecute(const char *ptext)
while (i < strlen(ptext))
{
quotes = 0;
for (j = 0; i < strlen(ptext); i++,j++)
{
@@ -817,12 +816,17 @@ 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)
@@ -832,30 +836,43 @@ 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"))
{
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value,
cvar->PossibleValue[1].value);
i = 2;
}
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;
}
{
const char *cvalue = NULL;
//CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name);
while (cvar->PossibleValue[i].strvalue)
{
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
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);
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);
}
@@ -1026,7 +1043,10 @@ static void COM_Add_f(void)
}
if (( cvar->flags & CV_FLOAT ))
CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2))));
{
float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2));
CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n)));
}
else
CV_AddValue(cvar, atoi(COM_Argv(2)));
}
+158 -35
View File
@@ -87,6 +87,9 @@ boolean serverrunning = false;
INT32 serverplayer = 0;
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
plrinfo playerinfo[MAXPLAYERS];
SINT8 joinnode = 0; // used for CL_VIEWSERVER
// Server specific vars
UINT8 playernode[MAXPLAYERS];
@@ -95,7 +98,7 @@ UINT8 playernode[MAXPLAYERS];
tic_t jointimeout = (3*TICRATE);
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
#ifdef SATURNPAK
static boolean resendingsavegame[MAXNETNODES]; // Are we resending the savegame?
static tic_t resendingsavegame[MAXNETNODES]; // Are we resending the savegame?
static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can resend again?
#endif
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
@@ -1068,6 +1071,7 @@ static void SV_RequireResynch(INT32 node)
// Initial setup
memset(resynch_sent[node], 0, MAXPLAYERS);
for (i = 0; i < MAXPLAYERS; ++i)
{
if (!playeringame[i]) // Player not in game so just drop it from required synch
@@ -1184,6 +1188,7 @@ typedef enum
#endif
CL_CONNECTED,
CL_ABORTED,
CL_VIEWSERVER,
CL_ASKFULLFILELIST,
CL_CONFIRMCONNECT,
#ifdef HAVE_CURL
@@ -1247,7 +1252,7 @@ static inline void CL_DrawConnectionStatus(void)
if (!menuactive) // menu already draws its own fade
V_DrawFadeScreen(0xFF00, 16); // force default
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES && cl_mode != CL_VIEWSERVER
#ifdef HAVE_CURL
&& cl_mode != CL_DOWNLOADHTTPFILES
#endif
@@ -1367,6 +1372,78 @@ static inline void CL_DrawConnectionStatus(void)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
va(" %2u/%2u Files",loadcompletednum,fileneedednum));
}
else if (cl_mode == CL_VIEWSERVER)
{
V_DrawFill(8, 16, BASEVIDWIDTH - 16, 54, 239);
V_DrawThinString(12 + 80, 18, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.servername));
const char *map = va("%sP", serverlist[joinnode].info.mapname);
patch_t *current_map = W_LumpExists(map) ? W_CachePatchName(map, PU_CACHE) : W_CachePatchName("BLANKLVL", PU_CACHE);
V_DrawSmallScaledPatch(10, 18, 0, current_map);
V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.maptitle));
V_DrawThinString(12 + 80, 48, V_ALLOWLOWERCASE, va("%s", Gametype_Names[serverlist[joinnode].info.gametype]));
if (fileneedednum > 0)
{
V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_ORANGEMAP, va("%i Addons", fileneedednum));
}
else
{
V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_YELLOWMAP, "Vanilla");
}
if (serverlist[joinnode].info.cheatsenabled)
{
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, 58, V_ALLOWLOWERCASE|V_GREENMAP, "Cheats");
}
V_DrawFill(8, 72, BASEVIDWIDTH - 16, 112, 239);
V_DrawString(12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, "Players");
V_DrawRightAlignedString(BASEVIDWIDTH - 12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, va("%i / %i", serverlist[joinnode].info.numberofplayer, serverlist[joinnode].info.maxplayer));
INT32 i;
INT32 count = 0;
INT32 x = 14;
INT32 y = 84;
INT32 statuscolor = 1;
char player_name[MAXPLAYERNAME+1];
if (serverlist[joinnode].info.numberofplayer > 0)
{
for (i = 0; i < MAXPLAYERS; i++)
{
if (playerinfo[i].node < 255)
{
strncpy(player_name, playerinfo[i].name, MAXPLAYERNAME);
V_DrawThinString(x + 10, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, player_name);
if (playerinfo[i].team == 0) { statuscolor = 184; } // playing
if (playerinfo[i].data & 0x20) { statuscolor = 86; } // tag IT
if (playerinfo[i].team == 1) { statuscolor = 128; } // ctf red team
if (playerinfo[i].team == 2) { statuscolor = 232; } // ctf blue team
if (playerinfo[i].team == 255) { statuscolor = 16; } // spectator or non-team
V_DrawFill(x, y, 7, 7, 31);
V_DrawFill(x, y, 6, 6, statuscolor);
y += 9;
count++;
if ((count == 11) || (count == 22))
{
x += 104;
y = 84;
}
}
}
}
// Buttons
V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239);
V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80"));
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80"));
}
else if (filedownload.current != -1)
{
INT32 dldlength;
@@ -1687,13 +1764,7 @@ static void SV_SendPlayerInfo(INT32 node)
for (i = 0; i < MSCOMPAT_MAXPLAYERS; i++)
{
if (i >= MAXPLAYERS)
{
netbuffer->u.playerinfo[i].node = 255;
continue;
}
if (playeringame[i] == UINT8_MAX || !playeringame[i])
if ((i >= MAXPLAYERS) || !playeringame[i])
{
netbuffer->u.playerinfo[i].node = 255; // This slot is empty.
continue;
@@ -1778,8 +1849,6 @@ static boolean SV_SendServerConfig(INT32 node)
memset(netbuffer->u.servercfg.playerskins, 0xFF, sizeof(netbuffer->u.servercfg.playerskins));
memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor));
memset(netbuffer->u.servercfg.adminplayers, -1, sizeof(netbuffer->u.servercfg.adminplayers));
for (i = 0; i < MAXPLAYERS; i++)
{
netbuffer->u.servercfg.adminplayers[i] = (SINT8)adminplayers[i];
@@ -2476,6 +2545,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
if (i < 0)
return true;
}
joinnode = i;
// Quit here rather than downloading files and being refused later.
if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer)
@@ -2502,7 +2572,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
return true;
}
cl_mode = CL_CHECKFILES;
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
}
else
{
@@ -2556,7 +2626,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
case CL_ASKFULLFILELIST:
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
cl_mode = CL_CHECKFILES;
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
{
if (CL_AskFileList(fileneedednum))
@@ -2722,6 +2792,15 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
D_ProcessEvents(); //needed for menu system to receive inputs
key = I_GetKey();
if (cl_mode == CL_VIEWSERVER)
{
if (key == KEY_ENTER || key == KEY_JOY1)
cl_mode = CL_CHECKFILES;
else if (key == KEY_ESCAPE || key == KEY_JOY1+1)
cl_mode = CL_ABORTED;
}
// Only ESC and non-keyboard keys abort connection
if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED))
{
@@ -3275,7 +3354,7 @@ void CL_ClearPlayer(INT32 playernum)
P_RemoveMobj(players[playernum].mo);
}
memset(&players[playernum], 0, sizeof (player_t));
memset(&players[playernum], 0, sizeof(player_t));
}
//
@@ -4149,6 +4228,8 @@ consvar_t cv_downloadspeed = {"downloadspeed", "300", CV_SAVE, downloadspeed_con
static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}};
consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_serverinfoscreen = {"serverinfoscreen", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void Got_AddPlayer(UINT8 **p, INT32 playernum);
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
@@ -4251,7 +4332,7 @@ static void ResetNode(INT32 node)
// SATURN
#ifdef SATURNPAK
is_client_saturn[node] = false;
resendingsavegame[node] = false;
resendingsavegame[node] = 0;
savegameresendcooldown[node] = 0;
gamestate_resend_counter[node] = 0;
#endif
@@ -4284,14 +4365,14 @@ void SV_ResetServer(void)
sprintf(player_names[i], "Player %d", i + 1);
}
memset(player_name_changes, 0, sizeof player_name_changes);
memset(player_name_changes, 0, sizeof(player_name_changes));
memset(playeringame, false, sizeof playeringame);
memset(playernode, UINT8_MAX, sizeof playernode);
memset(playeringame, false, sizeof(playeringame));
memset(playernode, UINT8_MAX, sizeof(playernode));
pingmeasurecount = 1;
memset(realpingtable, 0, sizeof realpingtable);
memset(playerpingtable, 0, sizeof playerpingtable);
memset(realpingtable, 0, sizeof(realpingtable));
memset(playerpingtable, 0, sizeof(playerpingtable));
ClearAdminPlayers();
@@ -4916,6 +4997,16 @@ static void HandleServerInfo(SINT8 node)
if (client && cl_mode > CL_SEARCHING && node == servernode)
memcpy(connectedservername, netbuffer->u.serverinfo.servername, MAXSERVERNAME);
}
static void HandlePlayerInfo(SINT8 node)
{
(void)node;
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)
playerinfo[i] = netbuffer->u.playerinfo[i];
}
#endif
#ifdef SATURNPAK
@@ -4952,7 +5043,7 @@ static void PT_CanReceiveGamestate(SINT8 node)
CONS_Printf(M_GetText("Resending game state to %s...\n"), player_names[nodetoplayer[node]]);
SV_SendSaveGame(node, true); // Resend a complete game state
resendingsavegame[node] = true;
resendingsavegame[node] = 1;
}
#endif
@@ -5204,6 +5295,10 @@ static void HandlePacketFromAwayNode(SINT8 node)
case PT_CLIENTCMD:
break; // This is not an "unknown packet"
case PT_PLAYERINFO:
HandlePlayerInfo(node);
break;
case PT_SERVERTICS:
// Do not remove my own server (we have just get a out of order packet)
@@ -5324,18 +5419,18 @@ static void HandlePacketFromPlayer(SINT8 node)
/// \todo Use a separate cvar for that kind of timeout?
freezetimeout[node] = I_GetTime() + connectiontimeout;
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
tic_t faketic = maketic;
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
&& (maketic - firstticstosend < TICQUEUE - 1))
faketic++;
// Don't do anything for packets of type NODEKEEPALIVE?
// Sryder 2018/07/01: Update the freezetimeout still!
if (netbuffer->packettype == PT_NODEKEEPALIVE
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS)
break;
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
tic_t faketic = maketic;
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
&& (maketic - firstticstosend < TICQUEUE - 1))
faketic++;
// Copy ticcmd
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1);
@@ -5395,11 +5490,11 @@ static void HandlePacketFromPlayer(SINT8 node)
// Check player consistancy during the level
if (gamestate == GS_LEVEL
&& (realstart > gametic - TICQUEUE+1 && realstart <= gametic)
&& (realstart <= gametic && realstart + TICQUEUE - 1 > gametic)
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
&& (!UseSaturnSynch(node) || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
{
resendingsavegame[node] = false; // reset this before just in case
resendingsavegame[node] = 0; // reset this before just in case
// Check if a client is saturn before sending ANYTHING!
// this way we only send stuff to clients we know can use the gamestate resend
@@ -5409,7 +5504,7 @@ static void HandlePacketFromPlayer(SINT8 node)
// Tell the client we are about to resend them the gamestate
netbuffer->packettype = PT_WILLRESENDGAMESTATE;
HSendPacket(node, true, 0, 0);
resendingsavegame[node] = true;
resendingsavegame[node] = 1;
}
else if (UseVanillaSynch(node))
{
@@ -5425,10 +5520,13 @@ static void HandlePacketFromPlayer(SINT8 node)
}
if (cv_blamecfail.value)
{
CONS_Printf(M_GetText("Synch failure for player %d (%s); expected %hd, got %hd\n"),
netconsole+1, player_names[netconsole],
consistancy[realstart%TICQUEUE],
SHORT(netbuffer->u.clientpak.consistancy));
}
DEBFILE(va("Restoring player %d (synch failure) [%update] %d!=%d\n",
netconsole, realstart, consistancy[realstart%TICQUEUE],
SHORT(netbuffer->u.clientpak.consistancy)));
@@ -5700,7 +5798,7 @@ static void HandlePacketFromPlayer(SINT8 node)
break;
}
//Update client ping table from the server.
// Update client ping table from the server.
if (client)
{
UINT8 i;
@@ -5736,7 +5834,7 @@ static void HandlePacketFromPlayer(SINT8 node)
break;
case PT_RECEIVEDGAMESTATE:
sendingsavegame[node] = false;
resendingsavegame[node] = false;
resendingsavegame[node] = 0;
savegameresendcooldown[node] = I_GetTime() + cv_resynchcooldown.value * TICRATE; // I_GetTime() + 5 * TICRATE;
break;
case PT_WILLRESENDGAMESTATE:
@@ -5796,8 +5894,9 @@ static void GetPackets(void)
}
#endif
if (netbuffer->packettype == PT_PLAYERINFO)
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
/*if (netbuffer->packettype == PT_PLAYERINFO)
continue; // We do nothing with PLAYERINFO, that's for the MS browser. Not quite true anymore :p*/
// We also count unknown packets, hence "<="
if (netbuffer->packettype <= NUMPACKETTYPE)
@@ -6366,10 +6465,35 @@ static void SV_Maketic(void)
maketic++;
}
#ifdef SATURNPAK
static void SV_UpdateResendGamestateTimeout(void)
{
for (INT32 i = 0; i < MAXNETNODES; ++i)
{
if (!resendingsavegame[i])
continue;
resendingsavegame[i]++;
// Resending savegame took too long
if (resendingsavegame[i] > (tic_t)TICRATE*cv_pingtimeout.value)
{
resendingsavegame[i] = 0;
SendKick(i, KICK_MSG_CON_FAIL);
}
}
}
#endif
boolean TryRunTics(tic_t realtics)
{
boolean ticking;
#ifdef SATURNPAK
if (server)
SV_UpdateResendGamestateTimeout();
#endif
// the machine has lagged but it is not so bad
if (realtics > TICRATE/7) // FIXME: consistency failure!!
{
@@ -6510,7 +6634,6 @@ static inline void PingUpdate(void)
if (pingtimeout[i] > 0)
pingtimeout[i]--;
}
}
//kick lagging players... unless everyone but the server's ping sucks.
+5
View File
@@ -577,6 +577,9 @@ 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;
@@ -608,6 +611,8 @@ 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);
+127 -122
View File
@@ -197,12 +197,10 @@ static void D_PadMenuScrollInput(UINT8 input)
// and pass it to the eventlist
static void D_GamePadMenuScrollTicker(void)
{
UINT8 i;
static UINT8 menuInputDelayTimer = 0;
if (dedicated)
return;
for (UINT8 i = 0; i < 4; i++)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (dpadscrollstate[i])
{
@@ -222,10 +220,10 @@ static void D_GamePadMenuScrollTicker(void)
static void D_DeviceLEDTick(void)
{
UINT8 i;
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0};
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0};
if (dedicated || numcontrollers == 0)
if (numcontrollers == 0)
{
return;
}
@@ -252,7 +250,6 @@ static void D_DeviceLEDTick(void)
void D_ProcessEvents(void)
{
event_t *ev;
boolean eaten;
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
@@ -291,8 +288,10 @@ void D_ProcessEvents(void)
// Demo input:
if (demo.playback)
{
if (M_DemoResponder(ev))
continue; // demo ate the event
}
// console input
#ifdef HAVE_THREADS
@@ -317,6 +316,88 @@ void D_ProcessEvents(void)
// draw current display, possibly wiping it from the previous
//
static void D_Renderview(void)
{
UINT8 i;
if (automapactive)
return;
R_ApplyLevelInterpolators(rendertimefrac);
for (i = 0; i <= splitscreen; i++)
{
const boolean issplitscreen = (i > 0);
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
{
viewssnum = i;
if (!issplitscreen) // Initialize for P1
{
viewwindowy = viewwindowx = 0;
topleft = screens[0];
objectsdrawn = 0;
}
#ifdef HWRENDER
if (rendermode == render_opengl)
{
HWR_RenderPlayerView();
R_RestoreLevelInterpolators();
continue;
}
#endif
if (issplitscreen) // Splitscreen-specific
{
const INT32 len = viewheight*sizeof(ylookup[0]);
switch (i)
{
case 1:
if (splitscreen > 1)
{
viewwindowx = viewwidth;
viewwindowy = 0;
}
else
{
viewwindowx = 0;
viewwindowy = viewheight;
}
M_Memcpy(ylookup, ylookup2, len);
break;
case 2:
viewwindowx = 0;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup3, len);
break;
case 3:
viewwindowx = viewwidth;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup4, len);
default:
break;
}
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
}
R_RenderPlayerView(&players[displayplayers[i]]);
if (issplitscreen)
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
if (!issplitscreen)
R_ApplyViewMorph();
V_DoPostProcessor(i, postimgparam[i]);
}
R_RestoreLevelInterpolators();
}
// wipegamestate can be set to -1 to force a wipe on the next draw
// added comment : there is a wipe eatch change of the gamestate
gamestate_t wipegamestate = GS_LEVEL;
@@ -327,7 +408,6 @@ static boolean D_Display(void)
boolean forcerefresh = false;
static boolean wipe = false;
INT32 wipedefindex = 0;
UINT8 i;
if (!dedicated)
{
@@ -366,6 +446,7 @@ static boolean D_Display(void)
{
// set for all later
wipedefindex = gamestate; // wipe_xxx_toblack
if (gamestate == GS_TITLESCREEN && wipegamestate != GS_INTRO)
wipedefindex = wipe_timeattack_toblack;
else if (gamestate == GS_INTERMISSION)
@@ -378,26 +459,28 @@ static boolean D_Display(void)
if (!dedicated)
{
// Fade to black first
if (gamestate != GS_LEVEL // fades to black on its own timing, always
&& wipedefs[wipedefindex] != UINT8_MAX)
if (gamestate != GS_LEVEL)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
ranwipe = true;
}
// Fade to black first
if (wipedefs[wipedefindex] != UINT8_MAX) // fades to black on its own timing, always
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
ranwipe = true;
}
if (gamestate != GS_LEVEL && rendermode != render_none)
{
V_SetPaletteLump("PLAYPAL"); // Reset the palette
R_ReInitColormaps(0, LUMPERROR);
if (rendermode != render_none)
{
V_SetPaletteLump("PLAYPAL"); // Reset the palette
R_ReInitColormaps(0, LUMPERROR);
}
}
F_WipeStartScreen();
}
else //dedicated servers
else // dedicated servers
{
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
ranwipe = true;
@@ -405,7 +488,7 @@ static boolean D_Display(void)
}
}
if (dedicated) //bail out after wipe logic
if (dedicated) // bail out after wipe logic
return false;
// do buffered drawing
@@ -430,9 +513,6 @@ static boolean D_Display(void)
HU_Drawer();
break;
case GS_TIMEATTACK:
break;
case GS_INTRO:
F_IntroDrawer();
if (wipegamestate == (gamestate_t)-1)
@@ -484,6 +564,7 @@ static boolean D_Display(void)
HU_Erase();
HU_Drawer();
}
case GS_TIMEATTACK:
case GS_DEDICATEDSERVER:
case GS_NULL:
break;
@@ -492,89 +573,10 @@ static boolean D_Display(void)
if (gamestate == GS_LEVEL)
{
// draw the view directly
if (cv_renderview.value && !automapactive)
if (cv_renderview.value)
{
PS_START_TIMING(ps_rendercalltime);
R_ApplyLevelInterpolators(rendertimefrac);
for (i = 0; i <= splitscreen; i++)
{
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
{
viewssnum = i;
if (i == 0) // Initialize for P1
{
viewwindowy = 0;
viewwindowx = 0;
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
objectsdrawn = 0;
}
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_RenderPlayerView();
else
#endif
if (rendermode != render_none)
{
if (i > 0) // Splitscreen-specific
{
switch (i)
{
case 1:
if (splitscreen > 1)
{
viewwindowx = viewwidth;
viewwindowy = 0;
}
else
{
viewwindowx = 0;
viewwindowy = viewheight;
}
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
break;
case 2:
viewwindowx = 0;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup3, viewheight*sizeof (ylookup[0]));
break;
case 3:
viewwindowx = viewwidth;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup4, viewheight*sizeof (ylookup[0]));
default:
break;
}
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
}
R_RenderPlayerView(&players[displayplayers[i]]);
if (i > 0)
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
}
if (rendermode == render_soft)
{
if (!splitscreen)
R_ApplyViewMorph();
for (i = 0; i <= splitscreen; i++)
{
V_DoPostProcessor(i, postimgparam[i]);
}
}
R_RestoreLevelInterpolators();
D_Renderview();
PS_STOP_TIMING(ps_rendercalltime);
}
@@ -584,6 +586,7 @@ static boolean D_Display(void)
{
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
}
lastdraw = false;
}
@@ -606,13 +609,8 @@ static boolean D_Display(void)
// draw pause pic
if (paused && cv_showhud.value && !demo.playback)
{
INT32 py;
patch_t *patch;
if (automapactive)
py = 4;
else
py = viewwindowy + 4;
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
INT32 py = (automapactive) ? 4 : (viewwindowy + 4);
patch_t *patch = W_CachePatchName("M_PAUSE", PU_PATCH);
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - patch->width)/2, py, V_SNAPTOTOP, patch);
}
@@ -754,7 +752,7 @@ void D_SRB2Loop(void)
// Casting the return value of a function is bad practice (apparently)
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
capbudget = (precise_t) budget;
capbudget = (precise_t)budget;
boolean ranwipe = false;
@@ -824,12 +822,15 @@ void D_SRB2Loop(void)
doDisplay = true;
}
if (menuactive)
if (!dedicated)
{
D_GamePadMenuScrollTicker();
}
if (menuactive)
{
D_GamePadMenuScrollTicker();
}
D_DeviceLEDTick();
D_DeviceLEDTick();
}
}
if (interp)
@@ -841,7 +842,9 @@ void D_SRB2Loop(void)
ps_interp_frac.value.p = (precise_t)((FIXED_TO_FLOAT(g_time.timefrac)) * 1000.0f);
ps_interp_lag.value.p = (precise_t)((deltasecs) * 1000.0f);
if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped)
const boolean lagging = ((deltatics >= 1.0) || hu_stopped);
if (!(paused || P_AutoPause()) && !lagging)
{
rendertimefrac = g_time.timefrac;
}
@@ -850,7 +853,7 @@ void D_SRB2Loop(void)
rendertimefrac = FRACUNIT;
}
if ((deltatics < 1.0) && !hu_stopped)
if (!lagging)
{
rendertimefrac_unpaused = g_time.timefrac;
}
@@ -1607,7 +1610,9 @@ void D_SRB2Main(void)
#endif
// for dedicated server
#if !defined (DEDICATED)
dedicated = M_CheckParm("-dedicated") != 0;
#endif
strcpy(title, "SRB2Kart");
strcpy(srb2, "SRB2Kart");
+10 -9
View File
@@ -216,11 +216,8 @@ static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2
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}};
@@ -305,14 +302,12 @@ consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
{"verticallook4", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
};
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
{"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}
};
#endif
#if defined (HAVE_SDL)
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = {
@@ -905,6 +900,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_netticbuffer);
CV_RegisterVar(&cv_mindelay);
CV_RegisterVar(&cv_gentlemens);
CV_RegisterVar(&cv_serverinfoscreen);
#ifdef NETGAME_DEVMODE
CV_RegisterVar(&cv_fishcake);
@@ -2777,7 +2773,7 @@ static void Command_Map_f(void)
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
else
{
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
if (!mapheaderinfo[newmapnum-1])
{
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
Z_Free(realmapname);
@@ -3031,9 +3027,14 @@ static void Command_ReplayMarker(void)
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");
}
+108
View File
@@ -0,0 +1,108 @@
# 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)
+7
View File
@@ -0,0 +1,7 @@
i_system.c
i_main.c
i_video.c
i_sound.c
i_threads.c
dosstr.c
endtxt.c
+38
View File
@@ -0,0 +1,38 @@
// 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
+234
View File
@@ -0,0 +1,234 @@
/*
* 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);
}
+24
View File
@@ -0,0 +1,24 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 1998-2000 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief Support to show ENDOOM text
#ifndef __ENDTXT__
#define __ENDTXT__
void ShowEndTxt (void);
#endif
+238
View File
@@ -0,0 +1,238 @@
// 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;
}
+339
View File
@@ -0,0 +1,339 @@
// 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
+364
View File
@@ -0,0 +1,364 @@
// 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
+154
View File
@@ -0,0 +1,154 @@
// 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;
}
+10 -4
View File
@@ -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,9 +571,15 @@ void DRPC_UpdatePresence(void)
{
// Map name on tool tip
char *title = G_BuildMapTitle(gamemap);
snprintf(mapname, 48, "Map: %s", title);
if (title)
{
snprintf(mapname, 48, "Map: %s", title);
Z_Free(title);
}
else
snprintf(mapname, 48, "Map: UNKNOWN");
discordPresence.largeImageText = mapname;
Z_Free(title);
}
if (gamestate == GS_LEVEL && Playing())
+2 -2
View File
@@ -113,8 +113,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v8.1"
#define VERSIONSTRINGW L"Saturn v8.1"
#define VERSIONSTRING "Saturn v8.2"
#define VERSIONSTRINGW L"Saturn v8.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!
+3 -2
View File
@@ -531,8 +531,8 @@ static const char *credits[] = {
"\"Xyzzy\"",
"\"Chearii\"",
" ",
"\"Sunflower\" aka \"AnimeSonic\"",
"\"Yuz\" aka \"Yuzler\"",
"\"Sunflower\"",
"\"Yuz\"",
"\"Democrab\"",
"\"EXpand\"",
"\"Nexit\"",
@@ -543,6 +543,7 @@ static const char *credits[] = {
"\"Achii\"",
"\"Anonimus\"",
"\"scizor300\"",
"\"Lugent\"",
"",
"\1Special Thanks",
"SEGA",
+42 -33
View File
@@ -385,7 +385,8 @@ consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, N
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
// Display song credits
consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}};
consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// Show "FREE PLAY" when you're alone. :(
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -3998,7 +3999,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
}
}
char *G_BuildMapTitle(INT32 mapnum)
{
char *title = NULL;
@@ -5465,33 +5465,36 @@ void G_GhostTicker(void)
break;
}
}
if (type == MT_GHOST)
if (type != -1)
{
mobj = P_SpawnGhostMobj(g->mo); // does a large portion of the work for us
mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|tr_trans60<<FF_TRANSSHIFT; // P_SpawnGhostMobj sets trans50, we want trans60
}
else
{
mobj = P_SpawnMobj(g->mo->x, g->mo->y, g->mo->z - FixedDiv(FixedMul(g->mo->info->height, g->mo->scale) - g->mo->height,3*FRACUNIT), MT_THOK);
mobj->sprite = states[mobjinfo[type].spawnstate].sprite;
mobj->frame = (states[mobjinfo[type].spawnstate].frame & FF_FRAMEMASK) | tr_trans60<<FF_TRANSSHIFT;
mobj->tics = -1; // nope.
mobj->color = g->mo->color;
if (g->mo->eflags & MFE_VERTICALFLIP)
if (type == MT_GHOST)
{
mobj->flags2 |= MF2_OBJECTFLIP;
mobj->eflags |= MFE_VERTICALFLIP;
mobj = P_SpawnGhostMobj(g->mo); // does a large portion of the work for us
mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|tr_trans60<<FF_TRANSSHIFT; // P_SpawnGhostMobj sets trans50, we want trans60
}
P_SetScale(mobj, g->mo->scale);
mobj->destscale = g->mo->scale;
else
{
mobj = P_SpawnMobj(g->mo->x, g->mo->y, g->mo->z - FixedDiv(FixedMul(g->mo->info->height, g->mo->scale) - g->mo->height,3*FRACUNIT), MT_THOK);
mobj->sprite = states[mobjinfo[type].spawnstate].sprite;
mobj->frame = (states[mobjinfo[type].spawnstate].frame & FF_FRAMEMASK) | tr_trans60<<FF_TRANSSHIFT;
mobj->tics = -1; // nope.
mobj->color = g->mo->color;
if (g->mo->eflags & MFE_VERTICALFLIP)
{
mobj->flags2 |= MF2_OBJECTFLIP;
mobj->eflags |= MFE_VERTICALFLIP;
}
P_SetScale(mobj, g->mo->scale);
mobj->destscale = g->mo->scale;
}
mobj->floorz = mobj->z;
mobj->ceilingz = mobj->z+mobj->height;
P_UnsetThingPosition(mobj);
mobj->flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY; // make an ATTEMPT to curb crazy SOCs fucking stuff up...
P_SetThingPosition(mobj);
mobj->fuse = 8;
P_SetTarget(&mobj->target, g->mo);
}
mobj->floorz = mobj->z;
mobj->ceilingz = mobj->z+mobj->height;
P_UnsetThingPosition(mobj);
mobj->flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY; // make an ATTEMPT to curb crazy SOCs fucking stuff up...
P_SetThingPosition(mobj);
mobj->fuse = 8;
P_SetTarget(&mobj->target, g->mo);
}
if (ziptic & EZT_HIT)
{ // Spawn hit poofs for killing things!
@@ -6068,15 +6071,19 @@ void G_BeginRecording(void)
char *title = G_BuildMapTitle(gamemap);
// Print to a separate temp buffer instead of demo.titlename, so we can use it in M_TextInputSetString
snprintf(demotitlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
if (title)
{
snprintf(demotitlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
Z_Free(title);
}
else
snprintf(demotitlename, 64, "%s", modeattacking ? "Time Attack" : connectedservername);
// Init just in case it isn't initialized already
M_TextInputInit(&demo.titlenameinput, demo.titlename, sizeof(demo.titlename));
// This will indirectly assign to demo.titlename too
M_TextInputSetString(&demo.titlenameinput, demotitlename);
Z_Free(title);
}
// demo checksum
@@ -8117,9 +8124,6 @@ void G_SaveDemo(void)
UINT8 *p = demobuf.buffer+16; // after version
UINT32 length;
#ifdef NOMD5
UINT8 i;
#endif
// Ensure extrainfo pointer is always available, even if no info is present.
if (demoinfo_p && *(UINT32 *)demoinfo_p == 0)
@@ -8140,7 +8144,7 @@ void G_SaveDemo(void)
size_t i, strindex = 0;
boolean dash = true;
for (i = 0; i < 127 && demo.titlename[i]; i++)
for (i = 0; demo.titlename[i] && i < 127; i++)
{
if ((demo.titlename[i] >= 'a' && demo.titlename[i] <= 'z') ||
(demo.titlename[i] >= '0' && demo.titlename[i] <= '9'))
@@ -8174,7 +8178,7 @@ void G_SaveDemo(void)
length = *(UINT32 *)demoinfo_p;
WRITEUINT32(demoinfo_p, length);
#ifdef NOMD5
for (i = 0; i < 16; i++, p++)
for (UINT8 k = 0; k < 16; k++, p++)
*p = M_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
#else
// Make a checksum of everything after the checksum in the file up to the end of the standard data. Extrainfo is freely modifiable.
@@ -8231,6 +8235,11 @@ boolean G_DemoTitleResponder(event_t *ev)
void G_SetGamestate(gamestate_t newstate)
{
gamestate = newstate;
//HACK: reset musiccredits whenever we change gamestate
// since we allow them to run everywhere now
S_ResetMusicCredit();
#ifdef HAVE_DISCORDRPC
DRPC_UpdatePresence();
#endif
+1 -1
View File
@@ -1030,7 +1030,7 @@ INT32 G_KeyStringtoNum(const char *keystr)
if (!keystr[0])
return 0;
if (!keystr[0] || (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z'))
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
return keystr[0];
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
+14
View File
@@ -0,0 +1,14 @@
hw_bsp.c
hw_draw.c
hw_main.c
hw_clip.c
hw_md2.c
hw_cache.c
hw_md2load.c
hw_md3load.c
hw_model.c
hw_portal.c
hw_batching.c
hw_shaders.c
u_list.c
r_opengl/r_opengl.c
+12 -30
View File
@@ -89,32 +89,23 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
{
if (!pSurf)
{
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
I_Error("Got a null FSurfaceInfo in batching"); // nulls should not come in the stuff that batching currently applies to
}
if (polygonArraySize == polygonArrayAllocSize)
{
PolygonArrayEntry* new_array;
// ran out of space, make new array double the size
// ran out of space, double the array size
polygonArrayAllocSize *= 2;
new_array = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
memcpy(new_array, polygonArray, polygonArraySize * sizeof(PolygonArrayEntry));
free(polygonArray);
polygonArray = new_array;
polygonArray = realloc(polygonArray, polygonArrayAllocSize * sizeof(PolygonArrayEntry));
// also need to redo the index array, dont need to copy it though
free(polygonArraySorted);
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
polygonArraySorted = realloc(polygonArraySorted, polygonArrayAllocSize * sizeof(PolygonArrayEntry*));
}
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
{
FOutVector* new_array;
// need more space for vertices in unsortedVertexArray
unsortedVertexArrayAllocSize *= 2;
new_array = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
memcpy(new_array, unsortedVertexArray, unsortedVertexArraySize * sizeof(FOutVector));
free(unsortedVertexArray);
unsortedVertexArray = new_array;
unsortedVertexArray = realloc(unsortedVertexArray, unsortedVertexArrayAllocSize * sizeof(FOutVector));
}
// add the polygon data to the arrays
@@ -124,7 +115,7 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
polygonArray[polygonArraySize].numVerts = iNumPts;
polygonArray[polygonArraySize].polyFlags = PolyFlags;
polygonArray[polygonArraySize].texture = current_texture;
polygonArray[polygonArraySize].shader = (shader_target != -1) ? HWR_GetShaderFromTarget(shader_target) : shader_target;
polygonArray[polygonArraySize].shader = (shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target;
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
polygonArraySize++;
@@ -138,10 +129,11 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
}
}
static int comparePolygons(const void *p1, const void *p2)
{
PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
int diff;
INT64 diff64;
@@ -177,9 +169,7 @@ static int comparePolygons(const void *p1, const void *p2)
diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end;
if (diff != 0) return diff;
diff = poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional;
return diff;
return poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional;
}
static int comparePolygonsNoShaders(const void *p1, const void *p2)
@@ -328,19 +318,11 @@ void HWR_RenderBatches(void)
// probably never will this loop run more than once though
while (finalVertexWritePos + numVerts > finalVertexArrayAllocSize)
{
FOutVector* new_array;
unsigned int* new_index_array;
finalVertexArrayAllocSize *= 2;
new_array = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
memcpy(new_array, finalVertexArray, finalVertexWritePos * sizeof(FOutVector));
free(finalVertexArray);
finalVertexArray = new_array;
finalVertexArray = realloc(finalVertexArray, finalVertexArrayAllocSize * sizeof(FOutVector));
// also increase size of index array, 3x of vertex array since
// going from fans to triangles increases vertex count to 3x
new_index_array = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
memcpy(new_index_array, finalVertexIndexArray, finalIndexWritePos * sizeof(UINT32));
free(finalVertexIndexArray);
finalVertexIndexArray = new_index_array;
finalVertexIndexArray = realloc(finalVertexIndexArray, finalVertexArrayAllocSize * 3 * sizeof(UINT32));
}
// write the vertices of the polygon
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex],
+14 -9
View File
@@ -46,12 +46,16 @@ RGBA_t *HWR_GetTexturePalette(void)
static INT32 format2bpp(GLTextureFormat_t format)
{
if (format == GL_TEXFMT_RGBA)
return 4;
else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
return 2;
else
return 1;
switch (format)
{
case GL_TEXFMT_RGBA:
return 4;
case GL_TEXFMT_ALPHA_INTENSITY_88:
case GL_TEXFMT_AP_88:
return 2;
default:
return 1;
}
}
// This code was originally placed directly in HWR_DrawPatchInCache.
@@ -221,8 +225,6 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (texture->width <= 0 || texture->height <= 0)
return;
palette = HWR_GetTexturePalette();
x1 = patch->originx;
width = SHORT(realpatch->width);
height = SHORT(realpatch->height);
@@ -234,6 +236,8 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (patch->originy > texture->height || (patch->originy + height) < 0)
return; // patch not located within texture's y bounds, ignore
palette = HWR_GetTexturePalette();
// patch is actually inside the texture!
// now check if texture is partly off-screen and adjust accordingly
@@ -323,7 +327,6 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
boolean skyspecial = false; // poor hack for Legacy large skies..
RGBA_t *palette;
palette = HWR_GetTexturePalette();
texture = textures[texnum];
@@ -361,6 +364,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
INT32 j;
RGBA_t col;
palette = HWR_GetTexturePalette();
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
for (idx = 0, j = 0; j < blockheight; j++)
+2
View File
@@ -318,6 +318,8 @@ enum hwdsetspecialstate
HWD_SET_TEXTUREFILTERMODE,
HWD_SET_TEXTUREANISOTROPICMODE,
HWD_SET_WIREFRAME,
HWD_SET_MSAA,
HWD_SET_SCREEN_TEXTURES,
+30 -21
View File
@@ -241,16 +241,16 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
if (option & V_SNAPTORIGHT)
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(option & V_SNAPTOLEFT))
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f;
}
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy));
else if (option & V_SNAPTOBOTTOM)
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(option & V_SNAPTOTOP))
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f;
}
}
}
@@ -305,10 +305,13 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
FSurfaceInfo Surf;
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
switch (alphalevel)
{
case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break;
case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break;
case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break;
default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break;
}
flags |= PF_Modulated;
GL_DrawPolygon(&Surf, v, 4, flags);
@@ -392,16 +395,16 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
if (option & V_SNAPTORIGHT)
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(option & V_SNAPTOLEFT))
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f;
}
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy));
else if (option & V_SNAPTOBOTTOM)
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(option & V_SNAPTOTOP))
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f;
}
}
}
@@ -467,10 +470,13 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
FSurfaceInfo Surf;
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value];
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value];
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
switch (alphalevel)
{
case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; break;
case 14: Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; break;
case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; break;
default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break;
}
flags |= PF_Modulated;
GL_DrawPolygon(&Surf, v, 4, flags);
@@ -487,7 +493,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// --------------------------------------------------------------------------
// Fills a box of pixels using a flat texture as a pattern
// --------------------------------------------------------------------------
void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
{
FOutVector v[4];
double dflatsize;
@@ -840,7 +846,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
if (color & V_SNAPTORIGHT)
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(color & V_SNAPTOLEFT))
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2.0f;
}
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
{
@@ -848,7 +854,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
if (color & V_SNAPTOBOTTOM)
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(color & V_SNAPTOTOP))
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2.0f;
}
}
@@ -1122,10 +1128,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
if (alphalevel)
{
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
switch (alphalevel)
{
case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break;
case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break;
case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break;
default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break;
}
}
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
+34 -17
View File
@@ -226,6 +226,8 @@ consvar_t cv_glsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL,
consvar_t cv_glbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glwireframe = {"gr_wireframe", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glrenderdistance = {"gr_renderdistance", "Max", CV_SAVE, glrenderdistance_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -338,6 +340,11 @@ static void HWR_SetShaderState(void)
GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
}
static boolean HWR_IsWireframeMode(void)
{
return (cv_glwireframe.value /*&& cv_debug*/);
}
static boolean HWR_OverrideObjectLightLevel(mobj_t *thing, INT32 *lightlevel)
{
if (R_ThingIsFullBright(thing))
@@ -4227,7 +4234,6 @@ static void *HWR_CreateDrawNode(gl_drawnode_type_t type)
Z_Realloc(drawnodes, alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes);
}
drawnode = &drawnodes[numdrawnodes++];
drawnode->type = type;
@@ -4458,7 +4464,10 @@ static void HWR_DrawModels(void)
continue;
}
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
if (!spr->mobj)
continue;
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
md2_t *md2;
@@ -5259,6 +5268,9 @@ static void HWR_DrawSkyBackground(void)
if (drewsky)
return;
if (HWR_IsWireframeMode())
return;
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
memcpy(&dometransform, &atransform, sizeof(FTransform));
@@ -5461,8 +5473,8 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
HWR_PortalClipping(rootportal);
}
// Set transform.
GL_SetTransform(&atransform);
if (HWR_IsWireframeMode())
GL_SetSpecialState(HWD_SET_WIREFRAME, 1);
ps_numbspcalls.value.i = 0;
ps_numpolyobjects.value.i = 0;
@@ -5527,6 +5539,9 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
ps_hw_nodedrawtime.value.p = 0;
HWR_RenderDrawNodes();
if (HWR_IsWireframeMode())
GL_SetSpecialState(HWD_SET_WIREFRAME, 0);
HWR_FreePortalList(portallist);
}
@@ -5750,7 +5765,7 @@ static void HWR_TogglePaletteRendering(void)
// If the r_opengl "texture palette" stays the same during this switch, these textures
// will not be cleared out. However they are still out of date since the
// composite texture blending method has changed. Therefore they need to be cleared.
GL_ClearMipMapCache();
HWR_LoadMapTextures(numtextures);
}
}
else
@@ -5764,7 +5779,7 @@ static void HWR_TogglePaletteRendering(void)
// If the r_opengl "texture palette" stays the same during this switch, these textures
// will not be cleared out. However they are still out of date since the
// composite texture blending method has changed. Therefore they need to be cleared.
GL_ClearMipMapCache();
HWR_LoadMapTextures(numtextures);
}
}
}
@@ -5801,6 +5816,8 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_glbatching);
CV_RegisterVar(&cv_glwireframe);
CV_RegisterVar(&cv_glrenderdistance);
CV_RegisterVar(&cv_glhorizonlines);
@@ -5873,7 +5890,6 @@ static void COM_HWR_glinfo(void)
CONS_Printf("Unrecognized argument: %s\n", argv);
return;
}
}
CONS_Printf("\x88OpenGL %s\x80\n", gl_version);
@@ -5993,19 +6009,19 @@ static void HWR_DoPostProcessor(player_t *player)
if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects
return;
// Capture the screen for intermission and screen waving
if (gamestate != GS_INTERMISSION)
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
if (splitscreen) // Not supported in splitscreen - someone want to add support?
return;
//UINT8 viewnum = R_GetViewNumber(); // see above
//UINT8 viewnum = R_GetViewNumber(); // see below
//camera_t *thiscam = &camera[viewnum];
camera_t *thiscam = &camera[0];
// Not supported in splitscreen - someone want to add support?
const boolean screenwave = (!splitscreen && (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT));
// Capture the screen for intermission and screen waving
if ((lastdraw || screenwave) && gamestate != GS_INTERMISSION)
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
// Drunken vision! WooOOooo~
if (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT)
if (screenwave)
{
// 10 by 10 grid. 2 coordinates (xy)
float v[SCREENVERTS][SCREENVERTS][2];
@@ -6020,7 +6036,7 @@ static void HWR_DoPostProcessor(player_t *player)
if (thiscam->postimg & POSTIMG_WATER)
{
WAVELENGTH = 5;
AMPLITUDE = 20;
AMPLITUDE = 40;
FREQUENCY = 8;
}
else
@@ -6039,6 +6055,7 @@ static void HWR_DoPostProcessor(player_t *player)
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
}
}
GL_PostImgRedraw(v);
// Capture the screen again for screen waving on the intermission
+3 -1
View File
@@ -202,6 +202,8 @@ extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_glbatching;
extern consvar_t cv_glwireframe;
extern consvar_t cv_glrenderdistance;
extern consvar_t cv_glhorizonlines;
@@ -223,7 +225,7 @@ FUNCINLINE static ATTRINLINE boolean HWR_ShouldUsePaletteRendering(void)
FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
{
return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value);
return (cv_glflashpal.value && HWR_ShouldUsePaletteRendering());
}
#endif
+183 -138
View File
@@ -350,6 +350,8 @@ typedef void (APIENTRY * PFNglDisable) (GLenum cap);
static PFNglDisable pglDisable;
typedef void (APIENTRY * PFNglGetFloatv) (GLenum pname, GLfloat *params);
static PFNglGetFloatv pglGetFloatv;
typedef void (APIENTRY * PFNglPolygonMode) (GLenum, GLenum);
static PFNglPolygonMode pglPolygonMode;
/* Depth Buffer */
typedef void (APIENTRY * PFNglClearDepth) (GLclampd depth);
@@ -549,6 +551,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglGetFloatv, glGetFloatv)
GETOPENGLFUNC(pglGetIntegerv, glGetIntegerv)
GETOPENGLFUNC(pglGetString, glGetString)
GETOPENGLFUNC(pglPolygonMode, glPolygonMode)
GETOPENGLFUNC(pglClearDepth, glClearDepth)
GETOPENGLFUNC(pglDepthFunc, glDepthFunc)
@@ -734,69 +737,78 @@ static boolean GLFramebuffer_CheckExt(void)
return false;
// check if all needed gl extensions are available
return (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_object", gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
return (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions)
&& GL_isExtAvailable("GL_ARB_framebuffer_object", gl_extensions)
&& GL_isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
}
#endif
void SetupGLFunc4(void)
{
#define GetGLfunc(func) \
p##func = GetGLFunc(#func); \
if (!p##func) \
{ \
GL_MSG_Warning("failed to get OpenGL function: %s", #func); \
} \
/* 1.2 funcs */
pglTexImage3D = GetGLFunc("glTexImage3D");
GetGLfunc(glTexImage3D);
/* 1.3 funcs */
pglActiveTexture = GetGLFunc("glActiveTexture");
pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f");
pglClientActiveTexture = GetGLFunc("glClientActiveTexture");
pglMultiTexCoord2fv = GetGLFunc("glMultiTexCoord2fv");
GetGLfunc(glActiveTexture);
GetGLfunc(glMultiTexCoord2f);
GetGLfunc(glClientActiveTexture);
GetGLfunc(glMultiTexCoord2fv);
/* 1.5 funcs */
pglGenBuffers = GetGLFunc("glGenBuffers");
pglBindBuffer = GetGLFunc("glBindBuffer");
pglBufferData = GetGLFunc("glBufferData");
pglDeleteBuffers = GetGLFunc("glDeleteBuffers");
pglColorPointer = GetGLFunc("glColorPointer");
GetGLfunc(glGenBuffers);
GetGLfunc(glBindBuffer);
GetGLfunc(glBufferData);
GetGLfunc(glDeleteBuffers);
GetGLfunc(glColorPointer);
/* 2.0 funcs */
pglBlendEquation = GetGLFunc("glBlendEquation");
GetGLfunc(glBlendEquation);
pglStencilFuncSeparate = GetGLFunc("glStencilFuncSeparate");
pglStencilOpSeparate = GetGLFunc("glStencilOpSeparate");
GetGLfunc(glStencilFuncSeparate);
GetGLfunc(glStencilOpSeparate);
pglCreateShader = GetGLFunc("glCreateShader");
pglShaderSource = GetGLFunc("glShaderSource");
pglCompileShader = GetGLFunc("glCompileShader");
pglGetShaderiv = GetGLFunc("glGetShaderiv");
pglGetShaderInfoLog = GetGLFunc("glGetShaderInfoLog");
pglDeleteShader = GetGLFunc("glDeleteShader");
pglCreateProgram = GetGLFunc("glCreateProgram");
pglDeleteProgram = GetGLFunc("glDeleteProgram");
pglAttachShader = GetGLFunc("glAttachShader");
pglLinkProgram = GetGLFunc("glLinkProgram");
pglGetProgramiv = GetGLFunc("glGetProgramiv");
pglGetProgramInfoLog = GetGLFunc("glGetProgramInfoLog");
pglUseProgram = GetGLFunc("glUseProgram");
pglUniform1i = GetGLFunc("glUniform1i");
pglUniform1f = GetGLFunc("glUniform1f");
pglUniform2f = GetGLFunc("glUniform2f");
pglUniform3f = GetGLFunc("glUniform3f");
pglUniform4f = GetGLFunc("glUniform4f");
pglUniform1fv = GetGLFunc("glUniform1fv");
pglUniform2fv = GetGLFunc("glUniform2fv");
pglUniform3fv = GetGLFunc("glUniform3fv");
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
GetGLfunc(glCreateShader);
GetGLfunc(glShaderSource);
GetGLfunc(glCompileShader);
GetGLfunc(glGetShaderiv);
GetGLfunc(glGetShaderInfoLog);
GetGLfunc(glDeleteShader);
GetGLfunc(glCreateProgram);
GetGLfunc(glDeleteProgram);
GetGLfunc(glAttachShader);
GetGLfunc(glLinkProgram);
GetGLfunc(glGetProgramiv);
GetGLfunc(glGetProgramInfoLog);
GetGLfunc(glUseProgram);
GetGLfunc(glUniform1i);
GetGLfunc(glUniform1f);
GetGLfunc(glUniform2f);
GetGLfunc(glUniform3f);
GetGLfunc(glUniform4f);
GetGLfunc(glUniform1fv);
GetGLfunc(glUniform2fv);
GetGLfunc(glUniform3fv);
GetGLfunc(glGetUniformLocation);
#ifdef USE_FBO_OGL
if (GLFramebuffer_CheckExt())
{
pglGenFramebuffers = GetGLFunc("glGenFramebuffers");
pglBindFramebuffer = GetGLFunc("glBindFramebuffer");
pglDeleteFramebuffers = GetGLFunc("glDeleteFramebuffers");
pglFramebufferTexture2D = GetGLFunc("glFramebufferTexture2D");
pglCheckFramebufferStatus = GetGLFunc("glCheckFramebufferStatus");
pglGenRenderbuffers = GetGLFunc("glGenRenderbuffers");
pglBindRenderbuffer = GetGLFunc("glBindRenderbuffer");
pglDeleteRenderbuffers = GetGLFunc("glDeleteRenderbuffers");
pglRenderbufferStorage = GetGLFunc("glRenderbufferStorage");
pglFramebufferRenderbuffer = GetGLFunc("glFramebufferRenderbuffer");
GetGLfunc(glGenFramebuffers);
GetGLfunc(glBindFramebuffer);
GetGLfunc(glDeleteFramebuffers);
GetGLfunc(glFramebufferTexture2D);
GetGLfunc(glCheckFramebufferStatus);
GetGLfunc(glGenRenderbuffers);
GetGLfunc(glBindRenderbuffer);
GetGLfunc(glDeleteRenderbuffers);
GetGLfunc(glRenderbufferStorage);
GetGLfunc(glFramebufferRenderbuffer);
// check if ALL functions are availible
if (pglGenFramebuffers && pglBindFramebuffer &&
@@ -807,6 +819,7 @@ void SetupGLFunc4(void)
supportFBO = true;
}
#endif
#undef GetGLfunc
}
boolean GL_InitShaders(void)
@@ -956,6 +969,7 @@ static void GL_SetNoTexture(void)
{
if (NOTEXTURE_NUM == 0)
pglGenTextures(1, &NOTEXTURE_NUM);
pglBindTexture(GL_TEXTURE_2D, NOTEXTURE_NUM);
tex_downloaded = NOTEXTURE_NUM;
}
@@ -1105,10 +1119,12 @@ void GL_DeleteTexture(GLMipmap_t *pTexInfo)
head->next->prev = head->prev;
else // no next -> tail is being deleted -> update TexCacheTail
TexCacheTail = head->prev;
if (head->prev)
head->prev->next = head->next;
else // no prev -> head is being deleted -> update TexCacheHead
TexCacheHead = head->next;
free(head);
break;
}
@@ -1129,7 +1145,7 @@ static void GL_Framebuffer_GenerateAttachments(void)
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
// Generate the framebuffer texture
if (FramebufferTexture == 0)
if (!FramebufferTexture)
{
pglGenTextures(1, &FramebufferTexture);
pglBindTexture(GL_TEXTURE_2D, FramebufferTexture);
@@ -1143,7 +1159,7 @@ static void GL_Framebuffer_GenerateAttachments(void)
}
// Generate the renderbuffer
if (RenderbufferObject == 0)
if (!RenderbufferObject)
{
pglGenRenderbuffers(1, &RenderbufferObject);
@@ -1165,10 +1181,10 @@ static void GL_Framebuffer_GenerateAttachments(void)
static void GL_Framebuffer_DeleteAttachments(void)
{
if (!supportFBO || fboinit == false)
if (!supportFBO || !fboinit)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0 && FramebufferTexture == 0)
if (!FramebufferObject && !RenderbufferObject && !FramebufferTexture)
return;
// Unbind the framebuffer
@@ -1192,7 +1208,7 @@ static void GL_Framebuffer_Generate(void)
return;
// Generate the framebuffer
if (FramebufferObject == 0)
if (!FramebufferObject)
pglGenFramebuffers(1, &FramebufferObject);
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
@@ -1201,7 +1217,7 @@ static void GL_Framebuffer_Generate(void)
static void GL_Framebuffer_Delete(void)
{
if (!supportFBO || fboinit == false)
if (!supportFBO || !fboinit)
return;
if (FramebufferObject)
@@ -1213,10 +1229,10 @@ static void GL_Framebuffer_Delete(void)
void GL_Framebuffer_Unbind(void)
{
if (!supportFBO || fboinit == false)
if (!supportFBO || !fboinit)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0)
if (!FramebufferObject && !RenderbufferObject)
return;
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -1230,7 +1246,7 @@ void GL_Framebuffer_Enable(void)
if (FramebufferObject == 0)
GL_Framebuffer_Generate();
else if (FramebufferTexture == 0 || RenderbufferObject == 0)
else if (!FramebufferTexture || !RenderbufferObject)
GL_Framebuffer_GenerateAttachments();
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
@@ -1239,10 +1255,10 @@ void GL_Framebuffer_Enable(void)
void GL_Framebuffer_Disable(void)
{
if (!supportFBO || fboinit == false)
if (!supportFBO || !fboinit)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0)
if (!FramebufferObject && !RenderbufferObject)
return;
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -1292,20 +1308,29 @@ INT32 GL_isExtAvailable(const char *extension, const GLubyte *start)
{
GLubyte *where, *terminator;
if (!extension || !start) return 0;
if (!extension || !start)
return 0;
where = (GLubyte *) strchr(extension, ' ');
if (where || *extension == '\0')
return 0;
for (;;)
{
where = (GLubyte *) strstr((const char *) start, extension);
if (!where)
break;
terminator = where + strlen(extension);
if (where == start || *(where - 1) == ' ')
{
if (*terminator == ' ' || *terminator == '\0')
return 1;
}
start = terminator;
}
return 0;
@@ -1337,23 +1362,33 @@ void GL_ReadScreenTexture(int tex, UINT16 *dst_data)
{
INT32 i;
int dst_stride = screen_width * 3; // stride between rows of image data
GLubyte*top = (GLvoid*)dst_data, *bottom = top + dst_stride * (screen_height - 1);
GLubyte *top, *bottom;
GLubyte *row;
row = malloc(dst_stride);
if (!row) return;
if (!row)
return;
top = (GLvoid*)dst_data;
bottom = top + dst_stride * (screen_height - 1);
// at the time this function is called, generic2 can be found drawn on the framebuffer
// if some other screen texture is needed, draw it to the framebuffer
// and draw generic2 back after reading the framebuffer.
// this hack is for some reason **much** faster than the simple solution of using glGetTexImage.
if (tex != HWD_SCREENTEXTURE_GENERIC2)
GL_DrawScreenTexture(tex, NULL, 0);
pglPixelStorei(GL_PACK_ALIGNMENT, 1);
pglReadPixels(0, 0, screen_width, screen_height, GL_RGB, GL_UNSIGNED_BYTE, dst_data);
if (tex != HWD_SCREENTEXTURE_GENERIC2)
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
// Flip image upside down.
// In other words, convert OpenGL's "bottom->top" row order into "top->bottom".
for(i = 0; i < screen_height/2; i++)
for (i = 0; i < screen_height/2; i++)
{
memcpy(row, top, dst_stride);
memcpy(top, bottom, dst_stride);
@@ -1361,6 +1396,7 @@ void GL_ReadScreenTexture(int tex, UINT16 *dst_data)
top += dst_stride;
bottom -= dst_stride;
}
free(row);
}
@@ -1413,10 +1449,8 @@ void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask
if (ColorMask)
{
if (ClearColor)
pglClearColor(ClearColor->red,
ClearColor->green,
ClearColor->blue,
ClearColor->alpha);
pglClearColor(ClearColor->red, ClearColor->green, ClearColor->blue, ClearColor->alpha);
ClearMask |= GL_COLOR_BUFFER_BIT;
}
if (DepthMask)
@@ -1431,6 +1465,7 @@ void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask
if (StencilMask)
ClearMask |= GL_STENCIL_BUFFER_BIT;// looks like sometimes stencil buffer needs clearing? had a problem with random black screens
pglClear(ClearMask);
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too
@@ -2055,7 +2090,7 @@ static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i)
pglGetShaderiv(gl_fragShader, GL_COMPILE_STATUS, &result);
if (result == GL_FALSE)
{
pglGetShaderInfoLog(gl_fragShader, 512, NULL, info_log);
pglGetShaderInfoLog(gl_fragShader, 512, NULL, info_log);
GL_MSG_Error("Error compiling fragment shader: %s\n", info_log);
pglDeleteShader(gl_vertShader);
@@ -2093,25 +2128,25 @@ static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i)
#define GETUNI(uniform) pglGetUniformLocation(shader->program, uniform);
// lighting
shader->uniforms[gluniform_poly_color] = GETUNI("poly_color");
shader->uniforms[gluniform_tint_color] = GETUNI("tint_color");
shader->uniforms[gluniform_fade_color] = GETUNI("fade_color");
shader->uniforms[gluniform_lighting] = GETUNI("lighting");
shader->uniforms[gluniform_fade_start] = GETUNI("fade_start");
shader->uniforms[gluniform_fade_end] = GETUNI("fade_end");
shader->uniforms[gluniform_light_dir] = GETUNI("light_dir");
shader->uniforms[gluniform_light_contrast] = GETUNI("light_contrast");
shader->uniforms[gluniform_light_backlight] = GETUNI("light_backlight");
shader->uniforms[gluniform_poly_color] = GETUNI("poly_color");
shader->uniforms[gluniform_tint_color] = GETUNI("tint_color");
shader->uniforms[gluniform_fade_color] = GETUNI("fade_color");
shader->uniforms[gluniform_lighting] = GETUNI("lighting");
shader->uniforms[gluniform_fade_start] = GETUNI("fade_start");
shader->uniforms[gluniform_fade_end] = GETUNI("fade_end");
shader->uniforms[gluniform_light_dir] = GETUNI("light_dir");
shader->uniforms[gluniform_light_contrast] = GETUNI("light_contrast");
shader->uniforms[gluniform_light_backlight] = GETUNI("light_backlight");
// palette rendering
shader->uniforms[gluniform_palette_tex] = GETUNI("palette_tex");
shader->uniforms[gluniform_palette_lookup_tex] = GETUNI("palette_lookup_tex");
shader->uniforms[gluniform_lighttable_tex] = GETUNI("lighttable_tex");
shader->uniforms[gluniform_palette_tex] = GETUNI("palette_tex");
shader->uniforms[gluniform_palette_lookup_tex] = GETUNI("palette_lookup_tex");
shader->uniforms[gluniform_lighttable_tex] = GETUNI("lighttable_tex");
shader->uniforms[gluniform_scr_resolution] = GETUNI("scr_resolution");
shader->uniforms[gluniform_scr_resolution] = GETUNI("scr_resolution");
// misc.
shader->uniforms[gluniform_leveltime] = GETUNI("leveltime");
shader->uniforms[gluniform_leveltime] = GETUNI("leveltime");
#undef GETUNI
// set permanent uniform values
@@ -2319,49 +2354,54 @@ void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
gl_allowshaders = Value;
break;
case HWD_SET_TEXTUREFILTERMODE:
switch (Value)
{
case HWD_SET_TEXTUREFILTER_TRILINEAR:
min_filter = GL_LINEAR_MIPMAP_LINEAR;
mag_filter = GL_LINEAR;
MipMap = GL_TRUE;
break;
case HWD_SET_TEXTUREFILTER_BILINEAR:
min_filter = mag_filter = GL_LINEAR;
switch (Value)
{
case HWD_SET_TEXTUREFILTER_TRILINEAR:
min_filter = GL_LINEAR_MIPMAP_LINEAR;
mag_filter = GL_LINEAR;
MipMap = GL_TRUE;
break;
case HWD_SET_TEXTUREFILTER_BILINEAR:
min_filter = mag_filter = GL_LINEAR;
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_POINTSAMPLED:
min_filter = mag_filter = GL_NEAREST;
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_MIXED1:
min_filter = GL_NEAREST;
mag_filter = GL_LINEAR;
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_MIXED2:
min_filter = GL_LINEAR;
mag_filter = GL_NEAREST;
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_MIXED3:
min_filter = GL_LINEAR_MIPMAP_LINEAR;
mag_filter = GL_NEAREST;
MipMap = GL_TRUE;
break;
default:
min_filter = GL_NEAREST;
mag_filter = GL_LINEAR;
}
if (!supportMipMap)
{
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_POINTSAMPLED:
min_filter = mag_filter = GL_NEAREST;
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_MIXED1:
min_filter = GL_NEAREST;
mag_filter = GL_LINEAR;
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_MIXED2:
min_filter = GL_LINEAR;
mag_filter = GL_NEAREST;
MipMap = GL_FALSE;
break;
case HWD_SET_TEXTUREFILTER_MIXED3:
min_filter = GL_LINEAR_MIPMAP_LINEAR;
mag_filter = GL_NEAREST;
MipMap = GL_TRUE;
break;
default:
min_filter = GL_NEAREST;
mag_filter = GL_LINEAR;
}
}
if (!supportMipMap)
{
MipMap = GL_FALSE;
min_filter = GL_LINEAR;
GL_Flush(); //??? if we want to change filter mode by texture, remove this
}
break;
GL_Flush(); //??? if we want to change filter mode by texture, remove this
case HWD_SET_WIREFRAME:
pglPolygonMode(GL_FRONT_AND_BACK, Value ? GL_LINE : GL_FILL);
break;
case HWD_SET_TEXTURE_FORMAT:
@@ -2699,7 +2739,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
GL_SetBlend((poly.alpha < 1 ? Surface->PolyFlags : (PF_Masked|PF_Occlude))|PF_Modulated);
GL_SetBlend(((poly.alpha < 1) ? Surface->PolyFlags : (PF_Masked|PF_Occlude))|PF_Modulated);
tint.red = byte2float[Surface->TintColor.s.red];
tint.green = byte2float[Surface->TintColor.s.green];
@@ -2743,9 +2783,9 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
if (hflipped)
scalez = -scalez;
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
if (pos->roll)
{
@@ -2916,8 +2956,10 @@ void GL_SetTransform(FTransform *stransform)
if (shearing)
{
float dy = stransform->viewaiming * 2;
if (stransform->fliptype == TRANSFORM_FLIP || stransform->fliptype == TRANSFORM_MIRRORFLIP)
dy *= -1.0f;
pglTranslatef(0.0f, -dy/BASEVIDHEIGHT, 0.0f);
}
@@ -2969,9 +3011,9 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
const float blackBack[16] =
{
-16.0f, -16.0f, 6.0f,
-16.0f, 16.0f, 6.0f,
16.0f, 16.0f, 6.0f,
16.0f, -16.0f, 6.0f
-16.0f, 16.0f, 6.0f,
16.0f, 16.0f, 6.0f,
16.0f, -16.0f, 6.0f
};
if (gl_enable_screen_textures != 2)
@@ -2993,9 +3035,9 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
pglEnableClientState(GL_TEXTURE_COORD_ARRAY);
for(x = 0; x < SCREENVERTS-1;x ++)
for (x = 0; x < (SCREENVERTS-1); x ++)
{
for(y = 0; y < SCREENVERTS-1; y++)
for (y = 0; y < (SCREENVERTS-1); y++)
{
float stCoords[8];
float vertCoords[12];
@@ -3047,23 +3089,22 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
void GL_FlushScreenTextures(void)
{
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
memset(screenTextures, 0 , sizeof(screenTextures));
memset(screenTextures, 0, sizeof(screenTextures));
}
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
{
float fix[8];
float xfix, yfix;
const float screenVerts[12] =
{
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};
float fix[8];
if (gl_enable_screen_textures != 2)
return;
@@ -3108,9 +3149,9 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd)
const float screenVerts[12] =
{
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};
float fix[8];
@@ -3194,9 +3235,9 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
float screenVerts[12] =
{
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};
if (gl_enable_screen_textures != 2)
@@ -3295,6 +3336,7 @@ void GL_MakeScreenTexture(int tex)
// Create screen texture
if (firstTime)
pglGenTextures(1, &screenTextures[tex]);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
if (firstTime)
@@ -3329,6 +3371,7 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
origaspect = (float)screen_width / screen_height;
newaspect = (float)width / height;
if (origaspect < newaspect)
{
xoff = origaspect / newaspect;
@@ -3464,8 +3507,10 @@ void GL_SetScreenPalette(RGBA_t *palette)
if (memcmp(screenPalette, palette, sizeof(screenPalette)))
{
memcpy(screenPalette, palette, sizeof(screenPalette));
if (!screenPaletteTex)
pglGenTextures(1, &screenPaletteTex);
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_1D, screenPaletteTex);
pglTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+4 -4
View File
@@ -220,9 +220,9 @@ HMS_connect (const char *format, ...)
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
@@ -339,8 +339,8 @@ HMS_unlist (void)
if (! hms)
return 0;
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
curl_easy_setopt(hms->curl, CURLOPT_POST, (long)1);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, (long)0);
okay = HMS_do(hms);
HMS_end(hms);
+65 -4
View File
@@ -2133,7 +2133,7 @@ void HU_TickSongCredits(void)
}
}
void HU_DrawSongCredits(void)
static void HU_DrawSongCreditsVanilla(void)
{
char *str;
INT32 len;
@@ -2141,9 +2141,6 @@ void HU_DrawSongCredits(void)
INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32);
INT32 bgt;
if (!cursongcredit.def) // No def
return;
str = va("\x1F"" %s", cursongcredit.def->source);
len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
destx = (len + 7) * FRACUNIT;
@@ -2173,6 +2170,70 @@ void HU_DrawSongCredits(void)
V_DrawRightAlignedThinString(cursongcredit.x / FRACUNIT, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
}
#define BOXCREDITSLIDEIN (5*TICRATE-TICRATE/2)
#define BOXCREDITSLIDEOUT (TICRATE/2)
#define BOXCREDITHEIGHT 8
static void HU_DrawSongCreditsBox(void)
{
char *str = cursongcredit.def->source;
INT32 strwidth = V_SmallStringWidth(str, V_ALLOWLOWERCASE) + 4;
// dup dup dup dup
INT32 dup = min(vid.dupx, vid.dupy);
// Center it
INT32 x = (BASEVIDWIDTH/2 - strwidth/2)*dup + ((vid.width - (BASEVIDWIDTH * vid.dupx)) / 2);
INT32 y = 0;
INT32 flags = V_SNAPTOTOP|V_NOSCALESTART;
INT32 t = cursongcredit.anim;
INT32 bgt;
fixed_t interpoffset = FixedMul(BOXCREDITHEIGHT*dup*FRACUNIT/(TICRATE/2), R_GetHudUncap());
if (t > BOXCREDITSLIDEIN)
{
// Sliding in
t = TICRATE/2 - (t - BOXCREDITSLIDEIN);
y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup + interpoffset)/FRACUNIT;
}
else if (t < TICRATE/2)
{
// Sliding out
y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup - interpoffset)/FRACUNIT;
}
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans/2);
if (bgt < NUMTRANSMAPS)
{
V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<<V_ALPHASHIFT));
V_DrawFill(x+dup, y+dup, (strwidth-2)*dup, (BOXCREDITHEIGHT-2)*dup, 30|flags|(bgt<<V_ALPHASHIFT));
}
if (cursongcredit.trans < NUMTRANSMAPS)
{
V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str);
}
}
void HU_DrawSongCredits(void)
{
if (!cursongcredit.def) // No def
return;
switch (cv_songcredits.value)
{
case 1:
HU_DrawSongCreditsVanilla();
break;
case 2:
HU_DrawSongCreditsBox();
break;
default:
break;
}
}
// Heads up displays drawer, call each frame
//
+3 -2
View File
@@ -10525,11 +10525,12 @@ static void K_drawKartWanted(void)
{
INT32 x = basex+(splitscreen > 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21);
fixed_t scale = FRACUNIT/2;
player_t *p = &players[battlewanted[i]];
if (battlewanted[i] == -1)
break;
player_t *p = &players[battlewanted[i]];
if (numwanted == 1)
scale = FRACUNIT;
else
@@ -10540,7 +10541,7 @@ static void K_drawKartWanted(void)
y += 16;
}
if (players[battlewanted[i]].skincolor)
if (p->skincolor)
{
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? R_GetSkinFaceWant(p) : R_GetSkinFaceRank(p)), colormap);
+80 -61
View File
@@ -2188,29 +2188,30 @@ static menuitem_t OP_SaturnMenu[] =
{IT_STRING | IT_CVAR, NULL, "Minimum Input Delay", &cv_mindelay, 20},
{IT_STRING | IT_CVAR, NULL, "Gentlemens Ping", &cv_gentlemens, 25},
{IT_STRING | IT_CVAR, NULL, "Server Info Screen", &cv_serverinfoscreen, 30},
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35},
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 40},
{IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 45},
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 50},
{IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 50},
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 55},
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 60},
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 65},
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 70},
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 75},
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 80},
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 85},
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 90},
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 95},
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 100},
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 105},
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 110},
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 115},
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 120},
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 125},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 130},
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 135},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 140}, // uwu
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 135},
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 140},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 145}, // uwu
};
static const char* OP_SaturnTooltips[] =
@@ -2219,6 +2220,7 @@ static const char* OP_SaturnTooltips[] =
"How long can the game wait before it kicks you out from the server\nconnecting screen.",
"Practice for online play! 0 = instant response.",
"Simulate online input delay when hosting a server.\nValue choosen by Player with the lowest ping",
"Show a screen before joining a server displaying important information about it",
"How much speen do you want?",
"Colourize the speedlines in your skincolor if you go fast enough!",
"Colourize the sneaker flame trails in your skincolor!",
@@ -2466,39 +2468,38 @@ static menuitem_t OP_HudOffsetMenu[] =
static menuitem_t OP_SaturnCreditsMenu[] =
{
{IT_HEADER, NULL, "Saturn Credits", NULL, 0},
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 7},
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 17},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 27},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 37},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 47},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 57},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 67},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 77},
{IT_STRING2+IT_SPACE, NULL, "Sunflower", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "Yuz", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "Democrab", NULL, 100},
{IT_STRING2+IT_SPACE, NULL, "EXpand", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Nexit", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Spee", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 160},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 170},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 190},
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 200},
{IT_STRING2+IT_SPACE, NULL, "Sunflower aka AnimeSonic", NULL, 87},
{IT_STRING2+IT_SPACE, NULL, "Yuz aka Yuzler", NULL, 97},
{IT_STRING2+IT_SPACE, NULL, "Democrab", NULL, 107},
{IT_STRING2+IT_SPACE, NULL, "EXpand", NULL, 117},
{IT_STRING2+IT_SPACE, NULL, "Nexit", NULL, 127},
{IT_STRING2+IT_SPACE, NULL, "Spee", NULL, 137},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 147},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 157},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 167},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 177},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 187},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 197},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 168},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 167},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 178},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 188},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 198},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 177},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 187},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 197},
{IT_STRING+IT_SPACE, NULL, "", NULL, 207}, // dummy text I
{IT_STRING, NULL, "", NULL, 267}, // dummy text II
{IT_STRING+IT_SPACE, NULL, "", NULL, 198}, // dummy text I
{IT_STRING, NULL, "", NULL, 258}, // dummy text II
};
// sry we dont have space for this anymore :/
@@ -3600,8 +3601,8 @@ static void M_ChangeCvar(INT32 choice)
char s[20];
float increment;
increment = (currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f);
sprintf(s, "%f",FIXED_TO_FLOAT(cv->value)+(choice)*increment);
increment = FIXED_TO_FLOAT(cv->value)+(choice)*((currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f));
sprintf(s,"%ld%s",(long)increment,M_Ftrim(increment));
CV_Set(cv, s);
}
else
@@ -7133,7 +7134,7 @@ static void DrawReplayHutReplayInfo(void)
case MD_OUTDATED:
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", demolist[dir_on[menudepthleft]].version));
/*fallthru*/
/* FALLTHRU */
default:
// Draw level stuff
x = 15; y = 15;
@@ -7167,8 +7168,11 @@ static void DrawReplayHutReplayInfo(void)
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
{
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
if (title)
{
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
}
}
else
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
@@ -8120,6 +8124,9 @@ UINT8 skyRoomMenuTranslations[MAXUNLOCKABLES];
static char *M_GetConditionString(condition_t cond)
{
char *title = NULL;
char *response = NULL;
switch(cond.type)
{
case UC_PLAYTIME:
@@ -8146,33 +8153,45 @@ static char *M_GetConditionString(condition_t cond)
G_TicsToSeconds(cond.requirement));
case UC_MAPVISITED:
{
char *title = G_BuildMapTitle(cond.requirement-1);
char *response = va("Visit %s", title);
Z_Free(title);
title = G_BuildMapTitle(cond.requirement-1);
if (title)
{
response = va("Visit %s", title);
Z_Free(title);
}
return response;
}
case UC_MAPBEATEN:
{
char *title = G_BuildMapTitle(cond.requirement-1);
char *response = va("Beat %s", title);
Z_Free(title);
title = G_BuildMapTitle(cond.requirement-1);
if (title)
{
response = va("Beat %s", title);
Z_Free(title);
}
return response;
}
case UC_MAPALLEMERALDS:
{
char *title = G_BuildMapTitle(cond.requirement-1);
char *response = va("Beat %s w/ all emeralds", title);
Z_Free(title);
title = G_BuildMapTitle(cond.requirement-1);
if (title)
{
response = va("Beat %s w/ all emeralds", title);
Z_Free(title);
}
return response;
}
case UC_MAPTIME:
{
char *title = G_BuildMapTitle(cond.extrainfo1-1);
char *response = va("Beat %s in %i:%02i.%02i", title,
G_TicsToMinutes(cond.requirement, true),
G_TicsToSeconds(cond.requirement),
G_TicsToCentiseconds(cond.requirement));
Z_Free(title);
title = G_BuildMapTitle(cond.extrainfo1-1);
if (title)
{
response = va("Beat %s in %i:%02i.%02i", title,
G_TicsToMinutes(cond.requirement, true),
G_TicsToSeconds(cond.requirement),
G_TicsToCentiseconds(cond.requirement));
Z_Free(title);
}
return response;
}
case UC_TOTALEMBLEMS:
+21 -1
View File
@@ -55,12 +55,13 @@
#ifdef HAVE_SDL
#include "sdl/hwsym_sdl.h"
#endif
#ifdef __linux__
#ifndef _LARGEFILE64_SOURCE
typedef off_t off64_t;
#endif
#endif
#endif
#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) && (__GNUC__ < 8)
#define PRIdS "u"
@@ -1965,6 +1966,25 @@ char *M_GetToken(const char *inputString)
return texturesToken;
}
const char * M_Ftrim (double f)
{
static char dig[9];/* "0." + 6 digits (6 is printf's default) */
int i;
/* I know I said it's the default, but just in case... */
sprintf(dig, "%.6f", fabs(modf(f, &f)));
/* trim trailing zeroes */
for (i = strlen(dig)-1; dig[i] == '0'; --i)
;
if (dig[i] == '.')/* :NOTHING: */
return "";
else
{
dig[i + 1] = '\0';
return &dig[1];/* skip the 0 */
}
}
/** Count bits in a number.
*/
UINT8 M_CountBits(UINT32 num, UINT8 size)
+6
View File
@@ -104,6 +104,12 @@ boolean M_IsPathAbsolute (const char *path);
void M_MkdirEach (const char *path, int start, int mode);
void M_MkdirEachUntil (const char *path, int start, int end, int mode);
/*
Return dot and then the fractional part of a float, without
trailing zeros, or "" if the fractional part is zero.
*/
const char * M_Ftrim (double);
// counting bits, for weapon ammo code, usually
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
-6
View File
@@ -26,12 +26,6 @@
#if defined (STDC_HEADERS) || defined (_LIBC)
#include <stdlib.h>
#else
#ifndef HAVE_MEMCPY
#if !(defined (_WIN32) && !defined (__CYGWIN__)) && !defined (__APPLE__)
#define memcpy(d, s, n) bcopy ((s), (d), (n))
#endif
#endif
#endif
#include "md5.h"
+2 -2
View File
@@ -6900,7 +6900,7 @@ static boolean P_MobjDeadThink(mobj_t *mobj)
P_RemoveMobj(mobj);
return false;
}
// fallthru
/* FALLTHRU */
case MT_ORBINAUT_SHIELD:
case MT_BANANA_SHIELD:
case MT_EGGMANITEM_SHIELD:
@@ -6910,7 +6910,7 @@ static boolean P_MobjDeadThink(mobj_t *mobj)
case MT_JAWZ_DUD:
if (P_IsObjectOnGround(mobj))
P_SetMobjState(mobj, mobj->info->xdeathstate);
// fallthru
/* FALLTHRU */
case MT_JAWZ_SHIELD:
mobj->flags2 ^= MF2_DONTDRAW;
break;
+2 -7
View File
@@ -2747,8 +2747,6 @@ static void P_SetupPlayer(void)
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755);
G_RecordDemo(buf);
if (dedicated)
G_BeginRecording(); //this has to move here, since dedicated servers dont run got_mapcmd
}
wantedcalcdelay = wantedfrequency*2;
@@ -2868,12 +2866,9 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeEndScreen();
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
else //dedicated servers
{
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
// Reset the palette now all fades have been done
+1
View File
@@ -654,6 +654,7 @@ void P_Ticker(boolean run)
{
P_MapStart();
R_UpdateMobjInterpolators();
R_UpdateLevelInterpolators();
OP_ObjectplaceMovement(&players[0]);
P_MoveChaseCamera(&players[0], &camera[0], false);
R_UpdateViewInterpolation();
+15 -17
View File
@@ -4296,19 +4296,17 @@ void P_DoTimeOver(player_t *player)
exitcountdown = 5*TICRATE;
}
/* gaysed script from me, based on Golden's sprite slope roll */
/* gaysed script from me, based on Golden's sprite slope roll */
// holy SHIT
static INT32
Quaketilt (player_t *player)
static INT32 Quaketilt(player_t *player)
{
angle_t tilt;
angle_t tilt, moma;
fixed_t lowb; // this threshold for speed
angle_t moma = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
INT32 delta = (INT32)( player->mo->angle - moma );
INT32 delta;
fixed_t speed;
boolean sliptiding = player->kartstuff[k_drift] ? 0 : player->kartstuff[k_aizdriftstrat];
moma = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
delta = (INT32)( player->mo->angle - moma );
if (delta == (INT32)ANGLE_180)/* FUCK YOU HAVE A HACK */
{
@@ -4318,6 +4316,9 @@ Quaketilt (player_t *player)
// Hi! I'm "not a math guy"!
if (abs(delta) > ANGLE_90)
delta = (INT32)(( moma + ANGLE_180 ) - player->mo->angle );
const boolean sliptiding = player->kartstuff[k_drift] ? 0 : player->kartstuff[k_aizdriftstrat];
if (P_IsObjectOnGround(player->mo))
{
if (sliptiding)
@@ -4336,23 +4337,24 @@ Quaketilt (player_t *player)
tilt = ANGLE_22h;
lowb = 10*FRACUNIT;
}
lowb = FixedMul(lowb, player->mo->scale);
moma = FixedMul(FixedDiv(delta, ANGLE_90), tilt);
speed = abs( player->mo->momx + player->mo->momy );
if (speed < lowb)
{
// ease out tilt as we slow...
moma = FixedMul(moma, FixedDiv(speed, lowb));
}
return moma;
}
static void
DoABarrelRoll (player_t *player)
static void DoABarrelRoll(player_t *player)
{
angle_t slope;
angle_t slope = 0;
angle_t delta;
fixed_t smoothing;
if (player->exiting)
@@ -4370,10 +4372,6 @@ DoABarrelRoll (player_t *player)
{
slope = player->mo->standingslope->real_zangle;
}
else
{
slope = 0;
}
if (abs((INT32)slope) > ANGLE_11hh)
{
@@ -4394,7 +4392,7 @@ DoABarrelRoll (player_t *player)
smoothing = FixedDiv(AbsAngle(slope), ANGLE_45);
delta = FixedDiv(delta, cv_tiltsmoothing.value *
FixedDiv(FRACUNIT, FRACUNIT + smoothing));
FixedDiv(FRACUNIT, FRACUNIT + smoothing));
if (delta)
player->tilt += delta;
+16 -5
View File
@@ -690,12 +690,15 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// Patch identifier
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch name should be");
}
texturesTokenLength = strlen(texturesToken);
if (texturesTokenLength>8)
if (texturesTokenLength > 8)
{
I_Error("Error parsing TEXTURES lump: Patch name \"%s\" exceeds 8 characters",texturesToken);
}
@@ -713,10 +716,12 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// Comma 1
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after \"%s\"'s patch name should be",patchName);
}
if (strcmp(texturesToken,",")!=0)
{
I_Error("Error parsing TEXTURES lump: Expected \",\" after %s's patch name, got \"%s\"",patchName,texturesToken);
@@ -725,14 +730,17 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// XPos
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch \"%s\"'s x coordinate should be",patchName);
}
endPos = NULL;
#ifndef AVOID_ERRNO
errno = 0;
#endif
patchXPos = strtol(texturesToken,&endPos,10);
(void)patchXPos; //unused for now
if (endPos == texturesToken // Empty string
@@ -748,10 +756,12 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// Comma 2
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after patch \"%s\"'s x coordinate should be",patchName);
}
if (strcmp(texturesToken,",")!=0)
{
I_Error("Error parsing TEXTURES lump: Expected \",\" after patch \"%s\"'s x coordinate, got \"%s\"",patchName,texturesToken);
@@ -760,6 +770,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// YPos
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch \"%s\"'s y coordinate should be",patchName);
@@ -1131,9 +1142,9 @@ static void R_InitExtraColormaps(void)
lumpnum_t R_GetFlatNumForName(const char *name)
{
INT32 i;
lumpnum_t lump;
lumpnum_t start;
lumpnum_t end;
lumpnum_t lump = LUMPERROR;
lumpnum_t start = LUMPERROR;
lumpnum_t end = LUMPERROR;
// Scan wad files backwards so patched flats take preference.
for (i = numwadfiles - 1; i >= 0; i--)
@@ -1608,7 +1619,7 @@ const char *R_ColormapNameForNum(INT32 num)
if (num == -1)
return "NONE";
if (num < 0 || num > MAXCOLORMAPS)
if (num < 0 || num >= MAXCOLORMAPS)
I_Error("R_ColormapNameForNum: num %d is invalid!\n", num);
if (foundcolormaps[num] == LUMPERROR)
+1 -1
View File
@@ -668,7 +668,7 @@ typedef struct
INT16 height;
INT16 leftoffset; // pixels to the left of origin
INT16 topoffset; // pixels below the origin
INT32 columnofs[8]; // only [width] used
INT32 columnofs[]; // only [width] used
// the [0] is &columnofs[width]
} ATTRPACK softwarepatch_t;
-4
View File
@@ -782,10 +782,6 @@ void R_DrawSpan_8 (void)
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
if (dest+8 > deststop)
{
return;
+16 -15
View File
@@ -125,16 +125,17 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
{8192, "8192"}, {12288, "12288"}, {20480, "20480"},
{24576, "24576"},{0, "Infinite"}, {0, NULL}};
#if defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) || defined(__arm64__) // only for 64bit (idk how else to proper check lmao)
#if __SIZEOF_POINTER__ < 8 // only for 64bit
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
{256, "256"}, {512, "512"}, {768, "768"},
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"}, {0, "None"}, {0, NULL}};
{0, "None"}, {0, NULL}};
#else
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{0, "None"}, {0, NULL}};
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"}, {0, "None"}, {0, NULL}};
#endif
static CV_PossibleValue_t maxinterpdist_cons_t[] = {
@@ -1062,7 +1063,7 @@ static void R_SetupCommonFrame(player_t * player, sector_t * sector)
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
{
if (player->awayviewtics)
if (player->awayviewtics && player->awayviewmobj)
{
newview->aim = player->awayviewaiming;
newview->angle = player->awayviewmobj->angle;
@@ -1168,7 +1169,7 @@ void R_SkyboxFrame(int s)
{
mapheader_t *mh = mapheaderinfo[gamemap-1];
if (player->awayviewtics)
if (player->awayviewtics && player->awayviewmobj)
{
SETUPSKYVIEW(player->awayviewmobj, (player->awayviewmobj->z + 20*FRACUNIT));
}
@@ -1225,7 +1226,7 @@ void R_SetupFrame(int s, boolean skybox)
R_SetupAimingFrame(player, thiscam);
if (player->awayviewtics) // cut-away view stuff
if (player->awayviewtics && player->awayviewmobj) // cut-away view stuff
{
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
I_Assert(viewmobj != NULL);
@@ -1234,7 +1235,7 @@ void R_SetupFrame(int s, boolean skybox)
newview->y = viewmobj->y;
newview->z = viewmobj->z + 20*FRACUNIT;
if (!P_MobjWasRemoved(viewmobj) && viewmobj->subsector && viewmobj->subsector->sector)
if (viewmobj->subsector && viewmobj->subsector->sector)
sector = viewmobj->subsector->sector;
R_SetupCommonFrame(player, sector);
@@ -1252,7 +1253,7 @@ void R_SetupFrame(int s, boolean skybox)
R_SetupCommonFrame(player, sector);
}
else // use the player's eyes view
else if (player->mo) // use the player's eyes view
{
viewmobj = player->mo;
I_Assert(viewmobj != NULL);
@@ -1261,7 +1262,7 @@ void R_SetupFrame(int s, boolean skybox)
newview->y = viewmobj->y;
newview->z = player->viewz;
if (!P_MobjWasRemoved(viewmobj) && viewmobj->subsector && viewmobj->subsector->sector)
if (viewmobj->subsector && viewmobj->subsector->sector)
sector = viewmobj->subsector->sector;
R_SetupCommonFrame(player, sector);
@@ -1349,10 +1350,10 @@ void R_RenderPlayerView(player_t *player)
for (UINT8 j = 0; j <= splitscreen; j++)
{
if (player == &players[displayplayers[i]]
&& viewfov[i] != fov)
if (player == &players[displayplayers[j]]
&& viewfov[j] != fov)
{
viewfov[i] = fov;
viewfov[j] = fov;
R_SetFov(fov);
}
}
+11 -8
View File
@@ -826,15 +826,18 @@ void R_DrawSinglePlane(visplane_t *pl)
// Don't draw planes that shouldn't be drawn.
for (rover = pl->ffloor->target->ffloors; rover; rover = rover->next)
{
if (!((pl->ffloor->flags & FF_CUTEXTRA) && (rover->flags & FF_EXTRA)))
continue;
if ((pl->ffloor->flags & FF_CUTEXTRA) && (rover->flags & FF_EXTRA))
{
if (!(rover->flags & FF_EXTRA))
continue;
// The plane is from an extra 3D floor... Check the flags so
// there are no undesired cuts.
if (((pl->ffloor->flags & (FF_FOG|FF_SWIMMABLE)) == (rover->flags & (FF_FOG|FF_SWIMMABLE)))
&& pl->height < *rover->topheight
&& pl->height > *rover->bottomheight)
return;
// The plane is from an extra 3D floor... Check the flags so
// there are no undesired cuts.
if (((pl->ffloor->flags & (FF_FOG|FF_SWIMMABLE)) == (rover->flags & (FF_FOG|FF_SWIMMABLE)))
&& pl->height < *rover->topheight
&& pl->height > *rover->bottomheight)
return;
}
}
if (pl->ffloor->flags & FF_TRANSLUCENT)
+11 -3
View File
@@ -1436,6 +1436,11 @@ musicdef_t *S_FindMusicCredit(const char *musname)
return NULL;
}
void S_ResetMusicCredit(void)
{
memset(&cursongcredit, 0, sizeof(cursongcredit));
}
//
// S_ShowSpecifiedMusicCredit
//
@@ -2042,9 +2047,12 @@ static boolean S_SkipIntroMusic(void)
char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
// check if menu music is playing, otherwise it may continue playing
if (!stricmp(music.name, "titles") || (maptitle && (!stricmp(maptitle, "Wandering Falls")))) // wandering balls changes its song when the race starts Zzz...
skip = false;
if (maptitle)
{
// check if menu music is playing, otherwise it may continue playing
if (!stricmp(music.name, "titles") || (maptitle && (!stricmp(maptitle, "Wandering Falls")))) // wandering balls changes its song when the race starts Zzz...
skip = false;
}
Z_Free(maptitle);
+1
View File
@@ -206,6 +206,7 @@ void S_InitMTDefs(void);
musicdef_t *S_FindMusicCredit(const char *musname);
void S_ShowSpecifiedMusicCredit(const char *musname);
void S_ShowMusicCredit(void);
void S_ResetMusicCredit(void);
boolean S_PrepareSoundTest(void);
Loaded 100 of 112 files, more files were not shown because too many files have changed in this diff. Show more