Compare commits

..
Author SHA1 Message Date
Alug 3b07022379 remove spritecliphack shader and readd fickle fix
the shader aint working out that well so just do this for now
2024-06-22 20:43:27 +02:00
Alug a4fce0b3b1 add shader for shadows to also fix sprite shadows in pal render 2024-06-03 16:19:41 +02:00
Alug 79ad1f8d51 readd sprite shadows and give dropshadows their own cvar 2024-06-03 15:46:30 +02:00
Alug 73aef11554 make shadow hack less noticable lul 2024-06-03 15:24:59 +02:00
Alug 318916abc9 Merge branch 'Saturn-Next' into nomobjshadows 2024-06-03 15:24:54 +02:00
Alug 164a9d604a conflict moment 2024-06-02 22:15:58 +02:00
Alug 7696b115ae add maxinterpdist to shadows 2024-06-02 22:15:28 +02:00
Alug b8ecaf336c fix ogl shadows for the 500th time 2024-06-02 22:15:25 +02:00
Alug 1ea8ebf84c o 2024-06-02 22:15:23 +02:00
Alug 9f70fe5373 fix ogl whiteshadows 2024-06-02 22:15:20 +02:00
Alug 9695ede7c2 reenable shadow skewing in software 2024-06-02 22:15:17 +02:00
Alug a5cd72d5db smth smth shader 2024-06-02 22:15:14 +02:00
Alug f87e282981 readd shadowscale since some things need manual scale 2024-06-02 22:15:11 +02:00
Alug 4b15972543 make software shadows more opague 2024-06-02 22:15:09 +02:00
Alug d5753bb15a smol fix and dont colormap software shadows either 2024-06-02 22:15:06 +02:00
Alug a92e5b3f7b dont colourmap shadows
todo software renderer ugh
2024-06-02 22:14:56 +02:00
Alug 72d2357560 use shader to prevent sprite floor clipping
from durr lul
2024-06-02 22:14:53 +02:00
Alug d306b560b1 dont rotate shadows with sprite rotation off
theres prob a better way to get an interpolated floorz but this works
also adds a small offset to not let stuff clip into the ground
2024-06-02 22:14:42 +02:00
Alug 4d331d9c9f change shadowscale a little 2024-06-02 22:13:47 +02:00
indev 932f6d83f7 Allow all mobjs to have shadow 2024-06-02 22:13:45 +02:00
Alug d57783aa3a port neat render based shadows
what an absolute arsepain
shearing in software is disabled cause it is inverted for whatever reason
also if someone ever wants to reeimplement lua spawnshadows idk go ahead kek
2024-06-02 22:13:41 +02:00
Alug 1d79854d3b Merge branch 'Saturn-Next' into nomobjshadows 2024-06-02 22:13:30 +02:00
173 changed files with 23630 additions and 21766 deletions

No files matched your search

-346
View File
@@ -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
View File
@@ -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
View File
@@ -1 +1 @@
/lsdl2srb2kart
/lsdlsrb2
-1
View File
@@ -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 -557
View File
File diff suppressed because it is too large. Load diff
+6 -47
View File
@@ -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
@@ -229,7 +215,6 @@ endif
ifdef LINUX
UNIXCOMMON=1
NOOBJDUMP=1
ifndef NOGME
HAVE_LIBGME=1
endif
@@ -293,8 +278,8 @@ ifdef NOHW
OPTS+=-DNOHW
else
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.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
@@ -399,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=''
@@ -519,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 \
@@ -530,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 \
@@ -564,7 +535,6 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/r_splats.o \
$(OBJDIR)/r_patch.o \
$(OBJDIR)/r_things.o \
$(OBJDIR)/r_portal.o \
$(OBJDIR)/screen.o \
$(OBJDIR)/v_video.o \
$(OBJDIR)/s_sound.o \
@@ -660,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:
@@ -738,18 +697,18 @@ else
ifdef SDL
ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
+7 -12
View File
@@ -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
+128 -382
View File
@@ -1,10 +1,8 @@
// SONIC ROBO BLAST 2 KART
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -28,37 +26,43 @@
#endif
// For use if I do walls with outsides/insides
static const UINT8 REDS = (2*16);
static const UINT8 REDS = (8*16);
static const UINT8 REDRANGE = 16;
static const UINT8 GRAYS = (1*16);
static const UINT8 GRAYSRANGE = 16;
static const UINT8 BROWNS = (15*16);
static const UINT8 YELLOWS = (5*16)+8;
static const UINT8 GREENS = (6*16);
static const UINT8 BLUES = (9*16);
static const UINT8 BROWNS = (3*16);
static const UINT8 YELLOWS = (7*16);
static const UINT8 GREENS = (10*16);
static const UINT8 DBLACK = 31;
static const UINT8 DWHITE = 0;
static const UINT8 NOCLIMBREDS = 248;
static const UINT8 NOCLIMBREDRANGE = 8;
static const UINT8 NOCLIMBGRAYS = 204;
static const UINT8 NOCLIMBBROWNS = (2*16);
static const UINT8 NOCLIMBYELLOWS = (11*16);
// Automap colors
#define BACKGROUND DBLACK
#define WALLCOLORS (REDS + REDRANGE/2)
#define WALLRANGE (REDRANGE/2)
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
#define NOCLIMBWALLRANGE (NOCLIMBREDRANGE/2)
#define THOKWALLCOLORS REDS
#define THOKWALLRANGE REDRANGE
#define TSWALLCOLORS DWHITE
#define TSFINISHLINE GRAYS
#define TSFOFINFO (BLUES + 4)
#define NOCLIMBTHOKWALLCOLORS NOCLIMBREDS
#define NOCLIMBTHOKWALLRANGE NOCLIMBREDRANGE
#define TSWALLCOLORS GRAYS
#define TSWALLRANGE GRAYSRANGE
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
#define FDWALLCOLORS BROWNS
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
#define CDWALLCOLORS YELLOWS
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
#define THINGCOLORS GREENS
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
#define XHAIRCOLORS GRAYS
// Automap passes
#define PASS_SOLID 1
#define PASS_INTANGIBLE 2
#define PASS_FOF 4
// controls
#define AM_PANUPKEY KEY_UPARROW
#define AM_PANDOWNKEY KEY_DOWNARROW
@@ -106,6 +110,11 @@ typedef struct
mpoint_t a, b;
} mline_t;
typedef struct
{
fixed_t slp, islp;
} islope_t;
//
// The vector graphics for the automap.
// A line drawing of the player pointing right,
@@ -127,14 +136,16 @@ static const mline_t player_arrow[] = {
#undef R
#define NUMPLYRLINES (sizeof (player_arrow)/sizeof (mline_t))
#if 0
#define R (FRACUNIT)
static const mline_t cross_mark[] =
{
{ { -R, 0 }, { R, 0} },
{ { 0, -R }, { 0, R } },
static mline_t triangle_guy[] = {
{ { (fixed_t)-.867f*R, (fixed_t)-.5f*R }, { (fixed_t) .867f*R, (fixed_t)-.5f*R } },
{ { (fixed_t) .867f*R, (fixed_t)-.5f*R }, { (fixed_t) 0, (fixed_t) R } },
{ { (fixed_t) 0, (fixed_t) R }, { (fixed_t)-.867f*R, (fixed_t)-.5f*R } }
};
#undef R
#define NUMCROSSMARKLINES (sizeof(cross_mark)/sizeof(mline_t))
#define NUMTRIANGLEGUYLINES (sizeof (triangle_guy)/sizeof (mline_t))
#endif
#define R (FRACUNIT)
static const mline_t thintriangle_guy[] = {
@@ -151,14 +162,10 @@ static boolean draw_grid = false;
boolean automapactive = false;
boolean am_recalc = false; //added : 05-02-98 : true when screen size changes
static boolean am_stopped = true;
static boolean am_minigen = false;
static UINT8 *am_buf = NULL;
static INT32 f_x, f_y; // location of window on screen (always zero for both)
static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively)
static boolean m_keydown[4]; // which window panning keys are being pressed down?
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
@@ -198,13 +205,12 @@ static fixed_t scale_ftom;
static player_t *plr; // the player represented by an arrow
static boolean followplayer = true; // specifies whether to follow the player around
static INT32 followplayer = true; // specifies whether to follow the player around
// function for drawing lines, depends on rendermode
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
static AMDRAWFLINEFUNC AM_drawFline;
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc);
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
static void AM_activateNewScale(void)
@@ -254,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);
@@ -334,23 +350,22 @@ static void AM_initVariables(void)
old_m_h = m_h;
}
//
// Called when the screen size changes.
//
static void AM_FrameBufferInit(void)
{
f_x = f_y = 0;
f_w = vid.width;
f_h = vid.height;
am_buf = screens[0];
}
//
// should be called at the start of every level
// right now, i figure it out myself
//
static void AM_LevelInit(void)
{
f_x = f_y = 0;
f_w = vid.width;
f_h = vid.height;
AM_drawFline = AM_drawFline_soft;
#ifdef HWRENDER
if (rendermode == render_opengl)
AM_drawFline = HWR_drawAMline;
#endif
AM_findMinMaxBoundaries();
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
if (scale_mtof > max_scale_mtof)
@@ -372,7 +387,7 @@ void AM_Stop(void)
*
* \sa AM_Stop
*/
void AM_Start(void)
static inline void AM_Start(void)
{
static INT32 lastlevel = -1;
@@ -381,12 +396,8 @@ void AM_Start(void)
am_stopped = false;
if (lastlevel != gamemap || am_recalc) // screen size changed
{
AM_FrameBufferInit();
if (lastlevel != gamemap)
{
AM_LevelInit();
lastlevel = gamemap;
}
AM_LevelInit();
lastlevel = gamemap;
am_recalc = false;
}
AM_initVariables();
@@ -412,27 +423,6 @@ static void AM_maxOutWindowScale(void)
AM_activateNewScale();
}
//
// set window panning
//
static void AM_setWindowPanning(void)
{
// up and down
if (m_keydown[2]) // pan up
m_paninc.y = FTOM(F_PANINC);
else if (m_keydown[3]) // pan down
m_paninc.y = -FTOM(F_PANINC);
else
m_paninc.y = 0;
// left and right
if (m_keydown[0]) // pan right
m_paninc.x = FTOM(F_PANINC);
else if (m_keydown[1]) // pan left
m_paninc.x = -FTOM(F_PANINC);
else
m_paninc.x = 0;
}
/** Responds to user inputs in automap mode.
*
* \param ev Event to possibly respond to.
@@ -465,49 +455,35 @@ boolean AM_Responder(event_t *ev)
{
case AM_PANRIGHTKEY: // pan right
if (!followplayer)
{
m_keydown[0] = true;
AM_setWindowPanning();
}
m_paninc.x = FTOM(F_PANINC);
else
rc = false;
break;
case AM_PANLEFTKEY: // pan left
if (!followplayer)
{
m_keydown[1] = true;
AM_setWindowPanning();
}
m_paninc.x = -FTOM(F_PANINC);
else
rc = false;
break;
case AM_PANUPKEY: // pan up
if (!followplayer)
{
m_keydown[2] = true;
AM_setWindowPanning();
}
m_paninc.y = FTOM(F_PANINC);
else
rc = false;
break;
case AM_PANDOWNKEY: // pan down
if (!followplayer)
{
m_keydown[3] = true;
AM_setWindowPanning();
}
m_paninc.y = -FTOM(F_PANINC);
else
rc = false;
break;
case AM_ZOOMOUTKEY: // zoom out
mtof_zoommul = M_ZOOMOUT;
ftom_zoommul = M_ZOOMIN;
AM_setWindowPanning();
break;
case AM_ZOOMINKEY: // zoom in
mtof_zoommul = M_ZOOMIN;
ftom_zoommul = M_ZOOMOUT;
AM_setWindowPanning();
break;
case AM_TOGGLEKEY:
AM_Stop();
@@ -521,7 +497,6 @@ boolean AM_Responder(event_t *ev)
}
else
AM_restoreScaleAndLoc();
AM_setWindowPanning();
break;
case AM_FOLLOWKEY:
followplayer = !followplayer;
@@ -541,32 +516,14 @@ boolean AM_Responder(event_t *ev)
switch (ev->data1)
{
case AM_PANRIGHTKEY:
if (!followplayer)
{
m_keydown[0] = false;
AM_setWindowPanning();
}
break;
case AM_PANLEFTKEY:
if (!followplayer)
{
m_keydown[1] = false;
AM_setWindowPanning();
}
m_paninc.x = 0;
break;
case AM_PANUPKEY:
if (!followplayer)
{
m_keydown[2] = false;
AM_setWindowPanning();
}
break;
case AM_PANDOWNKEY:
if (!followplayer)
{
m_keydown[3] = false;
AM_setWindowPanning();
}
m_paninc.y = 0;
break;
case AM_ZOOMOUTKEY:
case AM_ZOOMINKEY:
@@ -767,16 +724,6 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
}
#undef DOOUTCODE
//
// Draws a pixel.
//
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
{
if (xx < 0 || yy < 0 || xx >= f_w || yy >= f_h)
return; // off the screen
am_buf[(yy*f_w) + xx] = cc;
}
//
// Classic Bresenham w/ whatever optimizations needed for speed
//
@@ -798,6 +745,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
}
#endif
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
dx = fl->b.x - fl->a.x;
ax = 2 * (dx < 0 ? -dx : dx);
sx = dx < 0 ? -1 : 1;
@@ -814,7 +763,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
d = ay - ax/2;
for (;;)
{
AM_drawPixel(x, y, color);
PUTDOT(x, y, color)
if (x == fl->b.x)
return;
if (d >= 0)
@@ -831,7 +780,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
d = ax - ay/2;
for (;;)
{
AM_drawPixel(x, y, color);
PUTDOT(x, y, color)
if (y == fl->b.y)
return;
if (d >= 0)
@@ -843,6 +792,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
d += ax;
}
}
#undef PUTDOT
}
//
@@ -864,18 +815,17 @@ static void AM_drawGrid(INT32 color)
fixed_t x, y;
fixed_t start, end;
mline_t ml;
fixed_t gridsize = (MAPBLOCKUNITS<<MAPBITS);
// Figure out start of vertical gridlines
start = m_x;
if ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize)
start += gridsize - ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize);
if ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS))
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS));
end = m_x + m_w;
// draw vertical gridlines
ml.a.y = m_y;
ml.b.y = m_y + m_h;
for (x = start; x < end; x += gridsize)
for (x = start; x < end; x += (MAPBLOCKUNITS<<FRACBITS))
{
ml.a.x = x;
ml.b.x = x;
@@ -884,14 +834,14 @@ static void AM_drawGrid(INT32 color)
// Figure out start of horizontal gridlines
start = m_y;
if ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize)
start += gridsize - ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize);
if ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS))
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS));
end = m_y + m_h;
// draw horizontal gridlines
ml.a.x = m_x;
ml.b.x = m_x + m_w;
for (y = start; y < end; y += gridsize)
for (y = start; y < end; y += (MAPBLOCKUNITS<<FRACBITS))
{
ml.a.y = y;
ml.b.y = y;
@@ -899,63 +849,14 @@ static void AM_drawGrid(INT32 color)
}
}
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \
end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y) + FRACUNIT/2) >> FRACBITS; \
} else \
end1 = end2 = (normalheight + FRACUNIT/2) >> FRACBITS;
static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondarystore)
{
ffloor_t *secondaryrover = NULL;
for (; rover; rover = rover->next)
{
fixed_t rovt1, rovt2;
fixed_t rovb1, rovb2;
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_BLOCKPLAYER))
continue;
SLOPEPARAMS(*rover->t_slope, rovt1, rovt2, *rover->topheight)
SLOPEPARAMS(*rover->b_slope, rovb1, rovb2, *rover->bottomheight)
for (secondaryrover = secondarystore; secondaryrover; secondaryrover = secondaryrover->next)
{
fixed_t sect1, sect2;
fixed_t secb1, secb2;
if (!(secondaryrover->flags & FF_EXISTS))
continue;
if (!(secondaryrover->flags & FF_BLOCKPLAYER))
continue;
if (secondaryrover->secnum == rover->secnum)
break;
SLOPEPARAMS(*secondaryrover->t_slope, sect1, sect2, *secondaryrover->topheight)
SLOPEPARAMS(*secondaryrover->b_slope, secb1, secb2, *secondaryrover->bottomheight)
if (rovt1 != sect1)
continue;
if (rovt2 != sect2)
continue;
if (rovb1 != secb1)
continue;
if (rovb2 != secb2)
continue;
break;
}
if (secondaryrover == NULL)
break;
}
return rover;
}
//
// Determines visible lines, draws them.
// This is LineDef based, not LineSeg based.
//
static void AM_drawWalls(UINT8 pass)
static inline void AM_drawWalls(void)
{
size_t i;
static mline_t l;
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale)>>FRACBITS;
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
@@ -965,143 +866,74 @@ static void AM_drawWalls(UINT8 pass)
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
if (lines[i].backsector) {
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
}
#undef SLOPEPARAMS
if (!lines[i].backsector) // 1-sided
{
if (!(pass & PASS_SOLID))
;
else if (frontf1 != frontc1 || frontf2 != frontc2 || lines[i].frontsector->f_slope)
{
AM_drawMline(&l, TSWALLCOLORS);
}
else if (!am_minigen)
{
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBWALLCOLORS);
else
AM_drawMline(&l, WALLCOLORS);
}
continue;
}
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
{
if (backf1 == backc1 && backf2 == backc2
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
{
if (!am_minigen && (pass & PASS_INTANGIBLE))
{
AM_drawMline(&l, GRIDCOLORS);
}
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
else
AM_drawMline(&l, TSWALLCOLORS);
}
else if (pass & PASS_SOLID)
else
{
AM_drawMline(&l, TSWALLCOLORS);
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS);
else
AM_drawMline(&l, THOKWALLCOLORS);
}
}
else
{
//dont think kart even supports those idk?
/*if (lines[i].flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS))
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSWALLCOLORS); // Completely solid course boundary
}
else if ((lines[i].flags & ML_MIDSOLID)
&& sides[lines->sidenum[0]].midtexture)
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSWALLCOLORS); // solid midtexture, likely a course boundary
}*/
if ((backf1 != frontf1 && abs(backf1 - frontf1) > maxstep)
|| (backf2 != frontf2 && abs(backf2 - frontf2) > maxstep))
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSWALLCOLORS); // floor-wall, likely a course boundary
}
/*else if (lines[i].special == 2001) // guh its a sector effect in kart idk how to make it work tbh lol
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSFINISHLINE); // finish line
}*/
else if (backf1 != frontf1 || backf2 != frontf2)
{
if (pass & PASS_INTANGIBLE)
AM_drawMline(&l, FDWALLCOLORS); // floorlevel change
}
else if (backc1 != frontc1 || backc2 != frontc2)
{
if (!(pass & PASS_INTANGIBLE))
;
else if (abs(backc1 - frontc1) < maxstep
|| abs(backc2 - frontc2) < maxstep)
{
AM_drawMline(&l, CDWALLCOLORS); // ceilinglevel change
if (lines[i].flags & ML_NOCLIMB) {
if (backf1 != frontf1 || backf2 != frontf2) {
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
}
else if (backc1 != frontc1 || backc2 != frontc2) {
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
}
else
{
AM_drawMline(&l, GRIDCOLORS); // ceiling-wall, not likely to be a course boundary but flagged up just in case
}
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
}
else
{
{
ffloor_t *rover = NULL;
if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors)
{
if (lines[i].backsector->ffloors == NULL)
{
// Check frontside for one solid
for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_BLOCKPLAYER))
continue;
break;
}
}
else if (lines[i].frontsector->ffloors == NULL)
{
// Check backside for one solid
for (rover = lines[i].backsector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_BLOCKPLAYER))
continue;
break;
}
}
else
{
// Check to see if any secnums exist in one but not the other.
rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors);
if (rover == NULL)
rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors);
}
}
if (rover != NULL)
{
if (pass & PASS_FOF)
AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet
}
else if (!am_minigen)
{
if (pass & PASS_INTANGIBLE)
AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line
}
if (backf1 != frontf1 || backf2 != frontf2) {
AM_drawMline(&l, FDWALLCOLORS); // floor level change
}
else if (backc1 != frontc1 || backc2 != frontc2) {
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
}
else
AM_drawMline(&l, TSWALLCOLORS);
}
}
}
}
#undef SLOPEPARAMS
//
// Rotation in 2D.
// Used to rotate player arrow line character.
@@ -1174,7 +1006,7 @@ static inline void AM_drawPlayers(void)
if (!multiplayer)
{
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
return;
}
@@ -1183,15 +1015,12 @@ 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)
color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8];
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, p->mo->angle, color, p->mo->x, p->mo->y);
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y);
}
}
@@ -1211,27 +1040,13 @@ static inline void AM_drawThings(UINT8 colors)
}
}
/** Draws the crosshair.
/** Draws the crosshair, actually just a dot in software mode.
*
* \param color Color for the crosshair.
*/
static inline void AM_drawCrosshair(UINT8 color)
{
const fixed_t scale = 4<<FRACBITS;
size_t i;
fline_t fl;
for (i = 0; i < NUMCROSSMARKLINES; i++)
{
fl.a.x = FixedMul(cross_mark[i].a.x, scale) >> FRACBITS;
fl.a.y = FixedMul(cross_mark[i].a.y, scale) >> FRACBITS;
fl.b.x = FixedMul(cross_mark[i].b.x, scale) >> FRACBITS;
fl.b.y = FixedMul(cross_mark[i].b.y, scale) >> FRACBITS;
fl.a.x += f_x + (f_w / 2);
fl.a.y += f_y + (f_h / 2);
fl.b.x += f_x + (f_w / 2);
fl.b.y += f_y + (f_h / 2);
AM_drawFline(&fl, color);
}
V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART);
}
/** Draws the automap.
@@ -1241,80 +1056,11 @@ void AM_Drawer(void)
if (!automapactive)
return;
AM_drawFline = AM_drawFline_soft;
#ifdef HWRENDER
if (rendermode == render_opengl)
AM_drawFline = HWR_drawAMline;
#endif
AM_clearFB(BACKGROUND);
if (draw_grid) AM_drawGrid(GRIDCOLORS);
AM_drawWalls(PASS_FOF|PASS_INTANGIBLE|PASS_SOLID);
AM_drawWalls();
AM_drawPlayers();
AM_drawThings(THINGCOLORS);
if (!followplayer) AM_drawCrosshair(XHAIRCOLORS);
}
minigen_t *AM_MinimapGenerate(INT32 mul)
{
static minigen_t ret = {0};
if (automapactive)
return NULL;
am_minigen = true;
AM_drawFline = AM_drawFline_soft; // yes, even in GL
//AM_FrameBufferInit();
f_x = f_y = 0;
ret.w = f_w = minimapinfo.minimap_w * mul;
ret.h = f_h = minimapinfo.minimap_h * mul;
am_buf = ret.buf = NULL;
//AM_LevelInit();
AM_findMinMaxBoundaries();
scale_mtof = min_scale_mtof - (min_scale_mtof/20);
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
//AM_initVariables();
f_oldloc.x = INT32_MAX;
m_paninc.x = m_paninc.y = 0;
ftom_zoommul = FRACUNIT;
mtof_zoommul = FRACUNIT;
m_w = FTOM(f_w);
m_h = FTOM(f_h);
//AM_changeWindowLoc();
m_x = min_x - FixedMul(m_w, FRACUNIT/40);
m_y = min_y - FixedMul(m_h, FRACUNIT/40);
m_x2 = m_x + m_w;
m_y2 = m_y + m_h;
// for saving & restoring
old_m_x = m_x;
old_m_y = m_y;
old_m_w = m_w;
old_m_h = m_h;
am_buf = ret.buf = malloc((f_w*f_h));
if (ret.buf == NULL)
return NULL;
//AM_clearFB(BACKGROUND);
memset(am_buf, 0xff, (f_w*f_h));
AM_drawWalls(PASS_FOF);
AM_drawWalls(PASS_INTANGIBLE);
AM_drawWalls(PASS_SOLID);
am_buf = NULL;
am_recalc = true;
am_minigen = false;
return &ret;
AM_drawCrosshair(XHAIRCOLORS);
}
+8 -17
View File
@@ -1,10 +1,8 @@
// SONIC ROBO BLAST 2 KART
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -28,6 +26,11 @@ typedef struct
fpoint_t a, b;
} fline_t;
// Used by ST StatusBar stuff.
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
extern boolean am_recalc; // true if screen size changes
extern boolean automapactive; // In AutoMap mode?
@@ -40,19 +43,7 @@ void AM_Ticker(void);
// Called by main loop, instead of view drawer if automap is active.
void AM_Drawer(void);
// Enables the automap.
void AM_Start(void);
// Called to force the automap to quit if the level is completed while it is up.
void AM_Stop(void);
typedef struct
{
INT32 w, h;
UINT8 *buf;
} minigen_t;
// Minimap generation
minigen_t *AM_MinimapGenerate(INT32 mul);
#endif
+5 -2
View File
@@ -36,7 +36,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
return;
// Lua can handle it!
if (LUA_HookBotAI(sonic, tails, cmd))
if (LUAh_BotAI(sonic, tails, cmd))
return;
if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
@@ -118,8 +118,11 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
return;
}
// Bot AI isn't programmed in analog.
//CV_SetValue(&cv_analog2, false);
// Let Lua scripts build ticcmds
if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
if (LUAh_BotTiccmd(player, cmd))
return;
// We don't have any main character AI, sorry. D:
+23 -28
View File
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2024 by Sonic Team Junior.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -11,9 +11,6 @@
/// \brief Macros to read/write from/to a UINT8 *,
/// used for packet creation and such
#ifndef __BYTEPTR_H__
#define __BYTEPTR_H__
#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__)
#define DEALIGNED
#endif
@@ -153,7 +150,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
#undef DEALIGNED
#define WRITESTRINGN(p, s, n) do { \
#define WRITESTRINGN(p, s, n) ({ \
size_t tmp_i; \
\
for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \
@@ -161,72 +158,70 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
\
if (tmp_i < n) \
WRITECHAR(p, '\0'); \
} while (0)
})
#define WRITESTRINGL(p, s, n) do { \
#define WRITESTRINGL(p, s, n) ({ \
size_t tmp_i; \
\
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
WRITECHAR(p, '\0'); \
} while (0)
})
#define WRITESTRING(p, s) do { \
#define WRITESTRING(p, s) ({ \
size_t tmp_i; \
\
for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
WRITECHAR(p, '\0'); \
} while (0)
})
#define WRITEMEM(p, s, n) do { \
memcpy(p, s, n); \
p += n; \
} while (0)
#define WRITEMEM(p, s, n) ({ \
memcpy(p, s, n); \
p += n; \
})
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
#define SKIPSTRINGN(p, n) do { \
#define SKIPSTRINGN(p, n) ({ \
size_t tmp_i = 0; \
\
while (tmp_i < n && READCHAR(p) != '\0') \
tmp_i++; \
} while (0)
})
#define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n)
#define READSTRINGN(p, s, n) do { \
#define READSTRINGN(p, s, n) ({ \
size_t tmp_i = 0; \
\
while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
} while (0)
})
#define READSTRINGL(p, s, n) do { \
#define READSTRINGL(p, s, n) ({ \
size_t tmp_i = 0; \
\
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
} while (0)
})
#define READSTRING(p, s) do { \
#define READSTRING(p, s) ({ \
size_t tmp_i = 0; \
\
while ((s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
} while (0)
})
#define READMEM(p, s, n) do { \
memcpy(s, p, n); \
p += n; \
} while (0)
#endif // __BYTEPTR_H__
#define READMEM(p, s, n) ({ \
memcpy(s, p, n); \
p += n; \
})
+1 -1
View File
@@ -628,7 +628,7 @@ static void COM_ExecuteString(char *ptext)
// check cvars
// Hurdler: added at Ebola's request ;)
// (don't flood the console in software mode with bad gl_xxx command)
// (don't flood the console in software mode with bad gr_xxx command)
if (!CV_Command() && con_destlines)
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
}
+254 -55
View File
@@ -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;
}
@@ -1236,7 +1435,7 @@ void CONS_Printf(const char *fmt, ...)
txt = malloc(8192);
va_start(argptr, fmt);
vsnprintf(txt, 8192, fmt, argptr);
vsprintf(txt, fmt, argptr);
va_end(argptr);
// echo console prints to log file
@@ -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);
+461 -754
View File
File diff suppressed because it is too large. Load diff
+8 -32
View File
@@ -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,28 +567,22 @@ 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
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam);
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam); // splitsreen player
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam); // splitsreen3 player
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam); // splitsreen4 player
// Create any new ticcmds and broadcast to other players.
void NetKeepAlive(void);
@@ -645,18 +626,13 @@ extern char motd[254], server_context[8];
extern UINT8 playernode[MAXPLAYERS];
INT32 D_NumPlayers(void);
void D_ResetTiccmds(void);
ticcmd_t *D_LocalTiccmd(UINT8 ss);
tic_t GetLag(INT32 node);
//UINT8 GetFreeXCmdSize(UINT8 playerid);
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)];
+115 -198
View File
@@ -15,7 +15,6 @@
/// plus functions to parse command line parameters, configure game
/// parameters, and call the startup functions.
#include "d_netcmd.h"
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
#include <sys/stat.h>
#include <sys/types.h>
@@ -38,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"
@@ -100,22 +98,23 @@ UINT8 window_notinfocus = false;
// DEMO LOOP
//
//static INT32 demosequence;
static const char *pagename = "MAP1PIC";
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
boolean singletics = false; // timedemo
boolean lastdraw = false;
postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
// These variables are only true if
@@ -150,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
@@ -169,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 (cv_usejoystick[i].value == 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
@@ -271,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;
@@ -282,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)
@@ -292,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)
@@ -335,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)
@@ -349,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)
@@ -450,8 +415,6 @@ static boolean D_Display(void)
{
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
{
viewssnum = i;
if (i == 0) // Initialize for P1
{
viewwindowy = 0;
@@ -461,8 +424,10 @@ static boolean D_Display(void)
objectsdrawn = 0;
}
viewssnum = i;
#ifdef HWRENDER
if (rendermode == render_opengl)
if (rendermode != render_soft)
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
else
#endif
@@ -512,12 +477,13 @@ static boolean D_Display(void)
if (rendermode == render_soft)
{
if (!splitscreen)
R_ApplyViewMorph();
if (!splitscreen)
R_ApplyViewMorph();
for (i = 0; i <= splitscreen; i++)
{
V_DoPostProcessor(i, &players[displayplayers[i]], postimgparam[i]);
if (postimgtype[i])
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
}
}
@@ -531,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;
}
@@ -538,8 +505,6 @@ static boolean D_Display(void)
PS_START_TIMING(ps_uitime);
ST_Drawer();
HU_Drawer();
NetUpdate(); // TEST: run this EVERY frame
}
else
{
@@ -566,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...
@@ -596,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())
{
@@ -644,7 +610,6 @@ static boolean D_Display(void)
PS_STOP_TIMING(ps_swaptime);
}
return ranwipe;
}
// =========================================================================
@@ -652,7 +617,7 @@ static boolean D_Display(void)
// =========================================================================
tic_t rendergametic;
static SINT8 menuInputDelayTimer = 0;
static int menuInputDelayTimer = 0;
void D_SRB2Loop(void)
{
@@ -662,7 +627,6 @@ void D_SRB2Loop(void)
boolean interp = false;
boolean doDisplay = false;
int frameskip = 0;
if (dedicated)
server = true;
@@ -707,8 +671,6 @@ void D_SRB2Loop(void)
capbudget = (precise_t) budget;
}
boolean ranwipe = false;
I_UpdateTime(cv_timescale.value);
if (lastwipetic)
@@ -741,12 +703,10 @@ 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)
{
refreshdirmenu = 0; // not sure where to put this, here as good as any?
// don't skip more than 10 frames at a time
// (fadein / fadeout cause massive frame skip!)
if (realtics > 8)
@@ -764,59 +724,21 @@ 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)
{
renderdeltatics = FLOAT_TO_FIXED(deltatics);
if (!(paused || P_AutoPause()) && !hu_stopped)
if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped)
{
rendertimefrac = g_time.timefrac;
}
@@ -824,26 +746,16 @@ void D_SRB2Loop(void)
{
rendertimefrac = FRACUNIT;
}
if (!hu_stopped)
{
rendertimefrac_unpaused = g_time.timefrac;
}
else
{
rendertimefrac_unpaused = FRACUNIT;
}
}
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.
@@ -862,37 +774,52 @@ void D_SRB2Loop(void)
LUA_Step();
#ifdef HAVE_DISCORDRPC
if (!dedicated)
if (! dedicated)
{
Discord_RunCallbacks();
}
#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);
@@ -967,14 +894,10 @@ void D_StartTitle(void)
gameaction = ga_nothing;
memset(displayplayers, 0, sizeof(displayplayers));
memset(g_localplayers, 0, sizeof g_localplayers);
consoleplayer = 0;
//demosequence = -1;
gametype = GT_RACE; // SRB2kart
paused = false;
S_ResetKeepAndSpecialMus(); // just in case
F_StartTitleScreen();
// Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade
@@ -1022,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"))
@@ -1046,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)
@@ -1081,7 +1004,8 @@ static void D_FindAddonsToAutoload(void)
const char *autoloadpath;
boolean postload;
INT32 i;
INT32 i, len;
boolean hasprefix = false;
char wadsToAutoload[256] = "";
// does it exist tho
@@ -1090,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)
{
@@ -1103,8 +1024,7 @@ static void D_FindAddonsToAutoload(void)
|| (wadsToAutoload[0] == '#'))
continue;
// this marks it so that it loads after loading server addons
else if (fastncmp(wadsToAutoload, "postload ", 9))
{
else if (fastncmp(wadsToAutoload, "postload ", 9)) {
strremove(wadsToAutoload, "postload ");
postload = true;
}
@@ -1116,10 +1036,34 @@ static void D_FindAddonsToAutoload(void)
wadsToAutoload[i] = '\0';
}
if (!postload && W_CheckPostLoadList(wadsToAutoload))
len = strlen(wadsToAutoload);
hasprefix = false;
for (i = 0; i < len; ++i)
{
CONS_Printf("forcing postload for file %s\n", wadsToAutoload);
postload = true;
if (wadsToAutoload[i] == '_')
{
hasprefix = true;
break;
}
}
// Lets just hope no one adds bonuschars in autoload
if (hasprefix)
{
// We searching for c in prefix, which stands for "character" and doesn't work well with
// autoload atm, only fine for postload
for (i = 0; i < len; ++i)
{
if (wadsToAutoload[i] == '_') break; // Prefix end
if (wadsToAutoload[i] == 'c' || wadsToAutoload[i] == 'C')
{
CONS_Alert(CONS_WARNING, "forcing postload for %s as local skin\n", wadsToAutoload);
postload = true;
break; // Found it
}
}
}
// LOAD IT
@@ -1137,32 +1081,6 @@ static void D_FindAddonsToAutoload(void)
fclose(autoloadconfigfile);
}
static void D_AddAutoloadFiles(void)
{
if (wasautoloaded)
return;
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;
}
void D_AddPostloadFiles(void)
{
if (postautoloaded || !netgame)
return;
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
postautoloaded = true;
}
void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
@@ -1268,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;
@@ -1577,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++;
@@ -1605,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
@@ -1614,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
@@ -1629,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
@@ -1651,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
//
@@ -1769,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,
@@ -1850,11 +1762,15 @@ void D_SRB2Main(void)
}
S_InitMusicDefs();
S_InitMTDefs();
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();
D_AddAutoloadFiles();
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()))
@@ -2057,9 +1973,10 @@ void D_SRB2Main(void)
if (dedicated && server)
{
pagename = "TITLESKY";
levelstarttic = gametic;
G_SetGamestate(GS_LEVEL);
if (!P_SetupLevel(false, false))
if (!P_SetupLevel(false))
I_Quit(); // fail so reset game stuff
}
+1 -6
View File
@@ -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;
// autoload stuff
extern boolean autoloading;
extern boolean autoloaded;
extern boolean postautoloaded;
void D_AddPostloadFiles(void);
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;
+46 -27
View File
@@ -64,11 +64,16 @@ 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;
boolean (*I_NetGet)(void) = NULL;
void (*I_NetSend)(void) = NULL;
boolean (*I_NetCanSend)(void) = NULL;
boolean (*I_NetCanGet)(void) = NULL;
void (*I_NetCloseSocket)(void) = NULL;
void (*I_NetFreeNodenum)(INT32 nodenum) = NULL;
SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL;
@@ -788,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",
@@ -831,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)
{
@@ -1085,7 +1072,15 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
netbuffer->ackreturn = 0;
if (reliable)
{
if (!GetFreeAcknum(&netbuffer->ack, false))
if (I_NetCanSend && !I_NetCanSend())
{
if (netbuffer->packettype < PT_CANFAIL)
GetFreeAcknum(&netbuffer->ack, true);
DEBFILE("HSendPacket: Out of bandwidth\n");
return false;
}
else if (!GetFreeAcknum(&netbuffer->ack, false))
return false;
}
else
@@ -1213,7 +1208,7 @@ boolean HGetPacket(void)
}
break;
}
#endif // ifndef NONET
#endif // ndef NONET
return true;
}
@@ -1263,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;
}
@@ -1282,11 +1280,13 @@ boolean D_CheckNetGame(void)
I_NetGet = Internal_Get;
I_NetSend = Internal_Send;
I_NetCanSend = NULL;
I_NetCloseSocket = NULL;
I_NetFreeNodenum = Internal_FreeNodenum;
I_NetMakeNodewPort = NULL;
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
net_bandwidth = 30000;
// I_InitNetwork sets doomcom and netgame
// check and initialize the network driver
multiplayer = false;
@@ -1306,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"))
{
@@ -1316,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"))
{
@@ -1335,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);
@@ -1347,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)
@@ -1435,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);
@@ -1480,6 +1498,7 @@ void D_CloseConnection(void)
I_NetGet = Internal_Get;
I_NetSend = Internal_Send;
I_NetCanSend = NULL;
I_NetCloseSocket = NULL;
I_NetFreeNodenum = Internal_FreeNodenum;
I_NetMakeNodewPort = NULL;
-1
View File
@@ -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
+242 -384
View File
File diff suppressed because it is too large. Load diff
+8 -9
View File
@@ -43,12 +43,18 @@ extern consvar_t cv_seenames, cv_allowseenames;
extern consvar_t cv_usemouse;
//WTF
extern consvar_t cv_mouseturn;
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
extern consvar_t cv_usejoystick;
extern consvar_t cv_usejoystick2;
extern consvar_t cv_usejoystick3;
extern consvar_t cv_usejoystick4;
#ifdef LJOYSTICK
extern consvar_t cv_joyport;
extern consvar_t cv_joyport2;
#endif
extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS
extern consvar_t cv_joyscale;
extern consvar_t cv_joyscale2;
extern consvar_t cv_joyscale3;
extern consvar_t cv_joyscale4;
// splitscreen with second mouse
extern consvar_t cv_mouse2port;
@@ -122,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;
@@ -160,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;
@@ -197,17 +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[4]; // screw you includes
extern consvar_t 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
View File
@@ -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
}
}
+6 -14
View File
@@ -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
// ========================================================================
@@ -403,6 +395,7 @@ typedef struct player_s
angle_t old_frameangle, old_frameangle2;
// SRB2Kart CEP: Sliptide rolling
INT32 sliptidemem;
angle_t sliproll;
INT16 lturn_max[MAXPREDICTTICS]; // What's the expected turn value for full-left for a number of frames back (to account for netgame latency)?
@@ -412,8 +405,6 @@ typedef struct player_s
// See pflags_t, above.
pflags_t pflags;
UINT16 postimgflags;
// playing animation.
panim_t panim;
@@ -474,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)
////////////////////
@@ -547,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
-1
View File
@@ -49,7 +49,6 @@ typedef struct thinker_s
// killough 11/98: count of how many other objects reference
// this one using pointers. Used for garbage collection.
INT32 references;
boolean cachable;
} thinker_t;
#endif
+189 -65
View File
@@ -14,6 +14,7 @@
#include "d_main.h" // for srb2home
#include "g_game.h"
#include "sounds.h"
#include "info.h"
#include "d_think.h"
#include "m_argv.h"
#include "z_zone.h"
@@ -32,12 +33,12 @@
#include "r_sky.h"
#include "r_draw.h" // translation colormap consts (for lua)
#include "fastcmp.h"
#include "lua_script.h"
#include "lua_glib.h"
#include "lua_hook.h"
#include "d_clisrv.h"
#include "v_video.h" // video flags (for lua)
#include "lua_glib.h"
#include "lua_hook.h"
#include "lua_script.h"
#include "lua_libs.h"
@@ -47,14 +48,13 @@
// Free slot names
// The crazy word-reading stuff uses these.
char *FREE_STATES[NUMSTATEFREESLOTS];
char *FREE_MOBJS[NUMMOBJFREESLOTS];
UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
static char *FREE_STATES[NUMSTATEFREESLOTS];
static char *FREE_MOBJS[NUMMOBJFREESLOTS];
static UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
#define initfreeslots() {\
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
}
// Crazy word-reading stuff
@@ -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"},
@@ -1493,6 +1559,9 @@ actionpointer_t actionpointers[] =
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
{{A_RollAngle}, "A_ROLLANGLE"},
{{A_ChangeRollAngleRelative},"A_CHANGEROLLANGLERELATIVE"},
{{A_ChangeRollAngleAbsolute},"A_CHANGEROLLANGLEABSOLUTE"},
{{A_PlaySound}, "A_PLAYSOUND"},
{{A_FindTarget}, "A_FINDTARGET"},
{{A_FindTracer}, "A_FINDTRACER"},
@@ -1523,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
@@ -1616,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"))
@@ -1661,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;
}
}
@@ -1720,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
@@ -1787,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
@@ -1914,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
@@ -1992,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
@@ -2370,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
@@ -2443,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"))
@@ -2456,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)
@@ -2521,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)
@@ -2536,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);
}
@@ -2565,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;
@@ -2585,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
@@ -2848,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;
}
@@ -2873,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;
}
@@ -2886,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"))
@@ -2903,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,
@@ -2924,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"))
{
@@ -2934,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"))
{
@@ -2950,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"))
{
@@ -2962,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"))
@@ -2975,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"))
@@ -2995,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"))
{
@@ -3014,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"))
{
@@ -3029,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"))
{
@@ -3044,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"))
{
@@ -3128,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);
}
@@ -3147,7 +3302,7 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
// RegEx to generate this from info.h: ^\tS_([^,]+), --> \t"S_\1",
// I am leaving the prefixes solely for clarity to programmers,
// because sadly no one remembers this place while searching for full state names.
const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
static const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
"S_NULL",
"S_UNKNOWN",
"S_INVISIBLE", // state for invisible sprite
@@ -6361,7 +6516,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
// RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1",
// I am leaving the prefixes solely for clarity to programmers,
// because sadly no one remembers this place while searching for full state names.
const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
"MT_NULL",
"MT_UNKNOWN",
@@ -7152,7 +7307,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
#endif
};
const char *const MOBJFLAG_LIST[] = {
static const char *const MOBJFLAG_LIST[] = {
"SPECIAL",
"SOLID",
"SHOOTABLE",
@@ -7188,7 +7343,7 @@ const char *const MOBJFLAG_LIST[] = {
};
// \tMF2_(\S+).*// (.+) --> \t"\1", // \2
const char *const MOBJFLAG2_LIST[] = {
static const char *const MOBJFLAG2_LIST[] = {
"AXIS", // It's a NiGHTS axis! (For faster checking)
"TWOD", // Moves like it's in a 2D level
"DONTRESPAWN", // Don't respawn this object!
@@ -7221,7 +7376,7 @@ const char *const MOBJFLAG2_LIST[] = {
NULL
};
const char *const MOBJEFLAG_LIST[] = {
static const char *const MOBJEFLAG_LIST[] = {
"ONGROUND", // The mobj stands on solid floor (not on another mobj or in air)
"JUSTHITFLOOR", // The mobj just hit the floor while falling, this is cleared on next frame
"TOUCHWATER", // The mobj stands in a sector with water, and touches the surface
@@ -7239,14 +7394,14 @@ const char *const MOBJEFLAG_LIST[] = {
NULL
};
const char *const MAPTHINGFLAG_LIST[4] = {
static const char *const MAPTHINGFLAG_LIST[4] = {
NULL,
"OBJECTFLIP", // Reverse gravity flag for objects.
"OBJECTSPECIAL", // Special flag used with certain objects.
"AMBUSH" // Deaf monsters/do not react to sound.
};
const char *const PLAYERFLAG_LIST[] = {
static const char *const PLAYERFLAG_LIST[] = {
// Flip camera angle with gravity flip prefrence.
"FLIPCAM",
@@ -7318,7 +7473,7 @@ const char *const PLAYERFLAG_LIST[] = {
};
// Linedef flags
const char *const ML_LIST[16] = {
static const char *const ML_LIST[16] = {
"IMPASSIBLE",
"BLOCKMONSTERS",
"TWOSIDED",
@@ -7339,7 +7494,7 @@ const char *const ML_LIST[16] = {
// This DOES differ from r_draw's Color_Names, unfortunately.
// Also includes Super colors
const char *COLOR_ENUMS[] = { // Rejigged for Kart.
static const char *COLOR_ENUMS[] = { // Rejigged for Kart.
"NONE", // SKINCOLOR_NONE
"WHITE", // SKINCOLOR_WHITE
"SILVER", // SKINCOLOR_SILVER
@@ -7507,7 +7662,7 @@ const char *COLOR_ENUMS[] = { // Rejigged for Kart.
"CSUPER5" // SKINCOLOR_CSUPER5,
};
const char *const POWERS_LIST[] = {
static const char *const POWERS_LIST[] = {
"INVULNERABILITY",
"SNEAKERS",
"FLASHING",
@@ -7542,7 +7697,7 @@ const char *const POWERS_LIST[] = {
"INGOOP" // In goop
};
const char *const KARTSTUFF_LIST[] = {
static const char *const KARTSTUFF_LIST[] = {
"POSITION",
"OLDPOSITION",
"POSITIONDELAY",
@@ -7629,7 +7784,7 @@ const char *const KARTSTUFF_LIST[] = {
"GROWCANCEL"
};
const char *const HUDITEMS_LIST[] = {
static const char *const HUDITEMS_LIST[] = {
"LIVESNAME",
"LIVESPIC",
"LIVESNUM",
@@ -8542,16 +8697,6 @@ static int lua_enumlib_mariomode_get(lua_State *L)
return 1;
}
static int lua_enumlib_replayfreecam_get(lua_State *L)
{
if (dedicated) // huh?
lua_pushboolean(L, false);
else
lua_pushboolean(L, camera[R_GetViewNumber()].freecam);
return 1;
}
static int lua_enumlib_twodlevel_get(lua_State *L)
{
lua_pushboolean(L, twodlevel);
@@ -8985,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.");
@@ -9008,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.");
@@ -9046,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);
@@ -9156,6 +9298,7 @@ int LUA_EnumLib(lua_State *L)
PUSHGETTER(globalweather, u8);
PUSHGETTER(levelskynum, i32);
PUSHGETTER(globallevelskynum, i32);
PUSHGETTER((*mapmusname), str);
PUSHGETTER(mapmusflags, u16);
PUSHGETTER(mapmusposition, u32);
PUSHGETTER(gravity, fxp);
@@ -9172,11 +9315,6 @@ int LUA_EnumLib(lua_State *L)
PUSHGETTER(racecountdown, u32);
PUSHGETTER(exitcountdown, u32);
lua_pushcfunction(L, lua_glib_new_getter);
lua_pushliteral(L, "mapmusname");
lua_glib_push_str_getter(L, mapmusname);
lua_call(L, 2, 0);
lua_pushcfunction(L, lua_glib_new_getter);
lua_pushliteral(L, "mariomode");
lua_pushcfunction(L, lua_enumlib_mariomode_get);
@@ -9227,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_pushcfunction(L, lua_enumlib_replayfreecam_get);
lua_call(L, 2, 0);
if (!mathlib)
{
lua_pushcfunction(L, lua_glib_new_getter);
@@ -9289,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;
}
}
+12 -19
View File
@@ -14,26 +14,20 @@
#define __DEHACKED_H__
#include "m_fixed.h" // for get_number
#include "info.h"
// Free slot names
// The crazy word-reading stuff uses these.
extern char *FREE_STATES[NUMSTATEFREESLOTS];
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
extern UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
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;
extern const char *const STATE_LIST[];
extern const char *const MOBJTYPE_LIST[];
extern const char *const MOBJFLAG_LIST[];
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
extern const char *const MOBJEFLAG_LIST[];
extern const char *const MAPTHINGFLAG_LIST[4];
extern const char *const PLAYERFLAG_LIST[];
extern const char *const ML_LIST[]; // Linedef flags
extern const char *COLOR_ENUMS[];
extern const char *const POWERS_LIST[];
extern const char *const KARTSTUFF_LIST[];
extern const char *const HUDITEMS_LIST[];
#define DEH_WriteUndoline(a,b,c)
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
@@ -47,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 -52
View File
@@ -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.2"
#define VERSIONSTRINGW L"Saturn v7.2"
#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);
@@ -522,22 +521,6 @@ extern boolean capslock;
// i_system.c, replace getchar() once the keyboard has been appropriated
INT32 I_GetKey(void);
/* http://www.cse.yorku.ca/~oz/hash.html */
static inline
UINT32 quickncasehash (const char *p, size_t n)
{
size_t i = 0;
UINT32 x = 5381;
while (i < n && p[i])
{
x = (x * 33) ^ tolower(p[i]);
i++;
}
return x;
}
#ifndef min // Double-Check with WATTCP-32's cdefs.h
#define min(x, y) (((x) < (y)) ? (x) : (y))
#endif
@@ -545,10 +528,6 @@ UINT32 quickncasehash (const char *p, size_t n)
#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
@@ -584,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
+2 -14
View File
@@ -112,6 +112,7 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
extern boolean nodrawers;
extern boolean noblit;
extern boolean lastdraw;
extern postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
extern INT32 viewwindowx, viewwindowy;
@@ -122,7 +123,6 @@ extern boolean gamedataloaded;
// Player taking events, and displaying.
extern INT32 consoleplayer;
extern INT32 displayplayers[MAXSPLITSCREENPLAYERS];
extern INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
// Maps of special importance
extern INT16 spstage_start;
@@ -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.
// =====================================
+8 -30
View File
@@ -344,12 +344,14 @@ typedef union FColorRGBA RGBA_t;
typedef enum
{
POSTIMG_WATER = 1, // Underwater screen effect.
POSTIMG_MOTION = 1<<1, // Unused motion blur effect.
POSTIMG_FLIP = 1<<2, // Flipcam screen effect.
POSTIMG_HEAT = 1<<3, // Heatwave screen effect.
POSTIMG_MIRROR = 1<<4, // encore screen effect.
} postimgflag_t;
postimg_none,
postimg_water,
postimg_motion,
postimg_flip,
postimg_heat,
postimg_mirror,
postimg_mirrorflip
} postimg_t;
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
#define LUMPERROR UINT32_MAX
@@ -365,30 +367,6 @@ typedef UINT32 tic_t;
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
#endif
#define TOSTR(x) #x
typedef UINT8 bitarray_t;
#define BIT_ARRAY_SIZE(n) (((n) + 7) >> 3)
static inline int
in_bit_array (const bitarray_t * const array, const int value)
{
return (array[value >> 3] & (1<<(value & 7)));
}
static inline void
set_bit_array (bitarray_t * const array, const int value)
{
array[value >> 3] |= (1<<(value & 7));
}
static inline void
unset_bit_array (bitarray_t * const array, const int value)
{
array[value >> 3] &= ~(1<<(value & 7));
}
typedef UINT64 precise_t;
#endif //__DOOMTYPE__
+5 -5
View File
@@ -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);
+16 -15
View File
@@ -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 */
@@ -327,8 +329,7 @@ char menupath[1024];
size_t menupathindex[menudepth];
size_t menudepthleft = menudepth;
char menusearchbuf[MAXSTRINGLENGTH+1];
textinput_t menusearch;
char menusearch[MAXSTRINGLENGTH+1];
char **dirmenu, **coredirmenu; // core only local for this file
size_t sizedirmenu, sizecoredirmenu; // ditto
@@ -381,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
@@ -391,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)
@@ -418,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
@@ -446,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))
{
@@ -498,7 +499,7 @@ static boolean filemenucmp(char *haystack, char *needle)
strupr(localhaystack);
if (cv_addons_search_type.value)
return (strstr(localhaystack, needle) != 0);
return (!strncmp(localhaystack, needle, menusearch.length));
return (!strncmp(localhaystack, needle, menusearch[0]));
}
void closefilemenu(boolean validsize)
@@ -564,7 +565,7 @@ void searchfilemenu(char *tempname)
first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP...
if (!menusearch.length)
if (!menusearch[0])
{
if (dirmenu)
Z_Free(dirmenu);
@@ -591,7 +592,7 @@ void searchfilemenu(char *tempname)
return;
}
strcpy(localmenusearch, menusearch.buffer);
strcpy(localmenusearch, menusearch+1);
if (!cv_addons_search_case.value)
strupr(localmenusearch);
@@ -653,7 +654,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
}
else
M_TextInputInit(&menusearch, menusearchbuf, MAXSTRINGLENGTH+1);
menusearch[0] = menusearch[1] = 0; // clear search
if (!(dirhandle = opendir(menupath))) // get directory
{
+1 -3
View File
@@ -7,7 +7,6 @@
#include "doomdef.h"
#include "d_netfil.h"
#include "m_menu.h" // MAXSTRINGLENGTH
#include "m_textinput.h"
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
@@ -35,8 +34,7 @@ extern char menupath[1024];
extern size_t menupathindex[menudepth];
extern size_t menudepthleft;
extern char menusearchbuf[MAXSTRINGLENGTH+1];
extern textinput_t menusearch;
extern char menusearch[MAXSTRINGLENGTH+1];
extern char **dirmenu;
extern size_t sizedirmenu;
+1155 -803
View File
File diff suppressed because it is too large. Load diff
+20 -26
View File
@@ -17,8 +17,6 @@
#include "doomdef.h"
#include "doomstat.h"
#include "d_event.h"
#include "p_saveg.h"
#include "m_textinput.h"
extern char gamedatafilename[64];
extern char timeattackfolder[64];
@@ -34,19 +32,18 @@ extern INT32 player_name_changes[MAXPLAYERS];
extern player_t players[MAXPLAYERS];
extern boolean playeringame[MAXPLAYERS];
extern savebuffer_t demobuf;
extern UINT8 *demo_p;
// ======================================
// DEMO playback/recording related stuff.
// ======================================
// 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
@@ -121,21 +118,12 @@ extern consvar_t cv_pauseifunfocused;
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_lookbackaxis,cv_custom1axis,cv_custom2axis,cv_custom3axis,cv_xdeadzone,cv_ydeadzone;
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_lookbackaxis2,cv_custom1axis2,cv_custom2axis2,cv_custom3axis2,cv_xdeadzone2,cv_ydeadzone2;
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_lookbackaxis3,cv_custom1axis3,cv_custom2axis3,cv_custom3axis3,cv_xdeadzone3,cv_ydeadzone3;
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_custom1axis4,cv_custom2axis4,cv_custom3axis4,cv_xdeadzone4,cv_ydeadzone4;
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
// Hud offsets
@@ -176,6 +164,7 @@ extern consvar_t cv_saltysquish;
extern consvar_t cv_driftsparkpulse;
extern consvar_t cv_gravstretch;
extern consvar_t cv_sloperoll;
extern consvar_t cv_spriteroll;
extern consvar_t cv_sliptideroll;
extern consvar_t cv_slamsound;
extern consvar_t cv_sloperolldist;
@@ -229,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
//
@@ -275,9 +262,9 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost);
// A normal game starts at map 1, but a warp test can start elsewhere
void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar,
UINT8 ssplayers, boolean FLS);
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.
@@ -364,7 +351,6 @@ extern demoghost *ghosts;
#define DFILE_ERROR_CANNOTLOAD 0x04 // Files are missing and cannot be loaded.
#define DFILE_ERROR_EXTRAFILES 0x05 // Extra files outside of the replay's file list are loaded.
void G_ResetDemoRecording(void);
void G_DoPlayDemo(char *defdemoname);
void G_TimeDemo(const char *name);
void G_AddGhost(char *defdemoname);
@@ -428,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);
@@ -438,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);
-218
View File
@@ -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,133 +812,10 @@ static const char *gamecontrolname[num_gamecontrols] =
"custom1",
"custom2",
"custom3",
"director",
"freecam",
"camfloat",
"camsink",
};
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
#include "k_kart.h"
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 = cv_usejoystick[player].value;
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 = cv_usejoystick[player].value;
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 = cv_usejoystick[player].value;
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 = cv_usejoystick[i].value;
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 = cv_usejoystick[player].value;
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
@@ -1142,12 +930,6 @@ void G_Controldefault(UINT8 player)
//gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT
gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down
gamecontrol[gc_scores ][1] = KEY_HAT1+0; // D-Pad Up
gamecontrol[gc_camfloat ][0] = 'a';
gamecontrol[gc_camsink ][0] = 'd';
gamecontrol[gc_camfloat ][1] = KEY_JOY1+0; // A
gamecontrol[gc_camsink ][1] = KEY_JOY1+1; // B
}
if (player == 0 || player == 2)
-14
View File
@@ -15,7 +15,6 @@
#define __G_INPUT__
#include "d_event.h"
#include "doomstat.h"
#include "keys.h"
#include "command.h"
@@ -99,10 +98,6 @@ typedef enum
gc_custom1, // Lua scriptable
gc_custom2, // Lua scriptable
gc_custom3, // Lua scriptable
gc_director,
gc_freecam, // Toggle for freecam while ingame
gc_camfloat, // alternative button for raising cam
gc_camsink, // alternative button for sinking
num_gamecontrols
} gamecontrols_e;
@@ -110,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
@@ -137,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);
+89 -92
View File
@@ -15,10 +15,9 @@
#include "hw_main.h"
#include "../i_system.h"
#include "../doomdef.h"
#include "../qs22j.h"
// The texture for the next polygon given to HWR_ProcessPolygon.
// Set with HWR_SetCurrentTexture.
GLMipmap_t *current_texture = NULL;
@@ -36,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,37 +46,35 @@ int unsortedVertexArrayAllocSize = 65536;
// Call HWR_RenderBatches to render all the collected geometry.
void HWR_StartBatching(void)
{
if (currently_batching)
{
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
}
if (currently_batching)
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
// init arrays if that has not been done yet
// init arrays if that has not been done yet
if (!finalVertexArray)
{
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));
}
currently_batching = true;
currently_batching = true;
}
// This replaces the direct calls to GL_SetTexture in cases where batching is available.
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
// The texture selection is saved for the next HWR_ProcessPolygon call.
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
void HWR_SetCurrentTexture(GLMipmap_t *texture)
{
if (currently_batching)
{
current_texture = texture;
}
else
{
GL_SetTexture(texture);
}
if (currently_batching)
{
current_texture = texture;
}
else
{
HWD.pfnSetTexture(texture);
}
}
// If batching is enabled, this function collects the polygon data and the chosen texture
@@ -85,7 +82,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
// render the polygon immediately.
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader_target, boolean horizonSpecial)
{
if (currently_batching)
if (currently_batching)
{
if (!pSurf)
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
@@ -99,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)
@@ -130,15 +127,17 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
}
else
{
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
}
}
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;
@@ -156,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
@@ -185,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;
@@ -204,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;
@@ -221,14 +222,14 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
// the rendering backend to draw them.
void HWR_RenderBatches(void)
{
int finalVertexWritePos = 0;// position in finalVertexArray
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;
GLMipmap_t *currentTexture = NULL;
GLMipmap_t *currentTexture;
GLMipmap_t *nextTexture = NULL;
FBITFIELD currentPolyFlags = 0;
FBITFIELD nextPolyFlags = 0;
@@ -237,7 +238,7 @@ void HWR_RenderBatches(void)
int i;
if (!currently_batching)
if (!currently_batching)
I_Error("HWR_RenderBatches called without starting batching");
nextSurfaceInfo.LightInfo.fade_end = 0;
@@ -257,21 +258,19 @@ 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_glshaders.value && gl_shadersavailable)
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
if (cv_grshaders.value && gr_shadersavailable)
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
// 2. texture
@@ -281,24 +280,24 @@ 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.
// set state for first batch
if (cv_glshaders.value && gl_shadersavailable)
if (cv_grshaders.value && gr_shadersavailable)
{
GL_SetShader(currentShader);
HWD.pfnSetShader(currentShader);
}
if (currentPolyFlags & PF_NoTexture)
currentTexture = NULL;
else
GL_SetTexture(currentTexture);
else
HWD.pfnSetTexture(currentTexture);
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
{
@@ -323,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
@@ -345,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;
@@ -365,14 +364,14 @@ 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_glshaders.value && gl_shadersavailable)
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable)
{
changeState = true;
changeShader = true;
@@ -387,7 +386,7 @@ void HWR_RenderBatches(void)
changeState = true;
changePolyFlags = true;
}
if (cv_glshaders.value && gl_shadersavailable)
if (cv_grshaders.value && gr_shadersavailable)
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
@@ -413,7 +412,7 @@ void HWR_RenderBatches(void)
if (changeState || stopFlag)
{
// execute draw call
GL_DrawIndexedTriangles(&currentSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
HWD.pfnDrawIndexedTriangles(&currentSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
// update stats
ps_hw_numcalls.value.i++;
ps_hw_numverts.value.i += finalIndexWritePos;
@@ -427,41 +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)
{
GL_SetShader(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 GL_SetTexture during batch collection
GL_SetTexture(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?
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;
@@ -470,4 +466,5 @@ void HWR_RenderBatches(void)
PS_STOP_TIMING(ps_hw_batchdrawtime);
}
#endif // HWRENDER
+2 -4
View File
@@ -15,11 +15,9 @@
#include "hw_defs.h"
#include "hw_data.h"
#include "hw_gl.h"
#include "hw_drv.h"
extern boolean currently_batching;
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
+16 -26
View File
@@ -46,7 +46,7 @@ typedef struct
// when loading the map, this is set to true if portals are found.
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
boolean gl_maphasportals = false;
boolean gr_maphasportals = false;
// ==========================================================================
// FLOOR & CEILING CONVEX POLYS GENERATION
@@ -371,14 +371,14 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
line_t *line = lseg->linedef;
// portal check
if (!gl_maphasportals && line->special == 40 && lseg->side == 0)
if (!gr_maphasportals && line->special == 40 && lseg->side == 0)
{
// Find the other side!
INT32 line2 = P_FindSpecialLineFromTag(40, line->tag, -1);
if (line == &lines[line2])
line2 = P_FindSpecialLineFromTag(40, line->tag, line2);
if (line2 >= 0) // found it!
gl_maphasportals = 1;
gr_maphasportals = 1;
}
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
@@ -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
@@ -768,7 +762,7 @@ static INT32 SolveTProblem(void)
INT32 i;
size_t l;
if (cv_glsolvetjoin.value == 0)
if (cv_grsolvetjoin.value == 0)
return 0;
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
@@ -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;
@@ -905,7 +895,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
#endif
// reset the portal flag
gl_maphasportals = 0;
gr_maphasportals = 0;
// find min/max boundaries of map
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
@@ -923,9 +913,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
// allocate table for back to front drawing of subsectors
/*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
if (!gl_drawsubsectors)
I_Error("couldn't malloc gl_drawsubsectors\n");*/
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors);
if (!gr_drawsubsectors)
I_Error("couldn't malloc gr_drawsubsectors\n");*/
// number of the first new subsector that might be added
addsubsector = numsubsectors;
+194 -204
View File
@@ -14,10 +14,9 @@
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_gl.h"
#include "hw_drv.h"
#include "hw_batching.h"
#include "../doomstat.h" //gamemode
@@ -55,10 +54,10 @@ static INT32 format2bpp(GLTextureFormat_t format)
// It is now split from it for my sanity! (and the sanity of others)
// -- Monster Iestyn (13/02/19)
static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap,
INT32 pblockheight, INT32 blockmodulo,
fixed_t yfracstep, fixed_t scale_y,
texpatch_t *originPatch, INT32 patchheight,
INT32 bpp, RGBA_t *palette)
INT32 pblockheight, INT32 blockmodulo,
fixed_t yfracstep, fixed_t scale_y,
texpatch_t *originPatch, INT32 patchheight,
INT32 bpp, RGBA_t *palette)
{
fixed_t yfrac, position, count;
UINT8 *dest;
@@ -74,9 +73,6 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
(void)patchheight; // This parameter is unused
if (!mipmap)
return;
if (originPatch) // originPatch can be NULL here, unlike in the software version
originy = originPatch->originy;
@@ -112,14 +108,14 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
count--;
texel = source[yfrac>>FRACBITS];
alpha = 0xFF;
alpha = 0xff;
// Make pixel transparent if chroma keyed
if ((mipmap && mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
//Hurdler: not perfect, but better than holes
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
alpha = 0x00;
//Hurdler: 25/04/2000: now support colormap in hardware mode
if (mipmap && mipmap->colormap)
if (mipmap->colormap)
texel = mipmap->colormap[texel];
// hope compiler will get this switch out of the loops (dreams...)
@@ -127,8 +123,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
// Alam: SRB2 uses Mingw, HUGS
switch (bpp)
{
case 2 : // uhhhhhhhh..........
texelu16 = (UINT16)((alpha<<8) | texel);
case 2 : texelu16 = (UINT16)((alpha<<8) | texel);
memcpy(dest, &texelu16, sizeof(UINT16));
break;
case 3 : colortemp = palette[texel];
@@ -146,7 +141,6 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
dest += blockmodulo;
yfrac += yfracstep;
}
patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4);
}
}
@@ -172,7 +166,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
if (pwidth <= 0 || pheight <= 0)
return;
palette = HWR_GetTexturePalette();
ncols = pwidth;
@@ -188,7 +182,6 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
// NOTE: should this actually be pblockwidth*bpp?
blockmodulo = pblockwidth*bpp;
// Draw each column to the block cache
@@ -223,7 +216,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (texture->width <= 0 || texture->height <= 0)
return;
palette = HWR_GetTexturePalette();
x1 = patch->originx;
@@ -267,7 +260,6 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawTexturePatchInCache: no drawer defined for this bpp (%d)\n",bpp);
// NOTE: should this actually be pblockwidth*bpp?
blockmodulo = pblockwidth*bpp;
// Draw each column to the block cache
@@ -283,15 +275,15 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
}
}
static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
{
UINT8 *block;
INT32 bpp, i;
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
INT32 blocksize = (glMipmap->width * glMipmap->height);
INT32 blocksize = (grMipmap->width * grMipmap->height);
bpp = format2bpp(glMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(glMipmap->data));
bpp = format2bpp(grMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
switch (bpp)
{
@@ -311,7 +303,7 @@ static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
// Create a composite texture from patches, adapt the texture size to a power of 2
// height and width for the hardware texture cache.
//
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noencore)
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noencore)
{
UINT8 *block;
texture_t *texture;
@@ -321,7 +313,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
INT32 i;
boolean skyspecial = false; //poor hack for Legacy large skies..
RGBA_t *palette;
palette = HWR_GetTexturePalette();
@@ -336,30 +328,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
)
{
skyspecial = true;
gltex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
grtex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
}
else
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
gltex->mipmap.width = (UINT16)(texture->width);
gltex->mipmap.height = (UINT16)(texture->height);
grtex->mipmap.width = (UINT16)texture->width;
grtex->mipmap.height = (UINT16)texture->height;
if (skyspecial)
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
grtex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
else
gltex->mipmap.format = textureformat;
grtex->mipmap.format = textureformat;
gltex->mipmap.colormap = colormaps;
grtex->mipmap.colormap = colormaps;
#ifdef GLENCORE
if (encoremap && !noencore)
gltex->mipmap.colormap += COLORMAP_REMAPOFFSET;
grtex->mipmap.colormap += COLORMAP_REMAPOFFSET;
#endif
blockwidth = texture->width;
blockheight = texture->height;
blocksize = (blockwidth * blockheight);
block = MakeBlock(&gltex->mipmap);
block = MakeBlock(&grtex->mipmap);
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
{
@@ -367,17 +359,14 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
RGBA_t col;
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
for (j = 0; j < blockheight; j++)
{
for (i = 0; i < blockwidth; i++)
{
int idx = (j*blockwidth+i);
block[4*idx+0] = col.s.red;
block[4*idx+1] = col.s.green;
block[4*idx+2] = col.s.blue;
block[4*idx+3] = 0xff;
block[4*(j*blockwidth+i)+0] = col.s.red;
block[4*(j*blockwidth+i)+1] = col.s.green;
block[4*(j*blockwidth+i)+2] = col.s.blue;
block[4*(j*blockwidth+i)+3] = 0xff;
}
}
}
@@ -386,81 +375,85 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
{
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
HWR_DrawTexturePatchInCache(&grtex->mipmap,
blockwidth, blockheight,
texture, patch,
realpatch);
Z_Unlock(realpatch);
}
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
if (format2bpp(gltex->mipmap.format) == 4)
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;
gltex->mipmap.flags |= TF_TRANSPARENT;
break;
if (block[i] == 0)
{
grtex->mipmap.flags |= TF_TRANSPARENT;
break;
}
}
}
gltex->scaleX = 1.0f/(texture->width*FRACUNIT);
gltex->scaleY = 1.0f/(texture->height*FRACUNIT);
grtex->scaleX = 1.0f/(texture->width*FRACUNIT);
grtex->scaleY = 1.0f/(texture->height*FRACUNIT);
}
// patch may be NULL if glMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
{
// don't do it twice (like a cache)
if (glMipmap->width == 0)
if (grMipmap->width == 0)
{
// save the original patch header so that the GLPatch can be casted
// into a standard patch_t struct and the existing code can get the
// orginal patch dimensions and offsets.
glPatch->width = SHORT(patch->width);
glPatch->height = SHORT(patch->height);
glPatch->leftoffset = SHORT(patch->leftoffset);
glPatch->topoffset = SHORT(patch->topoffset);
grPatch->width = SHORT(patch->width);
grPatch->height = SHORT(patch->height);
grPatch->leftoffset = SHORT(patch->leftoffset);
grPatch->topoffset = SHORT(patch->topoffset);
glMipmap->width = glMipmap->height = 1;
while (glMipmap->width < glPatch->width) glMipmap->width <<= 1;
while (glMipmap->height < glPatch->height) glMipmap->height <<= 1;
//grMipmap->width = (UINT16)SHORT(patch->width);
//grMipmap->height = (UINT16)SHORT(patch->height);
grMipmap->width = grMipmap->height = 1;
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
// no wrap around, no chroma key
glMipmap->flags = 0;
grMipmap->flags = 0;
// setup the texture info
glMipmap->format = patchformat;
//glPatch->max_s = glPatch->max_t = 1.0f;
glPatch->max_s = (float)glPatch->width / (float)glMipmap->width;
glPatch->max_t = (float)glPatch->height / (float)glMipmap->height;
grMipmap->format = patchformat;
//grPatch->max_s = grPatch->max_t = 1.0f;
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
}
Z_Free(glMipmap->data);
glMipmap->data = NULL;
Z_Free(grMipmap->data);
grMipmap->data = NULL;
if (makebitmap)
{
MakeBlock(glMipmap);
HWR_DrawPatchInCache(glMipmap,
glMipmap->width, glMipmap->height,
glPatch->width, glPatch->height,
MakeBlock(grMipmap);
HWR_DrawPatchInCache(grMipmap,
grMipmap->width, grMipmap->height,
grPatch->width, grPatch->height,
patch);
}
//grPatch->max_s = grPatch->max_t = 1.0f;
}
// =================================================
// CACHING HANDLING
// =================================================
static size_t gl_numtextures;
static GLMapTexture_t *gl_textures; // For all textures
static size_t gr_numtextures;
static GLMapTexture_t *gr_textures; // For all textures
void HWR_InitTextureCache(void)
{
gl_numtextures = 0;
gl_textures = NULL;
gr_numtextures = 0;
gr_textures = NULL;
}
// Callback function for HWR_FreeTextureCache.
@@ -500,7 +493,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
if (next->data)
Z_Free(next->data);
next->data = NULL;
GL_DeleteTexture(next);
HWD.pfnDeleteTexture(next);
// Free the old colormap mipmap from memory.
free(next);
@@ -511,7 +504,7 @@ void HWR_FreeMipmapCache(void)
{
INT32 i;
// free references to the textures
GL_ClearMipMapCache();
HWD.pfnClearMipMapCache();
// free all hardware-converted graphics cached in the heap
// our gool is only the textures since user of the texture is the texture cache
@@ -532,10 +525,10 @@ void HWR_FreeTextureCache(void)
// now the heap don't have any 'user' pointing to our
// texturecache info, we can free it
if (gl_textures)
free(gl_textures);
gl_textures = NULL;
gl_numtextures = 0;
if (gr_textures)
free(gr_textures);
gr_textures = NULL;
gr_numtextures = 0;
}
void HWR_LoadTextures(size_t pnumtextures)
@@ -543,13 +536,13 @@ void HWR_LoadTextures(size_t pnumtextures)
// we must free it since numtextures changed
HWR_FreeTextureCache();
gl_numtextures = pnumtextures;
gr_numtextures = pnumtextures;
#ifdef GLENCORE
gl_textures = calloc(pnumtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
gr_textures = calloc(pnumtextures, sizeof (*gr_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
#else
gl_textures = calloc(pnumtextures, sizeof (*gl_textures));
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
#endif
if (gl_textures == NULL)
if (gr_textures == NULL)
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
}
@@ -558,9 +551,9 @@ void HWR_LoadTextures(size_t pnumtextures)
// --------------------------------------------------------------------------
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
{
GLMapTexture_t *gltex;
GLMapTexture_t *grtex;
if (tex < 0 || tex >= (signed)gl_numtextures)
if (tex < 0 || tex >= (signed)gr_numtextures)
{
#ifdef PARANOIA
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
@@ -569,25 +562,26 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
#endif
}
#ifdef GLENCORE
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
grtex = &gr_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
#else
gltex = &gl_textures[tex];
grtex = &gr_textures[tex];
#endif
if (!gltex->mipmap.data && !gltex->mipmap.downloaded)
HWR_GenerateTexture(tex, gltex, noencore);
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_GenerateTexture(tex, grtex, noencore);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!gltex->mipmap.downloaded)
GL_SetTexture(&gltex->mipmap);
HWR_SetCurrentTexture(&gltex->mipmap);
if (!grtex->mipmap.downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now.
Z_ChangeTag(gltex->mipmap.data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
return gltex;
return grtex;
}
static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
{
#ifdef GLENCORE
UINT8 *flat;
@@ -596,8 +590,8 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
size_t size, pflatsize;
// setup the texture info
glMipmap->format = GL_TEXFMT_P_8;
glMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
size = W_LumpLength(flatlumpnum);
@@ -625,140 +619,135 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
pflatsize = 64;
break;
}
glMipmap->width = (UINT16)pflatsize;
glMipmap->height = (UINT16)pflatsize;
grMipmap->width = (UINT16)pflatsize;
grMipmap->height = (UINT16)pflatsize;
// the flat raw data needn't be converted with palettized textures
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
PU_HWRCACHE, &glMipmap->data));
PU_HWRCACHE, &grMipmap->data));
#ifdef GLENCORE
flat = glMipmap->data;
flat = grMipmap->data;
for (steppy = 0; steppy < size; steppy++)
{
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
continue;
flat[steppy] = glMipmap->colormap[flat[steppy]];
}
if (flat[steppy] != HWR_PATCHES_CHROMAKEY_COLORINDEX)
flat[steppy] = grMipmap->colormap[flat[steppy]];
#endif
}
// Download a Doom 'flat' to the hardware cache and make it ready for use
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
GLMipmap_t *glMipmap;
GLMipmap_t *grmip;
if (flatlumpnum == LUMPERROR)
return;
glMipmap = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
glMipmap->colormap = colormaps;
grmip->colormap = colormaps;
#ifdef GLENCORE
if (!noencoremap && encoremap)
glMipmap->colormap += COLORMAP_REMAPOFFSET;
grmip->colormap += COLORMAP_REMAPOFFSET;
#endif
if (!glMipmap->downloaded && !glMipmap->data)
HWR_CacheFlat(glMipmap, flatlumpnum);
if (!grmip->downloaded && !grmip->data)
HWR_CacheFlat(grmip, flatlumpnum);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glMipmap->downloaded)
GL_SetTexture(glMipmap);
HWR_SetCurrentTexture(glMipmap);
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now.
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
}
//
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
// : load it first in doom cache if not already
//
static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
{
if (!glMipmap->downloaded && !glMipmap->data)
if (!grmip->downloaded && !grmip->data)
{
patch_t *patch = glPatch->rawpatch;
patch_t *patch = gpatch->rawpatch;
if (!patch)
patch = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
HWR_MakePatch(patch, glPatch, glMipmap, true);
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
HWR_MakePatch(patch, gpatch, grmip, true);
// You can't free rawpatch for some reason?
// (Obviously I can't, sprite rotation needs that...)
if (!glPatch->rawpatch)
if (!gpatch->rawpatch)
Z_Free(patch);
}
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glMipmap->downloaded)
GL_SetTexture(glMipmap);
HWR_SetCurrentTexture(glMipmap);
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
// The system-memory data can be purged now.
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use
// -----------------+
void HWR_GetPatch(GLPatch_t *glPatch)
void HWR_GetPatch(GLPatch_t *gpatch)
{
// is it in hardware cache
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
{
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
// flush the software patch before the conversion! oh yeah I suffered
patch_t *ptr = glPatch->rawpatch;
patch_t *ptr = gpatch->rawpatch;
if (!ptr)
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, true);
ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
// this is inefficient.. but the hardware patch in heap is purgeable so it should
// not fragment memory, and besides the REAL cache here is the hardware memory
if (!glPatch->rawpatch)
if (!gpatch->rawpatch)
Z_Free(ptr);
}
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glPatch->mipmap->downloaded)
GL_SetTexture(glPatch->mipmap);
HWR_SetCurrentTexture(glPatch->mipmap);
if (!gpatch->mipmap->downloaded)
HWD.pfnSetTexture(gpatch->mipmap);
HWR_SetCurrentTexture(gpatch->mipmap);
// The system-memory patch data can be purged now.
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
}
// -------------------+
// HWR_GetMappedPatch : Same as HWR_GetPatch for sprite color
// -------------------+
void HWR_GetMappedPatch(GLPatch_t *glPatch, const UINT8 *colormap)
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
{
GLMipmap_t *glMipmap, *newMipmap;
GLMipmap_t *grmip, *newmip;
// Blatant hack for encore colormapping aside...
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
{
// Load the default (green) color in doom cache (temporary?) AND hardware cache
HWR_GetPatch(glPatch);
HWR_GetPatch(gpatch);
return;
}
// search for the mipmap
// search for the mimmap
// skip the first (no colormap translated)
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
{
glMipmap = glMipmap->nextcolormap;
if (glMipmap->colormap != colormap)
continue;
HWR_LoadMappedPatch(glMipmap, glPatch);
return;
grmip = grmip->nextcolormap;
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
@@ -767,38 +756,38 @@ void HWR_GetMappedPatch(GLPatch_t *glPatch, const UINT8 *colormap)
// (it have a liste of mipmap)
// this malloc is cleared in HWR_FreeTextureCache
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
newMipmap = calloc(1, sizeof (*newMipmap));
if (newMipmap == NULL)
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
glMipmap->nextcolormap = newMipmap;
grmip->nextcolormap = newmip;
newMipmap->colormap = colormap;
HWR_LoadMappedPatch(newMipmap, glPatch);
newmip->colormap = colormap;
HWR_LoadMappedPatch(newmip, gpatch);
}
void HWR_UnlockCachedPatch(GLPatch_t *glPatch)
void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
{
if (!glPatch)
if (!gpatch)
return;
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
}
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
{
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
GLPatch_t *glPatch;
GLPatch_t *grpatch;
if (!(glPatch = M_AATreeGet(hwrcache, lumpnum)))
if (!(grpatch = M_AATreeGet(hwrcache, lumpnum)))
{
glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
glPatch->wadnum = wadnum;
glPatch->lumpnum = lumpnum;
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, glPatch);
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grpatch->wadnum = wadnum;
grpatch->lumpnum = lumpnum;
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, grpatch);
}
return glPatch;
return grpatch;
}
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
@@ -846,14 +835,14 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
Z_Free(flat);
}
static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
{
size_t size;
UINT16 fmheight = 0, fmwidth = 0;
// setup the texture info
glMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
glMipmap->flags = 0;
grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
grMipmap->flags = 0;
size = W_LumpLength(fademasklumpnum);
@@ -882,28 +871,28 @@ static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
}
// Thankfully, this will still work for this scenario
glMipmap->width = fmwidth;
glMipmap->height = fmheight;
grMipmap->width = fmwidth;
grMipmap->height = fmheight;
MakeBlock(glMipmap);
MakeBlock(grMipmap);
HWR_DrawFadeMaskInCache(glMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
// I DO need to convert this because it isn't power of 2 and we need the alpha
}
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{
GLMipmap_t *glMipmap;
GLMipmap_t *grmip;
glMipmap = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!glMipmap->downloaded && !glMipmap->data)
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
if (!grmip->downloaded && !grmip->data)
HWR_CacheFadeMask(grmip, fademasklumpnum);
GL_SetTexture(glMipmap);
HWD.pfnSetTexture(grmip);
// The system-memory data can be purged now.
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
}
// =================================================
@@ -915,15 +904,15 @@ void HWR_SetPalette(RGBA_t *palette)
if (HWR_ShouldUsePaletteRendering())
{
// set the palette for palette postprocessing
if (cv_glpalettedepth.value == 16)
if (cv_grpalettedepth.value == 16)
{
// crush to 16-bit rgb565, like software currently does in the standard configuration
// Note: Software's screenshots have the 24-bit palette, but the screen gets
// the 16-bit version! For making comparison screenshots either use an external screenshot
// tool or set the palette depth to 24 bits.
RGBA_t crushed_palette[256];
for (int i = 0; i < 256; i++)
int i;
for (i = 0; i < 256; i++)
{
float fred = (float)(palette[i].s.red >> 3);
float fgreen = (float)(palette[i].s.green >> 2);
@@ -933,21 +922,21 @@ void HWR_SetPalette(RGBA_t *palette)
crushed_palette[i].s.blue = (UINT8)(fblue / 31.0f * 255.0f);
crushed_palette[i].s.alpha = 255;
}
GL_SetScreenPalette(crushed_palette);
HWD.pfnSetScreenPalette(crushed_palette);
}
else
{
GL_SetScreenPalette(palette);
HWD.pfnSetScreenPalette(palette);
}
// this part is responsible for keeping track of the palette OUTSIDE of a level.
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
HWR_SetMapPalette();
}
else
{
// set the palette for the textures
GL_SetPalette(palette);
HWD.pfnSetTexturePalette(palette);
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
memset(mapPalette, 0, sizeof(mapPalette));
// hardware driver will flush there own cache if cache is non paletized
@@ -980,7 +969,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
}
}
#undef STEP_SIZE
GL_SetPaletteLookup(lut);
HWD.pfnSetPaletteLookup(lut);
Z_Free(lut);
}
@@ -993,9 +982,11 @@ void HWR_SetMapPalette(void)
RGBA_t *palette;
int i;
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
{
// outside of a level, pLocalPalette should have PLAYPAL ready for us
// outside of a level, pMasterPalette should have PLAYPAL ready for us
//palette = pMasterPalette; // we dont have this in kart so just use pLocalPalette as before
palette = pLocalPalette;
}
else
@@ -1005,10 +996,8 @@ void HWR_SetMapPalette(void)
lumpnum_t lumpnum = W_GetNumForName(GetPalette());
size_t palsize = W_LumpLength(lumpnum);
UINT8 *RGB_data;
if (palsize < 768) // 256 * 3
I_Error("HWR_SetMapPalette: A programmer assumed palette lumps are at least 768 bytes long, but apparently this was a wrong assumption!\n");
RGB_data = W_CacheLumpNum(lumpnum, PU_CACHE);
// we got the RGB palette now, but we need it in RGBA format.
for (i = 0; i < 256; i++)
@@ -1028,7 +1017,7 @@ void HWR_SetMapPalette(void)
// in palette rendering mode, this means that all rgba textures now have wrong colors
// and the lookup table is outdated
HWR_SetPaletteLookup(mapPalette);
GL_SetPalette(mapPalette);
HWD.pfnSetTexturePalette(mapPalette);
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
{
@@ -1051,11 +1040,12 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
for (i = 0; i < 256 * 32; i++)
hw_lighttable[i] = palette[lighttable[i]];
id = GL_CreateLightTable(hw_lighttable);
id = HWD.pfnCreateLightTable(hw_lighttable);
Z_Free(hw_lighttable);
return id;
}
// get hwr lighttable id for colormap, create it if it doesn't already exist
UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
{
@@ -1087,7 +1077,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
void HWR_ClearLightTables(void)
{
if (vid.glstate == VID_GL_LIBRARY_LOADED)
GL_ClearLightTables();
HWD.pfnClearLightTables();
}
#endif //HWRENDER
+4 -4
View File
@@ -333,20 +333,20 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
// ok, this is a gross hack that barely works...
// but at least it doesn't overestimate too much...
clipfov = atan(1 / projMatrix[0]) * 360 / M_PIl;
clipfov = atan(1 / projMatrix[0]) * 360 / M_PI;
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
if (floatangle >= 180.0)
return 0xffffffff;
a1 = (angle_t)xs_CRoundToInt(ANG1 * 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
//
@@ -458,4 +458,4 @@ boolean gld_SphereInFrustum(float x, float y, float z, float radius)
}
return true;
}
#endif
#endif
+6 -7
View File
@@ -33,31 +33,30 @@ typedef enum GLTextureFormat_e
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
} GLTextureFormat_t;
// Texture information (misleadingly named "mipmap" all over the code.)
// The *data pointer holds the address of the graphics data cached in heap memory.
// NULL if the texture is not in SRB2's heap cache.
// data holds the address of the graphics data cached in heap memory
// NULL if the texture is not in Doom heap cache.
struct GLMipmap_s
{
// for UpdateTexture
GLTextureFormat_t format;
void *data;
UINT32 flags;
UINT16 width, height;
UINT32 downloaded; // The GPU has this texture.
UINT32 downloaded; // tex_downloaded
struct GLMipmap_s *nextmipmap;
struct GLMipmap_s *nextcolormap;
const UINT8 *colormap;
};
typedef struct GLMipmap_s GLMipmap_t;
//
// Level textures, as cached for hardware rendering.
// Doom texture info, as cached for hardware rendering
//
struct GLMapTexture_s
{
GLMipmap_t mipmap;
float scaleX; //used for scaling textures on walls
float scaleX; //used for scaling textures on walls
float scaleY;
};
typedef struct GLMapTexture_s GLMapTexture_t;
+14 -43
View File
@@ -121,6 +121,8 @@ typedef struct
poly_t *planepoly; // the generated convex polygon
} extrasubsector_t;
//here lies gr_vissprite
// Kart features
#define USE_FTRANSFORM_ANGLEZ
#define USE_FTRANSFORM_MIRROR
@@ -132,14 +134,14 @@ typedef struct
{
FLOAT x,y,z; // position
#ifdef USE_FTRANSFORM_ANGLEZ
FLOAT anglex, angley, anglez; // aimingangle / viewangle
FLOAT anglex2, anglez2; // secondaries
FLOAT anglex,angley,anglez; // aimingangle / viewangle
FLOAT anglex2,anglez2; // secondaries
#else
FLOAT anglex, angley; // aimingangle / viewangle
FLOAT anglex,angley; // aimingangle / viewangle
FLOAT anglex2; // secondaries
#endif
FLOAT scalex, scaley, scalez;
FLOAT spritexscale, spriteyscale;
FLOAT scalex,scaley,scalez;
FLOAT spritexscale,spriteyscale;
FLOAT fovxangle, fovyangle;
UINT8 splitscreen;
boolean flip; // screenflip
@@ -154,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
@@ -164,41 +166,6 @@ typedef struct
FLOAT s,t;
} FOutVector;
typedef struct vbo_vertex_s
{
float x, y, z;
float u, v;
unsigned char r, g, b, a;
} gl_skyvertex_t;
typedef enum gl_skyloopmode_e
{
HWD_SKYLOOP_FAN,
HWD_SKYLOOP_STRIP
} gl_skyloopmode_t;
typedef struct
{
gl_skyloopmode_t mode;
int vertexcount;
int vertexindex;
boolean use_texture;
} gl_skyloopdef_t;
typedef struct
{
unsigned int vbo;
int rows, columns;
int loopcount;
int detail, vertex_count;
int texture, width, height;
boolean rebuild; // VBO needs to be rebuilt
gl_skyloopdef_t *loops;
gl_skyvertex_t *data;
} gl_sky_t;
// Shader targets used to render specific types of geometry.
// A shader target is resolved to an actual shader with HWR_GetShaderFromTarget.
// The shader returned may be a base shader or a custom shader.
@@ -206,9 +173,10 @@ enum
{
SHADER_NONE = -1,
SHADER_FLOOR = 0,
SHADER_SHADOW,
SHADER_WALL,
SHADER_SPRITE,
SHADER_MODEL,
SHADER_SPRITE,
SHADER_WATER,
SHADER_FOG,
SHADER_SKY,
@@ -236,6 +204,7 @@ enum hwdshaderstage
typedef enum hwdshaderstage hwdshaderstage_t;
// ==========================================================================
// RENDER MODES
// ==========================================================================
@@ -320,6 +289,9 @@ typedef struct FSurfaceInfo FSurfaceInfo;
enum hwdsetspecialstate
{
#ifdef USE_FBO_OGL
HWD_SET_FRAMEBUFFER,
#endif
HWD_SET_SHADERS,
HWD_SET_TEXTUREFILTERMODE,
@@ -374,7 +346,6 @@ enum hwdscreentexture
HWD_SCREENTEXTURE_WIPE_END, // destination image for the wipe/fade effect
HWD_SCREENTEXTURE_GENERIC1, // underwater/heat effect, intermission background
HWD_SCREENTEXTURE_GENERIC2, // palette-based colormap fade, final screen texture
HWD_SCREENTEXTURE_VHS,
NUMSCREENTEXTURES, // (generic3 is unused if palette rendering is disabled)
};
typedef enum hwdscreentexture hwdscreentexture_t;
+48 -49
View File
@@ -18,10 +18,9 @@
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_gl.h"
#include "hw_drv.h"
#include "../m_misc.h" //FIL_WriteFile()
#include "../r_draw.h" //viewborderlump
@@ -123,7 +122,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
flags |= PF_ForceWrapY;
// clip it since it is used for bunny scroll in doom I
GL_DrawPolygon(NULL, v, 4, flags);
HWD.pfnDrawPolygon(NULL, v, 4, flags);
}
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
@@ -304,10 +303,10 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated;
GL_DrawPolygon(&Surf, v, 4, flags);
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
}
else
GL_DrawPolygon(NULL, v, 4, flags);
HWD.pfnDrawPolygon(NULL, v, 4, flags);
}
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
@@ -461,10 +460,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated;
GL_DrawPolygon(&Surf, v, 4, flags);
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
}
else
GL_DrawPolygon(NULL, v, 4, flags);
HWD.pfnDrawPolygon(NULL, v, 4, flags);
}
// ==========================================================================
@@ -540,7 +539,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
// BTW, I see we put 0 for PFs, and If I'm right, that
// means we take the previous PFs as default
// how can we be sure they are ok?
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
}
@@ -553,33 +552,33 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
// 0--1
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
{
FOutVector v[4];
FSurfaceInfo Surf;
FOutVector v[4];
FSurfaceInfo Surf;
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f;
v[0].y = v[1].y = -1.0f;
v[2].y = v[3].y = 1.0f;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f;
v[0].y = v[1].y = -1.0f;
v[2].y = v[3].y = 1.0f;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = 1.0f;
v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = 1.0f;
v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f;
if (color & 0xFF00) // Do COLORMAP fade.
{
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
if (color & 0xFF00) // Do COLORMAP fade.
{
if (HWR_ShouldUsePaletteRendering() && cv_grscreentextures.value)
{
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
Surf.LightTableId = HWR_GetLightTableID(NULL);
Surf.LightInfo.light_level = strength;
GL_MakeScreenTexture(scr_tex);
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
GL_UnSetShader();
HWD.pfnMakeScreenTexture(scr_tex);
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
HWD.pfnUnSetShader();
return;
}
@@ -589,21 +588,21 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
Surf.PolyColor.s.alpha = (strength*8);
poly_flags |= PF_Translucent;
}
}
else // Do TRANSMAP** fade.
{
}
else // Do TRANSMAP** fade.
{
RGBA_t *palette = HWR_GetTexturePalette();
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
if (HWR_ShouldUsePaletteRendering())
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
else
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
poly_flags |= PF_Translucent;
}
}
GL_DrawPolygon(&Surf, v, 4, poly_flags);
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
}
// Draw the console background with translucency support
@@ -630,7 +629,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
Surf.PolyColor.rgba = UINT2RGBA(color);
Surf.PolyColor.s.alpha = 0x80;
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
@@ -653,17 +652,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
INT32 basewindowx, basewindowy;
GLPatch_t *patch;
// if (gl_viewwidth == vid.width)
// if (gr_viewwidth == vid.width)
// return;
if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdupx));
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowx), vid.fdupx));
// top
HWR_DrawFlatFill(0, 0,
@@ -777,16 +776,16 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
F2DCoord v1, v2;
RGBA_t color_rgba;
RGBA_t *palette = HWR_GetTexturePalette();
color_rgba = palette[color&0xFF];
v1.x = ((float)fl->a.x-(vid.width/2.0f))*(2.0f/vid.width);
v1.y = ((float)fl->a.y-(vid.height/2.0f))*(2.0f/vid.height);
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
GL_Draw2DLine(&v1, &v2, color_rgba);
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
}
// -----------------+
@@ -880,7 +879,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
Surf.PolyColor = palette[color&0xFF];
GL_DrawPolygon(&Surf, v, 4,
HWD.pfnDrawPolygon(&Surf, v, 4,
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
}
@@ -919,7 +918,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
clearColour.green = (float)rgbaColour.s.green / 255;
clearColour.blue = (float)rgbaColour.s.blue / 255;
clearColour.alpha = 1;
GL_ClearBuffer(true, false, false, &clearColour);
HWD.pfnClearBuffer(true, false, false, &clearColour);
return;
}
@@ -990,7 +989,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
Surf.PolyColor.rgba = UINT2RGBA(color);
Surf.PolyColor.s.alpha = 0x80;
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
// -----------------+
@@ -1030,7 +1029,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
clearColour.green = (float)rgbaColour.s.green / 255;
clearColour.blue = (float)rgbaColour.s.blue / 255;
clearColour.alpha = 1;
GL_ClearBuffer(true, false, false, &clearColour);
HWD.pfnClearBuffer(true, false, false, &clearColour);
return;
}
@@ -1108,7 +1107,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
}
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
#ifdef HAVE_PNG
@@ -1192,7 +1191,7 @@ UINT8 *HWR_GetScreenshot(void)
return NULL;
// returns 24bit 888 RGB
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
return buf;
}
@@ -1208,7 +1207,7 @@ boolean HWR_Screenshot(const char *pathname)
}
// returns 24bit 888 RGB
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
#ifdef USE_PNG
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
+142
View File
@@ -0,0 +1,142 @@
// 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 imports/exports for the GPU hardware low-level interface API
#ifndef __HWR_DRV_H__
#define __HWR_DRV_H__
// this must be here 19991024 by Kin
#include "../screen.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_md2.h"
#include "hw_dll.h"
#include "../doomdef.h"
// ==========================================================================
// STANDARD DLL EXPORTS
// ==========================================================================
EXPORT boolean HWRAPI(Init) (void);
EXPORT void HWRAPI(SetupGLInfo) (void);
EXPORT void HWRAPI(SetTexturePalette) (RGBA_t *ppal);
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data);
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
EXPORT void HWRAPI(ClearMipMapCache) (void);
//Hurdler: added for backward compatibility
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
//Hurdler: added for new development
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
EXPORT void HWRAPI(FlushScreenTextures) (void);
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
#define SCREENVERTS 10
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
// jimita
EXPORT boolean HWRAPI(InitShaders) (void);
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage);
EXPORT boolean HWRAPI(CompileShader) (int slot);
EXPORT void HWRAPI(SetShader) (int slot);
EXPORT void HWRAPI(UnSetShader) (void);
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut);
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable);
EXPORT void HWRAPI(ClearLightTables)(void);
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette);
// ==========================================================================
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
// ==========================================================================
#if !defined (_CREATE_DLL_)
struct hwdriver_s
{
Init pfnInit;
SetupGLInfo pfnSetupGLInfo;
SetTexturePalette pfnSetTexturePalette;
FinishUpdate pfnFinishUpdate;
Draw2DLine pfnDraw2DLine;
DrawPolygon pfnDrawPolygon;
DrawIndexedTriangles pfnDrawIndexedTriangles;
SetBlend pfnSetBlend;
ClearBuffer pfnClearBuffer;
SetTexture pfnSetTexture;
UpdateTexture pfnUpdateTexture;
DeleteTexture pfnDeleteTexture;
ReadScreenTexture pfnReadScreenTexture;
GClipRect pfnGClipRect;
ClearMipMapCache pfnClearMipMapCache;
SetSpecialState pfnSetSpecialState;
DrawModel pfnDrawModel;
CreateModelVBOs pfnCreateModelVBOs;
SetTransform pfnSetTransform;
GetTextureUsed pfnGetTextureUsed;
PostImgRedraw pfnPostImgRedraw;
FlushScreenTextures pfnFlushScreenTextures;
DoScreenWipe pfnDoScreenWipe;
DrawScreenTexture pfnDrawScreenTexture;
MakeScreenTexture pfnMakeScreenTexture;
RenderVhsEffect pfnRenderVhsEffect;
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
RenderSkyDome pfnRenderSkyDome;
InitShaders pfnInitShaders;
LoadShader pfnLoadShader;
CompileShader pfnCompileShader;
SetShader pfnSetShader;
UnSetShader pfnUnSetShader;
SetShaderInfo pfnSetShaderInfo;
SetPaletteLookup pfnSetPaletteLookup;
CreateLightTable pfnCreateLightTable;
ClearLightTables pfnClearLightTables;
SetScreenPalette pfnSetScreenPalette;
};
extern struct hwdriver_s hwdriver;
#define HWD hwdriver
#endif //not defined _CREATE_DLL_
#endif //__HWR_DRV_H__
-79
View File
@@ -1,79 +0,0 @@
// SONIC ROBO BLAST 2 Kart
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
// Copyright (C) 2020 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 hw_gl.h
/// \brief OpenGL low-level interface API
#ifndef __HWR_GL_H__
#define __HWR_GL_H__
#include "../screen.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_md2.h"
#define SCREENVERTS 10
boolean GL_Init(void);
void GL_FinishUpdate(INT32 waitvbl);
void SetupGLInfo(void);
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
void GL_SetTransform(FTransform *stransform);
void GL_SetBlend(FBITFIELD PolyFlags);
void GL_SetPalette(RGBA_t *palette);
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
#define GL_DrawModel(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface) GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface)
void GL_RenderSkyDome(gl_sky_t *sky);
void GL_SetTexture(GLMipmap_t *pTexInfo);
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
void GL_Flush(void);
#define GL_ClearMipMapCache GL_Flush
INT32 GL_GetTextureUsed(void);
void GL_CreateModelVBOs(model_t *model);
void GL_ReadScreenTexture(int tex, UINT16 *dst_data);
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
void GL_MakeScreenTexture(int tex);
void GL_FlushScreenTextures(void);
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean useshader);
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
boolean GL_InitShaders(void);
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
boolean GL_CompileShader(int slot);
void GL_SetShader(int slot);
void GL_UnSetShader(void);
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value);
void GL_SetPaletteLookup(UINT8 *lut);
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
void GL_ClearLightTables(void);
void GL_SetScreenPalette(RGBA_t *palette);
#endif // __HWR_GL_H__
+13 -4
View File
@@ -23,15 +23,16 @@
// needed for sprite rendering
// equivalent of the software renderer's vissprites
typedef struct gl_vissprite_s
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;
UINT32 renderflags;
GLPatch_t *gpatch;
boolean flip;
UINT8 translucency; //alpha level 0-255
@@ -41,7 +42,7 @@ typedef struct gl_vissprite_s
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gl_vissprite_t;
} gr_vissprite_t;
// --------
// hw_bsp.c
@@ -63,7 +64,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore);
void HWR_GetPatch(GLPatch_t *gpatch);
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
void HWR_SetPalette(RGBA_t *palette);
@@ -81,6 +82,14 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
extern INT32 patchformat;
extern INT32 textureformat;
// --------
// hw_main.c // originally hw_drawnodes.c from HWPortal branch
// --------
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
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_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_shaders.c
// --------
+27
View File
@@ -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
+20
View File
@@ -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
+2417 -1847
View File
File diff suppressed because it is too large. Load diff
+66 -67
View File
@@ -23,7 +23,6 @@
#include "hw_glob.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_portal.h"
#include "../am_map.h"
#include "../d_player.h"
@@ -36,32 +35,15 @@
void HWR_Startup(void);
void HWR_Shutdown(void);
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
extern float gl_basewindowcenterx, gl_basewindowcentery;
extern float gr_basewindowcenterx, gr_basewindowcentery;
extern unsigned msaa;
extern boolean a2c;
extern FTransform atransform;
extern float gl_viewsin, gl_viewcos;
extern boolean gl_drawing_stencil;
extern seg_t *gl_curline;
extern side_t *gl_sidedef;
extern line_t *gl_linedef;
extern sector_t *gl_frontsector;
extern sector_t *gl_backsector;
enum
{
HWR_STENCIL_NORMAL,
HWR_STENCIL_BEGIN,
HWR_STENCIL_REVERSE,
HWR_STENCIL_DEPTH,
HWR_STENCIL_SKY
};
extern float gr_viewsin, gr_viewcos;
// Performance stats
extern ps_metric_t ps_hw_nodesorttime;
@@ -80,7 +62,7 @@ extern ps_metric_t ps_hw_numcolors;
extern ps_metric_t ps_hw_batchsorttime;
extern ps_metric_t ps_hw_batchdrawtime;
extern boolean gl_shadersavailable;
extern boolean gr_shadersavailable;
// hw_draw.c
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
@@ -99,28 +81,24 @@ UINT8 *HWR_GetScreenshot(void);
boolean HWR_Screenshot(const char *lbmname);
// hw_main.c
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_SetViewSize(void);
void HWR_AddCommands(void);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
void HWR_ClearSkyDome(void);
void HWR_BuildSkyDome(void);
void HWR_SetTransform(float fpov, player_t *player);
void HWR_ClearClipper(void);
void HWR_SetStencilState(int state, int level);
boolean HWR_UseShader(void);
boolean HWR_ShouldUsePaletteRendering(void);
boolean HWR_PalRenderFlashpal(void);
void HWR_TogglePaletteRendering(void);
// My original intention was to split hw_main.c
// into files like hw_bsp.c, hw_sprites.c...
// hw_main.c: Lighting and fog
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
@@ -128,63 +106,84 @@ FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
INT32 HWR_GetTextureUsed(void);
// hw_main.c: Post-rendering
void HWR_DoPostProcessor(player_t *player);
void HWR_StartScreenWipe(void);
void HWR_EndScreenWipe(void);
void HWR_DrawIntermissionBG(void);
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
void HWR_MakeScreenFinalTexture(void);
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader);
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
// hw_main.c: Planes
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
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
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
// moved HWR_SplitWall to hw_main.c
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_DrawSprites(void);
// hw_bsp.c
void HWR_CreatePlanePolygons(INT32 bspnum);
extern boolean gl_maphasportals;
extern boolean gr_maphasportals;
// hw_cache.c
void HWR_LoadTextures(size_t pnumtextures);
RGBA_t *HWR_GetTexturePalette(void);
void HWR_SetShaderState(void);
// Console variables
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
extern consvar_t cv_glscreentextures;
extern consvar_t cv_grshaders;
#ifdef USE_FBO_OGL
extern consvar_t cv_glframebuffer;
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;
extern consvar_t cv_grfog;
extern consvar_t cv_grfogdensity;
extern consvar_t cv_grfiltermode;
extern consvar_t cv_granisotropicmode;
extern consvar_t cv_grcorrecttricks;
extern consvar_t cv_grfovchange;
extern consvar_t cv_grsolvetjoin;
extern consvar_t cv_grspritebillboarding;
extern consvar_t cv_grfakecontrast;
extern consvar_t cv_grslopecontrast;
extern consvar_t cv_grhorizonlines;
extern consvar_t cv_grfallbackplayermodel;
extern consvar_t cv_grbatching;
extern consvar_t cv_grrenderdistance;
extern consvar_t cv_grpaletterendering;
extern consvar_t cv_grpalettedepth;
extern consvar_t cv_grflashpal;
extern consvar_t cv_grscreentextures;
extern consvar_t cv_grportals;
extern consvar_t cv_nostencil;
extern consvar_t cv_secbright;
extern consvar_t cv_glmdls;
extern consvar_t cv_glfallbackplayermodel;
extern consvar_t cv_glspritebillboarding;
extern consvar_t cv_glshearing;
extern consvar_t cv_glfakecontrast;
extern consvar_t cv_glslopecontrast;
extern consvar_t cv_glshaders;
extern consvar_t cv_gllightdither;
extern consvar_t cv_glsecbright;
extern consvar_t cv_glfiltermode;
extern consvar_t cv_glanisotropicmode;
extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_glbatching;
extern consvar_t cv_glrenderdistance;
extern consvar_t cv_glhorizonlines;
extern consvar_t cv_glportals;
extern consvar_t cv_glfovchange;
extern consvar_t cv_glpaletterendering;
extern consvar_t cv_glpalettedepth;
extern consvar_t cv_glflashpal;
extern CV_PossibleValue_t granisotropicmode_cons_t[];
#endif
+114 -113
View File
@@ -25,14 +25,13 @@
#include "../doomstat.h"
#ifdef HWRENDER
#include "hw_gl.h"
#include "hw_drv.h"
#include "hw_light.h"
#include "hw_md2.h"
#include "../d_main.h"
#include "../r_bsp.h"
#include "../r_fps.h"
#include "../r_main.h"
#include "../p_setup.h"
#include "../m_misc.h"
#include "../w_wad.h"
#include "../z_zone.h"
@@ -45,8 +44,8 @@
#include "hw_main.h"
#include "../v_video.h"
#ifdef HAVE_PNG
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
@@ -76,7 +75,7 @@
md2_t md2_models[NUMSPRITES];
md2_t md2_playermodels[MAXSKINS];
md2_t md2_localplayermodels[MAXLOCALSKINS];
md2_t md2_localplayermodels[MAXSKINS];
/*
@@ -149,7 +148,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
}
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *glpatch)
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
{
png_structp png_ptr;
png_infop png_info_ptr;
@@ -203,7 +202,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE);
Z_Free(glpatch->mipmap->data);
Z_Free(grpatch->mipmap->data);
return 0;
}
#ifdef USE_FAR_KEYWORD
@@ -244,7 +243,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &glpatch->mipmap->data);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch;
@@ -284,7 +283,7 @@ typedef struct
} PcxHeader;
static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
GLPatch_t *glpatch)
GLPatch_t *grpatch)
{
PcxHeader header;
#define PALSIZE 768
@@ -324,7 +323,7 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &glpatch->mipmap->data);
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->data);
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{
@@ -366,43 +365,43 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
// -----------------+
static void md2_loadTexture(md2_t *model)
{
GLPatch_t *glpatch;
GLPatch_t *grpatch;
const char *filename = model->filename;
if (model->glpatch)
if (model->grpatch)
{
glpatch = model->glpatch;
Z_Free(glpatch->mipmap->data);
grpatch = model->grpatch;
Z_Free(grpatch->mipmap->data);
}
else
{
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->glpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->grpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
#endif
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
{
glpatch->notfound = true;// mark it so its not searched for again repeatedly
grpatch->notfound = true;// mark it so its not searched for again repeatedly
return;
}
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
// for palette rendering, color cube is applied in post-processing instead of here
if (!HWR_ShouldUsePaletteRendering())
@@ -410,7 +409,7 @@ static void md2_loadTexture(md2_t *model)
UINT32 size;
RGBA_t *image;
// Lactozilla: Apply colour cube
image = glpatch->mipmap->data;
image = grpatch->mipmap->data;
size = w*h;
while (size--)
{
@@ -419,8 +418,8 @@ static void md2_loadTexture(md2_t *model)
}
}
}
GL_SetTexture(glpatch->mipmap);
HWR_UnlockCachedPatch(glpatch);
HWD.pfnSetTexture(grpatch->mipmap);
HWR_UnlockCachedPatch(grpatch);
}
// -----------------+
@@ -428,49 +427,49 @@ static void md2_loadTexture(md2_t *model)
// -----------------+
static void md2_loadBlendTexture(md2_t *model)
{
GLPatch_t *glpatch;
GLPatch_t *grpatch;
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
strcpy(filename, model->filename);
FIL_ForceExtension(filename, "_blend.png");
if (model->blendglpatch)
if (model->blendgrpatch)
{
glpatch = model->blendglpatch;
Z_Free(glpatch->mipmap->data);
grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap->data);
}
else
{
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->blendglpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->blendgrpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
#endif
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
{
glpatch->notfound = true;// mark it so its not searched for again repeatedly
grpatch->notfound = true;// mark it so its not searched for again repeatedly
Z_Free(filename);
return;
}
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
}
GL_SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(glpatch);
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(grpatch);
Z_Free(filename);
}
@@ -491,16 +490,14 @@ void HWR_InitMD2(void)
{
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].glpatch = NULL;
md2_playermodels[s].grpatch = NULL;
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].glpatch = NULL;
md2_localplayermodels[s].grpatch = NULL;
md2_localplayermodels[s].skin = -1;
md2_localplayermodels[s].notfound = true;
md2_localplayermodels[s].error = false;
@@ -509,7 +506,7 @@ void HWR_InitMD2(void)
{
md2_models[i].scale = -1.0f;
md2_models[i].model = NULL;
md2_models[i].glpatch = NULL;
md2_models[i].grpatch = NULL;
md2_models[i].skin = -1;
md2_models[i].notfound = true;
md2_models[i].error = false;
@@ -682,7 +679,7 @@ spritemd2found:
#define SETBRIGHTNESS(brightness,r,g,b) \
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glMipmap, INT32 skinnum, skincolors_t color)
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
{
UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h;
@@ -698,24 +695,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
memset(translation, 0, sizeof(translation));
memset(cutoff, 0, sizeof(cutoff));
if (glMipmap->width == 0)
if (grmip->width == 0)
{
glMipmap->width = gpatch->width;
glMipmap->height = gpatch->height;
grmip->width = gpatch->width;
grmip->height = gpatch->height;
// no wrap around, no chroma key
glMipmap->flags = 0;
grmip->flags = 0;
// setup the texture info
glMipmap->format = GL_TEXFMT_RGBA;
grmip->format = GL_TEXFMT_RGBA;
}
if (glMipmap->data)
if (grmip->data)
{
Z_Free(glMipmap->data);
glMipmap->data = NULL;
Z_Free(grmip->data);
grmip->data = NULL;
}
cur = Z_Malloc(size*4, PU_HWRCACHE, &glMipmap->data);
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->data);
memset(cur, 0x00, size*4);
image = gpatch->mipmap->data;
@@ -796,10 +793,11 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
}
}
}
colorbrightnesses[translen] = colorbrightnesses[translen-1];
}
if (translen > 0)
colorbrightnesses[translen] = colorbrightnesses[translen-1];
while (size--)
{
if (skinnum == TC_BOSS)
@@ -1045,29 +1043,28 @@ skippixel:
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLMipmap_t *glMipmap, *newMipmap;
GLMipmap_t *grmip, *newmip;
if (colormap == colormaps || colormap == NULL)
{
// Don't do any blending
GL_SetTexture(gpatch->mipmap);
HWD.pfnSetTexture(gpatch->mipmap);
return;
}
// search for the Mipmap
// search for the mimmap
// skip the first (no colormap translated)
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
{
glMipmap = glMipmap->nextcolormap;
if (glMipmap->colormap != colormap)
continue;
if (glMipmap->downloaded && glMipmap->data)
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap)
{
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
return;
if (grmip->downloaded && grmip->data)
{
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
return;
}
}
}
@@ -1078,25 +1075,26 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
// (it have a liste of mipmap)
// this malloc is cleared in HWR_FreeTextureCache
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
newMipmap = calloc(1, sizeof (*newMipmap));
if (newMipmap == NULL)
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
glMipmap->nextcolormap = newMipmap;
newMipmap->colormap = colormap;
grmip->nextcolormap = newmip;
newmip->colormap = colormap;
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
GL_SetTexture(newMipmap);
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
HWD.pfnSetTexture(newmip);
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_DrawMD2 : Draw MD2
// :
// Returns :
// -----------------+
void HWR_DrawMD2(gl_vissprite_t *spr)
void HWR_DrawMD2(gr_vissprite_t *spr)
{
md2_t *md2;
@@ -1106,7 +1104,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
FTransform p;
FSurfaceInfo Surf;
if (!cv_glmdls.value)
if (!cv_grmdls.value)
return;
if (spr->precip)
@@ -1165,7 +1163,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
angle_t ang;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value))
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
@@ -1235,7 +1233,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
if (md2->model)
{
md2_printModelInfo(md2->model);
GL_CreateModelVBOs(md2->model);
HWD.pfnCreateModelVBOs(md2->model);
}
else
{
@@ -1245,22 +1243,22 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
}
}
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->glpatch;
gpatch = md2->grpatch;
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
md2_loadTexture(md2);
gpatch = md2->glpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendglpatch
|| ((!((GLPatch_t *)md2->blendglpatch)->mipmap->format || !((GLPatch_t *)md2->blendglpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendglpatch)->notfound)))
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendgrpatch)->notfound)))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
md2->blendglpatch && ((GLPatch_t *)md2->blendglpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendglpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendglpatch)->height)
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
{
INT32 tcskinnum = TC_DEFAULT;
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
@@ -1285,12 +1283,12 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
}
else tcskinnum = TC_DEFAULT;
}
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendglpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
}
else
{
// This is safe, since we know the texture has been downloaded
GL_SetTexture(gpatch->mipmap);
HWD.pfnSetTexture(gpatch->mipmap);
}
}
else
@@ -1314,7 +1312,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
// Interpolate the model interpolation. (lol)
tics -= FixedToFloat(rendertimefrac);
if (cv_glmdls.value == 1 && tics <= durs)
if (cv_grmdls.value == 1 && tics <= durs)
{
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE)
@@ -1371,16 +1369,19 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
p.spritexscale = FIXED_TO_FLOAT(spr->mobj->spritexscale);
p.spriteyscale = FIXED_TO_FLOAT(spr->mobj->spriteyscale);
angle_t sliptideroll = 0;
angle_t sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value && spr->mobj->player) ? spr->mobj->player->sliproll : 0);
if (spr->mobj->player)
sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value) ? spr->mobj->player->sliproll : 0);
if (spr->mobj->rollangle || sliptideroll)
if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value))
{
angle_t rollang = 0;
rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0);
rollang = sliptideroll
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->kartstuff[k_aizdriftstrat])
rollang = (spr->mobj->player && sliptideroll && cv_sliptideroll.value)
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->sliptidemem)
: (spr->mobj->rollangle * rollfactor);
fixed_t anglef = AngleFixed(rollang);
@@ -1463,7 +1464,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
p.mirror = atransform.mirror; // from Kart
#endif
GL_SetShader(SHADER_MODEL); // model shader
HWD.pfnSetShader(SHADER_MODEL); // model shader
{
SINT8 flipfactor = flip ? -1 : 1;
@@ -1476,11 +1477,11 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
// offset perpendicular to the camera angle
p.x -= ox * gl_viewsin;
p.y += ox * gl_viewcos;
p.x -= ox * gr_viewsin;
p.y += ox * gr_viewcos;
p.z += oy;
GL_DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
}
}
}
+4 -4
View File
@@ -28,8 +28,8 @@ typedef struct
float scale;
float offset;
model_t *model;
void *glpatch;
void *blendglpatch;
void *grpatch;
void *blendgrpatch;
boolean notfound;
INT32 skin;
boolean error;
@@ -37,10 +37,10 @@ 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(gl_vissprite_t *spr);
void HWR_DrawMD2(gr_vissprite_t *spr);
void HWR_AddPlayerMD2(INT32 skin, boolean local);
void HWR_AddSpriteMD2(size_t spritenum);
-231
View File
@@ -1,231 +0,0 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1996 by id Software, Inc.
//
// 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 hw_portal.c
/// \brief OpenGL renderer portals.
// ==========================================================================
// Visual portals (attr. Hannu Hanhi)
// ==========================================================================
#ifdef HWRENDER
#include "../r_portal.h"
#include "../z_zone.h"
#include "hw_clip.h"
#include "hw_gl.h"
#include "hw_defs.h"
#include "hw_main.h"
#include "hw_portal.h"
SINT8 gl_portal_state = GLPORTAL_OFF;
gl_portallist_t *currentportallist;
// clip the area outside the portal destination window
void HWR_PortalClipping(gl_portal_t *portal)
{
gld_clipper_SafeAddClipRange(portal->angle1, portal->angle2);
}
static gl_portal_t* HWR_Portal_Add (seg_t *seg)
{
gl_portal_t *portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
// Linked list.
if (!currentportallist->base)
{
currentportallist->base = portal;
currentportallist->cap = portal;
}
else
{
currentportallist->cap->next = portal;
currentportallist->cap = portal;
}
portal->next = NULL;
portal->seg = seg;
return portal;
}
void HWR_FreePortalList(gl_portallist_t freelist)
{
portalcullsector = NULL;
// free memory from portal list allocated by calls to Add2Lines
gl_portal_t *gl_portal_temp = freelist.base;
while (gl_portal_temp)
{
gl_portal_t *nextportal = gl_portal_temp->next;
Z_Free(gl_portal_temp);
gl_portal_temp = nextportal;
}
}
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
{
gl_portal_t *portal = HWR_Portal_Add(seg);
// Offset the portal view by the linedef centers
line_t* start = &lines[line1];
line_t* dest = &lines[line2];
angle_t dangle = R_PointToAngle2(0, 0, dest->dx, dest->dy) - R_PointToAngle2(start->dx, start->dy, 0, 0);
fixed_t disttopoint;
angle_t angtopoint;
vertex_t dest_c, start_c;
// looking glass center
start_c.x = start->v1->x/2 + start->v2->x/2;
start_c.y = start->v1->y/2 + start->v2->y/2;
// other side center
dest_c.x = dest->v1->x/2 + dest->v2->x/2;
dest_c.y = dest->v1->y/2 + dest->v2->y/2;
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
angtopoint += dangle;
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
portal->viewangle = viewangle + dangle;
portal->angle1 = R_PointToAngle64(seg->v1->x, seg->v1->y) + dangle;
portal->angle2 = R_PointToAngle64(seg->v2->x, seg->v2->y) + dangle;
portal->clipline = line2;
}
void HWR_PortalFrame(gl_portal_t* portal)
{
viewx = portal->viewx;
viewy = portal->viewy;
viewz = portal->viewz;
viewangle = portal->viewangle;
//viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
//viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
if (portal->clipline != -1)
{
portalclipline = &lines[portal->clipline];
portalcullsector = portalclipline->frontsector;
viewsector = portalclipline->frontsector;
}
else
{
portalclipline = NULL;
portalcullsector = NULL;
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
}
}
// Renders a portal segment.
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
{
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
// set our portal state and prepare to render the seg
HWR_SetPortalState(state);
gl_curline = portal->seg;
gl_frontsector = portal->seg->frontsector;
gl_backsector = portal->seg->backsector;
HWR_ProcessSeg();
gl_drawing_stencil = false;
// need to work around the r_opengl PF_Invisible bug with this call
// similarly as in the linkdraw hack in HWR_DrawSprites
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
}
// Renders a single portal from the current viewpoint.
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
{
// draw portal seg to stencil buffer with increment
HWR_SetTransform(fpov, player);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// go to portal frame lmao
HWR_PortalFrame(portal);
// call HWR_RenderViewpoint
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
// return to current frame
if (rootportal)
HWR_PortalFrame(rootportal);
else // current frame is not a portal frame but the main view!
{
R_SetupFrame(viewssnum, false);
portalclipline = NULL;
}
// remove portal seg from stencil buffer
HWR_SetTransform(fpov, player);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// draw portal seg to depth buffer
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_DEPTH);
}
// returns true if the point is on the correct (viewable) side of the
// portal destination line
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y)
{
// we are checking if the point is on the viewable side of the portal exit.
// being exactly on the portal exit line is not enough to pass the test.
// P_PointOnLineSide could behave differently from this expectation on this case,
// so first check if the point is precisely on the line, and then if not, check the side.
vertex_t closest_point;
P_ClosestPointOnLine(x, y, portalclipline, &closest_point);
if (closest_point.x != x || closest_point.y != y)
{
if (P_PointOnLineSide(x, y, portalclipline) != 1)
return true;
}
return false;
}
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
{
if (!portalclipline)
return true;
if (HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]))
{
return true;
}
// we did not find any reason to pass the check, so return failure
return false;
}
#endif
-81
View File
@@ -1,81 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 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 hw_portal.h
/// \brief OpenGL renderer portal struct, functions, linked list extern.
#ifndef __HW_PORTAL__
#define __HW_PORTAL__
#ifdef HWRENDER
#include "../doomstat.h"
#include "../r_data.h"
#include "../r_bsp.h"
/** Portal structure.
*/
enum
{
GLPORTAL_OFF,
GLPORTAL_SEARCH,
GLPORTAL_STENCIL,
GLPORTAL_DEPTH,
GLPORTAL_INSIDE,
};
typedef struct gl_portal_s
{
struct gl_portal_s *next;
// Viewport.
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
seg_t *seg; // seg that is used for drawing to the stencil buffer
INT32 clipline; // Optional clipline for line-based portals
// angles for the left and right edges of the portal
// relative to the viewpoint
angle_t angle1;
angle_t angle2;
} gl_portal_t;
typedef struct gl_portallist_s
{
gl_portal_t *base;
gl_portal_t *cap;
} gl_portallist_t;
extern SINT8 gl_portal_state;
// new thing
extern gl_portallist_t *currentportallist;
static inline void HWR_SetPortalState (SINT8 state)
{
gl_portal_state = state;
}
// Adds an entry to the clipper for portal rendering
void HWR_PortalClipping(gl_portal_t *portal);
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg);
void HWR_PortalFrame(gl_portal_t* portal);
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level);
void HWR_FreePortalList(gl_portallist_t portallist);
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord);
#endif
#endif
+17 -127
View File
@@ -13,7 +13,7 @@
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_gl.h"
#include "hw_drv.h"
#include "hw_shaders.h"
#include "../z_zone.h"
@@ -25,10 +25,13 @@ static struct {
const char *vertex;
const char *fragment;
} const gl_shadersources[] = {
// Floor shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
// Shadow shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_SHADOW_FRAGMENT_SHADER},
// Wall shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
@@ -49,7 +52,7 @@ static struct {
// Palette postprocess shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_PALETTE_POSTPROCESS_FRAGMENT_SHADER},
// UI colormap fade shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_FRAGMENT_SHADER},
@@ -79,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.
@@ -87,7 +89,7 @@ boolean HWR_InitShaders(void)
{
int i;
if (!GL_InitShaders())
if (!HWD.pfnInitShaders())
return false;
for (i = 0; i < NUMSHADERTARGETS; i++)
@@ -276,13 +278,10 @@ static char *HWR_PreprocessShader(char *original)
// Calculate length of modified shader.
new_len = original_len;
if (cv_glpaletterendering.value)
if (cv_grpaletterendering.value)
ADD_TO_LEN(PALETTE_RENDERING_DEFINE)
if (cv_gllightdither.value)
ADD_TO_LEN(LIGHT_DITHERING_DEFINE)
#undef ADD_TO_LEN
#define VERSION_PART "#version "
@@ -321,12 +320,9 @@ static char *HWR_PreprocessShader(char *original)
}
// Write the defines.
if (cv_glpaletterendering.value)
if (cv_grpaletterendering.value)
WRITE_DEFINE(PALETTE_RENDERING_DEFINE)
if (cv_gllightdither.value)
WRITE_DEFINE(LIGHT_DITHERING_DEFINE)
#undef WRITE_DEFINE
// Write a #line directive, so compiler errors will report line numbers from the
@@ -366,16 +362,16 @@ static void HWR_CompileShader(int index)
{
char *preprocessed = HWR_PreprocessShader(vertex_source);
if (!preprocessed) return;
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
}
if (fragment_source)
{
char *preprocessed = HWR_PreprocessShader(fragment_source);
if (!preprocessed) return;
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
}
gl_shaders[index].compiled = GL_CompileShader(index);
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
}
// compile or recompile shaders
@@ -407,7 +403,7 @@ int HWR_GetShaderFromTarget(int shader_target)
// - custom shaders are enabled
// - custom shaders are allowed by the server
if (custom_shader != -1 && gl_shaders[custom_shader].compiled &&
cv_glshaders.value == 1)
cv_grshaders.value == 1)
return custom_shader;
else
return gl_shadertargets[shader_target].base_shader;
@@ -429,6 +425,7 @@ static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
customshaderxlat_t shaderxlat[] =
{
{"Flat", SHADER_FLOOR},
{"Shadow", SHADER_SHADOW},
{"WallTexture", SHADER_WALL},
{"Sprite", SHADER_SPRITE},
{"Model", SHADER_MODEL},
@@ -449,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;
@@ -561,7 +458,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
int i;
boolean modified_shaders[NUMSHADERTARGETS] = {0};
if (!gl_shadersavailable)
if (!gr_shadersavailable)
return;
lump = HWR_FindShaderDefs(wadnum);
@@ -705,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);
}
+9 -46
View File
@@ -51,55 +51,16 @@
//
// 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
// second num (0.26), increase to make it go dark faster
@@ -108,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"
@@ -134,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" \
@@ -172,7 +133,7 @@
"gl_FragColor = final_color;\n" \
"}\n" \
"#endif\0"
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
"uniform sampler2D tex;\n" \
"uniform vec4 poly_color;\n" \
@@ -195,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"
@@ -211,6 +170,10 @@
#define GLSL_WALL_FRAGMENT_SHADER \
GLSL_WALL_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER
#define GLSL_SHADOW_FRAGMENT_SHADER \
GLSL_FLOOR_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
//
// Water surface shader
+22 -3
View File
@@ -358,8 +358,8 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
else
textureformatGL = GL_RGB5_A1;
GL_SetModelView(lvid->width, lvid->height);
GL_SetStates();
SetModelView(lvid->width, lvid->height);
SetStates();
// we need to clear the depth buffer. Very important!!!
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
// -----------------+
// FinishUpdate : Swap front and back buffers
// -----------------+
void GL_FinishUpdate (INT32 waitvbl)
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
{
#ifdef USE_WGL_SWAP
static INT32 oldwaitvbl = 0;
@@ -547,4 +547,23 @@ void GL_FinishUpdate (INT32 waitvbl)
SwapBuffers(hDC);
}
// -----------------+
// SetPalette : Set the color lookup table for paletted textures
// : in OpenGL, we store values for conversion of paletted graphics when
// : they are downloaded to the 3D card.
// -----------------+
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
{
INT32 i;
for (i = 0; i < 256; i++)
{
myPaletteData[i].s.red = pal[i].s.red;
myPaletteData[i].s.green = pal[i].s.green;
myPaletteData[i].s.blue = pal[i].s.blue;
myPaletteData[i].s.alpha = pal[i].s.alpha;
}
}
#endif
File diff suppressed because it is too large. Load diff
+17 -14
View File
@@ -43,9 +43,8 @@
#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows
#include "../../doomdef.h"
#include "../hw_gl.h"
#include "../hw_drv.h"
#include "../../z_zone.h"
// ==========================================================================
@@ -66,15 +65,14 @@ extern FILE *gllogstream;
// PROTOS
// ==========================================================================
FUNCPRINTF void GL_DBG_Printf(const char *format, ...);
boolean LoadGL(void);
void *GetGLFunc(const char *proc);
boolean SetupGLfunc(void);
void SetupGLFunc4(void);
void GL_Flush(void);
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start);
void GL_SetModelView(GLint w, GLint h);
void GL_SetStates(void);
void Flush(void);
INT32 isExtAvailable(const char *extension, const GLubyte *start);
void SetModelView(GLint w, GLint h);
void SetStates(void);
#ifndef GL_EXT_texture_filter_anisotropic
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
@@ -100,14 +98,21 @@ typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
extern PFNglGetIntegerv pglGetIntegerv;
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
extern PFNglGetString pglGetString;
#if 0
typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap); // redefined in r_opengl.c
static PFNglEnableClientState pglEnableClientState;
#endif
#endif
#ifdef USE_FBO_OGL
void GL_Framebuffer_DeleteAttachments(void);
void GLFramebuffer_Generate(void);
void GLFramebuffer_Delete(void);
void GL_Framebuffer_Unbind(void);
void GL_Framebuffer_Enable(void);
void GL_Framebuffer_Disable(void);
void GLFramebuffer_GenerateAttachments(void);
void GLFramebuffer_DeleteAttachments(void);
void GLFramebuffer_Enable(void);
void GLFramebuffer_Disable(void);
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
@@ -121,8 +126,6 @@ extern boolean supportFBO;
extern const GLubyte *gl_version;
extern const GLubyte *gl_renderer;
extern const GLubyte *gl_extensions;
extern const GLubyte *gl_vendor;
extern GLuint gl_num_extensions;
extern int majorGL, minorGL;
+16 -21
View File
@@ -289,7 +289,7 @@ int
HMS_register (void)
{
struct HMS_buffer *hms;
int okay;
int ok;
char post[256];
@@ -316,23 +316,23 @@ HMS_register (void)
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
okay = HMS_do(hms);
ok = HMS_do(hms);
if (okay)
if (ok)
{
hms_server_token = strdup(strtok(hms->buffer, "\n"));
}
HMS_end(hms);
return okay;
return ok;
}
int
HMS_unlist (void)
{
struct HMS_buffer *hms;
int okay;
int ok;
hms = HMS_connect("servers/%s/unlist", hms_server_token);
@@ -342,19 +342,19 @@ HMS_unlist (void)
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
okay = HMS_do(hms);
ok = HMS_do(hms);
HMS_end(hms);
free(hms_server_token);
return okay;
return ok;
}
int
HMS_update (void)
{
struct HMS_buffer *hms;
int okay;
int ok;
char post[256];
@@ -376,10 +376,10 @@ HMS_update (void)
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
okay = HMS_do(hms);
ok = HMS_do(hms);
HMS_end(hms);
return okay;
return ok;
}
void
@@ -488,7 +488,7 @@ int
HMS_compare_mod_version (char *buffer, size_t buffer_size)
{
struct HMS_buffer *hms;
int okay;
int ok;
char *version;
char *version_name;
@@ -498,7 +498,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
if (! hms)
return 0;
okay = 0;
ok = 0;
if (HMS_do(hms))
{
@@ -510,16 +510,16 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
if (atoi(version) != MODVERSION)
{
strlcpy(buffer, version_name, buffer_size);
okay = 1;
ok = 1;
}
else
okay = -1;
ok = -1;
}
}
HMS_end(hms);
return okay;
return ok;
}
const char *
@@ -532,9 +532,7 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
if (! hms)
return NULL;
boolean okay = HMS_do(hms);
if (okay)
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 (!okay)
return NULL;
return buffer;
}
+280 -164
View File
@@ -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);
@@ -1003,7 +998,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
if (LUAh_PlayerMsg(playernum, target, flags, msg, spam_eatmsg))
return;
if (spam_eatmsg)
@@ -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)
{
@@ -2274,7 +2382,7 @@ void HU_Drawer(void)
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_scores);
LUA_HUDHOOK(scores, luahuddrawlist_scores);
LUAh_ScoresHUD(luahuddrawlist_scores);
}
LUA_HUD_DrawList(luahuddrawlist_scores);
@@ -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;
@@ -2617,8 +2721,7 @@ static void HU_DrawRankings(void)
boolean completed[MAXPLAYERS];
UINT32 whiteplayer = MAXPLAYERS;
if (!automapactive)
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
if (cons_menuhighlight.value)
hilicol = cons_menuhighlight.value;
@@ -2634,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())
{
@@ -2691,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)
@@ -2763,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())
+1 -1
View File
@@ -53,6 +53,6 @@ typedef struct JoyType_s JoyType_t;
for palyer[sic] 1-4's joystick/gamepad
*/
extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;
#endif // __I_JOY_H__
+28
View File
@@ -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;
@@ -82,10 +102,18 @@ extern holepunch_t *holepunchpacket;
*/
extern boolean (*I_NetGet)(void);
/** \brief ask to driver if there is data waiting
*/
extern boolean (*I_NetCanGet)(void);
/** \brief send packet within doomcom struct
*/
extern void (*I_NetSend)(void);
/** \brief ask to driver if all is ok to send data now
*/
extern boolean (*I_NetCanSend)(void);
/** \brief close a connection
\param nodenum node to be closed
+1
View File
@@ -159,6 +159,7 @@ boolean I_SetSongPosition(UINT32 position);
UINT32 I_GetSongPosition(void);
void I_UpdateSongLagThreshold (void);
void I_UpdateSongLagConditions (void);
/// ------------------------
// MUSIC PLAYBACK
+15 -13
View File
@@ -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
@@ -202,13 +199,9 @@ void I_JoyScale4(void);
// Called by D_SRB2Main.
/** \brief to startup joystick
*/
void I_InitJoystick(UINT8 index);
/** \brief to startup the first joystick
*/
void I_InitJoystick1(void);
void I_InitJoystick(void);
/** \brief to startup the second joystick
*/
@@ -234,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
@@ -311,9 +301,21 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
*/
const char *I_LocateWad(void);
/** \brief Joystick events
/** \brief First Joystick's events
*/
void I_GetJoystickEvents(UINT8 index);
void I_GetJoystickEvents(void);
/** \brief Second Joystick's events
*/
void I_GetJoystick2Events(void);
/** \brief Third Joystick's events
*/
void I_GetJoystick3Events(void);
/** \brief Fourth Joystick's events
*/
void I_GetJoystick4Events(void);
/** \brief Mouses events
*/
+84 -28
View File
@@ -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
@@ -168,6 +160,7 @@ static UINT8 UPNP_support = TRUE;
#endif
#include "i_addrinfo.h"
#define SELECTTEST
#define DEFAULTPORT "5029"
@@ -749,6 +742,59 @@ static boolean SOCK_Get(void)
}
#endif
// check if we can send (do not go over the buffer)
#ifndef NONET
static fd_set masterset;
#ifdef SELECTTEST
static boolean FD_CPY(fd_set *src, fd_set *dst, SOCKET_TYPE *fd, size_t len)
{
size_t i;
boolean testset = false;
FD_ZERO(dst);
for (i = 0; i < len;i++)
{
if(fd[i] != (SOCKET_TYPE)ERRSOCKET &&
FD_ISSET(fd[i], src) && !FD_ISSET(fd[i], dst)) // no checking for dups
{
FD_SET(fd[i], dst);
testset = true;
}
}
return testset;
}
static boolean SOCK_CanSend(void)
{
struct timeval timeval_for_select = {0, 0};
fd_set tset;
int wselect;
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
return false;
wselect = select(255, NULL, &tset, NULL, &timeval_for_select);
if (wselect >= 1)
return true;
return false;
}
static boolean SOCK_CanGet(void)
{
struct timeval timeval_for_select = {0, 0};
fd_set tset;
int rselect;
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
return false;
rselect = select(255, &tset, NULL, NULL, &timeval_for_select);
if (rselect >= 1)
return true;
return false;
}
#endif
#endif
#ifndef NONET
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
{
@@ -770,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;
@@ -787,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;
@@ -801,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;
}
@@ -817,13 +853,12 @@ 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 //NONET
#endif
#ifndef NONET
static void SOCK_FreeNodenum(INT32 numnode)
@@ -975,6 +1010,7 @@ static boolean UDP_Socket(void)
mysockets[s] = ERRSOCKET;
for (s = 0; s < MAXNETNODES+1; s++)
nodesocket[s] = ERRSOCKET;
FD_ZERO(&masterset);
s = 0;
memset(&hints, 0x00, sizeof (hints));
@@ -1001,6 +1037,7 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
}
@@ -1021,6 +1058,7 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
#ifdef HAVE_MINIUPNPC
@@ -1053,6 +1091,7 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
}
@@ -1073,6 +1112,7 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
}
@@ -1239,15 +1279,16 @@ boolean I_InitTcpDriver(void)
static void SOCK_CloseSocket(void)
{
size_t i;
for (i = 0; i < mysocketses; i++)
for (i=0; i < MAXNETNODES+1; i++)
{
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET)
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET
&& FD_ISSET(mysockets[i], &masterset))
{
FD_CLR(mysockets[i], &masterset);
close(mysockets[i]);
}
mysockets[i] = ERRSOCKET;
}
mysocketses = 0;
}
#endif
@@ -1357,7 +1398,9 @@ static void rendezvous(int size)
if (tic == refreshtic)
{
#ifdef HOLEPUNCH
holepunchpacket->magic = hole_punch_magic;
#endif
sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4);
}
@@ -1382,6 +1425,7 @@ static void SOCK_RegisterHolePunch(void)
rendezvous(4);
}
#endif
#endif
static boolean SOCK_OpenSocket(void)
@@ -1401,7 +1445,13 @@ static boolean SOCK_OpenSocket(void)
I_NetFreeNodenum = SOCK_FreeNodenum;
I_NetMakeNodewPort = SOCK_NetMakeNodewPort;
#ifdef SELECTTEST
// seem like not work with libsocket : (
I_NetCanSend = SOCK_CanSend;
I_NetCanGet = SOCK_CanGet;
#endif
#ifdef HOLEPUNCH
I_NetRequestHolePunch = SOCK_RequestHolePunch;
I_NetRegisterHolePunch = SOCK_RegisterHolePunch;
#endif
@@ -1642,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;
@@ -1655,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;
@@ -1685,6 +1738,7 @@ boolean I_InitTcpNetwork(void)
// so we're on a LAN
COM_BufAddText("connect any\n");
net_bandwidth = 800000;
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
}
}
@@ -1709,6 +1763,8 @@ boolean I_InitTcpNetwork(void)
{
// so we're on a LAN
COM_BufAddText("connect any\n");
net_bandwidth = 800000;
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
}
}
-4
View File
@@ -139,13 +139,9 @@ UINT32 I_GetRefreshRate(void);
boolean I_UseNativeKeyboard(void);
boolean I_CheckNativeRes(void);
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void);
void I_DownSample(void);
boolean UseScreenFBO(void);
extern boolean downsample;
#endif
+11 -10
View File
@@ -21,6 +21,7 @@
#include "d_player.h"
#include "lzf.h"
// Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c!
char sprnames[NUMSPRITES + 1][5] =
{
"NULL","UNKN","THOK","PLAY","POSS","SPOS","FISH","BUZZ","RBUZ","JETB",
@@ -1821,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
@@ -1840,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
@@ -11197,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
@@ -11225,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
@@ -11239,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
+204 -427
View File
@@ -22,441 +22,218 @@
// 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_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
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
// Hey, moron! If you change this table, don't forget about sprnames in info.c and the sprite lights in hw_light.c!
typedef enum sprite
{
SPR_NULL, // invisible object
-446
View File
@@ -1,446 +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 "doomstat.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"
#include "r_fps.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
{
UINT8 viewnum;
player_t* viewplayer;
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;
struct directorinfo directorinfosplit[MAXSPLITSCREENPLAYERS];
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));
}
boolean K_DirectorIsAvailable(UINT8 viewnum)
{
if ((demo.playback && demo.title) || modeattacking)
return false;
return ((gamestate == GS_LEVEL) && (viewnum <= splitscreen) && (demo.playback || (players[g_localplayers[viewnum]].spectator && !K_DirectorIsPlayerAlone())));
}
static boolean K_DirectorIsEnabled(const UINT8 viewnum)
{
return (cv_director[viewnum].value && K_DirectorIsAvailable(viewnum));
}
void K_InitDirector(void)
{
INT32 playernum;
directorinfo.viewnum = 0;
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
directorinfosplit[i].cooldown = SWITCHTIME;
directorinfosplit[i].freeze = 0;
directorinfosplit[i].attacker = 0;
directorinfosplit[i].maxdist = 0;
directorinfosplit[i].viewplayer = NULL;
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
{
directorinfosplit[i].sortedplayers[playernum] = -1;
directorinfosplit[i].gap[playernum] = INT32_MAX;
directorinfosplit[i].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(const UINT8 viewnum)
{
INT32 playernum;
INT32 position;
player_t* target;
memset(directorinfosplit[viewnum].sortedplayers, -1, sizeof(directorinfo.sortedplayers));
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
{
target = &players[playernum];
if (playeringame[playernum] && !target->spectator && target->kartstuff[k_position] > 0)
{
directorinfosplit[viewnum].sortedplayers[target->kartstuff[k_position] - 1] = playernum;
}
}
for (position = 0; position < MAXPLAYERS - 1; position++)
{
directorinfosplit[viewnum].gap[position] = INT32_MAX;
if (directorinfosplit[viewnum].sortedplayers[position] == -1 || directorinfosplit[viewnum].sortedplayers[position + 1] == -1)
{
continue;
}
directorinfosplit[viewnum].gap[position] = ScaleFromMap(K_GetFinishGap(directorinfosplit[viewnum].sortedplayers[position], directorinfosplit[viewnum].sortedplayers[position + 1]), FRACUNIT);
if (directorinfosplit[viewnum].gap[position] >= BREAKAWAYDIST)
{
directorinfosplit[viewnum].boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfosplit[viewnum].boredom[position] + 1));
}
else if (directorinfosplit[viewnum].boredom[position] > 0)
{
directorinfosplit[viewnum].boredom[position]--;
}
}
if (directorinfosplit[viewnum].sortedplayers[0] == -1)
{
directorinfosplit[viewnum].maxdist = -1;
return;
}
directorinfosplit[viewnum].maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfosplit[viewnum].sortedplayers[0]]), FRACUNIT);
}
static boolean K_CanSwitchDirector(const UINT8 viewnum)
{
if (directorinfosplit[viewnum].cooldown > 0)
{
return false;
}
return true;
}
static void K_DirectorSwitch(INT32 player, boolean force, const UINT8 viewnum)
{
if (!K_DirectorIsEnabled(viewnum))
{
return;
}
if (players[player].exiting)
{
return;
}
if (!force && !K_CanSwitchDirector(viewnum))
{
return;
}
G_ResetView(viewnum+1, player, true);
directorinfosplit[viewnum].cooldown = SWITCHTIME;
}
static void K_DirectorForceSwitch(INT32 player, INT32 time, const UINT8 viewnum)
{
if (players[player].exiting)
{
return;
}
directorinfosplit[viewnum].attacker = player;
directorinfosplit[viewnum].freeze = time;
}
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
{
if (!K_DirectorIsEnabled(directorinfo.viewnum))
{
return;
}
if (directorinfosplit[directorinfo.viewnum].viewplayer != player)
{
return;
}
if (inflictor && inflictor->player)
{
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME, directorinfo.viewnum);
}
else if (source && source->player)
{
K_DirectorForceSwitch(source->player - players, TRANSFERTIME, directorinfo.viewnum);
}
}
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", directorinfosplit[0].cooldown));
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfosplit[0].maxdist));
for (position = 0; position < MAXPLAYERS - 1; position++)
{
ytxt = 10 * (position + 1);
leader = directorinfosplit[0].sortedplayers[position];
follower = directorinfosplit[0].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", directorinfosplit[0].gap[position]));
if (directorinfosplit[0].boredom[position] >= BOREDOMTIME)
{
V_DrawThinString(120, ytxt, V_70TRANS, va("BORED"));
}
else
{
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfosplit[0].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(const UINT8 viewnum)
{
INT32 targetposition;
directorinfo.viewnum = viewnum;
directorinfosplit[directorinfo.viewnum].viewplayer = &players[displayplayers[directorinfo.viewnum]];
if (!K_DirectorIsEnabled(directorinfo.viewnum))
{
return;
}
K_UpdateDirectorPositions(directorinfo.viewnum);
if (directorinfosplit[directorinfo.viewnum].cooldown > 0) {
directorinfosplit[directorinfo.viewnum].cooldown--;
}
// handle pending forced switches
if (directorinfosplit[directorinfo.viewnum].freeze > 0)
{
if (!(--directorinfosplit[directorinfo.viewnum].freeze))
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].attacker, true, directorinfo.viewnum);
return;
}
// if there's only one player left in the list, just switch to that player
if (directorinfosplit[directorinfo.viewnum].sortedplayers[0] != -1 && (directorinfosplit[directorinfo.viewnum].sortedplayers[1] == -1 ||
// TODO: Battle; I just threw this together quick. Focus on leader.
!race_rules()))
{
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].sortedplayers[0], false, directorinfo.viewnum);
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 (directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition] == -1)
{
break;
}
// pair too far apart? try the next one
if (directorinfosplit[directorinfo.viewnum].boredom[targetposition - 1] >= BOREDOMTIME)
{
continue;
}
// pair finished? try the next one
if (players[directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition]].exiting)
{
continue;
}
// don't risk switching away from forward pairs at race end, might miss something!
if (directorinfosplit[directorinfo.viewnum].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 && directorinfosplit[directorinfo.viewnum].gap[targetposition] < WALKBACKDIST)
{
targetposition++;
}
}
target = directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition];
// stop here since we're already viewing this player
if (displayplayers[directorinfo.viewnum] == target)
{
break;
}
// 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, directorinfo.viewnum);
}
// even if we're not certain, if we're cetain we're watching the WRONG player, try to switch
if (directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_position] != targetposition+1 && !directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_positiondelay])
{
K_DirectorSwitch(target, false, directorinfo.viewnum);
}
break;
}
}
void K_ToggleDirector(const UINT8 viewnum)
{
if (!K_DirectorIsAvailable(viewnum))
return;
G_AdjustView(viewnum+1, 1, true);
if (!K_DirectorIsEnabled(viewnum))
{
directorinfosplit[viewnum].cooldown = 0; // switch immediately
}
directortoggletimer = 0;
CV_SetValue(&cv_director[viewnum], (cv_director[viewnum].value ^ 1));
}
-18
View File
@@ -1,18 +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.
boolean K_DirectorIsAvailable(UINT8 viewnum);
void K_InitDirector(void);
void K_UpdateDirector(UINT8 viewnum);
void K_DrawDirectorDebugger(void);
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
void K_ToggleDirector(UINT8 viewnum);
+588 -601
View File
File diff suppressed because it is too large. Load diff
+1 -2
View File
@@ -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);
+11 -98
View File
@@ -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;
}
@@ -1109,18 +1108,6 @@ static int lib_pCheckSight(lua_State *L)
return 1;
}
// DONT USE THIS FOR ANYTHING GAMEPLAY, THIS WILL DESYNCH!
static int lib_pCheckSightFast(lua_State *L)
{
mobj_t *t1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *t2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
//HUDSAFE?
if (!t1 || !t2)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_CheckSightFast(t1, t2));
return 1;
}
static int lib_pCheckHoopPosition(lua_State *L)
{
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@@ -1271,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");
@@ -1281,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;
}
@@ -1565,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
@@ -1619,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;
}
@@ -1829,7 +1810,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
S_StartSoundAtVolume(origin, sound_id, volume);
S_StartSoundAtVolume(origin, sound_id, volume);
return 0;
}
@@ -1931,7 +1912,7 @@ static int lib_sChangeMusic(lua_State *L)
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
else
#endif
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
position = (UINT32)luaL_optinteger(L, 5, 0);
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
@@ -2575,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;
}
@@ -3031,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},
@@ -3166,6 +3083,7 @@ static luaL_Reg lib[] = {
{"P_LookForEnemies",lib_pLookForEnemies},
{"P_NukeEnemies",lib_pNukeEnemies},
{"P_HomingAttack",lib_pHomingAttack},
//{"P_SuperReady",lib_pSuperReady},
{"P_Telekinesis",lib_pTelekinesis},
// p_map
@@ -3178,7 +3096,6 @@ static luaL_Reg lib[] = {
{"P_SlideMove",lib_pSlideMove},
{"P_BounceMove",lib_pBounceMove},
{"P_CheckSight", lib_pCheckSight},
{"P_CheckSightFast", lib_pCheckSightFast},
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
{"P_RadiusAttack",lib_pRadiusAttack},
{"P_FloorzAtPos",lib_pFloorzAtPos},
@@ -3330,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}
};
+14 -57
View File
@@ -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.
{
@@ -169,7 +166,7 @@ void COM_Lua_f(void)
for (i = 0; i < argc; i++)
WRITESTRINGN(p, COM_Argv(i), 255);
if (flags & 2)
SendNetXCmdForPlayer(1, XD_LUACMD, buf, p-buf);
SendNetXCmd2(XD_LUACMD, buf, p-buf);
else
SendNetXCmd(XD_LUACMD, buf, p-buf);
free(buf);
@@ -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");
+89 -116
View File
@@ -12,129 +12,102 @@
#include "r_defs.h"
#include "d_player.h"
#include "s_sound.h"
#include "lua_hudlib_drawlist.h"
/*
* Do you know what an 'X Macro' is? Such a macro is called over each element of
* a list and expands the input. I use it for the hook lists because both an enum
* and array of hook names need to be kept in order. The X Macro handles this
* automatically.
*/
enum hook {
hook_NetVars=0,
hook_MapChange,
hook_MapLoad,
hook_PlayerJoin,
hook_PreThinkFrame,
hook_ThinkFrame,
hook_PostThinkFrame,
hook_MobjSpawn,
hook_MobjCollide,
hook_MobjMoveCollide,
hook_TouchSpecial,
hook_MobjFuse,
hook_MobjThinker,
hook_BossThinker,
hook_ShouldDamage,
hook_MobjDamage,
hook_MobjDeath,
hook_BossDeath,
hook_MobjRemoved,
hook_JumpSpecial,
hook_AbilitySpecial,
hook_SpinSpecial,
hook_JumpSpinSpecial,
hook_BotTiccmd,
hook_BotAI,
hook_LinedefExecute,
hook_PlayerMsg,
hook_HurtMsg,
hook_PlayerSpawn,
hook_PlayerQuit,
hook_PlayerThink,
hook_MusicChange,
hook_ShouldSpin, //SRB2KART
hook_ShouldExplode, //SRB2KART
hook_ShouldSquish, //SRB2KART
hook_PlayerSpin, //SRB2KART
hook_PlayerExplode, //SRB2KART
hook_PlayerSquish, //SRB2KART
hook_PlayerCmd, //SRB2KART
hook_IntermissionThinker, //SRB2KART
hook_VoteThinker, //SRB2KART
#define MOBJ_HOOK_LIST(X) \
X (MobjSpawn),/* P_SpawnMobj */\
X (MobjCollide),/* PIT_CheckThing */\
X (MobjMoveCollide),/* tritto */\
X (TouchSpecial),/* P_TouchSpecialThing */\
X (MobjFuse),/* when mobj->fuse runs out */\
X (MobjThinker),/* P_MobjThinker, P_SceneryThinker */\
X (BossThinker),/* P_GenericBossThinker */\
X (ShouldDamage),/* P_DamageMobj (Should mobj take damage?) */\
X (MobjDamage),/* P_DamageMobj (Mobj actually takes damage!) */\
X (MobjDeath),/* P_KillMobj */\
X (BossDeath),/* A_BossDeath */\
X (MobjRemoved),/* P_RemoveMobj */\
X (HurtMsg),/* imhurttin */\
#define HOOK_LIST(X) \
X (NetVars),/* add to archive table (netsave) */\
X (MapChange),/* (before map load) */\
X (MapLoad),\
X (PlayerJoin),/* Got_AddPlayer */\
X (PreThinkFrame)/* frame (before mobj and player thinkers) */,\
X (ThinkFrame),/* frame (after mobj and player thinkers) */\
X (PostThinkFrame),/* frame (at end of tick, ie after overlays, precipitation, specials) */\
X (JumpSpecial),/* P_DoJumpStuff (Any-jumping) */\
X (AbilitySpecial),/* P_DoJumpStuff (Double-jumping) */\
X (SpinSpecial),/* P_DoSpinAbility (Spin button effect) */\
X (JumpSpinSpecial),/* P_DoJumpStuff (Spin button effect (mid-air)) */\
X (BotTiccmd),/* B_BuildTiccmd */\
X (PlayerMsg),/* chat messages */\
X (PlayerSpawn),/* G_SpawnPlayer */\
X (PlayerQuit),\
X (PlayerThink),/* P_PlayerThink */\
X (MusicChange),\
X (ShouldSpin),/*SRB2KART*/\
X (ShouldExplode),/*SRB2KART*/\
X (ShouldSquish),/*SRB2KART*/\
X (PlayerSpin),/*SRB2KART*/\
X (PlayerExplode),/*SRB2KART*/\
X (PlayerSquish),/*SRB2KART*/\
X (PlayerCmd),/* building the player's ticcmd struct (Ported from SRB2Kart) */\
X (IntermissionThinker),/* Y_Ticker */\
X (VoteThinker),/*SRB2KART*/\
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
#define STRING_HOOK_LIST(X) \
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
X (LinedefExecute),\
#define HUD_HOOK_LIST(X) \
X (game),\
X (scores),/* emblems/multiplayer list */\
X (intermission),\
X (vote),\
/*
* I chose to access the hook enums through a macro as well. This could provide
* a hint to lookup the macro's definition instead of the enum's definition.
* (Since each enumeration is not defined in the source code, but by the list
* macros above, it is not greppable.) The name passed to the macro can also be
* grepped and found in the lists above.
*/
#define MOBJ_HOOK(name) mobjhook_ ## name
#define HOOK(name) hook_ ## name
#define HUD_HOOK(name) hudhook_ ## name
#define STRING_HOOK(name) stringhook_ ## name
#define ENUM(X) enum { X ## _LIST (X) X(MAX) }
ENUM (MOBJ_HOOK);
ENUM (HOOK);
ENUM (HUD_HOOK);
ENUM (STRING_HOOK);
#undef ENUM
/* dead simple, LUA_HOOK(GameQuit) */
#define LUA_HOOK(type) LUA_HookVoid(HOOK(type))
#define LUA_HUDHOOK(type,drawlist) LUA_HookHUD(HUD_HOOK(type),(drawlist))
hook_MAX // last hook
};
extern const char *const hookNames[];
extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd.
extern int hook_defrosting;
void LUA_HookVoid(int hook);
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
void LUAh_MapLoad(void); // Hook for map load
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
void LUAh_PreThinkFrame(void); // Hook for frame (before mobj and player thinkers)
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
void LUAh_PostThinkFrame(void); // Hook for frame (at end of tick, ie after overlays, precipitation, specials)
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
boolean LUAh_MobjThinker(mobj_t *mo); // Hook for P_MobjThinker or P_SceneryThinker by mobj type
#define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type
UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?)
boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!)
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping)
#define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping)
#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect)
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute); // Hook for chat messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping,
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
int LUA_HookMobj(mobj_t *, int hook);
int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook);
void LUA_HookInt(INT32 integer, int hook);
//void LUA_HookBool(boolean value, int hook);
int LUA_HookPlayer(player_t *, int hook);
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
void LUA_HookPreThinkFrame(void);
void LUA_HookThinkFrame(void);
void LUA_HookPostThinkFrame(void);
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher);
int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source);
int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd);
void LUA_HookLinedefExecute(line_t *, mobj_t *, sector_t *);
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute);
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source);
int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
void LUA_HookPlayerQuit(player_t *, int);
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
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.
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
boolean LUA_HookPlayerExplode(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 LUA_HookPlayerSquish(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_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
+1585 -986
View File
File diff suppressed because it is too large. Load diff
+4 -1
View File
@@ -50,6 +50,9 @@ extern boolean hud_interplatch; // string mode was toggled
boolean LUA_HudEnabled(enum hud option);
void LUA_SetHudHook(int hook, huddrawlist_h list);
void LUAh_GameHUD(huddrawlist_h list);
void LUAh_ScoresHUD(huddrawlist_h list);
void LUAh_IntermissionHUD(huddrawlist_h list);
void LUAh_VoteHUD(huddrawlist_h list);
#endif // __LUA_HUD_H__
+282 -72
View File
@@ -28,7 +28,6 @@
#include "lua_script.h"
#include "lua_libs.h"
#include "lua_hud.h"
#include "lua_hook.h"
#define HUDONLY if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
@@ -41,6 +40,8 @@ boolean hud_interpstring = false;
boolean hud_interplatch = false;
static UINT8 hud_enabled[(hud_MAX/8)+1];
static UINT8 hudAvailable; // hud hooks field
static UINT8 camnum = 1;
// must match enum hud in lua_hud.h
@@ -92,7 +93,18 @@ static const char *const patch_opt[] = {
"topoffset",
NULL};
static int patch_fields_ref = LUA_NOREF;
enum hudhook {
hudhook_game = 0,
hudhook_scores = 1,
hudhook_intermission = 2,
hudhook_vote = 3,
};
static const char *const hudhook_opt[] = {
"game",
"scores",
"intermission",
"vote",
NULL};
// alignment types for v.drawString
enum align {
@@ -217,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;
@@ -288,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
@@ -323,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);
@@ -489,7 +499,7 @@ static int libd_getSpritePatch(lua_State *L)
angle = (angle & 7); // modulus angle by 8
// rotsprite?????
if (lua_isnumber(L, 4) && cv_sloperoll.value)
if (lua_isnumber(L, 4) && (cv_spriteroll.value))
{
angle_t rollangle = luaL_checkangle(L, 4);
INT32 rot = R_GetRollAngle(rollangle);
@@ -577,16 +587,26 @@ static int libd_drawOnMinimap(lua_State *L)
UINT8 *colormap = NULL; // do we want to colormap this patch?
boolean centered; // the patch is centered and doesn't need readjusting on x/y coordinates.
huddrawlist_h list;
patch_t *AutomapPic = NULL;
// variables used to replicate k_kart's mmap drawer:
INT32 lumpnum;
patch_t *AutomapPic;
INT32 mx, my;
INT32 splitflags, minimaptrans;
// base position of the minimap which also takes splits into account:
INT32 MM_X, MM_Y;
// variables used for actually drawing the icon:
INT32 splitflags, minimaptrans;
fixed_t amnumxpos, amnumypos;
fixed_t amxpos, amypos;
INT32 mm_x, mm_y;
INT32 amxpos, amypos;
node_t *bsp = &nodes[numnodes-1];
fixed_t maxx, minx, maxy, miny;
fixed_t mapwidth, mapheight;
fixed_t xoffset, yoffset;
fixed_t xscale, yscale, zoom;
fixed_t patchw, patchh;
HUDONLY // only run this function in hud hooks
@@ -598,6 +618,8 @@ static int libd_drawOnMinimap(lua_State *L)
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
centered = lua_optboolean(L, 6);
// replicate exactly what source does for its minimap drawer; AKA hardcoded garbo.
// first, check what position the mmap is supposed to be in (pasted from k_kart.c):
MM_X = BASEVIDWIDTH - 50 + cv_mini_xoffset.value; // 270
MM_Y = (BASEVIDHEIGHT/2)-16 + cv_mini_yoffset.value; // 84
@@ -632,6 +654,7 @@ static int libd_drawOnMinimap(lua_State *L)
else
return 0;
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
splitflags |= minimaptrans;
@@ -649,73 +672,100 @@ static int libd_drawOnMinimap(lua_State *L)
if (gamestate != GS_LEVEL)
return 0;
if (stplyrnum != 0)
if (stplyr != &players[displayplayers[0]])
return 0;
AutomapPic = minimapinfo.minimap_pic;
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
if (!AutomapPic)
{
if (lumpnum != -1)
AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
else
return 0; // no pic, just get outta here
}
// Handle offsets and stuff.
mm_x = MM_X - (SHORT(AutomapPic->width)/2);
mm_y = MM_Y - (SHORT(AutomapPic->height)/2);
mx = MM_X - (AutomapPic->width/2);
my = MM_Y - (AutomapPic->height/2);
// let offsets transfer to the heads, too!
if (encoremode)
{
mm_x += SHORT(AutomapPic->leftoffset);
}
mx += SHORT(AutomapPic->leftoffset);
else
{
mm_x -= SHORT(AutomapPic->leftoffset);
}
mx -= SHORT(AutomapPic->leftoffset);
my -= SHORT(AutomapPic->topoffset);
mm_y -= SHORT(AutomapPic->topoffset);
// now that we have replicated this behavior, we can draw an icon from our supplied x, y coordinates by replicating k_kart.c's totally understandable uncommented code!!!
// scale patch coords
patchw = (SHORT(patch->width) * scale / 2);
patchh = (SHORT(patch->height) * scale / 2);
// get map boundaries using nodes
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 (centered)
{
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
}
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];
amnumxpos = (FixedMul(x, minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(y, minimapinfo.zoom) - minimapinfo.offs_y);
// 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;
// these are our final map boundaries:
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(x, zoom) - FixedMul(xoffset, zoom));
amnumypos = -(FixedMul(y, zoom) - FixedMul(yoffset, zoom));
if (encoremode)
{
amnumxpos = -amnumxpos;
}
amxpos = amnumxpos + ((mm_x + SHORT(AutomapPic->width) / 2)<<FRACBITS) - patchw;
amypos = amnumypos + ((mm_y + SHORT(AutomapPic->height) / 2)<<FRACBITS) - patchh;
// scale patch coords
patchw = patch->width*scale /2;
patchh = patch->height*scale /2;
if (centered)
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
amxpos = amnumxpos + ((mx + AutomapPic->width/2)<<FRACBITS) - patchw;
amypos = amnumypos + ((my + AutomapPic->height/2)<<FRACBITS) - patchh;
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
list = (huddrawlist_h) lua_touserdata(L, -1);
lua_pop(L, 1);
if (cv_minihead.value)
{
amxpos += patchw / 2;
amypos += patchh / 2;
scale /= 2;
}
if (LUA_HUD_IsDrawListValid(list))
{
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
}
else
{
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
if (LUA_HUD_IsDrawListValid(list)){
if (cv_minihead.value)
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale/2, patch, splitflags, colormap);
else
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
}else{
if (cv_minihead.value)
V_DrawFixedPatch(amxpos, amypos, scale/2, splitflags, patch, colormap);
else
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
}
return 0;
}
@@ -1201,8 +1251,6 @@ static luaL_Reg lib_draw[] = {
{NULL, NULL}
};
static int lib_draw_ref;
//
// lib_hud
//
@@ -1236,7 +1284,25 @@ static int lib_hudenabled(lua_State *L)
}
// add a HUD element for rendering
extern int lib_hudadd(lua_State *L);
static int lib_hudadd(lua_State *L)
{
enum hudhook field;
luaL_checktype(L, 1, LUA_TFUNCTION);
field = luaL_checkoption(L, 2, "game", hudhook_opt);
lua_getfield(L, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(L, -1));
lua_rawgeti(L, -1, field+2); // HUD[2+]
I_Assert(lua_istable(L, -1));
lua_remove(L, -2);
lua_pushvalue(L, 1);
lua_rawseti(L, -2, (int)(lua_objlen(L, -2) + 1));
hudAvailable |= 1<<field;
return 0;
}
static int lib_hudsetvotebackground(lua_State *L)
{
@@ -1321,9 +1387,23 @@ int LUA_HudLib(lua_State *L)
{
memset(hud_enabled, 0xff, (hud_MAX/8)+1);
lua_newtable(L);
luaL_register(L, NULL, lib_draw);
lib_draw_ref = luaL_ref(L, LUA_REGISTRYINDEX);
lua_newtable(L); // HUD registry table
lua_newtable(L);
luaL_register(L, NULL, lib_draw);
lua_rawseti(L, -2, 1); // HUD[1] = lib_draw
lua_newtable(L);
lua_rawseti(L, -2, 2); // HUD[2] = game rendering functions array
lua_newtable(L);
lua_rawseti(L, -2, 3); // HUD[3] = scores rendering functions array
lua_newtable(L);
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
lua_newtable(L);
lua_rawseti(L, -2, 5); // HUD[5] = vote rendering functions array
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
luaL_newmetatable(L, META_HUDINFO);
lua_pushcfunction(L, hudinfo_get);
@@ -1359,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;
}
@@ -1379,19 +1455,153 @@ boolean LUA_HudEnabled(enum hud option)
return false;
}
void LUA_SetHudHook(int hook, huddrawlist_h list)
// Hook for HUD rendering
void LUAh_GameHUD(huddrawlist_h list)
{
lua_getref(gL, lib_draw_ref);
if (!gL || !(hudAvailable & (1<<hudhook_game)))
return;
lua_pushlightuserdata(gL, list);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
// there used to be a switch statement here, its gone now.
if (hook == HUD_HOOK(game))
{
LUA_PushUserdata(gL, stplyr, META_PLAYER);
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
camnum = stplyrnum + 1; // for compatibility
hud_running = true;
lua_settop(gL, 0);
lua_pushcfunction(gL, LUA_GetErrorMessage);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hudhook_game+2); // HUD[2] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
I_Assert(lua_istable(gL, -1));
lua_remove(gL, -3); // pop HUD
LUA_PushUserdata(gL, stplyr, META_PLAYER);
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
camnum = stplyrnum + 1;
hud_interpcounter = 0;
lua_pushnil(gL);
while (lua_next(gL, -5) != 0) {
hud_interpolate = hud_interpstring = hud_interplatch = false;
hud_interpcounter++;
lua_pushvalue(gL, -5); // graphics library (HUD[1])
lua_pushvalue(gL, -5); // stplyr
lua_pushvalue(gL, -5); // camera
LUA_Call(gL, 3, 0, 1);
}
lua_settop(gL, 0);
hud_running = false;
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
void LUAh_ScoresHUD(huddrawlist_h list)
{
if (!gL || !(hudAvailable & (1<<hudhook_scores)))
return;
lua_pushlightuserdata(gL, list);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
hud_running = true;
lua_settop(gL, 0);
lua_pushcfunction(gL, LUA_GetErrorMessage);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hudhook_scores+2); // HUD[3] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
I_Assert(lua_istable(gL, -1));
lua_remove(gL, -3); // pop HUD
lua_pushnil(gL);
hud_interpcounter = 0;
while (lua_next(gL, -3) != 0) {
hud_interpolate = hud_interpstring = hud_interplatch = false;
hud_interpcounter++;
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1, 0, 1);
}
lua_settop(gL, 0);
hud_running = false;
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
void LUAh_IntermissionHUD(huddrawlist_h list)
{
if (!gL || !(hudAvailable & (1<<hudhook_intermission)))
return;
lua_pushlightuserdata(gL, list);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
hud_running = true;
lua_settop(gL, 0);
lua_pushcfunction(gL, LUA_GetErrorMessage);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hudhook_intermission+2); // HUD[4] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
I_Assert(lua_istable(gL, -1));
lua_remove(gL, -3); // pop HUD
lua_pushnil(gL);
hud_interpcounter = 0;
while (lua_next(gL, -3) != 0) {
hud_interpolate = hud_interpstring = hud_interplatch = false;
hud_interpcounter++;
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1, 0, 1);
}
lua_settop(gL, 0);
hud_running = false;
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
void LUAh_VoteHUD(huddrawlist_h list)
{
if (!gL || !(hudAvailable & (1<<hudhook_vote)))
return;
lua_pushlightuserdata(gL, list);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
hud_running = true;
lua_settop(gL, 0);
lua_pushcfunction(gL, LUA_GetErrorMessage);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hudhook_vote+2); // HUD[5] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
I_Assert(lua_istable(gL, -1));
lua_remove(gL, -3); // pop HUD
lua_pushnil(gL);
hud_interpcounter = 0;
while (lua_next(gL, -3) != 0) {
hud_interpolate = hud_interpstring = hud_interplatch = false;
hud_interpcounter++;
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1, 0, 1);
}
lua_settop(gL, 0);
hud_running = false;
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
+1 -7
View File
@@ -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 -356
View File
@@ -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);
@@ -111,8 +135,6 @@ static void A_Lua(mobj_t *actor)
lua_pushinteger(gL, var2);
LUA_Call(gL, 3, 0, 1);
lua_pop(gL, 1); // pop error handler
if (found)
{
--superstack;
@@ -254,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
@@ -291,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));
@@ -302,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;
@@ -398,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)
@@ -406,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.
@@ -444,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;
}
@@ -598,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;
}
@@ -761,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!");
@@ -771,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);
@@ -853,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;
}
@@ -896,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)
{
@@ -938,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);
// 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:
@@ -997,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;
}
@@ -1028,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!");
@@ -1043,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;
}
@@ -1098,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");
@@ -1111,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");
@@ -1124,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);
@@ -1177,4 +983,4 @@ int LUA_InfoLib(lua_State *L)
lua_setglobal(L, "S_sfx");
lua_setglobal(L, "sfxinfo");
return 0;
}
}
+50 -194
View File
@@ -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,
@@ -281,7 +267,7 @@ static int lib_iterateSectorThinglist(lua_State *L)
if (!lua_isnil(L, 1))
{
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
if (!thing)
if (P_MobjWasRemoved(thing))
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
thing = thing->snext;
}
@@ -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
View File
@@ -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
View File
@@ -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);
+560 -271
View File
File diff suppressed because it is too large. Load diff
+8 -7
View File
@@ -13,7 +13,6 @@
#include "m_fixed.h"
#include "doomtype.h"
#include "d_player.h"
#include "p_saveg.h"
#include "blua/lua.h"
#include "blua/lualib.h"
@@ -56,15 +55,17 @@ void LUA_InvalidateLevel(void);
void LUA_InvalidateMapthings(void);
void LUA_InvalidatePlayer(player_t *player);
void LUA_Step(void);
void LUA_Archive(savebuffer_t *save, boolean network);
void LUA_UnArchive(savebuffer_t *save, boolean network);
void LUA_Archive(void);
void LUA_UnArchive(void);
void LUA_ArchiveDemo(void);
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[]);
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save);
//void LUA_HookNetArchive(lua_CFunction archFunc);
int Lua_optoption(lua_State *L, int narg,
const char *def, const char *const lst[]);
void LUAh_NetArchiveHook(lua_CFunction archFunc);
// Console wrapper
void COM_Lua_f(void);
+1 -6
View File
@@ -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");
+3 -4
View File
@@ -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;
}
}
@@ -1091,7 +1090,7 @@ void OP_ObjectplaceMovement(player_t *player)
{
ticcmd_t *cmd = &player->cmd;
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
ticruned++;
+7
View File
@@ -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;
-29
View File
@@ -247,35 +247,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
return INT32_MAX;
}
/** \brief The xs_CRoundToInt function
\param val double number
\return Round toward nearest, but ties round toward even
*/
#if defined(SRB2_BIG_ENDIAN)
#define _xs_iexp_ 0
#define _xs_iman_ 1
#else
#define _xs_iexp_ 1 //intel is little endian
#define _xs_iman_ 0
#endif //BigEndian_
typedef double real64;
typedef union _xs_doubleints
{
real64 val;
unsigned ival[2];
} _xs_doubleints;
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
{
_xs_doubleints uval;
uval.val = val + 6755399441055744.0;
return uval.ival[_xs_iman_];
}
typedef struct
{
fixed_t x;
+1318 -1338
View File
File diff suppressed because it is too large. Load diff
+2 -27
View File
@@ -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,12 +286,8 @@ void PDistort_menu_Onchange(void);
// Bird menu updating
void Bird_menu_Onchange(void);
// Saturn Hud menu updating
void SaturnHud_menu_Onchange(void);
#ifdef HWRENDER
void M_UpdateOGLMenu(void);
#endif
// Saturn menu updating
void Saturn_menu_Onchange(void);
void M_ReplayHut(INT32 choice);
void M_SetPlaybackMenuPointer(void);
@@ -411,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 -129
View File
@@ -27,8 +27,6 @@
// Extended map support.
#include <ctype.h>
#include "am_map.h"
#include "doomdef.h"
#include "g_game.h"
#include "m_misc.h"
@@ -336,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.
@@ -559,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)
{
@@ -1575,84 +1524,6 @@ boolean M_ScreenshotResponder(event_t *ev)
return true;
}
void M_MinimapGenerate(void)
{
#ifdef USE_PNG
char *filepath;
boolean ret = false;
minigen_t *minigen = NULL;
size_t option_scale;
INT32 mul = 1;
if (gamestate != GS_LEVEL)
{
CONS_Alert(CONS_ERROR, "You must be in a level to generate a preliminary minimap!\n");
return;
}
if (automapactive)
{
CONS_Alert(CONS_ERROR, "The automap is active! Please deactivate it and try again.\n");
return;
}
option_scale = COM_CheckPartialParm("-m");
if (option_scale)
{
if (COM_Argc() < option_scale + 2)/* no argument after? */
{
CONS_Alert(CONS_ERROR,
"No multiplier follows parameter '%s'.\n",
COM_Argv(option_scale));
return;
}
mul = atoi(COM_Argv(option_scale + 1));
if (mul < 1 || mul > 10)
{
CONS_Alert(CONS_ERROR,
"Multiplier %d must be within range 1-10.\n",
mul);
return;
}
filepath = va("%s" PATHSEP "%s-MINIMAP-%d.png", srb2home, G_BuildMapName(gamemap), mul);
}
else
{
filepath = va("%s" PATHSEP "%s-MINIMAP.png", srb2home, G_BuildMapName(gamemap));
}
minigen = AM_MinimapGenerate(mul);
if (minigen == NULL || minigen->buf == NULL)
goto failure;
M_CreateScreenShotPalette();
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
failure:
if (minigen->buf != NULL)
free(minigen->buf);
if (ret)
{
CONS_Printf(M_GetText("%s saved.\nRemember that this is not a complete minimap,\nand must be edited before putting in-game.\n"), filepath);
if (mul != 1)
{
CONS_Printf("You should divide its size by %d!\n", mul);
}
}
else
{
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
}
#endif //#ifdef USE_PNG
}
// ==========================================================================
// TRANSLATION FUNCTIONS
// ==========================================================================
@@ -2067,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)
-3
View File
@@ -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);
@@ -69,8 +68,6 @@ void M_ScreenShot(void);
void M_DoScreenShot(void);
boolean M_ScreenshotResponder(event_t *ev);
void M_MinimapGenerate(void);
void Command_SaveConfig_f(void);
void Command_LoadConfig_f(void);
void Command_ChangeConfig_f(void);
+7 -10
View File
@@ -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}
};
@@ -301,7 +300,7 @@ static boolean PS_IsRowValid(perfstatrow_t *row)
|| (row->flags & PS_SW && rendermode != render_soft)
|| (row->flags & PS_HW && rendermode != render_opengl)
#ifdef HWRENDER
|| (row->flags & PS_BATCHING && !cv_glbatching.value)
|| (row->flags & PS_BATCHING && !cv_grbatching.value)
#endif
);
}
@@ -518,7 +517,7 @@ static void PS_UpdateFrameStats(void)
ps_hw_spritesorttime.value.p +
ps_hw_spritedrawtime.value.p;
if (cv_glbatching.value)
if (cv_grbatching.value)
{
ps_otherrendertime.value.p -=
ps_hw_batchsorttime.value.p +
@@ -547,7 +546,7 @@ static void PS_UpdateFrameStats(void)
PS_UpdateRowHistories(interpolation_rows, true);*/
#ifdef HWRENDER
if (rendermode == render_opengl && cv_glbatching.value)
if (rendermode == render_opengl && cv_grbatching.value)
{
PS_UpdateRowHistories(batchcount_rows, true);
PS_UpdateRowHistories(batchcalls_rows, true);
@@ -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)
@@ -760,7 +757,7 @@ static void PS_DrawRenderStats(void)
/*cy = */PS_DrawPerfRows(x, 10, V_BLUEMAP, commoncounter_rows);// + half_row;
#ifdef HWRENDER
if (rendermode == render_opengl && cv_glbatching.value)
if (rendermode == render_opengl && cv_grbatching.value)
{
x = hires ? 200 : 155;
y = PS_DrawPerfRows(x, 10, V_PURPLEMAP, batchcount_rows);
-316
View File
@@ -1,316 +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;
}
static void M_TextInputPaste(textinput_t *input)
{
const char *paste = I_ClipboardPaste();
if (input->select != input->cursor)
M_TextInputDelSelection(input);
if (paste != NULL)
M_TextInputAddString(input, paste);
}
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;
input->buffer[0] = 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 (shiftdown && key == KEY_INS)
{
M_TextInputPaste(input);
return true;
}
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')
{
M_TextInputPaste(input);
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;
}
-23
View File
@@ -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
View File
@@ -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
View File
@@ -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
Loaded 100 of 173 files, more files were not shown because too many files have changed in this diff. Show more