Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b07022379 | ||
|
|
a4fce0b3b1 | ||
|
|
79ad1f8d51 | ||
|
|
73aef11554 | ||
|
|
318916abc9 | ||
|
|
164a9d604a | ||
|
|
7696b115ae | ||
|
|
b8ecaf336c | ||
|
|
1ea8ebf84c | ||
|
|
9f70fe5373 | ||
|
|
9695ede7c2 | ||
|
|
a5cd72d5db | ||
|
|
f87e282981 | ||
|
|
4b15972543 | ||
|
|
d5753bb15a | ||
|
|
a92e5b3f7b | ||
|
|
72d2357560 | ||
|
|
d306b560b1 | ||
|
|
4d331d9c9f | ||
|
|
932f6d83f7 | ||
|
|
d57783aa3a | ||
|
|
1d79854d3b |
No files matched your search
@@ -1,346 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e # Enable auto-exit for debugging :))
|
||||
|
||||
# Make Linux AppImage program data
|
||||
# https://docs.appimage.org/reference/appdir.html
|
||||
|
||||
# PWD: {repo_root}/build
|
||||
# See deployer.sh for usage
|
||||
|
||||
# Terminal stuff
|
||||
RESET="$(tput sgr0)" #"\e[0m" # Resets terminal colors
|
||||
|
||||
# Colors for various information types
|
||||
FAILURE="$(tput setaf 1)" #"\e[91m"
|
||||
SUCCESS="$(tput setaf 2)" #"\e[92m"
|
||||
NOTICE="$(tput setaf 3)" #"\e[93m"
|
||||
VERBOSE="$(tput setaf 4)" #"\e[94m"
|
||||
|
||||
verbosity=0 # By default don't print anything unless it's *ultra* important.
|
||||
quiet=0 # Also don't print anything if they supplied the quiet argument
|
||||
|
||||
# URL from which to download appimagetool if there isn't one available in your $PATH
|
||||
# at time of writing only aarch64, armhf, i686, and x86_64 versions are available via this method
|
||||
# in those cases, and honestly even outside of those cases, it's better to just put a working one in your $PATH yourself..
|
||||
url="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$(uname -m).AppImage"
|
||||
|
||||
# A whitelist of libraries to include into SRB2's AppImage if SRB2 is dynamically linked.
|
||||
# please don't add a newline at the end of this or i will cry :(
|
||||
libraryWhitelist="
|
||||
libbacktrace
|
||||
libnsl
|
||||
libSDL2
|
||||
libSDL2_mixer
|
||||
libgme
|
||||
libopenmpt
|
||||
libpng
|
||||
libfluidsynth
|
||||
libpulse
|
||||
libmodplug
|
||||
libvorbisfile
|
||||
libopusfile
|
||||
libFLAC
|
||||
libmad
|
||||
libmpg123
|
||||
libvorbis
|
||||
libpulsecommon
|
||||
libsndfile
|
||||
libsndio
|
||||
libogg
|
||||
libvorbisenc
|
||||
libjson
|
||||
libreadline
|
||||
libwrap
|
||||
libtinfo
|
||||
libtirpc
|
||||
libpng16"
|
||||
|
||||
# these kinda look like macros don't they
|
||||
function print { (( "$quiet" == 0 )) && echo "$@" || :; } # echo if not quiet
|
||||
function coloredText { printf "$1"; print "${@:2}"; printf "$RESET"; } # use print to inherit quiet
|
||||
function success { coloredText "$SUCCESS" "$@"; } # use coloredText to inherit quiet
|
||||
function important { coloredText "$NOTICE" "$@"; } # use coloredText to inherit quiet
|
||||
function verboseOnly { (( "$verbosity" >= $1 )) && (coloredText "$VERBOSE" "${@:2}") || :; } # use coloredText to inherit quiet
|
||||
|
||||
# Parses an argument with a single dash
|
||||
function parseSingleDashArg() {
|
||||
while read -n 1 char; do
|
||||
if [[ "$char" == '-' || "$char" == '' ]]; then
|
||||
:
|
||||
elif [[ "$char" == 'h' ]]; then
|
||||
helppassed=1
|
||||
elif [[ "$char" == 'q' ]]; then
|
||||
quiet=1
|
||||
elif [[ "$char" == 'v' ]]; then
|
||||
verbosity="$((verbosity + 1))"
|
||||
elif [[ "$char" == 'd' ]]; then
|
||||
dry=1
|
||||
elif [[ "$char" == 's' ]]; then
|
||||
small=1
|
||||
else
|
||||
echo "$0: invalid option -- '$1'"
|
||||
echo "Try '$0 --help' for more information."
|
||||
return 1
|
||||
fi
|
||||
done <<<"$1"
|
||||
}
|
||||
|
||||
# Simple help argument checker.
|
||||
currentarg=1; # Which argument is --help...
|
||||
|
||||
# For $arg in the argument array...
|
||||
for arg in "$@"; do
|
||||
# Is it a help argument?
|
||||
if [[ "$arg" == "--help" ]]; then
|
||||
helppassed=1; # Help is passed, set $helppassed!
|
||||
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}" # Remove argument from list
|
||||
elif [[ "$arg" == "--quiet" ]]; then
|
||||
quiet=1
|
||||
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
|
||||
elif [[ "$arg" == "--verbose" ]]; then
|
||||
verbosity="$((verbosity + 1))" # Increase verbosity!
|
||||
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
|
||||
elif [[ "$arg" == "--dry" ]]; then
|
||||
dry=1; # Show parameters instead of using them.
|
||||
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
|
||||
elif [[ "$arg" == "--small" ]]; then
|
||||
small=1; # Don't copy assets to save on bandwidth.
|
||||
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
|
||||
elif [[ ! "$arg" == *'--'* && "$arg" == *'-'* ]]; then
|
||||
parseSingleDashArg "$arg"
|
||||
|
||||
if [[ "$?" == 0 ]]; then
|
||||
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}" # Remove argument from list
|
||||
fi
|
||||
elif [[ $arg == *'--'* ]]; then
|
||||
print "$0: invalid option -- '$1'"
|
||||
print "Try '$0 --help' for more information."
|
||||
return 1
|
||||
else
|
||||
currentarg="$((currentarg+1))" # Increment current argument number otherwise...
|
||||
fi
|
||||
done
|
||||
|
||||
important "SRB2Kart AppImage Packager v1.0 modified for kart by NepDisk."
|
||||
important "Orignal for SRB2 my mazmazz and Golden."
|
||||
|
||||
# Get root directory from the full path of this script.
|
||||
__ROOT_DIR="$3"
|
||||
|
||||
if [[ -z "$3" ]]; then
|
||||
# finds out where this script is and goes to that directory and goes up one for the root
|
||||
|
||||
scriptdir="$(dirname "${BASH_SOURCE[0]}")"
|
||||
scriptbase="$(basename "${BASH_SOURCE[0]}")"
|
||||
|
||||
__ROOT_DIR="$(cd "$scriptdir" && pwd -P)"
|
||||
fi
|
||||
|
||||
# If it starts with '.', put the current working directory behind it so things work.
|
||||
if [[ "$__ROOT_DIR" == '.' || "$__ROOT_DIR" == '..' ]]; then
|
||||
__ROOT_DIR="$PWD/$__ROOT_DIR"
|
||||
fi
|
||||
|
||||
# Set up defaults
|
||||
__PROGRAM_NAME="${PROGRAM_NAME:-"SRB2Kart Saturn"}"
|
||||
__PROGRAM_DESCRIPTION="${PROGRAM_DESCRIPTION:-"Modded version of SRB2kart with more features."}"
|
||||
__PROGRAM_FILENAME="${PROGRAM_FILENAME:-"lsdl2srb2kart"}"
|
||||
__PROGRAM_ASSETS="${PROGRAM_ASSETS:-"$__ROOT_DIR/assets/installer"}"
|
||||
|
||||
__BUILD_DIR="${1:-"$__ROOT_DIR/bin"}"
|
||||
__OUTPUT_FILENAME="${2:-"$__PROGRAM_FILENAME.AppImage"}"
|
||||
|
||||
__APPIMAGETOOL="${4:-"appimagetool"}"
|
||||
|
||||
if (! command -v "$__APPIMAGETOOL" &> /dev/null); then
|
||||
__APPIMAGETOOL=
|
||||
fi
|
||||
|
||||
# Stuff that prints and exits.
|
||||
|
||||
# Prints setup text using method given by arguments.
|
||||
# Example: printSetup "print" # print "Setup for AppImage...
|
||||
function printSetup {
|
||||
$@ "Setup for AppImage in BUILD_DIR: '$__BUILD_DIR'..."
|
||||
$@ "With the OUTPUT_FILENAME: '$__OUTPUT_FILENAME'"
|
||||
$@ "And SRB2 Repository Root ROOT_DIR: '$__ROOT_DIR'"
|
||||
$@ "Using APPIMAGETOOL: '$([ -z "$__APPIMAGETOOL" ] && echo '(download)' || echo $__APPIMAGETOOL)'"
|
||||
$@ ""
|
||||
$@ "This should be run from a Makefile or from the directory of the build. If it is not, then change to that directory or specify that directory as an argument."
|
||||
$@ "If ROOT_DIR isn't SRB2's repository root, specify that as an argument too."
|
||||
$@ "Make must have built the program before you run this script."
|
||||
$@ ""
|
||||
$@ "Make sure these Environment Variables are correct."
|
||||
$@ "If not, then enter: export PROGRAM_VARIABLE=value"
|
||||
$@ "PROGRAM_NAME: $__PROGRAM_NAME"
|
||||
$@ "PROGRAM_DESCRIPTION: $__PROGRAM_DESCRIPTION"
|
||||
$@ "PROGRAM_FILENAME: $__PROGRAM_FILENAME"
|
||||
$@ "PROGRAM_ASSETS: $__PROGRAM_ASSETS"
|
||||
}
|
||||
|
||||
if [[ "$helppassed" ]]; then
|
||||
print "Usage: $(basename "$0") [OPTION]... [BUILD_DIR] [OUTPUT_NAME] [ROOT_DIR] [APPIMAGETOOL]"
|
||||
print "Packages a SRB2 binary into an AppImage."
|
||||
print "OPTIONs may be included anywhere within the arguments."
|
||||
print ""
|
||||
print "Arguments:"
|
||||
print " -h, --help display this help and exit."
|
||||
print " -q, --quiet don't display any text."
|
||||
print " -v, --verbose make commands more verbose, will always print."
|
||||
print " -s, --small don't copy SRB2 assets to save on bandwidth."
|
||||
print " parameters regardless of --dry."
|
||||
print " -d, --dry print parameters and exit."
|
||||
print ""
|
||||
if (( "$verbosity" > 0 )) || [[ "$dry" ]]; then
|
||||
printSetup "print"
|
||||
else
|
||||
print "This should be run from a Makefile or from the directory of the build."
|
||||
print "Make must have built the program before you run this script."
|
||||
fi
|
||||
exit;
|
||||
fi
|
||||
|
||||
if (( "$verbosity" > 0 )) || [[ "$dry" ]]; then
|
||||
printSetup "verboseOnly" "0"
|
||||
verboseOnly 0 ""
|
||||
|
||||
if [[ "$dry" ]]; then
|
||||
set -n # Enable debug mode and verbose for dry run.
|
||||
fi
|
||||
fi
|
||||
|
||||
# End stuff that prints and exits.
|
||||
|
||||
if (( "$verbosity" >= 4 )); then
|
||||
set -v # Really verbose? Print *everything*!
|
||||
fi
|
||||
|
||||
# Define AppDir structure
|
||||
mkdir -p "$__BUILD_DIR/AppDir/usr/bin"
|
||||
mkdir -p "$__BUILD_DIR/AppDir/lib"
|
||||
mkdir -p "$__BUILD_DIR/AppDir/usr/share/applications"
|
||||
mkdir -p "$__BUILD_DIR/AppDir/usr/share/icons/hicolor/256x256/apps"
|
||||
|
||||
# Copy program data
|
||||
if [[ ! $small ]]; then
|
||||
verboseOnly 1 "Packaging program assets..."
|
||||
cp -r "$__PROGRAM_ASSETS"/* "$__BUILD_DIR/AppDir/usr/bin/"
|
||||
cp -r "$__BUILD_DIR/$__PROGRAM_FILENAME" "$__BUILD_DIR/AppDir/usr/bin"
|
||||
else
|
||||
verboseOnly 1 "Skipping program asset packing, --small or -s passed..."
|
||||
fi
|
||||
|
||||
verboseOnly 1 "Packaging SRB2..."
|
||||
verboseOnly 1 "Assuming executable name $__PROGRAM_FILENAME"
|
||||
cp -r "$__BUILD_DIR/$__PROGRAM_FILENAME" "$__BUILD_DIR/AppDir/usr/bin"
|
||||
|
||||
# Copy required dependencies, but only if the program is dynamically linked.
|
||||
verboseOnly 1 "Testing if this build is dynamically linked..."
|
||||
|
||||
set +e # Disable auto-exit for ldd.
|
||||
|
||||
srb2Libraries="$(ldd "$__BUILD_DIR/$__PROGRAM_FILENAME")"
|
||||
exitcode="$?"
|
||||
|
||||
set -e # Enable it again!
|
||||
|
||||
if (( $exitcode == 0 )); then
|
||||
verboseOnly 1 "This build *is* dynamically linked! Packaging dependencies."
|
||||
|
||||
# read the dynamic libraries of srb2, trim off beginning whitespace, and get the third field seperated by spaces
|
||||
# this gives us a newline-seperated list of libraries with their full paths.
|
||||
srb2Libraries="$(echo "$srb2Libraries" | cut -f 2 | cut -d ' ' -f 3)"
|
||||
|
||||
# remove any extraneous newlines around the string
|
||||
libraryWhitelist="$(echo $libraryWhitelist | head -c -1 | tr ' ' '\n')"
|
||||
|
||||
# replace e.g. 'abc' with '(/abc\b)', and replace newlines with '|'.
|
||||
# this converts it into a grep regular expression to check for any whitelisted library names.
|
||||
libraryWhitelist="$(printf "%s" "$libraryWhitelist" | sed 's|.*|(/\0\\b)|' | tr '\n' '|')"
|
||||
|
||||
# grab only the entries that match the regex
|
||||
__LDD_LIST="$(printf "%s" "$srb2Libraries" | grep -E "$libraryWhitelist")"
|
||||
|
||||
# use echo to convert the newline-seperated list into an argument list
|
||||
__LDD_LIST="$(echo $__LDD_LIST)"
|
||||
|
||||
# read into an array because i can't be bothered iterating the lines of a string today
|
||||
# there's so many other things in this file that'd need to be adjusted to be POSIX-compliant anyway
|
||||
IFS=' ' read -r -a paths <<< "$__LDD_LIST"
|
||||
|
||||
for path in "${paths[@]}"; do
|
||||
if [ -f "$path" ]; then
|
||||
verboseOnly 2 "Packaging dependency $(basename "$path")..."
|
||||
cp "$path" $__BUILD_DIR/AppDir/lib/
|
||||
else
|
||||
verboseOnly 2 "Dependency $(basename "$path") not found"
|
||||
fi
|
||||
done
|
||||
else
|
||||
verboseOnly 1 "This SRB2 build is statically linked, skipping dependency packing."
|
||||
fi
|
||||
|
||||
cd "$__BUILD_DIR/AppDir"
|
||||
|
||||
# Copy icons
|
||||
verboseOnly 1 "Packaging resources..."
|
||||
cp "$__ROOT_DIR/srb2.png" "./usr/share/icons/hicolor/256x256/apps/$__PROGRAM_FILENAME.png"
|
||||
ln -sf "./usr/share/icons/hicolor/256x256/apps/$__PROGRAM_FILENAME.png" "./.DirIcon"
|
||||
ln -sf "./usr/share/icons/hicolor/256x256/apps/$__PROGRAM_FILENAME.png" "./$__PROGRAM_FILENAME.png"
|
||||
|
||||
# Make desktop descriptor
|
||||
cat > "./usr/share/applications/$__PROGRAM_FILENAME.desktop" <<EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=$__PROGRAM_NAME
|
||||
Comment=$__PROGRAM_DESCRIPTION
|
||||
Icon=$__PROGRAM_FILENAME
|
||||
Exec=AppRun %F
|
||||
Categories=Game;
|
||||
EOF
|
||||
|
||||
ln -sf "./usr/share/applications/$__PROGRAM_FILENAME.desktop" "./$__PROGRAM_FILENAME.desktop"
|
||||
|
||||
# Make entry point
|
||||
echo -e '#!'"$(dirname "$SHELL")/sh" > ./AppRun
|
||||
echo -e 'HERE="$(dirname "$(readlink -f "${0}")")"' >> ./AppRun
|
||||
echo -e 'SRB2WADDIR=$HERE/usr/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HERE/lib exec $HERE/usr/bin/'"$__PROGRAM_FILENAME"' "$@"' >> ./AppRun
|
||||
chmod +x ./AppRun
|
||||
|
||||
cd .. # now in $__BUILD_DIR
|
||||
|
||||
# Package AppImage
|
||||
if [ -z "$__APPIMAGETOOL" ]; then
|
||||
verboseOnly 1 "No valid appimagetool path given or detected, downloading appimagetool..."
|
||||
|
||||
# Print notice for internet connection.
|
||||
important "If the command hangs here, check your internet connection, or download appimagetool and add it to your \$PATH and try compiling again."
|
||||
|
||||
(( "$verbosity" >= 3 )) && wget "$url" || wget -q "$url"
|
||||
|
||||
APPIMAGETOOL="./$(basename "$url")"
|
||||
chmod a+x "$APPIMAGETOOL"
|
||||
else
|
||||
verboseOnly 1 "appimagetool path given or detected, no download required."
|
||||
APPIMAGETOOL="$__APPIMAGETOOL"
|
||||
fi
|
||||
|
||||
verboseOnly 1 "Packing AppImage $__OUTPUT_FILENAME"
|
||||
|
||||
if (( verbosity >= 3 )); then
|
||||
"$APPIMAGETOOL" ./AppDir "$__OUTPUT_FILENAME"
|
||||
elif (( verbosity >= 2 )); then
|
||||
"$APPIMAGETOOL" ./AppDir "$__OUTPUT_FILENAME" >/dev/null
|
||||
else
|
||||
"$APPIMAGETOOL" ./AppDir "$__OUTPUT_FILENAME" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
success "AppImage ready!"
|
||||
verboseOnly 1 "Cleaning up files..."
|
||||
rm -r ./AppDir
|
||||
|
||||
if [ -z "$__APPIMAGETOOL" ]; then
|
||||
rm "$APPIMAGETOOL"
|
||||
fi
|
||||
|
||||
cd "$__ROOT_DIR" # snap back to reality
|
||||
-33
@@ -130,36 +130,3 @@ if rawget(_G, "S_StopSoundByNum") ~= nil then
|
||||
... -- Can use it
|
||||
end
|
||||
```
|
||||
## addHook("ServerJoin", function())
|
||||
|
||||
ServerJoin hook called when client joins server (starting a listen server also calls it for host).
|
||||
Generally it was made to make loading custom config files less hacky, but can be used for anything else too.
|
||||
|
||||
## player.viewrollangle field
|
||||
|
||||
Returns player's current view roll angle for the Screen Tilting feature, useful for HUD elements.
|
||||
|
||||
## G_SetPlayerGamepadIndicatorColor(player, skincolor)
|
||||
|
||||
Set a custom color for Supported Gamepads with RGB LED functionality.
|
||||
To be used with Displayplayers.
|
||||
Only takes Skincolors.
|
||||
Best to be used in a Loop to ensure the color wont get overwritten by the game.
|
||||
|
||||
## G_PlayerDeviceRumble(player, low_strength, high_strength, -optional- duration)
|
||||
|
||||
Add Gamepad Rumble support for things.
|
||||
To be used with Displayplayers.
|
||||
Duration is in milliseconds and is optional to set, default value is 84ms.
|
||||
|
||||
# Other changes
|
||||
|
||||
## P_PlayRinglossSound(source, damager)
|
||||
|
||||
Add optional `damager` argument (should be `mobj_t`), which causes hurt sound also play for damager
|
||||
if `karthitemdialog` option is enabled
|
||||
|
||||
## K_PlayHitEmSound(mobj, victim)
|
||||
|
||||
Add optional `victim` argument (should be a player's `mobj_t`), which causes "hit em" sound to be
|
||||
delayed and played for victim too if `karthitemdialog` option is enabled
|
||||
@@ -1 +1 @@
|
||||
/lsdl2srb2kart
|
||||
/lsdlsrb2
|
||||
@@ -28,7 +28,6 @@ LOCAL_SRC_FILES := am_map.c \
|
||||
m_cheat.c \
|
||||
m_fixed.c \
|
||||
m_menu.c \
|
||||
m_textinput.c \
|
||||
m_misc.c \
|
||||
m_queue.c \
|
||||
m_random.c \
|
||||
|
||||
+551
-553
File diff suppressed because it is too large.
Load diff
+2
-41
@@ -106,8 +106,6 @@ ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
|
||||
|
||||
else # if you on the *nix
|
||||
|
||||
NOUPX=1
|
||||
|
||||
system:=$(shell uname -s)
|
||||
|
||||
ifeq ($(system),Linux)
|
||||
@@ -207,18 +205,6 @@ USE_FBO_OGL=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
ifndef NOSATURNSYNCH
|
||||
DOSATURNSYNCH=1
|
||||
ifndef NOSATURNJOIN
|
||||
DOSATURNJOIN=1
|
||||
endif
|
||||
ifndef NOSATURNPAK
|
||||
DOSATURNPAK=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MINGW
|
||||
include win32/Makefile.cfg
|
||||
endif #ifdef MINGW
|
||||
@@ -292,12 +278,12 @@ ifdef NOHW
|
||||
OPTS+=-DNOHW
|
||||
else
|
||||
OPTS+=-DHWRENDER
|
||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
|
||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
|
||||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
|
||||
endif
|
||||
|
||||
OPTS += -DCOMPVERSION -fwrapv
|
||||
OPTS += -DCOMPVERSION
|
||||
|
||||
ifndef NONX86
|
||||
ifndef GCC29
|
||||
@@ -398,18 +384,6 @@ OPTS+=-DUSE_FBO_OGL
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
ifndef NOSATURNSYNCH
|
||||
OPTS+=-DDOSATURNSYNCH
|
||||
ifndef NOSATURNJOIN
|
||||
OPTS+=-DDOSATURNJOIN
|
||||
endif
|
||||
ifndef NOSATURNPAK
|
||||
OPTS+=-DDOSATURNPAK
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_MINIUPNPC
|
||||
ifdef NONET
|
||||
HAVE_MINIUPNPC=''
|
||||
@@ -518,7 +492,6 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/hu_stuff.o \
|
||||
$(OBJDIR)/y_inter.o \
|
||||
$(OBJDIR)/st_stuff.o \
|
||||
$(OBJDIR)/k_director.o \
|
||||
$(OBJDIR)/k_kart.o \
|
||||
$(OBJDIR)/m_aatree.o \
|
||||
$(OBJDIR)/m_anigif.o \
|
||||
@@ -529,7 +502,6 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/m_fixed.o \
|
||||
$(OBJDIR)/m_menu.o \
|
||||
$(OBJDIR)/m_misc.o \
|
||||
$(OBJDIR)/m_textinput.o \
|
||||
$(OBJDIR)/m_perfstats.o \
|
||||
$(OBJDIR)/m_random.o \
|
||||
$(OBJDIR)/m_queue.o \
|
||||
@@ -658,17 +630,6 @@ ifndef NOUPX
|
||||
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef APPIMAGE
|
||||
@echo Building AppImage...
|
||||
ifdef APPIMAGE_NOASSETS
|
||||
$(.)../AppImage_build.sh --small --quiet $(BIN)/
|
||||
else
|
||||
$(.)../AppImage_build.sh -q $(BIN)/
|
||||
endif
|
||||
@echo AppImage build complete, please look for $(EXENAME).AppImage in $(BIN)
|
||||
endif
|
||||
|
||||
@echo Build is done, please look for $(EXENAME) in $(BIN), \(checking for post steps\)
|
||||
|
||||
reobjdump:
|
||||
|
||||
+7
-12
@@ -12,7 +12,7 @@
|
||||
# to avoid a false positive with the version detection...
|
||||
|
||||
SUPPORTED_GCC_VERSIONS:=\
|
||||
142 141 140 14\
|
||||
141 14\
|
||||
132 131 130 13\
|
||||
123 122 121 120 12\
|
||||
114 113 112 111 110 11\
|
||||
@@ -24,7 +24,7 @@ SUPPORTED_GCC_VERSIONS:=\
|
||||
55 54 53 52 51 50\
|
||||
49 48 47 46 45 44 43 42 41 40
|
||||
|
||||
LATEST_GCC_VERSION=14.2.1
|
||||
LATEST_GCC_VERSION=14.1
|
||||
|
||||
# gcc or g++
|
||||
ifdef PREFIX
|
||||
@@ -78,20 +78,12 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef GCC142
|
||||
ifdef GCC141
|
||||
GCC141=1
|
||||
endif
|
||||
|
||||
ifdef GCC141
|
||||
GCC140=1
|
||||
endif
|
||||
|
||||
ifdef GCC14
|
||||
GCC140=1
|
||||
endif
|
||||
|
||||
ifdef GCC140
|
||||
GCC132=1
|
||||
GCC14=1
|
||||
endif
|
||||
|
||||
ifdef GCC132
|
||||
@@ -445,6 +437,9 @@ endif
|
||||
ifdef GCC44
|
||||
WFLAGS+=-Wno-error=array-bounds
|
||||
endif
|
||||
ifdef GCC45
|
||||
opts+=-fwrapv
|
||||
endif
|
||||
ifdef GCC46
|
||||
WFLAGS+=-Wno-error=suggest-attribute=noreturn
|
||||
endif
|
||||
|
||||
+17
-10
@@ -260,15 +260,25 @@ static inline void AM_restoreScaleAndLoc(void)
|
||||
*/
|
||||
static void AM_findMinMaxBoundaries(void)
|
||||
{
|
||||
fixed_t a, b;
|
||||
size_t i;
|
||||
fixed_t a;
|
||||
fixed_t b;
|
||||
|
||||
min_x = minimapinfo.min_x << MAPBITS;
|
||||
max_x = minimapinfo.max_x << MAPBITS;
|
||||
min_y = minimapinfo.min_y << MAPBITS;
|
||||
max_y = minimapinfo.max_y << MAPBITS;
|
||||
min_x = min_y = +INT32_MAX;
|
||||
max_x = max_y = -INT32_MAX;
|
||||
|
||||
max_w = minimapinfo.map_w << MAPBITS;
|
||||
max_h = minimapinfo.map_h << MAPBITS;
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
{
|
||||
if (vertexes[i].x < min_x)
|
||||
min_x = vertexes[i].x;
|
||||
else if (vertexes[i].x > max_x)
|
||||
max_x = vertexes[i].x;
|
||||
|
||||
if (vertexes[i].y < min_y)
|
||||
min_y = vertexes[i].y;
|
||||
else if (vertexes[i].y > max_y)
|
||||
max_y = vertexes[i].y;
|
||||
}
|
||||
|
||||
max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS);
|
||||
max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS);
|
||||
@@ -1005,9 +1015,6 @@ static inline void AM_drawPlayers(void)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
|
||||
p = &players[i];
|
||||
if (p->skincolor > 0)
|
||||
|
||||
+253
-54
@@ -32,7 +32,6 @@
|
||||
#include "i_threads.h"
|
||||
#include "d_main.h"
|
||||
#include "m_menu.h"
|
||||
#include "m_textinput.h"
|
||||
#include "filesrch.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -44,12 +43,8 @@
|
||||
#ifdef HAVE_THREADS
|
||||
I_mutex con_mutex;
|
||||
|
||||
// g_in_exiting_signal_handler is an evil hack
|
||||
// to avoid infinite SIGABRT recursion in the signal handler
|
||||
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
||||
// or something like that. idk
|
||||
# define Lock_state() if (!g_in_exiting_signal_handler) { I_lock_mutex(&con_mutex); }
|
||||
# define Unlock_state() if (!g_in_exiting_signal_handler) { I_unlock_mutex(con_mutex); }
|
||||
# define Lock_state() I_lock_mutex(&con_mutex)
|
||||
# define Unlock_state() I_unlock_mutex(con_mutex)
|
||||
#else/*HAVE_THREADS*/
|
||||
# define Lock_state()
|
||||
# define Unlock_state()
|
||||
@@ -98,7 +93,9 @@ static char inputlines[32][CON_MAXPROMPTCHARS]; // hold last 32 prompt lines
|
||||
|
||||
static INT32 inputline; // current input line number
|
||||
static INT32 inputhist; // line number of history input line to restore
|
||||
static textinput_t input;
|
||||
static size_t input_cur; // position of cursor in line
|
||||
static size_t input_sel; // position of selection marker (I.E.: anything between this and input_cur is "selected")
|
||||
static size_t input_len; // length of current line, used to bound cursor and such
|
||||
// notice: input does NOT include the "$" at the start of the line. - 11/3/16
|
||||
|
||||
// protos.
|
||||
@@ -457,8 +454,7 @@ static void CON_InputInit(void)
|
||||
// prepare the first prompt line
|
||||
memset(inputlines, 0, sizeof (inputlines));
|
||||
inputline = 0;
|
||||
|
||||
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
|
||||
input_cur = input_sel = input_len = 0;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
@@ -802,6 +798,113 @@ void CON_Ticker(void)
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
//
|
||||
// ----
|
||||
//
|
||||
// Shortcuts for adding and deleting characters, strings, and sections
|
||||
// Necessary due to moving cursor
|
||||
//
|
||||
|
||||
static void CON_InputClear(void)
|
||||
{
|
||||
Lock_state();
|
||||
|
||||
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
|
||||
input_cur = input_sel = input_len = 0;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputSetString(const char *c)
|
||||
{
|
||||
Lock_state();
|
||||
|
||||
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
|
||||
strcpy(inputlines[inputline], c);
|
||||
input_cur = input_sel = input_len = strlen(c);
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputAddString(const char *c)
|
||||
{
|
||||
size_t csize = strlen(c);
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_len + csize > CON_MAXPROMPTCHARS-1)
|
||||
{
|
||||
Unlock_state();
|
||||
return;
|
||||
}
|
||||
if (input_cur != input_len)
|
||||
memmove(&inputlines[inputline][input_cur+csize], &inputlines[inputline][input_cur], input_len-input_cur);
|
||||
memcpy(&inputlines[inputline][input_cur], c, csize);
|
||||
input_len += csize;
|
||||
input_sel = (input_cur += csize);
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputDelSelection(void)
|
||||
{
|
||||
size_t start, end, len;
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_cur > input_sel)
|
||||
{
|
||||
start = input_sel;
|
||||
end = input_cur;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = input_cur;
|
||||
end = input_sel;
|
||||
}
|
||||
len = (end - start);
|
||||
|
||||
if (end != input_len)
|
||||
memmove(&inputlines[inputline][start], &inputlines[inputline][end], input_len-end);
|
||||
memset(&inputlines[inputline][input_len - len], 0, len);
|
||||
|
||||
input_len -= len;
|
||||
input_sel = input_cur = start;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputAddChar(char c)
|
||||
{
|
||||
if (input_len >= CON_MAXPROMPTCHARS-1)
|
||||
return;
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_cur != input_len)
|
||||
memmove(&inputlines[inputline][input_cur+1], &inputlines[inputline][input_cur], input_len-input_cur);
|
||||
inputlines[inputline][input_cur++] = c;
|
||||
inputlines[inputline][++input_len] = 0;
|
||||
input_sel = input_cur;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputDelChar(void)
|
||||
{
|
||||
if (!input_cur)
|
||||
return;
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_cur != input_len)
|
||||
memmove(&inputlines[inputline][input_cur-1], &inputlines[inputline][input_cur], input_len-input_cur);
|
||||
inputlines[inputline][--input_len] = 0;
|
||||
input_sel = --input_cur;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
//
|
||||
// ----
|
||||
//
|
||||
@@ -882,10 +985,6 @@ boolean CON_Responder(event_t *ev)
|
||||
}
|
||||
}
|
||||
|
||||
Lock_state();
|
||||
M_TextInputHandle(&input, key);
|
||||
Unlock_state();
|
||||
|
||||
// Always eat ctrl/shift/alt if console open, so the menu doesn't get ideas
|
||||
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|
||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||
@@ -898,11 +997,12 @@ boolean CON_Responder(event_t *ev)
|
||||
// show all cvars/commands that match what we have inputted
|
||||
if (key == KEY_TAB)
|
||||
{
|
||||
|
||||
if (!completion[0])
|
||||
{
|
||||
if (!input.length || input.length >= 40 || strchr(input.buffer, ' '))
|
||||
if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
|
||||
return true;
|
||||
strcpy(completion, input.buffer);
|
||||
strcpy(completion, inputlines[inputline]);
|
||||
comskips = varskips = 0;
|
||||
}
|
||||
|
||||
@@ -923,9 +1023,42 @@ boolean CON_Responder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Those are already handled in M_TextInputHandle, but they do extra logic... Maybe textinput_t should have some sort of callbacks?
|
||||
if (key == 'x' || key == 'X' || key == 'v' || key == 'V')
|
||||
if (key == 'x' || key == 'X')
|
||||
{
|
||||
if (input_sel > input_cur)
|
||||
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
|
||||
else
|
||||
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
|
||||
CON_InputDelSelection();
|
||||
completion[0] = 0;
|
||||
return true;
|
||||
}
|
||||
else if (key == 'c' || key == 'C')
|
||||
{
|
||||
if (input_sel > input_cur)
|
||||
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
|
||||
else
|
||||
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'v' || key == 'V')
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
if (input_sel != input_cur)
|
||||
CON_InputDelSelection();
|
||||
if (paste != NULL)
|
||||
CON_InputAddString(paste);
|
||||
completion[0] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Select all
|
||||
if (key == 'a' || key == 'A')
|
||||
{
|
||||
input_sel = 0;
|
||||
input_cur = input_len;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ...why shouldn't it eat the key? if it doesn't, it just means you
|
||||
// can control Sonic from the console, which is silly
|
||||
@@ -940,9 +1073,9 @@ boolean CON_Responder(event_t *ev)
|
||||
// remember typing for several completions (a-la-4dos)
|
||||
if (!completion[0])
|
||||
{
|
||||
if (!input.length || input.length >= 40 || strchr(input.buffer, ' '))
|
||||
if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
|
||||
return true;
|
||||
strcpy(completion, input.buffer);
|
||||
strcpy(completion, inputlines[inputline]);
|
||||
comskips = varskips = 0;
|
||||
}
|
||||
else
|
||||
@@ -973,11 +1106,7 @@ boolean CON_Responder(event_t *ev)
|
||||
cmd = CV_CompleteVar(completion, varskips);
|
||||
|
||||
if (cmd)
|
||||
{
|
||||
Lock_state();
|
||||
M_TextInputSetString(&input, va("%s ", cmd));
|
||||
Unlock_state();
|
||||
}
|
||||
CON_InputSetString(va("%s ", cmd));
|
||||
else
|
||||
{
|
||||
if (comskips > 0)
|
||||
@@ -1003,6 +1132,37 @@ boolean CON_Responder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == KEY_LEFTARROW)
|
||||
{
|
||||
if (input_cur != 0)
|
||||
--input_cur;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
{
|
||||
if (input_cur < input_len)
|
||||
++input_cur;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_HOME)
|
||||
{
|
||||
input_cur = 0;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_END)
|
||||
{
|
||||
input_cur = input_len;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
|
||||
// At this point we're messing with input
|
||||
// Clear completion
|
||||
completion[0] = 0;
|
||||
@@ -1010,29 +1170,45 @@ boolean CON_Responder(event_t *ev)
|
||||
// command enter
|
||||
if (key == KEY_ENTER)
|
||||
{
|
||||
if (!input.length)
|
||||
if (!input_len)
|
||||
return true;
|
||||
|
||||
// push the command
|
||||
COM_BufAddText(input.buffer);
|
||||
COM_BufAddText(inputlines[inputline]);
|
||||
COM_BufAddText("\n");
|
||||
|
||||
CONS_Printf("\x86""%c""\x80""%s\n", CON_PROMPTCHAR, inputlines[inputline]);
|
||||
|
||||
Lock_state();
|
||||
|
||||
// Only add command to history if it differs from previous one
|
||||
if (strcmp(input.buffer, inputlines[(inputline-1) & 31]))
|
||||
{
|
||||
if (strcmp(inputlines[inputline], inputlines[(inputline-1) & 31]))
|
||||
inputline = (inputline+1) & 31;
|
||||
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
|
||||
}
|
||||
|
||||
inputhist = inputline;
|
||||
M_TextInputClear(&input);
|
||||
CON_InputClear();
|
||||
|
||||
Unlock_state();
|
||||
return true;
|
||||
}
|
||||
|
||||
// backspace and delete command prompt
|
||||
if (input_sel != input_cur)
|
||||
{
|
||||
if (key == KEY_BACKSPACE || key == KEY_DEL)
|
||||
{
|
||||
CON_InputDelSelection();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (key == KEY_BACKSPACE)
|
||||
{
|
||||
CON_InputDelChar();
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_DEL)
|
||||
{
|
||||
if (input_cur == input_len)
|
||||
return true;
|
||||
++input_cur;
|
||||
CON_InputDelChar();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1049,9 +1225,7 @@ boolean CON_Responder(event_t *ev)
|
||||
if (inputhist == inputline)
|
||||
inputhist = (inputline + 1) & 31;
|
||||
|
||||
Lock_state();
|
||||
M_TextInputSetString(&input, inputlines[inputhist]);
|
||||
Unlock_state();
|
||||
CON_InputSetString(inputlines[inputhist]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1065,16 +1239,41 @@ boolean CON_Responder(event_t *ev)
|
||||
while (inputhist != inputline && !inputlines[inputhist][0]);
|
||||
|
||||
// back to currentline
|
||||
Lock_state();
|
||||
if (inputhist == inputline)
|
||||
M_TextInputClear(&input);
|
||||
CON_InputClear();
|
||||
else
|
||||
M_TextInputSetString(&input, inputlines[inputhist]);
|
||||
Unlock_state();
|
||||
|
||||
CON_InputSetString(inputlines[inputhist]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// allow people to use keypad in console (good for typing IP addresses) - Calum
|
||||
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
|
||||
{
|
||||
char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
}
|
||||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
|
||||
key = CON_ShiftChar(key);
|
||||
|
||||
// enter a char into the command prompt
|
||||
if (key < 32 || key > 127)
|
||||
return true;
|
||||
|
||||
// add key to cmd line here
|
||||
if (key >= 'A' && key <= 'Z' && !(shiftdown ^ capslock)) //this is only really necessary for dedicated servers
|
||||
key = key + 'a' - 'A';
|
||||
|
||||
if (input_sel != input_cur)
|
||||
CON_InputDelSelection();
|
||||
CON_InputAddChar(key);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1356,16 +1555,16 @@ static void CON_DrawInput(void)
|
||||
|
||||
clen = con_width-13;
|
||||
|
||||
if (input.length <= clen)
|
||||
if (input_len <= clen)
|
||||
{
|
||||
c = 0;
|
||||
clen = input.length;
|
||||
clen = input_len;
|
||||
}
|
||||
else // input line scrolls left if it gets too long
|
||||
{
|
||||
clen -= 2; // There will always be some extra truncation -- but where is what we'll find out
|
||||
|
||||
if (input.cursor <= clen/2)
|
||||
if (input_cur <= clen/2)
|
||||
{
|
||||
// Close enough to right edge to show all
|
||||
c = 0;
|
||||
@@ -1376,15 +1575,15 @@ static void CON_DrawInput(void)
|
||||
{
|
||||
// Cursor in the middle (or right side) of input
|
||||
// Move over for the ellipsis
|
||||
c = input.cursor - (clen/2) + 2;
|
||||
c = input_cur - (clen/2) + 2;
|
||||
x += charwidth*2;
|
||||
lellip = 1;
|
||||
|
||||
if (c + clen >= input.length)
|
||||
if (c + clen >= input_len)
|
||||
{
|
||||
// Cursor in the right side of input
|
||||
// We were too far over, so move back
|
||||
c = input.length - clen;
|
||||
c = input_len - clen;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1398,7 +1597,7 @@ static void CON_DrawInput(void)
|
||||
if (lellip)
|
||||
{
|
||||
x -= charwidth*3;
|
||||
if (input.select < c)
|
||||
if (input_sel < c)
|
||||
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART);
|
||||
for (i = 0; i < 3; ++i, x += charwidth)
|
||||
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
|
||||
@@ -1408,7 +1607,7 @@ static void CON_DrawInput(void)
|
||||
|
||||
for (cend = c + clen; c < cend; ++c, x += charwidth)
|
||||
{
|
||||
if ((input.select > c && input.cursor <= c) || (input.select <= c && input.cursor > c))
|
||||
if ((input_sel > c && input_cur <= c) || (input_sel <= c && input_cur > c))
|
||||
{
|
||||
V_DrawFill(x, y, charwidth, (10 * con_scalefactor), 107 | V_NOSCALESTART);
|
||||
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_YELLOWMAP | V_NOSCALESTART, !cv_allcaps.value);
|
||||
@@ -1416,14 +1615,14 @@ static void CON_DrawInput(void)
|
||||
else
|
||||
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
|
||||
if (c == input.cursor && con_tick >= 4)
|
||||
if (c == input_cur && con_tick >= 4)
|
||||
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
}
|
||||
if (cend == input.cursor && con_tick >= 4)
|
||||
if (cend == input_cur && con_tick >= 4)
|
||||
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
if (rellip)
|
||||
{
|
||||
if (input.select > cend)
|
||||
if (input_sel > cend)
|
||||
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART);
|
||||
for (i = 0; i < 3; ++i, x += charwidth)
|
||||
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
|
||||
|
||||
+137
-487
File diff suppressed because it is too large.
Load diff
+3
-27
@@ -98,16 +98,6 @@ typedef enum
|
||||
PT_MOREFILESNEEDED, // Server, to client: "you need these (+ more on top of those)"
|
||||
|
||||
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
PT_WILLRESENDGAMESTATE, // Hey Client, I am about to resend you the gamestate!
|
||||
PT_CANRECEIVEGAMESTATE, // Okay Server, I'm ready to receive it, you can go ahead.
|
||||
PT_RECEIVEDGAMESTATE, // Thank you Server, I am ready to play again!
|
||||
|
||||
// we will reserve this for now even if unused, so order wont get mangled
|
||||
PT_ISSATURN, // Saturn specific identifier packet
|
||||
#endif
|
||||
|
||||
NUMPACKETTYPE
|
||||
} packettype_t;
|
||||
|
||||
@@ -373,9 +363,6 @@ typedef struct
|
||||
UINT8 subversion; // Contains build version
|
||||
UINT8 localplayers; // number of splitscreen players
|
||||
UINT8 mode;
|
||||
#ifdef SATURNJOIN
|
||||
UINT8 issaturn;
|
||||
#endif
|
||||
} ATTRPACK clientconfig_pak;
|
||||
|
||||
#define SV_SPEEDMASK 0x03 // used to send kartspeed
|
||||
@@ -580,22 +567,14 @@ extern consvar_t
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
cv_joinnextround,
|
||||
#endif
|
||||
cv_netticbuffer, cv_allownewplayer,
|
||||
#ifdef SATURNJOIN
|
||||
cv_allownewsaturnplayer,
|
||||
#endif
|
||||
cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts,
|
||||
#ifdef SATURNSYNCH
|
||||
cv_resynchcooldown, cv_gamestateattempts,
|
||||
#endif
|
||||
cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
cv_netticbuffer, cv_allownewplayer, cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
|
||||
extern consvar_t cv_connectawaittime;
|
||||
|
||||
extern consvar_t cv_discordinvites;
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
//tic_t ExpandTics(INT32 low, tic_t basetic);
|
||||
tic_t ExpandTics(INT32 low, tic_t basetic);
|
||||
void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
@@ -653,10 +632,7 @@ tic_t GetLag(INT32 node);
|
||||
UINT8 GetFreeXCmdSize(void);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNSYNCH
|
||||
extern UINT8 hu_redownloadinggamestate;
|
||||
#endif
|
||||
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||
extern UINT8 hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||
|
||||
typedef struct rewind_s {
|
||||
UINT8 savebuffer[(768*1024)];
|
||||
|
||||
+75
-173
@@ -37,7 +37,6 @@
|
||||
#include "d_net.h"
|
||||
#include "f_finale.h"
|
||||
#include "g_game.h"
|
||||
#include "g_input.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_sound.h"
|
||||
#include "i_system.h"
|
||||
@@ -104,12 +103,11 @@ static char *startupwadfiles[MAX_WADFILES];
|
||||
static char *startuppwads[MAX_WADFILES];
|
||||
|
||||
// autoloading
|
||||
char *autoloadwadfiles[MAX_WADFILES];
|
||||
static char *autoloadwadfiles[MAX_WADFILES];
|
||||
char *autoloadwadfilespost[MAX_WADFILES];
|
||||
boolean autoloading;
|
||||
boolean autoloaded;
|
||||
boolean postautoloaded = false;
|
||||
boolean wasautoloaded = false;
|
||||
boolean postautoloaded;
|
||||
|
||||
boolean devparm = false; // started game with -devparm
|
||||
|
||||
@@ -151,8 +149,6 @@ INT32 eventhead, eventtail;
|
||||
|
||||
boolean dedicated = false;
|
||||
|
||||
boolean loaded_config = false;
|
||||
|
||||
//
|
||||
// D_PostEvent
|
||||
// Called by the I/O functions when input is detected
|
||||
@@ -170,32 +166,6 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||
boolean capslock = 0; // gee i wonder what this does.
|
||||
|
||||
static inline void D_DeviceLEDTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
UINT16 color[MAXSPLITSCREENPLAYERS];
|
||||
UINT16 curcolor[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
if (I_NumJoys() == 0 || (cv_gamepadled[0].value == 0 && cv_gamepadled[1].value == 0 && cv_gamepadled[2].value == 0 && cv_gamepadled[3].value == 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
continue;
|
||||
|
||||
color[i] = G_GetSkinColor(i);
|
||||
|
||||
if (curcolor[i] == color[i]) // dont update if same colour
|
||||
continue;
|
||||
|
||||
G_SetPlayerGamepadIndicatorColor(i, color[i]);
|
||||
curcolor[i] = color[i];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// D_ProcessEvents
|
||||
// Send all the events of the given timestamp down the responder chain
|
||||
@@ -272,9 +242,8 @@ void D_ProcessEvents(void)
|
||||
// added comment : there is a wipe eatch change of the gamestate
|
||||
gamestate_t wipegamestate = GS_LEVEL;
|
||||
|
||||
static boolean D_Display(void)
|
||||
static void D_Display(void)
|
||||
{
|
||||
boolean ranwipe = false;
|
||||
boolean forcerefresh = false;
|
||||
static boolean wipe = false;
|
||||
INT32 wipedefindex = 0;
|
||||
@@ -283,7 +252,7 @@ static boolean D_Display(void)
|
||||
if (!dedicated)
|
||||
{
|
||||
if (nodrawers)
|
||||
return false; // for comparative timing/profiling
|
||||
return; // for comparative timing/profiling
|
||||
|
||||
// check for change of screen size (video mode)
|
||||
if (setmodeneeded && !wipe)
|
||||
@@ -293,10 +262,7 @@ static boolean D_Display(void)
|
||||
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
|
||||
|
||||
if (rendermode == render_soft && !splitscreen)
|
||||
{
|
||||
R_InterpolateViewRollAngle(rendertimefrac);
|
||||
R_CheckViewMorph();
|
||||
}
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded)
|
||||
@@ -336,7 +302,6 @@ static boolean D_Display(void)
|
||||
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)
|
||||
@@ -350,13 +315,12 @@ static boolean D_Display(void)
|
||||
else //dedicated servers
|
||||
{
|
||||
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
||||
ranwipe = true;
|
||||
wipegamestate = gamestate;
|
||||
}
|
||||
}
|
||||
|
||||
if (dedicated) //bail out after wipe logic
|
||||
return false;
|
||||
return;
|
||||
|
||||
// do buffered drawing
|
||||
switch (gamestate)
|
||||
@@ -463,7 +427,7 @@ static boolean D_Display(void)
|
||||
viewssnum = i;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
if (rendermode != render_soft)
|
||||
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
|
||||
else
|
||||
#endif
|
||||
@@ -518,10 +482,8 @@ static boolean D_Display(void)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (!postimgtype[i])
|
||||
continue;
|
||||
|
||||
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
|
||||
if (postimgtype[i])
|
||||
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,6 +497,7 @@ static boolean D_Display(void)
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
||||
usebuffer = true;
|
||||
}
|
||||
lastdraw = false;
|
||||
}
|
||||
@@ -568,7 +531,7 @@ static boolean D_Display(void)
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, V_SNAPTOTOP, patch);
|
||||
}
|
||||
|
||||
if (rendermode == render_soft && demo.rewinding)
|
||||
if (demo.rewinding)
|
||||
V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM);
|
||||
|
||||
// vid size change is now finished if it was on...
|
||||
@@ -598,10 +561,11 @@ static boolean D_Display(void)
|
||||
{
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
||||
ranwipe = true;
|
||||
}
|
||||
}
|
||||
|
||||
NetUpdate(); // send out any new accumulation
|
||||
|
||||
// It's safe to end the game now.
|
||||
if (G_GetExitGameFlag())
|
||||
{
|
||||
@@ -646,7 +610,6 @@ static boolean D_Display(void)
|
||||
PS_STOP_TIMING(ps_swaptime);
|
||||
}
|
||||
|
||||
return ranwipe;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -654,7 +617,7 @@ static boolean D_Display(void)
|
||||
// =========================================================================
|
||||
|
||||
tic_t rendergametic;
|
||||
static SINT8 menuInputDelayTimer = 0;
|
||||
static int menuInputDelayTimer = 0;
|
||||
|
||||
void D_SRB2Loop(void)
|
||||
{
|
||||
@@ -664,7 +627,6 @@ void D_SRB2Loop(void)
|
||||
|
||||
boolean interp = false;
|
||||
boolean doDisplay = false;
|
||||
int frameskip = 0;
|
||||
|
||||
if (dedicated)
|
||||
server = true;
|
||||
@@ -709,8 +671,6 @@ void D_SRB2Loop(void)
|
||||
capbudget = (precise_t) budget;
|
||||
}
|
||||
|
||||
boolean ranwipe = false;
|
||||
|
||||
I_UpdateTime(cv_timescale.value);
|
||||
|
||||
if (lastwipetic)
|
||||
@@ -743,11 +703,9 @@ void D_SRB2Loop(void)
|
||||
HW3S_BeginFrameUpdate();
|
||||
#endif
|
||||
|
||||
renderisnewtic = (realtics > 0 || singletics);
|
||||
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
|
||||
if (renderisnewtic)
|
||||
if (realtics > 0 || singletics)
|
||||
{
|
||||
// don't skip more than 10 frames at a time
|
||||
// (fadein / fadeout cause massive frame skip!)
|
||||
@@ -766,52 +724,14 @@ void D_SRB2Loop(void)
|
||||
}
|
||||
else if (rendertimeout < entertic) // in case the server hang or netsplit
|
||||
{
|
||||
// Lagless camera! Yay!
|
||||
if (cv_laglesscam.value && gamestate == GS_LEVEL && netgame)
|
||||
{
|
||||
// Evaluate the chase cam once for every local realtic
|
||||
// This might actually be better suited inside G_Ticker or TryRunTics
|
||||
for (tic_t chasecamtics = 0; chasecamtics < realtics; chasecamtics++)
|
||||
{
|
||||
P_RunChaseCameras();
|
||||
}
|
||||
R_UpdateViewInterpolation();
|
||||
}
|
||||
|
||||
doDisplay = true;
|
||||
}
|
||||
|
||||
#define DPADSCROLLINPUT(INPUT)\
|
||||
{\
|
||||
myev.data1 = INPUT;\
|
||||
M_Responder(&myev);\
|
||||
renderisnewtic = true;
|
||||
}
|
||||
// this is absolutely awful and i hate it lmao
|
||||
if (menuactive && (DPADUPSCROLL || DPADDOWNSCROLL || DPADLEFTSCROLL || DPADRIGHTSCROLL))
|
||||
{
|
||||
event_t myev;
|
||||
myev.type = ev_keydown;
|
||||
|
||||
if (menuInputDelayTimer < 19)
|
||||
menuInputDelayTimer++;
|
||||
|
||||
if (menuInputDelayTimer == 19) // TICRATE * ( (k+2) (1 - [wz + h + j - q]^2 - [(gk + 2g + k + 1)(h + j) + h - z]^2 - [16(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^2]^2 calculated by my butt
|
||||
{
|
||||
if (DPADUPSCROLL)
|
||||
DPADSCROLLINPUT(KEY_UPARROW)
|
||||
else if (DPADDOWNSCROLL)
|
||||
DPADSCROLLINPUT(KEY_DOWNARROW)
|
||||
else if (DPADLEFTSCROLL)
|
||||
DPADSCROLLINPUT(KEY_LEFTARROW)
|
||||
else if (DPADRIGHTSCROLL)
|
||||
DPADSCROLLINPUT(KEY_RIGHTARROW)
|
||||
}
|
||||
}
|
||||
else
|
||||
menuInputDelayTimer = 0;
|
||||
#undef DPADSCROLLINPUT
|
||||
|
||||
D_DeviceLEDTick();
|
||||
else
|
||||
{
|
||||
renderisnewtic = false;
|
||||
}
|
||||
|
||||
if (interp)
|
||||
@@ -826,19 +746,16 @@ void D_SRB2Loop(void)
|
||||
{
|
||||
rendertimefrac = FRACUNIT;
|
||||
}
|
||||
|
||||
rendertimefrac_unpaused = g_time.timefrac;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderdeltatics = realtics * FRACUNIT;
|
||||
rendertimefrac = FRACUNIT;
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
|
||||
if ((interp || doDisplay) && !frameskip)
|
||||
if (interp || doDisplay)
|
||||
{
|
||||
ranwipe = D_Display();
|
||||
D_Display();
|
||||
}
|
||||
|
||||
// Only take screenshots after drawing.
|
||||
@@ -863,31 +780,46 @@ void D_SRB2Loop(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Fully completed frame made.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
|
||||
// Use the time before sleep for frameskip calculations:
|
||||
// post-sleep time is literally being intentionally wasted
|
||||
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
|
||||
deltatics = deltasecs * NEWTICRATE;
|
||||
|
||||
// If time spent this game loop exceeds a single tic,
|
||||
// it's probably because of rendering.
|
||||
//
|
||||
// Skip rendering the next frame, up to a limit of 3
|
||||
// frames before a frame is rendered no matter what.
|
||||
//
|
||||
// Wipes run an inner loop and artificially increase
|
||||
// the measured time.
|
||||
if (!ranwipe && frameskip < 3 && deltatics > 1.0)
|
||||
// this is absolutely awful and i hate it lmao
|
||||
if (menuactive && (DPADUPSCROLL || DPADDOWNSCROLL || DPADLEFTSCROLL || DPADRIGHTSCROLL))
|
||||
{
|
||||
frameskip++;
|
||||
event_t myev;
|
||||
myev.type = ev_keydown;
|
||||
|
||||
if (renderisnewtic)
|
||||
{
|
||||
menuInputDelayTimer++;
|
||||
|
||||
if (menuInputDelayTimer >= 19) // TICRATE * ( (k+2) (1 - [wz + h + j - q]^2 - [(gk + 2g + k + 1)(h + j) + h - z]^2 - [16(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^2]^2 calculated by my butt
|
||||
{
|
||||
if (DPADUPSCROLL)
|
||||
{
|
||||
myev.data1 = KEY_UPARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
else if (DPADDOWNSCROLL)
|
||||
{
|
||||
myev.data1 = KEY_DOWNARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
else if (DPADLEFTSCROLL)
|
||||
{
|
||||
myev.data1 = KEY_LEFTARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
else if (DPADRIGHTSCROLL)
|
||||
{
|
||||
myev.data1 = KEY_RIGHTARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
frameskip = 0;
|
||||
}
|
||||
menuInputDelayTimer = 0;
|
||||
|
||||
// Fully completed frame made.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
if (!singletics)
|
||||
{
|
||||
INT64 elapsed = (INT64)(finishprecise - enterprecise);
|
||||
@@ -1013,7 +945,7 @@ static INT32 D_DetectFileType(const char* filename)
|
||||
return 5;
|
||||
else if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
|
||||
return 6;
|
||||
|
||||
|
||||
else if (!stricmp(&filename[strlen(filename) - 4], ".cfg"))
|
||||
return 7;
|
||||
else if (!stricmp(&filename[strlen(filename) - 4], ".txt"))
|
||||
@@ -1037,12 +969,12 @@ static void D_AutoloadFile(const char *file, char **filearray)
|
||||
if (!newfile)
|
||||
I_Error("No more free memory to AutoloadFile %s",file);
|
||||
|
||||
if (!fileType)
|
||||
if (!fileType)
|
||||
{
|
||||
CONS_Printf("D_AutoloadFile: File %s is unknown or invalid\n", file);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
strcpy(newfile, file);
|
||||
|
||||
if (fileType <= 6)
|
||||
@@ -1082,10 +1014,7 @@ static void D_FindAddonsToAutoload(void)
|
||||
|
||||
// If the file is found, run our shit
|
||||
if (!autoloadconfigfile) // nope outta here
|
||||
{
|
||||
wasautoloaded = postautoloaded = true; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
|
||||
return;
|
||||
}
|
||||
|
||||
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL)
|
||||
{
|
||||
@@ -1152,32 +1081,6 @@ static void D_FindAddonsToAutoload(void)
|
||||
fclose(autoloadconfigfile);
|
||||
}
|
||||
|
||||
void D_AddAutoloadFiles(void)
|
||||
{
|
||||
if (wasautoloaded && postautoloaded)
|
||||
return;
|
||||
|
||||
if (!wasautoloaded && !modeattacking)
|
||||
{
|
||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfiles);
|
||||
|
||||
wasautoloaded = true;
|
||||
}
|
||||
|
||||
if ((!postautoloaded) && netgame)
|
||||
{
|
||||
CONS_Printf("D_AutoloadFile(): Loading postloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfilespost);
|
||||
|
||||
postautoloaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
void D_CleanFile(char **filearray)
|
||||
{
|
||||
size_t pnumwadfiles;
|
||||
@@ -1283,13 +1186,13 @@ static void IdentifyVersion(void)
|
||||
D_AddFile(va(pandf,srb2waddir,"extra.kart"), startupwadfiles);
|
||||
found_extra_kart = true;
|
||||
}
|
||||
|
||||
|
||||
// completely optional 2: Back with a vengence
|
||||
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra2.kart"))) {
|
||||
D_AddFile(va(pandf,srb2waddir,"extra2.kart"), startupwadfiles);
|
||||
found_extra2_kart = true;
|
||||
}
|
||||
|
||||
|
||||
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra3.kart"))) {
|
||||
D_AddFile(va(pandf,srb2waddir,"extra3.kart"), startupwadfiles);
|
||||
found_extra3_kart = true;
|
||||
@@ -1592,7 +1495,7 @@ void D_SRB2Main(void)
|
||||
if (found_extra_kart || found_extra2_kart || found_extra3_kart) // found the funny, add it in!
|
||||
{
|
||||
// HAYA: These are seperated for a reason lmao
|
||||
if (found_extra_kart)
|
||||
if (found_extra_kart)
|
||||
mainwads++;
|
||||
if (found_extra2_kart)
|
||||
mainwads++;
|
||||
@@ -1620,7 +1523,7 @@ void D_SRB2Main(void)
|
||||
achi_speedo_clr = true;
|
||||
|
||||
// check for bigger lap count
|
||||
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
|
||||
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
|
||||
big_lap = true;
|
||||
|
||||
// now check for colour hud stuff
|
||||
@@ -1629,7 +1532,7 @@ void D_SRB2Main(void)
|
||||
clr_hud = true;
|
||||
|
||||
// check for bigger lap count but color** its color bitch
|
||||
if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL))
|
||||
if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL))
|
||||
big_lap_color = true;
|
||||
|
||||
// kartzspeedo
|
||||
@@ -1644,16 +1547,16 @@ void D_SRB2Main(void)
|
||||
|
||||
// stat display for extended player setup
|
||||
if (W_CheckMultipleLumps("K_STATNB", "K_STATN1", "K_STATN2", "K_STATN3", "K_STATN4", \
|
||||
"K_STATN5", "K_STATN6", NULL))
|
||||
"K_STATN5", "K_STATN6", NULL))
|
||||
statdp = true;
|
||||
|
||||
// Nametag stuffs
|
||||
if (W_CheckMultipleLumps("NTLINE", "NTLINEV", "NTSP", "NTWH", NULL))
|
||||
if (W_CheckMultipleLumps("NTLINE", "NTLINEV", "NTSP", "NTWH", NULL))
|
||||
nametaggfx = true;
|
||||
|
||||
if (W_CheckMultipleLumps("K_DGAU","K_DCAU","K_DGSU","K_DCSU", NULL))
|
||||
if (W_CheckMultipleLumps("K_DGAU","K_DCAU","K_DGSU","K_DCSU", NULL))
|
||||
driftgaugegfx = true;
|
||||
|
||||
|
||||
if (found_extra3_kart)
|
||||
{
|
||||
// 80x11 speedometer crap
|
||||
@@ -1666,15 +1569,11 @@ void D_SRB2Main(void)
|
||||
if (W_LumpExists("SC_SM3TC"))
|
||||
xtra_speedo_clr3 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef PUSHSPEEDO
|
||||
memcpy(speedo_cons_t, speedo_cons_temp, sizeof(speedo_cons_t));
|
||||
|
||||
// Do it before P_InitMapData because PNG patch
|
||||
// conversion sometimes needs the palette
|
||||
V_ReloadPalette();
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
@@ -1784,8 +1683,6 @@ void D_SRB2Main(void)
|
||||
|
||||
savedata.lives = 0; // flag this as not-used
|
||||
|
||||
loaded_config = true; // so pallettechange doesent get called 500 times at startup lol
|
||||
|
||||
//------------------------------------------------ COMMAND LINE PARAMS
|
||||
|
||||
// this must be done after loading gamedata,
|
||||
@@ -1870,6 +1767,11 @@ void D_SRB2Main(void)
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfiles);
|
||||
|
||||
// Set up splitscreen players before joining!
|
||||
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
|
||||
{
|
||||
@@ -2074,7 +1976,7 @@ void D_SRB2Main(void)
|
||||
pagename = "TITLESKY";
|
||||
levelstarttic = gametic;
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
if (!P_SetupLevel(false, false))
|
||||
if (!P_SetupLevel(false))
|
||||
I_Quit(); // fail so reset game stuff
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
// make sure not to write back the config until it's been correctly loaded
|
||||
extern tic_t rendergametic;
|
||||
|
||||
extern boolean loaded_config;
|
||||
|
||||
extern char srb2home[256]; //Alam: My Home
|
||||
extern boolean usehome; //Alam: which path?
|
||||
extern const char *pandf; //Alam: how to path?
|
||||
@@ -45,15 +43,12 @@ extern boolean statdp; // stat display for extended player setup
|
||||
extern boolean nametaggfx; // Nametag stuffs
|
||||
extern boolean driftgaugegfx;
|
||||
|
||||
void D_AddAutoloadFiles(void);
|
||||
|
||||
extern boolean autoloading;
|
||||
extern boolean autoloaded;
|
||||
extern boolean postautoloaded;
|
||||
extern boolean wasautoloaded;
|
||||
|
||||
extern char *autoloadwadfilespost[MAX_WADFILES];
|
||||
extern char *autoloadwadfiles[MAX_WADFILES];
|
||||
|
||||
// the infinite loop of D_SRB2Loop() called from win_main for windows version
|
||||
void D_SRB2Loop(void) FUNCNORETURN;
|
||||
|
||||
+33
-26
@@ -64,6 +64,9 @@ static doomdata_t reboundstore[MAXREBOUND];
|
||||
static INT16 reboundsize[MAXREBOUND];
|
||||
static INT32 rebound_head, rebound_tail;
|
||||
|
||||
/// \brief bandwith of netgame
|
||||
INT32 net_bandwidth;
|
||||
|
||||
/// \brief max length per packet
|
||||
INT16 hardware_MAXPACKETLENGTH;
|
||||
|
||||
@@ -790,7 +793,7 @@ static void fprintfstringnewline(char *s, size_t len)
|
||||
}
|
||||
|
||||
/// \warning Keep this up-to-date if you add/remove/rename packet types
|
||||
const char *packettypename[NUMPACKETTYPE] =
|
||||
static const char *packettypename[NUMPACKETTYPE] =
|
||||
{
|
||||
"NOTHING",
|
||||
"SERVERCFG",
|
||||
@@ -833,31 +836,13 @@ const char *packettypename[NUMPACKETTYPE] =
|
||||
"MOREFILESNEEDED",
|
||||
|
||||
"PING"
|
||||
#ifdef SATURNSYNCH
|
||||
,
|
||||
|
||||
"WILLRESENDGAMESTATE",
|
||||
"CANRECEIVEGAMESTATE",
|
||||
"RECEIVEDGAMESTATE",
|
||||
|
||||
// we will reserve this for now even if unused, so order wont get mangled
|
||||
"ISSATURN"
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *Net_GetPacketName(UINT8 packettype)
|
||||
{
|
||||
if (packettype >= NUMPACKETTYPE)
|
||||
return "UNKNOWN";
|
||||
|
||||
return packettypename[packettype];
|
||||
}
|
||||
|
||||
static void DebugPrintpacket(const char *header)
|
||||
{
|
||||
fprintf(debugfile, "%-12s (node %d,ack %d,ackret %d,size %d) type(%d) : %s\n",
|
||||
header, doomcom->remotenode, netbuffer->ack, netbuffer->ackreturn, doomcom->datalength,
|
||||
netbuffer->packettype, Net_GetPacketName(netbuffer->packettype));
|
||||
netbuffer->packettype, packettypename[netbuffer->packettype]);
|
||||
|
||||
switch (netbuffer->packettype)
|
||||
{
|
||||
@@ -1223,7 +1208,7 @@ boolean HGetPacket(void)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // ifndef NONET
|
||||
#endif // ndef NONET
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1273,7 +1258,10 @@ void D_SetDoomcom(void)
|
||||
{
|
||||
if (doomcom) return;
|
||||
doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
|
||||
doomcom->id = DOOMCOM_ID;
|
||||
doomcom->numslots = doomcom->numnodes = 1;
|
||||
doomcom->gametype = 0;
|
||||
doomcom->consoleplayer = 0;
|
||||
doomcom->extratics = 0;
|
||||
}
|
||||
|
||||
@@ -1298,6 +1286,7 @@ boolean D_CheckNetGame(void)
|
||||
I_NetMakeNodewPort = NULL;
|
||||
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
net_bandwidth = 30000;
|
||||
// I_InitNetwork sets doomcom and netgame
|
||||
// check and initialize the network driver
|
||||
multiplayer = false;
|
||||
@@ -1317,6 +1306,7 @@ boolean D_CheckNetGame(void)
|
||||
server = true; // WTF? server always true???
|
||||
// no! The deault mode is server. Client is set elsewhere
|
||||
// when the client executes connect command.
|
||||
doomcom->ticdup = 1;
|
||||
|
||||
if (M_CheckParm("-extratic"))
|
||||
{
|
||||
@@ -1327,6 +1317,21 @@ boolean D_CheckNetGame(void)
|
||||
CONS_Printf(M_GetText("Set extratics to %d\n"), doomcom->extratics);
|
||||
}
|
||||
|
||||
if (M_CheckParm("-bandwidth"))
|
||||
{
|
||||
if (M_IsNextParm())
|
||||
{
|
||||
net_bandwidth = atoi(M_GetNextParm());
|
||||
if (net_bandwidth < 1000)
|
||||
net_bandwidth = 1000;
|
||||
if (net_bandwidth > 100000)
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
CONS_Printf(M_GetText("Network bandwidth set to %d\n"), net_bandwidth);
|
||||
}
|
||||
else
|
||||
I_Error("usage: -bandwidth <byte_per_sec>");
|
||||
}
|
||||
|
||||
software_MAXPACKETLENGTH = hardware_MAXPACKETLENGTH;
|
||||
if (M_CheckParm("-packetsize"))
|
||||
{
|
||||
@@ -1346,6 +1351,8 @@ boolean D_CheckNetGame(void)
|
||||
if (netgame)
|
||||
multiplayer = true;
|
||||
|
||||
if (doomcom->id != DOOMCOM_ID)
|
||||
I_Error("Doomcom buffer invalid!");
|
||||
if (doomcom->numnodes > MAXNETNODES)
|
||||
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
|
||||
|
||||
@@ -1358,7 +1365,7 @@ boolean D_CheckNetGame(void)
|
||||
if (M_CheckParm("-debugfile"))
|
||||
{
|
||||
char filename[21];
|
||||
INT32 k = consoleplayer - 1;
|
||||
INT32 k = doomcom->consoleplayer - 1;
|
||||
if (M_IsNextParm())
|
||||
k = atoi(M_GetNextParm()) - 1;
|
||||
while (!debugfile && k < MAXPLAYERS)
|
||||
@@ -1446,13 +1453,13 @@ void Command_Ping_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (f_width < 10) f_width = 1;
|
||||
if (f_width < 10) f_width = 1;
|
||||
else if (f_width < 100) f_width = 2;
|
||||
else f_width = 3;
|
||||
else f_width = 3;
|
||||
|
||||
if (ms_width < 10) ms_width = 1;
|
||||
if (ms_width < 10) ms_width = 1;
|
||||
else if (ms_width < 100) ms_width = 2;
|
||||
else ms_width = 3;
|
||||
else ms_width = 3;
|
||||
|
||||
qsort(pingv, pingc, sizeof (struct pingcell), &pingcellcmp);
|
||||
|
||||
|
||||
@@ -65,6 +65,5 @@ void Net_ConnectionTimeout(INT32 node);
|
||||
void Net_AbortPacketType(UINT8 packettype);
|
||||
void Net_SendAcks(INT32 node);
|
||||
void Net_WaitAllAckReceived(UINT32 timeout);
|
||||
const char *Net_GetPacketName(UINT8 packettype);
|
||||
|
||||
#endif
|
||||
+29
-122
@@ -299,9 +299,6 @@ consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t,
|
||||
//WTF
|
||||
consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Lagless camera! Yay!
|
||||
consvar_t cv_laglesscam = {"laglesscamera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||
consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -397,7 +394,6 @@ static CV_PossibleValue_t kartspeedometer_cons_t[] = {{0, "Off"}, {1, "Kilometer
|
||||
consvar_t cv_kartspeedometer = {"kartdisplayspeed", "Off", CV_SAVE, kartspeedometer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
|
||||
static CV_PossibleValue_t kartvoices_cons_t[] = {{0, "Never"}, {1, "Tasteful"}, {2, "Meme"}, {0, NULL}};
|
||||
consvar_t cv_kartvoices = {"kartvoices", "Tasteful", CV_SAVE, kartvoices_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_karthitemdialog = {"karthitemdialog", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOSHOWHELP, CV_YesNo, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -493,8 +489,6 @@ consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0,
|
||||
|
||||
consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showdownloadprompt = {"showdownloadprompt", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Intermission time Tails 04-19-2002
|
||||
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_inttime = {"inttime", "20", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -567,10 +561,6 @@ static CV_PossibleValue_t ps_descriptor_cons_t[] = {
|
||||
{1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}};
|
||||
consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugdirector = {"debugdirector", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showdirectorhud = {"showdirectorhud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {SKINMENUTYPE_EXTENDED, "Extended"}, {0, NULL}};
|
||||
@@ -587,8 +577,7 @@ static CV_PossibleValue_t skinselectgridsort_t[] ={
|
||||
};
|
||||
consvar_t cv_skinselectgridsort ={ "skinselectgridsort", "Real name", CV_SAVE|CV_CALL|CV_NOINIT, skinselectgridsort_t, sortSkinGrid, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t betainterscreen_t[] = {{0, "Off"}, {1, "On"}, {2, "NoBG"}, {0, NULL}};
|
||||
consvar_t cv_betainterscreen = {"betaintermissionscreen", "Off", CV_SAVE, betainterscreen_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_betainterscreen = {"betaintermissionscreen", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
INT16 gametype = GT_RACE; // SRB2kart
|
||||
boolean forceresetplayers = false;
|
||||
@@ -790,10 +779,6 @@ void D_RegisterServerCommands(void)
|
||||
// d_clisrv
|
||||
CV_RegisterVar(&cv_maxplayers);
|
||||
CV_RegisterVar(&cv_resynchattempts);
|
||||
#ifdef SATURNSYNCH
|
||||
CV_RegisterVar(&cv_gamestateattempts);
|
||||
CV_RegisterVar(&cv_resynchcooldown);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_maxsend);
|
||||
CV_RegisterVar(&cv_noticedownload);
|
||||
CV_RegisterVar(&cv_downloadspeed);
|
||||
@@ -801,9 +786,6 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_httpsource);
|
||||
#ifndef NONET
|
||||
CV_RegisterVar(&cv_allownewplayer);
|
||||
#ifdef SATURNJOIN
|
||||
CV_RegisterVar(&cv_allownewsaturnplayer);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_joinrefusemessage);
|
||||
CV_RegisterVar(&cv_chatlogsize);
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
@@ -841,9 +823,9 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_recordmultiplayerdemos);
|
||||
CV_RegisterVar(&cv_netdemosyncquality);
|
||||
CV_RegisterVar(&cv_maxdemosize);
|
||||
CV_RegisterVar(&cv_demochangemap);
|
||||
|
||||
CV_RegisterVar(&cv_keyboardlayout);
|
||||
|
||||
CV_RegisterVar(&cv_betainterscreen);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -978,6 +960,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_audbuffersize);
|
||||
|
||||
// m_menu.c
|
||||
//CV_RegisterVar(&cv_compactscoreboard);
|
||||
CV_RegisterVar(&cv_chatheight);
|
||||
CV_RegisterVar(&cv_chatwidth);
|
||||
CV_RegisterVar(&cv_chattime);
|
||||
@@ -995,11 +978,6 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_showtrackaddon);
|
||||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
CV_RegisterVar(&cv_showdownloadprompt);
|
||||
|
||||
CV_RegisterVar(&cv_director);
|
||||
CV_RegisterVar(&cv_kartdebugdirector);
|
||||
CV_RegisterVar(&cv_showdirectorhud);
|
||||
|
||||
CV_RegisterVar(&cv_luaimmersion);
|
||||
CV_RegisterVar(&cv_fakelocalskin);
|
||||
@@ -1014,7 +992,6 @@ void D_RegisterClientCommands(void)
|
||||
//CV_RegisterVar(&cv_alwaysfreelook2);
|
||||
//CV_RegisterVar(&cv_chasefreelook);
|
||||
//CV_RegisterVar(&cv_chasefreelook2);
|
||||
CV_RegisterVar(&cv_replaysearchrate);
|
||||
CV_RegisterVar(&cv_showfocuslost);
|
||||
CV_RegisterVar(&cv_pauseifunfocused);
|
||||
|
||||
@@ -1089,13 +1066,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
CV_RegisterVar(&cv_turnsmooth);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_rumble[i]);
|
||||
CV_RegisterVar(&cv_gamepadled[i]);
|
||||
CV_RegisterVar(&cv_ledpowerup[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_usemouse2);
|
||||
CV_RegisterVar(&cv_invertmouse);
|
||||
@@ -1188,26 +1158,32 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_showmusicfilename);
|
||||
|
||||
CV_RegisterVar(&cv_betainterscreen);
|
||||
|
||||
CV_RegisterVar(&cv_laglesscam);
|
||||
|
||||
// ingame object placing
|
||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||
COM_AddCommand("writethings", Command_Writethings_f);
|
||||
CV_RegisterVar(&cv_speed);
|
||||
CV_RegisterVar(&cv_opflags);
|
||||
CV_RegisterVar(&cv_mapthingnum);
|
||||
//CV_RegisterVar(&cv_grid);
|
||||
//CV_RegisterVar(&cv_snapto);
|
||||
|
||||
// add cheat commands
|
||||
COM_AddCommand("noclip", Command_CheatNoClip_f);
|
||||
COM_AddCommand("god", Command_CheatGod_f);
|
||||
COM_AddCommand("notarget", Command_CheatNoTarget_f);
|
||||
/*COM_AddCommand("getallemeralds", Command_Getallemeralds_f);
|
||||
COM_AddCommand("resetemeralds", Command_Resetemeralds_f);
|
||||
COM_AddCommand("setrings", Command_Setrings_f);
|
||||
COM_AddCommand("setlives", Command_Setlives_f);
|
||||
COM_AddCommand("setcontinues", Command_Setcontinues_f);*/
|
||||
COM_AddCommand("devmode", Command_Devmode_f);
|
||||
COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f);
|
||||
COM_AddCommand("scale", Command_Scale_f);
|
||||
COM_AddCommand("gravflip", Command_Gravflip_f);
|
||||
COM_AddCommand("hurtme", Command_Hurtme_f);
|
||||
/*COM_AddCommand("jumptoaxis", Command_JumpToAxis_f);
|
||||
COM_AddCommand("charability", Command_Charability_f);
|
||||
COM_AddCommand("charspeed", Command_Charspeed_f);*/
|
||||
COM_AddCommand("teleport", Command_Teleport_f);
|
||||
COM_AddCommand("rteleport", Command_RTeleport_f);
|
||||
COM_AddCommand("skynum", Command_Skynum_f);
|
||||
@@ -1239,69 +1215,19 @@ void D_RegisterClientCommands(void)
|
||||
*/
|
||||
static void Skin_FindRealNameSkin(consvar_t *cvar)
|
||||
{
|
||||
INT32 matches[MAXSKINS] = {0}; // Skin numbers of matching skins
|
||||
INT32 matches_pos[MAXSKINS] = {0}; // Index of matching substring
|
||||
INT32 nummatches = 0;
|
||||
// Not the best way to implements this but it will do.
|
||||
|
||||
INT32 i;
|
||||
int i;
|
||||
const char *value = cvar->string;
|
||||
|
||||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
// Perfect match with some skin name, no need to find matching realname
|
||||
if (strncasecmp(value, skins[i].name, sizeof skins[i].name) == 0)
|
||||
if (strncmp(value, skins[i].realname, sizeof skins[i].realname) == 0)
|
||||
{
|
||||
// Change the cvar to be the value of the name.
|
||||
CV_StealthSet(cvar, skins[i].name);
|
||||
return;
|
||||
|
||||
const char *match = strcasestr(skins[i].realname, value);
|
||||
if (match != NULL)
|
||||
{
|
||||
matches[nummatches] = i;
|
||||
matches_pos[nummatches] = match - skins[i].realname;
|
||||
++nummatches;
|
||||
}
|
||||
}
|
||||
|
||||
if (nummatches == 1)
|
||||
{
|
||||
// Change the cvar to be the value of the name.
|
||||
CV_StealthSet(cvar, skins[matches[0]].name);
|
||||
}
|
||||
else if (nummatches > 1)
|
||||
{
|
||||
size_t query_length = strlen(value);
|
||||
|
||||
char start[SKINNAMESIZE+1] = {0}; // Start of name, printed with normal color
|
||||
char match[SKINNAMESIZE+1] = {0}; // Matching part of name, highlighted in red
|
||||
const char *end = NULL; // End of the name, printed with normal color. Can be just a pointer into realname part
|
||||
|
||||
CONS_Printf("\x86Multiple matches found:\n");
|
||||
|
||||
for (i = 0; i < nummatches; ++i)
|
||||
{
|
||||
const char *realname = skins[matches[i]].realname;
|
||||
|
||||
if (matches_pos[i] == 0)
|
||||
start[0] = 0;
|
||||
else
|
||||
{
|
||||
memcpy(start, realname, matches_pos[i]);
|
||||
start[matches_pos[i]] = 0;
|
||||
}
|
||||
|
||||
memcpy(match, realname+matches_pos[i], query_length);
|
||||
match[matches_pos[i] + query_length] = 0;
|
||||
|
||||
end = realname + matches_pos[i] + query_length;
|
||||
|
||||
CONS_Printf("%s\x85%s\x80%s (%s)\n", start, match, end, skins[matches[i]].name);
|
||||
}
|
||||
|
||||
CONS_Printf("\x86Try be more specific\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("\x86Skin not found\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1728,9 +1654,8 @@ static void SendNameAndColor(void)
|
||||
cv_skin.value = R_SkinAvailable(cv_skin.string);
|
||||
if (cv_skin.value < 0)
|
||||
{
|
||||
INT32 skinnum = players[consoleplayer].skin;
|
||||
CV_StealthSet(&cv_skin, skins[skinnum].name);
|
||||
cv_skin.value = skinnum;
|
||||
CV_StealthSet(&cv_skin, DEFAULTSKIN);
|
||||
cv_skin.value = 0;
|
||||
}
|
||||
|
||||
// Finally write out the complete packet and send it off.
|
||||
@@ -1858,9 +1783,8 @@ static void SendNameAndColor2(void)
|
||||
cv_skin2.value = R_SkinAvailable(cv_skin2.string);
|
||||
if (cv_skin2.value < 0)
|
||||
{
|
||||
INT32 skinnum = players[displayplayers[1]].skin;
|
||||
CV_StealthSet(&cv_skin2, skins[skinnum].name);
|
||||
cv_skin2.value = skinnum;
|
||||
CV_StealthSet(&cv_skin2, DEFAULTSKIN);
|
||||
cv_skin2.value = 0;
|
||||
}
|
||||
|
||||
// Finally write out the complete packet and send it off.
|
||||
@@ -1979,9 +1903,8 @@ static void SendNameAndColor3(void)
|
||||
cv_skin3.value = R_SkinAvailable(cv_skin3.string);
|
||||
if (cv_skin3.value < 0)
|
||||
{
|
||||
INT32 skinnum = players[displayplayers[2]].skin;
|
||||
CV_StealthSet(&cv_skin3, skins[skinnum].name);
|
||||
cv_skin3.value = skinnum;
|
||||
CV_StealthSet(&cv_skin3, DEFAULTSKIN);
|
||||
cv_skin3.value = 0;
|
||||
}
|
||||
|
||||
// Finally write out the complete packet and send it off.
|
||||
@@ -2108,9 +2031,8 @@ static void SendNameAndColor4(void)
|
||||
cv_skin4.value = R_SkinAvailable(cv_skin4.string);
|
||||
if (cv_skin4.value < 0)
|
||||
{
|
||||
INT32 skinnum = players[displayplayers[3]].skin;
|
||||
CV_StealthSet(&cv_skin4, skins[skinnum].name);
|
||||
cv_skin4.value = skinnum;
|
||||
CV_StealthSet(&cv_skin4, DEFAULTSKIN);
|
||||
cv_skin4.value = 0;
|
||||
}
|
||||
|
||||
// Finally write out the complete packet and send it off.
|
||||
@@ -3015,10 +2937,6 @@ static void Command_Map_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
// spend atleast 35 seconds in one map
|
||||
if (cv_demochangemap.value && demo.recording && demo.savemode != DSM_NOTSAVING && (timeinmap > 1463) && ((cv_demochangemap.value == 2 && newmapnum == gamemap) || newmapnum != gamemap))
|
||||
G_SaveDemo();
|
||||
|
||||
fromlevelselect = false;
|
||||
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
|
||||
|
||||
@@ -3209,8 +3127,6 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||
else
|
||||
S_ResumeAudio();
|
||||
}
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
}
|
||||
|
||||
static void Command_ReplayMarker(void)
|
||||
@@ -3228,10 +3144,7 @@ static void Command_ReplayMarker(void)
|
||||
demo.savemode = DSM_WILLAUTOSAVE;
|
||||
if (adjustedleveltime < 0)
|
||||
adjustedleveltime = 0;
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
if (title)
|
||||
Z_Free(title);
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", G_BuildMapTitle(gamemap), G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
CONS_Printf("Replay will be saved!\n");
|
||||
}
|
||||
}
|
||||
@@ -5752,12 +5665,6 @@ void Command_ExitGame_f(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
if (dedicated)
|
||||
{
|
||||
CONS_Printf("This command cannot be used on dedicated server\n");
|
||||
return;
|
||||
}
|
||||
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
CV_ClearChangedFlags();
|
||||
|
||||
@@ -128,7 +128,6 @@ extern consvar_t cv_kartvoterulechanges;
|
||||
extern consvar_t cv_kartgametypepreference;
|
||||
extern consvar_t cv_kartspeedometer;
|
||||
extern consvar_t cv_kartvoices;
|
||||
extern consvar_t cv_karthitemdialog;
|
||||
|
||||
extern consvar_t cv_karteliminatelast;
|
||||
|
||||
@@ -166,7 +165,6 @@ extern consvar_t cv_minihead;
|
||||
extern consvar_t cv_showlapemblem;
|
||||
|
||||
extern consvar_t cv_showviewpointtext;
|
||||
extern consvar_t cv_showdownloadprompt;
|
||||
extern consvar_t cv_luaimmersion;
|
||||
extern consvar_t cv_fakelocalskin;
|
||||
extern consvar_t cv_showlocalskinmenus;
|
||||
@@ -203,16 +201,12 @@ extern consvar_t cv_ps_thinkframe_page;
|
||||
extern consvar_t cv_ps_samplesize;
|
||||
extern consvar_t cv_ps_descriptor;
|
||||
|
||||
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
|
||||
|
||||
extern consvar_t cv_showtrackaddon;
|
||||
|
||||
extern consvar_t cv_showspecstuff;
|
||||
|
||||
extern consvar_t cv_betainterscreen;
|
||||
|
||||
extern consvar_t cv_laglesscam;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SKINMENUTYPE_SCROLL = 0,
|
||||
|
||||
+8
-36
@@ -65,10 +65,10 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
|
||||
#ifdef HAVE_CURL
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 35, 0)
|
||||
static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
#define XFERINFOFUNCTION
|
||||
#else
|
||||
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -833,6 +833,7 @@ void SV_FileSendTicker(void)
|
||||
|
||||
netbuffer->packettype = PT_FILEFRAGMENT;
|
||||
|
||||
// (((sendbytes-nowsentbyte)*TICRATE)/(I_GetTime()-starttime)<(UINT32)net_bandwidth)
|
||||
while (packetsent-- && filestosend != 0)
|
||||
{
|
||||
for (i = currentnode, j = 0; j < MAXNETNODES;
|
||||
@@ -1203,53 +1204,25 @@ size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
}
|
||||
|
||||
#ifdef XFERINFOFUNCTION
|
||||
static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
{
|
||||
time_t curtime;
|
||||
|
||||
(void)clientp;
|
||||
(void)ultotal;
|
||||
(void)ulnow; // Function prototype requires these but we won't use, so just discard
|
||||
|
||||
curtime = time(NULL);
|
||||
|
||||
curl_dlnow = dlnow;
|
||||
curl_dltotal = dltotal;
|
||||
|
||||
if (curtime > curl_starttime)
|
||||
{
|
||||
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
}
|
||||
else
|
||||
{
|
||||
getbytes = 0;
|
||||
}
|
||||
|
||||
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
{
|
||||
time_t curtime;
|
||||
|
||||
(void)clientp;
|
||||
(void)ultotal;
|
||||
(void)ulnow; // Function prototype requires these but we won't use, so just discard
|
||||
|
||||
curtime = time(NULL);
|
||||
|
||||
curl_dlnow = dlnow;
|
||||
curl_dltotal = dltotal;
|
||||
|
||||
if (curtime > curl_starttime)
|
||||
{
|
||||
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
}
|
||||
else
|
||||
{
|
||||
getbytes = 0;
|
||||
}
|
||||
|
||||
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -1327,9 +1300,8 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
curl_starttime = time(NULL);
|
||||
|
||||
curl_running = true;
|
||||
#ifdef HAVE_THREADS
|
||||
|
||||
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-12
@@ -347,14 +347,6 @@ typedef enum
|
||||
RW_RAIL = 32
|
||||
} ringweapons_t;
|
||||
|
||||
// enum for saved lap times
|
||||
typedef enum
|
||||
{
|
||||
LAP_CUR,
|
||||
LAP_LAST,
|
||||
LAP__MAX
|
||||
} laptime_e;
|
||||
|
||||
// ========================================================================
|
||||
// PLAYER STRUCTURE
|
||||
// ========================================================================
|
||||
@@ -473,7 +465,6 @@ typedef struct player_s
|
||||
INT16 numboxes; // Number of item boxes obtained for Race Mode
|
||||
INT16 totalring; // Total number of rings obtained for Race Mode
|
||||
tic_t realtime; // integer replacement for leveltime
|
||||
tic_t laptime[LAP__MAX];
|
||||
UINT8 laps; // Number of laps (optional)
|
||||
|
||||
////////////////////
|
||||
@@ -546,13 +537,15 @@ typedef struct player_s
|
||||
tic_t grieftime;
|
||||
UINT8 griefstrikes;
|
||||
|
||||
tic_t hitemtimer;
|
||||
UINT8 hitemvictim;
|
||||
|
||||
UINT8 splitscreenindex;
|
||||
#ifdef HWRENDER
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
#endif
|
||||
|
||||
struct {
|
||||
angle_t aiming, awayviewaiming, frameangle;
|
||||
angle_t viewrollangle;
|
||||
} lerp;
|
||||
} player_t;
|
||||
|
||||
#endif
|
||||
+163
-28
@@ -291,6 +291,8 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||
INT32 i;
|
||||
boolean slotfound = false;
|
||||
|
||||
DEH_WriteUndoline("PLAYERTEXT", description[num].notes, UNDO_ENDTEXT);
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
@@ -360,6 +362,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||
{
|
||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
||||
goto done;
|
||||
DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE);
|
||||
PlayerMenu[num].status = IT_CALL;
|
||||
strncpy(description[num].picname, word2, 8);
|
||||
}
|
||||
@@ -383,6 +386,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||
*/
|
||||
if (i != IT_DISABLED && !slotfound && (slotfound = findFreeSlot(&num)) == false)
|
||||
goto done;
|
||||
DEH_WriteUndoline(word, va("%d", PlayerMenu[num].status), UNDO_NONE);
|
||||
PlayerMenu[num].status = (INT16)i;
|
||||
}
|
||||
else if (fastcmp(word, "SKINNAME"))
|
||||
@@ -390,6 +394,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||
// Send to free slot.
|
||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
||||
goto done;
|
||||
DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE);
|
||||
PlayerMenu[num].status = IT_CALL;
|
||||
|
||||
strlcpy(description[num].skinname, word2, sizeof description[num].skinname);
|
||||
@@ -552,98 +557,122 @@ static void readthing(MYFILE *f, INT32 num)
|
||||
|
||||
if (fastcmp(word, "MAPTHINGNUM") || fastcmp(word, "DOOMEDNUM"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].doomednum), UNDO_NONE);
|
||||
mobjinfo[num].doomednum = (INT32)atoi(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPAWNSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnstate), UNDO_NONE);
|
||||
mobjinfo[num].spawnstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPAWNHEALTH"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnhealth), UNDO_NONE);
|
||||
mobjinfo[num].spawnhealth = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SEESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].seestate), UNDO_NONE);
|
||||
mobjinfo[num].seestate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SEESOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].seesound), UNDO_NONE);
|
||||
mobjinfo[num].seesound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "REACTIONTIME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].reactiontime), UNDO_NONE);
|
||||
mobjinfo[num].reactiontime = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "ATTACKSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].attacksound), UNDO_NONE);
|
||||
mobjinfo[num].attacksound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "PAINSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].painstate), UNDO_NONE);
|
||||
mobjinfo[num].painstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "PAINCHANCE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].painchance), UNDO_NONE);
|
||||
mobjinfo[num].painchance = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "PAINSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].painsound), UNDO_NONE);
|
||||
mobjinfo[num].painsound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "MELEESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].meleestate), UNDO_NONE);
|
||||
mobjinfo[num].meleestate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "MISSILESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].missilestate), UNDO_NONE);
|
||||
mobjinfo[num].missilestate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEATHSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathstate), UNDO_NONE);
|
||||
mobjinfo[num].deathstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEATHSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathsound), UNDO_NONE);
|
||||
mobjinfo[num].deathsound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "XDEATHSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].xdeathstate), UNDO_NONE);
|
||||
mobjinfo[num].xdeathstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPEED"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].speed), UNDO_NONE);
|
||||
mobjinfo[num].speed = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "RADIUS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].radius), UNDO_NONE);
|
||||
mobjinfo[num].radius = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "HEIGHT"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].height), UNDO_NONE);
|
||||
mobjinfo[num].height = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DISPOFFSET"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].dispoffset), UNDO_NONE);
|
||||
mobjinfo[num].dispoffset = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "MASS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].mass), UNDO_NONE);
|
||||
mobjinfo[num].mass = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DAMAGE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].damage), UNDO_NONE);
|
||||
mobjinfo[num].damage = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "ACTIVESOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].activesound), UNDO_NONE);
|
||||
mobjinfo[num].activesound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "FLAGS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].flags), UNDO_NONE);
|
||||
mobjinfo[num].flags = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "RAISESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].raisestate), UNDO_NONE);
|
||||
mobjinfo[num].raisestate = get_number(word2);
|
||||
}
|
||||
else
|
||||
@@ -1081,6 +1110,8 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
||||
UINT16 usi;
|
||||
UINT8 picid;
|
||||
|
||||
DEH_WriteUndoline("SCENETEXT", cutscenes[num]->scene[scenenum].text, UNDO_ENDTEXT);
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
@@ -1157,6 +1188,7 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
||||
|
||||
if (fastcmp(word, "NUMBEROFPICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].numpics), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].numpics = (UINT8)i;
|
||||
}
|
||||
else if (fastncmp(word, "PIC", 3))
|
||||
@@ -1171,22 +1203,27 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
||||
|
||||
if (fastcmp(word+4, "NAME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].picname[picid], UNDO_NONE);
|
||||
strncpy(cutscenes[num]->scene[scenenum].picname[picid], word2, 8);
|
||||
}
|
||||
else if (fastcmp(word+4, "HIRES"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].pichires[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].pichires[picid] = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word+4, "DURATION"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].picduration[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].picduration[picid] = usi;
|
||||
}
|
||||
else if (fastcmp(word+4, "XCOORD"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].xcoord[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].xcoord[picid] = usi;
|
||||
}
|
||||
else if (fastcmp(word+4, "YCOORD"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].ycoord[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].ycoord[picid] = usi;
|
||||
}
|
||||
else
|
||||
@@ -1194,12 +1231,14 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
||||
}
|
||||
else if (fastcmp(word, "MUSIC"))
|
||||
{
|
||||
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
|
||||
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
|
||||
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
|
||||
}
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
else if (fastcmp(word, "MUSICSLOT"))
|
||||
{
|
||||
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
|
||||
i = get_mus(word2, true);
|
||||
if (i && i <= 1035)
|
||||
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
|
||||
@@ -1212,34 +1251,42 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
||||
#endif
|
||||
else if (fastcmp(word, "MUSICTRACK"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
|
||||
}
|
||||
else if (fastcmp(word, "MUSICPOS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchposition), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].musswitchposition = (UINT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "MUSICLOOP"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musicloop), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].musicloop = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "TEXTXPOS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textxpos), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].textxpos = usi;
|
||||
}
|
||||
else if (fastcmp(word, "TEXTYPOS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textypos), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].textypos = usi;
|
||||
}
|
||||
else if (fastcmp(word, "FADEINID"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].fadeinid = (UINT8)i;
|
||||
}
|
||||
else if (fastcmp(word, "FADEOUTID"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].fadeoutid = (UINT8)i;
|
||||
}
|
||||
else if (fastcmp(word, "FADECOLOR"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].fadecolor = (UINT8)i;
|
||||
}
|
||||
else
|
||||
@@ -1299,6 +1346,8 @@ static void readcutscene(MYFILE *f, INT32 num)
|
||||
if (1 <= value && value <= 128)
|
||||
{
|
||||
readcutscenescene(f, num, value - 1);
|
||||
DEH_WriteUndoline(word, word2, UNDO_SPACE|UNDO_CUTLINE);
|
||||
DEH_WriteUndoline("NUMSCENES", va("%d", oldnumscenes), UNDO_SPACE);
|
||||
}
|
||||
else
|
||||
deh_warning("Scene number %d out of range (1 - 128)", value);
|
||||
@@ -1354,10 +1403,12 @@ static void readhuditem(MYFILE *f, INT32 num)
|
||||
|
||||
if (fastcmp(word, "X"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", hudinfo[num].x), UNDO_NONE);
|
||||
hudinfo[num].x = i;
|
||||
}
|
||||
else if (fastcmp(word, "Y"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", hudinfo[num].y), UNDO_NONE);
|
||||
hudinfo[num].y = i;
|
||||
}
|
||||
else
|
||||
@@ -1368,10 +1419,25 @@ static void readhuditem(MYFILE *f, INT32 num)
|
||||
Z_Free(s);
|
||||
}
|
||||
|
||||
/*
|
||||
Sprite number = 10
|
||||
Sprite subnumber = 32968
|
||||
Duration = 200
|
||||
Next frame = 200
|
||||
*/
|
||||
|
||||
// IMPORTANT!
|
||||
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONNUM ENUM IN INFO.H
|
||||
actionpointer_t actionpointers[] =
|
||||
/** Action pointer for reading actions from Dehacked lumps.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
actionf_t action; ///< Function pointer corresponding to the actual action.
|
||||
const char *name; ///< Name of the action in ALL CAPS.
|
||||
} actionpointer_t;
|
||||
|
||||
/** Array mapping action names to action functions.
|
||||
* Names must be in ALL CAPS for case insensitive comparisons.
|
||||
*/
|
||||
static actionpointer_t actionpointers[] =
|
||||
{
|
||||
{{A_Explode}, "A_EXPLODE"},
|
||||
{{A_Pain}, "A_PAIN"},
|
||||
@@ -1526,7 +1592,6 @@ actionpointer_t actionpointers[] =
|
||||
{{A_FZBoomSmoke}, "A_FZBOOMSMOKE"}, //SRB2kart
|
||||
{{A_RandomShadowFrame}, "A_RANDOMSHADOWFRAME"}, //SRB2kart
|
||||
{{A_RoamingShadowThinker}, "A_ROAMINGSHADOWTHINKER"}, //SRB2kart
|
||||
{{A_MayonakaArrow}, "A_MAYONAKAARROW"}, //SRB2kart
|
||||
{{A_ReaperThinker}, "A_REAPERTHINKER"}, //SRB2kart
|
||||
{{A_MementosTPParticles}, "A_MEMENTOSTPPARTICLES"}, //SRB2kart
|
||||
{{A_FlameParticle}, "A_FLAMEPARTICLE"}, // SRB2kart
|
||||
@@ -1619,26 +1684,32 @@ static void readframe(MYFILE *f, INT32 num)
|
||||
|
||||
if (fastcmp(word1, "SPRITENUMBER") || fastcmp(word1, "SPRITENAME"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%u", states[num].sprite), UNDO_NONE);
|
||||
states[num].sprite = get_sprite(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "SPRITESUBNUMBER") || fastcmp(word1, "SPRITEFRAME"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].frame), UNDO_NONE);
|
||||
states[num].frame = (INT32)get_number(word2); // So the FF_ flags get calculated
|
||||
}
|
||||
else if (fastcmp(word1, "DURATION"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%u", states[num].tics), UNDO_NONE);
|
||||
states[num].tics = (INT32)get_number(word2); // So TICRATE can be used
|
||||
}
|
||||
else if (fastcmp(word1, "NEXT"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].nextstate), UNDO_NONE);
|
||||
states[num].nextstate = get_state(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "VAR1"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].var1), UNDO_NONE);
|
||||
states[num].var1 = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "VAR2"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].var2), UNDO_NONE);
|
||||
states[num].var2 = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "ACTION"))
|
||||
@@ -1664,6 +1735,7 @@ static void readframe(MYFILE *f, INT32 num)
|
||||
{
|
||||
if (actionpointers[z].action.acv == states[num].action.acv)
|
||||
{
|
||||
DEH_WriteUndoline(word1, actionpointers[z].name, UNDO_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1723,14 +1795,17 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
|
||||
|
||||
if (fastcmp(word, "SINGULAR"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", S_sfx[num].singularity), UNDO_NONE);
|
||||
S_sfx[num].singularity = value;
|
||||
}
|
||||
else if (fastcmp(word, "PRIORITY"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", S_sfx[num].priority), UNDO_NONE);
|
||||
S_sfx[num].priority = value;
|
||||
}
|
||||
else if (fastcmp(word, "FLAGS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", S_sfx[num].pitch), UNDO_NONE);
|
||||
S_sfx[num].pitch = value;
|
||||
}
|
||||
else
|
||||
@@ -1790,6 +1865,16 @@ static void reademblemdata(MYFILE *f, INT32 num)
|
||||
INT32 value;
|
||||
|
||||
// Reset all data initially
|
||||
DEH_WriteUndoline("TYPE", va("%d", emblemlocations[num-1].type), UNDO_NONE);
|
||||
DEH_WriteUndoline("X", va("%d", emblemlocations[num-1].x), UNDO_NONE);
|
||||
DEH_WriteUndoline("Y", va("%d", emblemlocations[num-1].y), UNDO_NONE);
|
||||
DEH_WriteUndoline("Z", va("%d", emblemlocations[num-1].z), UNDO_NONE);
|
||||
DEH_WriteUndoline("MAPNUM", va("%d", emblemlocations[num-1].level), UNDO_NONE);
|
||||
DEH_WriteUndoline("VAR", va("%d", emblemlocations[num-1].var), UNDO_NONE);
|
||||
DEH_WriteUndoline("SPRITE", va("%d", emblemlocations[num-1].sprite), UNDO_NONE);
|
||||
DEH_WriteUndoline("COLOR", va("%d", emblemlocations[num-1].color), UNDO_NONE);
|
||||
DEH_WriteUndoline("HINT", extraemblems[num-1].hint, UNDO_NONE);
|
||||
|
||||
memset(&emblemlocations[num-1], 0, sizeof(emblem_t));
|
||||
|
||||
do
|
||||
@@ -1917,6 +2002,12 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
|
||||
INT32 value;
|
||||
|
||||
// Reset all data initially
|
||||
DEH_WriteUndoline("NAME", extraemblems[num-1].name, UNDO_NONE);
|
||||
DEH_WriteUndoline("OBJECTIVE", extraemblems[num-1].description, UNDO_NONE);
|
||||
DEH_WriteUndoline("CONDITIONSET", va("%d", extraemblems[num-1].conditionset), UNDO_NONE);
|
||||
DEH_WriteUndoline("SPRITE", va("%d", extraemblems[num-1].sprite), UNDO_NONE);
|
||||
DEH_WriteUndoline("COLOR", va("%d", extraemblems[num-1].color), UNDO_NONE);
|
||||
|
||||
memset(&extraemblems[num-1], 0, sizeof(extraemblem_t));
|
||||
|
||||
do
|
||||
@@ -1995,6 +2086,15 @@ static void readunlockable(MYFILE *f, INT32 num)
|
||||
INT32 i;
|
||||
|
||||
// Same deal with unlockables, clear all first
|
||||
DEH_WriteUndoline("NAME", unlockables[num].name, UNDO_NONE);
|
||||
DEH_WriteUndoline("OBJECTIVE", unlockables[num].objective, UNDO_NONE);
|
||||
DEH_WriteUndoline("HEIGHT", va("%d", unlockables[num].height), UNDO_NONE);
|
||||
DEH_WriteUndoline("CONDITIONSET", va("%d", unlockables[num].conditionset), UNDO_NONE);
|
||||
DEH_WriteUndoline("TYPE", va("%d", unlockables[num].type), UNDO_NONE);
|
||||
DEH_WriteUndoline("NOCECHO", va("%d", unlockables[num].nocecho), UNDO_NONE);
|
||||
DEH_WriteUndoline("NOCHECKLIST", va("%d", unlockables[num].nochecklist), UNDO_NONE);
|
||||
DEH_WriteUndoline("VAR", va("%d", unlockables[num].variable), UNDO_NONE);
|
||||
|
||||
memset(&unlockables[num], 0, sizeof(unlockable_t));
|
||||
|
||||
do
|
||||
@@ -2373,11 +2473,13 @@ static void readpatch(MYFILE *f, const char *name, UINT16 wad)
|
||||
// X position of the patch in the texture.
|
||||
if (fastcmp(word, "X"))
|
||||
{
|
||||
//DEH_WriteUndoline(word, va("%d", patch->originx), UNDO_NONE);
|
||||
patch.originx = (INT16)value;
|
||||
}
|
||||
// Y position of the patch in the texture.
|
||||
else if (fastcmp(word, "Y"))
|
||||
{
|
||||
//DEH_WriteUndoline(word, va("%d", patch->originy), UNDO_NONE);
|
||||
patch.originy = (INT16)value;
|
||||
}
|
||||
else
|
||||
@@ -2446,6 +2548,7 @@ static void readmaincfg(MYFILE *f)
|
||||
else
|
||||
value = get_number(word2);
|
||||
|
||||
DEH_WriteUndoline(word, va("%d", spstage_start), UNDO_NONE);
|
||||
spstage_start = (INT16)value;
|
||||
}
|
||||
else if (fastcmp(word, "SSTAGE_START"))
|
||||
@@ -2459,64 +2562,79 @@ static void readmaincfg(MYFILE *f)
|
||||
else
|
||||
value = get_number(word2);
|
||||
|
||||
DEH_WriteUndoline(word, va("%d", sstage_start), UNDO_NONE);
|
||||
sstage_start = (INT16)value;
|
||||
sstage_end = (INT16)(sstage_start+6); // 7 special stages total
|
||||
}
|
||||
else if (fastcmp(word, "USENIGHTSSS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", useNightsSS), UNDO_NONE);
|
||||
useNightsSS = (value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "REDTEAM"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_redteam), UNDO_NONE);
|
||||
skincolor_redteam = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "BLUETEAM"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_blueteam), UNDO_NONE);
|
||||
skincolor_blueteam = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "REDRING"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_redring), UNDO_NONE);
|
||||
skincolor_redring = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "BLUERING"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_bluering), UNDO_NONE);
|
||||
skincolor_bluering = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "INVULNTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", invulntics), UNDO_NONE);
|
||||
invulntics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SNEAKERTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", sneakertics), UNDO_NONE);
|
||||
sneakertics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "FLASHINGTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", flashingtics), UNDO_NONE);
|
||||
flashingtics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "TAILSFLYTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", tailsflytics), UNDO_NONE);
|
||||
tailsflytics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "UNDERWATERTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", underwatertics), UNDO_NONE);
|
||||
underwatertics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPACETIMETICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", spacetimetics), UNDO_NONE);
|
||||
spacetimetics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "EXTRALIFETICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", extralifetics), UNDO_NONE);
|
||||
extralifetics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "GAMEOVERTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", gameovertics), UNDO_NONE);
|
||||
gameovertics = get_number(word2);
|
||||
}
|
||||
|
||||
else if (fastcmp(word, "INTROTOPLAY"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", introtoplay), UNDO_NONE);
|
||||
introtoplay = (UINT8)get_number(word2);
|
||||
// range check, you morons.
|
||||
if (introtoplay > 128)
|
||||
@@ -2524,14 +2642,17 @@ static void readmaincfg(MYFILE *f)
|
||||
}
|
||||
else if (fastcmp(word, "LOOPTITLE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", looptitle), UNDO_NONE);
|
||||
looptitle = (value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "TITLESCROLLSPEED"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", titlescrollspeed), UNDO_NONE);
|
||||
titlescrollspeed = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "CREDITSCUTSCENE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", creditscutscene), UNDO_NONE);
|
||||
creditscutscene = (UINT8)get_number(word2);
|
||||
// range check, you morons.
|
||||
if (creditscutscene > 128)
|
||||
@@ -2539,22 +2660,27 @@ static void readmaincfg(MYFILE *f)
|
||||
}
|
||||
else if (fastcmp(word, "NUMDEMOS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", numDemos), UNDO_NONE);
|
||||
numDemos = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEMODELAYTIME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", demoDelayTime), UNDO_NONE);
|
||||
demoDelayTime = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEMOIDLETIME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", demoIdleTime), UNDO_NONE);
|
||||
demoIdleTime = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "USE1UPSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", use1upSound), UNDO_NONE);
|
||||
use1upSound = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "MAXXTRALIFE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", maxXtraLife), UNDO_NONE);
|
||||
maxXtraLife = (UINT8)get_number(word2);
|
||||
}
|
||||
|
||||
@@ -2568,6 +2694,7 @@ static void readmaincfg(MYFILE *f)
|
||||
I_Error("Maincfg: bad data file name '%s'\n", word2);
|
||||
|
||||
G_SaveGameData(false);
|
||||
DEH_WriteUndoline(word, gamedatafilename, UNDO_NONE);
|
||||
strlcpy(gamedatafilename, word2, sizeof (gamedatafilename));
|
||||
strlwr(gamedatafilename);
|
||||
savemoddata = true;
|
||||
@@ -2588,10 +2715,12 @@ static void readmaincfg(MYFILE *f)
|
||||
}
|
||||
else if (fastcmp(word, "RESETDATA"))
|
||||
{
|
||||
DEH_WriteUndoline(word, "0", UNDO_TODO); /// \todo
|
||||
P_ResetData(value);
|
||||
}
|
||||
else if (fastcmp(word, "CUSTOMVERSION"))
|
||||
{
|
||||
DEH_WriteUndoline(word, customversionstring, UNDO_NONE);
|
||||
strlcpy(customversionstring, word2, sizeof (customversionstring));
|
||||
}
|
||||
else
|
||||
@@ -2851,11 +2980,13 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
{
|
||||
G_SetGameModified(multiplayer, true);
|
||||
readmaincfg(f);
|
||||
DEH_WriteUndoline(word, "", UNDO_HEADER);
|
||||
continue;
|
||||
}
|
||||
else if (fastcmp(word, "WIPES"))
|
||||
{
|
||||
readwipes(f);
|
||||
DEH_WriteUndoline(word, "", UNDO_HEADER);
|
||||
// This is not a major mod.
|
||||
continue;
|
||||
}
|
||||
@@ -2876,6 +3007,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Character %d out of range (0 - 31)", i);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
// This is not a major mod.
|
||||
continue;
|
||||
}
|
||||
@@ -2889,6 +3021,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
{
|
||||
// Read patch from spec file.
|
||||
readpatch(f, word2, wad);
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
// This is not a major mod.
|
||||
}
|
||||
else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
|
||||
@@ -2906,7 +3039,13 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Thing %d out of range (0 - %d)", i, NUMMOBJTYPES-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
/* else if (fastcmp(word, "ANIMTEX"))
|
||||
{
|
||||
readAnimTex(f, i);
|
||||
// This is not a major mod.
|
||||
}*/
|
||||
else if (fastcmp(word, "LEVEL"))
|
||||
{
|
||||
// Support using the actual map name,
|
||||
@@ -2927,6 +3066,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Level number %d out of range (1 - %d)", i, NUMMAPS);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "CUTSCENE"))
|
||||
{
|
||||
@@ -2937,6 +3077,8 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Cutscene number %d out of range (1 - 128)", i);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
//G_SetGameModified(multiplayer, true); -- might have to reconsider in a future update
|
||||
}
|
||||
else if (fastcmp(word, "FRAME") || fastcmp(word, "STATE"))
|
||||
{
|
||||
@@ -2953,6 +3095,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Frame %d out of range (0 - %d)", i, NUMSTATES-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "SOUND"))
|
||||
{
|
||||
@@ -2965,6 +3108,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Sound %d out of range (0 - %d)", i, NUMSFX-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
// This is not a major mod.
|
||||
}
|
||||
else if (fastcmp(word, "HUDITEM"))
|
||||
@@ -2978,6 +3122,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("HUD item number %d out of range (0 - %d)", i, NUMHUDITEMS-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
// This is not a major mod.
|
||||
}
|
||||
else if (fastcmp(word, "EMBLEM"))
|
||||
@@ -2998,6 +3143,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Emblem number %d out of range (1 - %d)", i, MAXEMBLEMS);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "EXTRAEMBLEM"))
|
||||
{
|
||||
@@ -3017,6 +3163,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Extra emblem number %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "UNLOCKABLE"))
|
||||
{
|
||||
@@ -3032,6 +3179,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Unlockable number %d out of range (1 - %d)", i, MAXUNLOCKABLES);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "CONDITIONSET"))
|
||||
{
|
||||
@@ -3047,12 +3195,15 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
deh_warning("Condition set number %d out of range (1 - %d)", i, MAXCONDITIONSETS);
|
||||
ignorelines(f);
|
||||
}
|
||||
// no undo support for this insanity yet
|
||||
//DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "SRB2KART"))
|
||||
{
|
||||
INT32 ver = searchvalue(strtok(NULL, "\n"));
|
||||
if (ver != PATCHVERSION)
|
||||
deh_warning("Patch is for SRB2Kart version %d,\nonly version %d is supported", ver, PATCHVERSION);
|
||||
//DEH_WriteUndoline(word, va("%d", ver), UNDO_NONE);
|
||||
}
|
||||
else if (fastcmp(word, "SRB2"))
|
||||
{
|
||||
@@ -3131,6 +3282,7 @@ void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump)
|
||||
f.curpos = f.data;
|
||||
f.data[f.size] = 0;
|
||||
DEH_LoadDehackedFile(&f, wad);
|
||||
DEH_WriteUndoline(va("# uload for wad: %u, lump: %u", wad, lump), NULL, UNDO_DONE);
|
||||
Z_Free(f.data);
|
||||
}
|
||||
|
||||
@@ -8978,15 +9130,12 @@ int LUA_EnumLib(lua_State *L)
|
||||
char *str = NULL;
|
||||
int size = 0;
|
||||
|
||||
// Sound enum tables preallocated for sfx_freeslot0 elements because using NUMSFX may be too
|
||||
// much if number of skins increased a lot (because of skinsound freeslots)
|
||||
|
||||
/* SFX (SFX_) */
|
||||
lua_pushcfunction(L, lua_glib_new_enum);
|
||||
lua_createtable(L, 0, sfx_freeslot0);
|
||||
lua_createtable(L, 0, NUMSFX);
|
||||
for (int i = 0; i < NUMSFX; i++)
|
||||
{
|
||||
if (!S_sfx[i].name || !S_sfx[i].priority) continue;
|
||||
if (!S_sfx[i].name) continue;
|
||||
|
||||
if (lua_enumlib_sprintf_upper(&str, &size, "SFX_%s", S_sfx[i].name) == NULL)
|
||||
return luaL_error(L, "Ran out of memory.");
|
||||
@@ -9001,10 +9150,10 @@ int LUA_EnumLib(lua_State *L)
|
||||
|
||||
/* SFX (DS) */
|
||||
lua_pushcfunction(L, lua_glib_new_enum);
|
||||
lua_createtable(L, 0, sfx_freeslot0);
|
||||
lua_createtable(L, 0, NUMSFX);
|
||||
for (int i = 0; i < NUMSFX; i++)
|
||||
{
|
||||
if (!S_sfx[i].name || !S_sfx[i].priority) continue;
|
||||
if (!S_sfx[i].name) continue;
|
||||
|
||||
if (lua_enumlib_sprintf_upper(&str, &size, "DS%s", S_sfx[i].name) == NULL)
|
||||
return luaL_error(L, "Ran out of memory.");
|
||||
@@ -9039,10 +9188,10 @@ int LUA_EnumLib(lua_State *L)
|
||||
{
|
||||
/* SFX (sfx_) */
|
||||
lua_pushcfunction(L, lua_glib_new_enum);
|
||||
lua_createtable(L, 0, sfx_freeslot0);
|
||||
lua_createtable(L, 0, NUMSFX);
|
||||
for (int i = 0; i < NUMSFX; i++)
|
||||
{
|
||||
if (!S_sfx[i].name || !S_sfx[i].priority) continue;
|
||||
if (!S_sfx[i].name) continue;
|
||||
|
||||
lua_pushfstring(L, "sfx_%s", S_sfx[i].name);
|
||||
lua_pushinteger(L, i);
|
||||
@@ -9216,11 +9365,6 @@ int LUA_EnumLib(lua_State *L)
|
||||
lua_glib_push_bool_getter(L, &demo.playback);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "replayfreecam");
|
||||
lua_glib_push_bool_getter(L, &demo.freecam);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
if (!mathlib)
|
||||
{
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
@@ -9278,13 +9422,4 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum actionnum LUA_GetActionNumByName(const char *actiontocompare)
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; actionpointers[z].name; z++)
|
||||
if (fasticmp(actiontocompare, actionpointers[z].name))
|
||||
return z;
|
||||
return z;
|
||||
}
|
||||
}
|
||||
+14
-1
@@ -15,6 +15,20 @@
|
||||
|
||||
#include "m_fixed.h" // for get_number
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UNDO_NONE = 0x00,
|
||||
UNDO_NEWLINE = 0x01,
|
||||
UNDO_SPACE = 0x02,
|
||||
UNDO_CUTLINE = 0x04,
|
||||
UNDO_HEADER = 0x07,
|
||||
UNDO_ENDTEXT = 0x08,
|
||||
UNDO_TODO = 0,
|
||||
UNDO_DONE = 0,
|
||||
} undotype_f;
|
||||
|
||||
#define DEH_WriteUndoline(a,b,c)
|
||||
|
||||
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
||||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
|
||||
|
||||
@@ -27,7 +41,6 @@ fixed_t get_number(const char *word);
|
||||
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
|
||||
const char *LUA_GetActionName(void *action);
|
||||
void LUA_SetActionByName(void *state, const char *actiontocompare);
|
||||
enum actionnum LUA_GetActionNumByName(const char *actiontocompare);
|
||||
|
||||
extern boolean deh_loaded;
|
||||
|
||||
|
||||
+8
-36
@@ -127,8 +127,13 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v7.1"
|
||||
#define VERSIONSTRINGW L"Saturn v7.1"
|
||||
#ifndef USE_FBO_OGL
|
||||
#define VERSIONSTRING "Saturn v6.2 "
|
||||
#define VERSIONSTRINGW L"Saturn v6.2"
|
||||
#else
|
||||
#define VERSIONSTRING "Saturn v6.2 - FBO "
|
||||
#define VERSIONSTRINGW L"Saturn v6.2 - FBO"
|
||||
#endif
|
||||
// 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!
|
||||
@@ -206,7 +211,6 @@ extern char logfilename[1024];
|
||||
|
||||
#define MAXPLAYERS 16
|
||||
#define MAXSKINS 255
|
||||
#define MAXLOCALSKINS 32
|
||||
#define PLAYERSMASK (MAXPLAYERS-1)
|
||||
#define MAXPLAYERNAME 21
|
||||
|
||||
@@ -469,12 +473,7 @@ void M_StartupLocale(void);
|
||||
// M_GetText function that just returns the string.
|
||||
#define M_GetText(x) (x)
|
||||
#endif
|
||||
|
||||
FUNCINLINE static ATTRINLINE void *M_Memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
void *M_Memcpy(void* dest, const void* src, size_t n);
|
||||
char *va(const char *format, ...) FUNCPRINTF;
|
||||
char *M_GetToken(const char *inputString);
|
||||
char *sizeu1(size_t num);
|
||||
@@ -529,10 +528,6 @@ INT32 I_GetKey(void);
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, min_val, max_val) ((x) < (min_val) ? (min_val) : ((x) > (max_val) ? (max_val) : (x)))
|
||||
#endif
|
||||
|
||||
#ifndef M_PIl
|
||||
#define M_PIl 3.1415926535897932384626433832795029L
|
||||
#endif
|
||||
@@ -568,29 +563,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
||||
// Compile them at your own risk!
|
||||
|
||||
#ifndef NONET
|
||||
//-- SATURN __
|
||||
/// Enable gamestate resynching between Saturn servers and clients
|
||||
/// Like SRB2 and RR does
|
||||
/// Still highly experimental
|
||||
#ifdef DOSATURNSYNCH
|
||||
#define SATURNSYNCH
|
||||
|
||||
/// Detect if a client is on Saturn in the clientconfig.
|
||||
/// To seperately allow them to join or block joining from vanilla clients.
|
||||
#ifdef DOSATURNJOIN
|
||||
#define SATURNJOIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// Server detection for if a connecting client is on Saturn.
|
||||
/// For stuff like extra synching, etc.
|
||||
#ifdef DOSATURNPAK
|
||||
#define SATURNPAK
|
||||
#endif
|
||||
//-- <( ̄︶ ̄)> __
|
||||
#endif
|
||||
|
||||
/// Undefine to use the new method of Gamma correction see colour cube in v_video.c
|
||||
#define BACKWARDSCOMPATCORRECTION
|
||||
|
||||
|
||||
+1
-13
@@ -192,7 +192,7 @@ extern struct quake
|
||||
// camera offsets and duration
|
||||
fixed_t x,y,z;
|
||||
angle_t roll;
|
||||
tic_t time;
|
||||
UINT16 time;
|
||||
|
||||
// location, radius, and intensity...
|
||||
mappoint_t *epicenter;
|
||||
@@ -510,18 +510,6 @@ extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
|
||||
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
|
||||
extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
|
||||
|
||||
#define WAYPOINTSEQUENCESIZE 256
|
||||
#define NUMWAYPOINTSEQUENCES 256
|
||||
extern mobj_t *waypoints[NUMWAYPOINTSEQUENCES][WAYPOINTSEQUENCESIZE];
|
||||
extern UINT16 numwaypoints[NUMWAYPOINTSEQUENCES];
|
||||
|
||||
void P_AddWaypoint(UINT8 sequence, UINT8 id, mobj_t *waypoint);
|
||||
mobj_t *P_GetFirstWaypoint(UINT8 sequence);
|
||||
mobj_t *P_GetLastWaypoint(UINT8 sequence);
|
||||
mobj_t *P_GetPreviousWaypoint(mobj_t *current, boolean wrap);
|
||||
mobj_t *P_GetNextWaypoint(mobj_t *current, boolean wrap);
|
||||
mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo);
|
||||
|
||||
// =====================================
|
||||
// Internal parameters, used for engine.
|
||||
// =====================================
|
||||
|
||||
+5
-5
@@ -170,8 +170,8 @@ static void F_SkyScroll(INT32 scrollspeed)
|
||||
w = (vid.width / vid.dupx)<<FRACBITS;
|
||||
|
||||
// The scroll offset MUST be clamped before shifting by FRACBITS, or else it'll overflow in about 3 minutes
|
||||
animtimer = ((((finalecount * scrollspeed) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
|
||||
anim2 = (SHORT(pat2->width)<<FRACBITS) - ((((finalecount * scrollspeed) % (SHORT(pat2->width)*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
|
||||
animtimer = ((((finalecount * scrollspeed) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
|
||||
anim2 = (SHORT(pat2->width)<<FRACBITS) - ((((finalecount * scrollspeed) % (SHORT(pat2->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
|
||||
|
||||
// SRB2Kart: F_DrawPatchCol is over-engineered; recoded to be less shitty and error-prone
|
||||
if (rendermode != render_none)
|
||||
@@ -996,7 +996,7 @@ void F_TitleScreenDrawer(void)
|
||||
if (finalecount >= 20)
|
||||
V_DrawSmallScaledPatch(84, 87, 0, ttkart);
|
||||
else if (finalecount >= 10)
|
||||
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetMenuUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
|
||||
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetHudUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
|
||||
}
|
||||
else if (finalecount < 52)
|
||||
{
|
||||
@@ -1012,8 +1012,8 @@ void F_TitleScreenDrawer(void)
|
||||
|
||||
F_SkyScroll(titlescrollspeed);
|
||||
|
||||
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetMenuUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
|
||||
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetMenuUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
|
||||
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
|
||||
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
|
||||
|
||||
if (transval)
|
||||
V_DrawFadeScreen(120, 10 - transval);
|
||||
|
||||
+11
-9
@@ -37,6 +37,7 @@
|
||||
#include <tchar.h>
|
||||
|
||||
#define SUFFIX "*"
|
||||
#define SLASH "\\"
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
|
||||
#ifndef INVALID_FILE_ATTRIBUTES
|
||||
@@ -134,7 +135,7 @@ opendir (const CHAR *szPath)
|
||||
/* Allocate enough space to store DIR structure and the complete
|
||||
* directory path given. */
|
||||
nd = (DIR *) malloc (sizeof (DIR) + (strlen(szFullPath) + strlen (SLASH) +
|
||||
strlen(PATHSEP) + 1) * sizeof (CHAR));
|
||||
strlen(SUFFIX) + 1) * sizeof (CHAR));
|
||||
|
||||
if (!nd)
|
||||
{
|
||||
@@ -148,9 +149,10 @@ opendir (const CHAR *szPath)
|
||||
|
||||
/* Add on a slash if the path does not end with one. */
|
||||
if (nd->dd_name[0] != '\0' &&
|
||||
nd->dd_name[strlen (nd->dd_name) - 1] != PATHSEP[0])
|
||||
nd->dd_name[strlen (nd->dd_name) - 1] != '/' &&
|
||||
nd->dd_name[strlen (nd->dd_name) - 1] != '\\')
|
||||
{
|
||||
strcat (nd->dd_name, PATHSEP);
|
||||
strcat (nd->dd_name, SLASH);
|
||||
}
|
||||
|
||||
/* Add on the search pattern */
|
||||
@@ -380,9 +382,9 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||
return FS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (searchpath[searchpathindex[depthleft]-2] != PATHSEP[0])
|
||||
if (searchpath[searchpathindex[depthleft]-2] != '/')
|
||||
{
|
||||
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
||||
searchpath[searchpathindex[depthleft]-1] = '/';
|
||||
searchpath[searchpathindex[depthleft]] = 0;
|
||||
}
|
||||
else
|
||||
@@ -390,7 +392,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||
|
||||
while ((!found) && (depthleft < maxsearchdepth))
|
||||
{
|
||||
searchpath[searchpathindex[depthleft]] = 0;
|
||||
searchpath[searchpathindex[depthleft]]=0;
|
||||
dent = readdir(dirhandle[depthleft]);
|
||||
|
||||
if (!dent)
|
||||
@@ -417,7 +419,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||
if (S_ISDIR(fsstat.st_mode))
|
||||
dent->d_type = DT_DIR;
|
||||
else if (S_ISLNK(fsstat.st_mode))
|
||||
dent->d_type = DT_LNK;
|
||||
dent->d_type = DT_LNK;
|
||||
}
|
||||
|
||||
// Symlinks aren't always directory symlinks. Dunno if this would resolve recursive
|
||||
@@ -445,8 +447,8 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||
depthleft++;
|
||||
}
|
||||
|
||||
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
||||
searchpath[searchpathindex[depthleft]] = 0;
|
||||
searchpath[searchpathindex[depthleft]-1]='/';
|
||||
searchpath[searchpathindex[depthleft]]=0;
|
||||
}
|
||||
else if (!strcasecmp(searchname, dent->d_name))
|
||||
{
|
||||
|
||||
+245
-172
@@ -50,7 +50,6 @@
|
||||
#include "b_bot.h"
|
||||
#include "m_cond.h" // condition sets
|
||||
#include "md5.h" // demo checksums
|
||||
#include "k_director.h" // SRB2kart
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "r_fps.h" // frame interpolation/uncapped
|
||||
|
||||
@@ -336,11 +335,6 @@ boolean precache = true; // if true, load all graphics at start
|
||||
|
||||
INT16 prevmap, nextmap;
|
||||
|
||||
// save if director is enabled
|
||||
// so demos can disable it by default and restore it after
|
||||
static int directorstate = 0;
|
||||
tic_t directortoggletimer = 0;
|
||||
|
||||
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}};
|
||||
consvar_t cv_recordmultiplayerdemos = {"netdemo_record", "Manual Save", CV_SAVE, recordmultiplayerdemos_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -351,12 +345,13 @@ consvar_t cv_netdemosyncquality = {"netdemo_syncquality", "1", CV_SAVE, netdemos
|
||||
static CV_PossibleValue_t maxdemosize_cons_t[] = {{10, "MIN"}, {100, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_maxdemosize = {"maxdemosize", "10", CV_SAVE, maxdemosize_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t demochangemap_cons_t[] = {{0, "Disabled"}, {1, "Diff Map"}, {2, "Always"}, {0, NULL}};
|
||||
consvar_t cv_demochangemap = {"netdemo_savemapchange", "Disabled", CV_SAVE, demochangemap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static UINT8 *savebuffer;
|
||||
|
||||
// Analog Control
|
||||
static void UserAnalog_OnChange(void);
|
||||
static void UserAnalog2_OnChange(void);
|
||||
static void UserAnalog3_OnChange(void);
|
||||
static void UserAnalog4_OnChange(void);
|
||||
static void Analog_OnChange(void);
|
||||
static void Analog2_OnChange(void);
|
||||
static void Analog3_OnChange(void);
|
||||
@@ -422,9 +417,8 @@ consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NUL
|
||||
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// We can disable special tunes!
|
||||
static CV_PossibleValue_t powermusic_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "SFX"}, {0, NULL}};
|
||||
consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
/*consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_crosshair2 = {"crosshair2", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -442,10 +436,10 @@ consvar_t cv_analog = {"analog", "Off", CV_CALL, CV_OnOff, Analog_OnChange, 0, N
|
||||
consvar_t cv_analog2 = {"analog2", "Off", CV_CALL, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_analog3 = {"analog3", "Off", CV_CALL, CV_OnOff, Analog3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_analog4 = {"analog4", "Off", CV_CALL, CV_OnOff, Analog4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog = {"useranalog", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog2 = {"useranalog2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog3 = {"useranalog3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog4 = {"useranalog4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog = {"useranalog", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog2 = {"useranalog2", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog3 = {"useranalog3", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_useranalog4 = {"useranalog4", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_turnaxis = {"joyaxis_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -507,8 +501,8 @@ static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}
|
||||
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t stretchfactor_t[] = {
|
||||
{0, "Off"}, {FRACUNIT/8, "0.125"}, {FRACUNIT/4, "0.250"},
|
||||
{3*FRACUNIT/8, "0.375"}, {FRACUNIT/2, "0.500"}, {5*FRACUNIT/8, "0.625"},
|
||||
{0, "Off"}, {FRACUNIT/8, "0.125"}, {FRACUNIT/4, "0.250"},
|
||||
{3*FRACUNIT/8, "0.375"}, {FRACUNIT/2, "0.500"}, {5*FRACUNIT/8, "0.625"},
|
||||
{3*FRACUNIT/4, "0.750"}, {7*FRACUNIT/8, "0.875"}, {FRACUNIT, "Max"}, {0, NULL}};
|
||||
consvar_t cv_gravstretch = {"gravstretch", "0", CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -592,6 +586,15 @@ void G_ClearRecords(void)
|
||||
}
|
||||
}
|
||||
|
||||
// For easy retrieval of records
|
||||
/*UINT32 G_GetBestScore(INT16 map)
|
||||
{
|
||||
if (!mainrecords[map-1])
|
||||
return 0;
|
||||
|
||||
return mainrecords[map-1]->score;
|
||||
}*/
|
||||
|
||||
tic_t G_GetBestTime(INT16 map)
|
||||
{
|
||||
if (!mainrecords[map-1] || mainrecords[map-1]->time <= 0)
|
||||
@@ -967,7 +970,7 @@ static INT32 Joy3Axis(axis_input_e axissel)
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -987,7 +990,7 @@ static INT32 Joy3Axis(axis_input_e axissel)
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,7 +1065,7 @@ static INT32 Joy4Axis(axis_input_e axissel)
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1082,7 +1085,7 @@ static INT32 Joy4Axis(axis_input_e axissel)
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1496,11 +1499,61 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
|
||||
}
|
||||
|
||||
// User has designated that they want
|
||||
// analog ON, so tell the game to stop
|
||||
// fudging with it.
|
||||
static void UserAnalog_OnChange(void)
|
||||
{
|
||||
/*if (cv_useranalog.value)
|
||||
CV_SetValue(&cv_analog, 1);
|
||||
else
|
||||
CV_SetValue(&cv_analog, 0);*/
|
||||
}
|
||||
|
||||
static void UserAnalog2_OnChange(void)
|
||||
{
|
||||
if (botingame)
|
||||
return;
|
||||
/*if (cv_useranalog2.value)
|
||||
CV_SetValue(&cv_analog2, 1);
|
||||
else
|
||||
CV_SetValue(&cv_analog2, 0);*/
|
||||
}
|
||||
|
||||
static void UserAnalog3_OnChange(void)
|
||||
{
|
||||
if (botingame)
|
||||
return;
|
||||
/*if (cv_useranalog3.value)
|
||||
CV_SetValue(&cv_analog3, 1);
|
||||
else
|
||||
CV_SetValue(&cv_analog3, 0);*/
|
||||
}
|
||||
|
||||
static void UserAnalog4_OnChange(void)
|
||||
{
|
||||
if (botingame)
|
||||
return;
|
||||
/*if (cv_useranalog4.value)
|
||||
CV_SetValue(&cv_analog4, 1);
|
||||
else
|
||||
CV_SetValue(&cv_analog4, 0);*/
|
||||
}
|
||||
|
||||
static void Analog_OnChange(void)
|
||||
{
|
||||
if (!cv_cam_dist.string)
|
||||
return;
|
||||
|
||||
// cameras are not initialized at this point
|
||||
|
||||
/*
|
||||
if (!cv_chasecam.value && cv_analog.value) {
|
||||
CV_SetValue(&cv_analog, 0);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
SendWeaponPref();
|
||||
}
|
||||
|
||||
@@ -1509,6 +1562,15 @@ static void Analog2_OnChange(void)
|
||||
if (!(splitscreen || botingame) || !cv_cam2_dist.string)
|
||||
return;
|
||||
|
||||
// cameras are not initialized at this point
|
||||
|
||||
/*
|
||||
if (!cv_chasecam2.value && cv_analog2.value) {
|
||||
CV_SetValue(&cv_analog2, 0);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
SendWeaponPref2();
|
||||
}
|
||||
|
||||
@@ -1517,6 +1579,15 @@ static void Analog3_OnChange(void)
|
||||
if (splitscreen < 2 || !cv_cam3_dist.string)
|
||||
return;
|
||||
|
||||
// cameras are not initialized at this point
|
||||
|
||||
/*
|
||||
if (!cv_chasecam3.value && cv_analog3.value) {
|
||||
CV_SetValue(&cv_analog3, 0);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
SendWeaponPref3();
|
||||
}
|
||||
|
||||
@@ -1525,6 +1596,15 @@ static void Analog4_OnChange(void)
|
||||
if (splitscreen < 3 || !cv_cam4_dist.string)
|
||||
return;
|
||||
|
||||
// cameras are not initialized at this point
|
||||
|
||||
/*
|
||||
if (!cv_chasecam4.value && cv_analog4.value) {
|
||||
CV_SetValue(&cv_analog4, 0);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
SendWeaponPref4();
|
||||
}
|
||||
|
||||
@@ -1557,7 +1637,7 @@ void G_DoLoadLevel(boolean resetplayer)
|
||||
}
|
||||
|
||||
// Setup the level.
|
||||
if (!P_SetupLevel(false,false))
|
||||
if (!P_SetupLevel(false))
|
||||
{
|
||||
// fail so reset game stuff
|
||||
Command_ExitGame_f();
|
||||
@@ -1600,8 +1680,6 @@ void G_DoLoadLevel(boolean resetplayer)
|
||||
|
||||
// clear hud messages remains (usually from game startup)
|
||||
CON_ClearHUD();
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
}
|
||||
|
||||
static INT32 pausedelay = 0;
|
||||
@@ -1856,11 +1934,6 @@ boolean G_Responder(event_t *ev)
|
||||
COM_ImmedExecute("changeteam4 spectator");
|
||||
}
|
||||
}
|
||||
if (ev->data1 == gamecontrol[gc_director][0]
|
||||
|| ev->data1 == gamecontrol[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1991,29 +2064,6 @@ INT32 G_CountPlayersPotentiallyViewable(boolean active)
|
||||
return total;
|
||||
}
|
||||
|
||||
//
|
||||
// G_FixCamera
|
||||
// Reset camera position, angle and interpolation on a view
|
||||
// after changing state.
|
||||
//
|
||||
static void G_FixCamera(UINT8 view)
|
||||
{
|
||||
player_t *player = &players[displayplayers[view - 1]];
|
||||
|
||||
// The order of displayplayers can change, which would
|
||||
// invalidate localangle.
|
||||
localangle[view - 1] = player->cmd.angleturn;
|
||||
|
||||
P_ResetCamera(player, &camera[view - 1]);
|
||||
|
||||
// Make sure the viewport doesn't interpolate at all into
|
||||
// its new position -- just snap instantly into place.
|
||||
|
||||
// Why does it need to be done twice?
|
||||
R_ResetViewInterpolation(view);
|
||||
R_ResetViewInterpolation(view);
|
||||
}
|
||||
|
||||
//
|
||||
// G_ResetView
|
||||
// Correct a viewpoint to playernum or the next available, wraps forward.
|
||||
@@ -2026,6 +2076,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||
UINT8 viewd;
|
||||
|
||||
INT32 *displayplayerp;
|
||||
camera_t *camerap;
|
||||
|
||||
INT32 olddisplayplayer;
|
||||
INT32 playersviewable;
|
||||
@@ -2057,25 +2108,29 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||
olddisplayplayer = (*displayplayerp);
|
||||
|
||||
/* Check if anyone is available to view. */
|
||||
if ((playernum = G_FindView(playernum, viewnum, onlyactive, playernum < olddisplayplayer)) == -1)
|
||||
if (( playernum = G_FindView(playernum, viewnum, onlyactive, playernum < olddisplayplayer) ) == -1)
|
||||
return;
|
||||
|
||||
/* Focus our target view first so that we don't take its player. */
|
||||
(*displayplayerp) = playernum;
|
||||
if ((*displayplayerp) != olddisplayplayer)
|
||||
{
|
||||
camerap = &camera[viewnum-1];
|
||||
P_ResetCamera(&players[(*displayplayerp)], camerap);
|
||||
|
||||
R_ResetViewInterpolation(viewnum);
|
||||
}
|
||||
|
||||
/* If a viewpoint changes, reset the camera to clear uninitialized memory. */
|
||||
if (viewnum > splits)
|
||||
{
|
||||
for (viewd = splits+1; viewd <= viewnum; ++viewd)
|
||||
for (viewd = splits+1; viewd < viewnum; ++viewd)
|
||||
{
|
||||
G_FixCamera(viewd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*displayplayerp) != olddisplayplayer)
|
||||
{
|
||||
G_FixCamera(viewnum);
|
||||
displayplayerp = (&displayplayers[viewd-1]);
|
||||
camerap = &camera[viewd];
|
||||
|
||||
(*displayplayerp) = G_FindView(0, viewd, onlyactive, false);
|
||||
|
||||
P_ResetCamera(&players[(*displayplayerp)], camerap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2157,6 +2212,13 @@ void G_Ticker(boolean run)
|
||||
if (!(netgame || multiplayer) && G_GetRetryFlag())
|
||||
{
|
||||
G_ClearRetryFlag();
|
||||
|
||||
// Costs a life to retry ... unless the player in question is dead already.
|
||||
/*if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE)
|
||||
players[consoleplayer].lives -= 1;
|
||||
|
||||
G_DoReborn(consoleplayer);*/
|
||||
|
||||
D_MapChange(gamemap, gametype, cv_kartencore.value, true, 1, false, false);
|
||||
}
|
||||
|
||||
@@ -2182,14 +2244,13 @@ void G_Ticker(boolean run)
|
||||
buf = gametic % TICQUEUE;
|
||||
|
||||
if (!demo.playback)
|
||||
// read/write demo and check turbo cheat
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++) // read/write demo and check turbo cheat
|
||||
cmd = &players[i].cmd;
|
||||
|
||||
if (playeringame[i])
|
||||
{
|
||||
cmd = &players[i].cmd;
|
||||
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
//@TODO all this throwdir stuff shouldn't be here! But it stays for now to maintain 1.0.4 compat...
|
||||
// Remove for 1.1!
|
||||
|
||||
@@ -2424,10 +2485,6 @@ void G_PlayerReborn(INT32 player)
|
||||
boolean fade;
|
||||
boolean playing;
|
||||
|
||||
tic_t laptime[LAP__MAX];
|
||||
|
||||
INT32 i;
|
||||
|
||||
score = players[player].score;
|
||||
marescore = players[player].marescore;
|
||||
lives = players[player].lives;
|
||||
@@ -2489,11 +2546,6 @@ void G_PlayerReborn(INT32 player)
|
||||
starpostnum = 0;
|
||||
respawnflip = 0;
|
||||
starpostangle = 0;
|
||||
|
||||
for (i = 0; i < LAP__MAX; i++)
|
||||
{
|
||||
laptime[i] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2522,11 +2574,6 @@ void G_PlayerReborn(INT32 player)
|
||||
bumper = players[player].kartstuff[k_bumper];
|
||||
comebackpoints = players[player].kartstuff[k_comebackpoints];
|
||||
wanted = players[player].kartstuff[k_wanted];
|
||||
|
||||
for (i = 0; i < LAP__MAX; i++)
|
||||
{
|
||||
laptime[i] = players[player].laptime[i];
|
||||
}
|
||||
}
|
||||
|
||||
spectatorreentry = players[player].spectatorreentry;
|
||||
@@ -2570,11 +2617,6 @@ void G_PlayerReborn(INT32 player)
|
||||
p->laps = laps;
|
||||
p->totalring = totalring;
|
||||
|
||||
for (i = 0; i < LAP__MAX; i++)
|
||||
{
|
||||
p->laptime[i] = laptime[i];
|
||||
}
|
||||
|
||||
p->mare = mare;
|
||||
if (bot)
|
||||
p->bot = 1; // reset to AI-controlled
|
||||
@@ -2624,7 +2666,8 @@ void G_PlayerReborn(INT32 player)
|
||||
}
|
||||
|
||||
/* I'm putting this here because lol */
|
||||
fade = (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(p));
|
||||
|
||||
fade = (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(p));
|
||||
|
||||
if (fade)
|
||||
{
|
||||
@@ -2634,7 +2677,7 @@ void G_PlayerReborn(INT32 player)
|
||||
Fade it in with the same call to avoid
|
||||
max volume for a few milliseconds (?).
|
||||
*/
|
||||
if (!playing)
|
||||
if (! playing)
|
||||
S_SetRestoreMusicFadeInCvar(&cv_respawnfademusicback);
|
||||
}
|
||||
|
||||
@@ -2990,6 +3033,12 @@ void G_DoReborn(INT32 playernum)
|
||||
player_t *player = &players[playernum];
|
||||
boolean starpost = false;
|
||||
|
||||
/*if (modeattacking) // Not needed for SRB2Kart.
|
||||
{
|
||||
M_EndModeAttackRun();
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Make sure objectplace is OFF when you first start the level!
|
||||
OP_ResetObjectplace();
|
||||
|
||||
@@ -3009,6 +3058,68 @@ void G_DoReborn(INT32 playernum)
|
||||
if (oldmo)
|
||||
G_ChangePlayerReferences(oldmo, players[playernum].mo);
|
||||
}
|
||||
/*else if (countdowntimeup || (!multiplayer && !modeattacking))
|
||||
{
|
||||
// reload the level from scratch
|
||||
if (countdowntimeup)
|
||||
{
|
||||
player->starpostangle = 0;
|
||||
player->starposttime = 0;
|
||||
player->starpostx = 0;
|
||||
player->starposty = 0;
|
||||
player->starpostz = 0;
|
||||
player->starpostnum = 0;
|
||||
}
|
||||
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
player->playerstate = PST_REBORN;
|
||||
|
||||
P_LoadThingsOnly();
|
||||
|
||||
// Do a wipe
|
||||
wipegamestate = -1;
|
||||
|
||||
if (player->starpostnum) // SRB2kart
|
||||
starpost = true;
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (camera[i].chase)
|
||||
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
|
||||
}
|
||||
|
||||
// clear cmd building stuff
|
||||
memset(gamekeydown, 0, sizeof (gamekeydown));
|
||||
for (i = 0;i < JOYAXISSET; i++)
|
||||
{
|
||||
joyxmove[i] = joyymove[i] = 0;
|
||||
joy2xmove[i] = joy2ymove[i] = 0;
|
||||
joy3xmove[i] = joy3ymove[i] = 0;
|
||||
joy4xmove[i] = joy4ymove[i] = 0;
|
||||
}
|
||||
mousex = mousey = 0;
|
||||
mouse2x = mouse2y = 0;
|
||||
|
||||
// clear hud messages remains (usually from game startup)
|
||||
CON_ClearHUD();
|
||||
|
||||
// Starpost support
|
||||
G_SpawnPlayer(playernum, starpost);
|
||||
|
||||
if (botingame)
|
||||
{ // Bots respawn next to their master.
|
||||
players[displayplayers[1]].playerstate = PST_REBORN;
|
||||
G_SpawnPlayer(displayplayers[1], false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LUAh_MapChange(gamemap);
|
||||
G_DoLoadLevel(true);
|
||||
}
|
||||
}*/
|
||||
else
|
||||
{
|
||||
// respawn at the start
|
||||
@@ -3045,8 +3156,6 @@ void G_AddPlayer(INT32 playernum)
|
||||
|
||||
void G_ExitLevel(void)
|
||||
{
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
gameaction = ga_completed;
|
||||
@@ -3075,6 +3184,13 @@ const char *Gametype_Names[NUMGAMETYPES] =
|
||||
{
|
||||
"Race", // GT_RACE
|
||||
"Battle" // GT_MATCH
|
||||
|
||||
/*"Co-op", // GT_COOP
|
||||
"Competition", // GT_COMPETITION
|
||||
"Team Match", // GT_TEAMMATCH
|
||||
"Tag", // GT_TAG
|
||||
"Hide and Seek", // GT_HIDEANDSEEK
|
||||
"CTF" // GT_CTF*/
|
||||
};
|
||||
|
||||
//
|
||||
@@ -3136,7 +3252,12 @@ boolean G_GametypeHasTeams(void)
|
||||
//
|
||||
boolean G_GametypeHasSpectators(void)
|
||||
{
|
||||
// SRB2Kart: We don't have any exceptions to not being able to spectate yet. Maybe when SP & bots roll around.
|
||||
#if 0
|
||||
return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE);
|
||||
#else
|
||||
return (netgame || (multiplayer && demo.playback)); //true
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -4171,11 +4292,14 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
|
||||
Z_Free(savebuffer);
|
||||
save_p = savebuffer = NULL;
|
||||
|
||||
// gameaction = ga_nothing;
|
||||
// G_SetGamestate(GS_LEVEL);
|
||||
displayplayers[0] = consoleplayer;
|
||||
multiplayer = false;
|
||||
splitscreen = 0;
|
||||
SplitScreen_OnChange(); // not needed?
|
||||
|
||||
// G_DeferedInitNew(sk_medium, G_BuildMapName(1), 0, 0, 1);
|
||||
if (setsizeneeded)
|
||||
R_ExecuteSetViewSize();
|
||||
|
||||
@@ -4322,11 +4446,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
||||
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
|
||||
players[i].lives = 1; // SRB2Kart
|
||||
|
||||
// This should be cleared in P_SpawnPlayer but address sanitizer says "use-after-free"
|
||||
// when reloading map sometimes
|
||||
players[i].awayviewtics = 0;
|
||||
players[i].awayviewmobj = NULL;
|
||||
|
||||
// The latter two should clear by themselves, but just in case
|
||||
players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
|
||||
|
||||
@@ -4380,7 +4499,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
||||
else
|
||||
{
|
||||
LUAh_MapChange(gamemap);
|
||||
S_CheckMap();
|
||||
G_DoLoadLevel(resetplayer);
|
||||
}
|
||||
|
||||
@@ -4634,8 +4752,6 @@ INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
|
||||
{
|
||||
if (mapname[0] == '*') // current map
|
||||
return gamemap;
|
||||
else if (mapname[0] == '?')
|
||||
return G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, false, NULL);
|
||||
else if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map
|
||||
{
|
||||
newmapnum = mapheaderinfo[gamemap-1]->nextlevel;
|
||||
@@ -6387,18 +6503,8 @@ void G_BeginRecording(void)
|
||||
// Full replay title
|
||||
demo_p += 64;
|
||||
{
|
||||
char demotitlename[65];
|
||||
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);
|
||||
|
||||
// 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);
|
||||
|
||||
snprintf(demo.titlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
|
||||
Z_Free(title);
|
||||
}
|
||||
|
||||
@@ -7055,57 +7161,6 @@ void G_LoadDemoInfo(menudemo_t *pdemo)
|
||||
Z_Free(infobuffer);
|
||||
}
|
||||
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
{
|
||||
UINT8 infobuffer[96], *info_p;
|
||||
UINT16 pdemoversion;
|
||||
size_t count;
|
||||
|
||||
FILE *handle = fopen(pdemo->filepath, "rb");
|
||||
|
||||
if (!handle)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Failed to read file '%s'.\n"), pdemo->filepath);
|
||||
sprintf(pdemo->title, "INVALID REPLAY");
|
||||
return;
|
||||
}
|
||||
|
||||
count = fread(infobuffer, 1, 96, handle);
|
||||
fclose(handle);
|
||||
info_p = infobuffer;
|
||||
|
||||
// First check isn't too accurate technically, but well, valid replays should be larger than that anyway
|
||||
if (count < 96 || memcmp(info_p, DEMOHEADER, 12))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemo->filepath);
|
||||
sprintf(pdemo->title, "INVALID REPLAY");
|
||||
return;
|
||||
}
|
||||
|
||||
info_p += 12; // DEMOHEADER
|
||||
|
||||
READUINT8(info_p);
|
||||
READUINT8(info_p);
|
||||
pdemoversion = READUINT16(info_p);
|
||||
|
||||
switch(pdemoversion)
|
||||
{
|
||||
case DEMOVERSION: // latest always supported
|
||||
// demo title
|
||||
M_Memcpy(pdemo->title, info_p, 64);
|
||||
break;
|
||||
#ifdef DEMO_COMPAT_100
|
||||
case 0x0001:
|
||||
sprintf(pdemo->title, "Legacy Replay");
|
||||
break;
|
||||
#endif
|
||||
// too old, cannot support.
|
||||
default:
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemo->filepath);
|
||||
sprintf(pdemo->title, "INVALID REPLAY");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_PlayDemo
|
||||
//
|
||||
@@ -7635,9 +7690,6 @@ post_compat:
|
||||
players[i].kartweight = kartweight[i];
|
||||
}
|
||||
|
||||
directorstate = cv_director.value;
|
||||
CV_SetValue(&cv_director, 0);
|
||||
|
||||
demo.deferstart = true;
|
||||
}
|
||||
#undef SKIPERRORS
|
||||
@@ -7768,6 +7820,9 @@ void G_AddGhost(char *defdemoname)
|
||||
case ATTACKING_RECORD: // 1
|
||||
p += 8; // demo time, lap
|
||||
break;
|
||||
/*case ATTACKING_NIGHTS: // 2
|
||||
p += 8; // demo time left, score
|
||||
break;*/
|
||||
default: // 3
|
||||
break;
|
||||
}
|
||||
@@ -8201,11 +8256,6 @@ void G_StopDemo(void)
|
||||
{
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
if (demo.playback)
|
||||
{
|
||||
CV_SetValue(&cv_director, directorstate);
|
||||
directorstate = 0;
|
||||
}
|
||||
demo.playback = false;
|
||||
if (demo.title)
|
||||
modeattacking = false;
|
||||
@@ -8388,6 +8438,7 @@ void G_SaveDemo(void)
|
||||
|
||||
boolean G_DemoTitleResponder(event_t *ev)
|
||||
{
|
||||
size_t len;
|
||||
INT32 ch;
|
||||
|
||||
if (ev->type != ev_keydown)
|
||||
@@ -8408,7 +8459,28 @@ boolean G_DemoTitleResponder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
M_TextInputHandle(&demo.titlenameinput, ch);
|
||||
if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART])
|
||||
|| ch == ' ') // Allow spaces, of course
|
||||
{
|
||||
len = strlen(demo.titlename);
|
||||
if (len < 64)
|
||||
{
|
||||
demo.titlename[len+1] = 0;
|
||||
demo.titlename[len] = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(ch) : CON_ShiftChar(ch);
|
||||
}
|
||||
}
|
||||
else if (ch == KEY_BACKSPACE)
|
||||
{
|
||||
if (shiftdown)
|
||||
memset(demo.titlename, 0, sizeof(demo.titlename));
|
||||
else
|
||||
{
|
||||
len = strlen(demo.titlename);
|
||||
|
||||
if (len > 0)
|
||||
demo.titlename[len-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -8493,3 +8565,4 @@ INT32 G_TicsToMilliseconds(tic_t tics)
|
||||
{
|
||||
return (INT32)((tics%TICRATE) * (1000.00f/TICRATE));
|
||||
}
|
||||
|
||||
+11
-8
@@ -17,7 +17,6 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_event.h"
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern char gamedatafilename[64];
|
||||
extern char timeattackfolder[64];
|
||||
@@ -40,12 +39,11 @@ extern UINT8 *demo_p;
|
||||
// ======================================
|
||||
|
||||
// demoplaying back and demo recording
|
||||
extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality, cv_maxdemosize, cv_demochangemap;
|
||||
extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality, cv_maxdemosize;
|
||||
|
||||
// Publicly-accessible demo vars
|
||||
struct demovars_s {
|
||||
char titlename[65];
|
||||
textinput_t titlenameinput;
|
||||
boolean recording, playback, timing;
|
||||
UINT16 version; // Current file format of the demo being played
|
||||
boolean title; // Title Screen demo can be cancelled by any key
|
||||
@@ -220,8 +218,6 @@ extern angle_t localangle[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 localaiming[MAXSPLITSCREENPLAYERS]; // should be an angle_t but signed
|
||||
extern boolean camspin[MAXSPLITSCREENPLAYERS]; // SRB2Kart
|
||||
|
||||
extern tic_t directortoggletimer;
|
||||
|
||||
//
|
||||
// GAME
|
||||
//
|
||||
@@ -269,7 +265,6 @@ void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar
|
||||
void G_DoLoadLevel(boolean resetplayer);
|
||||
|
||||
void G_LoadDemoInfo(menudemo_t *pdemo);
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo); // For use in replay search feature
|
||||
void G_DeferedPlayDemo(const char *demo);
|
||||
|
||||
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
|
||||
@@ -419,9 +414,19 @@ void G_SetGamestate(gamestate_t newstate);
|
||||
|
||||
// Gamedata record shit
|
||||
void G_AllocMainRecordData(INT16 i);
|
||||
//void G_AllocNightsRecordData(INT16 i);
|
||||
void G_ClearRecords(void);
|
||||
|
||||
//UINT32 G_GetBestScore(INT16 map);
|
||||
tic_t G_GetBestTime(INT16 map);
|
||||
//tic_t G_GetBestLap(INT16 map);
|
||||
//UINT16 G_GetBestRings(INT16 map);
|
||||
//UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare);
|
||||
//tic_t G_GetBestNightsTime(INT16 map, UINT8 mare);
|
||||
//UINT8 G_GetBestNightsGrade(INT16 map, UINT8 mare);
|
||||
|
||||
//void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare);
|
||||
//void G_SetNightsRecords(void);
|
||||
|
||||
FUNCMATH INT32 G_TicsToHours(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full);
|
||||
@@ -429,8 +434,6 @@ FUNCMATH INT32 G_TicsToSeconds(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
|
||||
|
||||
boolean K_DirectorIsPlayerAlone(void); // idk where else to put this lol
|
||||
|
||||
// Don't split up TOL handling
|
||||
INT16 G_TOLFlag(INT32 pgametype);
|
||||
|
||||
|
||||
-231
@@ -14,17 +14,11 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_input.h"
|
||||
#include "g_game.h"
|
||||
#include "keys.h"
|
||||
#include "hu_stuff.h" // need HUFONT start & end
|
||||
#include "d_net.h"
|
||||
#include "console.h"
|
||||
|
||||
#include "i_system.h"
|
||||
#include "i_video.h"
|
||||
#include "r_draw.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#define MAXMOUSESENSITIVITY 100 // sensitivity steps
|
||||
|
||||
static CV_PossibleValue_t mousesens_cons_t[] = {{1, "MIN"}, {MAXMOUSESENSITIVITY, "MAX"}, {0, NULL}};
|
||||
@@ -39,89 +33,6 @@ consvar_t cv_mouseysens2 = {"mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL
|
||||
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_turnsmooth = {"turnsmoothing", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void G_ResetPlayerDeviceRumble(INT32 player);
|
||||
static void rumble_off_handle(void);
|
||||
static void rumble_off_handle2(void);
|
||||
static void rumble_off_handle3(void);
|
||||
static void rumble_off_handle4(void);
|
||||
|
||||
static void G_ResetPlayerGamepadIndicatorColor(INT32 player);
|
||||
static void led_off_handle(void);
|
||||
static void led_off_handle2(void);
|
||||
static void led_off_handle3(void);
|
||||
static void led_off_handle4(void);
|
||||
|
||||
consvar_t cv_rumble[MAXSPLITSCREENPLAYERS] = {
|
||||
{"rumble", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"rumble2", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"rumble3", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"rumble4", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = {
|
||||
{"gamepadled", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled2", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled3", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"gamepadled4", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS] = {
|
||||
{"ledpowerup", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"ledpowerup2", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"ledpowerup3", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"ledpowerup4", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static void rumble_off_handle(void)
|
||||
{
|
||||
if (cv_rumble[0].value == 0)
|
||||
G_ResetPlayerDeviceRumble(0);
|
||||
}
|
||||
|
||||
|
||||
static void rumble_off_handle2(void)
|
||||
{
|
||||
if (cv_rumble[1].value == 0)
|
||||
G_ResetPlayerDeviceRumble(1);
|
||||
}
|
||||
|
||||
|
||||
static void rumble_off_handle3(void)
|
||||
{
|
||||
if (cv_rumble[2].value == 0)
|
||||
G_ResetPlayerDeviceRumble(2);
|
||||
}
|
||||
|
||||
|
||||
static void rumble_off_handle4(void)
|
||||
{
|
||||
if (cv_rumble[3].value == 0)
|
||||
G_ResetPlayerDeviceRumble(3);
|
||||
}
|
||||
|
||||
static void led_off_handle(void)
|
||||
{
|
||||
G_ResetPlayerGamepadIndicatorColor(0);
|
||||
}
|
||||
|
||||
|
||||
static void led_off_handle2(void)
|
||||
{
|
||||
G_ResetPlayerGamepadIndicatorColor(1);
|
||||
}
|
||||
|
||||
|
||||
static void led_off_handle3(void)
|
||||
{
|
||||
G_ResetPlayerGamepadIndicatorColor(2);
|
||||
}
|
||||
|
||||
|
||||
static void led_off_handle4(void)
|
||||
{
|
||||
G_ResetPlayerGamepadIndicatorColor(3);
|
||||
}
|
||||
|
||||
INT32 mousex, mousey;
|
||||
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
|
||||
|
||||
@@ -901,152 +812,10 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
"custom1",
|
||||
"custom2",
|
||||
"custom3",
|
||||
"director",
|
||||
};
|
||||
|
||||
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
|
||||
|
||||
#include "k_kart.h"
|
||||
|
||||
INT32 G_GetDeviceForPlayer(INT32 player)
|
||||
{
|
||||
switch (player)
|
||||
{
|
||||
case 0:
|
||||
return cv_usejoystick.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_usejoystick2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_usejoystick3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_usejoystick4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline UINT16 G_GetSkinColor(INT32 player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
if (cv_ledpowerup[player].value && gamestate == GS_LEVEL && players[displayplayers[player]].mo && (players[displayplayers[player]].kartstuff[k_invincibilitytimer] || players[displayplayers[player]].powers[pw_invulnerability] || players[displayplayers[player]].kartstuff[k_growshrinktimer]))
|
||||
return players[displayplayers[player]].mo->color;
|
||||
|
||||
// take actual player skincolour when ingame
|
||||
if (gamestate == GS_LEVEL && players[displayplayers[player]].skincolor)
|
||||
return players[displayplayers[player]].skincolor;
|
||||
|
||||
// otherwise just fallback to whatever the cvar is
|
||||
switch (player)
|
||||
{
|
||||
case 0:
|
||||
return cv_playercolor.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_playercolor2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_playercolor3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_playercolor4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color)
|
||||
{
|
||||
INT32 device;
|
||||
UINT16 skincolor;
|
||||
byteColor_t byte_color;
|
||||
|
||||
I_Assert(player >= 0 && player < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
return;
|
||||
|
||||
device = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
skincolor = color ? color : G_GetSkinColor(player);
|
||||
byte_color = V_GetColor(colortranslations[skincolor][8]).s;
|
||||
|
||||
I_SetGamepadIndicatorColor(device, byte_color.red, byte_color.green, byte_color.blue);
|
||||
}
|
||||
|
||||
static void G_ResetPlayerGamepadIndicatorColor(INT32 player)
|
||||
{
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
{
|
||||
INT32 device = G_GetDeviceForPlayer(player);
|
||||
if (device <= 0)
|
||||
return;
|
||||
|
||||
I_SetGamepadIndicatorColor(device, 0, 0, 255);
|
||||
}
|
||||
else
|
||||
G_SetPlayerGamepadIndicatorColor(player, 0);
|
||||
}
|
||||
|
||||
static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
|
||||
void G_ResetAllDeviceRumbles(void)
|
||||
{
|
||||
int i;
|
||||
int devices;
|
||||
|
||||
devices = I_NumJoys();
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
{
|
||||
INT32 device_id = G_GetDeviceForPlayer(i);
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
if (cv_rumble[player].value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
I_GamepadRumble(device_id, low_strength, high_strength, duration);
|
||||
}
|
||||
|
||||
//
|
||||
// Detach any keys associated to the given game control
|
||||
// - pass the pointer to the gamecontrol table for the player being edited
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#define __G_INPUT__
|
||||
|
||||
#include "d_event.h"
|
||||
#include "doomstat.h"
|
||||
#include "keys.h"
|
||||
#include "command.h"
|
||||
|
||||
@@ -99,7 +98,6 @@ typedef enum
|
||||
gc_custom1, // Lua scriptable
|
||||
gc_custom2, // Lua scriptable
|
||||
gc_custom3, // Lua scriptable
|
||||
gc_director,
|
||||
num_gamecontrols
|
||||
} gamecontrols_e;
|
||||
|
||||
@@ -107,9 +105,6 @@ typedef enum
|
||||
extern consvar_t cv_mousesens, cv_mouseysens;
|
||||
extern consvar_t cv_mousesens2, cv_mouseysens2;
|
||||
extern consvar_t cv_controlperkey, cv_turnsmooth;
|
||||
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern INT32 mousex, mousey;
|
||||
extern INT32 mlooky; //mousey with mlookSensitivity
|
||||
@@ -134,12 +129,6 @@ extern INT32 gamecontrol4[num_gamecontrols][2];
|
||||
// peace to my little coder fingers!
|
||||
// check a gamecontrol being active or not
|
||||
|
||||
UINT16 G_GetSkinColor(INT32 player);
|
||||
INT32 G_GetDeviceForPlayer(INT32 player);
|
||||
void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color);
|
||||
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||
void G_ResetAllDeviceRumbles(void);
|
||||
|
||||
// remaps the input event to a game control.
|
||||
void G_MapEventsToControls(event_t *ev);
|
||||
|
||||
|
||||
+60
-60
@@ -35,7 +35,7 @@ int finalVertexArrayAllocSize = 65536;
|
||||
|
||||
PolygonArrayEntry* polygonArray = NULL;// contains the polygon data from DrawPolygon, waiting to be processed
|
||||
int polygonArraySize = 0;
|
||||
PolygonArrayEntry **polygonArraySorted = NULL;// contains sorted pointers to polygonArray
|
||||
UINT32* polygonIndexArray = NULL;// contains sorting pointers for polygonArray
|
||||
int polygonArrayAllocSize = 65536;
|
||||
|
||||
FOutVector* unsortedVertexArray = NULL;// contains unsorted vertices and texture coordinates from DrawPolygon
|
||||
@@ -47,9 +47,7 @@ int unsortedVertexArrayAllocSize = 65536;
|
||||
void HWR_StartBatching(void)
|
||||
{
|
||||
if (currently_batching)
|
||||
{
|
||||
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
|
||||
}
|
||||
|
||||
// init arrays if that has not been done yet
|
||||
if (!finalVertexArray)
|
||||
@@ -57,7 +55,7 @@ void HWR_StartBatching(void)
|
||||
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
finalVertexIndexArray = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
||||
polygonArray = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
|
||||
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
}
|
||||
|
||||
@@ -98,8 +96,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
free(polygonArray);
|
||||
polygonArray = new_array;
|
||||
// also need to redo the index array, dont need to copy it though
|
||||
free(polygonArraySorted);
|
||||
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
|
||||
free(polygonIndexArray);
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
|
||||
}
|
||||
|
||||
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
|
||||
@@ -136,8 +134,10 @@ 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;
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
UINT32 downloaded1 = 0;
|
||||
@@ -155,7 +155,7 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (shader1 == -1 && shader2 == -1)
|
||||
return poly1 - poly2;
|
||||
return index1 - index2;
|
||||
|
||||
if (poly1->texture)
|
||||
downloaded1 = poly1->texture->downloaded; // there should be a opengl texture name here, usable for comparisons
|
||||
@@ -184,8 +184,10 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
|
||||
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
{
|
||||
PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
|
||||
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
@@ -203,7 +205,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
downloaded2 = texture2->downloaded;
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (!texture1 && !texture2)
|
||||
return poly1 - poly2;
|
||||
return index1 - index2;
|
||||
diff64 = downloaded1 - downloaded2;
|
||||
if (diff64 != 0) return diff64;
|
||||
|
||||
@@ -223,7 +225,7 @@ void HWR_RenderBatches(void)
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalIndexWritePos = 0;// position in finalVertexIndexArray
|
||||
|
||||
int polygonReadPos = 0;// position in polygonArraySorted
|
||||
int polygonReadPos = 0;// position in polygonIndexArray
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
@@ -256,18 +258,18 @@ void HWR_RenderBatches(void)
|
||||
ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0;
|
||||
ps_hw_numshaders.value.i = ps_hw_numtextures.value.i
|
||||
= ps_hw_numpolyflags.value.i = ps_hw_numcolors.value.i = 1;
|
||||
// init polygonArraySorted
|
||||
// init polygonIndexArray
|
||||
for (i = 0; i < polygonArraySize; i++)
|
||||
{
|
||||
polygonArraySorted[i] = &polygonArray[i];
|
||||
polygonIndexArray[i] = i;
|
||||
}
|
||||
|
||||
// sort polygons
|
||||
PS_START_TIMING(ps_hw_batchsorttime);
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
|
||||
qs22j(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
|
||||
else
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders);
|
||||
qs22j(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
|
||||
PS_STOP_TIMING(ps_hw_batchsorttime);
|
||||
// sort order
|
||||
// 1. shader
|
||||
@@ -278,10 +280,10 @@ void HWR_RenderBatches(void)
|
||||
|
||||
PS_START_TIMING(ps_hw_batchdrawtime);
|
||||
|
||||
currentShader = polygonArraySorted[0]->shader;
|
||||
currentTexture = polygonArraySorted[0]->texture;
|
||||
currentPolyFlags = polygonArraySorted[0]->polyFlags;
|
||||
currentSurfaceInfo = polygonArraySorted[0]->surf;
|
||||
currentShader = polygonArray[polygonIndexArray[0]].shader;
|
||||
currentTexture = polygonArray[polygonIndexArray[0]].texture;
|
||||
currentPolyFlags = polygonArray[polygonIndexArray[0]].polyFlags;
|
||||
currentSurfaceInfo = polygonArray[polygonIndexArray[0]].surf;
|
||||
// For now, will sort and track the colors. Vertex attributes could be used instead of uniforms
|
||||
// and a color array could replace the color calls.
|
||||
|
||||
@@ -320,8 +322,8 @@ void HWR_RenderBatches(void)
|
||||
// reset write pos
|
||||
// repeat loop
|
||||
|
||||
PolygonArrayEntry *entry = polygonArraySorted[polygonReadPos++];
|
||||
int numVerts = entry->numVerts;
|
||||
int index = polygonIndexArray[polygonReadPos++];
|
||||
int numVerts = polygonArray[index].numVerts;
|
||||
// before writing, check if there is enough room
|
||||
// using 'while' instead of 'if' here makes sure that there will *always* be enough room.
|
||||
// probably never will this loop run more than once though
|
||||
@@ -342,7 +344,7 @@ void HWR_RenderBatches(void)
|
||||
finalVertexIndexArray = new_index_array;
|
||||
}
|
||||
// write the vertices of the polygon
|
||||
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex],
|
||||
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[polygonArray[index].vertsIndex],
|
||||
numVerts * sizeof(FOutVector));
|
||||
// write the indexes, pointing to the fan vertexes but in triangles format
|
||||
firstIndex = finalVertexWritePos;
|
||||
@@ -362,11 +364,11 @@ void HWR_RenderBatches(void)
|
||||
else
|
||||
{
|
||||
// check if a state change is required, set the change bools and next vars
|
||||
PolygonArrayEntry *nextEntry = polygonArraySorted[polygonReadPos];
|
||||
nextShader = nextEntry->shader;
|
||||
nextTexture = nextEntry->texture;
|
||||
nextPolyFlags = nextEntry->polyFlags;
|
||||
nextSurfaceInfo = nextEntry->surf;
|
||||
int nextIndex = polygonIndexArray[polygonReadPos];
|
||||
nextShader = polygonArray[nextIndex].shader;
|
||||
nextTexture = polygonArray[nextIndex].texture;
|
||||
nextPolyFlags = polygonArray[nextIndex].polyFlags;
|
||||
nextSurfaceInfo = polygonArray[nextIndex].surf;
|
||||
if (nextPolyFlags & PF_NoTexture)
|
||||
nextTexture = 0;
|
||||
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable)
|
||||
@@ -424,40 +426,38 @@ void HWR_RenderBatches(void)
|
||||
if (stopFlag) break;
|
||||
|
||||
// change state according to change bools and next vars, update current vars and reset bools
|
||||
if (changeState)
|
||||
if (changeShader)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
HWD.pfnSetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
ps_hw_numshaders.value.i++;
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
ps_hw_numtextures.value.i++;
|
||||
}
|
||||
if (changePolyFlags)
|
||||
{
|
||||
currentPolyFlags = nextPolyFlags;
|
||||
changePolyFlags = false;
|
||||
|
||||
ps_hw_numpolyflags.value.i++;
|
||||
}
|
||||
if (changeSurfaceInfo)
|
||||
{
|
||||
currentSurfaceInfo = nextSurfaceInfo;
|
||||
changeSurfaceInfo = false;
|
||||
|
||||
ps_hw_numcolors.value.i++;
|
||||
}
|
||||
ps_hw_numshaders.value.i++;
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
ps_hw_numtextures.value.i++;
|
||||
}
|
||||
if (changePolyFlags)
|
||||
{
|
||||
currentPolyFlags = nextPolyFlags;
|
||||
changePolyFlags = false;
|
||||
|
||||
ps_hw_numpolyflags.value.i++;
|
||||
}
|
||||
if (changeSurfaceInfo)
|
||||
{
|
||||
currentSurfaceInfo = nextSurfaceInfo;
|
||||
changeSurfaceInfo = false;
|
||||
|
||||
ps_hw_numcolors.value.i++;
|
||||
}
|
||||
// and that should be it?
|
||||
}
|
||||
// reset the arrays (set sizes to 0)
|
||||
polygonArraySize = 0;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
|
||||
unsigned int vertsIndex;// location of verts in unsortedVertexArray
|
||||
|
||||
+8
-18
@@ -667,15 +667,9 @@ static boolean PointInSeg(polyvertex_t *a,polyvertex_t *v1,polyvertex_t *v2)
|
||||
// v1 = origine
|
||||
ax= v2->x-v1->x;
|
||||
ay= v2->y-v1->y;
|
||||
norm = hypotf(ax, ay);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
if (norm != 0) // yes, this can be exactly 0
|
||||
#pragma GCC diagnostic pop
|
||||
{
|
||||
ax /= norm;
|
||||
ay /= norm;
|
||||
}
|
||||
norm = (float)hypot(ax, ay);
|
||||
ax /= norm;
|
||||
ay /= norm;
|
||||
bx = a->x-v1->x;
|
||||
by = a->y-v1->y;
|
||||
//d = a.b
|
||||
@@ -778,11 +772,9 @@ static INT32 SolveTProblem(void)
|
||||
for (l = 0; l < addsubsector; l++)
|
||||
{
|
||||
p = extrasubsectors[l].planepoly;
|
||||
if (!p)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < p->numpts; i++)
|
||||
SearchSegInBSP((INT32)numnodes-1, &p->pts[i], p);
|
||||
if (p)
|
||||
for (i = 0; i < p->numpts; i++)
|
||||
SearchSegInBSP((INT32)numnodes-1, &p->pts[i], p);
|
||||
}
|
||||
//CONS_Debug(DBG_RENDER, "numsplitpoly %d\n", numsplitpoly);
|
||||
return numsplitpoly;
|
||||
@@ -810,10 +802,8 @@ static void AdjustSegs(void)
|
||||
count = subsectors[i].numlines;
|
||||
lseg = &segs[subsectors[i].firstline];
|
||||
p = extrasubsectors[i].planepoly;
|
||||
|
||||
if (!p)
|
||||
continue;
|
||||
|
||||
//if (!p)
|
||||
//continue;
|
||||
for (; count--; lseg++)
|
||||
{
|
||||
float distv1,distv2,tmp;
|
||||
|
||||
+14
-19
@@ -379,19 +379,18 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
|
||||
Z_Unlock(realpatch);
|
||||
}
|
||||
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
if (format2bpp(grtex->mipmap.format)==4)
|
||||
{
|
||||
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
|
||||
{
|
||||
if (block[i] != 0)
|
||||
continue;
|
||||
|
||||
grtex->mipmap.flags |= TF_TRANSPARENT;
|
||||
break;
|
||||
if (block[i] == 0)
|
||||
{
|
||||
grtex->mipmap.flags |= TF_TRANSPARENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,6 +572,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -629,12 +629,8 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
#ifdef GLENCORE
|
||||
flat = grMipmap->data;
|
||||
for (steppy = 0; steppy < size; steppy++)
|
||||
{
|
||||
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
continue;
|
||||
|
||||
flat[steppy] = grMipmap->colormap[flat[steppy]];
|
||||
}
|
||||
if (flat[steppy] != HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
flat[steppy] = grMipmap->colormap[flat[steppy]];
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -747,12 +743,11 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
|
||||
if (grmip->colormap != colormap)
|
||||
continue;
|
||||
|
||||
HWR_LoadMappedPatch(grmip, gpatch);
|
||||
return;
|
||||
if (grmip->colormap == colormap)
|
||||
{
|
||||
HWR_LoadMappedPatch(grmip, gpatch);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// not found, create it!
|
||||
// If we are here, the sprite with the current colormap is not already in hardware memory
|
||||
|
||||
@@ -337,16 +337,16 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
|
||||
if (floatangle >= 180.0)
|
||||
return 0xffffffff;
|
||||
a1 = (angle_t)(ANG1 * (int)floatangle);
|
||||
a1 = ANG1 * (int)floatangle;
|
||||
return a1;
|
||||
}
|
||||
|
||||
|
||||
// SRB2CB I don't think used any of this stuff, let's disable for now since SRB2 probably doesn't want it either
|
||||
// compiler complains about (p)glGetFloatv anyway, in case anyone wants this
|
||||
// only r_opengl.c can use the base gl funcs as it turns out, that's a problem for whoever wants sphere frustum checks
|
||||
// btw to renable define HAVE_SPHEREFRUSTRUM in hw_clip.h
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
|
||||
//
|
||||
// gld_FrustumSetup
|
||||
//
|
||||
|
||||
@@ -44,6 +44,7 @@ struct GLMipmap_s
|
||||
UINT16 width, height;
|
||||
UINT32 downloaded; // tex_downloaded
|
||||
|
||||
struct GLMipmap_s *nextmipmap;
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
};
|
||||
|
||||
@@ -156,7 +156,7 @@ typedef struct
|
||||
boolean mirrorflip; // Encore Mode with Flipcam
|
||||
#endif
|
||||
boolean shearing; // 14042019
|
||||
float viewaiming; // 17052019
|
||||
angle_t viewaiming; // 17052019
|
||||
} FTransform;
|
||||
|
||||
// Transformed vector, as passed to HWR API
|
||||
@@ -175,8 +175,8 @@ enum
|
||||
SHADER_FLOOR = 0,
|
||||
SHADER_SHADOW,
|
||||
SHADER_WALL,
|
||||
SHADER_SPRITE,
|
||||
SHADER_MODEL,
|
||||
SHADER_SPRITE,
|
||||
SHADER_WATER,
|
||||
SHADER_FOG,
|
||||
SHADER_SKY,
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct gr_vissprite_s
|
||||
float x1, x2;
|
||||
float z1, z2;
|
||||
float gz, gzt;
|
||||
float tz;
|
||||
float tz, ty;
|
||||
float scale;
|
||||
float spritexscale, spriteyscale;
|
||||
float spritexoffset, spriteyoffset;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_light.h"
|
||||
#include "hw_drv.h"
|
||||
#include "../i_video.h"
|
||||
#include "../z_zone.h"
|
||||
#include "../m_random.h"
|
||||
#include "../m_bbox.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../r_state.h"
|
||||
#include "../r_main.h"
|
||||
#include "../p_local.h"
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -0,0 +1,20 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Dynamic lighting & coronas add on by Hurdler
|
||||
|
||||
#ifndef _HW_LIGHTS_
|
||||
#define _HW_LIGHTS_
|
||||
|
||||
#include "hw_glob.h"
|
||||
#include "hw_defs.h"
|
||||
|
||||
#endif
|
||||
+1182
-745
File diff suppressed because it is too large.
Load diff
@@ -120,6 +120,7 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc
|
||||
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
|
||||
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
void HWR_AddPolyObjectPlanes(void);
|
||||
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
||||
|
||||
// hw_main.c: Segs
|
||||
@@ -131,10 +132,12 @@ void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 t
|
||||
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
|
||||
void HWR_DrawSkyBackground(float fpov);
|
||||
|
||||
void HWR_AddPolyObjectSegs(void);
|
||||
|
||||
// hw_main.c: Sprites
|
||||
void HWR_AddSprites(sector_t *sec);
|
||||
void HWR_ProjectSprite(mobj_t *thing);
|
||||
//void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||
void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||
void HWR_DrawSprites(void);
|
||||
|
||||
// hw_bsp.c
|
||||
@@ -152,7 +155,10 @@ extern consvar_t cv_grshaders;
|
||||
#ifdef USE_FBO_OGL
|
||||
extern consvar_t cv_grframebuffer;
|
||||
#endif
|
||||
extern consvar_t cv_grfofcut;
|
||||
extern consvar_t cv_fofzfightfix;
|
||||
extern consvar_t cv_splitwallfix;
|
||||
extern consvar_t cv_slopepegfix;
|
||||
extern consvar_t cv_grshearing;
|
||||
extern consvar_t cv_grfov;
|
||||
extern consvar_t cv_grmdls;
|
||||
@@ -173,7 +179,6 @@ extern consvar_t cv_grrenderdistance;
|
||||
extern consvar_t cv_grpaletterendering;
|
||||
extern consvar_t cv_grpalettedepth;
|
||||
extern consvar_t cv_grflashpal;
|
||||
extern consvar_t cv_lightdither;
|
||||
extern consvar_t cv_grscreentextures;
|
||||
extern consvar_t cv_grportals;
|
||||
extern consvar_t cv_nostencil;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_drv.h"
|
||||
#include "hw_light.h"
|
||||
#include "hw_md2.h"
|
||||
#include "../d_main.h"
|
||||
#include "../r_bsp.h"
|
||||
@@ -74,7 +75,7 @@
|
||||
|
||||
md2_t md2_models[NUMSPRITES];
|
||||
md2_t md2_playermodels[MAXSKINS];
|
||||
md2_t md2_localplayermodels[MAXLOCALSKINS];
|
||||
md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
|
||||
/*
|
||||
@@ -493,9 +494,7 @@ void HWR_InitMD2(void)
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
}
|
||||
for (s = 0; s < MAXLOCALSKINS; s++)
|
||||
{
|
||||
|
||||
md2_localplayermodels[s].scale = -1.0f;
|
||||
md2_localplayermodels[s].model = NULL;
|
||||
md2_localplayermodels[s].grpatch = NULL;
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct
|
||||
|
||||
extern md2_t md2_models[NUMSPRITES];
|
||||
extern md2_t md2_playermodels[MAXSKINS];
|
||||
extern md2_t md2_localplayermodels[MAXLOCALSKINS];
|
||||
extern md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
void HWR_InitMD2(void);
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr);
|
||||
|
||||
+1
-115
@@ -82,7 +82,6 @@ static shadertarget_t gl_shadertargets[NUMSHADERTARGETS];
|
||||
#define WHITESPACE_CHARS " \t"
|
||||
|
||||
#define PALETTE_RENDERING_DEFINE "#define SRB2_PALETTE_RENDERING"
|
||||
#define LIGHT_DITHERING_DEFINE "#define SRB2_LIGHT_DITHER"
|
||||
|
||||
// Initialize shader variables and the backend's shader system. Load the base shaders.
|
||||
// Returns false if shaders cannot be used.
|
||||
@@ -283,9 +282,6 @@ static char *HWR_PreprocessShader(char *original)
|
||||
if (cv_grpaletterendering.value)
|
||||
ADD_TO_LEN(PALETTE_RENDERING_DEFINE)
|
||||
|
||||
if (cv_lightdither.value)
|
||||
ADD_TO_LEN(LIGHT_DITHERING_DEFINE)
|
||||
|
||||
#undef ADD_TO_LEN
|
||||
|
||||
#define VERSION_PART "#version "
|
||||
@@ -327,9 +323,6 @@ static char *HWR_PreprocessShader(char *original)
|
||||
if (cv_grpaletterendering.value)
|
||||
WRITE_DEFINE(PALETTE_RENDERING_DEFINE)
|
||||
|
||||
if (cv_lightdither.value)
|
||||
WRITE_DEFINE(LIGHT_DITHERING_DEFINE)
|
||||
|
||||
#undef WRITE_DEFINE
|
||||
|
||||
// Write a #line directive, so compiler errors will report line numbers from the
|
||||
@@ -453,106 +446,6 @@ void HWR_LoadAllCustomShaders(void)
|
||||
HWR_LoadCustomShadersFromFile(i, W_FileHasFolders(wadfiles[i]));
|
||||
}
|
||||
|
||||
static const char version_directives[][14] = {
|
||||
"#version 330\n",
|
||||
"#version 150\n",
|
||||
"#version 140\n",
|
||||
"#version 130\n",
|
||||
"#version 120\n",
|
||||
"#version 110\n",
|
||||
};
|
||||
|
||||
static boolean HWR_VersionDirectiveExists(const char* source)
|
||||
{
|
||||
return strncmp(source, "#version", 8) == 0;
|
||||
}
|
||||
|
||||
static char* HWR_PrependVersionDirective(const char* source, UINT32 version_index)
|
||||
{
|
||||
const UINT32 version_len = sizeof(version_directives[version_index]) - 1;
|
||||
const UINT32 source_len = strlen(source);
|
||||
|
||||
char* result = Z_Malloc(source_len + version_len + 1, PU_STATIC, NULL);
|
||||
strcpy(result, version_directives[version_index]);
|
||||
strcpy(result + version_len, source);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void HWR_ReplaceVersionInplace(char* shader, UINT32 version_index)
|
||||
{
|
||||
shader[9] = version_directives[version_index][9];
|
||||
shader[10] = version_directives[version_index][10];
|
||||
shader[11] = version_directives[version_index][11];
|
||||
}
|
||||
|
||||
static boolean HWR_CheckVersionDirectives(const char* vert, const char* frag)
|
||||
{
|
||||
return HWR_VersionDirectiveExists(vert) && HWR_VersionDirectiveExists(frag);
|
||||
}
|
||||
|
||||
static void HWR_TryToCompileShaderWithImplicitVersion(INT32 shader_index, INT32 shaderxlat_id)
|
||||
{
|
||||
char* vert_shader = gl_shaders[shader_index].vertex;
|
||||
char* frag_shader = gl_shaders[shader_index].fragment;
|
||||
|
||||
boolean vert_shader_version_exists = HWR_VersionDirectiveExists(vert_shader);
|
||||
boolean frag_shader_version_exists = HWR_VersionDirectiveExists(frag_shader);
|
||||
|
||||
if (!vert_shader_version_exists)
|
||||
CONS_Alert(CONS_WARNING, "HWR_LoadCustomShadersFromFile: vertex shader '%s' is missing a #version directive\n", HWR_GetShaderName(shaderxlat_id));
|
||||
|
||||
if (!frag_shader_version_exists)
|
||||
CONS_Alert(CONS_WARNING, "HWR_LoadCustomShadersFromFile: fragment shader '%s' is missing a #version directive\n", HWR_GetShaderName(shaderxlat_id));
|
||||
|
||||
// try to compile as is
|
||||
HWR_CompileShader(shader_index);
|
||||
|
||||
if (gl_shaders[shader_index].compiled)
|
||||
return;
|
||||
|
||||
// try each version directive
|
||||
for (UINT32 i = 0; i < sizeof(version_directives) / sizeof(version_directives[0]); ++i)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "HWR_TryToCompileShaderWithImplicitVersion: Trying %s\n", version_directives[i]);
|
||||
|
||||
if (!vert_shader_version_exists)
|
||||
{
|
||||
// first time reallocation would have to be made
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
void* old = (void*)gl_shaders[shader_index].vertex;
|
||||
vert_shader = gl_shaders[shader_index].vertex = HWR_PrependVersionDirective(vert_shader, i);
|
||||
Z_Free(old);
|
||||
}
|
||||
else
|
||||
HWR_ReplaceVersionInplace(vert_shader, i);
|
||||
}
|
||||
|
||||
if (!frag_shader_version_exists)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
void* old = (void*)gl_shaders[shader_index].fragment;
|
||||
frag_shader = gl_shaders[shader_index].fragment = HWR_PrependVersionDirective(frag_shader, i);
|
||||
Z_Free(old);
|
||||
}
|
||||
else
|
||||
HWR_ReplaceVersionInplace(frag_shader, i);
|
||||
}
|
||||
|
||||
HWR_CompileShader(shader_index);
|
||||
if (gl_shaders[shader_index].compiled)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "HWR_TryToCompileShaderWithImplicitVersion: Compiled with %s\n",
|
||||
version_directives[i]);
|
||||
CONS_Alert(CONS_WARNING, "Implicit GLSL version is used. Correct behavior is not guaranteed\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
{
|
||||
UINT16 lump;
|
||||
@@ -709,20 +602,13 @@ skip_field:
|
||||
{
|
||||
int shader_index = i + NUMSHADERTARGETS; // index to gl_shaders
|
||||
gl_shadertargets[i].custom_shader = shader_index;
|
||||
|
||||
// if only one stage (vertex/fragment) is defined, the other one
|
||||
// is copied from the base shaders.
|
||||
if (!gl_shaders[shader_index].fragment)
|
||||
gl_shaders[shader_index].fragment = Z_StrDup(gl_shadersources[i].fragment);
|
||||
|
||||
if (!gl_shaders[shader_index].vertex)
|
||||
gl_shaders[shader_index].vertex = Z_StrDup(gl_shadersources[i].vertex);
|
||||
|
||||
if (!HWR_CheckVersionDirectives(gl_shaders[shader_index].vertex, gl_shaders[shader_index].fragment))
|
||||
HWR_TryToCompileShaderWithImplicitVersion(shader_index, i);
|
||||
else
|
||||
HWR_CompileShader(shader_index);
|
||||
|
||||
HWR_CompileShader(shader_index);
|
||||
if (!gl_shaders[shader_index].compiled)
|
||||
CONS_Alert(CONS_ERROR, "HWR_LoadCustomShadersFromFile: A compilation error occured for the %s shader in file %s. See the console messages above for more information.\n", shaderxlat[i].type, wadfiles[wadnum]->filename);
|
||||
}
|
||||
|
||||
@@ -51,53 +51,15 @@
|
||||
//
|
||||
|
||||
// Include GLSL_FLOOR_FUDGES or GLSL_WALL_FUDGES or define the fudges in shaders that use this macro.
|
||||
#define GLSL_DOOM_COLORMAP_DITHER \
|
||||
"float baseValue = max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
|
||||
"float endResolutionx = scr_resolution.x;\n" \
|
||||
"float endResolutiony = scr_resolution.y;\n" \
|
||||
"if (scr_resolution.x > 1280.0) {\n" \
|
||||
"endResolutionx = scr_resolution.x * 0.5;\n" \
|
||||
"}\n" \
|
||||
"if (scr_resolution.y > 720.0) {\n" \
|
||||
"endResolutiony = scr_resolution.y * 0.5;\n" \
|
||||
"}\n" \
|
||||
"float zFactor = clamp((z - 192.0) / (6144.0 - 192.0), 0.0, 1.0);\n" \
|
||||
"int scaleFactor = int(mix(1.0, 8.0, zFactor));\n" \
|
||||
"endResolutionx = endResolutionx * scaleFactor;\n" \
|
||||
"endResolutiony = endResolutiony * scaleFactor;\n" \
|
||||
"vec2 normalizedPosition = position * vec2(endResolutionx / scr_resolution.x, endResolutiony / scr_resolution.y);\n" \
|
||||
"int x = int(mod(normalizedPosition.x, 4.0));\n" \
|
||||
"int y = int(mod(normalizedPosition.y, 4.0));\n" \
|
||||
"float bayerMatrix[4*4] = float[4*4](\n" \
|
||||
"0.0, 8.0, 2.0, 10.0,\n" \
|
||||
"12.0, 4.0, 14.0, 6.0,\n" \
|
||||
"3.0, 11.0, 1.0, 9.0,\n" \
|
||||
"15.0, 7.0, 13.0, 5.0\n" \
|
||||
");\n" \
|
||||
"#ifdef SRB2_PALETTE_RENDERING\n" \
|
||||
"float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 11.0);\n" \
|
||||
"#else\n" \
|
||||
"float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 16.0);\n" \
|
||||
"#endif\n" \
|
||||
"return mix(baseValue + threshold - 0.5 / 16.0, baseValue, zFactor);\n"
|
||||
|
||||
#define GLSL_DOOM_COLORMAP_NODITHER \
|
||||
"return max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
|
||||
|
||||
#define GLSL_DOOM_COLORMAP \
|
||||
"uniform vec2 scr_resolution;\n" \
|
||||
"float R_DoomColormap(float light, float z, vec2 position)\n" \
|
||||
"float R_DoomColormap(float light, float z)\n" \
|
||||
"{\n" \
|
||||
"float lightnum = clamp(light / 17.0, 0.0, 15.0);\n" \
|
||||
"float lightz = clamp(z / 16.0, 0.0, 127.0);\n" \
|
||||
"float startmap = (15.0 - lightnum) * 4.0;\n" \
|
||||
"float scale = 160.0 / (lightz + 1.0);\n" \
|
||||
"float cap = (155.0 - light) * 0.26;\n" \
|
||||
"#ifdef SRB2_LIGHT_DITHER\n" \
|
||||
GLSL_DOOM_COLORMAP_DITHER \
|
||||
"#else\n" \
|
||||
GLSL_DOOM_COLORMAP_NODITHER \
|
||||
"#endif\n" \
|
||||
"return max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
|
||||
"}\n"
|
||||
// lighting cap adjustment:
|
||||
// first num (155.0), increase to make it start to go dark sooner
|
||||
@@ -107,7 +69,7 @@
|
||||
"float R_DoomLightingEquation(float light)\n" \
|
||||
"{\n" \
|
||||
"float z = gl_FragCoord.z / gl_FragCoord.w;\n" \
|
||||
"float colormap = floor(R_DoomColormap(light, z, gl_FragCoord.xy)) + 0.5;\n" \
|
||||
"float colormap = floor(R_DoomColormap(light, z)) + 0.5;\n" \
|
||||
"return clamp(colormap, 0.0, 31.0) / 32.0;\n" \
|
||||
"}\n"
|
||||
|
||||
@@ -133,7 +95,7 @@
|
||||
#define GLSL_PALETTE_RENDERING \
|
||||
"float tex_pal_idx = texture3D(palette_lookup_tex, vec3((texel * 63.0 + 0.5) / 64.0))[0] * 255.0;\n" \
|
||||
"float z = gl_FragCoord.z / gl_FragCoord.w;\n" \
|
||||
"float light_y = clamp(floor(R_DoomColormap(lighting, z, gl_FragCoord.xy)), 0.0, 31.0);\n" \
|
||||
"float light_y = clamp(floor(R_DoomColormap(lighting, z)), 0.0, 31.0);\n" \
|
||||
"vec2 lighttable_coord = vec2((tex_pal_idx + 0.5) / 256.0, (light_y + 0.5) / 32.0);\n" \
|
||||
"vec4 final_color = texture2D(lighttable_tex, lighttable_coord);\n" \
|
||||
"final_color.a = texel.a * poly_color.a;\n" \
|
||||
@@ -194,12 +156,10 @@
|
||||
|
||||
// hand tuned adjustments for light level calculation
|
||||
#define GLSL_FLOOR_FUDGES \
|
||||
"#version 120\n" \
|
||||
"#define STARTMAP_FUDGE 1.06\n" \
|
||||
"#define SCALE_FUDGE 1.15\n"
|
||||
|
||||
#define GLSL_WALL_FUDGES \
|
||||
"#version 120\n" \
|
||||
"#define STARTMAP_FUDGE 1.05\n" \
|
||||
"#define SCALE_FUDGE 2.2\n"
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ GLfloat projMatrix[16];
|
||||
static GLint viewport[4];
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
static boolean GLFramebuffer_IsFuncAvailible(void);
|
||||
|
||||
GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
GLboolean FrameBufferEnabled = GL_FALSE, RenderToFramebuffer = GL_FALSE;
|
||||
|
||||
@@ -606,7 +608,6 @@ typedef void (APIENTRY *PFNglDeleteProgram) (GLuint);
|
||||
typedef void (APIENTRY *PFNglAttachShader) (GLuint, GLuint);
|
||||
typedef void (APIENTRY *PFNglLinkProgram) (GLuint);
|
||||
typedef void (APIENTRY *PFNglGetProgramiv) (GLuint, GLenum, GLint*);
|
||||
typedef void (APIENTRY *PFNglGetProgramInfoLog) (GLuint, GLsizei, GLsizei*, GLchar*);
|
||||
typedef void (APIENTRY *PFNglUseProgram) (GLuint);
|
||||
typedef void (APIENTRY *PFNglUniform1i) (GLint, GLint);
|
||||
typedef void (APIENTRY *PFNglUniform1f) (GLint, GLfloat);
|
||||
@@ -629,7 +630,6 @@ static PFNglDeleteProgram pglDeleteProgram;
|
||||
static PFNglAttachShader pglAttachShader;
|
||||
static PFNglLinkProgram pglLinkProgram;
|
||||
static PFNglGetProgramiv pglGetProgramiv;
|
||||
static PFNglGetProgramInfoLog pglGetProgramInfoLog;
|
||||
static PFNglUseProgram pglUseProgram;
|
||||
static PFNglUniform1i pglUniform1i;
|
||||
static PFNglUniform1f pglUniform1f;
|
||||
@@ -669,8 +669,6 @@ typedef enum
|
||||
|
||||
// misc.
|
||||
gluniform_leveltime,
|
||||
|
||||
gluniform_scr_resolution,
|
||||
|
||||
gluniform_max,
|
||||
} gluniform_t;
|
||||
@@ -705,9 +703,6 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
|
||||
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
static boolean GLFramebuffer_IsFuncAvailible(void);
|
||||
#endif
|
||||
|
||||
void SetupGLFunc4(void)
|
||||
{
|
||||
@@ -740,7 +735,6 @@ void SetupGLFunc4(void)
|
||||
pglAttachShader = GetGLFunc("glAttachShader");
|
||||
pglLinkProgram = GetGLFunc("glLinkProgram");
|
||||
pglGetProgramiv = GetGLFunc("glGetProgramiv");
|
||||
pglGetProgramInfoLog = GetGLFunc("glGetProgramInfoLog");
|
||||
pglUseProgram = GetGLFunc("glUseProgram");
|
||||
pglUniform1i = GetGLFunc("glUniform1i");
|
||||
pglUniform1f = GetGLFunc("glUniform1f");
|
||||
@@ -765,8 +759,6 @@ void SetupGLFunc4(void)
|
||||
pglDeleteRenderbuffers = GetGLFunc("glDeleteRenderbuffers");
|
||||
pglRenderbufferStorage = GetGLFunc("glRenderbufferStorage");
|
||||
pglFramebufferRenderbuffer = GetGLFunc("glFramebufferRenderbuffer");
|
||||
|
||||
supportFBO = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -778,7 +770,9 @@ static boolean GLFramebuffer_IsFuncAvailible(void)
|
||||
if (majorGL < 3)
|
||||
return false;
|
||||
|
||||
return (isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions));
|
||||
return((isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions)) &&
|
||||
(isExtAvailable("GL_ARB_framebuffer_object",gl_extensions)) &&
|
||||
(isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions)));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -852,7 +846,7 @@ EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
||||
switch (info)
|
||||
{
|
||||
case HWD_SHADERINFO_LEVELTIME:
|
||||
shader_leveltime = (((float)(value-1)) + FIXED_TO_FLOAT(rendertimefrac)) / TICRATE;
|
||||
shader_leveltime = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1044,9 +1038,37 @@ EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
static void GLFramebuffer_GenerateAttachments(void)
|
||||
void GLFramebuffer_Generate(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Generate the framebuffer
|
||||
if (FramebufferObject == 0)
|
||||
pglGenFramebuffers(1, &FramebufferObject);
|
||||
|
||||
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
|
||||
GLFramebuffer_GenerateAttachments();
|
||||
}
|
||||
|
||||
void GLFramebuffer_Delete(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Unbind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
if (FramebufferObject)
|
||||
pglDeleteFramebuffers(1, &FramebufferObject);
|
||||
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
FramebufferObject = 0;
|
||||
}
|
||||
|
||||
void GLFramebuffer_GenerateAttachments(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Bind the framebuffer
|
||||
@@ -1087,12 +1109,11 @@ static void GLFramebuffer_GenerateAttachments(void)
|
||||
|
||||
void GLFramebuffer_DeleteAttachments(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Unbind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
if (FramebufferTexture)
|
||||
pglDeleteTextures(1, &FramebufferTexture);
|
||||
@@ -1104,43 +1125,9 @@ void GLFramebuffer_DeleteAttachments(void)
|
||||
RenderbufferObject = 0;
|
||||
}
|
||||
|
||||
static void GLFramebuffer_Generate(void)
|
||||
void GLFramebuffer_Enable(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
return;
|
||||
|
||||
// Generate the framebuffer
|
||||
if (FramebufferObject == 0)
|
||||
pglGenFramebuffers(1, &FramebufferObject);
|
||||
|
||||
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
|
||||
GLFramebuffer_GenerateAttachments();
|
||||
}
|
||||
|
||||
static void GLFramebuffer_Delete(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
return;
|
||||
|
||||
if (FramebufferObject)
|
||||
pglDeleteFramebuffers(1, &FramebufferObject);
|
||||
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
FramebufferObject = 0;
|
||||
}
|
||||
|
||||
inline void GLFramebuffer_Unbind(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
return;
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
inline void GLFramebuffer_Enable(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
if (FramebufferObject == 0)
|
||||
@@ -1154,13 +1141,11 @@ inline void GLFramebuffer_Enable(void)
|
||||
|
||||
void GLFramebuffer_Disable(void)
|
||||
{
|
||||
if (!supportFBO)
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
GLFramebuffer_Delete();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1849,9 +1834,7 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_end], (GLfloat)Surface->LightInfo.fade_end, pglUniform1f);
|
||||
}
|
||||
|
||||
UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f);
|
||||
|
||||
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], vid.width, vid.height, pglUniform2f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_leveltime], ((float)shader_leveltime) / TICRATE, pglUniform1f);
|
||||
|
||||
#undef UNIFORM_1
|
||||
#undef UNIFORM_2
|
||||
@@ -1867,7 +1850,6 @@ static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
GLint result;
|
||||
const GLchar *vert_shader = shader->vertex_shader;
|
||||
const GLchar *frag_shader = shader->fragment_shader;
|
||||
GLchar info_log[512];
|
||||
|
||||
if (shader->program)
|
||||
pglDeleteProgram(shader->program);
|
||||
@@ -1897,10 +1879,7 @@ static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
pglGetShaderiv(gl_vertShader, GL_COMPILE_STATUS, &result);
|
||||
if (result == GL_FALSE)
|
||||
{
|
||||
pglGetShaderInfoLog(gl_vertShader, 512, NULL, info_log);
|
||||
|
||||
GL_MSG_Error("Error compiling vertex shader: %s\n", info_log);
|
||||
|
||||
GL_MSG_Error("Error compiling vertex shader", gl_vertShader, i);
|
||||
pglDeleteShader(gl_vertShader);
|
||||
return false;
|
||||
}
|
||||
@@ -1927,9 +1906,7 @@ static boolean 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);
|
||||
|
||||
GL_MSG_Error("Error compiling fragment shader: %s\n", info_log);
|
||||
GL_MSG_Error("Error compiling fragment shader", gl_fragShader, i);
|
||||
pglDeleteShader(gl_vertShader);
|
||||
pglDeleteShader(gl_fragShader);
|
||||
return false;
|
||||
@@ -1955,8 +1932,7 @@ static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
// couldn't link?
|
||||
if (result != GL_TRUE)
|
||||
{
|
||||
pglGetProgramInfoLog(shader->program, 512, NULL, info_log);
|
||||
GL_MSG_Error("Shader_CompileProgram: Error linking shader program %s: %s\n", HWR_GetShaderName(i), info_log);
|
||||
GL_MSG_Error("Shader_CompileProgram: Error linking shader program %s\n", HWR_GetShaderName(i));
|
||||
pglDeleteProgram(shader->program);
|
||||
return false;
|
||||
}
|
||||
@@ -1977,8 +1953,6 @@ static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
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");
|
||||
|
||||
// misc.
|
||||
shader->uniforms[gluniform_leveltime] = GETUNI("leveltime");
|
||||
#undef GETUNI
|
||||
@@ -2353,6 +2327,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
#ifdef USE_FBO_OGL
|
||||
case HWD_SET_FRAMEBUFFER:
|
||||
FrameBufferEnabled = Value ? GL_TRUE : GL_FALSE;
|
||||
supportFBO = GLFramebuffer_IsFuncAvailible();
|
||||
|
||||
if (!supportFBO)
|
||||
{
|
||||
@@ -2984,8 +2959,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
// https://zdoom.org/wiki/Y-shearing
|
||||
if (shearing)
|
||||
{
|
||||
float dy = stransform->viewaiming * 2;
|
||||
if (stransform->flip || stransform->mirrorflip)
|
||||
float dy = FIXED_TO_FLOAT(AIMINGTODY((stransform->viewaiming)) * 2)* ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT); //screen_width/BASEVIDWIDTH;
|
||||
if (stransform->flip)
|
||||
dy *= -1.0f;
|
||||
pglTranslatef(0.0f, -dy/BASEVIDHEIGHT, 0.0f);
|
||||
}
|
||||
|
||||
@@ -105,9 +105,12 @@ static PFNglEnableClientState pglEnableClientState;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GLFramebuffer_Generate(void);
|
||||
void GLFramebuffer_Delete(void);
|
||||
|
||||
void GLFramebuffer_GenerateAttachments(void);
|
||||
void GLFramebuffer_DeleteAttachments(void);
|
||||
|
||||
void GLFramebuffer_Unbind(void);
|
||||
void GLFramebuffer_Enable(void);
|
||||
void GLFramebuffer_Disable(void);
|
||||
|
||||
|
||||
+1
-6
@@ -532,9 +532,7 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return NULL;
|
||||
|
||||
boolean ok = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
char *p = strstr(hms->buffer, "\n\n");
|
||||
|
||||
@@ -552,9 +550,6 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
if (!ok)
|
||||
return NULL;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
+277
-160
@@ -49,8 +49,6 @@
|
||||
#include "s_sound.h" // song credits
|
||||
#include "k_kart.h"
|
||||
|
||||
#include "m_textinput.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
@@ -88,8 +86,8 @@ patch_t *frameslash; // framerate stuff. Used in screen.c
|
||||
|
||||
static player_t *plr;
|
||||
boolean chat_on; // entering a chat message?
|
||||
static char w_chat_buf[HU_MAXMSGLEN + 1];
|
||||
static textinput_t w_chat;
|
||||
static char w_chat[HU_MAXMSGLEN + 1];
|
||||
static size_t c_input = 0; // let's try to make the chat input less shitty.
|
||||
static boolean headsupactive = false;
|
||||
boolean hu_showscores; // draw rankings
|
||||
static char hu_tick;
|
||||
@@ -596,10 +594,7 @@ void HU_AddChatText(const char *text, boolean playsound)
|
||||
if (OLDCHAT) // if we're using oldchat, print directly in console
|
||||
CONS_Printf("%s\n", text);
|
||||
else // if we aren't, still save the message to log.txt
|
||||
{
|
||||
CON_LogMessage(text);
|
||||
CON_LogMessage("\n"); // Add newline. Don't use va for that, since `text` might be refering to va's buffer itself
|
||||
}
|
||||
CON_LogMessage(va("%s\n", text));
|
||||
#else
|
||||
(void)playsound;
|
||||
CONS_Printf("%s\n", text);
|
||||
@@ -1145,6 +1140,71 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Handles key input and string input
|
||||
//
|
||||
static inline boolean HU_keyInChatString(char *s, char ch)
|
||||
{
|
||||
size_t l;
|
||||
|
||||
if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART])
|
||||
|| ch == ' ') // Allow spaces, of course
|
||||
{
|
||||
l = strlen(s);
|
||||
if (l < HU_MAXMSGLEN - 1)
|
||||
{
|
||||
if (c_input >= strlen(s)) // don't do anything complicated
|
||||
{
|
||||
s[l++] = ch;
|
||||
s[l]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// move everything past c_input for new characters:
|
||||
size_t m = HU_MAXMSGLEN-1;
|
||||
while (m>=c_input)
|
||||
{
|
||||
if (s[m])
|
||||
s[m+1] = (s[m]);
|
||||
if (m == 0) // prevent overflow
|
||||
break;
|
||||
m--;
|
||||
}
|
||||
s[c_input] = ch; // and replace this.
|
||||
}
|
||||
c_input++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (ch == KEY_BACKSPACE)
|
||||
{
|
||||
size_t i = c_input;
|
||||
|
||||
if (c_input <= 0)
|
||||
return false;
|
||||
|
||||
if (!s[i-1])
|
||||
return false;
|
||||
|
||||
if (i >= strlen(s)-1)
|
||||
{
|
||||
s[strlen(s)-1] = 0;
|
||||
c_input--;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (; (i < HU_MAXMSGLEN); i++)
|
||||
{
|
||||
s[i-1] = s[i];
|
||||
}
|
||||
c_input--;
|
||||
}
|
||||
else if (ch != KEY_ENTER)
|
||||
return false; // did not eat key
|
||||
|
||||
return true; // ate the key
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -1193,11 +1253,7 @@ void HU_Ticker(void)
|
||||
if (cechotimer > 0) --cechotimer;
|
||||
|
||||
// Animate the desynch dots
|
||||
if (hu_resynching
|
||||
#ifdef SATURNSYNCH
|
||||
|| hu_redownloadinggamestate
|
||||
#endif
|
||||
)
|
||||
if (hu_resynching)
|
||||
resynch_ticker++; //tic tic tic tic tic
|
||||
|
||||
HU_TickSongCredits();
|
||||
@@ -1217,9 +1273,9 @@ static boolean HU_clearChatSpaces(void)
|
||||
char c; // current character we're iterating.
|
||||
boolean nothingbutspaces = true;
|
||||
|
||||
for (; i < strlen(w_chat_buf); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
for (; i < strlen(w_chat); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
{
|
||||
c = w_chat_buf[i];
|
||||
c = w_chat[i];
|
||||
if (!c)
|
||||
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
|
||||
|
||||
@@ -1231,110 +1287,128 @@ static boolean HU_clearChatSpaces(void)
|
||||
return nothingbutspaces;
|
||||
}
|
||||
|
||||
static void HU_SendChatMessage(void)
|
||||
//
|
||||
//
|
||||
static void HU_queueChatChar(INT32 c)
|
||||
{
|
||||
char buf[2 + HU_MAXMSGLEN + 1];
|
||||
char *msg = &buf[2];
|
||||
size_t ci = 2;
|
||||
INT32 target = 0;
|
||||
char c;
|
||||
|
||||
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
|
||||
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
|
||||
|
||||
do {
|
||||
c = w_chat_buf[-2+ci++];
|
||||
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
||||
buf[ci-1]=c;
|
||||
} while (c);
|
||||
|
||||
M_TextInputClear(&w_chat);
|
||||
|
||||
// last minute mute check
|
||||
if (CHAT_MUTE)
|
||||
// send automaticly the message (no more chat char)
|
||||
if (c == KEY_ENTER)
|
||||
{
|
||||
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
|
||||
return;
|
||||
}
|
||||
char buf[2 + HU_MAXMSGLEN + 1];
|
||||
char *msg = &buf[2];
|
||||
size_t i;
|
||||
size_t ci = 2;
|
||||
INT32 target = 0;
|
||||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
const char *newmsg;
|
||||
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
|
||||
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
|
||||
|
||||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
do {
|
||||
c = w_chat[-2+ci++];
|
||||
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
||||
buf[ci-1]=c;
|
||||
} while (c);
|
||||
i = 0;
|
||||
for (;(i<HU_MAXMSGLEN);i++)
|
||||
w_chat[i] = 0; // reset this.
|
||||
|
||||
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
|
||||
if (teamtalk)
|
||||
c_input = 0;
|
||||
|
||||
for (;(i<HU_MAXMSGLEN);i++)
|
||||
w_chat[i] = 0; // reset this.
|
||||
|
||||
c_input = 0;
|
||||
|
||||
// last minute mute check
|
||||
if (CHAT_MUTE)
|
||||
{
|
||||
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
|
||||
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
spc = 0;
|
||||
// let it slide
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
const char *newmsg;
|
||||
|
||||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
|
||||
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
|
||||
if (teamtalk)
|
||||
{
|
||||
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
spc = 0;
|
||||
// let it slide
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
||||
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||
return;
|
||||
}
|
||||
|
||||
// we need to get rid of the /pm<node>
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||
}
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
if (ci > 3) // don't send target+flags+empty message.
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
if (teamtalk)
|
||||
buf[0] = -1; // target
|
||||
else
|
||||
buf[0] = target;
|
||||
|
||||
buf[1] = 0; // flags
|
||||
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
||||
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
|
||||
else
|
||||
{
|
||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||
return;
|
||||
}
|
||||
|
||||
// we need to get rid of the /pm<node>
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||
}
|
||||
if (ci > 3) // don't send target+flags+empty message.
|
||||
{
|
||||
if (teamtalk)
|
||||
buf[0] = -1; // target
|
||||
else
|
||||
buf[0] = target;
|
||||
|
||||
buf[1] = 0; // flags
|
||||
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void HU_clearChatChars(void)
|
||||
{
|
||||
M_TextInputClear(&w_chat);
|
||||
size_t i = 0;
|
||||
for (;i<HU_MAXMSGLEN;i++)
|
||||
w_chat[i] = 0; // reset this.
|
||||
chat_on = false;
|
||||
c_input = 0;
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
@@ -1382,8 +1456,7 @@ boolean HU_Responder(event_t *ev)
|
||||
&& netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
|
||||
{
|
||||
chat_on = true;
|
||||
w_chat_buf[0] = 0;
|
||||
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
|
||||
w_chat[0] = 0;
|
||||
teamtalk = false;
|
||||
chat_scrollmedown = true;
|
||||
typelines = 1;
|
||||
@@ -1393,8 +1466,7 @@ boolean HU_Responder(event_t *ev)
|
||||
&& netgame && !OLD_MUTE)
|
||||
{
|
||||
chat_on = true;
|
||||
w_chat_buf[0] = 0;
|
||||
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
|
||||
w_chat[0] = 0;
|
||||
teamtalk = G_GametypeHasTeams(); // Don't teamtalk if we don't have teams.
|
||||
chat_scrollmedown = true;
|
||||
typelines = 1;
|
||||
@@ -1419,13 +1491,62 @@ boolean HU_Responder(event_t *ev)
|
||||
&& ev->data1 != gamecontrol[gc_talkkey][1]))
|
||||
return false;
|
||||
|
||||
M_TextInputHandle(&w_chat, c);
|
||||
c = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(c) : CON_ShiftChar(c);
|
||||
|
||||
// pasting. pasting is cool. chat is a bit limited, though :(
|
||||
if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE)
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
size_t chatlen;
|
||||
size_t pastelen;
|
||||
|
||||
// create a dummy string real quickly
|
||||
|
||||
if (paste == NULL)
|
||||
return true;
|
||||
|
||||
chatlen = strlen(w_chat);
|
||||
pastelen = strlen(paste);
|
||||
if (chatlen+pastelen > HU_MAXMSGLEN)
|
||||
return true; // we can't paste this!!
|
||||
|
||||
if (c_input >= strlen(w_chat)) // add it at the end of the string.
|
||||
{
|
||||
memcpy(&w_chat[chatlen], paste, pastelen); // copy all of that.
|
||||
c_input += pastelen;
|
||||
/*size_t i = 0;
|
||||
for (;i<pastelen;i++)
|
||||
{
|
||||
HU_queueChatChar(paste[i]); // queue it so that it's actually sent. (this chat write thing is REALLY messy.)
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
else // otherwise, we need to shift everything and make space, etc etc
|
||||
{
|
||||
size_t i = HU_MAXMSGLEN-1;
|
||||
while (i >= c_input)
|
||||
{
|
||||
if (w_chat[i])
|
||||
w_chat[i+pastelen] = w_chat[i];
|
||||
if (i == 0) // prevent overflow
|
||||
break;
|
||||
i--;
|
||||
}
|
||||
memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
|
||||
c_input += pastelen;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CHAT_MUTE && HU_keyInChatString(w_chat,c))
|
||||
{
|
||||
HU_queueChatChar(c);
|
||||
}
|
||||
if (c == KEY_ENTER)
|
||||
{
|
||||
chat_on = false;
|
||||
c_input = 0; // reset input cursor
|
||||
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
|
||||
HU_SendChatMessage();
|
||||
}
|
||||
else if (c == KEY_ESCAPE
|
||||
|| ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1]
|
||||
@@ -1433,6 +1554,7 @@ boolean HU_Responder(event_t *ev)
|
||||
&& c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle.
|
||||
{
|
||||
chat_on = false;
|
||||
c_input = 0; // reset input cursor
|
||||
}
|
||||
else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS!
|
||||
{
|
||||
@@ -1446,6 +1568,10 @@ boolean HU_Responder(event_t *ev)
|
||||
justscrolleddown = true;
|
||||
chat_scrolltime = 4;
|
||||
}
|
||||
else if (c == KEY_LEFTARROW && c_input != 0 && !OLDCHAT) // i said go back
|
||||
c_input--;
|
||||
else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat) && !OLDCHAT) // don't need to check for admin or w/e here since the chat won't ever contain anything if it's muted.
|
||||
c_input++;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -1799,9 +1925,8 @@ static void HU_DrawChat(void)
|
||||
INT32 charwidth = 4, charheight = 6;
|
||||
INT32 boxw = cv_chatwidth.value;
|
||||
INT32 t = 0, c = 0, y = chaty - (typelines*charheight);
|
||||
UINT32 i = 0, saylen = strlen(w_chat_buf); // You learn new things everyday!
|
||||
UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday!
|
||||
INT32 cflag = 0;
|
||||
size_t select_start = 0, select_end = 0;
|
||||
const char *ntalk = "Say: ", *ttalk = "Team: ";
|
||||
const char *talk = ntalk;
|
||||
const char *mute = "Chat has been muted.";
|
||||
@@ -1863,19 +1988,13 @@ static void HU_DrawChat(void)
|
||||
i = 0;
|
||||
typelines = 1;
|
||||
|
||||
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
|
||||
V_DrawChatCharacter(chatx+2+c+charwidth*w_chat.cursor, y+1, '_'|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawChatCharacter(chatx + 2 + c, y+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||
|
||||
if (w_chat.select != w_chat.cursor)
|
||||
{
|
||||
select_start = min(w_chat.select, w_chat.cursor);
|
||||
select_end = max(w_chat.select, w_chat.cursor);
|
||||
}
|
||||
|
||||
while (w_chat_buf[i])
|
||||
while (w_chat[i])
|
||||
{
|
||||
boolean skippedline = false;
|
||||
if (w_chat.cursor == (i+1))
|
||||
if (c_input == (i+1))
|
||||
{
|
||||
INT32 cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
|
||||
INT32 cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
|
||||
@@ -1890,14 +2009,10 @@ static void HU_DrawChat(void)
|
||||
}
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat_buf[i] >= HU_FONTSTART)
|
||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat_buf[i] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
|
||||
|
||||
// Draw selection
|
||||
if (i >= select_start && i < select_end)
|
||||
V_DrawFill(chatx + c + 2, y-1, charwidth, charheight, 103|V_TRANSLUCENT|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t);
|
||||
|
||||
++i;
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
++i;
|
||||
else
|
||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
|
||||
|
||||
c += charwidth;
|
||||
if (c > boxw-(charwidth*2) && !skippedline)
|
||||
@@ -1909,7 +2024,7 @@ static void HU_DrawChat(void)
|
||||
}
|
||||
|
||||
// handle /pm list. It's messy, horrible and I don't care.
|
||||
if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
||||
if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
||||
{
|
||||
INT32 count = 0;
|
||||
INT32 p_dispy = chaty - charheight -1;
|
||||
@@ -1929,38 +2044,38 @@ static void HU_DrawChat(void)
|
||||
{
|
||||
|
||||
// filter: (code needs optimization pls help I'm bad with C)
|
||||
if (w_chat_buf[3])
|
||||
if (w_chat[3])
|
||||
{
|
||||
char *nodenum;
|
||||
UINT32 n;
|
||||
// right, that's half important: (w_chat_buf[4] may be a space since /pm0 msg is perfectly acceptable!)
|
||||
if ( ( ((w_chat_buf[3] != 0) && ((w_chat_buf[3] < '0') || (w_chat_buf[3] > '9'))) || ((w_chat_buf[4] != 0) && (((w_chat_buf[4] < '0') || (w_chat_buf[4] > '9'))))) && (w_chat_buf[4] != ' '))
|
||||
// right, that's half important: (w_chat[4] may be a space since /pm0 msg is perfectly acceptable!)
|
||||
if ( ( ((w_chat[3] != 0) && ((w_chat[3] < '0') || (w_chat[3] > '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' '))
|
||||
break;
|
||||
|
||||
|
||||
nodenum = (char*) malloc(3);
|
||||
memcpy(nodenum, w_chat_buf+3, 2);
|
||||
memcpy(nodenum, w_chat+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
n = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
// special cases:
|
||||
|
||||
if ((n == 0) && !(w_chat_buf[4] == '0'))
|
||||
if ((n == 0) && !(w_chat[4] == '0'))
|
||||
{
|
||||
if (!(i<10))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 1) && !(w_chat_buf[3] == '0'))
|
||||
else if ((n == 1) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 1) || ((i >= 10) && (i <= 19))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 2) && !(w_chat_buf[3] == '0'))
|
||||
else if ((n == 2) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 2) || ((i >= 20) && (i <= 29))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 3) && !(w_chat_buf[3] == '0'))
|
||||
else if ((n == 3) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 3) || ((i >= 30) && (i <= 31))))
|
||||
continue;
|
||||
@@ -1999,7 +2114,6 @@ static void HU_DrawChat_Old(void)
|
||||
size_t i = 0;
|
||||
const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
|
||||
const char *talk = ntalk;
|
||||
size_t select_start = 0, select_end = 0;
|
||||
INT32 charwidth = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
INT32 charheight = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
|
||||
if (teamtalk)
|
||||
@@ -2028,19 +2142,14 @@ static void HU_DrawChat_Old(void)
|
||||
c += charwidth;
|
||||
}
|
||||
|
||||
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX+c+charwidth*w_chat.cursor, y+2*con_scalefactor, '_'|cv_constextsize.value|V_NOSCALESTART|t, !cv_allcaps.value);
|
||||
|
||||
if (w_chat.select != w_chat.cursor)
|
||||
{
|
||||
select_start = min(w_chat.select, w_chat.cursor);
|
||||
select_end = max(w_chat.select, w_chat.cursor);
|
||||
}
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX+c, y+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, !cv_allcaps.value);
|
||||
|
||||
i = 0;
|
||||
while (w_chat_buf[i])
|
||||
while (w_chat[i])
|
||||
{
|
||||
if (w_chat.cursor == (i+1) && hu_tick < 4)
|
||||
|
||||
if (c_input == (i+1) && hu_tick < 4)
|
||||
{
|
||||
INT32 cursorx = (HU_INPUTX+c+charwidth < vid.width) ? (HU_INPUTX + c + charwidth) : (HU_INPUTX); // we may have to go down.
|
||||
INT32 cursory = (cursorx != HU_INPUTX) ? (y) : (y+charheight);
|
||||
@@ -2048,18 +2157,17 @@ static void HU_DrawChat_Old(void)
|
||||
}
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat_buf[i] >= HU_FONTSTART)
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
{
|
||||
++i;
|
||||
//charwidth = 4 * con_scalefactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
//charwidth = SHORT(hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat_buf[i] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
|
||||
}
|
||||
|
||||
// Draw selection
|
||||
if (i >= select_start && i < select_end)
|
||||
V_DrawFill(HU_INPUTX + c, y, charwidth, charheight, 103|V_TRANSLUCENT|cv_constextsize.value|V_NOSCALESTART|t);
|
||||
|
||||
++i;
|
||||
|
||||
c += charwidth;
|
||||
if (c >= vid.width)
|
||||
{
|
||||
@@ -2310,11 +2418,7 @@ void HU_Drawer(void)
|
||||
HU_DrawSongCredits();
|
||||
|
||||
// draw desynch text
|
||||
if (hu_resynching
|
||||
#ifdef SATURNSYNCH
|
||||
|| hu_redownloadinggamestate
|
||||
#endif
|
||||
)
|
||||
if (hu_resynching)
|
||||
{
|
||||
char resynch_text[14];
|
||||
UINT32 i;
|
||||
@@ -2633,14 +2737,10 @@ static void HU_DrawRankings(void)
|
||||
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametype_cons_t[gametype].strvalue);
|
||||
|
||||
// draw the current map in the lower right if theres none just say its unknown
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
if (!maptitle)
|
||||
if (!G_BuildMapTitle(gamemap))
|
||||
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "UNKNOWN");
|
||||
else
|
||||
{
|
||||
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, maptitle);
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, G_BuildMapTitle(gamemap));
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
@@ -2690,6 +2790,18 @@ static void HU_DrawRankings(void)
|
||||
V_DrawCenteredString(256, 16, hilicol, va("%d", cv_pointlimit.value));
|
||||
}
|
||||
}
|
||||
/*else if (gametype == GT_COOP)
|
||||
{
|
||||
INT32 totalscore = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
totalscore += players[i].score;
|
||||
}
|
||||
|
||||
V_DrawCenteredString(256, 8, 0, "TOTAL SCORE");
|
||||
V_DrawCenteredString(256, 16, 0, va("%u", totalscore));
|
||||
}*/
|
||||
else
|
||||
{
|
||||
if (circuitmap)
|
||||
@@ -2762,7 +2874,12 @@ static void HU_DrawRankings(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*if (G_GametypeHasTeams())
|
||||
HU_DrawTeamTabRankings(tab, whiteplayer); //separate function for Spazzo's silly request -- gotta fix this up later
|
||||
else if (scorelines > 10)*/
|
||||
HU_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, whiteplayer, hilicol);
|
||||
/*else
|
||||
HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/
|
||||
|
||||
// draw spectators in a ticker across the bottom
|
||||
if (netgame && G_GametypeHasSpectators())
|
||||
|
||||
+20
@@ -34,6 +34,7 @@
|
||||
#define NO_BAN_TIME (time_t)(-1)
|
||||
|
||||
extern INT16 hardware_MAXPACKETLENGTH;
|
||||
extern INT32 net_bandwidth; // in byte/s
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
@@ -41,17 +42,36 @@ extern INT16 hardware_MAXPACKETLENGTH;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/// Supposed to be DOOMCOM_ID
|
||||
INT32 id;
|
||||
|
||||
/// SRB2 executes an INT32 to execute commands.
|
||||
INT16 intnum;
|
||||
/// Communication between SRB2 and the driver.
|
||||
/// Is CMD_SEND or CMD_GET.
|
||||
INT16 command;
|
||||
/// Is dest for send, set by get (-1 = no packet).
|
||||
INT16 remotenode;
|
||||
|
||||
/// Number of bytes in doomdata to be sent
|
||||
INT16 datalength;
|
||||
|
||||
/// Info common to all nodes.
|
||||
/// Console is always node 0.
|
||||
INT16 numnodes;
|
||||
/// Flag: 1 = no duplication, 2-5 = dup for slow nets.
|
||||
INT16 ticdup;
|
||||
/// Flag: 1 = send a backup tic in every packet.
|
||||
INT16 extratics;
|
||||
/// kind of game
|
||||
INT16 gametype;
|
||||
/// Flag: -1 = new game, 0-5 = load savegame
|
||||
INT16 savegame;
|
||||
/// currect map
|
||||
INT16 map;
|
||||
|
||||
/// Info specific to this node.
|
||||
INT16 consoleplayer;
|
||||
/// Number of "slots": the highest player number in use plus one.
|
||||
INT16 numslots;
|
||||
|
||||
|
||||
@@ -159,6 +159,7 @@ boolean I_SetSongPosition(UINT32 position);
|
||||
UINT32 I_GetSongPosition(void);
|
||||
|
||||
void I_UpdateSongLagThreshold (void);
|
||||
void I_UpdateSongLagConditions (void);
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PLAYBACK
|
||||
|
||||
@@ -34,9 +34,6 @@ extern UINT8 graphics_started;
|
||||
*/
|
||||
extern UINT8 keyboard_started;
|
||||
|
||||
/** \brief Set to true when inside a signal handler that will exit the program. */
|
||||
extern boolean g_in_exiting_signal_handler;
|
||||
|
||||
/** \brief The I_GetFreeMem function
|
||||
|
||||
\param total total memory in the system
|
||||
@@ -230,9 +227,6 @@ INT32 I_NumJoys(void);
|
||||
*/
|
||||
const char *I_GetJoyName(INT32 joyindex);
|
||||
|
||||
void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||
void I_SetGamepadIndicatorColor(INT32 device_id, UINT8 red, UINT8 green, UINT8 blue);
|
||||
|
||||
#ifndef NOMUMBLE
|
||||
#include "p_mobj.h" // mobj_t
|
||||
#include "s_sound.h" // listener_t
|
||||
|
||||
+9
-22
@@ -100,14 +100,6 @@
|
||||
#undef ETIMEDOUT
|
||||
#endif
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#ifdef EHOSTUNREACH
|
||||
#undef EHOSTUNREACH
|
||||
#endif
|
||||
#define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
#ifdef ENETUNREACH
|
||||
#undef ENETUNREACH
|
||||
#endif
|
||||
#define ENETUNREACH WSAENETUNREACH
|
||||
#ifndef IOC_VENDOR
|
||||
#define IOC_VENDOR 0x18000000
|
||||
#endif
|
||||
@@ -824,8 +816,6 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr
|
||||
return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d);
|
||||
}
|
||||
|
||||
#define ALLOWEDERROR(x) ((x) == ECONNREFUSED || (x) == EWOULDBLOCK || (x) == EHOSTUNREACH || (x) == ENETUNREACH)
|
||||
|
||||
static void SOCK_Send(void)
|
||||
{
|
||||
ssize_t c = ERRSOCKET;
|
||||
@@ -841,11 +831,7 @@ static void SOCK_Send(void)
|
||||
for (j = 0; j < broadcastaddresses; j++)
|
||||
{
|
||||
if (myfamily[i] == broadcastaddress[j].any.sa_family)
|
||||
{
|
||||
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
|
||||
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
|
||||
break;
|
||||
}
|
||||
SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -855,11 +841,7 @@ static void SOCK_Send(void)
|
||||
for (i = 0; i < mysocketses; i++)
|
||||
{
|
||||
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
|
||||
{
|
||||
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
|
||||
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
|
||||
break;
|
||||
}
|
||||
SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -871,12 +853,11 @@ static void SOCK_Send(void)
|
||||
if (c == ERRSOCKET)
|
||||
{
|
||||
int e = errno; // save error code so it can't be modified later
|
||||
if (!ALLOWEDERROR(e))
|
||||
if (e != ECONNREFUSED && e != EWOULDBLOCK)
|
||||
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
|
||||
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||
}
|
||||
}
|
||||
#undef ALLOWEDERROR
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
@@ -1711,6 +1692,8 @@ boolean I_InitTcpNetwork(void)
|
||||
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
|
||||
if (dedicated)
|
||||
doomcom->numnodes = 0;
|
||||
/* else if (M_IsNextParm())
|
||||
doomcom->numnodes = (INT16)atoi(M_GetNextParm());*/
|
||||
else
|
||||
doomcom->numnodes = 1;
|
||||
|
||||
@@ -1724,6 +1707,7 @@ boolean I_InitTcpNetwork(void)
|
||||
// FIXME:
|
||||
// ??? and now ?
|
||||
// server on a big modem ??? 4*isdn
|
||||
net_bandwidth = 16000;
|
||||
hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
|
||||
|
||||
ret = true;
|
||||
@@ -1754,6 +1738,7 @@ boolean I_InitTcpNetwork(void)
|
||||
// so we're on a LAN
|
||||
COM_BufAddText("connect any\n");
|
||||
|
||||
net_bandwidth = 800000;
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
}
|
||||
}
|
||||
@@ -1778,6 +1763,8 @@ boolean I_InitTcpNetwork(void)
|
||||
{
|
||||
// so we're on a LAN
|
||||
COM_BufAddText("connect any\n");
|
||||
|
||||
net_bandwidth = 800000;
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,10 +140,6 @@ UINT32 I_GetRefreshRate(void);
|
||||
boolean I_UseNativeKeyboard(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
extern boolean xwaylandcrap;
|
||||
#endif
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
void I_DownSample(void);
|
||||
extern boolean downsample;
|
||||
|
||||
+10
-10
@@ -1822,7 +1822,7 @@ state_t states[NUMSTATES] =
|
||||
|
||||
// Rain
|
||||
{SPR_RAIN, FF_TRANS50, -1, {NULL}, 0, 0, S_NULL}, // S_RAIN1
|
||||
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_RAINRETURN
|
||||
{SPR_RAIN, FF_TRANS50, 1, {NULL}, 0, 0, S_RAIN1}, // S_RAINRETURN
|
||||
|
||||
// Snowflake
|
||||
{SPR_SNO1, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SNOW1
|
||||
@@ -1841,9 +1841,9 @@ state_t states[NUMSTATES] =
|
||||
{SPR_SPLH, FF_TRANS50|8, 2, {NULL}, 0, 0, S_NULL}, // S_SPLISH9
|
||||
|
||||
// Water Splash
|
||||
{SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1
|
||||
{SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2
|
||||
{SPR_SPLA, FF_TRANS90|2, 3, {NULL}, 0, 0, S_NULL}, // S_SPLASH3
|
||||
{SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1
|
||||
{SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2
|
||||
{SPR_SPLA, FF_TRANS90|2, 3, {NULL}, 0, 0, S_RAINRETURN}, // S_SPLASH3
|
||||
|
||||
// Smoke
|
||||
{SPR_SMOK, FF_TRANS50 , 4, {NULL}, 0, 0, S_SMOKE2}, // S_SMOKE1
|
||||
@@ -11198,22 +11198,22 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||
S_RAIN1, // spawnstate
|
||||
1000, // spawnhealth
|
||||
S_NULL, // seestate
|
||||
sfx_rainin, // seesound
|
||||
0, // reactiontime
|
||||
sfx_None, // seesound
|
||||
8, // reactiontime
|
||||
sfx_None, // attacksound
|
||||
S_NULL, // painstate
|
||||
0, // painchance
|
||||
sfx_None, // painsound
|
||||
S_NULL, // meleestate
|
||||
S_NULL, // missilestate
|
||||
S_SPLASH1, // deathstate
|
||||
S_NULL, // deathstate
|
||||
S_NULL, // xdeathstate
|
||||
sfx_None, // deathsound
|
||||
-72*FRACUNIT, // speed -- -24*FRACUNIT originally, srb2kart x3 (nya)
|
||||
1*FRACUNIT, // radius
|
||||
8*FRACUNIT, // height
|
||||
0, // display offset
|
||||
80, // mass
|
||||
4, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOBLOCKMAP, // flags
|
||||
@@ -11226,7 +11226,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||
1000, // spawnhealth
|
||||
S_NULL, // seestate
|
||||
sfx_None, // seesound
|
||||
0, // reactiontime
|
||||
8, // reactiontime
|
||||
sfx_None, // attacksound
|
||||
S_NULL, // painstate
|
||||
0, // painchance
|
||||
@@ -11240,7 +11240,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||
4*FRACUNIT, // radius
|
||||
4*FRACUNIT, // height
|
||||
0, // display offset
|
||||
0, // mass
|
||||
4, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOBLOCKMAP, // flags
|
||||
|
||||
+203
-430
@@ -22,438 +22,211 @@
|
||||
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
|
||||
// For great modding!!
|
||||
|
||||
/** Action pointer for reading actions from Dehacked lumps.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
actionf_t action; ///< Function pointer corresponding to the actual action.
|
||||
const char *name; ///< Name of the action in ALL CAPS.
|
||||
} actionpointer_t;
|
||||
|
||||
/** Array mapping action names to action functions.
|
||||
* Names must be in ALL CAPS for case insensitive comparisons.
|
||||
*/
|
||||
extern actionpointer_t actionpointers[];
|
||||
|
||||
// IMPORTANT!
|
||||
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONPOINTERS ARRAY IN DEHACKED.C
|
||||
enum actionnum
|
||||
{
|
||||
A_EXPLODE = 0,
|
||||
A_PAIN,
|
||||
A_FALL,
|
||||
A_MONITORPOP,
|
||||
A_LOOK,
|
||||
A_CHASE,
|
||||
A_FACESTABCHASE,
|
||||
A_FACETARGET,
|
||||
A_FACETRACER,
|
||||
A_SCREAM,
|
||||
A_BOSSDEATH,
|
||||
A_CUSTOMPOWER,
|
||||
A_GIVEWEAPON,
|
||||
A_RINGSHIELD,
|
||||
A_RINGBOX,
|
||||
A_INVINCIBILITY,
|
||||
A_SUPERSNEAKERS,
|
||||
A_BUNNYHOP,
|
||||
A_BUBBLESPAWN,
|
||||
A_FANBUBBLESPAWN,
|
||||
A_BUBBLERISE,
|
||||
A_BUBBLECHECK,
|
||||
A_AWARDSCORE,
|
||||
A_EXTRALIFE,
|
||||
A_BOMBSHIELD,
|
||||
A_JUMPSHIELD,
|
||||
A_WATERSHIELD,
|
||||
A_FORCESHIELD,
|
||||
A_PITYSHIELD,
|
||||
A_GRAVITYBOX,
|
||||
A_SCORERISE,
|
||||
A_PARTICLESPAWN,
|
||||
A_ATTRACTCHASE,
|
||||
A_DROPMINE,
|
||||
A_FISHJUMP,
|
||||
A_THROWNRING,
|
||||
A_GRENADERING, // SRB2kart
|
||||
A_SETSOLIDSTEAM,
|
||||
A_UNSETSOLIDSTEAM,
|
||||
A_SIGNPLAYER,
|
||||
A_OVERLAYTHINK,
|
||||
A_JETCHASE,
|
||||
A_JETBTHINK,
|
||||
A_JETGTHINK,
|
||||
A_JETGSHOOT,
|
||||
A_SHOOTBULLET,
|
||||
A_MINUSDIGGING,
|
||||
A_MINUSPOPUP,
|
||||
A_MINUSCHECK,
|
||||
A_CHICKENCHECK,
|
||||
A_MOUSETHINK,
|
||||
A_DETONCHASE,
|
||||
A_CAPECHASE,
|
||||
A_ROTATESPIKEBALL,
|
||||
A_SLINGAPPEAR,
|
||||
A_MACEROTATE,
|
||||
A_UNIDUSBALL,
|
||||
A_ROCKSPAWN,
|
||||
A_SETFUSE,
|
||||
A_CRAWLACOMMANDERTHINK,
|
||||
A_SMOKETRAILER,
|
||||
A_RINGEXPLODE,
|
||||
A_OLDRINGEXPLODE,
|
||||
A_MIXUP,
|
||||
A_RECYCLEPOWERS,
|
||||
A_BOSS1CHASE,
|
||||
A_FOCUSTARGET,
|
||||
A_BOSS2CHASE,
|
||||
A_BOSS2POGO,
|
||||
A_BOSSZOOM,
|
||||
A_BOSSSCREAM,
|
||||
A_BOSS2TAKEDAMAGE,
|
||||
A_BOSS7CHASE,
|
||||
A_GOOPSPLAT,
|
||||
A_BOSS2POGOSFX,
|
||||
A_BOSS2POGOTARGET,
|
||||
A_BOSSJETFUME,
|
||||
A_EGGMANBOX,
|
||||
A_TURRETFIRE,
|
||||
A_SUPERTURRETFIRE,
|
||||
A_TURRETSTOP,
|
||||
A_JETJAWROAM,
|
||||
A_JETJAWCHOMP,
|
||||
A_POINTYTHINK,
|
||||
A_CHECKBUDDY,
|
||||
A_HOODTHINK,
|
||||
A_ARROWCHECK,
|
||||
A_SNAILERTHINK,
|
||||
A_SHARPCHASE,
|
||||
A_SHARPSPIN,
|
||||
A_VULTUREVTOL,
|
||||
A_VULTURECHECK,
|
||||
A_SKIMCHASE,
|
||||
A_1UPTHINKER,
|
||||
A_SKULLATTACK,
|
||||
A_LOBSHOT,
|
||||
A_FIRESHOT,
|
||||
A_SUPERFIRESHOT,
|
||||
A_BOSSFIRESHOT,
|
||||
A_BOSS7FIREMISSILES,
|
||||
A_BOSS1LASER,
|
||||
A_BOSS4REVERSE,
|
||||
A_BOSS4SPEEDUP,
|
||||
A_BOSS4RAISE,
|
||||
A_SPARKFOLLOW,
|
||||
A_BUZZFLY,
|
||||
A_GUARDCHASE,
|
||||
A_EGGSHIELD,
|
||||
A_SETREACTIONTIME,
|
||||
A_BOSS1SPIKEBALLS,
|
||||
A_BOSS3TAKEDAMAGE,
|
||||
A_BOSS3PATH,
|
||||
A_LINEDEFEXECUTE,
|
||||
A_PLAYSEESOUND,
|
||||
A_PLAYATTACKSOUND,
|
||||
A_PLAYACTIVESOUND,
|
||||
A_SPAWNOBJECTABSOLUTE,
|
||||
A_SPAWNOBJECTRELATIVE,
|
||||
A_CHANGEANGLERELATIVE,
|
||||
A_CHANGEANGLEABSOLUTE,
|
||||
A_ROLLANGLE,
|
||||
A_CHANGEROLLANGLERELATIVE,
|
||||
A_CHANGEROLLANGLEABSOLUTE,
|
||||
A_PLAYSOUND,
|
||||
A_FINDTARGET,
|
||||
A_FINDTRACER,
|
||||
A_SETTICS,
|
||||
A_SETRANDOMTICS,
|
||||
A_CHANGECOLORRELATIVE,
|
||||
A_CHANGECOLORABSOLUTE,
|
||||
A_MOVERELATIVE,
|
||||
A_MOVEABSOLUTE,
|
||||
A_THRUST,
|
||||
A_ZTHRUST,
|
||||
A_SETTARGETSTARGET,
|
||||
A_SETOBJECTFLAGS,
|
||||
A_SETOBJECTFLAGS2,
|
||||
A_RANDOMSTATE,
|
||||
A_RANDOMSTATERANGE,
|
||||
A_DUALACTION,
|
||||
A_REMOTEACTION,
|
||||
A_TOGGLEFLAMEJET,
|
||||
A_ITEMPOP, // SRB2kart
|
||||
A_JAWZCHASE, // SRB2kart
|
||||
A_JAWZEXPLODE, // SRB2kart
|
||||
A_SPBCHASE, // SRB2kart
|
||||
A_MINEEXPLODE, // SRB2kart
|
||||
A_BALLHOGEXPLODE, // SRB2kart
|
||||
A_LIGHTNINGFOLLOWPLAYER, //SRB2kart
|
||||
A_FZBOOMFLASH, //SRB2kart
|
||||
A_FZBOOMSMOKE, //SRB2kart
|
||||
A_RANDOMSHADOWFRAME, //SRB2kart
|
||||
A_ROAMINGSHADOWTHINKER, //SRB2kart
|
||||
A_MAYONAKAARROW, //SRB2kart
|
||||
A_REAPERTHINKER, //SRB2kart
|
||||
A_MEMENTOSTPPARTICLES, //SRB2kart
|
||||
A_FLAMEPARTICLE, // SRB2kart
|
||||
A_ORBITNIGHTS,
|
||||
A_GHOSTME,
|
||||
A_SETOBJECTSTATE,
|
||||
A_SETOBJECTTYPESTATE,
|
||||
A_KNOCKBACK,
|
||||
A_PUSHAWAY,
|
||||
A_RINGDRAIN,
|
||||
A_SPLITSHOT,
|
||||
A_MISSILESPLIT,
|
||||
A_MULTISHOT,
|
||||
A_INSTALOOP,
|
||||
A_CUSTOM3DROTATE,
|
||||
A_SEARCHFORPLAYERS,
|
||||
A_CHECKRANDOM,
|
||||
A_CHECKTARGETRINGS,
|
||||
A_CHECKRINGS,
|
||||
A_CHECKTOTALRINGS,
|
||||
A_CHECKHEALTH,
|
||||
A_CHECKRANGE,
|
||||
A_CHECKHEIGHT,
|
||||
A_CHECKTRUERANGE,
|
||||
A_CHECKTHINGCOUNT,
|
||||
A_CHECKAMBUSH,
|
||||
A_CHECKCUSTOMVALUE,
|
||||
A_CHECKCUSVALMEMO,
|
||||
A_SETCUSTOMVALUE,
|
||||
A_USECUSVALMEMO,
|
||||
A_RELAYCUSTOMVALUE,
|
||||
A_CUSVALACTION,
|
||||
A_FORCESTOP,
|
||||
A_FORCEWIN,
|
||||
A_SPIKERETRACT,
|
||||
A_INFOSTATE,
|
||||
A_REPEAT,
|
||||
A_SETSCALE,
|
||||
A_REMOTEDAMAGE,
|
||||
A_HOMINGCHASE,
|
||||
A_TRAPSHOT,
|
||||
A_VILETARGET,
|
||||
A_VILEATTACK,
|
||||
A_VILEFIRE,
|
||||
A_BRAKCHASE,
|
||||
A_BRAKFIRESHOT,
|
||||
A_BRAKLOBSHOT,
|
||||
A_NAPALMSCATTER,
|
||||
A_SPAWNFRESHCOPY,
|
||||
NUMACTIONS
|
||||
};
|
||||
|
||||
struct mobj_s;
|
||||
|
||||
// IMPORTANT NOTE: If you add/remove from this list of action
|
||||
// functions, don't forget to update them in dehacked.c!
|
||||
void A_Explode(struct mobj_s *actor);
|
||||
void A_Pain(struct mobj_s *actor);
|
||||
void A_Fall(struct mobj_s *actor);
|
||||
void A_MonitorPop(struct mobj_s *actor);
|
||||
void A_Look(struct mobj_s *actor);
|
||||
void A_Chase(struct mobj_s *actor);
|
||||
void A_FaceStabChase(struct mobj_s *actor);
|
||||
void A_FaceTarget(struct mobj_s *actor);
|
||||
void A_FaceTracer(struct mobj_s *actor);
|
||||
void A_Scream(struct mobj_s *actor);
|
||||
void A_BossDeath(struct mobj_s *actor);
|
||||
void A_CustomPower(struct mobj_s *actor); // Use this for a custom power
|
||||
void A_GiveWeapon(struct mobj_s *actor); // Gives the player weapon(s)
|
||||
void A_JumpShield(struct mobj_s *actor); // Obtained Jump Shield
|
||||
void A_RingShield(struct mobj_s *actor); // Obtained Ring Shield
|
||||
void A_RingBox(struct mobj_s *actor); // Obtained Ring Box Tails
|
||||
void A_Invincibility(struct mobj_s *actor); // Obtained Invincibility Box
|
||||
void A_SuperSneakers(struct mobj_s *actor); // Obtained Super Sneakers Box
|
||||
void A_BunnyHop(struct mobj_s *actor); // have bunny hop tails
|
||||
void A_BubbleSpawn(struct mobj_s *actor); // Randomly spawn bubbles
|
||||
void A_FanBubbleSpawn(struct mobj_s *actor);
|
||||
void A_BubbleRise(struct mobj_s *actor); // Bubbles float to surface
|
||||
void A_BubbleCheck(struct mobj_s *actor); // Don't draw if not underwater
|
||||
void A_AwardScore(struct mobj_s *actor);
|
||||
void A_ExtraLife(struct mobj_s *actor); // Extra Life
|
||||
void A_BombShield(struct mobj_s *actor); // Obtained Bomb Shield
|
||||
void A_WaterShield(struct mobj_s *actor); // Obtained Water Shield
|
||||
void A_ForceShield(struct mobj_s *actor); // Obtained Force Shield
|
||||
void A_PityShield(struct mobj_s *actor); // Obtained Pity Shield. We're... sorry.
|
||||
void A_GravityBox(struct mobj_s *actor);
|
||||
void A_ScoreRise(struct mobj_s *actor); // Rise the score logo
|
||||
void A_ParticleSpawn(struct mobj_s *actor);
|
||||
void A_AttractChase(struct mobj_s *actor); // Ring Chase
|
||||
void A_DropMine(struct mobj_s *actor); // Drop Mine from Skim or Jetty-Syn Bomber
|
||||
void A_FishJump(struct mobj_s *actor); // Fish Jump
|
||||
void A_ThrownRing(struct mobj_s *actor); // Sparkle trail for red ring
|
||||
void A_GrenadeRing(struct mobj_s *actor); // SRB2kart
|
||||
void A_SetSolidSteam(struct mobj_s *actor);
|
||||
void A_UnsetSolidSteam(struct mobj_s *actor);
|
||||
void A_SignPlayer(struct mobj_s *actor);
|
||||
void A_OverlayThink(struct mobj_s *actor);
|
||||
void A_JetChase(struct mobj_s *actor);
|
||||
void A_JetbThink(struct mobj_s *actor); // Jetty-Syn Bomber Thinker
|
||||
void A_JetgThink(struct mobj_s *actor); // Jetty-Syn Gunner Thinker
|
||||
void A_JetgShoot(struct mobj_s *actor); // Jetty-Syn Shoot Function
|
||||
void A_ShootBullet(struct mobj_s *actor); // JetgShoot without reactiontime setting
|
||||
void A_MinusDigging(struct mobj_s *actor);
|
||||
void A_MinusPopup(struct mobj_s *actor);
|
||||
void A_MinusCheck(struct mobj_s *actor);
|
||||
void A_ChickenCheck(struct mobj_s *actor);
|
||||
void A_MouseThink(struct mobj_s *actor); // Mouse Thinker
|
||||
void A_DetonChase(struct mobj_s *actor); // Deton Chaser
|
||||
void A_CapeChase(struct mobj_s *actor); // Fake little Super Sonic cape
|
||||
void A_RotateSpikeBall(struct mobj_s *actor); // Spike ball rotation
|
||||
void A_SlingAppear(struct mobj_s *actor);
|
||||
void A_MaceRotate(struct mobj_s *actor);
|
||||
void A_UnidusBall(struct mobj_s *actor);
|
||||
void A_RockSpawn(struct mobj_s *actor);
|
||||
void A_SetFuse(struct mobj_s *actor);
|
||||
void A_CrawlaCommanderThink(struct mobj_s *actor); // Crawla Commander
|
||||
void A_SmokeTrailer(struct mobj_s *actor);
|
||||
void A_RingExplode(struct mobj_s *actor);
|
||||
void A_OldRingExplode(struct mobj_s *actor);
|
||||
void A_MixUp(struct mobj_s *actor);
|
||||
void A_RecyclePowers(struct mobj_s *actor);
|
||||
void A_BossScream(struct mobj_s *actor);
|
||||
void A_Boss2TakeDamage(struct mobj_s *actor);
|
||||
void A_GoopSplat(struct mobj_s *actor);
|
||||
void A_Boss2PogoSFX(struct mobj_s *actor);
|
||||
void A_Boss2PogoTarget(struct mobj_s *actor);
|
||||
void A_EggmanBox(struct mobj_s *actor);
|
||||
void A_TurretFire(struct mobj_s *actor);
|
||||
void A_SuperTurretFire(struct mobj_s *actor);
|
||||
void A_TurretStop(struct mobj_s *actor);
|
||||
void A_JetJawRoam(struct mobj_s *actor);
|
||||
void A_JetJawChomp(struct mobj_s *actor);
|
||||
void A_PointyThink(struct mobj_s *actor);
|
||||
void A_CheckBuddy(struct mobj_s *actor);
|
||||
void A_HoodThink(struct mobj_s *actor);
|
||||
void A_ArrowCheck(struct mobj_s *actor);
|
||||
void A_SnailerThink(struct mobj_s *actor);
|
||||
void A_SharpChase(struct mobj_s *actor);
|
||||
void A_SharpSpin(struct mobj_s *actor);
|
||||
void A_VultureVtol(struct mobj_s *actor);
|
||||
void A_VultureCheck(struct mobj_s *actor);
|
||||
void A_SkimChase(struct mobj_s *actor);
|
||||
void A_SkullAttack(struct mobj_s *actor);
|
||||
void A_LobShot(struct mobj_s *actor);
|
||||
void A_FireShot(struct mobj_s *actor);
|
||||
void A_SuperFireShot(struct mobj_s *actor);
|
||||
void A_BossFireShot(struct mobj_s *actor);
|
||||
void A_Boss7FireMissiles(struct mobj_s *actor);
|
||||
void A_Boss1Laser(struct mobj_s *actor);
|
||||
void A_FocusTarget(struct mobj_s *actor);
|
||||
void A_Boss4Reverse(struct mobj_s *actor);
|
||||
void A_Boss4SpeedUp(struct mobj_s *actor);
|
||||
void A_Boss4Raise(struct mobj_s *actor);
|
||||
void A_SparkFollow(struct mobj_s *actor);
|
||||
void A_BuzzFly(struct mobj_s *actor);
|
||||
void A_GuardChase(struct mobj_s *actor);
|
||||
void A_EggShield(struct mobj_s *actor);
|
||||
void A_SetReactionTime(struct mobj_s *actor);
|
||||
void A_Boss1Spikeballs(struct mobj_s *actor);
|
||||
void A_Boss3TakeDamage(struct mobj_s *actor);
|
||||
void A_Boss3Path(struct mobj_s *actor);
|
||||
void A_LinedefExecute(struct mobj_s *actor);
|
||||
void A_PlaySeeSound(struct mobj_s *actor);
|
||||
void A_PlayAttackSound(struct mobj_s *actor);
|
||||
void A_PlayActiveSound(struct mobj_s *actor);
|
||||
void A_1upThinker(struct mobj_s *actor);
|
||||
void A_BossZoom(struct mobj_s *actor); //Unused
|
||||
void A_Boss1Chase(struct mobj_s *actor);
|
||||
void A_Boss2Chase(struct mobj_s *actor);
|
||||
void A_Boss2Pogo(struct mobj_s *actor);
|
||||
void A_Boss7Chase(struct mobj_s *actor);
|
||||
void A_BossJetFume(struct mobj_s *actor);
|
||||
void A_SpawnObjectAbsolute(struct mobj_s *actor);
|
||||
void A_SpawnObjectRelative(struct mobj_s *actor);
|
||||
void A_ChangeAngleRelative(struct mobj_s *actor);
|
||||
void A_ChangeAngleAbsolute(struct mobj_s *actor);
|
||||
void A_RollAngle(struct mobj_s *actor);
|
||||
void A_ChangeRollAngleRelative(struct mobj_s *actor);
|
||||
void A_ChangeRollAngleAbsolute(struct mobj_s *actor);
|
||||
void A_PlaySound(struct mobj_s *actor);
|
||||
void A_FindTarget(struct mobj_s *actor);
|
||||
void A_FindTracer(struct mobj_s *actor);
|
||||
void A_SetTics(struct mobj_s *actor);
|
||||
void A_SetRandomTics(struct mobj_s *actor);
|
||||
void A_ChangeColorRelative(struct mobj_s *actor);
|
||||
void A_ChangeColorAbsolute(struct mobj_s *actor);
|
||||
void A_MoveRelative(struct mobj_s *actor);
|
||||
void A_MoveAbsolute(struct mobj_s *actor);
|
||||
void A_Thrust(struct mobj_s *actor);
|
||||
void A_ZThrust(struct mobj_s *actor);
|
||||
void A_SetTargetsTarget(struct mobj_s *actor);
|
||||
void A_SetObjectFlags(struct mobj_s *actor);
|
||||
void A_SetObjectFlags2(struct mobj_s *actor);
|
||||
void A_RandomState(struct mobj_s *actor);
|
||||
void A_RandomStateRange(struct mobj_s *actor);
|
||||
void A_DualAction(struct mobj_s *actor);
|
||||
void A_RemoteAction(struct mobj_s *actor);
|
||||
void A_ToggleFlameJet(struct mobj_s *actor);
|
||||
void A_ItemPop(struct mobj_s *actor); // SRB2kart
|
||||
void A_JawzChase(struct mobj_s *actor); // SRB2kart
|
||||
void A_JawzExplode(struct mobj_s *actor); // SRB2kart
|
||||
void A_SPBChase(struct mobj_s *actor); // SRB2kart
|
||||
void A_MineExplode(struct mobj_s *actor); // SRB2kart
|
||||
void A_BallhogExplode(struct mobj_s *actor); // SRB2kart
|
||||
void A_LightningFollowPlayer(struct mobj_s *actor); // SRB2kart: Lightning shield effect player chasing
|
||||
void A_FZBoomFlash(struct mobj_s *actor); // SRB2kart
|
||||
void A_FZBoomSmoke(struct mobj_s *actor); // SRB2kart
|
||||
void A_RandomShadowFrame(struct mobj_s *actor); //SRB2kart: Shadow spawner frame randomizer
|
||||
void A_RoamingShadowThinker(struct mobj_s *actor); // SRB2kart: Roaming Shadow moving + attacking players.
|
||||
void A_MayonakaArrow(struct mobj_s *actor); //SRB2kart: midnight channel arrow sign
|
||||
void A_ReaperThinker(struct mobj_s *actor); //SRB2kart: mementos reaper
|
||||
void A_MementosTPParticles(struct mobj_s *actor); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
|
||||
void A_FlameParticle(struct mobj_s *actor); // SRB2kart
|
||||
void A_OrbitNights(struct mobj_s *actor);
|
||||
void A_GhostMe(struct mobj_s *actor);
|
||||
void A_SetObjectState(struct mobj_s *actor);
|
||||
void A_SetObjectTypeState(struct mobj_s *actor);
|
||||
void A_KnockBack(struct mobj_s *actor);
|
||||
void A_PushAway(struct mobj_s *actor);
|
||||
void A_RingDrain(struct mobj_s *actor);
|
||||
void A_SplitShot(struct mobj_s *actor);
|
||||
void A_MissileSplit(struct mobj_s *actor);
|
||||
void A_MultiShot(struct mobj_s *actor);
|
||||
void A_InstaLoop(struct mobj_s *actor);
|
||||
void A_Custom3DRotate(struct mobj_s *actor);
|
||||
void A_SearchForPlayers(struct mobj_s *actor);
|
||||
void A_CheckRandom(struct mobj_s *actor);
|
||||
void A_CheckTargetRings(struct mobj_s *actor);
|
||||
void A_CheckRings(struct mobj_s *actor);
|
||||
void A_CheckTotalRings(struct mobj_s *actor);
|
||||
void A_CheckHealth(struct mobj_s *actor);
|
||||
void A_CheckRange(struct mobj_s *actor);
|
||||
void A_CheckHeight(struct mobj_s *actor);
|
||||
void A_CheckTrueRange(struct mobj_s *actor);
|
||||
void A_CheckThingCount(struct mobj_s *actor);
|
||||
void A_CheckAmbush(struct mobj_s *actor);
|
||||
void A_CheckCustomValue(struct mobj_s *actor);
|
||||
void A_CheckCusValMemo(struct mobj_s *actor);
|
||||
void A_SetCustomValue(struct mobj_s *actor);
|
||||
void A_UseCusValMemo(struct mobj_s *actor);
|
||||
void A_RelayCustomValue(struct mobj_s *actor);
|
||||
void A_CusValAction(struct mobj_s *actor);
|
||||
void A_ForceStop(struct mobj_s *actor);
|
||||
void A_ForceWin(struct mobj_s *actor);
|
||||
void A_SpikeRetract(struct mobj_s *actor);
|
||||
void A_InfoState(struct mobj_s *actor);
|
||||
void A_Repeat(struct mobj_s *actor);
|
||||
void A_SetScale(struct mobj_s *actor);
|
||||
void A_RemoteDamage(struct mobj_s *actor);
|
||||
void A_HomingChase(struct mobj_s *actor);
|
||||
void A_TrapShot(struct mobj_s *actor);
|
||||
void A_VileTarget(struct mobj_s *actor);
|
||||
void A_VileAttack(struct mobj_s *actor);
|
||||
void A_VileFire(struct mobj_s *actor);
|
||||
void A_BrakChase(struct mobj_s *actor);
|
||||
void A_BrakFireShot(struct mobj_s *actor);
|
||||
void A_BrakLobShot(struct mobj_s *actor);
|
||||
void A_NapalmScatter(struct mobj_s *actor);
|
||||
void A_SpawnFreshCopy(struct mobj_s *actor);
|
||||
|
||||
extern boolean actionsoverridden[NUMACTIONS];
|
||||
void A_Explode();
|
||||
void A_Pain();
|
||||
void A_Fall();
|
||||
void A_MonitorPop();
|
||||
void A_Look();
|
||||
void A_Chase();
|
||||
void A_FaceStabChase();
|
||||
void A_FaceTarget();
|
||||
void A_FaceTracer();
|
||||
void A_Scream();
|
||||
void A_BossDeath();
|
||||
void A_CustomPower(); // Use this for a custom power
|
||||
void A_GiveWeapon(); // Gives the player weapon(s)
|
||||
void A_JumpShield(); // Obtained Jump Shield
|
||||
void A_RingShield(); // Obtained Ring Shield
|
||||
void A_RingBox(); // Obtained Ring Box Tails
|
||||
void A_Invincibility(); // Obtained Invincibility Box
|
||||
void A_SuperSneakers(); // Obtained Super Sneakers Box
|
||||
void A_BunnyHop(); // have bunny hop tails
|
||||
void A_BubbleSpawn(); // Randomly spawn bubbles
|
||||
void A_FanBubbleSpawn();
|
||||
void A_BubbleRise(); // Bubbles float to surface
|
||||
void A_BubbleCheck(); // Don't draw if not underwater
|
||||
void A_AwardScore();
|
||||
void A_ExtraLife(); // Extra Life
|
||||
void A_BombShield(); // Obtained Bomb Shield
|
||||
void A_WaterShield(); // Obtained Water Shield
|
||||
void A_ForceShield(); // Obtained Force Shield
|
||||
void A_PityShield(); // Obtained Pity Shield. We're... sorry.
|
||||
void A_GravityBox();
|
||||
void A_ScoreRise(); // Rise the score logo
|
||||
void A_ParticleSpawn();
|
||||
void A_AttractChase(); // Ring Chase
|
||||
void A_DropMine(); // Drop Mine from Skim or Jetty-Syn Bomber
|
||||
void A_FishJump(); // Fish Jump
|
||||
void A_ThrownRing(); // Sparkle trail for red ring
|
||||
void A_GrenadeRing(); // SRB2kart
|
||||
void A_SetSolidSteam();
|
||||
void A_UnsetSolidSteam();
|
||||
void A_SignPlayer();
|
||||
void A_OverlayThink();
|
||||
void A_JetChase();
|
||||
void A_JetbThink(); // Jetty-Syn Bomber Thinker
|
||||
void A_JetgThink(); // Jetty-Syn Gunner Thinker
|
||||
void A_JetgShoot(); // Jetty-Syn Shoot Function
|
||||
void A_ShootBullet(); // JetgShoot without reactiontime setting
|
||||
void A_MinusDigging();
|
||||
void A_MinusPopup();
|
||||
void A_MinusCheck();
|
||||
void A_ChickenCheck();
|
||||
void A_MouseThink(); // Mouse Thinker
|
||||
void A_DetonChase(); // Deton Chaser
|
||||
void A_CapeChase(); // Fake little Super Sonic cape
|
||||
void A_RotateSpikeBall(); // Spike ball rotation
|
||||
void A_SlingAppear();
|
||||
void A_MaceRotate();
|
||||
void A_UnidusBall();
|
||||
void A_RockSpawn();
|
||||
void A_SetFuse();
|
||||
void A_CrawlaCommanderThink(); // Crawla Commander
|
||||
void A_SmokeTrailer();
|
||||
void A_RingExplode();
|
||||
void A_OldRingExplode();
|
||||
void A_MixUp();
|
||||
void A_RecyclePowers();
|
||||
void A_BossScream();
|
||||
void A_Boss2TakeDamage();
|
||||
void A_GoopSplat();
|
||||
void A_Boss2PogoSFX();
|
||||
void A_Boss2PogoTarget();
|
||||
void A_EggmanBox();
|
||||
void A_TurretFire();
|
||||
void A_SuperTurretFire();
|
||||
void A_TurretStop();
|
||||
void A_JetJawRoam();
|
||||
void A_JetJawChomp();
|
||||
void A_PointyThink();
|
||||
void A_CheckBuddy();
|
||||
void A_HoodThink();
|
||||
void A_ArrowCheck();
|
||||
void A_SnailerThink();
|
||||
void A_SharpChase();
|
||||
void A_SharpSpin();
|
||||
void A_VultureVtol();
|
||||
void A_VultureCheck();
|
||||
void A_SkimChase();
|
||||
void A_SkullAttack();
|
||||
void A_LobShot();
|
||||
void A_FireShot();
|
||||
void A_SuperFireShot();
|
||||
void A_BossFireShot();
|
||||
void A_Boss7FireMissiles();
|
||||
void A_Boss1Laser();
|
||||
void A_FocusTarget();
|
||||
void A_Boss4Reverse();
|
||||
void A_Boss4SpeedUp();
|
||||
void A_Boss4Raise();
|
||||
void A_SparkFollow();
|
||||
void A_BuzzFly();
|
||||
void A_GuardChase();
|
||||
void A_EggShield();
|
||||
void A_SetReactionTime();
|
||||
void A_Boss1Spikeballs();
|
||||
void A_Boss3TakeDamage();
|
||||
void A_Boss3Path();
|
||||
void A_LinedefExecute();
|
||||
void A_PlaySeeSound();
|
||||
void A_PlayAttackSound();
|
||||
void A_PlayActiveSound();
|
||||
void A_1upThinker();
|
||||
void A_BossZoom(); //Unused
|
||||
void A_Boss1Chase();
|
||||
void A_Boss2Chase();
|
||||
void A_Boss2Pogo();
|
||||
void A_Boss7Chase();
|
||||
void A_BossJetFume();
|
||||
void A_SpawnObjectAbsolute();
|
||||
void A_SpawnObjectRelative();
|
||||
void A_ChangeAngleRelative();
|
||||
void A_ChangeAngleAbsolute();
|
||||
void A_RollAngle();
|
||||
void A_ChangeRollAngleRelative();
|
||||
void A_ChangeRollAngleAbsolute();
|
||||
void A_PlaySound();
|
||||
void A_FindTarget();
|
||||
void A_FindTracer();
|
||||
void A_SetTics();
|
||||
void A_SetRandomTics();
|
||||
void A_ChangeColorRelative();
|
||||
void A_ChangeColorAbsolute();
|
||||
void A_MoveRelative();
|
||||
void A_MoveAbsolute();
|
||||
void A_Thrust();
|
||||
void A_ZThrust();
|
||||
void A_SetTargetsTarget();
|
||||
void A_SetObjectFlags();
|
||||
void A_SetObjectFlags2();
|
||||
void A_RandomState();
|
||||
void A_RandomStateRange();
|
||||
void A_DualAction();
|
||||
void A_RemoteAction();
|
||||
void A_ToggleFlameJet();
|
||||
void A_ItemPop(); // SRB2kart
|
||||
void A_JawzChase(); // SRB2kart
|
||||
void A_JawzExplode(); // SRB2kart
|
||||
void A_SPBChase(); // SRB2kart
|
||||
void A_MineExplode(); // SRB2kart
|
||||
void A_BallhogExplode(); // SRB2kart
|
||||
void A_LightningFollowPlayer(); // SRB2kart: Lightning shield effect player chasing
|
||||
void A_FZBoomFlash(); // SRB2kart
|
||||
void A_FZBoomSmoke(); // SRB2kart
|
||||
void A_RandomShadowFrame(); //SRB2kart: Shadow spawner frame randomizer
|
||||
void A_RoamingShadowThinker(); // SRB2kart: Roaming Shadow moving + attacking players.
|
||||
void A_MayonakaArrow(); //SRB2kart: midnight channel arrow sign
|
||||
void A_ReaperThinker(); //SRB2kart: mementos reaper
|
||||
void A_MementosTPParticles(); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
|
||||
void A_FlameParticle(); // SRB2kart
|
||||
void A_OrbitNights();
|
||||
void A_GhostMe();
|
||||
void A_SetObjectState();
|
||||
void A_SetObjectTypeState();
|
||||
void A_KnockBack();
|
||||
void A_PushAway();
|
||||
void A_RingDrain();
|
||||
void A_SplitShot();
|
||||
void A_MissileSplit();
|
||||
void A_MultiShot();
|
||||
void A_InstaLoop();
|
||||
void A_Custom3DRotate();
|
||||
void A_SearchForPlayers();
|
||||
void A_CheckRandom();
|
||||
void A_CheckTargetRings();
|
||||
void A_CheckRings();
|
||||
void A_CheckTotalRings();
|
||||
void A_CheckHealth();
|
||||
void A_CheckRange();
|
||||
void A_CheckHeight();
|
||||
void A_CheckTrueRange();
|
||||
void A_CheckThingCount();
|
||||
void A_CheckAmbush();
|
||||
void A_CheckCustomValue();
|
||||
void A_CheckCusValMemo();
|
||||
void A_SetCustomValue();
|
||||
void A_UseCusValMemo();
|
||||
void A_RelayCustomValue();
|
||||
void A_CusValAction();
|
||||
void A_ForceStop();
|
||||
void A_ForceWin();
|
||||
void A_SpikeRetract();
|
||||
void A_InfoState();
|
||||
void A_Repeat();
|
||||
void A_SetScale();
|
||||
void A_RemoteDamage();
|
||||
void A_HomingChase();
|
||||
void A_TrapShot();
|
||||
void A_VileTarget();
|
||||
void A_VileAttack();
|
||||
void A_VileFire();
|
||||
void A_BrakChase();
|
||||
void A_BrakFireShot();
|
||||
void A_BrakLobShot();
|
||||
void A_NapalmScatter();
|
||||
void A_SpawnFreshCopy();
|
||||
|
||||
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
||||
#define NUMMOBJFREESLOTS 1024
|
||||
|
||||
@@ -1,434 +0,0 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by AJ "Tyron" Martinez.
|
||||
// Copyright (C) 2024 by James Robert Roman.
|
||||
//
|
||||
// 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 k_director.c
|
||||
/// \brief SRB2kart automatic spectator camera.
|
||||
|
||||
//#include "k_kart.h"
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
#include "v_video.h"
|
||||
#include "k_director.h"
|
||||
#include "d_netcmd.h"
|
||||
#include "p_local.h"
|
||||
#include "st_stuff.h"
|
||||
|
||||
#define SWITCHTIME TICRATE * 5 // cooldown between unforced switches
|
||||
#define BOREDOMTIME 3 * TICRATE / 2 // how long until players considered far apart?
|
||||
#define TRANSFERTIME TICRATE // how long to delay reaction shots?
|
||||
#define BREAKAWAYDIST 2000 // how *far* until players considered far apart?
|
||||
#define WALKBACKDIST 400 // how close should a trailing player be before we switch?
|
||||
#define PINCHDIST 20000 // how close should the leader be to be considered "end of race"?
|
||||
|
||||
struct directorinfo
|
||||
{
|
||||
tic_t cooldown; // how long has it been since we last switched?
|
||||
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
|
||||
INT32 attacker; // who to switch to when freeze delay elapses
|
||||
INT32 maxdist; // how far is the closest player from finishing?
|
||||
|
||||
INT32 sortedplayers[MAXPLAYERS]; // position-1 goes in, player index comes out.
|
||||
INT32 gap[MAXPLAYERS]; // gap between a given position and their closest pursuer
|
||||
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
|
||||
} directorinfo;
|
||||
|
||||
boolean K_DirectorIsPlayerAlone(void)
|
||||
{
|
||||
UINT8 pingame = 0;
|
||||
|
||||
// Gotta check how many players are active at this moment.
|
||||
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
pingame++;
|
||||
|
||||
if (pingame >= 2) // we dont need to check further
|
||||
break;
|
||||
}
|
||||
|
||||
return (pingame <= 1);
|
||||
}
|
||||
|
||||
static inline boolean race_rules(void)
|
||||
{
|
||||
return gametype == GT_RACE;
|
||||
}
|
||||
|
||||
static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
|
||||
{
|
||||
return FixedMul(n, FixedDiv(scale, mapobjectscale));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(void)
|
||||
{
|
||||
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((stplyr && !stplyr->spectator) && (!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
|
||||
}
|
||||
|
||||
void K_InitDirector(void)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
directorinfo.freeze = 0;
|
||||
directorinfo.attacker = 0;
|
||||
directorinfo.maxdist = 0;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
directorinfo.sortedplayers[playernum] = -1;
|
||||
directorinfo.gap[playernum] = INT32_MAX;
|
||||
directorinfo.boredom[playernum] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static fixed_t K_GetDistanceToFinish(player_t player)
|
||||
{
|
||||
mobj_t *mo;
|
||||
fixed_t dist = 0;
|
||||
INT16 maxMoveCount = -1;
|
||||
INT16 maxAngle = -1;
|
||||
|
||||
if (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE))
|
||||
{
|
||||
for (mo = waypointcap; mo != NULL; mo = mo->tracer)
|
||||
{
|
||||
if (mo->spawnpoint->angle != 0)
|
||||
continue;
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // crappy optimization weeeee
|
||||
{
|
||||
for (mo = waypointcap; mo != NULL; mo = mo->tracer)
|
||||
{
|
||||
if (mo->movecount > maxMoveCount)
|
||||
maxMoveCount = mo->movecount;
|
||||
if (mo->spawnpoint->angle > maxAngle)
|
||||
maxAngle = mo->spawnpoint->angle;
|
||||
|
||||
if (!(mo->movecount == maxMoveCount && mo->spawnpoint->angle == maxAngle)) // sprint maps finishline waypoint is the one with highest movecount AND angle
|
||||
continue;
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
||||
static fixed_t K_GetFinishGap(INT32 leader, INT32 follower)
|
||||
{
|
||||
fixed_t dista = K_GetDistanceToFinish(players[follower]);
|
||||
fixed_t distb = K_GetDistanceToFinish(players[leader]);
|
||||
|
||||
if (players[follower].kartstuff[k_position] < players[leader].kartstuff[k_position])
|
||||
{
|
||||
return distb - dista;
|
||||
}
|
||||
else
|
||||
{
|
||||
return dista - distb;
|
||||
}
|
||||
}
|
||||
|
||||
static void K_UpdateDirectorPositions(void)
|
||||
{
|
||||
INT32 playernum;
|
||||
INT32 position;
|
||||
player_t* target;
|
||||
|
||||
memset(directorinfo.sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
target = &players[playernum];
|
||||
|
||||
if (playeringame[playernum] && !target->spectator && target->kartstuff[k_position] > 0)
|
||||
{
|
||||
directorinfo.sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
}
|
||||
}
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
directorinfo.gap[position] = INT32_MAX;
|
||||
|
||||
if (directorinfo.sortedplayers[position] == -1 || directorinfo.sortedplayers[position + 1] == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
directorinfo.gap[position] = ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
|
||||
|
||||
if (directorinfo.gap[position] >= BREAKAWAYDIST)
|
||||
{
|
||||
directorinfo.boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfo.boredom[position] + 1));
|
||||
}
|
||||
else if (directorinfo.boredom[position] > 0)
|
||||
{
|
||||
directorinfo.boredom[position]--;
|
||||
}
|
||||
}
|
||||
|
||||
if (directorinfo.sortedplayers[0] == -1)
|
||||
{
|
||||
directorinfo.maxdist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
|
||||
}
|
||||
|
||||
static boolean K_CanSwitchDirector(void)
|
||||
{
|
||||
if (directorinfo.cooldown > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(&players[player]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (players[player].exiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force && !K_CanSwitchDirector())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
G_ResetView(1, player, true);
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
}
|
||||
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time)
|
||||
{
|
||||
if (players[player].exiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.attacker = player;
|
||||
directorinfo.freeze = time;
|
||||
}
|
||||
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_IsDisplayPlayer(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (inflictor && inflictor->player)
|
||||
{
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME);
|
||||
}
|
||||
else if (source && source->player)
|
||||
{
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME);
|
||||
}
|
||||
}
|
||||
|
||||
void K_DrawDirectorDebugger(void)
|
||||
{
|
||||
INT32 position;
|
||||
INT32 leader;
|
||||
INT32 follower;
|
||||
INT32 ytxt;
|
||||
|
||||
if (!cv_kartdebugdirector.value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
V_DrawThinString(10, 0, V_70TRANS, va("PLACE"));
|
||||
V_DrawThinString(40, 0, V_70TRANS, va("CONF?"));
|
||||
V_DrawThinString(80, 0, V_70TRANS, va("GAP"));
|
||||
V_DrawThinString(120, 0, V_70TRANS, va("BORED"));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfo.cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfo.maxdist));
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
ytxt = 10 * (position + 1);
|
||||
leader = directorinfo.sortedplayers[position];
|
||||
follower = directorinfo.sortedplayers[position + 1];
|
||||
|
||||
if (leader == -1 || follower == -1)
|
||||
break;
|
||||
|
||||
V_DrawThinString(10, ytxt, V_70TRANS, va("%d", position));
|
||||
V_DrawThinString(20, ytxt, V_70TRANS, va("%d", position + 1));
|
||||
|
||||
if (players[leader].kartstuff[k_positiondelay])
|
||||
{
|
||||
V_DrawThinString(40, ytxt, V_70TRANS, va("NG"));
|
||||
}
|
||||
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfo.gap[position]));
|
||||
|
||||
if (directorinfo.boredom[position] >= BOREDOMTIME)
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("BORED"));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfo.boredom[position]));
|
||||
}
|
||||
|
||||
V_DrawThinString(150, ytxt, V_70TRANS, va("%s", player_names[leader]));
|
||||
V_DrawThinString(230, ytxt, V_70TRANS, va("%s", player_names[follower]));
|
||||
}
|
||||
}
|
||||
|
||||
void K_UpdateDirector(void)
|
||||
{
|
||||
INT32 *displayplayerp = &displayplayers[0];
|
||||
INT32 targetposition;
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
K_UpdateDirectorPositions();
|
||||
|
||||
if (directorinfo.cooldown > 0) {
|
||||
directorinfo.cooldown--;
|
||||
}
|
||||
|
||||
// handle pending forced switches
|
||||
if (directorinfo.freeze > 0)
|
||||
{
|
||||
if (!(--directorinfo.freeze))
|
||||
K_DirectorSwitch(directorinfo.attacker, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if there's only one player left in the list, just switch to that player
|
||||
if (directorinfo.sortedplayers[0] != -1 && (directorinfo.sortedplayers[1] == -1 ||
|
||||
// TODO: Battle; I just threw this together quick. Focus on leader.
|
||||
!race_rules()))
|
||||
{
|
||||
K_DirectorSwitch(directorinfo.sortedplayers[0], false);
|
||||
return;
|
||||
}
|
||||
|
||||
// aaight, time to walk through the standings to find the first interesting pair
|
||||
// NB: targetposition/sortedplayers is 0-indexed, aiming at the "back half" of a given pair by default.
|
||||
// we adjust for this when comparing to player->position or when looking at the leading player, Don't Freak Out
|
||||
for (targetposition = 1; targetposition < MAXPLAYERS; targetposition++)
|
||||
{
|
||||
INT32 target;
|
||||
|
||||
// you are out of players, try again
|
||||
if (directorinfo.sortedplayers[targetposition] == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// pair too far apart? try the next one
|
||||
if (directorinfo.boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// pair finished? try the next one
|
||||
if (players[directorinfo.sortedplayers[targetposition]].exiting)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't risk switching away from forward pairs at race end, might miss something!
|
||||
if (directorinfo.maxdist > PINCHDIST)
|
||||
{
|
||||
// if the "next" player is close enough, they should be able to see everyone fine!
|
||||
// walk back through the standings to find a vantage that gets everyone in frame.
|
||||
// (also creates a pretty cool effect w/ overtakes at speed)
|
||||
while (targetposition < MAXPLAYERS && directorinfo.gap[targetposition] < WALKBACKDIST)
|
||||
{
|
||||
targetposition++;
|
||||
}
|
||||
}
|
||||
|
||||
target = directorinfo.sortedplayers[targetposition];
|
||||
|
||||
// stop here since we're already viewing this player
|
||||
if (*displayplayerp == target)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if this is a splitscreen player, try next pair
|
||||
if (P_IsDisplayPlayer(&players[target]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we're certain the back half of the pair is actually in this position, try to switch
|
||||
if (!players[target].kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
}
|
||||
|
||||
// even if we're not certain, if we're certain we're watching the WRONG player, try to switch
|
||||
if (players[*displayplayerp].kartstuff[k_position] != targetposition+1 && !players[*displayplayerp].kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void K_ToggleDirector(void)
|
||||
{
|
||||
if (!directortextactive)
|
||||
return;
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
directorinfo.cooldown = 0; // switch immediately
|
||||
}
|
||||
|
||||
directortoggletimer = 0;
|
||||
|
||||
COM_ImmedExecute("add director 1");
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by AJ "Tyron" Martinez.
|
||||
// Copyright (C) 2024 by James Robert Roman.
|
||||
//
|
||||
// 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 k_director.h
|
||||
/// \brief SRB2kart automatic spectator camera.
|
||||
|
||||
void K_InitDirector(void);
|
||||
void K_UpdateDirector(void);
|
||||
void K_DrawDirectorDebugger(void);
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
|
||||
void K_ToggleDirector(void);
|
||||
+240
-292
@@ -16,7 +16,6 @@
|
||||
#include "m_random.h"
|
||||
#include "m_menu.h" // ffdhidshfuisduifigergho9igj89dgodhfih AAAAAAAAAA
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "p_slopes.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_draw.h"
|
||||
@@ -32,14 +31,12 @@
|
||||
#include "z_zone.h"
|
||||
#include "m_misc.h"
|
||||
#include "m_cond.h"
|
||||
#include "k_director.h"
|
||||
#include "k_kart.h"
|
||||
#include "f_finale.h"
|
||||
#include "lua_hud.h" // For Lua hud checks
|
||||
#include "lua_hook.h" // For MobjDamage and ShouldDamage
|
||||
#include "d_main.h" // found_extra_kart
|
||||
|
||||
|
||||
#include "i_video.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -77,7 +74,6 @@ IMPL_HUD_OFFSET(stat); // Stats
|
||||
//extra hud things
|
||||
consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showlaptimes = {"showlaptimes", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
|
||||
consvar_t cv_newspeedometer = {"newspeedometer", "Default", CV_SAVE, speedo_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -88,7 +84,7 @@ consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0,
|
||||
consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
//Colourized HUD
|
||||
consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, SaturnHud_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, Saturn_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_colorizeditembox = {"colorizeditembox", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t HudColor_cons_t[MAXSKINCOLORS+1];
|
||||
@@ -617,8 +613,10 @@ UINT8 K_GetKartColorByName(const char *name)
|
||||
|
||||
UINT8 K_GetHudColor(void)
|
||||
{
|
||||
if (cv_colorizedhud.value && cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value;
|
||||
|
||||
if (cv_colorizedhud.value){
|
||||
if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value;
|
||||
}
|
||||
if (stplyr && P_IsLocalPlayer(stplyr) && gamestate == GS_LEVEL) return stplyr->skincolor;
|
||||
return ((stplyr && gamestate == GS_LEVEL) ? stplyr->skincolor : cv_playercolor.value);
|
||||
}
|
||||
|
||||
@@ -680,7 +678,6 @@ void K_RegisterKartStuff(void)
|
||||
CV_RegisterVar(&cv_kartgametypepreference);
|
||||
CV_RegisterVar(&cv_kartspeedometer);
|
||||
CV_RegisterVar(&cv_kartvoices);
|
||||
CV_RegisterVar(&cv_karthitemdialog);
|
||||
CV_RegisterVar(&cv_karteliminatelast);
|
||||
CV_RegisterVar(&cv_votetime);
|
||||
|
||||
@@ -723,7 +720,6 @@ void K_RegisterKartStuff(void)
|
||||
|
||||
CV_RegisterVar(&cv_showstats);
|
||||
CV_RegisterVar(&cv_showinput);
|
||||
CV_RegisterVar(&cv_showlaptimes);
|
||||
CV_RegisterVar(&cv_newspeedometer);
|
||||
|
||||
CV_RegisterVar(&cv_battlespeedo);
|
||||
@@ -1900,31 +1896,6 @@ static void K_RegularVoiceTimers(player_t *player)
|
||||
player->kartstuff[k_tauntvoices] = 4*TICRATE;
|
||||
}
|
||||
|
||||
static void K_PlayGenericCombatSound(mobj_t *source, mobj_t *other, sfxenum_t sfx_id)
|
||||
{
|
||||
skin_t *skin = NULL;
|
||||
|
||||
// I HATE LOCALSKINS! I HATE LOCALSKINS! :AAAAAAAAAA:
|
||||
if (source->player)
|
||||
{
|
||||
INT32 skinnum = source->player->skinlocal ? (source->player->localskin - 1) : source->player->skin;
|
||||
skin = &(source->player->skinlocal ? localskins : skins)[skinnum];
|
||||
}
|
||||
|
||||
if (!skin)
|
||||
return;
|
||||
|
||||
boolean alwaysHear = false;
|
||||
|
||||
if (other != NULL && P_MobjWasRemoved(other) == false && other->player != NULL)
|
||||
alwaysHear = P_IsDisplayPlayer(other->player);
|
||||
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(alwaysHear ? NULL : source, skin->soundsid[S_sfx[sfx_id].skinsound]);
|
||||
|
||||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
void K_PlayAttackTaunt(mobj_t *source)
|
||||
{
|
||||
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
||||
@@ -1973,34 +1944,10 @@ void K_PlayOvertakeSound(mobj_t *source)
|
||||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
static boolean K_SetDelayedHitEm(player_t *player, player_t *victim)
|
||||
{
|
||||
player_t *prevvictim = NULL;
|
||||
|
||||
if (player->hitemtimer)
|
||||
prevvictim = &players[player->hitemvictim];
|
||||
|
||||
// We prioritize local players to hear "hit em" sfx
|
||||
if (prevvictim && P_IsDisplayPlayer(prevvictim) && !P_IsDisplayPlayer(victim))
|
||||
return false;
|
||||
|
||||
player->hitemtimer = TICRATE/2;
|
||||
player->hitemvictim = victim - players;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void K_PlayHitEmSound(mobj_t *source, mobj_t *victim)
|
||||
void K_PlayHitEmSound(mobj_t *source)
|
||||
{
|
||||
if (cv_kartvoices.value)
|
||||
{
|
||||
if (cv_karthitemdialog.value
|
||||
&& source->player && victim && victim->player
|
||||
&& K_SetDelayedHitEm(source->player, victim->player))
|
||||
return; // Don't call K_RegularVoiceTimers yet, we didn't do any sound
|
||||
|
||||
S_StartSound(source, sfx_khitem);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, sfx_s1c9); // The only lost gameplay functionality with voices disabled
|
||||
|
||||
@@ -2015,33 +1962,6 @@ void K_PlayPowerGloatSound(mobj_t *source)
|
||||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
static void K_HandleDelayedHitByEm(player_t *player)
|
||||
{
|
||||
if (player->hitemtimer == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player->hitemtimer--;
|
||||
|
||||
if (player->hitemtimer == 0)
|
||||
{
|
||||
mobj_t *victim = NULL;
|
||||
|
||||
if (player->hitemvictim < MAXPLAYERS && playeringame[player->hitemvictim])
|
||||
{
|
||||
player_t *victimPlayer = &players[player->hitemvictim];
|
||||
|
||||
if (victimPlayer != NULL && victimPlayer->spectator == false)
|
||||
{
|
||||
victim = victimPlayer->mo;
|
||||
}
|
||||
}
|
||||
|
||||
K_PlayGenericCombatSound(player->mo, victim, sfx_khitem);
|
||||
}
|
||||
}
|
||||
|
||||
void K_MomentumToFacing(player_t *player)
|
||||
{
|
||||
angle_t dangle = player->mo->angle - R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||
@@ -2313,7 +2233,6 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
|
||||
boolean force = false; // Used to check if Lua ShouldSpin should get us damaged reguardless of flashtics or heck knows what.
|
||||
UINT8 shouldForce = LUAh_ShouldSpin(player, inflictor, source);
|
||||
|
||||
if (P_MobjWasRemoved(player->mo))
|
||||
return; // mobj was removed (in theory that shouldn't happen)
|
||||
if (shouldForce == 1)
|
||||
@@ -2321,8 +2240,6 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
else if (shouldForce == 2)
|
||||
return;
|
||||
|
||||
K_DirectorFollowAttack(player, inflictor, source);
|
||||
|
||||
if (!trapitem && G_BattleGametype())
|
||||
{
|
||||
if (K_IsPlayerWanted(player))
|
||||
@@ -2349,7 +2266,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
return;
|
||||
|
||||
if (source && source != player->mo && source->player)
|
||||
K_PlayHitEmSound(source, player->mo);
|
||||
K_PlayHitEmSound(source);
|
||||
|
||||
//player->kartstuff[k_sneakertimer] = 0;
|
||||
player->kartstuff[k_driftboost] = 0;
|
||||
@@ -2549,7 +2466,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||
if (player->mo->state != &states[S_KART_SQUISH]) // Squash
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SQUISH);
|
||||
|
||||
P_PlayRinglossSound(player->mo, source);
|
||||
P_PlayRinglossSound(player->mo);
|
||||
|
||||
player->kartstuff[k_instashield] = 15;
|
||||
if (cv_kartdebughuddrop.value && !modeattacking)
|
||||
@@ -2573,8 +2490,6 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
else if (shouldForce == 2)
|
||||
return;
|
||||
|
||||
K_DirectorFollowAttack(player, inflictor, source);
|
||||
|
||||
if (G_BattleGametype())
|
||||
{
|
||||
if (K_IsPlayerWanted(player))
|
||||
@@ -2601,7 +2516,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
return;
|
||||
|
||||
if (source && source != player->mo && source->player)
|
||||
K_PlayHitEmSound(source, player->mo);
|
||||
K_PlayHitEmSound(source);
|
||||
|
||||
player->kartstuff[k_sneakertimer] = 0;
|
||||
player->kartstuff[k_driftboost] = 0;
|
||||
@@ -2682,11 +2597,12 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
if (player->mo->state != &states[S_KART_SPIN])
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPIN);
|
||||
|
||||
P_PlayRinglossSound(player->mo, source);
|
||||
P_PlayRinglossSound(player->mo);
|
||||
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
P_StartQuake(5, 64<<FRACBITS, 0);
|
||||
quake.intensity = 64*FRACUNIT;
|
||||
quake.time = 5;
|
||||
}
|
||||
|
||||
player->kartstuff[k_instashield] = 15;
|
||||
@@ -4490,7 +4406,6 @@ static void K_MoveHeldObjects(player_t *player)
|
||||
if (!player->mo->hnext)
|
||||
{
|
||||
player->kartstuff[k_bananadrag] = 0;
|
||||
|
||||
if (player->kartstuff[k_eggmanheld])
|
||||
player->kartstuff[k_eggmanheld] = 0;
|
||||
else if (player->kartstuff[k_itemheld])
|
||||
@@ -4506,7 +4421,6 @@ static void K_MoveHeldObjects(player_t *player)
|
||||
// we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic...
|
||||
P_SetTarget(&player->mo->hnext, NULL);
|
||||
player->kartstuff[k_bananadrag] = 0;
|
||||
|
||||
if (player->kartstuff[k_eggmanheld])
|
||||
player->kartstuff[k_eggmanheld] = 0;
|
||||
else if (player->kartstuff[k_itemheld])
|
||||
@@ -5001,14 +4915,23 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
||||
static void K_UpdateInvincibilitySounds(player_t *player)
|
||||
{
|
||||
INT32 sfxnum = sfx_None;
|
||||
boolean localplayer = P_IsLocalPlayer(player);
|
||||
|
||||
if (player->mo->health > 0)
|
||||
if (player->mo->health > 0 && !P_IsLocalPlayer(player))
|
||||
{
|
||||
if (player->kartstuff[k_growshrinktimer] > 0 && (!localplayer || cv_growmusic.value == 2)) // Prioritize Grow
|
||||
sfxnum = cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow;
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 0 && (!localplayer || cv_supermusic.value == 2))
|
||||
sfxnum = cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc;
|
||||
if (cv_kartinvinsfx.value)
|
||||
{
|
||||
if (player->kartstuff[k_growshrinktimer] > 0) // Prioritize Grow
|
||||
sfxnum = sfx_alarmg;
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 0)
|
||||
sfxnum = sfx_alarmi;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->kartstuff[k_growshrinktimer] > 0)
|
||||
sfxnum = sfx_kgrow;
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 0)
|
||||
sfxnum = sfx_kinvnc;
|
||||
}
|
||||
}
|
||||
|
||||
if (sfxnum != sfx_None && !S_SoundPlaying(player->mo, sfxnum))
|
||||
@@ -5353,15 +5276,15 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||
// Roulette Code
|
||||
K_KartItemRoulette(player, cmd);
|
||||
|
||||
// Used when karthitemdialog is On
|
||||
K_HandleDelayedHitByEm(player);
|
||||
|
||||
// Handle invincibility sfx
|
||||
K_UpdateInvincibilitySounds(player); // Also thanks, VAda!
|
||||
|
||||
// Plays the music during and after the starting countdown.
|
||||
if (P_IsLocalPlayer(player))
|
||||
S_StartMapMusic(false);
|
||||
// Plays the music after the starting countdown.
|
||||
if (P_IsLocalPlayer(player) && leveltime == (starttime + (TICRATE/2)))
|
||||
{
|
||||
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||
S_ShowMusicCredit();
|
||||
}
|
||||
}
|
||||
|
||||
void K_KartPlayerAfterThink(player_t *player)
|
||||
@@ -6070,7 +5993,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
P_SetScale(overlay, player->mo->scale);
|
||||
}
|
||||
player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds
|
||||
if (P_IsLocalPlayer(player) && cv_supermusic.value == 1 && cv_birdmusic.value)
|
||||
if (P_IsLocalPlayer(player) && cv_supermusic.value && cv_birdmusic.value)
|
||||
S_ChangeMusicSpecial("kinvnc");
|
||||
else
|
||||
S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc));
|
||||
@@ -6275,7 +6198,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
|
||||
player->mo->destscale = (6*player->mo->destscale)/8;
|
||||
player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds
|
||||
if (P_IsLocalPlayer(player) && cv_growmusic.value == 1 && cv_birdmusic.value )
|
||||
if (P_IsLocalPlayer(player) && cv_growmusic.value && cv_birdmusic.value )
|
||||
S_ChangeMusicSpecial("kgrow");
|
||||
else
|
||||
S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow));
|
||||
@@ -6549,7 +6472,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE))
|
||||
S_StartSound(NULL, sfx_s3ka7);
|
||||
if (leveltime == starttime)
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3kad);
|
||||
S_StopMusic(); // The GO! sound stops the level start ambience
|
||||
}
|
||||
}
|
||||
|
||||
// Start charging once you're given the opportunity.
|
||||
@@ -7581,55 +7507,55 @@ static void K_initKartHUD(void)
|
||||
|
||||
if (splitscreen) // Splitscreen
|
||||
{
|
||||
ITEM_X = 5;
|
||||
ITEM_Y = 3;
|
||||
ITEM_X = 5 + cv_item_xoffset.value;
|
||||
ITEM_Y = 3 + cv_item_yoffset.value;
|
||||
|
||||
LAPS_Y = (BASEVIDHEIGHT/2)-24;
|
||||
LAPS_Y = (BASEVIDHEIGHT/2)-24 + cv_laps_yoffset.value;
|
||||
|
||||
POSI_Y = (BASEVIDHEIGHT/2)- 2;
|
||||
POSI_Y = (BASEVIDHEIGHT/2)- 2 + cv_posi_yoffset.value;
|
||||
|
||||
STCD_Y = BASEVIDHEIGHT/4;
|
||||
STCD_Y = BASEVIDHEIGHT/4 + cv_stcd_yoffset.value;
|
||||
|
||||
MINI_Y = (BASEVIDHEIGHT/2);
|
||||
MINI_Y = (BASEVIDHEIGHT/2) + cv_mini_yoffset.value;
|
||||
|
||||
if (splitscreen > 1) // 3P/4P Small Splitscreen
|
||||
{
|
||||
// 1P (top left)
|
||||
ITEM_X = -9;
|
||||
ITEM_Y = -8;
|
||||
ITEM_X = -9 + cv_item_xoffset.value;
|
||||
ITEM_Y = -8 + cv_item_yoffset.value;
|
||||
|
||||
LAPS_X = 3;
|
||||
LAPS_Y = (BASEVIDHEIGHT/2)-13;
|
||||
LAPS_X = 3 + cv_laps_xoffset.value;
|
||||
LAPS_Y = (BASEVIDHEIGHT/2)-13 + cv_laps_yoffset.value;
|
||||
|
||||
POSI_X = 24;
|
||||
POSI_Y = (BASEVIDHEIGHT/2)- 16;
|
||||
POSI_X = 24 + cv_posi_xoffset.value;
|
||||
POSI_Y = (BASEVIDHEIGHT/2)- 16 + cv_posi_yoffset.value;
|
||||
|
||||
// 2P (top right)
|
||||
ITEM2_X = BASEVIDWIDTH-39;
|
||||
ITEM2_Y = -8;
|
||||
ITEM2_X = BASEVIDWIDTH-39 + cv_item_xoffset.value;
|
||||
ITEM2_Y = -8 + cv_item_yoffset.value;
|
||||
|
||||
LAPS2_X = BASEVIDWIDTH-3;
|
||||
LAPS2_Y = (BASEVIDHEIGHT/2)-13;
|
||||
LAPS2_X = BASEVIDWIDTH-3 + cv_laps_xoffset.value;
|
||||
LAPS2_Y = (BASEVIDHEIGHT/2)-13 + cv_laps_yoffset.value;
|
||||
|
||||
POSI2_X = BASEVIDWIDTH -4;
|
||||
POSI2_Y = (BASEVIDHEIGHT/2)- 16;
|
||||
POSI2_X = BASEVIDWIDTH -4 + cv_posi_xoffset.value;
|
||||
POSI2_Y = (BASEVIDHEIGHT/2)- 16 + cv_posi_yoffset.value;
|
||||
|
||||
// Reminder that 3P and 4P are just 1P and 2P splitscreen'd to the bottom.
|
||||
|
||||
STCD_X = BASEVIDWIDTH/4;
|
||||
STCD_X = BASEVIDWIDTH/4 + cv_stcd_xoffset.value;
|
||||
|
||||
MINI_X = (3*BASEVIDWIDTH/4);
|
||||
MINI_Y = (3*BASEVIDHEIGHT/4);
|
||||
MINI_X = (3*BASEVIDWIDTH/4) + cv_mini_xoffset.value;
|
||||
MINI_Y = (3*BASEVIDHEIGHT/4) + cv_mini_yoffset.value;
|
||||
|
||||
if (splitscreen > 2) // 4P-only
|
||||
{
|
||||
MINI_X = (BASEVIDWIDTH/2);
|
||||
MINI_Y = (BASEVIDHEIGHT/2);
|
||||
MINI_X = (BASEVIDWIDTH/2) + cv_mini_xoffset.value;
|
||||
MINI_Y = (BASEVIDHEIGHT/2) + cv_mini_yoffset.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timeinmap > 113 || forceshowhud)
|
||||
if (timeinmap > 113)
|
||||
hudtrans = cv_translucenthud.value;
|
||||
else if (timeinmap > 105)
|
||||
hudtrans = ((((INT32)timeinmap) - 105)*cv_translucenthud.value)/(113-105);
|
||||
@@ -7784,6 +7710,49 @@ static void K_drawKartStats(void)
|
||||
|
||||
if (!LUA_HudEnabled(hud_statdisplay))
|
||||
return;
|
||||
|
||||
// I tried my best, but this is still mess :/
|
||||
if (splitscreen)
|
||||
{
|
||||
if (splitscreen == 1)
|
||||
{
|
||||
// If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping
|
||||
// to bottom
|
||||
if (splitnum == 0)
|
||||
{
|
||||
y /= 2;
|
||||
flags = V_SNAPTOLEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can move it down a bit
|
||||
y += 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// In 4-player splitscreen...
|
||||
flags = 0;
|
||||
|
||||
// ...For players 2 and 4, which are at right side, we move x coordinate...
|
||||
if (splitnum == 1 || splitnum == 3)
|
||||
x += BASEVIDWIDTH/2;
|
||||
// ...Else, for players on left side we can snap position to left...
|
||||
else
|
||||
flags |= V_SNAPTOLEFT;
|
||||
|
||||
// ...For players 1 and 2, which are at top side, we move y coordinate...
|
||||
if (splitnum == 0 || splitnum == 1)
|
||||
y /= 2;
|
||||
// ...Else, for players on bottom side we can snap position to bottom
|
||||
else
|
||||
{
|
||||
flags |= V_SNAPTOBOTTOM;
|
||||
// Can move it down a bit
|
||||
y += 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Internal offset for speedometer
|
||||
if (cv_kartspeedometer.value)
|
||||
@@ -7795,49 +7764,10 @@ static void K_drawKartStats(void)
|
||||
}
|
||||
else
|
||||
spdoffset = 0;
|
||||
|
||||
|
||||
// Customizations c:
|
||||
if (!splitscreen)
|
||||
{
|
||||
x += 18 + cv_stat_xoffset.value;
|
||||
y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset;
|
||||
}
|
||||
else if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c:
|
||||
{
|
||||
x -= 10;
|
||||
y -= 40;
|
||||
y += (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0);
|
||||
|
||||
// If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping
|
||||
// to bottom
|
||||
if (splitnum == 0)
|
||||
{
|
||||
y /= 2;
|
||||
flags = V_SNAPTOLEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can move it down a bit
|
||||
y += 45;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (splitnum == 0 || splitnum == 2) // If we are P1 or P3...
|
||||
{
|
||||
// ye i just align it to position number lol
|
||||
x = POSI_X + 19;
|
||||
y = POSI_Y - 6;
|
||||
flags = V_SNAPTOLEFT|((splitnum == 2) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
x = POSI2_X - 75;
|
||||
y = POSI2_Y - 6;
|
||||
flags = V_SNAPTORIGHT|((splitnum == 3) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
||||
}
|
||||
}
|
||||
|
||||
x += 18 + cv_stat_xoffset.value;
|
||||
y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset;
|
||||
flags |= V_HUDTRANS;
|
||||
|
||||
skin_t *fakeskin;
|
||||
@@ -8181,6 +8111,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
||||
{
|
||||
// TIME_X = BASEVIDWIDTH-124; // 196
|
||||
// TIME_Y = 6; // 6
|
||||
|
||||
tic_t worktime;
|
||||
|
||||
INT32 splitflags = 0;
|
||||
if (!mode)
|
||||
@@ -8205,51 +8137,63 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
||||
|
||||
TX += 33;
|
||||
|
||||
if (drawtime == UINT32_MAX)
|
||||
;
|
||||
else if (mode && !drawtime)
|
||||
worktime = drawtime/(60*TICRATE);
|
||||
|
||||
if (mode && !drawtime)
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("--'--\"--"));
|
||||
else if (worktime < 100) // 99:99:99 only
|
||||
{
|
||||
if ((cv_timelimit.value && G_BattleGametype()) && (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value)) // i hate this so much
|
||||
{
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("OVERTIME"));
|
||||
return;
|
||||
}
|
||||
|
||||
// zero minute
|
||||
if (worktime < 10)
|
||||
{
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("0"));
|
||||
// minutes time 0 __ __
|
||||
V_DrawKartString(TX+12, TY+3, splitflags, va("%d", worktime));
|
||||
}
|
||||
// minutes time 0 __ __
|
||||
else
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("%d", worktime));
|
||||
|
||||
// apostrophe location _'__ __
|
||||
V_DrawKartString(TX+24, TY+3, splitflags, va("'"));
|
||||
|
||||
worktime = (drawtime/TICRATE % 60);
|
||||
|
||||
// zero second _ 0_ __
|
||||
if (worktime < 10)
|
||||
{
|
||||
V_DrawKartString(TX+36, TY+3, splitflags, va("0"));
|
||||
// seconds time _ _0 __
|
||||
V_DrawKartString(TX+48, TY+3, splitflags, va("%d", worktime));
|
||||
}
|
||||
// zero second _ 00 __
|
||||
else
|
||||
V_DrawKartString(TX+36, TY+3, splitflags, va("%d", worktime));
|
||||
|
||||
// quotation mark location _ __"__
|
||||
V_DrawKartString(TX+60, TY+3, splitflags, va("\""));
|
||||
}
|
||||
else
|
||||
{
|
||||
tic_t worktime = drawtime/(60*TICRATE);
|
||||
|
||||
if ((G_BattleGametype() && cv_timelimit.value) && (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value)) // i hate this so much
|
||||
worktime = G_TicsToCentiseconds(drawtime);
|
||||
|
||||
// zero tick _ __ 0_
|
||||
if (worktime < 10)
|
||||
{
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("OVERTIME"));
|
||||
V_DrawKartString(TX+72, TY+3, splitflags, va("0"));
|
||||
// tics _ __ _0
|
||||
V_DrawKartString(TX+84, TY+3, splitflags, va("%d", worktime));
|
||||
}
|
||||
else if (worktime < 100)
|
||||
{
|
||||
// minutes time 00 __ __
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartString(TX+12, TY+3, splitflags, va("%d", worktime%10));
|
||||
|
||||
// apostrophe location _'__ __
|
||||
V_DrawKartString(TX+24, TY+3, splitflags, va("'"));
|
||||
|
||||
worktime = (drawtime/TICRATE % 60);
|
||||
|
||||
// seconds time _ 00 __
|
||||
V_DrawKartString(TX+36, TY+3, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartString(TX+48, TY+3, splitflags, va("%d", worktime%10));
|
||||
|
||||
// quotation mark location _ __"__
|
||||
V_DrawKartString(TX+60, TY+3, splitflags, va("\""));
|
||||
|
||||
worktime = G_TicsToCentiseconds(drawtime);
|
||||
|
||||
// tics _ __ 00
|
||||
V_DrawKartString(TX+72, TY+3, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartString(TX+84, TY+3, splitflags, va("%d", worktime%10));
|
||||
}
|
||||
else if ((drawtime/TICRATE) & 1)
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("99'59\"99"));
|
||||
// zero tick _ __ 00
|
||||
else
|
||||
V_DrawKartString(TX+72, TY+3, splitflags, va("%d", worktime));
|
||||
}
|
||||
else if ((drawtime/TICRATE) & 1)
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("99'59\"99"));
|
||||
|
||||
if (emblemmap && (modeattacking || (mode == 1)) && !demo.playback) // emblem time!
|
||||
{
|
||||
@@ -8763,7 +8707,7 @@ static void K_drawKartLaps(void)
|
||||
else
|
||||
V_DrawMappedPatch(fx, fy, V_HUDTRANS|splitflags, kp_lapstickerclr, colormap);
|
||||
}
|
||||
|
||||
|
||||
if (stplyr->exiting)
|
||||
V_DrawKartString(fx+33, fy+3, V_HUDTRANS|splitflags, "FIN");
|
||||
else
|
||||
@@ -8778,7 +8722,7 @@ static void K_drawKartSpeedometer(void)
|
||||
return;
|
||||
|
||||
fixed_t convSpeed = 0;
|
||||
|
||||
|
||||
//KartZ speedo
|
||||
fixed_t fuspeed = 0;
|
||||
INT32 spdpatch = 0;
|
||||
@@ -8916,14 +8860,6 @@ static void K_drawKartBumpersOrKarma(void)
|
||||
fy = info.y;
|
||||
fflags = info.flags;
|
||||
|
||||
if (cv_battlespeedo.value && !splitscreen)
|
||||
{
|
||||
if ((cv_newspeedometer.value == 2 && xtra_speedo) || (cv_newspeedometer.value == 3 && achi_speedo) || (cv_newspeedometer.value == 5 && xtra_speedo3))
|
||||
fy += 5;
|
||||
else
|
||||
fy += 7;
|
||||
}
|
||||
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
if (stplyr->kartstuff[k_bumper] <= 0)
|
||||
@@ -9060,11 +8996,11 @@ static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *targe
|
||||
offset = FixedMul(FINETANGENT(((aimingangle+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), xres);
|
||||
// this isn't fovtan... what am i even doing anymore
|
||||
if (splitscreen == 1)
|
||||
offset = 17*offset/120;
|
||||
#ifdef HWRENDER
|
||||
offset = 17*offset/10;
|
||||
// OpenGL with software perspective is miscentered on non-16:10 resolutions
|
||||
//if (rendermode == render_opengl)
|
||||
//offset = FixedMul(offset, FixedDiv(104857, FixedDiv(xres, yres)));
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
offset = FixedMul(offset, FixedDiv(104857, FixedDiv(xres, yres)));
|
||||
#endif
|
||||
// thanks fickle
|
||||
offset = FixedDiv(offset, fovratio);
|
||||
@@ -9087,14 +9023,12 @@ static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *targe
|
||||
int splitindex = stplyrnum;
|
||||
|
||||
// adjust coords for splitscreen
|
||||
if (splitscreen == 1) // 2P
|
||||
{
|
||||
if (splitscreen == 1){ // 2P
|
||||
y = y>>1;
|
||||
if (splitindex)
|
||||
y = y + yres;
|
||||
}
|
||||
if (splitscreen >= 2) // 3P or 4P
|
||||
{
|
||||
if (splitscreen >= 2) { // 3P or 4P
|
||||
x = x>>1;
|
||||
y = y>>1;
|
||||
if (splitindex & 1)
|
||||
@@ -9363,20 +9297,9 @@ static void K_drawDriftGauge(void)
|
||||
0, 31, 47, 63, 79, 95, 111, 119, 127, 143, 159, 175, 183, 191, 199, 207, 223, 247
|
||||
};
|
||||
|
||||
if (demo.playback && demo.freecam)
|
||||
if (!stplyr->mo || !stplyr->kartstuff[k_drift] || (!splitscreen && !camera->chase))
|
||||
return;
|
||||
|
||||
if (!stplyr->mo || (!splitscreen && !camera->chase))
|
||||
return;
|
||||
|
||||
if (forceshowhud)
|
||||
goto skipcrap; // i will skip the drift early return and you cant stop me!
|
||||
|
||||
if (!stplyr->kartstuff[k_drift])
|
||||
return;
|
||||
|
||||
skipcrap:
|
||||
|
||||
if (!K_GetScreenCoords(&pos, stplyr, stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false))
|
||||
return;
|
||||
|
||||
@@ -9429,7 +9352,9 @@ skipcrap:
|
||||
{
|
||||
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
|
||||
for (i = 0; i < 4; i++)
|
||||
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 18 - 1)] + i*2) | V_NOSCALESTART|drifttrans);
|
||||
{
|
||||
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[(leveltime % 18) + 1] + i*2) | V_NOSCALESTART|drifttrans);
|
||||
}
|
||||
}
|
||||
else // none/blue/red
|
||||
{
|
||||
@@ -9618,7 +9543,7 @@ static void K_drawKartPlayerCheck(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, patch_t *AutomapPic)
|
||||
{
|
||||
// amnum xpos & ypos are the icon's speed around the HUD.
|
||||
// The number being divided by is for how fast it moves.
|
||||
@@ -9633,17 +9558,60 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
fixed_t amnumxpos, amnumypos;
|
||||
INT32 amxpos, amypos;
|
||||
|
||||
if (mo->skin)
|
||||
skin = ((skin_t*)(mo->localskin ? mo->localskin : mo->skin))-(skinlocal ? localskins : skins);
|
||||
node_t *bsp = &nodes[numnodes-1];
|
||||
fixed_t maxx, minx, maxy, miny;
|
||||
|
||||
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x);
|
||||
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y);
|
||||
fixed_t mapwidth, mapheight;
|
||||
fixed_t xoffset, yoffset;
|
||||
fixed_t xscale, yscale, zoom;
|
||||
|
||||
if (mo->skin)
|
||||
skin = ((skin_t*)((mo->localskin) ? mo->localskin : mo->skin))-((skinlocal) ? localskins : skins);
|
||||
|
||||
maxx = maxy = INT32_MAX;
|
||||
minx = miny = INT32_MIN;
|
||||
minx = bsp->bbox[0][BOXLEFT];
|
||||
maxx = bsp->bbox[0][BOXRIGHT];
|
||||
miny = bsp->bbox[0][BOXBOTTOM];
|
||||
maxy = bsp->bbox[0][BOXTOP];
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minx)
|
||||
minx = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > maxx)
|
||||
maxx = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < miny)
|
||||
miny = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > maxy)
|
||||
maxy = bsp->bbox[1][BOXTOP];
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
mapwidth = maxx - minx;
|
||||
mapheight = maxy - miny;
|
||||
|
||||
// These should always be small enough to be bitshift back right now
|
||||
xoffset = (minx + mapwidth/2)<<FRACBITS;
|
||||
yoffset = (miny + mapheight/2)<<FRACBITS;
|
||||
|
||||
xscale = FixedDiv(AutomapPic->width, mapwidth);
|
||||
yscale = FixedDiv(AutomapPic->height, mapheight);
|
||||
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
|
||||
|
||||
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), zoom) - FixedMul(xoffset, zoom));
|
||||
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), zoom) - FixedMul(yoffset, zoom));
|
||||
|
||||
if (encoremode)
|
||||
amnumxpos = -amnumxpos;
|
||||
|
||||
amxpos = amnumxpos + ((x + (SHORT(minimapinfo.minimap_pic->width)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width))/2)<<FRACBITS);
|
||||
amypos = amnumypos + ((y + (SHORT(minimapinfo.minimap_pic->height)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height))/2)<<FRACBITS);
|
||||
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin]->width/2))<<FRACBITS);
|
||||
amypos = amnumypos + ((y + AutomapPic->height/2 - (((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin]->height/2))<<FRACBITS);
|
||||
|
||||
if (!mo->color) // 'default' color
|
||||
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
|
||||
@@ -9681,6 +9649,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
|
||||
static void K_drawKartMinimap(void)
|
||||
{
|
||||
INT32 lumpnum;
|
||||
patch_t *AutomapPic;
|
||||
INT32 i = 0;
|
||||
INT32 x, y;
|
||||
INT32 minimaptrans, splitflags;
|
||||
@@ -9695,21 +9665,21 @@ static void K_drawKartMinimap(void)
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
return;
|
||||
|
||||
if (minimapinfo.minimap_pic == NULL)
|
||||
{
|
||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
|
||||
|
||||
if (lumpnum != -1)
|
||||
AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
|
||||
else
|
||||
return; // no pic, just get outta here
|
||||
}
|
||||
|
||||
drawinfo_t info;
|
||||
K_getMinimapDrawinfo(&info);
|
||||
x = info.x - (SHORT(minimapinfo.minimap_pic->width)/2);
|
||||
y = info.y - (SHORT(minimapinfo.minimap_pic->height)/2);
|
||||
x = info.x - (AutomapPic->width/2);
|
||||
y = info.y - (AutomapPic->height/2);
|
||||
splitflags = info.flags;
|
||||
|
||||
|
||||
if (forceshowhud)
|
||||
minimaptrans = cv_kartminimap.value;
|
||||
else if (timeinmap > 105)
|
||||
if (timeinmap > 105)
|
||||
{
|
||||
minimaptrans = cv_kartminimap.value;
|
||||
if (timeinmap <= 113)
|
||||
@@ -9724,9 +9694,9 @@ static void K_drawKartMinimap(void)
|
||||
splitflags |= minimaptrans;
|
||||
|
||||
if (encoremode)
|
||||
V_DrawScaledPatch(x+SHORT(minimapinfo.minimap_pic->width), y, splitflags|V_FLIP, minimapinfo.minimap_pic);
|
||||
V_DrawScaledPatch(x+(AutomapPic->width), y, splitflags|V_FLIP, AutomapPic);
|
||||
else
|
||||
V_DrawScaledPatch(x, y, splitflags, minimapinfo.minimap_pic);
|
||||
V_DrawScaledPatch(x, y, splitflags, AutomapPic);
|
||||
|
||||
if (!(splitscreen == 2))
|
||||
{
|
||||
@@ -9736,10 +9706,10 @@ static void K_drawKartMinimap(void)
|
||||
|
||||
// let offsets transfer to the heads, too!
|
||||
if (encoremode)
|
||||
x += SHORT(minimapinfo.minimap_pic->leftoffset);
|
||||
x += SHORT(AutomapPic->leftoffset);
|
||||
else
|
||||
x -= SHORT(minimapinfo.minimap_pic->leftoffset);
|
||||
y -= SHORT(minimapinfo.minimap_pic->topoffset);
|
||||
x -= SHORT(AutomapPic->leftoffset);
|
||||
y -= SHORT(AutomapPic->topoffset);
|
||||
|
||||
// initialize
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -9751,7 +9721,7 @@ static void K_drawKartMinimap(void)
|
||||
demoghost *g = ghosts;
|
||||
while (g)
|
||||
{
|
||||
K_drawKartMinimapHead(g->mo, x, y, splitflags);
|
||||
K_drawKartMinimapHead(g->mo, x, y, splitflags, AutomapPic);
|
||||
g = g->next;
|
||||
}
|
||||
|
||||
@@ -9792,7 +9762,7 @@ static void K_drawKartMinimap(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
K_drawKartMinimapHead(players[i].mo, x, y, splitflags);
|
||||
K_drawKartMinimapHead(players[i].mo, x, y, splitflags, AutomapPic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9804,7 +9774,7 @@ static void K_drawKartMinimap(void)
|
||||
{
|
||||
if (i == -1)
|
||||
continue; // this doesn't interest us
|
||||
K_drawKartMinimapHead(players[localplayers[i]].mo, x, y, splitflags);
|
||||
K_drawKartMinimapHead(players[localplayers[i]].mo, x, y, splitflags, AutomapPic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10522,27 +10492,9 @@ void K_drawKartHUD(void)
|
||||
// If not splitscreen, draw...
|
||||
if (!splitscreen && !demo.title)
|
||||
{
|
||||
tic_t realtime = stplyr->realtime;
|
||||
|
||||
if (cv_showlaptimes.value
|
||||
&& stplyr->kartstuff[k_lapanimation]
|
||||
&& !stplyr->exiting
|
||||
&& stplyr->laptime[LAP_LAST] != 0
|
||||
&& !midgamejoin)
|
||||
{
|
||||
if ((stplyr->kartstuff[k_lapanimation] / 5) & 1)
|
||||
{
|
||||
realtime = stplyr->laptime[LAP_LAST];
|
||||
}
|
||||
else
|
||||
{
|
||||
realtime = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the timestamp
|
||||
if (LUA_HudEnabled(hud_time))
|
||||
K_drawKartTimestamp(realtime, TIME_X, TIME_Y, gamemap, 0);
|
||||
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, 0);
|
||||
|
||||
if (!modeattacking)
|
||||
{
|
||||
@@ -10569,7 +10521,6 @@ void K_drawKartHUD(void)
|
||||
if (demo.title) // Draw title logo instead in demo.titles
|
||||
{
|
||||
INT32 x = (BASEVIDWIDTH - 32)*FRACUNIT, y = 128*FRACUNIT, offs;
|
||||
INT32 logoflags = V_SNAPTORIGHT|V_SNAPTOBOTTOM;
|
||||
|
||||
if (splitscreen == 3)
|
||||
{
|
||||
@@ -10588,8 +10539,8 @@ void K_drawKartHUD(void)
|
||||
x += offs - frac;
|
||||
}
|
||||
|
||||
V_DrawSciencePatch(x - (54*FRACUNIT), y, logoflags, W_CachePatchName("TTKBANNR", PU_CACHE), FRACUNIT/4);
|
||||
V_DrawSciencePatch(x - (54*FRACUNIT), y + (25*FRACUNIT), logoflags, W_CachePatchName("TTKART", PU_CACHE), FRACUNIT/4);
|
||||
V_DrawSciencePatch(x - (54*FRACUNIT), y, 0, W_CachePatchName("TTKBANNR", PU_CACHE), FRACUNIT/4);
|
||||
V_DrawSciencePatch(x - (54*FRACUNIT), y + (25*FRACUNIT), 0, W_CachePatchName("TTKART", PU_CACHE), FRACUNIT/4);
|
||||
}
|
||||
else if (G_RaceGametype()) // Race-only elements
|
||||
{
|
||||
@@ -10685,9 +10636,6 @@ void K_drawKartHUD(void)
|
||||
if (cv_kartdebugcheckpoint.value)
|
||||
K_drawCheckpointDebugger();
|
||||
|
||||
if (cv_kartdebugdirector.value)
|
||||
K_DrawDirectorDebugger();
|
||||
|
||||
if (cv_kartdebugnodes.value)
|
||||
{
|
||||
UINT8 p;
|
||||
|
||||
+1
-2
@@ -31,7 +31,6 @@ extern consvar_t cv_highresportrait;
|
||||
extern consvar_t cv_stat_xoffset;
|
||||
extern consvar_t cv_stat_yoffset;
|
||||
extern consvar_t cv_showstats;
|
||||
extern consvar_t cv_showlaptimes;
|
||||
extern consvar_t cv_battlespeedo;
|
||||
|
||||
#define NUMSPEEDOSTUFF 6
|
||||
@@ -92,7 +91,7 @@ void K_UpdateSpectateGrief(void);
|
||||
void K_PlayAttackTaunt(mobj_t *source);
|
||||
void K_PlayBoostTaunt(mobj_t *source);
|
||||
void K_PlayOvertakeSound(mobj_t *source);
|
||||
void K_PlayHitEmSound(mobj_t *source, mobj_t *victim);
|
||||
void K_PlayHitEmSound(mobj_t *source);
|
||||
void K_PlayPowerGloatSound(mobj_t *source);
|
||||
|
||||
const char *K_GetItemPatch(UINT8 item, boolean tiny);
|
||||
|
||||
+8
-83
@@ -20,7 +20,6 @@
|
||||
#include "m_random.h"
|
||||
#include "s_sound.h"
|
||||
#include "g_game.h"
|
||||
#include "g_input.h"
|
||||
#include "hu_stuff.h" // HU_AddChatText
|
||||
#include "console.h"
|
||||
#include "k_kart.h" // SRB2Kart
|
||||
@@ -656,7 +655,7 @@ static int lib_pSpawnShadowMobj(lua_State *L)
|
||||
NOHUD
|
||||
if (!caster)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_SpawnShadowMobj(caster);
|
||||
caster->haveshadow = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1259,7 +1258,6 @@ static int lib_pPlayRinglossSound(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
player_t *player = NULL;
|
||||
mobj_t *damager = NULL;
|
||||
NOHUD
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
@@ -1269,15 +1267,8 @@ static int lib_pPlayRinglossSound(lua_State *L)
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!lua_isnoneornil(L, 3))
|
||||
{
|
||||
damager = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
||||
if (!damager)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
P_PlayRinglossSound(source, damager);
|
||||
P_PlayRinglossSound(source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1553,9 +1544,8 @@ static int lib_pSetSkyboxMobj(lua_State *L)
|
||||
// Shhh, neither does P_StartQuake.
|
||||
static int lib_pStartQuake(lua_State *L)
|
||||
{
|
||||
tic_t q_time = (tic_t)luaL_checkinteger(L, 2);
|
||||
fixed_t q_intensity = luaL_checkinteger(L, 1);
|
||||
fixed_t q_radius = luaL_optinteger(L, 4, 512<<FRACBITS);
|
||||
UINT16 q_time = (UINT16)luaL_checkinteger(L, 2);
|
||||
static mappoint_t q_epicenter = {0,0,0};
|
||||
|
||||
NOHUD
|
||||
@@ -1607,8 +1597,11 @@ static int lib_pStartQuake(lua_State *L)
|
||||
}
|
||||
else
|
||||
quake.epicenter = NULL;
|
||||
quake.radius = luaL_optinteger(L, 4, 512*FRACUNIT);
|
||||
|
||||
P_StartQuake(q_time, q_intensity, q_radius);
|
||||
// These things are actually used in 2.1.
|
||||
quake.intensity = q_intensity;
|
||||
quake.time = q_time;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2563,22 +2556,10 @@ static int lib_kOvertakeSound(lua_State *L)
|
||||
static int lib_kHitEmSound(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *victim = NULL;
|
||||
|
||||
if (!lua_isnoneornil(L, 2))
|
||||
{
|
||||
victim = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
if (!victim)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
}
|
||||
|
||||
NOHUD
|
||||
if (!mobj->player)
|
||||
return luaL_error(L, "K_PlayHitEmSound: mobj_t isn't a player object."); //Nothing bad would happen if we let it run the func, but telling why it ain't doing anything is helpful.
|
||||
if (victim && !victim->player)
|
||||
return luaL_error(L, "K_PlayHitEmSound: mobj_t isn't a player object."); //Same as above
|
||||
|
||||
K_PlayHitEmSound(mobj, victim);
|
||||
K_PlayHitEmSound(mobj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3019,58 +3000,6 @@ static int lib_kSetHyuCountdown(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// G_INPUT
|
||||
////////////
|
||||
|
||||
static int lib_gSetPlayerGamepadIndicatorColor(lua_State *L)
|
||||
{
|
||||
INT32 player = -1;
|
||||
player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
|
||||
UINT16 color = (UINT16)luaL_checkinteger(L, 2); // skincolor
|
||||
|
||||
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
|
||||
{
|
||||
if (plr - players == displayplayers[i])
|
||||
{
|
||||
player = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Not a local player
|
||||
if (player == -1) return 0;
|
||||
|
||||
// pls update with color 0 when youre done with changing led stuff so it can get player color again
|
||||
G_SetPlayerGamepadIndicatorColor(player, color);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_gPlayerDeviceRumble(lua_State *L)
|
||||
{
|
||||
INT32 player = -1;
|
||||
player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
|
||||
UINT16 low_strength = (UINT16)luaL_checkinteger(L, 2); // low frequency rumble motor strenght
|
||||
UINT16 high_strength = (UINT16)luaL_checkinteger(L, 3); // high frequency rumble motor strenght
|
||||
UINT32 duration = (UINT32)luaL_optinteger(L, 4, 84); // duration of rumble in ms
|
||||
|
||||
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
|
||||
{
|
||||
if (plr - players == displayplayers[i])
|
||||
{
|
||||
player = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Not a local player
|
||||
if (player == -1) return 0;
|
||||
|
||||
G_PlayerDeviceRumble(player, low_strength, high_strength, duration);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static luaL_Reg lib[] = {
|
||||
{"print", lib_print},
|
||||
{"chatprint", lib_chatprint},
|
||||
@@ -3318,10 +3247,6 @@ static luaL_Reg lib[] = {
|
||||
{"K_SetIndirectItemCooldown",lib_kSetIndirectItemCountdown},
|
||||
{"K_SetHyudoroCooldown",lib_kSetHyuCountdown},
|
||||
|
||||
//g_input
|
||||
{"G_SetPlayerGamepadIndicatorColor",lib_gSetPlayerGamepadIndicatorColor},
|
||||
{"G_PlayerDeviceRumble",lib_gPlayerDeviceRumble},
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
+13
-56
@@ -81,9 +81,6 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
||||
lua_pushstring(gL, buf);
|
||||
}
|
||||
LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too.
|
||||
|
||||
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
|
||||
|
||||
return;
|
||||
|
||||
deny:
|
||||
@@ -146,7 +143,7 @@ void COM_Lua_f(void)
|
||||
if (netgame && !( flags & COM_LOCAL ))/* don't send local commands */
|
||||
{ // Send the command through the network
|
||||
UINT8 argc;
|
||||
lua_pop(gL, 2); // pop command info table and LUA_GetErrorMessage
|
||||
lua_pop(gL, 1); // pop command info table
|
||||
|
||||
if (flags & COM_ADMIN && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command.
|
||||
{
|
||||
@@ -185,8 +182,6 @@ void COM_Lua_f(void)
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
lua_pushstring(gL, COM_Argv(i));
|
||||
LUA_Call(gL, (int)COM_Argc(), 0, 1); // COM_Argc is 1-based, so this will cover the player we passed too.
|
||||
|
||||
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
|
||||
}
|
||||
|
||||
// Wrapper for COM_AddCommand
|
||||
@@ -458,11 +453,9 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
|
||||
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && stricmp(cvar->string, "0"))))
|
||||
{
|
||||
char *temp = NULL;
|
||||
|
||||
if (!category)
|
||||
{
|
||||
temp = strdup(wadfiles[numwadfiles - 1]->filename);
|
||||
char *temp = strdup(wadfiles[numwadfiles - 1]->filename);
|
||||
nameonly(temp);
|
||||
|
||||
category = temp;
|
||||
@@ -472,8 +465,6 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
M_SlotCvarIntoModMenu(cvar, category, menu_name);
|
||||
else
|
||||
M_SlotCvarIntoModMenu(cvar, category, cvar->name);
|
||||
|
||||
free (temp);
|
||||
}
|
||||
|
||||
// return cvar userdata
|
||||
@@ -589,59 +580,27 @@ static luaL_Reg lib[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
enum cvar_e
|
||||
{
|
||||
cvar_name,
|
||||
cvar_defaultvalue,
|
||||
cvar_flags,
|
||||
cvar_value,
|
||||
cvar_string,
|
||||
cvar_changed,
|
||||
};
|
||||
|
||||
static const char *const cvar_opt[] = {
|
||||
"name",
|
||||
"defaultvalue",
|
||||
"flags",
|
||||
"value",
|
||||
"string",
|
||||
"changed",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int cvar_fields_ref = LUA_NOREF;
|
||||
|
||||
static int cvar_get(lua_State *L)
|
||||
{
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
enum cvar_e field = Lua_optoption(L, 2, -1, cvar_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case cvar_name:
|
||||
if(fastcmp(field,"name"))
|
||||
lua_pushstring(L, cvar->name);
|
||||
break;
|
||||
case cvar_defaultvalue:
|
||||
else if(fastcmp(field,"defaultvalue"))
|
||||
lua_pushstring(L, cvar->defaultvalue);
|
||||
break;
|
||||
case cvar_flags:
|
||||
else if(fastcmp(field,"flags"))
|
||||
lua_pushinteger(L, cvar->flags);
|
||||
break;
|
||||
case cvar_value:
|
||||
else if(fastcmp(field,"value"))
|
||||
lua_pushinteger(L, cvar->value);
|
||||
break;
|
||||
case cvar_string:
|
||||
else if(fastcmp(field,"string"))
|
||||
lua_pushstring(L, cvar->string);
|
||||
break;
|
||||
case cvar_changed:
|
||||
else if(fastcmp(field,"changed"))
|
||||
lua_pushboolean(L, cvar->changed);
|
||||
break;
|
||||
default:
|
||||
if (devparm)
|
||||
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, field);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if (devparm)
|
||||
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, field);
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -653,8 +612,6 @@ int LUA_ConsoleLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L,1);
|
||||
|
||||
cvar_fields_ref = Lua_CreateFieldTable(L, cvar_opt);
|
||||
|
||||
// Set empty registry tables
|
||||
lua_newtable(L);
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "COM_Command");
|
||||
|
||||
+1
-4
@@ -55,7 +55,6 @@ enum hook {
|
||||
hook_PlayerCmd, //SRB2KART
|
||||
hook_IntermissionThinker, //SRB2KART
|
||||
hook_VoteThinker, //SRB2KART
|
||||
hook_ServerJoin, // SRB2KART - Saturn 32p
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
@@ -107,10 +106,8 @@ boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); //
|
||||
boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
|
||||
void LUAh_ServerJoin(void); // SRB2KART - Saturn 32p: called by client when joining a server, allows lua to load any sort of config file
|
||||
|
||||
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
|
||||
|
||||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
+787
-1008
File diff suppressed because it is too large.
Load diff
+2
-10
@@ -106,8 +106,6 @@ static const char *const hudhook_opt[] = {
|
||||
"vote",
|
||||
NULL};
|
||||
|
||||
static int patch_fields_ref = LUA_NOREF;
|
||||
|
||||
// alignment types for v.drawString
|
||||
enum align {
|
||||
align_left = 0,
|
||||
@@ -231,8 +229,6 @@ static const char *const hud_drawinfo_options[] = {
|
||||
"minimap",
|
||||
NULL};
|
||||
|
||||
static int camera_fields_ref = LUA_NOREF;
|
||||
|
||||
static int lib_getHudInfo(lua_State *L)
|
||||
{
|
||||
UINT32 i;
|
||||
@@ -302,7 +298,7 @@ static int colormap_get(lua_State *L)
|
||||
static int patch_get(lua_State *L)
|
||||
{
|
||||
patch_t *patch = *((patch_t **)luaL_checkudata(L, 1, META_PATCH));
|
||||
enum patch field = Lua_optoption(L, 2, -1, patch_fields_ref);
|
||||
enum patch field = luaL_checkoption(L, 2, NULL, patch_opt);
|
||||
|
||||
// patches are CURRENTLY always valid, expected to be cached with PU_STATIC
|
||||
// this may change in the future, so patch.valid still exists
|
||||
@@ -337,7 +333,7 @@ static int patch_set(lua_State *L)
|
||||
static int camera_get(lua_State *L)
|
||||
{
|
||||
camera_t *cam = *((camera_t **)luaL_checkudata(L, 1, META_CAMERA));
|
||||
enum cameraf field = Lua_optoption(L, 2, -1, camera_fields_ref);
|
||||
enum cameraf field = luaL_checkoption(L, 2, NULL, camera_opt);
|
||||
|
||||
// cameras should always be valid unless I'm a nutter
|
||||
I_Assert(cam != NULL);
|
||||
@@ -1443,15 +1439,11 @@ int LUA_HudLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L,1);
|
||||
|
||||
patch_fields_ref = Lua_CreateFieldTable(L, patch_opt);
|
||||
|
||||
luaL_newmetatable(L, META_CAMERA);
|
||||
lua_pushcfunction(L, camera_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L,1);
|
||||
|
||||
camera_fields_ref = Lua_CreateFieldTable(L, camera_opt);
|
||||
|
||||
luaL_register(L, "hud", lib_hud);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ static UINT64 GetItemId(void)
|
||||
return 0;
|
||||
|
||||
// leave bits 0 and 1 free for the string mode
|
||||
UINT64 id = ((UINT64)(uintptr_t)gL->savedpc << 32) | (hud_interpcounter << 10) | (hud_interptag << 2);
|
||||
UINT64 id = ((uintptr_t)gL->savedpc << 32) | (hud_interpcounter << 10) | (hud_interptag << 2);
|
||||
|
||||
if (hud_interplatch)
|
||||
{
|
||||
@@ -632,18 +632,12 @@ void LUA_HUD_DrawList(huddrawlist_h list)
|
||||
switch (item->type)
|
||||
{
|
||||
case DI_Draw:
|
||||
if (!item->patch || item->patch == NULL)
|
||||
return;
|
||||
V_DrawFixedPatch(LERPS(x), LERPS(y), FRACUNIT, item->flags, item->patch, item->colormap);
|
||||
break;
|
||||
case DI_DrawScaled:
|
||||
if (!item->patch || item->patch == NULL)
|
||||
return;
|
||||
V_DrawFixedPatch(LERPS(x), LERPS(y), LERP(scale), item->flags, item->patch, item->colormap);
|
||||
break;
|
||||
case DI_DrawStretched:
|
||||
if (!item->patch || item->patch == NULL)
|
||||
return;
|
||||
V_DrawStretchyFixedPatch(LERPS(x), LERPS(y), LERP(hscale), LERP(vscale), item->flags, item->patch, item->colormap);
|
||||
break;
|
||||
case DI_DrawNum:
|
||||
|
||||
+162
-354
@@ -23,10 +23,34 @@
|
||||
#include "lua_hud.h" // hud_running errors
|
||||
#include "lua_hook.h" // cmd errors
|
||||
|
||||
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
|
||||
boolean LUA_CallAction(const char *action, mobj_t *actor);
|
||||
state_t *astate;
|
||||
|
||||
boolean actionsoverridden[NUMACTIONS] = {false};
|
||||
enum sfxinfo_read {
|
||||
sfxinfor_name = 0,
|
||||
sfxinfor_singular,
|
||||
sfxinfor_priority,
|
||||
sfxinfor_flags, // "pitch"
|
||||
sfxinfor_skinsound
|
||||
};
|
||||
const char *const sfxinfo_ropt[] = {
|
||||
"name",
|
||||
"singular",
|
||||
"priority",
|
||||
"flags",
|
||||
"skinsound",
|
||||
NULL};
|
||||
|
||||
enum sfxinfo_write {
|
||||
sfxinfow_singular = 0,
|
||||
sfxinfow_priority,
|
||||
sfxinfow_flags // "pitch"
|
||||
};
|
||||
const char *const sfxinfo_wopt[] = {
|
||||
"singular",
|
||||
"priority",
|
||||
"flags",
|
||||
NULL};
|
||||
|
||||
//
|
||||
// Sprite Names
|
||||
@@ -77,7 +101,7 @@ static void A_Lua(mobj_t *actor)
|
||||
{
|
||||
boolean found = false;
|
||||
I_Assert(actor != NULL);
|
||||
|
||||
|
||||
lua_settop(gL, 0); // Just in case...
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
@@ -252,21 +276,27 @@ boolean LUA_SetLuaAction(void *stv, const char *action)
|
||||
return true; // action successfully set.
|
||||
}
|
||||
|
||||
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor)
|
||||
boolean LUA_CallAction(const char *csaction, mobj_t *actor)
|
||||
{
|
||||
I_Assert(csaction != NULL);
|
||||
I_Assert(actor != NULL);
|
||||
|
||||
if (!actionsoverridden[actionnum]) // The action is not overriden,
|
||||
if (!gL) // Lua isn't loaded,
|
||||
return false; // action not called.
|
||||
|
||||
if (superstack && fasticmp(actionpointers[actionnum].name, superactions[superstack-1])) // the action is calling itself,
|
||||
return false; // let it call the hardcoded function
|
||||
if (superstack && fasticmp(csaction, superactions[superstack-1])) // the action is calling itself,
|
||||
return false; // let it call the hardcoded function instead.
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
// grab function by uppercase name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, LREG_ACTIONS);
|
||||
lua_getfield(gL, -1, actionpointers[actionnum].name);
|
||||
{
|
||||
char *action = Z_StrDup(csaction);
|
||||
strupr(action);
|
||||
lua_getfield(gL, -1, action);
|
||||
Z_Free(action);
|
||||
}
|
||||
lua_remove(gL, -2); // pop LREG_ACTIONS
|
||||
|
||||
if (lua_isnil(gL, -1)) // no match
|
||||
@@ -289,7 +319,7 @@ boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor)
|
||||
lua_pushinteger(gL, var1);
|
||||
lua_pushinteger(gL, var2);
|
||||
|
||||
superactions[superstack] = actionpointers[actionnum].name;
|
||||
superactions[superstack] = csaction;
|
||||
++superstack;
|
||||
|
||||
LUA_Call(gL, 3, 0, -(2 + 3));
|
||||
@@ -300,93 +330,49 @@ boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor)
|
||||
return true; // action successfully called.
|
||||
}
|
||||
|
||||
enum state_e {
|
||||
state_sprite = 0,
|
||||
state_frame,
|
||||
state_tics,
|
||||
state_action,
|
||||
state_var1,
|
||||
state_var2,
|
||||
state_nextstate,
|
||||
};
|
||||
|
||||
const char *const state_opt[] = {
|
||||
"sprite",
|
||||
"frame",
|
||||
"tics",
|
||||
"action",
|
||||
"var1",
|
||||
"var2",
|
||||
"nextstate",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int state_fields_ref = LUA_NOREF;
|
||||
|
||||
// state_t *, field -> number
|
||||
static int state_get(lua_State *L)
|
||||
{
|
||||
state_t *st = *((state_t **)luaL_checkudata(L, 1, META_STATE));
|
||||
enum state_e field = Lua_optoption(L, 2, -1, state_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
lua_Integer number;
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case state_sprite:
|
||||
number = st->sprite;
|
||||
break;
|
||||
|
||||
case state_frame:
|
||||
number = st->frame;
|
||||
break;
|
||||
|
||||
case state_tics:
|
||||
number = st->tics;
|
||||
break;
|
||||
|
||||
case state_action:
|
||||
{
|
||||
const char *name;
|
||||
if (!st->action.acp1) // Action is NULL.
|
||||
return 0; // return nil.
|
||||
if (st->action.acp1 == (actionf_p1)A_Lua) { // This is a Lua function?
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_STATEACTION);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_pushlightuserdata(L, st); // Push the state pointer and
|
||||
lua_rawget(L, -2); // use it to get the actual Lua function.
|
||||
lua_remove(L, -2); // pop LREG_STATEACTION
|
||||
return 1; // Return the Lua function.
|
||||
}
|
||||
name = LUA_GetActionName(&st->action); // find a hardcoded function name
|
||||
if (!name) // If it's not a hardcoded function and it's not a Lua function...
|
||||
return 0; // Just what is this??
|
||||
// get the function from the global
|
||||
// because the metatable will trigger.
|
||||
lua_getglobal(L, name); // actually gets from LREG_ACTIONS if applicable, and pushes a new C closure if not.
|
||||
lua_pushstring(L, name); // push the name we found.
|
||||
return 2; // return both the function and its name, in case somebody wanted to do a comparison by name or something?
|
||||
if (fastcmp(field,"sprite"))
|
||||
number = st->sprite;
|
||||
else if (fastcmp(field,"frame"))
|
||||
number = st->frame;
|
||||
else if (fastcmp(field,"tics"))
|
||||
number = st->tics;
|
||||
else if (fastcmp(field,"action")) {
|
||||
const char *name;
|
||||
if (!st->action.acp1) // Action is NULL.
|
||||
return 0; // return nil.
|
||||
if (st->action.acp1 == (actionf_p1)A_Lua) { // This is a Lua function?
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_STATEACTION);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_pushlightuserdata(L, st); // Push the state pointer and
|
||||
lua_rawget(L, -2); // use it to get the actual Lua function.
|
||||
lua_remove(L, -2); // pop LREG_STATEACTION
|
||||
return 1; // Return the Lua function.
|
||||
}
|
||||
break;
|
||||
|
||||
case state_var1:
|
||||
number = st->var1;
|
||||
break;
|
||||
|
||||
case state_var2:
|
||||
number = st->var2;
|
||||
break;
|
||||
|
||||
case state_nextstate:
|
||||
number = st->nextstate;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if (devparm)
|
||||
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
name = LUA_GetActionName(&st->action); // find a hardcoded function name
|
||||
if (!name) // If it's not a hardcoded function and it's not a Lua function...
|
||||
return 0; // Just what is this??
|
||||
// get the function from the global
|
||||
// because the metatable will trigger.
|
||||
lua_getglobal(L, name); // actually gets from LREG_ACTIONS if applicable, and pushes a new C closure if not.
|
||||
lua_pushstring(L, name); // push the name we found.
|
||||
return 2; // return both the function and its name, in case somebody wanted to do a comparison by name or something?
|
||||
} else if (fastcmp(field,"var1"))
|
||||
number = st->var1;
|
||||
else if (fastcmp(field,"var2"))
|
||||
number = st->var2;
|
||||
else if (fastcmp(field,"nextstate"))
|
||||
number = st->nextstate;
|
||||
else if (devparm)
|
||||
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field);
|
||||
else
|
||||
return 0;
|
||||
|
||||
lua_pushinteger(L, number);
|
||||
return 1;
|
||||
@@ -396,7 +382,7 @@ static int state_get(lua_State *L)
|
||||
static int state_set(lua_State *L)
|
||||
{
|
||||
state_t *st = *((state_t **)luaL_checkudata(L, 1, META_STATE));
|
||||
enum state_e field = Lua_optoption(L, 2, -1, state_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
lua_Integer value;
|
||||
|
||||
if (hud_running)
|
||||
@@ -404,24 +390,16 @@ static int state_set(lua_State *L)
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter states in BuildCMD code!");
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case state_sprite:
|
||||
if (fastcmp(field,"sprite")) {
|
||||
value = luaL_checknumber(L, 3);
|
||||
if (value < SPR_NULL || value >= NUMSPRITES)
|
||||
return luaL_error(L, "sprite number %d is invalid.", value);
|
||||
st->sprite = (spritenum_t)value;
|
||||
break;
|
||||
|
||||
case state_frame:
|
||||
} else if (fastcmp(field,"frame"))
|
||||
st->frame = (UINT32)luaL_checknumber(L, 3);
|
||||
break;
|
||||
|
||||
case state_tics:
|
||||
else if (fastcmp(field,"tics"))
|
||||
st->tics = (INT32)luaL_checknumber(L, 3);
|
||||
break;
|
||||
|
||||
case state_action:
|
||||
else if (fastcmp(field,"action")) {
|
||||
switch(lua_type(L, 3))
|
||||
{
|
||||
case LUA_TNIL: // Null? Set the action to nothing, then.
|
||||
@@ -442,26 +420,17 @@ static int state_set(lua_State *L)
|
||||
default: // ?!
|
||||
return luaL_typerror(L, 3, "function");
|
||||
}
|
||||
break;
|
||||
|
||||
case state_var1:
|
||||
} else if (fastcmp(field,"var1"))
|
||||
st->var1 = (INT32)luaL_checknumber(L, 3);
|
||||
break;
|
||||
|
||||
case state_var2:
|
||||
else if (fastcmp(field,"var2"))
|
||||
st->var2 = (INT32)luaL_checknumber(L, 3);
|
||||
break;
|
||||
|
||||
case state_nextstate:
|
||||
else if (fastcmp(field,"nextstate")) {
|
||||
value = luaL_checkinteger(L, 3);
|
||||
if (value < S_NULL || value >= NUMSTATES)
|
||||
return luaL_error(L, "nextstate number %d is invalid.", value);
|
||||
st->nextstate = (statenum_t)value;
|
||||
break;
|
||||
|
||||
default:
|
||||
} else
|
||||
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -596,161 +565,75 @@ static int lib_mobjinfolen(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
enum mobjinfo_e
|
||||
{
|
||||
mobjinfo_doomednum,
|
||||
mobjinfo_spawnstate,
|
||||
mobjinfo_spawnhealth,
|
||||
mobjinfo_seestate,
|
||||
mobjinfo_seesound,
|
||||
mobjinfo_reactiontime,
|
||||
mobjinfo_attacksound,
|
||||
mobjinfo_painstate,
|
||||
mobjinfo_painchance,
|
||||
mobjinfo_painsound,
|
||||
mobjinfo_meleestate,
|
||||
mobjinfo_missilestate,
|
||||
mobjinfo_deathstate,
|
||||
mobjinfo_xdeathstate,
|
||||
mobjinfo_deathsound,
|
||||
mobjinfo_speed,
|
||||
mobjinfo_radius,
|
||||
mobjinfo_height,
|
||||
mobjinfo_dispoffset,
|
||||
mobjinfo_mass,
|
||||
mobjinfo_damage,
|
||||
mobjinfo_activesound,
|
||||
mobjinfo_flags,
|
||||
mobjinfo_raisestate,
|
||||
};
|
||||
|
||||
const char *const mobjinfo_opt[] = {
|
||||
"doomednum",
|
||||
"spawnstate",
|
||||
"spawnhealth",
|
||||
"seestate",
|
||||
"seesound",
|
||||
"reactiontime",
|
||||
"attacksound",
|
||||
"painstate",
|
||||
"painchance",
|
||||
"painsound",
|
||||
"meleestate",
|
||||
"missilestate",
|
||||
"deathstate",
|
||||
"xdeathstate",
|
||||
"deathsound",
|
||||
"speed",
|
||||
"radius",
|
||||
"height",
|
||||
"dispoffset",
|
||||
"mass",
|
||||
"damage",
|
||||
"activesound",
|
||||
"flags",
|
||||
"raisestate",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int mobjinfo_fields_ref = LUA_NOREF;
|
||||
|
||||
// mobjinfo_t *, field -> number
|
||||
static int mobjinfo_get(lua_State *L)
|
||||
{
|
||||
mobjinfo_t *info = *((mobjinfo_t **)luaL_checkudata(L, 1, META_MOBJINFO));
|
||||
enum mobjinfo_e field = Lua_optoption(L, 2, -1, mobjinfo_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
|
||||
I_Assert(info != NULL);
|
||||
I_Assert(info >= mobjinfo);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case mobjinfo_doomednum:
|
||||
if (fastcmp(field,"doomednum"))
|
||||
lua_pushinteger(L, info->doomednum);
|
||||
break;
|
||||
case mobjinfo_spawnstate:
|
||||
else if (fastcmp(field,"spawnstate"))
|
||||
lua_pushinteger(L, info->spawnstate);
|
||||
break;
|
||||
case mobjinfo_spawnhealth:
|
||||
else if (fastcmp(field,"spawnhealth"))
|
||||
lua_pushinteger(L, info->spawnhealth);
|
||||
break;
|
||||
case mobjinfo_seestate:
|
||||
else if (fastcmp(field,"seestate"))
|
||||
lua_pushinteger(L, info->seestate);
|
||||
break;
|
||||
case mobjinfo_seesound:
|
||||
else if (fastcmp(field,"seesound"))
|
||||
lua_pushinteger(L, info->seesound);
|
||||
break;
|
||||
case mobjinfo_reactiontime:
|
||||
else if (fastcmp(field,"reactiontime"))
|
||||
lua_pushinteger(L, info->reactiontime);
|
||||
break;
|
||||
case mobjinfo_attacksound:
|
||||
else if (fastcmp(field,"attacksound"))
|
||||
lua_pushinteger(L, info->attacksound);
|
||||
break;
|
||||
case mobjinfo_painstate:
|
||||
else if (fastcmp(field,"painstate"))
|
||||
lua_pushinteger(L, info->painstate);
|
||||
break;
|
||||
case mobjinfo_painchance:
|
||||
else if (fastcmp(field,"painchance"))
|
||||
lua_pushinteger(L, info->painchance);
|
||||
break;
|
||||
case mobjinfo_painsound:
|
||||
else if (fastcmp(field,"painsound"))
|
||||
lua_pushinteger(L, info->painsound);
|
||||
break;
|
||||
case mobjinfo_meleestate:
|
||||
else if (fastcmp(field,"meleestate"))
|
||||
lua_pushinteger(L, info->meleestate);
|
||||
break;
|
||||
case mobjinfo_missilestate:
|
||||
else if (fastcmp(field,"missilestate"))
|
||||
lua_pushinteger(L, info->missilestate);
|
||||
break;
|
||||
case mobjinfo_deathstate:
|
||||
else if (fastcmp(field,"deathstate"))
|
||||
lua_pushinteger(L, info->deathstate);
|
||||
break;
|
||||
case mobjinfo_xdeathstate:
|
||||
else if (fastcmp(field,"xdeathstate"))
|
||||
lua_pushinteger(L, info->xdeathstate);
|
||||
break;
|
||||
case mobjinfo_deathsound:
|
||||
else if (fastcmp(field,"deathsound"))
|
||||
lua_pushinteger(L, info->deathsound);
|
||||
break;
|
||||
case mobjinfo_speed:
|
||||
else if (fastcmp(field,"speed"))
|
||||
lua_pushinteger(L, info->speed); // sometimes it's fixed_t, sometimes it's not...
|
||||
break;
|
||||
case mobjinfo_radius:
|
||||
else if (fastcmp(field,"radius"))
|
||||
lua_pushfixed(L, info->radius);
|
||||
break;
|
||||
case mobjinfo_height:
|
||||
else if (fastcmp(field,"height"))
|
||||
lua_pushfixed(L, info->height);
|
||||
break;
|
||||
case mobjinfo_dispoffset:
|
||||
else if (fastcmp(field,"dispoffset"))
|
||||
lua_pushinteger(L, info->dispoffset);
|
||||
break;
|
||||
case mobjinfo_mass:
|
||||
else if (fastcmp(field,"mass"))
|
||||
lua_pushinteger(L, info->mass);
|
||||
break;
|
||||
case mobjinfo_damage:
|
||||
else if (fastcmp(field,"damage"))
|
||||
lua_pushinteger(L, info->damage);
|
||||
break;
|
||||
case mobjinfo_activesound:
|
||||
else if (fastcmp(field,"activesound"))
|
||||
lua_pushinteger(L, info->activesound);
|
||||
break;
|
||||
case mobjinfo_flags:
|
||||
else if (fastcmp(field,"flags"))
|
||||
lua_pushinteger(L, info->flags);
|
||||
break;
|
||||
case mobjinfo_raisestate:
|
||||
else if (fastcmp(field,"raisestate"))
|
||||
lua_pushinteger(L, info->raisestate);
|
||||
break;
|
||||
default:
|
||||
else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_pushlightuserdata(L, info);
|
||||
lua_rawget(L, -2);
|
||||
if (!lua_istable(L, -1)) { // no extra values table
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "mobjinfo_t", lua_tostring(L, 2));
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "mobjinfo_t", field);
|
||||
return 0;
|
||||
}
|
||||
lua_pushvalue(L, 2); // field name
|
||||
lua_gettable(L, -2);
|
||||
lua_getfield(L, -1, field);
|
||||
if (lua_isnil(L, -1)) // no value for this field
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "mobjinfo_t", lua_tostring(L, 2));
|
||||
break;
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "mobjinfo_t", field);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -759,7 +642,7 @@ static int mobjinfo_get(lua_State *L)
|
||||
static int mobjinfo_set(lua_State *L)
|
||||
{
|
||||
mobjinfo_t *info = *((mobjinfo_t **)luaL_checkudata(L, 1, META_MOBJINFO));
|
||||
enum mobjinfo_e field = Lua_optoption(L, 2, -1, mobjinfo_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
|
||||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter mobjinfo in HUD rendering code!");
|
||||
@@ -769,81 +652,55 @@ static int mobjinfo_set(lua_State *L)
|
||||
I_Assert(info != NULL);
|
||||
I_Assert(info >= mobjinfo);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case mobjinfo_doomednum:
|
||||
if (fastcmp(field,"doomednum"))
|
||||
info->doomednum = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_spawnstate:
|
||||
else if (fastcmp(field,"spawnstate"))
|
||||
info->spawnstate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_spawnhealth:
|
||||
else if (fastcmp(field,"spawnhealth"))
|
||||
info->spawnhealth = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_seestate:
|
||||
else if (fastcmp(field,"seestate"))
|
||||
info->seestate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_seesound:
|
||||
else if (fastcmp(field,"seesound"))
|
||||
info->seesound = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_reactiontime:
|
||||
else if (fastcmp(field,"reactiontime"))
|
||||
info->reactiontime = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_attacksound:
|
||||
else if (fastcmp(field,"attacksound"))
|
||||
info->attacksound = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_painstate:
|
||||
else if (fastcmp(field,"painstate"))
|
||||
info->painstate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_painchance:
|
||||
else if (fastcmp(field,"painchance"))
|
||||
info->painchance = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_painsound:
|
||||
else if (fastcmp(field,"painsound"))
|
||||
info->painsound = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_meleestate:
|
||||
else if (fastcmp(field,"meleestate"))
|
||||
info->meleestate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_missilestate:
|
||||
else if (fastcmp(field,"missilestate"))
|
||||
info->missilestate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_deathstate:
|
||||
else if (fastcmp(field,"deathstate"))
|
||||
info->deathstate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_xdeathstate:
|
||||
else if (fastcmp(field,"xdeathstate"))
|
||||
info->xdeathstate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_deathsound:
|
||||
else if (fastcmp(field,"deathsound"))
|
||||
info->deathsound = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_speed:
|
||||
else if (fastcmp(field,"speed"))
|
||||
info->speed = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobjinfo_radius:
|
||||
else if (fastcmp(field,"radius"))
|
||||
info->radius = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobjinfo_height:
|
||||
else if (fastcmp(field,"height"))
|
||||
info->height = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobjinfo_dispoffset:
|
||||
else if (fastcmp(field,"dispoffset"))
|
||||
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_mass:
|
||||
else if (fastcmp(field,"mass"))
|
||||
info->mass = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_damage:
|
||||
else if (fastcmp(field,"damage"))
|
||||
info->damage = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_activesound:
|
||||
else if (fastcmp(field,"activesound"))
|
||||
info->activesound = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_flags:
|
||||
else if (fastcmp(field,"flags"))
|
||||
info->flags = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobjinfo_raisestate:
|
||||
else if (fastcmp(field,"raisestate"))
|
||||
info->raisestate = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
default:
|
||||
else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_pushlightuserdata(L, info);
|
||||
@@ -851,17 +708,18 @@ static int mobjinfo_set(lua_State *L)
|
||||
if (lua_isnil(L, -1)) {
|
||||
// This index doesn't have a table for extra values yet, let's make one.
|
||||
lua_pop(L, 1);
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; adding it as Lua data.\n"), "mobjinfo_t", lua_tostring(L, 2));
|
||||
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; adding it as Lua data.\n"), "mobjinfo_t", field);
|
||||
lua_newtable(L);
|
||||
lua_pushlightuserdata(L, info);
|
||||
lua_pushvalue(L, -2); // ext value table
|
||||
lua_rawset(L, -4); // LREG_EXTVARS table
|
||||
}
|
||||
lua_pushvalue(L, 2); // key
|
||||
lua_pushvalue(L, 3); // value to store
|
||||
lua_settable(L, -3);
|
||||
lua_setfield(L, -2, field);
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
//else
|
||||
//return luaL_error(L, LUA_QL("mobjinfo_t") " has no field named " LUA_QS, field);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -894,25 +752,6 @@ static int lib_getSfxInfo(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
enum sfxinfo_e {
|
||||
sfxinfo_name = 0,
|
||||
sfxinfo_singular,
|
||||
sfxinfo_priority,
|
||||
sfxinfo_flags, // "pitch"
|
||||
sfxinfo_skinsound
|
||||
};
|
||||
|
||||
const char *const sfxinfo_opt[] = {
|
||||
"name",
|
||||
"singular",
|
||||
"priority",
|
||||
"flags",
|
||||
"skinsound",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int sfxinfo_fields_ref = LUA_NOREF;
|
||||
|
||||
// stack: dummy, S_sfx[] table index, table of values to set.
|
||||
static int lib_setSfxInfo(lua_State *L)
|
||||
{
|
||||
@@ -936,44 +775,22 @@ static int lib_setSfxInfo(lua_State *L)
|
||||
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, 1)) {
|
||||
enum sfxinfo_e i;
|
||||
enum sfxinfo_write i;
|
||||
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
int j = lua_tointeger(L, 2) - 1;
|
||||
|
||||
// Read and Write enums were combined, need to do this switch now
|
||||
switch (j)
|
||||
{
|
||||
case 1:
|
||||
i = sfxinfo_singular;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
i = sfxinfo_priority;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
i = sfxinfo_flags;
|
||||
break;
|
||||
|
||||
default:
|
||||
i = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i = lua_tointeger(L, 2) - 1; // lua is one based, this enum is zero based.
|
||||
else
|
||||
i = Lua_optoption(L, 2, -1, sfxinfo_fields_ref);
|
||||
i = luaL_checkoption(L, 2, NULL, sfxinfo_wopt);
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case sfxinfo_singular:
|
||||
case sfxinfow_singular:
|
||||
info->singularity = luaL_checkboolean(L, 3);
|
||||
break;
|
||||
case sfxinfo_priority:
|
||||
case sfxinfow_priority:
|
||||
info->priority = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case sfxinfo_flags:
|
||||
case sfxinfow_flags:
|
||||
info->pitch = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
default:
|
||||
@@ -995,29 +812,29 @@ static int lib_sfxlen(lua_State *L)
|
||||
static int sfxinfo_get(lua_State *L)
|
||||
{
|
||||
sfxinfo_t *sfx = *((sfxinfo_t **)luaL_checkudata(L, 1, META_SFXINFO));
|
||||
enum sfxinfo_e field = Lua_optoption(L, 2, -1, sfxinfo_fields_ref);
|
||||
enum sfxinfo_read field = luaL_checkoption(L, 2, NULL, sfxinfo_ropt);
|
||||
|
||||
I_Assert(sfx != NULL);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case sfxinfo_name:
|
||||
case sfxinfor_name:
|
||||
lua_pushstring(L, sfx->name);
|
||||
return 1;
|
||||
case sfxinfo_singular:
|
||||
case sfxinfor_singular:
|
||||
lua_pushboolean(L, sfx->singularity);
|
||||
return 1;
|
||||
case sfxinfo_priority:
|
||||
case sfxinfor_priority:
|
||||
lua_pushinteger(L, sfx->priority);
|
||||
return 1;
|
||||
case sfxinfo_flags:
|
||||
case sfxinfor_flags:
|
||||
lua_pushinteger(L, sfx->pitch);
|
||||
return 1;
|
||||
case sfxinfo_skinsound:
|
||||
case sfxinfor_skinsound:
|
||||
lua_pushinteger(L, sfx->skinsound);
|
||||
return 1;
|
||||
default:
|
||||
return luaL_error(L, LUA_QL("sfxinfo_t") " has no field named " LUA_QS, lua_tostring(L, 2));
|
||||
return luaL_error(L, "impossible error");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1026,7 +843,7 @@ static int sfxinfo_get(lua_State *L)
|
||||
static int sfxinfo_set(lua_State *L)
|
||||
{
|
||||
sfxinfo_t *sfx = *((sfxinfo_t **)luaL_checkudata(L, 1, META_SFXINFO));
|
||||
int field = Lua_optoption(L, 2, -1, sfxinfo_fields_ref);
|
||||
enum sfxinfo_write field = luaL_checkoption(L, 2, NULL, sfxinfo_wopt);
|
||||
|
||||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter S_sfx in HUD rendering code!");
|
||||
@@ -1041,20 +858,17 @@ static int sfxinfo_set(lua_State *L)
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case sfxinfo_singular:
|
||||
case sfxinfow_singular:
|
||||
sfx->singularity = luaL_checkboolean(L, 1);
|
||||
break;
|
||||
case sfxinfo_priority:
|
||||
case sfxinfow_priority:
|
||||
sfx->priority = luaL_checkinteger(L, 1);
|
||||
break;
|
||||
case sfxinfo_flags:
|
||||
case sfxinfow_flags:
|
||||
sfx->pitch = luaL_checkinteger(L, 1);
|
||||
break;
|
||||
default:
|
||||
if (field == -1)
|
||||
return luaL_error(L, LUA_QL("sfxinfo_t") " has no field named " LUA_QS, lua_tostring(L, 2));
|
||||
else
|
||||
return luaL_error(L, LUA_QL("sfxinfo_t") " field " LUA_QS " is read-only", lua_tostring(L, 2));
|
||||
return luaL_error(L, "impossible error");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1096,8 +910,6 @@ int LUA_InfoLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
state_fields_ref = Lua_CreateFieldTable(L, state_opt);
|
||||
|
||||
luaL_newmetatable(L, META_MOBJINFO);
|
||||
lua_pushcfunction(L, mobjinfo_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1109,8 +921,6 @@ int LUA_InfoLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
mobjinfo_fields_ref = Lua_CreateFieldTable(L, mobjinfo_opt);
|
||||
|
||||
luaL_newmetatable(L, META_SFXINFO);
|
||||
lua_pushcfunction(L, sfxinfo_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1122,8 +932,6 @@ int LUA_InfoLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
sfxinfo_fields_ref = Lua_CreateFieldTable(L, sfxinfo_opt);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getSprname);
|
||||
@@ -1175,4 +983,4 @@ int LUA_InfoLib(lua_State *L)
|
||||
lua_setglobal(L, "S_sfx");
|
||||
lua_setglobal(L, "sfxinfo");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+49
-193
@@ -71,8 +71,6 @@ enum subsector_e {
|
||||
subsector_firstline,
|
||||
};
|
||||
|
||||
static int sector_fields_ref = LUA_NOREF;
|
||||
|
||||
static const char *const subsector_opt[] = {
|
||||
"valid",
|
||||
"sector",
|
||||
@@ -80,8 +78,6 @@ static const char *const subsector_opt[] = {
|
||||
"firstline",
|
||||
NULL};
|
||||
|
||||
static int subsector_fields_ref = LUA_NOREF;
|
||||
|
||||
enum line_e {
|
||||
line_valid = 0,
|
||||
line_v1,
|
||||
@@ -124,8 +120,6 @@ static const char *const line_opt[] = {
|
||||
"callcount",
|
||||
NULL};
|
||||
|
||||
static int line_fields_ref = LUA_NOREF;
|
||||
|
||||
enum side_e {
|
||||
side_valid = 0,
|
||||
side_textureoffset,
|
||||
@@ -152,8 +146,6 @@ static const char *const side_opt[] = {
|
||||
"text",
|
||||
NULL};
|
||||
|
||||
static int side_fields_ref = LUA_NOREF;
|
||||
|
||||
enum vertex_e {
|
||||
vertex_valid = 0,
|
||||
vertex_x,
|
||||
@@ -168,8 +160,6 @@ static const char *const vertex_opt[] = {
|
||||
"z",
|
||||
NULL};
|
||||
|
||||
static int vertex_fields_ref = LUA_NOREF;
|
||||
|
||||
enum ffloor_e {
|
||||
ffloor_valid = 0,
|
||||
ffloor_topheight,
|
||||
@@ -206,8 +196,6 @@ static const char *const ffloor_opt[] = {
|
||||
"alpha",
|
||||
NULL};
|
||||
|
||||
static int ffloor_fields_ref = LUA_NOREF;
|
||||
|
||||
enum slope_e {
|
||||
slope_valid = 0,
|
||||
slope_o,
|
||||
@@ -234,8 +222,6 @@ static const char *const slope_opt[] = {
|
||||
"flags",
|
||||
NULL};
|
||||
|
||||
static int slope_fields_ref = LUA_NOREF;
|
||||
|
||||
// shared by both vector2_t and vector3_t
|
||||
enum vector_e {
|
||||
vector_x = 0,
|
||||
@@ -401,7 +387,7 @@ static int sectorlines_num(lua_State *L)
|
||||
static int sector_get(lua_State *L)
|
||||
{
|
||||
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||
enum sector_e field = Lua_optoption(L, 2, sector_valid, sector_fields_ref);
|
||||
enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt);
|
||||
INT16 i;
|
||||
|
||||
if (!sector)
|
||||
@@ -487,7 +473,7 @@ static int sector_get(lua_State *L)
|
||||
static int sector_set(lua_State *L)
|
||||
{
|
||||
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||
enum sector_e field = Lua_optoption(L, 2, sector_valid, sector_fields_ref);
|
||||
enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt);
|
||||
|
||||
if (!sector)
|
||||
return luaL_error(L, "accessed sector_t doesn't exist anymore.");
|
||||
@@ -565,7 +551,7 @@ static int sector_num(lua_State *L)
|
||||
static int subsector_get(lua_State *L)
|
||||
{
|
||||
subsector_t *subsector = *((subsector_t **)luaL_checkudata(L, 1, META_SUBSECTOR));
|
||||
enum subsector_e field = Lua_optoption(L, 2, subsector_valid, subsector_fields_ref);
|
||||
enum subsector_e field = luaL_checkoption(L, 2, subsector_opt[0], subsector_opt);
|
||||
|
||||
if (!subsector)
|
||||
{
|
||||
@@ -604,7 +590,7 @@ static int subsector_num(lua_State *L)
|
||||
static int line_get(lua_State *L)
|
||||
{
|
||||
line_t *line = *((line_t **)luaL_checkudata(L, 1, META_LINE));
|
||||
enum line_e field = Lua_optoption(L, 2, line_valid, line_fields_ref);
|
||||
enum line_e field = luaL_checkoption(L, 2, line_opt[0], line_opt);
|
||||
|
||||
if (!line)
|
||||
{
|
||||
@@ -729,7 +715,7 @@ static int sidenum_get(lua_State *L)
|
||||
static int side_get(lua_State *L)
|
||||
{
|
||||
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
||||
enum side_e field = Lua_optoption(L, 2, side_valid, side_fields_ref);
|
||||
enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt);
|
||||
|
||||
if (!side)
|
||||
{
|
||||
@@ -779,7 +765,7 @@ static int side_get(lua_State *L)
|
||||
static int side_set(lua_State *L)
|
||||
{
|
||||
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
||||
enum side_e field = Lua_optoption(L, 2, side_valid, side_fields_ref);
|
||||
enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt);
|
||||
|
||||
if (!side)
|
||||
{
|
||||
@@ -830,7 +816,7 @@ static int side_num(lua_State *L)
|
||||
static int vertex_get(lua_State *L)
|
||||
{
|
||||
vertex_t *vertex = *((vertex_t **)luaL_checkudata(L, 1, META_VERTEX));
|
||||
enum vertex_e field = Lua_optoption(L, 2, vertex_valid, vertex_fields_ref);
|
||||
enum vertex_e field = luaL_checkoption(L, 2, vertex_opt[0], vertex_opt);
|
||||
|
||||
if (!vertex)
|
||||
{
|
||||
@@ -1099,7 +1085,7 @@ static int lib_numvertexes(lua_State *L)
|
||||
static int ffloor_get(lua_State *L)
|
||||
{
|
||||
ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
|
||||
enum ffloor_e field = Lua_optoption(L, 2, ffloor_valid, ffloor_fields_ref);
|
||||
enum ffloor_e field = luaL_checkoption(L, 2, ffloor_opt[0], ffloor_opt);
|
||||
INT16 i;
|
||||
|
||||
if (!ffloor)
|
||||
@@ -1175,7 +1161,7 @@ static int ffloor_get(lua_State *L)
|
||||
static int ffloor_set(lua_State *L)
|
||||
{
|
||||
ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
|
||||
enum ffloor_e field = Lua_optoption(L, 2, ffloor_valid, ffloor_fields_ref);
|
||||
enum ffloor_e field = luaL_checkoption(L, 2, ffloor_opt[0], ffloor_opt);
|
||||
|
||||
if (!ffloor)
|
||||
return luaL_error(L, "accessed ffloor_t doesn't exist anymore.");
|
||||
@@ -1253,7 +1239,7 @@ static int ffloor_set(lua_State *L)
|
||||
static int slope_get(lua_State *L)
|
||||
{
|
||||
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
|
||||
enum slope_e field = Lua_optoption(L, 2, slope_valid, slope_fields_ref);
|
||||
enum slope_e field = luaL_checkoption(L, 2, slope_opt[0], slope_opt);
|
||||
|
||||
if (!slope)
|
||||
{
|
||||
@@ -1303,7 +1289,7 @@ static int slope_get(lua_State *L)
|
||||
static int slope_set(lua_State *L)
|
||||
{
|
||||
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
|
||||
enum slope_e field = Lua_optoption(L, 2, slope_valid, slope_fields_ref);
|
||||
enum slope_e field = luaL_checkoption(L, 2, slope_opt[0], slope_opt);
|
||||
|
||||
if (!slope)
|
||||
return luaL_error(L, "accessed pslope_t doesn't exist anymore.");
|
||||
@@ -1460,207 +1446,93 @@ static int lib_nummapheaders(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
enum mapheaderinfo_e
|
||||
{
|
||||
mapheaderinfo_lvlttl,
|
||||
mapheaderinfo_subttl,
|
||||
mapheaderinfo_zonttl,
|
||||
mapheaderinfo_actnum,
|
||||
mapheaderinfo_typeoflevel,
|
||||
mapheaderinfo_nextlevel,
|
||||
mapheaderinfo_musname,
|
||||
mapheaderinfo_mustrack,
|
||||
mapheaderinfo_muspos,
|
||||
mapheaderinfo_musinterfadeout,
|
||||
mapheaderinfo_musintername,
|
||||
mapheaderinfo_forcecharacter,
|
||||
mapheaderinfo_weather,
|
||||
mapheaderinfo_skynum,
|
||||
mapheaderinfo_skybox_scalex,
|
||||
mapheaderinfo_skybox_scaley,
|
||||
mapheaderinfo_skybox_scalez,
|
||||
mapheaderinfo_interscreen,
|
||||
mapheaderinfo_runsoc,
|
||||
mapheaderinfo_scriptname,
|
||||
mapheaderinfo_precutscenenum,
|
||||
mapheaderinfo_cutscenenum,
|
||||
mapheaderinfo_countdown,
|
||||
mapheaderinfo_palette,
|
||||
mapheaderinfo_numlaps,
|
||||
mapheaderinfo_unlockrequired,
|
||||
mapheaderinfo_levelselect,
|
||||
mapheaderinfo_bonustype,
|
||||
mapheaderinfo_saveoverride,
|
||||
mapheaderinfo_levelflags,
|
||||
mapheaderinfo_menuflags,
|
||||
//mapheaderinfo_automap,
|
||||
mapheaderinfo_mobj_scale,
|
||||
};
|
||||
|
||||
static const char *const mapheaderinfo_opt[] = {
|
||||
"lvlttl",
|
||||
"subttl",
|
||||
"zonttl",
|
||||
"actnum",
|
||||
"typeoflevel",
|
||||
"nextlevel",
|
||||
"musname",
|
||||
"mustrack",
|
||||
"muspos",
|
||||
"musinterfadeout",
|
||||
"musintername",
|
||||
"forcecharacter",
|
||||
"weather",
|
||||
"skynum",
|
||||
"skybox_scalex",
|
||||
"skybox_scaley",
|
||||
"skybox_scalez",
|
||||
"interscreen",
|
||||
"runsoc",
|
||||
"scriptname",
|
||||
"precutscenenum",
|
||||
"cutscenenum",
|
||||
"countdown",
|
||||
"palette",
|
||||
"numlaps",
|
||||
"unlockrequired",
|
||||
"levelselect",
|
||||
"bonustype",
|
||||
"saveoverride",
|
||||
"levelflags",
|
||||
"menuflags",
|
||||
//"automap",
|
||||
"mobj_scale",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int mapheaderinfo_fields_ref = LUA_NOREF;
|
||||
|
||||
static int mapheaderinfo_get(lua_State *L)
|
||||
{
|
||||
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
|
||||
enum mapheaderinfo_e field = Lua_optoption(L, 2, -1, mapheaderinfo_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
INT16 i;
|
||||
switch (field)
|
||||
{
|
||||
case mapheaderinfo_lvlttl:
|
||||
if (fastcmp(field,"lvlttl"))
|
||||
lua_pushstring(L, header->lvlttl);
|
||||
break;
|
||||
case mapheaderinfo_subttl:
|
||||
else if (fastcmp(field,"subttl"))
|
||||
lua_pushstring(L, header->subttl);
|
||||
break;
|
||||
case mapheaderinfo_zonttl:
|
||||
else if (fastcmp(field,"zonttl"))
|
||||
lua_pushstring(L, header->zonttl);
|
||||
break;
|
||||
case mapheaderinfo_actnum:
|
||||
else if (fastcmp(field,"actnum"))
|
||||
lua_pushstring(L, header->actnum);
|
||||
break;
|
||||
case mapheaderinfo_typeoflevel:
|
||||
else if (fastcmp(field,"typeoflevel"))
|
||||
lua_pushinteger(L, header->typeoflevel);
|
||||
break;
|
||||
case mapheaderinfo_nextlevel:
|
||||
else if (fastcmp(field,"nextlevel"))
|
||||
lua_pushinteger(L, header->nextlevel);
|
||||
break;
|
||||
case mapheaderinfo_musname:
|
||||
else if (fastcmp(field,"musname"))
|
||||
lua_pushstring(L, header->musname);
|
||||
break;
|
||||
case mapheaderinfo_mustrack:
|
||||
else if (fastcmp(field,"mustrack"))
|
||||
lua_pushinteger(L, header->mustrack);
|
||||
break;
|
||||
case mapheaderinfo_muspos:
|
||||
else if (fastcmp(field,"muspos"))
|
||||
lua_pushinteger(L, header->muspos);
|
||||
break;
|
||||
case mapheaderinfo_musinterfadeout:
|
||||
else if (fastcmp(field,"musinterfadeout"))
|
||||
lua_pushinteger(L, header->musinterfadeout);
|
||||
break;
|
||||
case mapheaderinfo_musintername:
|
||||
else if (fastcmp(field,"musintername"))
|
||||
lua_pushstring(L, header->musintername);
|
||||
break;
|
||||
case mapheaderinfo_forcecharacter:
|
||||
else if (fastcmp(field,"forcecharacter"))
|
||||
lua_pushstring(L, header->forcecharacter);
|
||||
break;
|
||||
case mapheaderinfo_weather:
|
||||
else if (fastcmp(field,"weather"))
|
||||
lua_pushinteger(L, header->weather);
|
||||
break;
|
||||
case mapheaderinfo_skynum:
|
||||
else if (fastcmp(field,"skynum"))
|
||||
lua_pushinteger(L, header->skynum);
|
||||
break;
|
||||
case mapheaderinfo_skybox_scalex:
|
||||
else if (fastcmp(field,"skybox_scalex"))
|
||||
lua_pushinteger(L, header->skybox_scalex);
|
||||
break;
|
||||
case mapheaderinfo_skybox_scaley:
|
||||
else if (fastcmp(field,"skybox_scaley"))
|
||||
lua_pushinteger(L, header->skybox_scaley);
|
||||
break;
|
||||
case mapheaderinfo_skybox_scalez:
|
||||
else if (fastcmp(field,"skybox_scalez"))
|
||||
lua_pushinteger(L, header->skybox_scalez);
|
||||
break;
|
||||
case mapheaderinfo_interscreen:
|
||||
else if (fastcmp(field,"interscreen")) {
|
||||
for (i = 0; i < 8; i++)
|
||||
if (!header->interscreen[i])
|
||||
break;
|
||||
lua_pushlstring(L, header->interscreen, i);
|
||||
break;
|
||||
case mapheaderinfo_runsoc:
|
||||
} else if (fastcmp(field,"runsoc"))
|
||||
lua_pushstring(L, header->runsoc);
|
||||
break;
|
||||
case mapheaderinfo_scriptname:
|
||||
else if (fastcmp(field,"scriptname"))
|
||||
lua_pushstring(L, header->scriptname);
|
||||
break;
|
||||
case mapheaderinfo_precutscenenum:
|
||||
else if (fastcmp(field,"precutscenenum"))
|
||||
lua_pushinteger(L, header->precutscenenum);
|
||||
break;
|
||||
case mapheaderinfo_cutscenenum:
|
||||
else if (fastcmp(field,"cutscenenum"))
|
||||
lua_pushinteger(L, header->cutscenenum);
|
||||
break;
|
||||
case mapheaderinfo_countdown:
|
||||
else if (fastcmp(field,"countdown"))
|
||||
lua_pushinteger(L, header->countdown);
|
||||
break;
|
||||
case mapheaderinfo_palette:
|
||||
else if (fastcmp(field,"palette"))
|
||||
lua_pushinteger(L, header->palette);
|
||||
break;
|
||||
case mapheaderinfo_numlaps:
|
||||
else if (fastcmp(field,"numlaps"))
|
||||
lua_pushinteger(L, header->numlaps);
|
||||
break;
|
||||
case mapheaderinfo_unlockrequired:
|
||||
else if (fastcmp(field,"unlockrequired"))
|
||||
lua_pushinteger(L, header->unlockrequired);
|
||||
break;
|
||||
case mapheaderinfo_levelselect:
|
||||
else if (fastcmp(field,"levelselect"))
|
||||
lua_pushinteger(L, header->levelselect);
|
||||
break;
|
||||
case mapheaderinfo_bonustype:
|
||||
else if (fastcmp(field,"bonustype"))
|
||||
lua_pushinteger(L, header->bonustype);
|
||||
break;
|
||||
case mapheaderinfo_saveoverride:
|
||||
else if (fastcmp(field,"saveoverride"))
|
||||
lua_pushinteger(L, header->saveoverride);
|
||||
break;
|
||||
case mapheaderinfo_levelflags:
|
||||
else if (fastcmp(field,"levelflags"))
|
||||
lua_pushinteger(L, header->levelflags);
|
||||
break;
|
||||
case mapheaderinfo_menuflags:
|
||||
else if (fastcmp(field,"menuflags"))
|
||||
lua_pushinteger(L, header->menuflags);
|
||||
break;
|
||||
/*case mapheaderinfo_automap:
|
||||
lua_pushstring(L, header->selectheading);
|
||||
break;*/
|
||||
case mapheaderinfo_mobj_scale:
|
||||
/*else if (fastcmp(field,"automap"))
|
||||
lua_pushboolean(L, header->automap);*/
|
||||
else if (fastcmp(field,"mobj_scale"))
|
||||
lua_pushfixed(L, header->mobj_scale);
|
||||
break;
|
||||
// TODO add support for reading numGradedMares and grades
|
||||
default:
|
||||
{
|
||||
else {
|
||||
// Read custom vars now
|
||||
// (note: don't include the "LUA." in your lua scripts!)
|
||||
UINT8 j = 0;
|
||||
for (;j < header->numCustomOptions && !fastcmp(lua_tostring(L, 2), header->customopts[j].option); ++j);
|
||||
for (;j < header->numCustomOptions && !fastcmp(field, header->customopts[j].option); ++j);
|
||||
|
||||
if(j < header->numCustomOptions)
|
||||
lua_pushstring(L, header->customopts[j].value);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
int LUA_MapLib(lua_State *L)
|
||||
@@ -1684,8 +1556,6 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
sector_fields_ref = Lua_CreateFieldTable(L, sector_opt);
|
||||
|
||||
luaL_newmetatable(L, META_SUBSECTOR);
|
||||
lua_pushcfunction(L, subsector_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1694,8 +1564,6 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
subsector_fields_ref = Lua_CreateFieldTable(L, subsector_opt);
|
||||
|
||||
luaL_newmetatable(L, META_LINE);
|
||||
lua_pushcfunction(L, line_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1704,8 +1572,6 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
line_fields_ref = Lua_CreateFieldTable(L, line_opt);
|
||||
|
||||
luaL_newmetatable(L, META_SIDENUM);
|
||||
lua_pushcfunction(L, sidenum_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1722,8 +1588,6 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
side_fields_ref = Lua_CreateFieldTable(L, side_opt);
|
||||
|
||||
luaL_newmetatable(L, META_VERTEX);
|
||||
lua_pushcfunction(L, vertex_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1732,8 +1596,6 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
vertex_fields_ref = Lua_CreateFieldTable(L, vertex_opt);
|
||||
|
||||
luaL_newmetatable(L, META_FFLOOR);
|
||||
lua_pushcfunction(L, ffloor_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1742,8 +1604,6 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L, 1);
|
||||
|
||||
ffloor_fields_ref = Lua_CreateFieldTable(L, ffloor_opt);
|
||||
|
||||
luaL_newmetatable(L, META_SLOPE);
|
||||
lua_pushcfunction(L, slope_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1752,8 +1612,6 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L, 1);
|
||||
|
||||
slope_fields_ref = Lua_CreateFieldTable(L, slope_opt);
|
||||
|
||||
luaL_newmetatable(L, META_VECTOR2);
|
||||
lua_pushcfunction(L, vector2_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@@ -1772,8 +1630,6 @@ int LUA_MapLib(lua_State *L)
|
||||
//lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
mapheaderinfo_fields_ref = Lua_CreateFieldTable(L, mapheaderinfo_opt);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getSector);
|
||||
@@ -1834,4 +1690,4 @@ int LUA_MapLib(lua_State *L)
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "mapheaderinfo");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+49
-105
@@ -147,7 +147,7 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
{ NULL, 0, NULL, NULL },
|
||||
{ NULL },
|
||||
};
|
||||
#undef FIELD
|
||||
|
||||
@@ -769,41 +769,14 @@ static int mobj_set(lua_State *L)
|
||||
#undef NOSETPOS
|
||||
#undef NOFIELD
|
||||
|
||||
enum mapthing_e {
|
||||
mapthing_valid = 0,
|
||||
mapthing_x,
|
||||
mapthing_y,
|
||||
mapthing_angle,
|
||||
mapthing_type,
|
||||
mapthing_options,
|
||||
mapthing_z,
|
||||
mapthing_extrainfo,
|
||||
mapthing_mobj,
|
||||
};
|
||||
|
||||
const char *const mapthing_opt[] = {
|
||||
"valid",
|
||||
"x",
|
||||
"y",
|
||||
"angle",
|
||||
"type",
|
||||
"options",
|
||||
"z",
|
||||
"extrainfo",
|
||||
"mobj",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int mapthing_fields_ref = LUA_NOREF;
|
||||
|
||||
static int mapthing_get(lua_State *L)
|
||||
{
|
||||
mapthing_t *mt = *((mapthing_t **)luaL_checkudata(L, 1, META_MAPTHING));
|
||||
enum mapthing_e field = Lua_optoption(L, 2, -1, mapthing_fields_ref);
|
||||
lua_settop(L, 2);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
lua_Integer number;
|
||||
|
||||
if (!mt) {
|
||||
if (field == mapthing_valid) {
|
||||
if (fastcmp(field,"valid")) {
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
@@ -812,50 +785,39 @@ static int mapthing_get(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case mapthing_valid:
|
||||
lua_pushboolean(L, true);
|
||||
break;
|
||||
case mapthing_x:
|
||||
lua_pushinteger(L, mt->x);
|
||||
break;
|
||||
case mapthing_y:
|
||||
lua_pushinteger(L, mt->y);
|
||||
break;
|
||||
case mapthing_angle:
|
||||
lua_pushinteger(L, mt->angle);
|
||||
break;
|
||||
case mapthing_type:
|
||||
lua_pushinteger(L, mt->type);
|
||||
break;
|
||||
case mapthing_options:
|
||||
lua_pushinteger(L, mt->options);
|
||||
break;
|
||||
case mapthing_z:
|
||||
lua_pushinteger(L, mt->z);
|
||||
break;
|
||||
case mapthing_extrainfo:
|
||||
lua_pushinteger(L, mt->extrainfo);
|
||||
break;
|
||||
case mapthing_mobj:
|
||||
LUA_PushUserdata(L, mt->mobj, META_MOBJ);
|
||||
break;
|
||||
default:
|
||||
if (devparm)
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (fastcmp(field,"valid")) {
|
||||
lua_pushboolean(L, true);
|
||||
return 1;
|
||||
} else if(fastcmp(field,"x"))
|
||||
number = mt->x;
|
||||
else if(fastcmp(field,"y"))
|
||||
number = mt->y;
|
||||
else if(fastcmp(field,"angle"))
|
||||
number = mt->angle;
|
||||
else if(fastcmp(field,"type"))
|
||||
number = mt->type;
|
||||
else if(fastcmp(field,"options"))
|
||||
number = mt->options;
|
||||
else if(fastcmp(field,"z"))
|
||||
number = mt->z;
|
||||
else if(fastcmp(field,"extrainfo"))
|
||||
number = mt->extrainfo;
|
||||
else if(fastcmp(field,"mobj")) {
|
||||
LUA_PushUserdata(L, mt->mobj, META_MOBJ);
|
||||
return 1;
|
||||
} else if (devparm)
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
|
||||
else
|
||||
return 0;
|
||||
|
||||
lua_pushinteger(L, number);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mapthing_set(lua_State *L)
|
||||
{
|
||||
mapthing_t *mt = *((mapthing_t **)luaL_checkudata(L, 1, META_MAPTHING));
|
||||
enum mapthing_e field = Lua_optoption(L, 2, -1, mapthing_fields_ref);
|
||||
lua_settop(L, 3);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
|
||||
if (!mt)
|
||||
return luaL_error(L, "accessed mapthing_t doesn't exist anymore.");
|
||||
@@ -865,40 +827,24 @@ static int mapthing_set(lua_State *L)
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter mapthing_t in BuildCMD code!");
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case mapthing_x:
|
||||
mt->x = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mapthing_y:
|
||||
mt->y = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mapthing_angle:
|
||||
mt->angle = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mapthing_type:
|
||||
mt->type = (UINT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mapthing_options:
|
||||
mt->options = (UINT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mapthing_z:
|
||||
mt->z = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mapthing_extrainfo:
|
||||
{
|
||||
INT32 extrainfo = luaL_checkinteger(L, 3);
|
||||
if (extrainfo & ~15)
|
||||
return luaL_error(L, "mapthing_t extrainfo set %d out of range (%d - %d)", extrainfo, 0, 15);
|
||||
mt->extrainfo = (UINT8)extrainfo;
|
||||
break;
|
||||
}
|
||||
case mapthing_mobj:
|
||||
mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
break;
|
||||
default:
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
|
||||
}
|
||||
if(fastcmp(field,"x"))
|
||||
mt->x = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"y"))
|
||||
mt->y = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"angle"))
|
||||
mt->angle = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"type"))
|
||||
mt->type = (UINT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"options"))
|
||||
mt->options = (UINT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"z"))
|
||||
mt->z = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"extrainfo"))
|
||||
mt->extrainfo = (UINT8)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"mobj"))
|
||||
mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
else
|
||||
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -969,8 +915,6 @@ int LUA_MobjLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L,1);
|
||||
|
||||
mapthing_fields_ref = Lua_CreateFieldTable(L, mapthing_opt);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getMapthing);
|
||||
@@ -981,4 +925,4 @@ int LUA_MobjLib(lua_State *L)
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setglobal(L, "mapthings");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+18
-81
@@ -51,9 +51,6 @@ int player_localskin_setter(lua_State *L);
|
||||
int player_sliproll_getter(lua_State *L);
|
||||
int player_sliproll_noset(lua_State *L);
|
||||
|
||||
int player_viewrollangle_getter(lua_State *L);
|
||||
int player_viewrollangle_noset(lua_State *L);
|
||||
|
||||
#define FIELD(type, field_name, getter, setter) { #field_name, offsetof(type, field_name), getter, setter }
|
||||
static const udata_field_t player_fields[] = {
|
||||
// Player doesn't actually have field "name" so macro fails. Need to declare field manually.
|
||||
@@ -162,9 +159,8 @@ static const udata_field_t player_fields[] = {
|
||||
#endif
|
||||
// Same as player.name
|
||||
{ "sliproll", 0, player_sliproll_getter, player_sliproll_noset },
|
||||
{ "viewrollangle", 0, player_viewrollangle_getter, player_viewrollangle_noset },
|
||||
{ "ping", 0, player_ping_getter, player_ping_noset }, // Hmm originally setter doesn't exist so data is written as unreachable custom field...
|
||||
{ NULL, 0, NULL, NULL },
|
||||
{ NULL },
|
||||
};
|
||||
#undef FIELD
|
||||
|
||||
@@ -221,7 +217,6 @@ NOSET(bot)
|
||||
NOSET(splitscreenindex)
|
||||
NOSET(ping)
|
||||
NOSET(sliproll)
|
||||
NOSET(viewrollangle)
|
||||
|
||||
#undef NOSET
|
||||
|
||||
@@ -377,15 +372,6 @@ int player_sliproll_getter(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int player_viewrollangle_getter(lua_State *L)
|
||||
{
|
||||
player_t *plr = GETPLAYER();
|
||||
|
||||
lua_pushangle(L, R_ViewRollAngle(plr));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_iteratePlayers(lua_State *L)
|
||||
{
|
||||
INT32 i = -1;
|
||||
@@ -708,65 +694,30 @@ static int kartstuff_len(lua_State *L)
|
||||
}
|
||||
|
||||
#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, field)
|
||||
#define NOSET luaL_error(L, LUA_QL("ticcmd_t") " field " LUA_QS " should not be set directly.", field)
|
||||
|
||||
enum ticcmd_e
|
||||
{
|
||||
ticcmd_forwardmove,
|
||||
ticcmd_sidemove,
|
||||
ticcmd_angleturn,
|
||||
ticcmd_aiming,
|
||||
ticcmd_buttons,
|
||||
ticcmd_driftturn,
|
||||
ticcmd_latency,
|
||||
};
|
||||
|
||||
static const char *const ticcmd_opt[] = {
|
||||
"forwardmove",
|
||||
"sidemove",
|
||||
"angleturn",
|
||||
"aiming",
|
||||
"buttons",
|
||||
"driftturn",
|
||||
"latency",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int ticcmd_fields_ref = LUA_NOREF;
|
||||
|
||||
static int ticcmd_get(lua_State *L)
|
||||
{
|
||||
ticcmd_t *cmd = *((ticcmd_t **)luaL_checkudata(L, 1, META_TICCMD));
|
||||
enum ticcmd_e field = Lua_optoption(L, 2, -1, ticcmd_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
if (!cmd)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case ticcmd_forwardmove:
|
||||
if (fastcmp(field,"forwardmove"))
|
||||
lua_pushinteger(L, cmd->forwardmove);
|
||||
break;
|
||||
case ticcmd_sidemove:
|
||||
else if (fastcmp(field,"sidemove"))
|
||||
lua_pushinteger(L, cmd->sidemove);
|
||||
break;
|
||||
case ticcmd_angleturn:
|
||||
else if (fastcmp(field,"angleturn"))
|
||||
lua_pushinteger(L, cmd->angleturn);
|
||||
break;
|
||||
case ticcmd_aiming:
|
||||
else if (fastcmp(field,"aiming"))
|
||||
lua_pushinteger(L, cmd->aiming);
|
||||
break;
|
||||
case ticcmd_buttons:
|
||||
else if (fastcmp(field,"buttons"))
|
||||
lua_pushinteger(L, cmd->buttons);
|
||||
break;
|
||||
case ticcmd_driftturn:
|
||||
else if (fastcmp(field,"driftturn"))
|
||||
lua_pushinteger(L, cmd->driftturn);
|
||||
break;
|
||||
case ticcmd_latency:
|
||||
else if (fastcmp(field,"latency"))
|
||||
lua_pushinteger(L, cmd->latency);
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return NOFIELD;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -774,44 +725,32 @@ static int ticcmd_get(lua_State *L)
|
||||
static int ticcmd_set(lua_State *L)
|
||||
{
|
||||
ticcmd_t *cmd = *((ticcmd_t **)luaL_checkudata(L, 1, META_TICCMD));
|
||||
enum ticcmd_e field = Lua_optoption(L, 2, -1, ticcmd_fields_ref);
|
||||
const char *field = luaL_checkstring(L, 2);
|
||||
if (!cmd)
|
||||
return LUA_ErrInvalid(L, "ticcmd_t");
|
||||
|
||||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case ticcmd_forwardmove:
|
||||
if (fastcmp(field,"forwardmove"))
|
||||
cmd->forwardmove = (SINT8)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case ticcmd_sidemove:
|
||||
else if (fastcmp(field,"sidemove"))
|
||||
cmd->sidemove = (SINT8)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case ticcmd_angleturn:
|
||||
else if (fastcmp(field,"angleturn"))
|
||||
cmd->angleturn = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case ticcmd_aiming:
|
||||
else if (fastcmp(field,"aiming"))
|
||||
cmd->aiming = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case ticcmd_buttons:
|
||||
else if (fastcmp(field,"buttons"))
|
||||
cmd->buttons = (UINT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case ticcmd_driftturn:
|
||||
else if (fastcmp(field,"driftturn"))
|
||||
cmd->driftturn = (INT16)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case ticcmd_latency:
|
||||
return NOSET;
|
||||
default:
|
||||
else
|
||||
return NOFIELD;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef NOFIELD
|
||||
#undef NOSET
|
||||
|
||||
int LUA_PlayerLib(lua_State *L)
|
||||
{
|
||||
@@ -858,8 +797,6 @@ int LUA_PlayerLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L,1);
|
||||
|
||||
ticcmd_fields_ref = Lua_CreateFieldTable(L, ticcmd_opt);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getPlayer);
|
||||
|
||||
+25
-120
@@ -22,8 +22,6 @@
|
||||
#include "p_saveg.h"
|
||||
#include "p_local.h"
|
||||
#include "p_slopes.h" // for P_SlopeById
|
||||
#include "s_sound.h"
|
||||
#include "m_menu.h"
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
#include "d_netfil.h" // for LUA_DumpFile
|
||||
#endif
|
||||
@@ -154,7 +152,6 @@ static int noglobals(lua_State *L)
|
||||
{
|
||||
const char *csname;
|
||||
char *name;
|
||||
enum actionnum actionnum;
|
||||
|
||||
lua_remove(L, 1); // we're not gonna be using _G
|
||||
csname = lua_tostring(L, 1);
|
||||
@@ -173,10 +170,6 @@ static int noglobals(lua_State *L)
|
||||
lua_rawset(L, -3); // rawset doesn't trigger this metatable again.
|
||||
// otherwise we would've used setfield, obviously.
|
||||
|
||||
actionnum = LUA_GetActionNumByName(name);
|
||||
if (actionnum < NUMACTIONS)
|
||||
actionsoverridden[actionnum] = true;
|
||||
|
||||
Z_Free(name);
|
||||
return 0;
|
||||
}
|
||||
@@ -401,14 +394,8 @@ fixed_t LUA_EvalMath(const char *word)
|
||||
if (luaL_dostring(mL, buf))
|
||||
{
|
||||
p = lua_tostring(mL, -1);
|
||||
|
||||
// If there is [string "..."]:1: text, skip it
|
||||
if (strstr(p, ":") != NULL)
|
||||
{
|
||||
while (*p++ != ':' && *p);
|
||||
|
||||
p += 3; // "1: "
|
||||
}
|
||||
while (*p++ != ':' && *p) ;
|
||||
p += 3; // "1: "
|
||||
CONS_Alert(CONS_WARNING, "%s\n", p);
|
||||
}
|
||||
else
|
||||
@@ -672,17 +659,8 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
t++;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Too many tables to archive!\n");
|
||||
WRITEUINT8(save_p, ARCH_NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
WRITEUINT8(save_p, ARCH_TABLE);
|
||||
WRITEUINT16(save_p, t);
|
||||
|
||||
@@ -1335,12 +1313,6 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
||||
break;
|
||||
case ARCH_TEND:
|
||||
return 1;
|
||||
default:
|
||||
CONS_Alert(CONS_ERROR, "Unknown value type unarchived, save is corrupted!\n");
|
||||
G_SetExitGameFlag();
|
||||
S_StartSound(NULL, sfx_syfail); // he he he
|
||||
M_StartMessage(M_GetText("Corrupted save received\nPress ESC\n"), NULL, MM_NOTHING);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1455,12 +1427,7 @@ static void UnArchiveExtVars(void *pointer)
|
||||
|
||||
if (field_count == 0)
|
||||
return;
|
||||
|
||||
// Technically possible new, since server may have local lua scripts but no "public" ones, so
|
||||
// field_count would be non zero (there is no way to tell local field from non-local, so
|
||||
// everything gets archived)
|
||||
if (!gL)
|
||||
return;
|
||||
I_Assert(gL != NULL);
|
||||
|
||||
TABLESINDEX = lua_gettop(gL);
|
||||
lua_createtable(gL, 0, field_count); // pointer's ext vars subtable
|
||||
@@ -1468,13 +1435,7 @@ static void UnArchiveExtVars(void *pointer)
|
||||
for (i = 0; i < field_count; i++)
|
||||
{
|
||||
READSTRING(save_p, field);
|
||||
|
||||
if (UnArchiveValue(TABLESINDEX) == 1)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field);
|
||||
break;
|
||||
}
|
||||
|
||||
UnArchiveValue(TABLESINDEX);
|
||||
lua_setfield(gL, -2, field);
|
||||
}
|
||||
|
||||
@@ -1538,29 +1499,12 @@ static void UnArchiveTables(void)
|
||||
for (i = 1; i <= n; i++)
|
||||
{
|
||||
lua_rawgeti(gL, TABLESINDEX, i);
|
||||
|
||||
if (!lua_istable(gL, -1))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Value in tables list #%d is not a table! (corrupted save?)\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (UnArchiveValue(TABLESINDEX) == 1) // read key
|
||||
break;
|
||||
|
||||
UINT8 ret = UnArchiveValue(TABLESINDEX);
|
||||
|
||||
if (ret == 1)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Unexpected end of save reached (Corrupted save?)\n");
|
||||
lua_pop(gL, 1); // Pop key
|
||||
break;
|
||||
}
|
||||
else if (ret == 2) // read value
|
||||
if (UnArchiveValue(TABLESINDEX) == 2) // read value
|
||||
n++;
|
||||
|
||||
if (lua_isnil(gL, -2)) // if key is nil (if a function etc was accidentally saved)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "A nil key in table %d was found! (Invalid key type or corrupted save?)\n", i);
|
||||
@@ -1620,13 +1564,8 @@ void LUA_Step(void)
|
||||
{
|
||||
if (!gL)
|
||||
return;
|
||||
|
||||
if (lua_gettop(gL) != 0)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "Eek, there is garbage on lua stack!\n");
|
||||
lua_settop(gL, 0);
|
||||
lua_gc(gL, LUA_GCSTEP, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
lua_gc(gL, LUA_GCSTEP, 1);
|
||||
}
|
||||
|
||||
void LUA_Archive(void)
|
||||
@@ -1648,14 +1587,12 @@ void LUA_Archive(void)
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
// archive function will determine when to skip mobjs,
|
||||
// and write mobjnum in otherwise.
|
||||
ArchiveExtVars(th, "mobj");
|
||||
}
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
// archive function will determine when to skip mobjs,
|
||||
// and write mobjnum in otherwise.
|
||||
ArchiveExtVars(th, "mobj");
|
||||
}
|
||||
}
|
||||
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
|
||||
|
||||
@@ -1683,15 +1620,11 @@ void LUA_UnArchive(void)
|
||||
}
|
||||
|
||||
do {
|
||||
mobjnum = READUINT32(save_p); // read a mobjnum
|
||||
mobjnum = READUINT32(save_p); // read a mobjnum
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
|
||||
continue;
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
}
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker
|
||||
&& ((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
|
||||
LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
|
||||
@@ -1745,41 +1678,13 @@ void LUA_UnArchiveDemo(void)
|
||||
}
|
||||
|
||||
// For mobj_t, player_t, etc. to take custom variables.
|
||||
int Lua_optoption(lua_State *L, int narg, int def, int list_ref)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if (lua_isnoneornil(L, narg))
|
||||
return def;
|
||||
|
||||
I_Assert(lua_checkstack(L, 2));
|
||||
luaL_checkstring(L, narg);
|
||||
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, list_ref);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_pushvalue(L, narg);
|
||||
lua_rawget(L, -2);
|
||||
|
||||
if (lua_isnumber(L, -1))
|
||||
result = lua_tointeger(L, -1);
|
||||
|
||||
lua_pop(L, 2); // Pop result and fields table
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int Lua_CreateFieldTable(lua_State *L, const char *const lst[])
|
||||
int Lua_optoption(lua_State *L, int narg,
|
||||
const char *def, const char *const lst[])
|
||||
{
|
||||
const char *name = (def) ? luaL_optstring(L, narg, def) : luaL_checkstring(L, narg);
|
||||
int i;
|
||||
|
||||
lua_newtable(L);
|
||||
for (i = 0; lst[i] != NULL; i++)
|
||||
{
|
||||
lua_pushstring(L, lst[i]);
|
||||
lua_pushinteger(L, i);
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
|
||||
return luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
}
|
||||
for (i=0; lst[i]; i++)
|
||||
if (fastcmp(lst[i], name))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
+2
-2
@@ -63,8 +63,8 @@ void LUA_UnArchiveDemo(void);
|
||||
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||
int Lua_optoption(lua_State *L, int narg, int def, int list_ref);
|
||||
int Lua_CreateFieldTable(lua_State *L, const char *const lst[]);
|
||||
int Lua_optoption(lua_State *L, int narg,
|
||||
const char *def, const char *const lst[]);
|
||||
void LUAh_NetArchiveHook(lua_CFunction archFunc);
|
||||
|
||||
// Console wrapper
|
||||
|
||||
+1
-6
@@ -38,7 +38,6 @@ enum skin {
|
||||
skin_highresscale,
|
||||
skin_soundsid
|
||||
};
|
||||
|
||||
static const char *const skin_opt[] = {
|
||||
"valid",
|
||||
"name",
|
||||
@@ -62,12 +61,10 @@ static const char *const skin_opt[] = {
|
||||
|
||||
#define UNIMPLEMENTED luaL_error(L, LUA_QL("skin_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", skin_opt[field])
|
||||
|
||||
static int skin_fields_ref = LUA_NOREF;
|
||||
|
||||
static int skin_get(lua_State *L)
|
||||
{
|
||||
skin_t *skin = *((skin_t **)luaL_checkudata(L, 1, META_SKIN));
|
||||
enum skin field = Lua_optoption(L, 2, -1, skin_fields_ref);
|
||||
enum skin field = luaL_checkoption(L, 2, NULL, skin_opt);
|
||||
INT32 i;
|
||||
|
||||
// skins are always valid, only added, never removed
|
||||
@@ -256,8 +253,6 @@ int LUA_SkinLib(lua_State *L)
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L,1);
|
||||
|
||||
skin_fields_ref = Lua_CreateFieldTable(L, skin_opt);
|
||||
|
||||
luaL_newmetatable(L, META_SOUNDSID);
|
||||
lua_pushcfunction(L, soundsid_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
@@ -37,8 +37,9 @@
|
||||
/*
|
||||
* Sacrifice very little compression quality in favour of compression speed.
|
||||
* This gives almost the same compression as the default code, and is
|
||||
* (very roughly) 15% faster. This is the preferred mode of operation.
|
||||
* (very roughly) 15% faster. This is the preferable mode of operation.
|
||||
*/
|
||||
|
||||
#ifndef VERY_FAST
|
||||
# define VERY_FAST 1
|
||||
#endif
|
||||
@@ -47,7 +48,7 @@
|
||||
* Sacrifice some more compression quality in favour of compression speed.
|
||||
* (roughly 1-2% worse compression for large blocks and
|
||||
* 9-10% for small, redundant, blocks and >>20% better speed in both cases)
|
||||
* In short: when in need for speed, enable this for binary data,
|
||||
* In INT16: when in need for speed, enable this for binary data,
|
||||
* possibly disable this for text data.
|
||||
*/
|
||||
#ifndef ULTRA_FAST
|
||||
@@ -65,10 +66,21 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use string functions to copy memory.
|
||||
* this is usually a loss, even with glibc's optimized memcpy
|
||||
*/
|
||||
#ifndef USE_MEMCPY
|
||||
#ifdef _MSC_VER
|
||||
# define USE_MEMCPY 0
|
||||
#else
|
||||
# define USE_MEMCPY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* You may choose to pre-set the hash table (might be faster on some
|
||||
* modern cpus and large (>>64k) blocks, and also makes compression
|
||||
* deterministic/repeatable when the configuration otherwise is the same).
|
||||
* modern cpus and large (>>64k) blocks)
|
||||
*/
|
||||
#ifndef INIT_HTAB
|
||||
# define INIT_HTAB 1
|
||||
@@ -76,15 +88,15 @@
|
||||
|
||||
/*
|
||||
* Avoid assigning values to errno variable? for some embedding purposes
|
||||
* (linux kernel for example), this is necessary. NOTE: this breaks
|
||||
* the documentation in lzf.h. Avoiding errno has no speed impact.
|
||||
* (linux kernel for example), this is neccessary. NOTE: this breaks
|
||||
* the documentation in lzf.h.
|
||||
*/
|
||||
#ifndef AVOID_ERRNO
|
||||
# define AVOID_ERRNO 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Whether to pass the LZF_STATE variable as argument, or allocate it
|
||||
* Wether to pass the LZF_STATE variable as argument, or allocate it
|
||||
* on the stack. For small-stack environments, define this to 1.
|
||||
* NOTE: this breaks the prototype in lzf.h.
|
||||
*/
|
||||
@@ -93,108 +105,50 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Whether to add extra checks for input validity in lzf_decompress
|
||||
* Wether to add extra checks for input validity in lzf_decompress
|
||||
* and return EINVAL if the input stream has been corrupted. This
|
||||
* only shields against overflowing the input buffer and will not
|
||||
* detect most corrupted streams.
|
||||
* This check is not normally noticeable on modern hardware
|
||||
* This check is not normally noticable on modern hardware
|
||||
* (<1% slowdown), but might slow down older cpus considerably.
|
||||
*/
|
||||
#ifndef CHECK_INPUT
|
||||
# define CHECK_INPUT 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Whether the target CPU has a slow multiplication. This affects
|
||||
* the default hash function for the compressor, and enables a slightly
|
||||
* worse hash function that needs only shifts.
|
||||
*/
|
||||
#ifndef MULTIPLICATION_IS_SLOW
|
||||
# define MULTIPLICATION_IS_SLOW 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If defined, then this data type will be used for storing offsets.
|
||||
* This can be useful if you want to use a huge hashtable, want to
|
||||
* conserve memory, or both, and your data fits into e.g. 64kb.
|
||||
* If instead you want to compress data > 4GB, then it's better to
|
||||
* to "#define LZF_USE_OFFSETS 0" instead.
|
||||
*/
|
||||
/*#define LZF_HSLOT unsigned short*/
|
||||
|
||||
/*
|
||||
* Whether to store pointers or offsets inside the hash table. On
|
||||
* 64 bit architetcures, pointers take up twice as much space,
|
||||
* and might also be slower. Default is to autodetect.
|
||||
*/
|
||||
/*#define LZF_USE_OFFSETS autodetect */
|
||||
|
||||
/*
|
||||
* Whether to optimise code for size, at the expense of speed. Use
|
||||
* this when you are extremely tight on memory, perhaps in combination
|
||||
* with AVOID_ERRNO 1 and CHECK_INPUT 0.
|
||||
*/
|
||||
#ifndef OPTIMISE_SIZE
|
||||
# ifdef __OPTIMIZE_SIZE__
|
||||
# define OPTIMISE_SIZE 1
|
||||
# else
|
||||
# define OPTIMISE_SIZE 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* nothing should be changed below */
|
||||
|
||||
# include <string.h>
|
||||
# include <limits.h>
|
||||
|
||||
#if ULTRA_FAST
|
||||
# undef VERY_FAST
|
||||
#endif
|
||||
|
||||
#ifndef LZF_USE_OFFSETS
|
||||
# ifdef _WIN32
|
||||
# define LZF_USE_OFFSETS defined(_M_X64)
|
||||
# else
|
||||
# include <stdint.h>
|
||||
# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char u8;
|
||||
|
||||
#ifdef LZF_HSLOT
|
||||
# define LZF_HSLOT_BIAS ((const u8 *)in_data)
|
||||
#else
|
||||
# ifdef LZF_USE_OFFSETS
|
||||
# define LZF_HSLOT_BIAS ((const u8 *)in_data)
|
||||
typedef unsigned int LZF_HSLOT;
|
||||
typedef const u8 *LZF_STATE[1 << (HLOG)];
|
||||
|
||||
#if !STRICT_ALIGN
|
||||
/* for unaligned accesses we need a 16 bit datatype. */
|
||||
# include <limits.h>
|
||||
# if USHRT_MAX == 65535
|
||||
typedef unsigned short u16;
|
||||
# elif UINT_MAX == 65535
|
||||
typedef unsigned int u16;
|
||||
# else
|
||||
# define LZF_HSLOT_BIAS 0
|
||||
typedef const u8 *LZF_HSLOT;
|
||||
# undef STRICT_ALIGN
|
||||
# define STRICT_ALIGN 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if USHRT_MAX == 65535
|
||||
typedef unsigned short u16;
|
||||
#elif UINT_MAX == 65535
|
||||
typedef unsigned int u16;
|
||||
#else
|
||||
# undef STRICT_ALIGN
|
||||
# define STRICT_ALIGN 1
|
||||
#if ULTRA_FAST
|
||||
# if defined(VERY_FAST)
|
||||
# undef VERY_FAST
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define LZF_MAX_LIT (1 << 5)
|
||||
#define LZF_MAX_OFF (1 << 13)
|
||||
#define LZF_MAX_REF ((1 << 8) + (1 << 3))
|
||||
|
||||
typedef LZF_HSLOT LZF_STATE[1 << (HLOG)];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const u8 *first [1 << (6+8)]; /* most recent occurance of a match */
|
||||
u16 prev [LZF_MAX_OFF]; /* how many bytes to go backwards for the next match */
|
||||
} LZF_STATE_BEST[1];
|
||||
#if USE_MEMCPY || INIT_HTAB
|
||||
# ifdef __cplusplus
|
||||
# include <cstring>
|
||||
# else
|
||||
# include <string.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -210,31 +164,14 @@ typedef struct
|
||||
# define SET_ERRNO(n) errno = (n)
|
||||
#endif
|
||||
|
||||
#ifndef USE_REP_MOVSB
|
||||
#if (defined (__i386) || defined (__amd64)) && __GNUC__ >= 3
|
||||
#define USE_REP_MOVSB 1
|
||||
#else
|
||||
#define USE_REP_MOVSB 0 // Default to 0 if not defined elsewhere
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if USE_REP_MOVSB /* small win on amd, big loss on intel */
|
||||
#if (defined (__i386) || defined (__amd64)) && __GNUC__ >= 3
|
||||
# define lzf_movsb(dst, src, len) \
|
||||
asm ("rep movsb" \
|
||||
: "=D" (dst), "=S" (src), "=c" (len) \
|
||||
: "0" (dst), "1" (src), "2" (len));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
size_t
|
||||
lzf_decompress (const void *const in_data, size_t in_len,
|
||||
void *out_data, size_t out_len)
|
||||
void *out_data, size_t out_len)
|
||||
{
|
||||
u8 const *ip = (const u8 *)in_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
u8 const *const in_end = ip + in_len;
|
||||
u8 *const out_end = op + out_len;
|
||||
u8 *const out_end = op + out_len;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -258,23 +195,14 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef lzf_movsb
|
||||
lzf_movsb (op, ip, ctrl);
|
||||
#elif OPTIMISE_SIZE
|
||||
while (ctrl--)
|
||||
*op++ = *ip++;
|
||||
#if USE_MEMCPY
|
||||
M_Memcpy (op, ip, ctrl);
|
||||
op += ctrl;
|
||||
ip += ctrl;
|
||||
#else
|
||||
switch (ctrl)
|
||||
{
|
||||
case 32: *op++ = *ip++; case 31: *op++ = *ip++; case 30: *op++ = *ip++; case 29: *op++ = *ip++;
|
||||
case 28: *op++ = *ip++; case 27: *op++ = *ip++; case 26: *op++ = *ip++; case 25: *op++ = *ip++;
|
||||
case 24: *op++ = *ip++; case 23: *op++ = *ip++; case 22: *op++ = *ip++; case 21: *op++ = *ip++;
|
||||
case 20: *op++ = *ip++; case 19: *op++ = *ip++; case 18: *op++ = *ip++; case 17: *op++ = *ip++;
|
||||
case 16: *op++ = *ip++; case 15: *op++ = *ip++; case 14: *op++ = *ip++; case 13: *op++ = *ip++;
|
||||
case 12: *op++ = *ip++; case 11: *op++ = *ip++; case 10: *op++ = *ip++; case 9: *op++ = *ip++;
|
||||
case 8: *op++ = *ip++; case 7: *op++ = *ip++; case 6: *op++ = *ip++; case 5: *op++ = *ip++;
|
||||
case 4: *op++ = *ip++; case 3: *op++ = *ip++; case 2: *op++ = *ip++; case 1: *op++ = *ip++;
|
||||
}
|
||||
do
|
||||
*op++ = *ip++;
|
||||
while (--ctrl);
|
||||
#endif
|
||||
}
|
||||
else /* back reference */
|
||||
@@ -316,49 +244,12 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef lzf_movsb
|
||||
len += 2;
|
||||
lzf_movsb (op, ref, len);
|
||||
#elif OPTIMISE_SIZE
|
||||
len += 2;
|
||||
*op++ = *ref++;
|
||||
*op++ = *ref++;
|
||||
|
||||
do
|
||||
*op++ = *ref++;
|
||||
while (--len);
|
||||
#else
|
||||
switch (len)
|
||||
{
|
||||
default:
|
||||
len += 2;
|
||||
|
||||
if (op >= ref + len)
|
||||
{
|
||||
/* disjunct areas */
|
||||
memcpy (op, ref, len);
|
||||
op += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* overlapping, use octet by octet copying */
|
||||
do
|
||||
*op++ = *ref++;
|
||||
while (--len);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: *op++ = *ref++;
|
||||
case 8: *op++ = *ref++;
|
||||
case 7: *op++ = *ref++;
|
||||
case 6: *op++ = *ref++;
|
||||
case 5: *op++ = *ref++;
|
||||
case 4: *op++ = *ref++;
|
||||
case 3: *op++ = *ref++;
|
||||
case 2: *op++ = *ref++;
|
||||
case 1: *op++ = *ref++;
|
||||
case 0: *op++ = *ref++; /* two octets more */
|
||||
*op++ = *ref++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
while (ip < in_end);
|
||||
@@ -375,29 +266,23 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
|
||||
/*
|
||||
* don't play with this unless you benchmark!
|
||||
* the data format is not dependent on the hash function.
|
||||
* the hash function might seem strange, just believe me,
|
||||
* decompression is not dependent on the hash function
|
||||
* the hashing function might seem strange, just believe me
|
||||
* it works ;)
|
||||
*/
|
||||
#ifndef FRST
|
||||
# define FRST(p) (((p[0]) << 8) | p[1])
|
||||
# define NEXT(v,p) (((v) << 8) | p[2])
|
||||
# if MULTIPLICATION_IS_SLOW
|
||||
# if ULTRA_FAST
|
||||
# define IDX(h) ((( h >> (3*8 - HLOG)) - h ) & (HSIZE - 1))
|
||||
# elif VERY_FAST
|
||||
# define IDX(h) ((( h >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
|
||||
# else
|
||||
# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
|
||||
# endif
|
||||
# else
|
||||
/* this one was developed with sesse,
|
||||
* and is very similar to the one in snappy.
|
||||
* it does need a modern enough cpu with a fast multiplication.
|
||||
*/
|
||||
# define IDX(h) (((h * 0x1e35a7bdU) >> (32 - HLOG - 8)) & (HSIZE - 1))
|
||||
# endif
|
||||
# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
|
||||
#endif
|
||||
/*
|
||||
* IDX works because it is very similar to a multiplicative hash, e.g.
|
||||
* ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1))
|
||||
* the latter is also quite fast on newer CPUs, and sligthly better
|
||||
*
|
||||
* the next one is also quite good, albeit slow ;)
|
||||
* (int)(cos(h & 0xffffff) * 1e6)
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* original lzv-like hash function, much worse and thus slower */
|
||||
@@ -406,214 +291,177 @@ lzf_decompress (const void *const in_data, size_t in_len,
|
||||
# define IDX(h) ((h) & (HSIZE - 1))
|
||||
#endif
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
# define expect(expr,value) __builtin_expect ((expr),(value))
|
||||
# define inline inline
|
||||
#else
|
||||
# define expect(expr,value) (expr)
|
||||
# define inline static
|
||||
#endif
|
||||
|
||||
#define expect_false(expr) expect ((expr) != 0, 0)
|
||||
#define expect_true(expr) expect ((expr) != 0, 1)
|
||||
#define MAX_LIT (1 << 5)
|
||||
#define MAX_OFF (1 << 13)
|
||||
#define MAX_REF ((1 << 8) + (1 << 3))
|
||||
|
||||
/*
|
||||
* compressed format
|
||||
*
|
||||
* 000LLLLL <L+1> ; literal, L+1=1..33 octets
|
||||
* LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset
|
||||
* 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset
|
||||
* 000LLLLL <L+1> ; literal
|
||||
* LLLooooo oooooooo ; backref L
|
||||
* 111ooooo LLLLLLLL oooooooo ; backref L+7
|
||||
*
|
||||
*/
|
||||
|
||||
size_t
|
||||
lzf_compress (const void *const in_data, size_t in_len,
|
||||
void *out_data, size_t out_len
|
||||
lzf_compress (const void *const in_data,size_t in_len,
|
||||
void *out_data, size_t out_len
|
||||
#if LZF_STATE_ARG
|
||||
, LZF_STATE htab
|
||||
, LZF_STATE *htab
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
#if !LZF_STATE_ARG
|
||||
LZF_STATE htab;
|
||||
#endif
|
||||
const u8 **hslot;
|
||||
const u8 *ip = (const u8 *)in_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
u8 *op = (u8 *)out_data;
|
||||
const u8 *in_end = ip + in_len;
|
||||
u8 *out_end = op + out_len;
|
||||
const u8 *ref;
|
||||
|
||||
/*
|
||||
* off requires a type wide enough to hold a general pointer difference.
|
||||
* ISO C doesn't have that (size_t might not be enough and ptrdiff_t only
|
||||
* works for differences within a single object). We also assume that
|
||||
* no bit pattern traps. Since the only platform that is both non-POSIX
|
||||
* and fails to support both assumptions is windows 64 bit, we make a
|
||||
* special workaround for it.
|
||||
*/
|
||||
u8 *out_end = op + out_len;
|
||||
const u8 *ref = NULL;
|
||||
|
||||
unsigned int hval = FRST (ip);
|
||||
size_t off;
|
||||
unsigned int hval;
|
||||
int lit;
|
||||
|
||||
if (!in_len || !out_len)
|
||||
return 0;
|
||||
int lit = 0;
|
||||
|
||||
#if INIT_HTAB
|
||||
# if USE_MEMCPY
|
||||
memset (htab, 0, sizeof (htab));
|
||||
# else
|
||||
for (hslot = htab; hslot < htab + HSIZE; hslot++)
|
||||
*hslot++ = ip;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
lit = 0; op++; /* start run */
|
||||
|
||||
hval = FRST (ip);
|
||||
while (ip < in_end - 2)
|
||||
for (;;)
|
||||
{
|
||||
LZF_HSLOT *hslot;
|
||||
|
||||
hval = NEXT (hval, ip);
|
||||
hslot = htab + IDX (hval);
|
||||
ref = *hslot + LZF_HSLOT_BIAS; *hslot = ip - LZF_HSLOT_BIAS;
|
||||
|
||||
if (1
|
||||
#if INIT_HTAB
|
||||
&& ref < ip /* the next test will actually take care of this, but this is faster */
|
||||
#endif
|
||||
&& (off = ip - ref - 1) < LZF_MAX_OFF
|
||||
&& ref > (const u8 *)in_data
|
||||
&& ref[2] == ip[2]
|
||||
#if STRICT_ALIGN
|
||||
&& ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0])
|
||||
#else
|
||||
&& *(const u16 *)ref == *(const u16 *)ip
|
||||
#endif
|
||||
)
|
||||
if (ip < in_end - 2)
|
||||
{
|
||||
/* match found at *ref++ */
|
||||
unsigned int len = 2;
|
||||
size_t maxlen = in_end - ip - len;
|
||||
maxlen = maxlen > LZF_MAX_REF ? LZF_MAX_REF : maxlen;
|
||||
hval = NEXT (hval, ip);
|
||||
hslot = htab + IDX (hval);
|
||||
ref = *hslot; *hslot = ip;
|
||||
|
||||
if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */
|
||||
if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */
|
||||
return 0;
|
||||
|
||||
op [- lit - 1] = lit - 1; /* stop run */
|
||||
op -= !lit; /* undo run if length is zero */
|
||||
|
||||
for (;;)
|
||||
if (
|
||||
#if INIT_HTAB && !USE_MEMCPY
|
||||
ref < ip /* the next test will actually take care of this, but this is faster */
|
||||
&&
|
||||
#endif
|
||||
(off = ip - ref - 1) < MAX_OFF
|
||||
&& ip + 4 < in_end
|
||||
&& ref > (const u8 *)in_data
|
||||
#if STRICT_ALIGN
|
||||
&& ref[0] == ip[0]
|
||||
&& ref[1] == ip[1]
|
||||
&& ref[2] == ip[2]
|
||||
#else
|
||||
&& *(const u16 *)ref == *(const u16 *)ip
|
||||
&& ref[2] == ip[2]
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (expect_true (maxlen > 16))
|
||||
{
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
/* match found at *ref++ */
|
||||
unsigned int len = 2;
|
||||
size_t maxlen = in_end - ip - len;
|
||||
maxlen = maxlen > MAX_REF ? MAX_REF : maxlen;
|
||||
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
len++; if (ref [len] != ip [len]) break;
|
||||
}
|
||||
if (op + lit + 1 + 3 >= out_end)
|
||||
return 0;
|
||||
|
||||
do
|
||||
len++;
|
||||
while (len < maxlen && ref[len] == ip[len]);
|
||||
|
||||
break;
|
||||
}
|
||||
if (lit)
|
||||
{
|
||||
*op++ = (u8)(lit - 1);
|
||||
lit = -lit;
|
||||
do
|
||||
*op++ = ip[lit];
|
||||
while (++lit);
|
||||
}
|
||||
|
||||
len -= 2; /* len is now #octets - 1 */
|
||||
ip++;
|
||||
len -= 2;
|
||||
ip++;
|
||||
|
||||
if (len < 7)
|
||||
{
|
||||
*op++ = (off >> 8) + (len << 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
*op++ = (off >> 8) + ( 7 << 5);
|
||||
*op++ = len - 7;
|
||||
}
|
||||
if (len < 7)
|
||||
{
|
||||
*op++ = (u8)((off >> 8) + (len << 5));
|
||||
}
|
||||
else
|
||||
{
|
||||
*op++ = (u8)((off >> 8) + ( 7 << 5));
|
||||
*op++ = (u8)(len - 7);
|
||||
}
|
||||
|
||||
*op++ = off;
|
||||
|
||||
lit = 0; op++; /* start run */
|
||||
|
||||
ip += len + 1;
|
||||
|
||||
if (expect_false (ip >= in_end - 2))
|
||||
break;
|
||||
*op++ = (u8)off;
|
||||
|
||||
#if ULTRA_FAST || VERY_FAST
|
||||
--ip;
|
||||
# if VERY_FAST && !ULTRA_FAST
|
||||
--ip;
|
||||
# endif
|
||||
hval = FRST (ip);
|
||||
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
|
||||
ip++;
|
||||
|
||||
# if VERY_FAST && !ULTRA_FAST
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
|
||||
ip++;
|
||||
# endif
|
||||
#else
|
||||
ip -= len + 1;
|
||||
|
||||
do
|
||||
{
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
|
||||
ip++;
|
||||
}
|
||||
while (len--);
|
||||
ip += len;
|
||||
#if VERY_FAST && !ULTRA_FAST
|
||||
--ip;
|
||||
#endif
|
||||
hval = FRST (ip);
|
||||
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
ip++;
|
||||
|
||||
#if VERY_FAST && !ULTRA_FAST
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
ip++;
|
||||
#endif
|
||||
#else
|
||||
do
|
||||
{
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
ip++;
|
||||
}
|
||||
while (len--);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (ip == in_end)
|
||||
break;
|
||||
|
||||
/* one more literal byte we must copy */
|
||||
lit++;
|
||||
ip++;
|
||||
|
||||
if (lit == MAX_LIT)
|
||||
{
|
||||
/* one more literal byte we must copy */
|
||||
if (expect_false (op >= out_end))
|
||||
if (op + 1 + MAX_LIT >= out_end)
|
||||
return 0;
|
||||
|
||||
lit++; *op++ = *ip++;
|
||||
|
||||
if (expect_false (lit == LZF_MAX_LIT))
|
||||
{
|
||||
op [- lit - 1] = lit - 1; /* stop run */
|
||||
lit = 0; op++; /* start run */
|
||||
}
|
||||
*op++ = MAX_LIT - 1;
|
||||
#if USE_MEMCPY
|
||||
M_Memcpy (op, ip - MAX_LIT, MAX_LIT);
|
||||
op += MAX_LIT;
|
||||
lit = 0;
|
||||
#else
|
||||
lit = -lit;
|
||||
do
|
||||
*op++ = ip[lit];
|
||||
while (++lit);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (op + 3 > out_end) /* at most 3 bytes can be missing here */
|
||||
return 0;
|
||||
|
||||
while (ip < in_end)
|
||||
if (lit)
|
||||
{
|
||||
lit++; *op++ = *ip++;
|
||||
if (op + lit + 1 >= out_end)
|
||||
return 0;
|
||||
|
||||
if (expect_false (lit == LZF_MAX_LIT))
|
||||
{
|
||||
op [- lit - 1] = lit - 1; /* stop run */
|
||||
lit = 0; op++; /* start run */
|
||||
}
|
||||
*op++ = (u8)(lit - 1);
|
||||
lit = -lit;
|
||||
do
|
||||
*op++ = ip[lit];
|
||||
while (++lit);
|
||||
}
|
||||
|
||||
op [- lit - 1] = lit - 1; /* end run */
|
||||
op -= !lit; /* undo run if length is zero */
|
||||
|
||||
return op - (u8 *)out_data;
|
||||
return op - (u8 *) out_data;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
// Copyright (C) 2000-2005 by Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -22,7 +22,7 @@
|
||||
**
|
||||
***********************************************************************/
|
||||
|
||||
#define LZF_VERSION 0x0106 /* 1.6 */
|
||||
#define LZF_VERSION 0x0105 /* 1.5 */
|
||||
|
||||
/*
|
||||
* Compress in_len bytes stored at the memory block starting at
|
||||
|
||||
+2
-3
@@ -909,9 +909,8 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
// get offset from mt, which points to old mapthings, then add new location
|
||||
if (!mo->spawnpoint)
|
||||
continue;
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
if (mo->spawnpoint)
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1011,6 +1011,13 @@ int main(int argc, char** argv)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void *cpu_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
void *(*M_Memcpy)(void* dest, const void* src, size_t n) = cpu_cpy;
|
||||
|
||||
void I_Error(const char *error, ...)
|
||||
{
|
||||
(void)error;
|
||||
|
||||
+956
-986
File diff suppressed because it is too large.
Load diff
+2
-23
@@ -21,8 +21,6 @@
|
||||
#include "mserv.h"
|
||||
#include "r_things.h" // for SKINNAMESIZE
|
||||
|
||||
extern boolean forceshowhud;
|
||||
|
||||
//
|
||||
// MENUS
|
||||
//
|
||||
@@ -61,13 +59,6 @@ void M_SortServerList(void);
|
||||
// Draws a box with a texture inside as background for messages
|
||||
void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines);
|
||||
|
||||
// Same but with extra flags applied
|
||||
void M_DrawTextBoxFlags(INT32 x, INT32 y, INT32 width, INT32 boxlines, INT32 flags);
|
||||
|
||||
// Draw text input
|
||||
typedef struct textinput_s textinput_t;
|
||||
void M_DrawTextInput(INT32 x, INT32 y, textinput_t *input, INT32 flags);
|
||||
|
||||
// Used in d_netcmd to restart time attack
|
||||
void M_ModeAttackRetry(INT32 choice);
|
||||
|
||||
@@ -264,7 +255,6 @@ extern INT32 mapwads[NUMMAPS];
|
||||
|
||||
extern description_t description[MAXSKINS];
|
||||
|
||||
extern consvar_t cv_replaysearchrate;
|
||||
extern consvar_t cv_showfocuslost;
|
||||
extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort;
|
||||
extern consvar_t cv_showallmaps;
|
||||
@@ -296,8 +286,8 @@ void PDistort_menu_Onchange(void);
|
||||
// Bird menu updating
|
||||
void Bird_menu_Onchange(void);
|
||||
|
||||
// Saturn Hud menu updating
|
||||
void SaturnHud_menu_Onchange(void);
|
||||
// Saturn menu updating
|
||||
void Saturn_menu_Onchange(void);
|
||||
|
||||
void M_ReplayHut(INT32 choice);
|
||||
void M_SetPlaybackMenuPointer(void);
|
||||
@@ -407,15 +397,4 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define DoToolTips(menu, tooltip)\
|
||||
if (currentMenu == &menu)\
|
||||
{\
|
||||
if (!(tooltip[itemOn] == NULL))\
|
||||
{\
|
||||
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, tooltip[itemOn], coolalphatimer);\
|
||||
if (coolalphatimer > 0 && interpTimerHackAllow)\
|
||||
coolalphatimer--;\
|
||||
}\
|
||||
}
|
||||
|
||||
#endif //__X_MENU__
|
||||
+5
-49
@@ -334,38 +334,6 @@ boolean FIL_FileOK(char const *name)
|
||||
return access(name,6)+1; //R_OK|W_OK
|
||||
}
|
||||
|
||||
/** Copies contents of one file to another
|
||||
*
|
||||
* \param src File to copy from
|
||||
* \param dst File to write into
|
||||
* \return true if copy was succesful, false if it doesn't.
|
||||
*/
|
||||
boolean FIL_CopyFile(const char *src, const char *dst)
|
||||
{
|
||||
FILE *srcFile = fopen(src, "rb");
|
||||
|
||||
if (srcFile == NULL)
|
||||
return false;
|
||||
|
||||
FILE *dstFile = fopen(dst, "wb");
|
||||
|
||||
if (dstFile == NULL)
|
||||
{
|
||||
fclose(srcFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
char buffer[1024];
|
||||
size_t n;
|
||||
|
||||
while ((n = fread(buffer, 1, sizeof(buffer), srcFile)) > 0)
|
||||
fwrite(buffer, 1, n, dstFile);
|
||||
|
||||
fclose(srcFile);
|
||||
fclose(dstFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Checks if a pathname has a file extension and adds the extension provided
|
||||
* if not.
|
||||
@@ -557,28 +525,11 @@ void M_SaveConfig(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
char *filepath;
|
||||
char backupfile[MAX_WADPATH+4];
|
||||
|
||||
// make sure not to write back the config until it's been correctly loaded
|
||||
if (!gameconfig_loaded)
|
||||
return;
|
||||
|
||||
// Create backup of the config file
|
||||
snprintf(backupfile, sizeof backupfile, "%s.bak", configfile);
|
||||
backupfile[sizeof backupfile - 1] = '\0';
|
||||
|
||||
FILE *config = fopen(configfile, "r");
|
||||
|
||||
if (config != NULL)
|
||||
{
|
||||
fclose(config);
|
||||
if (FIL_CopyFile(configfile, backupfile) == false)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,"Failed to create a backup of the configuration file. Will not attempt to write to file\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// can change the file name
|
||||
if (filename)
|
||||
{
|
||||
@@ -1987,6 +1938,11 @@ char *sizeu5(size_t num)
|
||||
return sizeu5_buf;
|
||||
}
|
||||
|
||||
void *M_Memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
/** Return the appropriate message for a file error or end of file.
|
||||
*/
|
||||
const char *M_FileError(FILE *fp)
|
||||
|
||||
@@ -54,7 +54,6 @@ boolean FIL_FileExists(const char *name);
|
||||
boolean FIL_WriteFileOK(char const *name);
|
||||
boolean FIL_ReadFileOK(char const *name);
|
||||
boolean FIL_FileOK(char const *name);
|
||||
boolean FIL_CopyFile(const char *src, const char *dst);
|
||||
|
||||
void FIL_DefaultExtension (char *path, const char *extension);
|
||||
void FIL_ForceExtension(char *path, const char *extension);
|
||||
|
||||
+3
-6
@@ -10,7 +10,6 @@
|
||||
/// \brief Performance measurement tools.
|
||||
|
||||
#include "m_perfstats.h"
|
||||
#include "p_mobj.h"
|
||||
#include "v_video.h"
|
||||
#include "i_video.h"
|
||||
#include "d_netcmd.h"
|
||||
@@ -173,8 +172,8 @@ perfstatrow_t thinkercount_rows[] = {
|
||||
{" regular", " Regular: ", &ps_regularcount, PS_LEVEL},
|
||||
{" scenery", " Scenery: ", &ps_scenerycount, PS_LEVEL},
|
||||
{" nothink", " Nothink: ", &ps_nothinkcount, PS_HIDE_ZERO|PS_LEVEL},
|
||||
{" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL},
|
||||
{" other ", " Other: ", &ps_otherthcount, PS_LEVEL},
|
||||
{" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL},
|
||||
{" remove ", " Pending removal:", &ps_removecount, PS_LEVEL},
|
||||
{0}
|
||||
};
|
||||
@@ -572,14 +571,12 @@ static void PS_CountThinkers(void)
|
||||
ps_regularcount.value.i = 0;
|
||||
ps_scenerycount.value.i = 0;
|
||||
ps_nothinkcount.value.i = 0;
|
||||
ps_precipcount.value.i = 0;
|
||||
ps_otherthcount.value.i = 0;
|
||||
ps_precipcount.value.i = 0;
|
||||
ps_removecount.value.i = 0;
|
||||
for (thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next)
|
||||
{
|
||||
if (thinker->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
ps_thinkercount.value.i++;
|
||||
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
ps_removecount.value.i++;
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
|
||||
@@ -1,303 +0,0 @@
|
||||
#include "m_textinput.h"
|
||||
#include "i_system.h"
|
||||
#include "keys.h"
|
||||
#include "console.h"
|
||||
|
||||
static void M_TextInputDel(textinput_t *input, size_t start, size_t end)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = (end - start);
|
||||
|
||||
if (end != input->length)
|
||||
memmove(&input->buffer[start], &input->buffer[end], input->length-end);
|
||||
memset(&input->buffer[input->length - len], 0, len);
|
||||
|
||||
input->length -= len;
|
||||
|
||||
if (input->select >= end)
|
||||
input->select -= len;
|
||||
else if (input->select > start)
|
||||
input->select = start;
|
||||
|
||||
if (input->cursor >= end)
|
||||
input->cursor -= len;
|
||||
else if (input->cursor > start)
|
||||
input->cursor = start;
|
||||
}
|
||||
|
||||
static void M_TextInputDelSelection(textinput_t *input)
|
||||
{
|
||||
size_t start, end;
|
||||
|
||||
if (input->cursor > input->select)
|
||||
{
|
||||
start = input->select;
|
||||
end = input->cursor;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = input->cursor;
|
||||
end = input->select;
|
||||
}
|
||||
|
||||
M_TextInputDel(input, start, end);
|
||||
|
||||
input->select = input->cursor = start;
|
||||
}
|
||||
|
||||
static void M_TextInputAddString(textinput_t *input, const char *c)
|
||||
{
|
||||
size_t csize = strlen(c);
|
||||
|
||||
if (input->length + csize > input->buffer_size-1)
|
||||
return;
|
||||
|
||||
if (input->cursor != input->length)
|
||||
memmove(&input->buffer[input->cursor+csize], &input->buffer[input->cursor], input->length-input->cursor);
|
||||
memcpy(&input->buffer[input->cursor], c, csize);
|
||||
input->length += csize;
|
||||
input->select = (input->cursor += csize);
|
||||
input->buffer[input->length] = 0;
|
||||
}
|
||||
|
||||
static void M_TextInputAddChar(textinput_t *input, char c)
|
||||
{
|
||||
if (input->length >= input->buffer_size-1)
|
||||
return;
|
||||
|
||||
if (input->cursor != input->length)
|
||||
memmove(&input->buffer[input->cursor+1], &input->buffer[input->cursor], input->length-input->cursor);
|
||||
input->buffer[input->cursor++] = c;
|
||||
input->buffer[++input->length] = 0;
|
||||
input->select = input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputDelChar(textinput_t *input)
|
||||
{
|
||||
if (!input->cursor)
|
||||
return;
|
||||
|
||||
if (input->cursor != input->length)
|
||||
memmove(&input->buffer[input->cursor-1], &input->buffer[input->cursor], input->length-input->cursor);
|
||||
input->buffer[--input->length] = 0;
|
||||
input->select = --input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputToWordEnd(textinput_t *input, boolean move_sel)
|
||||
{
|
||||
// Skip spaces
|
||||
while (input->cursor < input->length && isspace(input->buffer[input->cursor]))
|
||||
++input->cursor;
|
||||
|
||||
// Skip word
|
||||
while (input->cursor < input->length && !isspace(input->buffer[input->cursor]))
|
||||
++input->cursor;
|
||||
|
||||
if (move_sel) input->select = input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputToWordBegin(textinput_t *input, boolean move_sel)
|
||||
{
|
||||
// Hack, always move back 1 character if possible so if we press ctrl-left at a word beginning
|
||||
// we move to previous word
|
||||
if (input->cursor) --input->cursor;
|
||||
|
||||
// Skip spaces
|
||||
while (input->cursor && isspace(input->buffer[input->cursor]))
|
||||
--input->cursor;
|
||||
|
||||
// Skip word
|
||||
while (input->cursor && !isspace(input->buffer[input->cursor]))
|
||||
--input->cursor;
|
||||
|
||||
// Unless we reached beginning of line, we're pointing at a space before word, so move cursor
|
||||
// forward to fix that
|
||||
if (input->cursor) ++input->cursor;
|
||||
|
||||
if (move_sel) input->select = input->cursor;
|
||||
}
|
||||
|
||||
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
|
||||
{
|
||||
input->buffer = buffer;
|
||||
input->buffer_size = buffer_size;
|
||||
|
||||
M_TextInputClear(input);
|
||||
}
|
||||
|
||||
void M_TextInputClear(textinput_t *input)
|
||||
{
|
||||
input->cursor = 0;
|
||||
input->select = 0;
|
||||
input->length = 0;
|
||||
}
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c)
|
||||
{
|
||||
memset(input->buffer, 0, input->buffer_size);
|
||||
strcpy(input->buffer, c);
|
||||
input->cursor = input->select = input->length = strlen(c);
|
||||
}
|
||||
|
||||
boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
||||
{
|
||||
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|
||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||
|| key == KEY_LALT || key == KEY_RALT)
|
||||
return false;
|
||||
|
||||
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
|
||||
{
|
||||
if (key == 'x' || key == 'X')
|
||||
{
|
||||
if (input->select > input->cursor)
|
||||
I_ClipboardCopy(&input->buffer[input->cursor], input->select-input->cursor);
|
||||
else
|
||||
I_ClipboardCopy(&input->buffer[input->select], input->cursor-input->select);
|
||||
M_TextInputDelSelection(input);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'c' || key == 'C')
|
||||
{
|
||||
if (input->select > input->cursor)
|
||||
I_ClipboardCopy(&input->buffer[input->cursor], input->select-input->cursor);
|
||||
else
|
||||
I_ClipboardCopy(&input->buffer[input->select], input->cursor-input->select);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'v' || key == 'V')
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
if (input->select != input->cursor)
|
||||
M_TextInputDelSelection(input);
|
||||
if (paste != NULL)
|
||||
M_TextInputAddString(input, paste);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'w' || key == 'W')
|
||||
{
|
||||
size_t word_start, word_end, i;
|
||||
word_end = i = input->cursor;
|
||||
|
||||
// Unless we're pointing at the beginning of line, decrement i so we only start
|
||||
// removing symbols that come before the cursor
|
||||
if (i) --i;
|
||||
|
||||
// We might be pointing to spaces, skip them first
|
||||
while (i && isspace(input->buffer[i]))
|
||||
--i;
|
||||
|
||||
// Now skip the "word"
|
||||
while (i && !isspace(input->buffer[i]))
|
||||
--i;
|
||||
|
||||
// Unless we reached beginning of line, i is pointing at first space that was found
|
||||
// before word start, and we don't want to remove it
|
||||
if (i) ++i;
|
||||
|
||||
word_start = i;
|
||||
|
||||
if (word_start != word_end)
|
||||
M_TextInputDel(input, word_start, word_end);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
M_TextInputToWordEnd(input, !shiftdown);
|
||||
else if (key == KEY_LEFTARROW)
|
||||
M_TextInputToWordBegin(input, !shiftdown);
|
||||
|
||||
// Select all
|
||||
if (key == 'a' || key == 'A')
|
||||
{
|
||||
input->select = 0;
|
||||
input->cursor = input->length;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ...why shouldn't it eat the key? if it doesn't, it just means you
|
||||
// can control Sonic from the console, which is silly
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == KEY_LEFTARROW)
|
||||
{
|
||||
if (input->cursor != 0)
|
||||
--input->cursor;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
{
|
||||
if (input->cursor < input->length)
|
||||
++input->cursor;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_HOME)
|
||||
{
|
||||
input->cursor = 0;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_END)
|
||||
{
|
||||
input->cursor = input->length;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
|
||||
// backspace and delete command prompt
|
||||
if (input->select != input->cursor)
|
||||
{
|
||||
if (key == KEY_BACKSPACE || key == KEY_DEL)
|
||||
{
|
||||
M_TextInputDelSelection(input);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (key == KEY_BACKSPACE)
|
||||
{
|
||||
M_TextInputDelChar(input);
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_DEL)
|
||||
{
|
||||
if (input->cursor == input->length)
|
||||
return true;
|
||||
++input->cursor;
|
||||
M_TextInputDelChar(input);
|
||||
return true;
|
||||
}
|
||||
|
||||
// allow people to use keypad in console (good for typing IP addresses) - Calum
|
||||
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
|
||||
{
|
||||
char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
}
|
||||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
|
||||
key = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(key) : CON_ShiftChar(key);
|
||||
|
||||
// enter a char into the command prompt
|
||||
if (key < 32 || key > 127)
|
||||
return false;
|
||||
|
||||
if (input->select != input->cursor)
|
||||
M_TextInputDelSelection(input);
|
||||
M_TextInputAddChar(input, key);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef __M_TEXTINPUT__
|
||||
#define __M_TEXTINPUT__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
typedef struct textinput_s {
|
||||
size_t cursor;
|
||||
size_t select;
|
||||
size_t length;
|
||||
|
||||
char *buffer;
|
||||
size_t buffer_size;
|
||||
} textinput_t;
|
||||
|
||||
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size);
|
||||
|
||||
void M_TextInputClear(textinput_t *input);
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c);
|
||||
|
||||
boolean M_TextInputHandle(textinput_t *input, INT32 key);
|
||||
|
||||
#endif
|
||||
+16
-73
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "doomdef.h"
|
||||
#include "console.h" // con_startup
|
||||
#include "command.h"
|
||||
#include "i_threads.h"
|
||||
#include "mserv.h"
|
||||
@@ -213,50 +212,20 @@ static void Command_Listserv_f(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
static boolean firstmsrules = false;
|
||||
|
||||
static void
|
||||
Get_masterserver_rules (boolean checkfirst)
|
||||
{
|
||||
char rules[256];
|
||||
|
||||
if (checkfirst)
|
||||
{
|
||||
boolean MSRulesExist;
|
||||
|
||||
Lock_state();
|
||||
MSRulesExist = (MSRules != NULL);
|
||||
Unlock_state();
|
||||
|
||||
if (MSRulesExist)
|
||||
return;
|
||||
}
|
||||
|
||||
if (HMS_fetch_rules(rules, sizeof rules))
|
||||
{
|
||||
Lock_state();
|
||||
Z_Free(MSRules);
|
||||
MSRules = Z_StrDup(rules);
|
||||
|
||||
if (MSRegistered == true)
|
||||
{
|
||||
CONS_Printf("\n");
|
||||
CONS_Alert(CONS_NOTICE, "%s\n", rules);
|
||||
}
|
||||
|
||||
firstmsrules = true;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Finish_registration (void)
|
||||
{
|
||||
int registered;
|
||||
char *rules = GetMasterServerRules();
|
||||
|
||||
CONS_Printf("Registering this server on the master server...\n");
|
||||
|
||||
if (rules)
|
||||
{
|
||||
CONS_Printf("\n");
|
||||
CONS_Alert(CONS_NOTICE, "%s\n", rules);
|
||||
}
|
||||
|
||||
registered = HMS_register();
|
||||
|
||||
Lock_state();
|
||||
@@ -268,17 +237,6 @@ Finish_registration (void)
|
||||
}
|
||||
Unlock_state();
|
||||
|
||||
char *rules = GetMasterServerRules();
|
||||
if (rules == NULL)
|
||||
{
|
||||
Get_masterserver_rules(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("\n");
|
||||
CONS_Alert(CONS_NOTICE, "%s\n", rules);
|
||||
}
|
||||
|
||||
if (registered)
|
||||
CONS_Printf("Master server registration successful.\n");
|
||||
}
|
||||
@@ -364,10 +322,17 @@ Finish_unlist (void)
|
||||
static void
|
||||
Finish_masterserver_change (char *api)
|
||||
{
|
||||
char rules[256];
|
||||
|
||||
HMS_set_api(api);
|
||||
|
||||
if (!con_startup)
|
||||
Get_masterserver_rules(false);
|
||||
if (HMS_fetch_rules(rules, sizeof rules))
|
||||
{
|
||||
Lock_state();
|
||||
Z_Free(MSRules);
|
||||
MSRules = Z_StrDup(rules);
|
||||
Unlock_state();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
@@ -465,14 +430,6 @@ Change_masterserver_thread (char *api)
|
||||
|
||||
Finish_masterserver_change(api);
|
||||
}
|
||||
|
||||
static void
|
||||
Get_masterserver_rules_thread (void)
|
||||
{
|
||||
// THIS FUNC has its own lock check in it
|
||||
Get_masterserver_rules(true);
|
||||
}
|
||||
|
||||
#endif/*HAVE_THREADS*/
|
||||
|
||||
void RegisterServer(void)
|
||||
@@ -583,20 +540,6 @@ Set_api (const char *api)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Get_rules (void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"get-masterserver-rules",
|
||||
(I_thread_fn)Get_masterserver_rules_thread,
|
||||
NULL
|
||||
);
|
||||
#else
|
||||
Get_masterserver_rules(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
static void
|
||||
|
||||
+1
-5
@@ -82,8 +82,6 @@ extern I_mutex ms_ServerList_mutex;
|
||||
void RegisterServer(void);
|
||||
void UnregisterServer(void);
|
||||
|
||||
void Get_rules(void);
|
||||
|
||||
void MasterClient_Ticker(void);
|
||||
|
||||
msg_server_t *GetShortServersList(int id);
|
||||
@@ -92,11 +90,9 @@ char *GetMODVersion(int id);
|
||||
#endif
|
||||
|
||||
char *GetMasterServerRules(void);
|
||||
#endif
|
||||
|
||||
void AddMServCommands(void);
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
/* HTTP */
|
||||
void HMS_set_api (char *api);
|
||||
int HMS_register (void);
|
||||
@@ -109,4 +105,4 @@ const char * HMS_fetch_rules (char *buffer, size_t size_of_buffer);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+203
-203
File diff suppressed because it is too large.
Load diff
@@ -1968,8 +1968,32 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
||||
}
|
||||
else // Not going anywhere, so look for players.
|
||||
{
|
||||
//thinker_t *th;
|
||||
//mobj_t *mo;
|
||||
|
||||
thwomp->direction = -1;
|
||||
|
||||
/* // SRB2kart 170217 - Thwomps are automatic.
|
||||
// scan the thinkers to find players!
|
||||
if (!rover || (rover->flags & FF_EXISTS))
|
||||
{
|
||||
// scan the thinkers to find players!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator
|
||||
&& mo->z <= thwomp->sector->ceilingheight
|
||||
&& P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT)
|
||||
{
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
thwomp->sector->ceilspeed = 0;
|
||||
thwomp->sector->floorspeed = 0;
|
||||
}
|
||||
|
||||
+596
-65
@@ -17,7 +17,6 @@
|
||||
#include "g_game.h"
|
||||
#include "m_random.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "s_sound.h"
|
||||
#include "r_main.h"
|
||||
#include "st_stuff.h"
|
||||
@@ -254,21 +253,26 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
if (heightcheck)
|
||||
{
|
||||
if (toucher->momz < 0)
|
||||
{
|
||||
if (toucher->z + toucher->momz > special->z + special->height)
|
||||
/*if (special->type == MT_FLINGEMERALD) // little hack here...
|
||||
{ // flingemerald sprites are low to the ground, so extend collision radius down some.
|
||||
if (toucher->z > (special->z + special->height))
|
||||
return;
|
||||
if (special->z - special->height > (toucher->z + toucher->height))
|
||||
return;
|
||||
}
|
||||
else if (toucher->z > special->z + special->height)
|
||||
return;
|
||||
|
||||
if (toucher->momz > 0)
|
||||
else*/
|
||||
{
|
||||
if (toucher->z + toucher->height + toucher->momz < special->z)
|
||||
if (toucher->momz < 0) {
|
||||
if (toucher->z + toucher->momz > special->z + special->height)
|
||||
return;
|
||||
} else if (toucher->z > special->z + special->height)
|
||||
return;
|
||||
if (toucher->momz > 0) {
|
||||
if (toucher->z + toucher->height + toucher->momz < special->z)
|
||||
return;
|
||||
} else if (toucher->z + toucher->height < special->z)
|
||||
return;
|
||||
}
|
||||
else if (toucher->z + toucher->height < special->z)
|
||||
return;
|
||||
}
|
||||
|
||||
if (special->health <= 0)
|
||||
@@ -379,8 +383,16 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
player->kartstuff[k_roulettetype] = 2;
|
||||
}
|
||||
|
||||
mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
|
||||
S_StartSound(poof, special->info->deathsound);
|
||||
#if 0
|
||||
// Eggbox snipe!
|
||||
if (special->type == MT_EGGMANITEM && special->health > 1)
|
||||
S_StartSound(toucher, sfx_bsnipe);
|
||||
#endif
|
||||
|
||||
{
|
||||
mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
|
||||
S_StartSound(poof, special->info->deathsound);
|
||||
}
|
||||
|
||||
if (special->target && special->target->player)
|
||||
{
|
||||
@@ -463,8 +475,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
}
|
||||
else if (special->target->player->kartstuff[k_comebackmode] == 1 && P_CanPickupItem(player, 1))
|
||||
{
|
||||
mobj_t *poof2 = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
|
||||
S_StartSound(poof2, special->info->seesound);
|
||||
mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
|
||||
S_StartSound(poof, special->info->seesound);
|
||||
|
||||
// Karma fireworks
|
||||
for (i = 0; i < 5; i++)
|
||||
@@ -490,10 +502,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
}
|
||||
else if (special->target->player->kartstuff[k_comebackmode] == 2 && P_CanPickupItem(player, 2))
|
||||
{
|
||||
mobj_t *poof3 = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
|
||||
mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
|
||||
UINT8 ptadd = 1; // No WANTED bonus for tricking
|
||||
|
||||
S_StartSound(poof3, special->info->seesound);
|
||||
S_StartSound(poof, special->info->seesound);
|
||||
|
||||
if (player->kartstuff[k_bumper] == 1) // If you have only one bumper left, and see if it's a 1v1
|
||||
{
|
||||
@@ -571,6 +583,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
else
|
||||
K_SpinPlayer(player, special->target, 0, special, false);
|
||||
return;
|
||||
/*case MT_EERIEFOG:
|
||||
special->frame &= ~FF_TRANS80;
|
||||
special->frame |= FF_TRANS90;
|
||||
return;*/
|
||||
case MT_SMK_MOLE:
|
||||
if (special->target && !P_MobjWasRemoved(special->target))
|
||||
return;
|
||||
@@ -919,6 +935,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
player->flyangle = special->threshold;
|
||||
|
||||
player->speed = FixedMul(special->info->speed, special->scale);
|
||||
// Potentially causes axis transfer failures.
|
||||
// Also rarely worked properly anyway.
|
||||
//P_UnsetThingPosition(player->mo);
|
||||
//player->mo->x = special->x;
|
||||
//player->mo->y = special->y;
|
||||
//P_SetThingPosition(player->mo);
|
||||
toucher->z = special->z+(special->height/4);
|
||||
}
|
||||
else // More like a spring
|
||||
@@ -963,6 +985,140 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
}
|
||||
}
|
||||
return;
|
||||
/*case MT_NIGHTSSUPERLOOP:
|
||||
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
|
||||
return;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
player->powers[pw_nights_superloop] = (UINT16)special->info->speed;
|
||||
else
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].pflags & PF_NIGHTSMODE)
|
||||
players[i].powers[pw_nights_superloop] = (UINT16)special->info->speed;
|
||||
if (special->info->deathsound != sfx_None)
|
||||
S_StartSound(NULL, special->info->deathsound);
|
||||
}
|
||||
|
||||
// CECHO showing you what this item is
|
||||
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
|
||||
{
|
||||
HU_SetCEchoFlags(V_AUTOFADEOUT);
|
||||
HU_SetCEchoDuration(4);
|
||||
HU_DoCEcho(M_GetText("\\\\\\\\\\\\\\\\Super Paraloop"));
|
||||
}
|
||||
break;
|
||||
case MT_NIGHTSDRILLREFILL:
|
||||
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
|
||||
return;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
player->drillmeter = special->info->speed;
|
||||
else
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].pflags & PF_NIGHTSMODE)
|
||||
players[i].drillmeter = special->info->speed;
|
||||
if (special->info->deathsound != sfx_None)
|
||||
S_StartSound(NULL, special->info->deathsound);
|
||||
}
|
||||
|
||||
// CECHO showing you what this item is
|
||||
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
|
||||
{
|
||||
HU_SetCEchoFlags(V_AUTOFADEOUT);
|
||||
HU_SetCEchoDuration(4);
|
||||
HU_DoCEcho(M_GetText("\\\\\\\\\\\\\\\\Drill Refill"));
|
||||
}
|
||||
break;
|
||||
case MT_NIGHTSHELPER:
|
||||
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
|
||||
return;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
{
|
||||
// A flicky orbits us now
|
||||
mobj_t *flickyobj = P_SpawnMobj(toucher->x, toucher->y, toucher->z + toucher->info->height, MT_NIGHTOPIANHELPER);
|
||||
P_SetTarget(&flickyobj->target, toucher);
|
||||
|
||||
player->powers[pw_nights_helper] = (UINT16)special->info->speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj_t *flickyobj;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].mo && players[i].pflags & PF_NIGHTSMODE) {
|
||||
players[i].powers[pw_nights_helper] = (UINT16)special->info->speed;
|
||||
flickyobj = P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_NIGHTOPIANHELPER);
|
||||
P_SetTarget(&flickyobj->target, players[i].mo);
|
||||
}
|
||||
if (special->info->deathsound != sfx_None)
|
||||
S_StartSound(NULL, special->info->deathsound);
|
||||
}
|
||||
|
||||
// CECHO showing you what this item is
|
||||
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
|
||||
{
|
||||
HU_SetCEchoFlags(V_AUTOFADEOUT);
|
||||
HU_SetCEchoDuration(4);
|
||||
HU_DoCEcho(M_GetText("\\\\\\\\\\\\\\\\Nightopian Helper"));
|
||||
}
|
||||
break;
|
||||
case MT_NIGHTSEXTRATIME:
|
||||
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
|
||||
return;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
{
|
||||
player->nightstime += special->info->speed;
|
||||
player->startedtime += special->info->speed;
|
||||
P_RestoreMusic(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
players[i].nightstime += special->info->speed;
|
||||
players[i].startedtime += special->info->speed;
|
||||
P_RestoreMusic(&players[i]);
|
||||
}
|
||||
if (special->info->deathsound != sfx_None)
|
||||
S_StartSound(NULL, special->info->deathsound);
|
||||
}
|
||||
|
||||
// CECHO showing you what this item is
|
||||
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
|
||||
{
|
||||
HU_SetCEchoFlags(V_AUTOFADEOUT);
|
||||
HU_SetCEchoDuration(4);
|
||||
HU_DoCEcho(M_GetText("\\\\\\\\\\\\\\\\Extra Time"));
|
||||
}
|
||||
break;
|
||||
case MT_NIGHTSLINKFREEZE:
|
||||
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
|
||||
return;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
{
|
||||
player->powers[pw_nights_linkfreeze] = (UINT16)special->info->speed;
|
||||
player->linktimer = 2*TICRATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
players[i].powers[pw_nights_linkfreeze] += (UINT16)special->info->speed;
|
||||
players[i].linktimer = 2*TICRATE;
|
||||
}
|
||||
if (special->info->deathsound != sfx_None)
|
||||
S_StartSound(NULL, special->info->deathsound);
|
||||
}
|
||||
|
||||
// CECHO showing you what this item is
|
||||
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
|
||||
{
|
||||
HU_SetCEchoFlags(V_AUTOFADEOUT);
|
||||
HU_SetCEchoDuration(4);
|
||||
HU_DoCEcho(M_GetText("\\\\\\\\\\\\\\\\Link Freeze"));
|
||||
}
|
||||
break;*/
|
||||
case MT_NIGHTSWING:
|
||||
if (G_IsSpecialStage(gamemap) && useNightsSS)
|
||||
{ // Pseudo-ring.
|
||||
@@ -976,9 +1132,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
break;
|
||||
case MT_HOOPCOLLIDE:
|
||||
// This produces a kind of 'domino effect' with the hoop's pieces.
|
||||
if (!midgamejoin)
|
||||
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
|
||||
|
||||
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
|
||||
i = 0;
|
||||
for (; special->type == MT_HOOP; special = special->hnext)
|
||||
{
|
||||
@@ -1310,7 +1464,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
}
|
||||
else
|
||||
{
|
||||
P_PlayRinglossSound(toucher, NULL);
|
||||
P_PlayRinglossSound(toucher);
|
||||
if (toucher->health > 10)
|
||||
toucher->health -= 10;
|
||||
else
|
||||
@@ -1356,6 +1510,23 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|| special->z > toucher->z + (toucher->height*2/3))
|
||||
return; // Only go in the mouth
|
||||
|
||||
/* // SRB2kart - Can't drown.
|
||||
// Eaten by player!
|
||||
if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
P_RestoreMusic(player);
|
||||
|
||||
if (player->powers[pw_underwater] < underwatertics + 1)
|
||||
player->powers[pw_underwater] = underwatertics + 1;
|
||||
*/
|
||||
|
||||
/*
|
||||
if (!player->climbing)
|
||||
{
|
||||
P_SetPlayerMobjState(toucher, S_PLAY_GASP);
|
||||
P_ResetPlayer(player);
|
||||
}
|
||||
*/
|
||||
|
||||
toucher->momx = toucher->momy = toucher->momz = 0;
|
||||
break;
|
||||
|
||||
@@ -1412,7 +1583,26 @@ void P_CheckTimeLimit(void)
|
||||
if (gameaction == ga_completed)
|
||||
return;
|
||||
|
||||
if (cv_overtime.value)
|
||||
//Tagmode round end but only on the tic before the
|
||||
//XD_EXITLEVEL packet is received by all players.
|
||||
/*if (G_TagGametype())
|
||||
{
|
||||
if (leveltime == (timelimitintics + 1))
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator
|
||||
|| (players[i].pflags & PF_TAGGED) || (players[i].pflags & PF_TAGIT))
|
||||
continue;
|
||||
|
||||
CONS_Printf(M_GetText("%s received double points for surviving the round.\n"), player_names[i]);
|
||||
P_AddPlayerScore(&players[i], players[i].score);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Optional tie-breaker for Match/CTF
|
||||
else*/ if (cv_overtime.value)
|
||||
{
|
||||
INT32 playerarray[MAXPLAYERS];
|
||||
INT32 tempplayer = 0;
|
||||
@@ -1485,6 +1675,9 @@ void P_CheckTimeLimit(void)
|
||||
return;
|
||||
P_DoPlayerExit(&players[i]);
|
||||
}
|
||||
|
||||
/*if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);*/
|
||||
}
|
||||
|
||||
/** Checks if a player's score is over the pointlimit and the round should end.
|
||||
@@ -1506,27 +1699,127 @@ void P_CheckPointLimit(void)
|
||||
if (G_RaceGametype())
|
||||
return;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
// pointlimit is nonzero, check if it's been reached by this player
|
||||
/*if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
if ((UINT32)cv_pointlimit.value <= players[i].marescore)
|
||||
// Just check both teams
|
||||
if ((UINT32)cv_pointlimit.value <= redscore || (UINT32)cv_pointlimit.value <= bluescore)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++) // AAAAA nested loop using the same iteration variable ;;
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
if (players[i].exiting)
|
||||
return;
|
||||
P_DoPlayerExit(&players[i]);
|
||||
}
|
||||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
}
|
||||
else*/
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
return; // good thing we're leaving the function immediately instead of letting the loop get mangled!
|
||||
if ((UINT32)cv_pointlimit.value <= players[i].marescore)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++) // AAAAA nested loop using the same iteration variable ;;
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
if (players[i].exiting)
|
||||
return;
|
||||
P_DoPlayerExit(&players[i]);
|
||||
}
|
||||
|
||||
/*if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);*/
|
||||
return; // good thing we're leaving the function immediately instead of letting the loop get mangled!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Checks for untagged remaining players in both tag derivitave modes.
|
||||
*If no untagged players remain, end the round.
|
||||
*Also serves as error checking if the only IT player leaves.*/
|
||||
/*void P_CheckSurvivors(void)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 survivors = 0;
|
||||
INT32 taggers = 0;
|
||||
INT32 spectators = 0;
|
||||
INT32 survivorarray[MAXPLAYERS];
|
||||
|
||||
if (!D_NumPlayers()) //no players in the game, no check performed.
|
||||
return;
|
||||
|
||||
for (i=0; i < MAXPLAYERS; i++) //figure out counts of taggers, survivors and spectators.
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
if (players[i].spectator)
|
||||
spectators++;
|
||||
else if (players[i].pflags & PF_TAGIT)
|
||||
taggers++;
|
||||
else if (!(players[i].pflags & PF_TAGGED))
|
||||
{
|
||||
survivorarray[survivors] = i;
|
||||
survivors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!taggers) //If there are no taggers, pick a survivor at random to be it.
|
||||
{
|
||||
// Exception for hide and seek. If a round has started and the IT player leaves, end the round.
|
||||
if (gametype == GT_HIDEANDSEEK && (leveltime >= (hidetime * TICRATE)))
|
||||
{
|
||||
CONS_Printf(M_GetText("The IT player has left the game.\n"));
|
||||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (survivors)
|
||||
{
|
||||
INT32 newtagger = survivorarray[P_RandomKey(survivors)];
|
||||
|
||||
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[newtagger]); // Tell everyone who is it!
|
||||
players[newtagger].pflags |= PF_TAGIT;
|
||||
|
||||
survivors--; //Get rid of the guy we just made IT.
|
||||
|
||||
//Yeah, we have an eligible tagger, but we may not have anybody for him to tag!
|
||||
//If there is only one guy waiting on the game to fill or spectators to enter game, don't bother.
|
||||
if (!survivors && (D_NumPlayers() - spectators) > 1)
|
||||
{
|
||||
CONS_Printf(M_GetText("All players have been tagged!\n"));
|
||||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//If we reach this point, no player can replace the one that was IT.
|
||||
//Unless it is one player waiting on a game, end the round.
|
||||
if ((D_NumPlayers() - spectators) > 1)
|
||||
{
|
||||
CONS_Printf(M_GetText("There are no players able to become IT.\n"));
|
||||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//If there are taggers, but no survivors, end the round.
|
||||
//Except when the tagger is by himself and the rest of the game are spectators.
|
||||
if (!survivors && (D_NumPlayers() - spectators) > 1)
|
||||
{
|
||||
CONS_Printf(M_GetText("All players have been tagged!\n"));
|
||||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Checks whether or not to end a race netgame.
|
||||
boolean P_CheckRacers(void)
|
||||
{
|
||||
@@ -1615,6 +1908,9 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
mobj_t *mo;
|
||||
int ms;
|
||||
|
||||
//if (inflictor && (inflictor->type == MT_SHELL || inflictor->type == MT_FIREBALL))
|
||||
// P_SetTarget(&target->tracer, inflictor);
|
||||
|
||||
if (!useNightsSS && G_IsSpecialStage(gamemap) && target->player && sstimer > 6)
|
||||
sstimer = 6; // Just let P_Ticker take care of the rest.
|
||||
|
||||
@@ -1640,6 +1936,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SPECIAL);
|
||||
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
|
||||
target->health = 0; // This makes it easy to check if something's dead elsewhere.
|
||||
target->shadowscale = 0;
|
||||
|
||||
if (LUAh_MobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
|
||||
return;
|
||||
@@ -1663,7 +1960,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
K_KillBananaChain(target->target->hnext, inflictor, source);
|
||||
target->target->player->kartstuff[k_itemamount] = 0;
|
||||
}
|
||||
else if (target->target->player->kartstuff[k_itemamount])
|
||||
else
|
||||
target->target->player->kartstuff[k_itemamount]--;
|
||||
}
|
||||
else if ((target->type == MT_ORBINAUT_SHIELD && target->target->player->kartstuff[k_itemtype] == KITEM_ORBINAUT) // orbit items
|
||||
@@ -1695,6 +1992,14 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (metalrecording) // Ack! Metal Sonic shouldn't die! Cut the tape, end recording!
|
||||
G_StopMetalRecording();
|
||||
/*if (gametype == GT_MATCH && cv_match_scoring.value == 0 // note, no team match suicide penalty
|
||||
&& ((target == source) || (source == NULL && inflictor == NULL) || (source && !source->player)))
|
||||
{ // Suicide penalty - Not in Kart
|
||||
if (target->player->score >= 50)
|
||||
target->player->score -= 50;
|
||||
else
|
||||
target->player->score = 0;
|
||||
}*/
|
||||
|
||||
target->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
@@ -1711,6 +2016,85 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
target->fuse = cv_itemrespawntime.value*TICRATE + 2; // Random box generation
|
||||
}
|
||||
}
|
||||
|
||||
// Award Score Tails
|
||||
/*{ // Enemies shouldn't award points in Kart
|
||||
INT32 score = 0;
|
||||
|
||||
if (maptol & TOL_NIGHTS) // Enemies always worth 200, bosses don't do anything.
|
||||
{
|
||||
if ((target->flags & MF_ENEMY) && !(target->flags & (MF_MISSILE|MF_BOSS)))
|
||||
{
|
||||
score = 200;
|
||||
|
||||
if (source->player->bonustime)
|
||||
score *= 2;
|
||||
|
||||
// Also, add to the link.
|
||||
// I don't know if NiGHTS did this, but
|
||||
// Sonic Time Attacked did and it seems like a good enough incentive
|
||||
// to make people want to actually dash towards/paraloop enemies
|
||||
if (++source->player->linkcount > source->player->maxlink)
|
||||
source->player->maxlink = source->player->linkcount;
|
||||
source->player->linktimer = 2*TICRATE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->flags & MF_BOSS)
|
||||
score = 1000;
|
||||
else if ((target->flags & MF_ENEMY) && !(target->flags & MF_MISSILE))
|
||||
{
|
||||
mobj_t *scoremobj;
|
||||
UINT32 scorestate = mobjinfo[MT_SCORE].spawnstate;
|
||||
|
||||
scoremobj = P_SpawnMobj(target->x, target->y, target->z + (target->height / 2), MT_SCORE);
|
||||
|
||||
// On ground? No chain starts.
|
||||
if (!source->player->powers[pw_invulnerability] && P_IsObjectOnGround(source))
|
||||
{
|
||||
source->player->scoreadd = 0;
|
||||
score = 100;
|
||||
}
|
||||
// Mario Mode has Mario-like chain point values
|
||||
else if (mariomode) switch (++source->player->scoreadd)
|
||||
{
|
||||
case 1: score = 100; break;
|
||||
case 2: score = 200; scorestate += 1; break;
|
||||
case 3: score = 400; scorestate += 5; break;
|
||||
case 4: score = 800; scorestate += 6; break;
|
||||
case 5: score = 1000; scorestate += 3; break;
|
||||
case 6: score = 2000; scorestate += 7; break;
|
||||
case 7: score = 4000; scorestate += 8; break;
|
||||
case 8: score = 8000; scorestate += 9; break;
|
||||
default: // 1up for a chain this long
|
||||
if (modeattacking) // but 1ups don't exist in record attack!
|
||||
{ // So we just go back to 10k points.
|
||||
score = 10000; scorestate += 4; break;
|
||||
}
|
||||
P_GivePlayerLives(source->player, 1);
|
||||
P_PlayLivesJingle(source->player);
|
||||
scorestate += 10;
|
||||
break;
|
||||
}
|
||||
// More Sonic-like point system
|
||||
else switch (++source->player->scoreadd)
|
||||
{
|
||||
case 1: score = 100; break;
|
||||
case 2: score = 200; scorestate += 1; break;
|
||||
case 3: score = 500; scorestate += 2; break;
|
||||
case 4: case 5: case 6: case 7: case 8: case 9:
|
||||
case 10: case 11: case 12: case 13: case 14:
|
||||
score = 1000; scorestate += 3; break;
|
||||
default: score = 10000; scorestate += 4; break;
|
||||
}
|
||||
|
||||
P_SetMobjState(scoremobj, scorestate);
|
||||
}
|
||||
}
|
||||
|
||||
P_AddPlayerScore(source->player, score);
|
||||
}*/
|
||||
}
|
||||
|
||||
// if a player avatar dies...
|
||||
@@ -1737,7 +2121,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
}
|
||||
target->player->playerstate = PST_DEAD;
|
||||
|
||||
if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player))
|
||||
if (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(target->player))
|
||||
{
|
||||
if (netgame || multiplayer)
|
||||
ms = cv_respawntime.value * 1000;
|
||||
@@ -1748,7 +2132,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
If the time spent with the music paused is less than half
|
||||
a second, continue playing the song (just mute it).
|
||||
*/
|
||||
if ((ms - cv_respawnfademusicout.value) < 500)
|
||||
if (( ms - cv_respawnfademusicout.value ) < 500)
|
||||
S_FadeMusic(0, cv_respawnfademusicout.value);
|
||||
else
|
||||
S_FadeOutStopMusic(cv_respawnfademusicout.value);
|
||||
@@ -1774,7 +2158,42 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
if (target->player == &players[displayplayers[3]])
|
||||
localaiming[3] = 0;
|
||||
|
||||
if (G_BattleGametype())
|
||||
//tag deaths handled differently in suicide cases. Don't count spectators!
|
||||
/*if (G_TagGametype()
|
||||
&& !(target->player->pflags & PF_TAGIT) && (!source || !source->player) && !(target->player->spectator))
|
||||
{
|
||||
// if you accidentally die before you run out of time to hide, ignore it.
|
||||
// allow them to try again, rather than sitting the whole thing out.
|
||||
if (leveltime >= hidetime * TICRATE)
|
||||
{
|
||||
if (gametype == GT_TAG)//suiciding in survivor makes you IT.
|
||||
{
|
||||
target->player->pflags |= PF_TAGIT;
|
||||
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[target->player-players]); // Tell everyone who is it!
|
||||
P_CheckSurvivors();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(target->player->pflags & PF_TAGGED))
|
||||
{
|
||||
//otherwise, increment the tagger's score.
|
||||
//in hide and seek, suiciding players are counted as found.
|
||||
INT32 w;
|
||||
|
||||
for (w=0; w < MAXPLAYERS; w++)
|
||||
{
|
||||
if (players[w].pflags & PF_TAGIT)
|
||||
P_AddPlayerScore(&players[w], 1);
|
||||
}
|
||||
|
||||
target->player->pflags |= PF_TAGGED;
|
||||
CONS_Printf(M_GetText("%s was found!\n"), player_names[target->player-players]);
|
||||
P_CheckSurvivors();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else*/ if (G_BattleGametype())
|
||||
K_CheckBumpers();
|
||||
|
||||
target->player->kartstuff[k_pogospring] = 0;
|
||||
@@ -2189,6 +2608,26 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
||||
return false;
|
||||
}
|
||||
|
||||
// The tag occurs so long as you aren't shooting another tagger with friendlyfire on.
|
||||
/*if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT))
|
||||
{
|
||||
P_AddPlayerScore(source->player, 1); //award points to tagger.
|
||||
|
||||
if (gametype == GT_TAG) //survivor
|
||||
{
|
||||
player->pflags |= PF_TAGIT; //in survivor, the player becomes IT and helps hunt down the survivors.
|
||||
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[player-players]); // Tell everyone who is it!
|
||||
}
|
||||
else
|
||||
{
|
||||
player->pflags |= PF_TAGGED; //in hide and seek, the player is tagged and stays stationary.
|
||||
CONS_Printf(M_GetText("%s was found!\n"), player_names[player-players]); // Tell everyone who is it!
|
||||
}
|
||||
|
||||
//checks if tagger has tagged all players, if so, end round early.
|
||||
P_CheckSurvivors();
|
||||
}*/
|
||||
|
||||
P_DoPlayerPain(player, source, inflictor);
|
||||
|
||||
// Check for a shield
|
||||
@@ -2206,7 +2645,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
||||
}
|
||||
else if (target->health > 1) // Ring loss
|
||||
{
|
||||
P_PlayRinglossSound(target, source);
|
||||
P_PlayRinglossSound(target);
|
||||
P_PlayerRingBurst(player, player->mo->health - 1);
|
||||
}
|
||||
|
||||
@@ -2227,6 +2666,15 @@ static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj
|
||||
{
|
||||
player_t *player = target->player;
|
||||
|
||||
// You can't kill yourself, idiot... // Unless it's Mario kart. Which it is. In this mod. All the time.
|
||||
//if (source == target)
|
||||
// return false;
|
||||
|
||||
// In COOP/RACE/CHAOS, you can't hurt other players unless cv_friendlyfire is on
|
||||
// ...But in SRB2kart, you can!
|
||||
//if (!cv_friendlyfire.value && (G_RaceGametype()))
|
||||
// return false;
|
||||
|
||||
// Tag handling
|
||||
if (G_TagGametype())
|
||||
return P_TagDamage(target, inflictor, source, damage);
|
||||
@@ -2278,6 +2726,32 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
||||
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
|
||||
|
||||
/*if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
{
|
||||
// Award no points when players shoot each other when cv_friendlyfire is on.
|
||||
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
|
||||
P_AddPlayerScore(source->player, 1);
|
||||
}
|
||||
}
|
||||
if (source && source->player && !player->powers[pw_super]) //don't score points against super players
|
||||
{
|
||||
// Award no points when players shoot each other when cv_friendlyfire is on.
|
||||
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
|
||||
P_AddPlayerScore(source->player, 1);
|
||||
}
|
||||
|
||||
// If the player was super, tell them he/she ain't so super nomore.
|
||||
if (gametype != GT_COOP && player->powers[pw_super])
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3k66); //let all players hear it.
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players]));
|
||||
}*/
|
||||
|
||||
if (player->pflags & PF_TIMEOVER)
|
||||
{
|
||||
mobj_t *boom;
|
||||
@@ -2338,8 +2812,44 @@ void P_RemoveShield(player_t *player)
|
||||
player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK;
|
||||
}
|
||||
|
||||
/*
|
||||
static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) // SRB2kart - unused.
|
||||
{
|
||||
// Must do pain first to set flashing -- P_RemoveShield can cause damage
|
||||
P_DoPlayerPain(player, source, inflictor);
|
||||
|
||||
P_RemoveShield(player);
|
||||
|
||||
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
|
||||
|
||||
if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes
|
||||
S_StartSound(player->mo, sfx_spkdth);
|
||||
else
|
||||
S_StartSound (player->mo, sfx_shldls); // Ba-Dum! Shield loss.
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
{
|
||||
// Award no points when players shoot each other when cv_friendlyfire is on.
|
||||
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
|
||||
P_AddPlayerScore(source->player, 25);
|
||||
}
|
||||
}
|
||||
if (source && source->player && !player->powers[pw_super]) //don't score points against super players
|
||||
{
|
||||
// Award no points when players shoot each other when cv_friendlyfire is on.
|
||||
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
|
||||
P_AddPlayerScore(source->player, cv_match_scoring.value == 1 ? 25 : 50);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
{
|
||||
//const UINT8 scoremultiply = ((K_IsWantedPlayer(player) && !trapitem) : 2 ? 1);
|
||||
|
||||
if (!(inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds])))
|
||||
{
|
||||
P_DoPlayerPain(player, source, inflictor);
|
||||
@@ -2350,8 +2860,26 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
|
||||
S_StartSound(player->mo, sfx_spkdth);
|
||||
}
|
||||
|
||||
/*if (source && source->player && !player->powers[pw_super]) //don't score points against super players
|
||||
{
|
||||
// Award no points when players shoot each other when cv_friendlyfire is on.
|
||||
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
|
||||
P_AddPlayerScore(source->player, scoremultiply);
|
||||
}
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
{
|
||||
// Award no points when players shoot each other when cv_friendlyfire is on.
|
||||
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
|
||||
P_AddPlayerScore(source->player, scoremultiply);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Ring loss sound plays despite hitting spikes
|
||||
P_PlayRinglossSound(player->mo, source); // Ringledingle!
|
||||
P_PlayRinglossSound(player->mo); // Ringledingle!
|
||||
}
|
||||
|
||||
/** Damages an object, which may or may not be a player.
|
||||
@@ -2564,7 +3092,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_PlayerRingBurst(player, 5);
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
P_StartQuake(5, 32<<FRACBITS, 0);
|
||||
quake.intensity = 32*FRACUNIT;
|
||||
quake.time = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3148,30 +3677,32 @@ void P_PlayerFlagBurst(player_t *player, boolean toss)
|
||||
P_SetTarget(&flag->target, player->mo);
|
||||
|
||||
// Flag text
|
||||
char plname[MAXPLAYERNAME+4];
|
||||
const char *flagtext;
|
||||
char flagcolor;
|
||||
|
||||
snprintf(plname, sizeof(plname), "%s%s%s",
|
||||
CTFTEAMCODE(player),
|
||||
player_names[player - players],
|
||||
CTFTEAMENDCODE(player));
|
||||
|
||||
if (type == MT_REDFLAG)
|
||||
{
|
||||
flagtext = M_GetText("Red flag");
|
||||
flagcolor = '\x85';
|
||||
}
|
||||
else
|
||||
{
|
||||
flagtext = M_GetText("Blue flag");
|
||||
flagcolor = '\x84';
|
||||
}
|
||||
char plname[MAXPLAYERNAME+4];
|
||||
const char *flagtext;
|
||||
char flagcolor;
|
||||
|
||||
if (toss)
|
||||
CONS_Printf(M_GetText("%s tossed the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
else
|
||||
CONS_Printf(M_GetText("%s dropped the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
snprintf(plname, sizeof(plname), "%s%s%s",
|
||||
CTFTEAMCODE(player),
|
||||
player_names[player - players],
|
||||
CTFTEAMENDCODE(player));
|
||||
|
||||
if (type == MT_REDFLAG)
|
||||
{
|
||||
flagtext = M_GetText("Red flag");
|
||||
flagcolor = '\x85';
|
||||
}
|
||||
else
|
||||
{
|
||||
flagtext = M_GetText("Blue flag");
|
||||
flagcolor = '\x84';
|
||||
}
|
||||
|
||||
if (toss)
|
||||
CONS_Printf(M_GetText("%s tossed the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
else
|
||||
CONS_Printf(M_GetText("%s dropped the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
}
|
||||
|
||||
player->gotflag = 0;
|
||||
|
||||
|
||||
+7
-29
@@ -70,7 +70,6 @@ extern thinker_t thinkercap;
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
void P_RemoveThinker(thinker_t *thinker);
|
||||
void P_UnlinkThinker(thinker_t *thinker);
|
||||
|
||||
//
|
||||
// P_USER
|
||||
@@ -144,8 +143,6 @@ extern consvar_t cv_tiltsmoothing;
|
||||
|
||||
extern consvar_t cv_actionmovie;
|
||||
|
||||
extern consvar_t cv_lookbackmom;
|
||||
|
||||
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
||||
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
||||
extern fixed_t t_cam3_dist, t_cam3_height, t_cam3_rotate;
|
||||
@@ -164,9 +161,8 @@ void P_InitCameraCmd(void);
|
||||
boolean P_PlayerInPain(player_t *player);
|
||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void P_ResetPlayer(player_t *player);
|
||||
boolean P_IsLocalPlayer(const player_t *player);
|
||||
boolean P_IsDisplayPlayer(const player_t *player);
|
||||
|
||||
boolean P_IsLocalPlayer(player_t *player);
|
||||
boolean P_IsDisplayPlayer(player_t *player);
|
||||
boolean P_SpectatorJoinGame(player_t *player);
|
||||
|
||||
boolean P_IsObjectInGoop(mobj_t *mo);
|
||||
@@ -219,7 +215,7 @@ boolean P_PlayerMoving(INT32 pnum);
|
||||
void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range);
|
||||
|
||||
void P_PlayLivesJingle(player_t *player);
|
||||
void P_PlayRinglossSound(mobj_t *source, mobj_t *damager);
|
||||
void P_PlayRinglossSound(mobj_t *source);
|
||||
void P_PlayDeathSound(mobj_t *source);
|
||||
void P_PlayVictorySound(mobj_t *source);
|
||||
|
||||
@@ -243,30 +239,24 @@ void P_RespawnSpecials(void);
|
||||
|
||||
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
|
||||
|
||||
mobj_t *P_SpawnShadowMobj(mobj_t * caster);
|
||||
//mobj_t *P_SpawnShadowMobj(mobj_t * caster);
|
||||
|
||||
void P_RecalcPrecipInSector(sector_t *sector);
|
||||
void P_PrecipitationEffects(void);
|
||||
|
||||
void P_RemoveMobj(mobj_t *th);
|
||||
|
||||
boolean P_MobjWasRemoved(mobj_t *th);
|
||||
void P_RemoveSavegameMobj(mobj_t *th);
|
||||
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
|
||||
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
|
||||
//void P_RunShields(void);
|
||||
void P_RunOverlays(void);
|
||||
void P_RunShadows(void);
|
||||
//void P_RunShadows(void);
|
||||
void P_MobjThinker(mobj_t *mobj);
|
||||
boolean P_RailThinker(mobj_t *mobj);
|
||||
void P_PushableThinker(mobj_t *mobj);
|
||||
void P_SceneryThinker(mobj_t *mobj);
|
||||
|
||||
// This does not need to be added to Lua.
|
||||
// To test it in Lua, check mobj.valid
|
||||
FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(const mobj_t *mobj)
|
||||
{
|
||||
return !(mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
@@ -298,7 +288,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
|
||||
#define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
|
||||
#endif
|
||||
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
|
||||
SINT8 P_MobjFlip(const mobj_t *mobj);
|
||||
SINT8 P_MobjFlip(mobj_t *mobj);
|
||||
fixed_t P_GetMobjGravity(mobj_t *mo);
|
||||
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
|
||||
|
||||
@@ -399,18 +389,6 @@ extern fixed_t bmaporgy; // origin of block map
|
||||
extern mobj_t **blocklinks; // for thing chains
|
||||
extern precipmobj_t **precipblocklinks; // special blockmap for precip rendering
|
||||
|
||||
extern struct minimapinfo
|
||||
{
|
||||
patch_t *minimap_pic;
|
||||
UINT8 mapthingcount;
|
||||
INT32 min_x, min_y;
|
||||
INT32 max_x, max_y;
|
||||
INT32 map_w, map_h;
|
||||
INT32 minimap_w, minimap_h;
|
||||
fixed_t offs_x, offs_y;
|
||||
fixed_t zoom;
|
||||
} minimapinfo;
|
||||
|
||||
//
|
||||
// P_INTER
|
||||
//
|
||||
|
||||
+86
-6
@@ -319,6 +319,78 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void P_DoTailsCarry(player_t *sonic, player_t *tails)
|
||||
{
|
||||
INT32 p;
|
||||
fixed_t zdist; // z distance between the two players' bottoms
|
||||
|
||||
if ((tails->pflags & PF_CARRIED) && tails->mo->tracer == sonic->mo)
|
||||
return;
|
||||
if ((sonic->pflags & PF_CARRIED) && sonic->mo->tracer == tails->mo)
|
||||
return;
|
||||
if (tails->bot == 1)
|
||||
return;
|
||||
|
||||
if (sonic->pflags & PF_NIGHTSMODE)
|
||||
return;
|
||||
|
||||
if (sonic->mo->tracer && sonic->mo->tracer->type == MT_TUBEWAYPOINT
|
||||
&& !(sonic->pflags & PF_ROPEHANG))
|
||||
return; // don't steal players from zoomtubes!
|
||||
|
||||
if ((sonic->mo->eflags & MFE_VERTICALFLIP) != (tails->mo->eflags & MFE_VERTICALFLIP))
|
||||
return; // Both should be in same gravity
|
||||
|
||||
if (tails->mo->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (tails->mo->ceilingz - (tails->mo->z + tails->mo->height) < sonic->mo->height-FixedMul(2*FRACUNIT, sonic->mo->scale))
|
||||
return;
|
||||
}
|
||||
else if (tails->mo->z - tails->mo->floorz < sonic->mo->height-FixedMul(2*FRACUNIT, sonic->mo->scale))
|
||||
return; // No room to pick up this guy!
|
||||
|
||||
// Search in case another player is already being carried by this fox.
|
||||
for (p = 0; p < MAXPLAYERS; p++)
|
||||
if (playeringame[p] && players[p].mo
|
||||
&& players[p].pflags & PF_CARRIED && players[p].mo->tracer == tails->mo)
|
||||
return;
|
||||
|
||||
if (tails->mo->eflags & MFE_VERTICALFLIP)
|
||||
zdist = (sonic->mo->z + sonic->mo->height) - (tails->mo->z + tails->mo->height);
|
||||
else
|
||||
zdist = tails->mo->z - sonic->mo->z;
|
||||
|
||||
if (zdist <= sonic->mo->height + FixedMul(FRACUNIT, sonic->mo->scale)
|
||||
&& zdist > sonic->mo->height*2/3
|
||||
&& P_MobjFlip(tails->mo)*sonic->mo->momz <= 0)
|
||||
{
|
||||
// Why block opposing teams from tailsflying each other?
|
||||
// Sneaking into the hands of a flying tails player in Race might be a viable strategy, who knows.
|
||||
if (tails->spectator || sonic->spectator || G_RaceGametype()) // SRB2kart
|
||||
sonic->pflags &= ~PF_CARRIED;
|
||||
else
|
||||
{
|
||||
if (sonic-players == consoleplayer && botingame)
|
||||
//CV_SetValue(&cv_analog2, false);
|
||||
P_ResetPlayer(sonic);
|
||||
P_SetTarget(&sonic->mo->tracer, tails->mo);
|
||||
sonic->pflags |= PF_CARRIED;
|
||||
S_StartSound(sonic->mo, sfx_s3k4a);
|
||||
P_UnsetThingPosition(sonic->mo);
|
||||
sonic->mo->x = tails->mo->x;
|
||||
sonic->mo->y = tails->mo->y;
|
||||
P_SetThingPosition(sonic->mo);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (sonic-players == consoleplayer && botingame)
|
||||
//CV_SetValue(&cv_analog2, true);
|
||||
sonic->pflags &= ~PF_CARRIED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// PIT_CheckThing
|
||||
//
|
||||
@@ -516,6 +588,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
// check for skulls slamming into things
|
||||
if (tmthing->flags2 & MF2_SKULLFLY)
|
||||
{
|
||||
/*if (tmthing->type == MT_EGGMOBILE) // Don't make Eggman stop!
|
||||
return true; // Let him RUN YOU RIGHT OVER. >:3
|
||||
else*/
|
||||
{
|
||||
// see if it went over / under
|
||||
if (tmthing->z > thing->z + thing->height)
|
||||
@@ -1601,7 +1676,7 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||
if (P_BoxOnLineSide(tmbbox, ld) != -1)
|
||||
return true;
|
||||
|
||||
if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag.
|
||||
if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag.
|
||||
{
|
||||
fixed_t cosradius, sinradius;
|
||||
cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT));
|
||||
@@ -2170,9 +2245,6 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
|
||||
floatok = false;
|
||||
|
||||
if (dedicated) // this crashes so don't even try it
|
||||
return false;
|
||||
|
||||
if (twodlevel)
|
||||
itsatwodlevel = true;
|
||||
else
|
||||
@@ -2402,6 +2474,14 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12)
|
||||
maxstep = 0;
|
||||
|
||||
// Don't 'step up' while springing,
|
||||
// Only step up "if needed".
|
||||
/* // SRB2kart - don't need
|
||||
if (thing->state == &states[S_PLAY_SPRING]
|
||||
&& P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale))
|
||||
maxstep = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
if (thing->type == MT_SKIM)
|
||||
@@ -4063,7 +4143,7 @@ static inline boolean PIT_GetSectors(line_t *ld)
|
||||
tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] ||
|
||||
tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] ||
|
||||
tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
return true;
|
||||
return true;
|
||||
|
||||
if (P_BoxOnLineSide(tmbbox, ld) != -1)
|
||||
return true;
|
||||
@@ -4098,7 +4178,7 @@ static inline boolean PIT_GetPrecipSectors(line_t *ld)
|
||||
preciptmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] ||
|
||||
preciptmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] ||
|
||||
preciptmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
return true;
|
||||
return true;
|
||||
|
||||
if (P_BoxOnLineSide(preciptmbbox, ld) != -1)
|
||||
return true;
|
||||
|
||||
+619
-619
File diff suppressed because it is too large.
Load diff
+25
-17
@@ -254,12 +254,18 @@ typedef enum
|
||||
// PRECIPITATION flags ?! ?! ?!
|
||||
//
|
||||
typedef enum {
|
||||
PCF_INVISIBLE = 1, // Don't draw.
|
||||
PCF_PIT = 1<<1, // Above pit.
|
||||
PCF_FOF = 1<<2, // Above FOF.
|
||||
PCF_MOVINGFOF = 1<<3, // Above MOVING FOF (this means we need to keep floorz up to date...)
|
||||
PCF_SPLASH = 1<<4, // Splashed on the ground, return to the ceiling after the animation's over
|
||||
PCF_THUNK = 1<<5, // Ran the thinker this tic.
|
||||
// Don't draw.
|
||||
PCF_INVISIBLE = 1,
|
||||
// Above pit.
|
||||
PCF_PIT = 2,
|
||||
// Above FOF.
|
||||
PCF_FOF = 4,
|
||||
// Above MOVING FOF (this means we need to keep floorz up to date...)
|
||||
PCF_MOVINGFOF = 8,
|
||||
// Is rain.
|
||||
PCF_RAIN = 16,
|
||||
// Ran the thinker this tic.
|
||||
PCF_THUNK = 32,
|
||||
} precipflag_t;
|
||||
// Map Object definition.
|
||||
typedef struct mobj_s
|
||||
@@ -269,12 +275,9 @@ typedef struct mobj_s
|
||||
|
||||
// Info for drawing: position.
|
||||
fixed_t x, y, z;
|
||||
fixed_t old_x, old_y, old_z; // position interpolation
|
||||
fixed_t old_x, old_y, old_z, old_floorz; // position interpolation
|
||||
fixed_t old_x2, old_y2, old_z2;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t *info; // &mobjinfo[mobj->type]
|
||||
|
||||
// More list: links in sector (if needed)
|
||||
struct mobj_s *bnext;
|
||||
struct mobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
@@ -342,6 +345,9 @@ typedef struct mobj_s
|
||||
struct mobj_s *hnext;
|
||||
struct mobj_s *hprev;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t *info; // &mobjinfo[mobj->type]
|
||||
|
||||
INT32 health; // for player this is rings + 1
|
||||
|
||||
// Movement direction, movement generation (zig-zagging).
|
||||
@@ -392,6 +398,11 @@ typedef struct mobj_s
|
||||
|
||||
boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation)
|
||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||
|
||||
boolean haveshadow;
|
||||
fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius
|
||||
boolean whiteshadow; // Use white shadow, set to true by default for fullbright objects
|
||||
|
||||
boolean mirrored; // The object's rotations will be mirrored left to right, e.g., see frame AL from the right and AR from the left
|
||||
boolean rollmodel; // OpenGL: Should this model rotate?
|
||||
|
||||
@@ -422,12 +433,9 @@ typedef struct precipmobj_s
|
||||
|
||||
// Info for drawing: position.
|
||||
fixed_t x, y, z;
|
||||
fixed_t old_x, old_y, old_z; // position interpolation
|
||||
fixed_t old_x, old_y, old_z, old_floorz; // position interpolation
|
||||
fixed_t old_x2, old_y2, old_z2;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t *info; // &mobjinfo[mobj->type]
|
||||
|
||||
// More list: links in sector (if needed)
|
||||
struct precipmobj_s *bnext;
|
||||
struct precipmobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
@@ -476,7 +484,6 @@ typedef struct precipmobj_s
|
||||
INT32 tics; // state tic counter
|
||||
state_t *state;
|
||||
INT32 flags; // flags from mobjinfo tables
|
||||
tic_t lastThink;
|
||||
} precipmobj_t;
|
||||
|
||||
typedef struct actioncache_s
|
||||
@@ -516,9 +523,10 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
|
||||
boolean P_BossTargetPlayer(mobj_t *actor, boolean closest);
|
||||
boolean P_SupermanLook4Players(mobj_t *actor);
|
||||
void P_DestroyRobots(void);
|
||||
boolean P_PrecipThinker(precipmobj_t *mobj);
|
||||
void P_SnowThinker(precipmobj_t *mobj);
|
||||
void P_RainThinker(precipmobj_t *mobj);
|
||||
void P_NullPrecipThinker(precipmobj_t *mobj);
|
||||
void P_FreePrecipMobj(precipmobj_t *mobj);
|
||||
void P_RemovePrecipMobj(precipmobj_t *mobj);
|
||||
void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
||||
void P_XYMovement(mobj_t *mo);
|
||||
void P_EmeraldManager(void);
|
||||
|
||||
+230
-86
@@ -28,7 +28,6 @@
|
||||
#include "r_main.h"
|
||||
#include "r_state.h"
|
||||
#include "r_defs.h"
|
||||
#include "qs22j.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -96,8 +95,6 @@ INT32 numPolyObjects;
|
||||
// Polyobject Blockmap -- initialized in P_LoadBlockMap
|
||||
polymaplink_t **polyblocklinks;
|
||||
|
||||
static size_t *KnownPolySides;
|
||||
static size_t KnownPolySidesCount;
|
||||
|
||||
//
|
||||
// Static Data
|
||||
@@ -155,36 +152,6 @@ FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
thinkercap.next = th;
|
||||
}
|
||||
|
||||
static void FreeSideLists(void)
|
||||
{
|
||||
free(KnownPolySides);
|
||||
KnownPolySides = NULL;
|
||||
KnownPolySidesCount = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// InitSideLists [RH]
|
||||
//
|
||||
// Group sides by vertex and collect side that are known to belong to a
|
||||
// polyobject so that they can be initialized fast.
|
||||
//==========================================================================
|
||||
static void InitSideLists(void)
|
||||
{
|
||||
size_t i;
|
||||
FreeSideLists();
|
||||
KnownPolySides = malloc(numsegs * sizeof(KnownPolySides[0]));
|
||||
for (i = 0; i < numsegs; i++)
|
||||
{
|
||||
if (segs[i].linedef &&
|
||||
(segs[i].linedef->special == POLYOBJ_START_LINE ||
|
||||
segs[i].linedef->special == POLYOBJ_EXPLICIT_LINE))
|
||||
{
|
||||
KnownPolySides[KnownPolySidesCount++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_PointInsidePolyobj
|
||||
//
|
||||
@@ -545,12 +512,11 @@ static void Polyobj_findExplicit(polyobj_t *po)
|
||||
size_t numSegItems = 0;
|
||||
size_t numSegItemsAlloc = 0;
|
||||
|
||||
size_t i, ii;
|
||||
size_t i;
|
||||
|
||||
// first loop: save off all segs with polyobject's id number
|
||||
for (ii = 0; ii < KnownPolySidesCount; ii++)
|
||||
for (i = 0; i < numsegs; ++i)
|
||||
{
|
||||
i = KnownPolySides[ii];
|
||||
INT32 polyID, parentID;
|
||||
|
||||
if (segs[i].linedef->special != POLYOBJ_EXPLICIT_LINE)
|
||||
@@ -581,7 +547,7 @@ static void Polyobj_findExplicit(polyobj_t *po)
|
||||
|
||||
// sort the array if necessary
|
||||
if (numSegItems >= 2)
|
||||
qs22j(segitems, numSegItems, sizeof(segitem_t), Polyobj_segCompare);
|
||||
qsort(segitems, numSegItems, sizeof(segitem_t), Polyobj_segCompare);
|
||||
|
||||
// second loop: put the sorted segs into the polyobject
|
||||
for (i = 0; i < numSegItems; ++i)
|
||||
@@ -600,7 +566,7 @@ static void Polyobj_findExplicit(polyobj_t *po)
|
||||
//
|
||||
static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
|
||||
{
|
||||
size_t i, ii;
|
||||
size_t i;
|
||||
polyobj_t *po = &PolyObjects[num];
|
||||
|
||||
// don't spawn a polyobject more than once
|
||||
@@ -624,9 +590,8 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
|
||||
// 1. Search segs for "line start" special with tag matching this
|
||||
// polyobject's id number. If found, iterate through segs which
|
||||
// share common vertices and record them into the polyobject.
|
||||
for (ii = 0; ii < KnownPolySidesCount; ii++)
|
||||
for (i = 0; i < numsegs; ++i)
|
||||
{
|
||||
i = KnownPolySides[ii];
|
||||
seg_t *seg = &segs[i];
|
||||
INT32 polyID, parentID;
|
||||
|
||||
@@ -1450,10 +1415,7 @@ static boolean Polyobj_rotate(polyobj_t *po, angle_t delta, UINT8 turnthings)
|
||||
{
|
||||
// update seg angles (used only by renderer)
|
||||
for (i = 0; i < po->segCount; ++i)
|
||||
{
|
||||
po->segs[i]->angle += delta;
|
||||
P_UpdateSegLightOffset(po->segs[i]);
|
||||
}
|
||||
|
||||
// update polyobject's angle
|
||||
po->angle += delta;
|
||||
@@ -1552,29 +1514,29 @@ void Polyobj_InitLevel(void)
|
||||
// the mobj_t pointers on a queue for use below.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mobj_t *mo = (mobj_t *)th;
|
||||
|
||||
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
|
||||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
++numPolyObjects;
|
||||
mobj_t *mo = (mobj_t *)th;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
|
||||
}
|
||||
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
|
||||
{
|
||||
++numAnchors;
|
||||
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
|
||||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
|
||||
{
|
||||
++numPolyObjects;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
|
||||
}
|
||||
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
|
||||
{
|
||||
++numAnchors;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1588,9 +1550,6 @@ void Polyobj_InitLevel(void)
|
||||
for (i = 0; i < numPolyObjects; ++i)
|
||||
PolyObjects[i].first = PolyObjects[i].next = numPolyObjects;
|
||||
|
||||
// [RH] Make this faster
|
||||
InitSideLists();
|
||||
|
||||
// setup polyobjects
|
||||
for (i = 0; i < numPolyObjects; ++i)
|
||||
{
|
||||
@@ -1599,9 +1558,6 @@ void Polyobj_InitLevel(void)
|
||||
Polyobj_spawnPolyObj(i, qitem->mo, qitem->mo->spawnpoint->angle);
|
||||
}
|
||||
|
||||
// [RH] Don't need the side lists anymore
|
||||
FreeSideLists();
|
||||
|
||||
// move polyobjects to spawn points
|
||||
for (i = 0; i < numAnchors; ++i)
|
||||
{
|
||||
@@ -1615,6 +1571,39 @@ void Polyobj_InitLevel(void)
|
||||
Polyobj_linkToBlockmap(&PolyObjects[i]);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// haleyjd 02/22/06: temporary debug
|
||||
printf("DEBUG: numPolyObjects = %d\n", numPolyObjects);
|
||||
for (i = 0; i < numPolyObjects; ++i)
|
||||
{
|
||||
INT32 j;
|
||||
polyobj_t *po = &PolyObjects[i];
|
||||
|
||||
printf("polyobj %d:\n", i);
|
||||
printf("id = %d, first = %d, next = %d\n", po->id, po->first, po->next);
|
||||
printf("segCount = %d, numSegsAlloc = %d\n", po->segCount, po->numSegsAlloc);
|
||||
for (j = 0; j < po->segCount; ++j)
|
||||
printf("\tseg %d: %p\n", j, po->segs[j]);
|
||||
printf("numVertices = %d, numVerticesAlloc = %d\n", po->numVertices, po->numVerticesAlloc);
|
||||
for (j = 0; j < po->numVertices; ++j)
|
||||
{
|
||||
printf("\tvtx %d: (%d, %d) / orig: (%d, %d)\n",
|
||||
j, po->vertices[j]->x>>FRACBITS, po->vertices[j]->y>>FRACBITS,
|
||||
po->origVerts[j].x>>FRACBITS, po->origVerts[j].y>>FRACBITS);
|
||||
}
|
||||
printf("numLines = %d, numLinesAlloc = %d\n", po->numLines, po->numLinesAlloc);
|
||||
for (j = 0; j < po->numLines; ++j)
|
||||
printf("\tline %d: %p\n", j, po->lines[j]);
|
||||
printf("spawnSpot = (%d, %d)\n", po->spawnSpot.x >> FRACBITS, po->spawnSpot.y >> FRACBITS);
|
||||
printf("centerPt = (%d, %d)\n", po->centerPt.x >> FRACBITS, po->centerPt.y >> FRACBITS);
|
||||
printf("attached = %d, linked = %d, validcount = %d, isBad = %d\n",
|
||||
po->attached, po->linked, po->validcount, po->isBad);
|
||||
printf("blockbox: [%d, %d, %d, %d]\n",
|
||||
po->blockbox[BOXLEFT], po->blockbox[BOXRIGHT], po->blockbox[BOXBOTTOM],
|
||||
po->blockbox[BOXTOP]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// done with mobj queues
|
||||
M_QueueFree(&spawnqueue);
|
||||
M_QueueFree(&anchorqueue);
|
||||
@@ -1800,12 +1789,12 @@ void T_PolyObjMove(polymove_t *th)
|
||||
//
|
||||
void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
{
|
||||
mobj_t *mo2;
|
||||
mobj_t *target = NULL;
|
||||
mobj_t *waypoint = NULL;
|
||||
mobj_t *mo2;
|
||||
thinker_t *wp;
|
||||
fixed_t adjustx, adjusty, adjustz;
|
||||
fixed_t momx, momy, momz, dist;
|
||||
thinker_t *wp;
|
||||
INT32 start;
|
||||
polyobj_t *po = Polyobj_GetForNum(th->polyObjNum);
|
||||
polyobj_t *oldpo = po;
|
||||
@@ -1822,7 +1811,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
#endif
|
||||
|
||||
// check for displacement due to override and reattach when possible
|
||||
if (!po->thinker)
|
||||
if (po->thinker == NULL)
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// Find out target first.
|
||||
@@ -1837,14 +1826,11 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (mo2->health != th->pointnum)
|
||||
continue;
|
||||
|
||||
target = mo2;
|
||||
break;
|
||||
if (mo2->threshold == th->sequence && mo2->health == th->pointnum)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target)
|
||||
@@ -1910,7 +1896,37 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "Looking for next waypoint...\n");
|
||||
|
||||
waypoint = (th->direction == -1) ? P_GetPreviousWaypoint(target, false) : P_GetNextWaypoint(target, false);
|
||||
// Find next waypoint
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!waypoint && th->wrap) // If specified, wrap waypoints
|
||||
{
|
||||
@@ -1920,7 +1936,35 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
th->stophere = true;
|
||||
}
|
||||
|
||||
waypoint = (th->direction == -1) ? P_GetLastWaypoint(th->sequence) : P_GetFirstWaypoint(th->sequence);
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (waypoint == NULL)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!waypoint && th->comeback) // Come back to the start
|
||||
{
|
||||
@@ -1929,7 +1973,36 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
if (!th->continuous)
|
||||
th->comeback = false;
|
||||
|
||||
waypoint = (th->direction == -1) ? P_GetPreviousWaypoint(target, false) : P_GetNextWaypoint(target, false);
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2379,9 +2452,11 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
polyobj_t *po;
|
||||
polyobj_t *oldpo;
|
||||
polywaypoint_t *th;
|
||||
mobj_t *mo2;
|
||||
mobj_t *first = NULL;
|
||||
mobj_t *last = NULL;
|
||||
mobj_t *target = NULL;
|
||||
thinker_t *wp;
|
||||
INT32 start;
|
||||
|
||||
if (!(po = Polyobj_GetForNum(pwdata->polyObjNum)))
|
||||
@@ -2407,7 +2482,10 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
th->polyObjNum = pwdata->polyObjNum;
|
||||
th->speed = pwdata->speed;
|
||||
th->sequence = pwdata->sequence; // Used to specify sequence #
|
||||
th->direction = pwdata->reverse ? -1 : 1;
|
||||
if (pwdata->reverse)
|
||||
th->direction = -1;
|
||||
else
|
||||
th->direction = 1;
|
||||
|
||||
th->comeback = pwdata->comeback;
|
||||
th->continuous = pwdata->continuous;
|
||||
@@ -2415,8 +2493,44 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
th->stophere = false;
|
||||
|
||||
// Find the first waypoint we need to use
|
||||
first = (th->direction == -1) ? P_GetLastWaypoint(th->sequence) : P_GetFirstWaypoint(th->sequence);
|
||||
last = (th->direction == -1) ? P_GetFirstWaypoint(th->sequence) : P_GetLastWaypoint(th->sequence);
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
last = mo2;
|
||||
else
|
||||
{
|
||||
if (first == NULL)
|
||||
first = mo2;
|
||||
else if (mo2->health > first->health)
|
||||
first = mo2;
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
first = mo2;
|
||||
else
|
||||
{
|
||||
if (last == NULL)
|
||||
last = mo2;
|
||||
else if (mo2->health > last->health)
|
||||
last = mo2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!first)
|
||||
{
|
||||
@@ -2450,6 +2564,36 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
|
||||
// Find the actual target movement waypoint
|
||||
target = first;
|
||||
/*for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
if (mo2->health == first->health - 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == first->health + 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (!target)
|
||||
{
|
||||
|
||||
+118
-142
@@ -107,7 +107,7 @@ static inline void P_UnArchivePlayer(void)
|
||||
//
|
||||
// P_NetArchivePlayers
|
||||
//
|
||||
static void P_NetArchivePlayers(boolean resending)
|
||||
static void P_NetArchivePlayers(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
UINT16 flags;
|
||||
@@ -117,9 +117,6 @@ static void P_NetArchivePlayers(boolean resending)
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (resending)
|
||||
WRITESINT8(save_p, (SINT8)adminplayers[i]);
|
||||
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
@@ -127,9 +124,6 @@ static void P_NetArchivePlayers(boolean resending)
|
||||
|
||||
// no longer send ticcmds, player name, skin, or color
|
||||
|
||||
if (resending)
|
||||
WRITESTRINGN(save_p, player_names[i], MAXPLAYERNAME);
|
||||
|
||||
WRITEANGLE(save_p, players[i].aiming);
|
||||
WRITEANGLE(save_p, players[i].awayviewaiming);
|
||||
WRITEINT32(save_p, players[i].awayviewtics);
|
||||
@@ -154,13 +148,6 @@ static void P_NetArchivePlayers(boolean resending)
|
||||
WRITEUINT16(save_p, players[i].flashpal);
|
||||
WRITEUINT16(save_p, players[i].flashcount);
|
||||
|
||||
if (resending)
|
||||
{
|
||||
WRITEUINT8(save_p, players[i].skincolor);
|
||||
WRITEINT32(save_p, players[i].skin);
|
||||
}
|
||||
|
||||
|
||||
WRITEUINT32(save_p, players[i].score);
|
||||
WRITEFIXED(save_p, players[i].dashspeed);
|
||||
WRITEINT32(save_p, players[i].dashtime);
|
||||
@@ -298,7 +285,7 @@ static void P_NetArchivePlayers(boolean resending)
|
||||
//
|
||||
// P_NetUnArchivePlayers
|
||||
//
|
||||
static void P_NetUnArchivePlayers(boolean resending)
|
||||
static void P_NetUnArchivePlayers(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
UINT16 flags;
|
||||
@@ -308,8 +295,6 @@ static void P_NetUnArchivePlayers(boolean resending)
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (resending)
|
||||
adminplayers[i] = (INT32)READSINT8(save_p);
|
||||
// Do NOT memset player struct to 0
|
||||
// other areas may initialize data elsewhere
|
||||
//memset(&players[i], 0, sizeof (player_t));
|
||||
@@ -320,9 +305,6 @@ static void P_NetUnArchivePlayers(boolean resending)
|
||||
// sending player names, skin and color should not be necessary at all!
|
||||
// (that data is handled in the server config now)
|
||||
|
||||
if (resending)
|
||||
READSTRINGN(save_p, player_names[i], MAXPLAYERNAME);
|
||||
|
||||
players[i].aiming = READANGLE(save_p);
|
||||
players[i].awayviewaiming = READANGLE(save_p);
|
||||
players[i].awayviewtics = READINT32(save_p);
|
||||
@@ -347,12 +329,6 @@ static void P_NetUnArchivePlayers(boolean resending)
|
||||
players[i].flashpal = READUINT16(save_p);
|
||||
players[i].flashcount = READUINT16(save_p);
|
||||
|
||||
if (resending)
|
||||
{
|
||||
players[i].skincolor = READUINT8(save_p);
|
||||
players[i].skin = READINT32(save_p);
|
||||
}
|
||||
|
||||
players[i].score = READUINT32(save_p);
|
||||
players[i].dashspeed = READFIXED(save_p); // dashing speed
|
||||
players[i].dashtime = READINT32(save_p); // dashing speed
|
||||
@@ -523,16 +499,35 @@ static void P_NetArchiveWorld(void)
|
||||
UINT8 *put;
|
||||
|
||||
// reload the map just to see difference
|
||||
virtres_t* virt = vres_GetMap(lastloadedmaplumpnum);
|
||||
mapsector_t *ms = (mapsector_t*) vres_Find(virt, "SECTORS")->data;
|
||||
mapsidedef_t *msd = (mapsidedef_t*) vres_Find(virt, "SIDEDEFS")->data;
|
||||
maplinedef_t *mld = (maplinedef_t*) vres_Find(virt, "LINEDEFS")->data;
|
||||
mapsector_t *ms;
|
||||
mapsidedef_t *msd;
|
||||
maplinedef_t *mld;
|
||||
const sector_t *ss = sectors;
|
||||
UINT8 diff, diff2;
|
||||
|
||||
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
|
||||
put = save_p;
|
||||
|
||||
if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
|
||||
{ // HACK: Open wad file rather quickly so we can get the data from the relevant lumps
|
||||
UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
|
||||
filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
|
||||
#define retrieve_mapdata(d, f)\
|
||||
d = Z_Malloc((f)->size, PU_CACHE, NULL); \
|
||||
M_Memcpy(d, wadData + (f)->filepos, (f)->size)
|
||||
retrieve_mapdata(ms, fileinfo + ML_SECTORS);
|
||||
retrieve_mapdata(mld, fileinfo + ML_LINEDEFS);
|
||||
retrieve_mapdata(msd, fileinfo + ML_SIDEDEFS);
|
||||
#undef retrieve_mapdata
|
||||
Z_Free(wadData); // we're done with this now
|
||||
}
|
||||
else // phew it's just a WAD
|
||||
{
|
||||
ms = W_CacheLumpNum(lastloadedmaplumpnum+ML_SECTORS, PU_CACHE);
|
||||
mld = W_CacheLumpNum(lastloadedmaplumpnum+ML_LINEDEFS, PU_CACHE);
|
||||
msd = W_CacheLumpNum(lastloadedmaplumpnum+ML_SIDEDEFS, PU_CACHE);
|
||||
}
|
||||
|
||||
for (i = 0; i < numsectors; i++, ss++, ms++)
|
||||
{
|
||||
diff = diff2 = 0;
|
||||
@@ -742,7 +737,6 @@ static void P_NetArchiveWorld(void)
|
||||
WRITEUINT16(put, 0xffff);
|
||||
R_ClearTextureNumCache(false);
|
||||
|
||||
vres_Free(virt);
|
||||
save_p = put;
|
||||
}
|
||||
|
||||
@@ -1880,7 +1874,7 @@ static void P_NetArchiveThinkers(void)
|
||||
continue;
|
||||
}
|
||||
#ifdef PARANOIA
|
||||
else if (th->function.acp1 != P_RemoveThinkerDelayed) // wait garbage collection
|
||||
else if (th->function.acv != P_RemoveThinkerDelayed) // wait garbage collection
|
||||
I_Error("unknown thinker type %p", th->function.acp1);
|
||||
#endif
|
||||
}
|
||||
@@ -1905,11 +1899,8 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)th;
|
||||
|
||||
if (mobj->mobjnum != oldposition)
|
||||
continue;
|
||||
|
||||
return mobj;
|
||||
if (mobj->mobjnum == oldposition)
|
||||
return mobj;
|
||||
}
|
||||
CONS_Debug(DBG_GAMELOGIC, "mobj not found\n");
|
||||
return NULL;
|
||||
@@ -2908,13 +2899,12 @@ static void P_NetUnArchiveThinkers(void)
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay)
|
||||
continue;
|
||||
|
||||
delay = (void *)currentthinker;
|
||||
|
||||
if ((mobjnum = (UINT32)(size_t)delay->caller))
|
||||
delay->caller = P_FindNewPosition(mobjnum);
|
||||
if (currentthinker->function.acp1 == (actionf_p1)T_ExecutorDelay)
|
||||
{
|
||||
delay = (void *)currentthinker;
|
||||
if ((mobjnum = (UINT32)(size_t)delay->caller))
|
||||
delay->caller = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3023,77 +3013,87 @@ static inline void P_FinishMobjs(void)
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
mobj->info = &mobjinfo[mobj->type];
|
||||
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
mobj->info = &mobjinfo[mobj->type];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline mobj_t *RelinkMobj(mobj_t **ptr)
|
||||
{
|
||||
UINT32 temp = (UINT32)(size_t)*ptr;
|
||||
*ptr = NULL;
|
||||
return P_SetTarget(ptr, P_FindNewPosition(temp));
|
||||
}
|
||||
|
||||
static void P_RelinkPointers(void)
|
||||
{
|
||||
thinker_t *currentthinker;
|
||||
mobj_t *mobj;
|
||||
UINT32 temp;
|
||||
|
||||
// use info field (value = oldposition) to relink mobjs
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
|
||||
continue;
|
||||
|
||||
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
|
||||
continue;
|
||||
|
||||
if (mobj->tracer)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->tracer))
|
||||
CONS_Debug(DBG_GAMELOGIC, "tracer not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->target)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->target))
|
||||
CONS_Debug(DBG_GAMELOGIC, "target not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->hnext)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->hnext))
|
||||
CONS_Debug(DBG_GAMELOGIC, "hnext not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->hprev)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->hprev))
|
||||
CONS_Debug(DBG_GAMELOGIC, "hprev not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->capsule)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->player->capsule))
|
||||
CONS_Debug(DBG_GAMELOGIC, "capsule not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->axis1)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->player->axis1))
|
||||
CONS_Debug(DBG_GAMELOGIC, "axis1 not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->axis2)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->player->axis2))
|
||||
CONS_Debug(DBG_GAMELOGIC, "axis2 not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->awayviewmobj)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->player->awayviewmobj))
|
||||
CONS_Debug(DBG_GAMELOGIC, "awayviewmobj not found on %d\n", mobj->type);
|
||||
if (mobj->tracer)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->tracer;
|
||||
mobj->tracer = NULL;
|
||||
if (!P_SetTarget(&mobj->tracer, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "tracer not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->target)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->target;
|
||||
mobj->target = NULL;
|
||||
if (!P_SetTarget(&mobj->target, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "target not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->hnext)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->hnext;
|
||||
mobj->hnext = NULL;
|
||||
if (!P_SetTarget(&mobj->hnext, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "hnext not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->hprev)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->hprev;
|
||||
mobj->hprev = NULL;
|
||||
if (!P_SetTarget(&mobj->hprev, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "hprev not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->capsule)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->player->capsule;
|
||||
mobj->player->capsule = NULL;
|
||||
if (!P_SetTarget(&mobj->player->capsule, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "capsule not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->axis1)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->player->axis1;
|
||||
mobj->player->axis1 = NULL;
|
||||
if (!P_SetTarget(&mobj->player->axis1, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "axis1 not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->axis2)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->player->axis2;
|
||||
mobj->player->axis2 = NULL;
|
||||
if (!P_SetTarget(&mobj->player->axis2, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "axis2 not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->player && mobj->player->awayviewmobj)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->player->awayviewmobj;
|
||||
mobj->player->awayviewmobj = NULL;
|
||||
if (!P_SetTarget(&mobj->player->awayviewmobj, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "awayviewmobj not found on %d\n", mobj->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3242,25 +3242,19 @@ static inline void P_UnArchiveSPGame(INT16 mapoverride)
|
||||
playeringame[consoleplayer] = true;
|
||||
}
|
||||
|
||||
static void P_NetArchiveMisc(boolean resending)
|
||||
static void P_NetArchiveMisc(void)
|
||||
{
|
||||
UINT32 pig = 0;
|
||||
INT32 i;
|
||||
|
||||
WRITEUINT32(save_p, ARCHIVEBLOCK_MISC);
|
||||
|
||||
if (resending)
|
||||
WRITEUINT32(save_p, gametic);
|
||||
|
||||
WRITEINT16(save_p, gamemap);
|
||||
if (gamestate != GS_LEVEL)
|
||||
WRITEINT16(save_p, GS_WAITINGPLAYERS); // nice hack to put people back into waitingplayers
|
||||
else
|
||||
WRITEINT16(save_p, gamestate);
|
||||
|
||||
if (resending)
|
||||
WRITEINT16(save_p, gametype);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
pig |= (playeringame[i] != 0)<<i;
|
||||
WRITEUINT32(save_p, pig);
|
||||
@@ -3343,18 +3337,14 @@ static void P_NetArchiveMisc(boolean resending)
|
||||
WRITEUINT8(save_p, 0x2e);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(boolean reloading)
|
||||
FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(void)
|
||||
{
|
||||
UINT32 pig;
|
||||
INT32 i;
|
||||
UINT8 *old_save_p;
|
||||
|
||||
if (READUINT32(save_p) != ARCHIVEBLOCK_MISC)
|
||||
I_Error("Bad $$$.sav at archive block Misc");
|
||||
|
||||
if (reloading)
|
||||
gametic = READUINT32(save_p);
|
||||
|
||||
gamemap = READINT16(save_p);
|
||||
|
||||
// gamemap changed; we assume that its map header is always valid,
|
||||
@@ -3364,14 +3354,10 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(boolean reloading)
|
||||
|
||||
// tell the sound code to reset the music since we're skipping what
|
||||
// normally sets this flag
|
||||
if (!reloading)
|
||||
mapmusflags |= MUSIC_RELOADRESET;
|
||||
mapmusflags |= MUSIC_RELOADRESET;
|
||||
|
||||
G_SetGamestate(READINT16(save_p));
|
||||
|
||||
if (reloading)
|
||||
gametype = READINT16(save_p);
|
||||
|
||||
pig = READUINT32(save_p);
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
@@ -3385,16 +3371,8 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(boolean reloading)
|
||||
|
||||
encoremode = (boolean)READUINT8(save_p);
|
||||
|
||||
// FIXME: save_p should not be global!!!
|
||||
old_save_p = save_p;
|
||||
|
||||
if (!P_SetupLevel(true, reloading))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n"));
|
||||
if (!P_SetupLevel(true))
|
||||
return false;
|
||||
}
|
||||
|
||||
save_p = old_save_p;
|
||||
|
||||
// get the time
|
||||
leveltime = READUINT32(save_p);
|
||||
@@ -3477,33 +3455,31 @@ void P_SaveGame(void)
|
||||
WRITEUINT8(save_p, 0x1d); // consistency marker
|
||||
}
|
||||
|
||||
void P_SaveNetGame(boolean resending)
|
||||
void P_SaveNetGame(void)
|
||||
{
|
||||
thinker_t *th;
|
||||
mobj_t *mobj;
|
||||
INT32 i = 1; // don't start from 0, it'd be confused with a blank pointer otherwise
|
||||
|
||||
CV_SaveNetVars(&save_p, false);
|
||||
P_NetArchiveMisc(resending);
|
||||
P_NetArchiveMisc();
|
||||
|
||||
// Assign the mobjnumber for pointer tracking
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)th;
|
||||
|
||||
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
|
||||
continue;
|
||||
|
||||
mobj->mobjnum = i++;
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
mobj = (mobj_t *)th;
|
||||
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
|
||||
continue;
|
||||
mobj->mobjnum = i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
P_NetArchivePlayers(resending);
|
||||
P_NetArchivePlayers();
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
P_NetArchiveWorld();
|
||||
@@ -3538,12 +3514,12 @@ boolean P_LoadGame(INT16 mapoverride)
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean P_LoadNetGame(boolean resending)
|
||||
boolean P_LoadNetGame(void)
|
||||
{
|
||||
CV_LoadNetVars(&save_p);
|
||||
if (!P_NetUnArchiveMisc(resending))
|
||||
if (!P_NetUnArchiveMisc())
|
||||
return false;
|
||||
P_NetUnArchivePlayers(resending);
|
||||
P_NetUnArchivePlayers();
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
P_NetUnArchiveWorld();
|
||||
|
||||
+2
-2
@@ -22,9 +22,9 @@
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(void);
|
||||
void P_SaveNetGame(boolean resending);
|
||||
void P_SaveNetGame(void);
|
||||
boolean P_LoadGame(INT16 mapoverride);
|
||||
boolean P_LoadNetGame(boolean resending);
|
||||
boolean P_LoadNetGame(void);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
|
||||
+734
-441
File diff suppressed because it is too large.
Load diff
+5
-6
@@ -17,9 +17,6 @@
|
||||
#include "doomdata.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_defs.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
extern SINT8 midgamejoin;
|
||||
|
||||
// map md5, sent to players via PT_SERVERINFO
|
||||
extern unsigned char mapmd5[16];
|
||||
@@ -33,7 +30,6 @@ extern boolean levelloading;
|
||||
extern UINT8 levelfadecol;
|
||||
|
||||
extern lumpnum_t lastloadedmaplumpnum; // for comparative savegame
|
||||
extern virtres_t *curmapvirt;
|
||||
//
|
||||
// MAP used flats lookup table
|
||||
//
|
||||
@@ -59,8 +55,11 @@ extern size_t nummapthings;
|
||||
extern mapthing_t *mapthings;
|
||||
|
||||
void P_SetupLevelSky(INT32 skynum, boolean global);
|
||||
#ifdef SCANTHINGS
|
||||
void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
#ifdef HWRENDER
|
||||
void HWR_LoadLevel(void);
|
||||
#endif
|
||||
@@ -88,11 +87,11 @@ SINT8 P_PartialAddGetStage(void);
|
||||
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_WriteThings(lumpnum_t lump);
|
||||
void P_UpdateSegLightOffset(seg_t *li);
|
||||
size_t P_PrecacheLevelFlats(void);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
// Needed for NiGHTS
|
||||
void P_ReloadRings(void);
|
||||
void P_DeleteGrades(INT16 i);
|
||||
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext);
|
||||
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
|
||||
|
||||
+12
-60
@@ -27,51 +27,11 @@
|
||||
static pslope_t *slopelist = NULL;
|
||||
static UINT16 slopecount = 0;
|
||||
|
||||
// Calculate light
|
||||
static void P_UpdateSlopeLightOffset(pslope_t *slope)
|
||||
{
|
||||
const boolean ceiling = (slope->normal.z < 0);
|
||||
const UINT8 contrast = 8;
|
||||
|
||||
fixed_t contrastFixed = ((fixed_t)contrast) * FRACUNIT;
|
||||
fixed_t zMul = FRACUNIT;
|
||||
angle_t slopeDir = ANGLE_MAX;
|
||||
fixed_t extralight = 0;
|
||||
|
||||
if (slope->normal.z == 0)
|
||||
{
|
||||
slope->lightOffset = 0;
|
||||
#ifdef HWRENDER
|
||||
slope->hwLightOffset = 0;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
slopeDir = R_PointToAngle2(0, 0, abs(slope->normal.y), abs(slope->normal.x));
|
||||
if (ceiling == true)
|
||||
{
|
||||
slopeDir ^= ANGLE_180;
|
||||
}
|
||||
|
||||
zMul = min(FRACUNIT, abs(slope->zdelta)*3/2); // *3/2, to make 60 degree slopes match walls.
|
||||
contrastFixed = FixedMul(contrastFixed, zMul);
|
||||
extralight = -contrastFixed + FixedMul(FixedDiv(AngleFixed(slopeDir), ANGLE_90), (contrastFixed * 2));
|
||||
|
||||
// Between -2 and 2 for software, -8 and 8 for hardware
|
||||
slope->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT;
|
||||
#ifdef HWRENDER
|
||||
slope->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Calculate line normal
|
||||
void P_CalculateSlopeNormal(pslope_t *slope)
|
||||
{
|
||||
void P_CalculateSlopeNormal(pslope_t *slope) {
|
||||
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
||||
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.x);
|
||||
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.y);
|
||||
|
||||
P_UpdateSlopeLightOffset(slope);
|
||||
}
|
||||
|
||||
// With a vertex slope that has its vertices set, configure relevant slope info
|
||||
@@ -129,24 +89,18 @@ static void P_ReconfigureVertexSlope(pslope_t *slope)
|
||||
slope->real_xydirection = R_PointToAngle2(0, 0, slope->d.x, slope->d.y)+ANGLE_180;
|
||||
slope->real_zangle = InvAngle(R_PointToAngle2(0, 0, FRACUNIT, slope->zdelta));
|
||||
|
||||
if (slope->normal.x == 0 && slope->normal.y == 0) // Set some defaults for a non-sloped "slope"
|
||||
{
|
||||
if (slope->normal.x == 0 && slope->normal.y == 0) { // Set some defaults for a non-sloped "slope"
|
||||
slope->zangle = slope->xydirection = 0;
|
||||
slope->zdelta = slope->d.x = slope->d.y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slope->extent = extent;
|
||||
slope->xydirection = slope->real_xydirection;
|
||||
slope->zangle = slope->real_zangle;
|
||||
}
|
||||
|
||||
P_UpdateSlopeLightOffset(slope);
|
||||
}
|
||||
|
||||
// Recalculate dynamic slopes
|
||||
void P_RunDynamicSlopes(void)
|
||||
{
|
||||
void P_RunDynamicSlopes(void) {
|
||||
pslope_t *slope;
|
||||
|
||||
for (slope = slopelist; slope; slope = slope->next) {
|
||||
@@ -330,7 +284,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
origin.y = line->v1->y + (line->v2->y - line->v1->y)/2;
|
||||
|
||||
// For FOF slopes, make a special function to copy to the xy origin & direction relative to the position of the FOF on the map!
|
||||
if (frontfloor || frontceil)
|
||||
if(frontfloor || frontceil)
|
||||
{
|
||||
line->frontsector->hasslope = true; // Tell the software renderer that we're sloped
|
||||
|
||||
@@ -354,7 +308,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
// TODO: We take origin and point 's xy values and translate them to the center of an FOF!
|
||||
|
||||
if (frontfloor)
|
||||
if(frontfloor)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
@@ -415,8 +369,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
P_CalculateSlopeNormal(fslope);
|
||||
}
|
||||
|
||||
if (frontceil)
|
||||
if(frontceil)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
@@ -463,7 +416,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
P_CalculateSlopeNormal(cslope);
|
||||
}
|
||||
}
|
||||
if (backfloor || backceil)
|
||||
if(backfloor || backceil)
|
||||
{
|
||||
line->backsector->hasslope = true; // Tell the software renderer that we're sloped
|
||||
|
||||
@@ -486,7 +439,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
direction.x = -direction.x;
|
||||
direction.y = -direction.y;
|
||||
|
||||
if (backfloor)
|
||||
if(backfloor)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
@@ -531,7 +484,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
P_CalculateSlopeNormal(fslope);
|
||||
}
|
||||
if (backceil)
|
||||
if(backceil)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
@@ -681,8 +634,7 @@ pslope_t *P_SlopeById(UINT16 id)
|
||||
}
|
||||
|
||||
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
|
||||
void P_ResetDynamicSlopes(void)
|
||||
{
|
||||
void P_ResetDynamicSlopes(void) {
|
||||
size_t i;
|
||||
|
||||
slopelist = NULL;
|
||||
@@ -982,4 +934,4 @@ void P_ButteredSlope(mobj_t *mo)
|
||||
P_Thrust(mo, mo->standingslope->xydirection, thrust);
|
||||
}
|
||||
|
||||
// EOF
|
||||
// EOF
|
||||
+586
-131
File diff suppressed because it is too large.
Load diff
Loaded 100 of 144 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user