diff --git a/AppImage_build.sh b/AppImage_build.sh new file mode 100755 index 000000000..2822d00d3 --- /dev/null +++ b/AppImage_build.sh @@ -0,0 +1,346 @@ +#!/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" < ./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 diff --git a/LUASTUFF.md b/LUASTUFF.md index e72ae4c2a..a8f285692 100644 --- a/LUASTUFF.md +++ b/LUASTUFF.md @@ -130,8 +130,24 @@ 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. diff --git a/src/Makefile b/src/Makefile index 78dfdd4f7..72f82265b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -633,6 +633,17 @@ 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: diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ef1076b3b..ae3f844c7 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -50,7 +50,6 @@ #include "s_sound.h" // sfx_syfail #include "m_perfstats.h" #include "d_main.h" -#include "r_fps.h" #ifdef CLIENT_LOADINGSCREEN // cl loading screen @@ -238,7 +237,7 @@ UINT16 software_MAXPACKETLENGTH; * \return The full tic value * */ -tic_t ExpandTics(INT32 low, tic_t basetic) +static inline tic_t ExpandTics(INT32 low, tic_t basetic) { INT32 delta; @@ -6314,8 +6313,6 @@ boolean TryRunTics(tic_t realtics) if (ticking) { - boolean tickInterp = true; - // run the count * tics while (neededtic > gametic) { @@ -6326,18 +6323,7 @@ boolean TryRunTics(tic_t realtics) if (update_stats) PS_START_TIMING(ps_tictime); - boolean run = (gametic % NEWTICRATERATIO) == 0; - - if (run && tickInterp) - { - // Update old view state BEFORE ticking so resetting - // the old interpolation state from game logic works. - R_UpdateViewInterpolation(); - tickInterp = false; // do not update again in sped-up tics - } - - G_Ticker(run); - + G_Ticker((gametic % NEWTICRATERATIO) == 0); ExtraDataTicker(); gametic++; consistancy[gametic%TICQUEUE] = Consistancy(); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 37a828788..b5ad26eea 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -589,7 +589,7 @@ 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 diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a81b6d1bf..f4a4838cc 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5698,6 +5698,12 @@ void Command_ExitGame_f(void) { INT32 i; + if (dedicated) + { + CONS_Printf("This command cannot be used on dedicated server\n"); + return; + } + D_QuitNetGame(); CL_Reset(); CV_ClearChangedFlags(); diff --git a/src/g_game.c b/src/g_game.c index daee674b3..151a055a9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -525,8 +525,6 @@ consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -static void G_FixCamera(UINT8 view); - #if MAXPLAYERS > 16 #error "please update player_name table using the new value for MAXPLAYERS" #endif @@ -2085,6 +2083,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) UINT8 viewd; INT32 *displayplayerp; + camera_t *camerap; INT32 olddisplayplayer; INT32 playersviewable; @@ -2123,15 +2122,29 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) (*displayplayerp) = playernum; if ((*displayplayerp) != olddisplayplayer) { - G_FixCamera(viewnum); + camerap = &camera[viewnum-1]; + P_ResetCamera(&players[(*displayplayerp)], camerap); + + // Make sure the viewport doesn't interpolate at all into + // its new position -- just snap instantly into place. + R_ResetViewInterpolation(viewnum); } if (viewnum > splits) { for (viewd = splits+1; viewd < viewnum; ++viewd) { - displayplayers[viewd-1] = G_FindView(displayplayers[viewd-1], viewd, onlyactive, playernum < olddisplayplayer); - G_FixCamera(viewd); + displayplayerp = (&displayplayers[viewd-1]); + camerap = &camera[viewd]; + + (*displayplayerp) = G_FindView(0, viewd, onlyactive, false); + + P_ResetCamera(&players[(*displayplayerp)], camerap); + + + // Make sure the viewport doesn't interpolate at all into + // its new position -- just snap instantly into place. + R_ResetViewInterpolation(viewd); } } @@ -2189,26 +2202,6 @@ void G_ResetViews(void) } } -// -// G_FixCamera -// Reset camera position, angle and interpolation on a view -// after changing state. -// -static void G_FixCamera(UINT8 view) -{ - player_t *player = &players[displayplayers[view - 1]]; - - // The order of displayplayers can change, which would - // invalidate localangle. - //localangle[view - 1] = player->cmd.angleturn; - - P_ResetCamera(player, &camera[view - 1]); - - // Make sure the viewport doesn't interpolate at all into - // its new position -- just snap instantly into place. - R_ResetViewInterpolation(view); -} - // // G_Ticker // Make ticcmd_ts for the players. @@ -2712,8 +2705,7 @@ void G_PlayerReborn(INT32 player) } /* I'm putting this here because lol */ - - fade = (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(p)); + fade = (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(p)); if (fade) { @@ -2723,7 +2715,7 @@ void G_PlayerReborn(INT32 player) Fade it in with the same call to avoid max volume for a few milliseconds (?). */ - if (! playing) + if (!playing) S_SetRestoreMusicFadeInCvar(&cv_respawnfademusicback); } diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 8223f7527..d75c9b17e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -26,6 +26,8 @@ #include "hw_md2.h" #include "hw_clip.h" +#include "r_opengl/r_opengl.h" + #include "../i_video.h" // for rendermode == render_glide #include "../v_video.h" #include "../p_local.h" @@ -4241,7 +4243,7 @@ static void HWR_SortVisSprites(void) gr_vsprorder[i] = HWR_GetVisSprite(i); } - qs22j(gr_vsprorder, gr_visspritecount, sizeof(gr_vissprite_t*), CompareVisSprites); + qsort(gr_vsprorder, gr_visspritecount, sizeof(gr_vissprite_t*), CompareVisSprites); } // A drawnode is something that points to a 3D floor, 3D side, or masked @@ -4682,14 +4684,15 @@ static void HWR_AddPrecipitationSprites(void) { //const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale; fixed_t drawdist; + fixed_t precipscale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT; INT32 xl, xh, yl, yh, bx, by; precipmobj_t *th; if (current_bsp_culling_distance) - drawdist = min(current_bsp_culling_distance, (fixed_t)(cv_drawdist_precip.value) * mapobjectscale); + drawdist = min((fixed_t)current_bsp_culling_distance, (fixed_t)(cv_drawdist_precip.value) * precipscale); else - drawdist = (fixed_t)(cv_drawdist_precip.value) * mapobjectscale; + drawdist = (fixed_t)(cv_drawdist_precip.value) * precipscale; // No to infinite precipitation draw distance. if (drawdist == 0) @@ -5110,6 +5113,12 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) // uncapped/interpolation interpmobjstate_t interp = {0}; + // okay... this is a hack, but weather isn't networked, so it should be ok + if (!P_PrecipThinker(thing)) + { + return; + } + // do interpolation if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value)) { @@ -5203,16 +5212,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height); vis->precip = true; - - // okay... this is a hack, but weather isn't networked, so it should be ok - if (!(thing->precipflags & PCF_THUNK)) - { - if (thing->precipflags & PCF_RAIN) - P_RainThinker(thing); - else - P_SnowThinker(thing); - thing->precipflags |= PCF_THUNK; - } } static boolean drewsky = false; @@ -5877,6 +5876,9 @@ void HWR_Shutdown(void) HWR_FreeMipmapCache(); HWR_FreeTextureCache(); HWD.pfnFlushScreenTextures(); +#ifdef USE_FBO_OGL + GLFramebuffer_Disable(); +#endif } void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index c3d0daf0d..96a608df6 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -120,8 +120,6 @@ GLfloat projMatrix[16]; static GLint viewport[4]; #ifdef USE_FBO_OGL -static boolean GLFramebuffer_IsFuncAvailible(void); - GLuint FramebufferObject, FramebufferTexture, RenderbufferObject; GLboolean FrameBufferEnabled = GL_FALSE, RenderToFramebuffer = GL_FALSE; @@ -707,6 +705,9 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f}; +#ifdef USE_FBO_OGL +static boolean GLFramebuffer_IsFuncAvailible(void); +#endif void SetupGLFunc4(void) { @@ -764,6 +765,8 @@ void SetupGLFunc4(void) pglDeleteRenderbuffers = GetGLFunc("glDeleteRenderbuffers"); pglRenderbufferStorage = GetGLFunc("glRenderbufferStorage"); pglFramebufferRenderbuffer = GetGLFunc("glFramebufferRenderbuffer"); + + supportFBO = true; } #endif } @@ -775,9 +778,7 @@ static boolean GLFramebuffer_IsFuncAvailible(void) if (majorGL < 3) return false; - return((isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions)) && - (isExtAvailable("GL_ARB_framebuffer_object",gl_extensions)) && - (isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions))); + return (isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions)); return false; } @@ -1043,37 +1044,9 @@ EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo) } #ifdef USE_FBO_OGL -void GLFramebuffer_Generate(void) +static void GLFramebuffer_GenerateAttachments(void) { - if (!GLFramebuffer_IsFuncAvailible()) - return; - - // Generate the framebuffer - if (FramebufferObject == 0) - pglGenFramebuffers(1, &FramebufferObject); - - if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) - GLFramebuffer_GenerateAttachments(); -} - -void GLFramebuffer_Delete(void) -{ - if (!GLFramebuffer_IsFuncAvailible()) - return; - - // Unbind the framebuffer - pglBindFramebuffer(GL_FRAMEBUFFER, 0); - - if (FramebufferObject) - pglDeleteFramebuffers(1, &FramebufferObject); - - GLFramebuffer_DeleteAttachments(); - FramebufferObject = 0; -} - -void GLFramebuffer_GenerateAttachments(void) -{ - if (!GLFramebuffer_IsFuncAvailible()) + if (!supportFBO) return; // Bind the framebuffer @@ -1114,11 +1087,12 @@ void GLFramebuffer_GenerateAttachments(void) void GLFramebuffer_DeleteAttachments(void) { - if (!GLFramebuffer_IsFuncAvailible()) + if (!supportFBO) return; // Unbind the framebuffer pglBindFramebuffer(GL_FRAMEBUFFER, 0); + pglBindRenderbuffer(GL_RENDERBUFFER, 0); if (FramebufferTexture) pglDeleteTextures(1, &FramebufferTexture); @@ -1130,9 +1104,43 @@ void GLFramebuffer_DeleteAttachments(void) RenderbufferObject = 0; } -void GLFramebuffer_Enable(void) +static void GLFramebuffer_Generate(void) { - if (!GLFramebuffer_IsFuncAvailible()) + if (!supportFBO) + return; + + // Generate the framebuffer + if (FramebufferObject == 0) + pglGenFramebuffers(1, &FramebufferObject); + + if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) + GLFramebuffer_GenerateAttachments(); +} + +static void GLFramebuffer_Delete(void) +{ + if (!supportFBO) + return; + + if (FramebufferObject) + pglDeleteFramebuffers(1, &FramebufferObject); + + GLFramebuffer_DeleteAttachments(); + FramebufferObject = 0; +} + +inline void GLFramebuffer_Unbind(void) +{ + if (!supportFBO) + return; + + pglBindFramebuffer(GL_FRAMEBUFFER, 0); + pglBindRenderbuffer(GL_RENDERBUFFER, 0); +} + +inline void GLFramebuffer_Enable(void) +{ + if (!supportFBO) return; if (FramebufferObject == 0) @@ -1146,11 +1154,13 @@ void GLFramebuffer_Enable(void) void GLFramebuffer_Disable(void) { - if (!GLFramebuffer_IsFuncAvailible()) + if (!supportFBO) return; pglBindFramebuffer(GL_FRAMEBUFFER, 0); pglBindRenderbuffer(GL_RENDERBUFFER, 0); + + GLFramebuffer_Delete(); } #endif @@ -2343,7 +2353,6 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) #ifdef USE_FBO_OGL case HWD_SET_FRAMEBUFFER: FrameBufferEnabled = Value ? GL_TRUE : GL_FALSE; - supportFBO = GLFramebuffer_IsFuncAvailible(); if (!supportFBO) { diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index 255969d5a..baab44637 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -105,12 +105,9 @@ static PFNglEnableClientState pglEnableClientState; #endif #ifdef USE_FBO_OGL -void GLFramebuffer_Generate(void); -void GLFramebuffer_Delete(void); - -void GLFramebuffer_GenerateAttachments(void); void GLFramebuffer_DeleteAttachments(void); +void GLFramebuffer_Unbind(void); void GLFramebuffer_Enable(void); void GLFramebuffer_Disable(void); diff --git a/src/i_sound.h b/src/i_sound.h index d0542cfb5..925be7596 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -159,7 +159,6 @@ boolean I_SetSongPosition(UINT32 position); UINT32 I_GetSongPosition(void); void I_UpdateSongLagThreshold (void); -void I_UpdateSongLagConditions (void); /// ------------------------ // MUSIC PLAYBACK diff --git a/src/i_video.h b/src/i_video.h index 708fde03c..6a60f8036 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -140,6 +140,10 @@ UINT32 I_GetRefreshRate(void); boolean I_UseNativeKeyboard(void); #ifdef USE_FBO_OGL +#if defined (__unix__) +extern boolean xwaylandcrap; +#endif + void RefreshOGLSDLSurface(void); void I_DownSample(void); extern boolean downsample; diff --git a/src/info.c b/src/info.c index b417c1135..f8cb9a6f1 100644 --- a/src/info.c +++ b/src/info.c @@ -1822,7 +1822,7 @@ state_t states[NUMSTATES] = // Rain {SPR_RAIN, FF_TRANS50, -1, {NULL}, 0, 0, S_NULL}, // S_RAIN1 - {SPR_RAIN, FF_TRANS50, 1, {NULL}, 0, 0, S_RAIN1}, // S_RAINRETURN + {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_RAINRETURN // Snowflake {SPR_SNO1, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SNOW1 @@ -1841,9 +1841,9 @@ state_t states[NUMSTATES] = {SPR_SPLH, FF_TRANS50|8, 2, {NULL}, 0, 0, S_NULL}, // S_SPLISH9 // Water Splash - {SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1 - {SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2 - {SPR_SPLA, FF_TRANS90|2, 3, {NULL}, 0, 0, S_RAINRETURN}, // 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_NULL}, // S_SPLASH3 // Smoke {SPR_SMOK, FF_TRANS50 , 4, {NULL}, 0, 0, S_SMOKE2}, // S_SMOKE1 @@ -11198,22 +11198,22 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_RAIN1, // spawnstate 1000, // spawnhealth S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime + sfx_rainin, // seesound + 0, // reactiontime sfx_None, // attacksound S_NULL, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_NULL, // deathstate + S_SPLASH1, // 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 - 4, // mass + 80, // mass 0, // damage sfx_None, // activesound MF_NOBLOCKMAP, // flags @@ -11226,7 +11226,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound - 8, // reactiontime + 0, // reactiontime sfx_None, // attacksound S_NULL, // painstate 0, // painchance @@ -11240,7 +11240,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4*FRACUNIT, // radius 4*FRACUNIT, // height 0, // display offset - 4, // mass + 0, // mass 0, // damage sfx_None, // activesound MF_NOBLOCKMAP, // flags diff --git a/src/k_kart.c b/src/k_kart.c index 2ef1ffa68..7ed4f5482 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -88,7 +88,7 @@ consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //Colourized HUD -consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, Saturn_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, SaturnHud_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_colorizeditembox = {"colorizeditembox", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t HudColor_cons_t[MAXSKINCOLORS+1]; @@ -7637,7 +7637,7 @@ static void K_initKartHUD(void) } } - if (timeinmap > 113) + if (timeinmap > 113 || forceshowhud) hudtrans = cv_translucenthud.value; else if (timeinmap > 105) hudtrans = ((((INT32)timeinmap) - 105)*cv_translucenthud.value)/(113-105); @@ -8227,39 +8227,36 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI { tic_t worktime = drawtime/(60*TICRATE); - if (worktime >= 100) - { - worktime = 99; - drawtime = (100*(60*TICRATE))-1; - } - - if ((cv_timelimit.value && G_BattleGametype()) && (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value)) // i hate this so much + if ((G_BattleGametype() && cv_timelimit.value) && (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value)) // i hate this so much { V_DrawKartString(TX, TY+3, splitflags, va("OVERTIME")); - return; } + else if (worktime < 100) + { + // minutes time 00 __ __ + V_DrawKartString(TX, TY+3, splitflags, va("%d", worktime/10)); + V_DrawKartString(TX+12, TY+3, splitflags, va("%d", worktime%10)); - // minutes time 00 __ __ - V_DrawKartString(TX, TY+3, splitflags, va("%d", worktime/10)); - V_DrawKartString(TX+12, TY+3, splitflags, va("%d", worktime%10)); + // apostrophe location _'__ __ + V_DrawKartString(TX+24, TY+3, splitflags, va("'")); - // apostrophe location _'__ __ - V_DrawKartString(TX+24, TY+3, splitflags, va("'")); + worktime = (drawtime/TICRATE % 60); - worktime = (drawtime/TICRATE % 60); + // seconds time _ 00 __ + V_DrawKartString(TX+36, TY+3, splitflags, va("%d", worktime/10)); + V_DrawKartString(TX+48, TY+3, splitflags, va("%d", worktime%10)); - // seconds time _ 00 __ - V_DrawKartString(TX+36, TY+3, splitflags, va("%d", worktime/10)); - V_DrawKartString(TX+48, TY+3, splitflags, va("%d", worktime%10)); + // quotation mark location _ __"__ + V_DrawKartString(TX+60, TY+3, splitflags, va("\"")); - // quotation mark location _ __"__ - V_DrawKartString(TX+60, TY+3, splitflags, va("\"")); + worktime = G_TicsToCentiseconds(drawtime); - worktime = G_TicsToCentiseconds(drawtime); - - // tics _ __ 00 - V_DrawKartString(TX+72, TY+3, splitflags, va("%d", worktime/10)); - V_DrawKartString(TX+84, TY+3, splitflags, va("%d", worktime%10)); + // tics _ __ 00 + V_DrawKartString(TX+72, TY+3, splitflags, va("%d", worktime/10)); + V_DrawKartString(TX+84, TY+3, splitflags, va("%d", worktime%10)); + } + else if ((drawtime/TICRATE) & 1) + V_DrawKartString(TX, TY+3, splitflags, va("99'59\"99")); } if (emblemmap && (modeattacking || (mode == 1)) && !demo.playback) // emblem time! @@ -8927,6 +8924,14 @@ static void K_drawKartBumpersOrKarma(void) fy = info.y; fflags = info.flags; + if (cv_battlespeedo.value) + { + if ((cv_newspeedometer.value == 2 && xtra_speedo) || (cv_newspeedometer.value == 3 && achi_speedo) || (cv_newspeedometer.value == 5 && xtra_speedo3)) + fy -= -10; + else + fy -= -14; + } + if (splitscreen > 1) { if (stplyr->kartstuff[k_bumper] <= 0) @@ -9366,9 +9371,17 @@ static void K_drawDriftGauge(void) 0, 31, 47, 63, 79, 95, 111, 119, 127, 143, 159, 175, 183, 191, 199, 207, 223, 247 }; - if (!stplyr->mo || !stplyr->kartstuff[k_drift] || (!splitscreen && !camera->chase)) + if (!stplyr->mo || (!splitscreen && !camera->chase)) return; + if (forceshowhud) + goto skipcrap; // i will skip the drift early return and you cant stop me! + + if (!stplyr->kartstuff[k_drift]) + return; + +skipcrap: + if (!K_GetScreenCoords(&pos, stplyr, stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false)) return; @@ -9746,7 +9759,9 @@ static void K_drawKartMinimap(void) splitflags = info.flags; - if (timeinmap > 105) + if (forceshowhud) + minimaptrans = cv_kartminimap.value; + else if (timeinmap > 105) { minimaptrans = cv_kartminimap.value; if (timeinmap <= 113) diff --git a/src/m_menu.c b/src/m_menu.c index 897016b2b..6a888b0f7 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -361,6 +361,7 @@ static void M_DeleteProtocol(void); // Saturn menu_t OP_SaturnDef; +menu_t OP_SaturnHudDef; menu_t OP_HudOffsetDef; menu_t OP_PlayerDistortDef; menu_t OP_SaturnCreditsDef; @@ -461,6 +462,9 @@ static void Newgametype_OnChange(void); static void Dummymenuplayer_OnChange(void); static void Dummystaff_OnChange(void); +// crap to force hud to show when in saturns hud options +boolean forceshowhud = false; + // ========================================================================== // CONSOLE VARIABLES AND THEIR POSSIBLE VALUES GO HERE. // ========================================================================== @@ -1214,89 +1218,89 @@ static menuitem_t OP_AllControlsMenu[] = static menuitem_t OP_Joystick1Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup1PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis , 30}, - {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis , 40}, - {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis , 50}, - {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis , 60}, - {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 70}, - {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 80}, - {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis , 90}, - {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis , 100}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis , 110}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis , 120}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis , 130}, - {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone , 140}, - {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 150}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis , 20}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis , 25}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis , 30}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis , 35}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 40}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 45}, + {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis , 50}, + {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis , 55}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis , 60}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis , 65}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis , 70}, + {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone , 75}, + {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 80}, - {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[0] , 170}, - {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[0] , 180}, - {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[0] , 190}, + {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[0] , 90}, + {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[0] , 95}, + {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[0] , 100}, }; static menuitem_t OP_Joystick2Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup2PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis2 , 30}, - {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis2 , 40}, - {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis2 , 50}, - {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis2 , 60}, - {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 70}, - {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 80}, - {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis2 , 90}, - {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis2 , 100}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis2 , 110}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis2 , 120}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis2 , 130}, - {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone2 , 140}, - {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone2 , 150}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis2 , 20}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis2 , 25}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis2 , 30}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis2 , 35}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 40}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 45}, + {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis2 , 50}, + {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis2 , 55}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis2 , 60}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis2 , 65}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis2 , 70}, + {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone2 , 75}, + {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone2 , 80}, - {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[1] , 170}, - {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[1] , 180}, - {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[1] , 190}, + {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[1] , 90}, + {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[1] , 95}, + {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[1] , 100}, }; static menuitem_t OP_Joystick3Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup3PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis3 , 30}, - {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis3 , 40}, - {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis3 , 50}, - {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis3 , 60}, - {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 70}, - {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 80}, - {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis3 , 90}, - {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis3 , 100}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis3 , 110}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis3 , 120}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis3 , 130}, - {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone3 , 140}, - {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone3 , 150}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis3 , 20}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis3 , 25}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis3 , 30}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis3 , 35}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 40}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 45}, + {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis3 , 50}, + {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis3 , 55}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis3 , 60}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis3 , 65}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis3 , 70}, + {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone3 , 75}, + {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone3 , 80}, - {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[2] , 170}, - {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[2] , 180}, - {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[2] , 190}, + {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[2] , 90}, + {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[2] , 95}, + {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[2] , 100}, }; static menuitem_t OP_Joystick4Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup4PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis4 , 30}, - {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis4 , 40}, - {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis4 , 50}, - {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis4 , 60}, - {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 70}, - {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 80}, - {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis4 , 90}, - {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis4 , 100}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis4 , 110}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis4 , 120}, - {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis4 , 130}, - {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone4 , 140}, - {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone4 , 150}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis4 , 20}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis4 , 25}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis4 , 30}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis4 , 35}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 40}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 45}, + {IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis4 , 50}, + {IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis4 , 55}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis4 , 60}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis4 , 65}, + {IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis4 , 70}, + {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone4 , 75}, + {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone4 , 80}, - {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[3] , 170}, - {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[3] , 180}, - {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[3] , 190}, + {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[3] , 90}, + {IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[3] , 95}, + {IT_STRING | IT_CVAR, NULL, "Flash LED on powerups" , &cv_ledpowerup[3] , 100}, }; static menuitem_t OP_JoystickSetMenu[] = @@ -1479,19 +1483,20 @@ static menuitem_t OP_ExpOptionsMenu[] = {IT_HEADER, NULL, "Advanced Options", NULL, 10}, {IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_grmaxinterpdist, 20}, {IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 30}, - {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 35}, + {IT_STRING | IT_CVAR, NULL, "Scale Weather with Mobjscale", &cv_mobjscaleprecip, 35}, + {IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 40}, - {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 45}, + {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 50}, #ifdef HWRENDER - {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 55}, + {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 60}, #ifdef USE_FBO_OGL - {IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_grframebuffer, 60}, + {IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_grframebuffer, 65}, #endif - {IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 70}, + {IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 75}, - {IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 80}, + {IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 85}, #endif }; @@ -1500,14 +1505,15 @@ static const char* OP_ExpTooltips[] = NULL, "How far Mobj interpolation should take effect.", "Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.", + "Should weather be scaled with Mapobjectscale?.", "When weather is on this will cut the object amount used in half.", "Toggle being able to see the sky.", #ifdef HWRENDER "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", #ifdef USE_FBO_OGL - "Allows the game to downsample from a higher resolution than your display in OpenGL renderer mode\nrequires a GPU with atleast OpenGL 3.0 support.", + "Allows the game to downsample from a higher resolution than your display\nin OpenGL renderer mode. Requires a GPU with atleast OpenGL 3.0 support.", #endif - "Change the depth of the Palette in Palette rendering mod\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.", + "Change the depth of the Palette in Palette rendering mode\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.", "Fixes issues that resulted in Textures sticking from the ground sometimes.\n This may be CPU heavy and result in worse performance in some cases.", #endif }; @@ -1517,6 +1523,7 @@ enum op_exp_header, op_exp_interpdist, op_exp_precipinter, + op_exp_precipmoscale, op_exp_lessprecip, op_exp_skybox, #ifdef HWRENDER @@ -1605,7 +1612,7 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 135}, {IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 145}, - {IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 165} + {IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 155} #else {IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 60}, {IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 70}, @@ -1620,7 +1627,7 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 145}, {IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 155}, - {IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 175} + {IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 165} #endif }; @@ -2045,37 +2052,19 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 10}, {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 20}, - {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 25}, - {IT_STRING | IT_CVAR, NULL, "Speedometer Style", &cv_newspeedometer, 30}, - {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 35}, - {IT_STRING | IT_CVAR, NULL, "Show Lap Times", &cv_showlaptimes, 40}, - {IT_STRING | IT_CVAR, NULL, "Higher Resolution Portraits", &cv_highresportrait, 45}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 50}, - {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 55}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 60}, - {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 65}, - {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 70}, - {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 75}, - {IT_STRING | IT_CVAR, NULL, "Lagless Camera", &cv_laglesscam, 85}, + {IT_STRING | IT_CVAR, NULL, "Lagless Camera", &cv_laglesscam, 30}, - {IT_STRING | IT_CVAR, NULL, "Uncapped HUD", &cv_uncappedhud, 95}, + {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 40}, + {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 45}, - {IT_STRING | IT_CVAR, NULL, "Show Cecho Messages", &cv_cechotoggle, 100}, - {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 105}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 110}, + {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 55}, - {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 120}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 65}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 130}, - - {IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 140}, - {IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 145}, - - {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 155}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 160}, - - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 170}, // uwu + {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 75}, + {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 80}, + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 85}, // uwu }; static const char* OP_SaturnTooltips[] = @@ -2083,28 +2072,13 @@ static const char* OP_SaturnTooltips[] = NULL, "How long can the game wait before it kicks you out from the server\nconnecting screen.", "How much speen do you want?", - "Displays the input display outside of Record Attack. Also adjusts the\nposition scale to match.", - "Change what style the speedometer is.", - "Enable the stat display.", - "Show Lap Time when doing a Lap on the Timer.", - "Enable the use of the higher resolution want icons instead of rank\nfor some places.", - "Enable colourized hud.", - "Enable the colourized itembox when colourized hud is enabled.", - "The color to use instead of the player color when colourized hud is enabled.", - "Show the big 'LAP' text on a lap change.", - "Show player names on the minimap.", - "Minimize the player icons on the minimap.", "Makes the Camera Lagless in netgames.", - "Uncaps the HUD framerate, making it appear smoother.", - "Show the big Cecho Messages.", "Show Localskin Menus.", "Force menu to only use uppercase.", "Use your desired Keyboard Layout for Text Input\nthis is either the Default, Native or Azerty\nNative does not affect Gameplay only Text!", "Disables the flicker effect on Midnight Channel.", - "Nametag Options.", - "Driftgauge Options.", + "Options for Saturn specific HUD things.", "Options for sprite distortion effects.", - "Move position of HUD elements.", "See the people who helped make this project possible!", }; @@ -2113,28 +2087,13 @@ enum sm_header, sm_waittime, sm_skinselspeed, - sm_input, - sm_speedometer, - sm_statdisplay, - sm_laptime, - sm_highresport, - sm_colorhud, - sm_coloritem, - sm_colorhud_customcolor, - sm_lapemblem, - sm_mapnames, - sm_smallmap, sm_laglesscam, - sm_uncappedhud, - sm_cechotogle, sm_showlocalskin, op_uppercase_menu, sm_nativkey, sm_pisschannel, - sm_nametagmen, - sm_driftgaugemen, + sm_hud, sm_distortionmenu, - sm_hudoffsets, sm_credits, }; @@ -2184,6 +2143,84 @@ enum saltsquishy, }; +static menuitem_t OP_SaturnHudMenu[] = +{ + {IT_HEADER, NULL, "Saturn Hud Options", NULL, 0}, + + {IT_STRING | IT_CVAR, NULL, "Speedometer Style", &cv_newspeedometer, 10}, + {IT_STRING | IT_CVAR, NULL, "Battle Speedometer", &cv_battlespeedo, 15}, + + {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 20}, + + {IT_STRING | IT_CVAR, NULL, "Show Lap Times", &cv_showlaptimes, 25}, + + {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 30}, + + {IT_STRING | IT_CVAR, NULL, "Higher Resolution Portraits", &cv_highresportrait, 35}, + + {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 40}, + {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 45}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 50}, + + {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 60}, + {IT_STRING | IT_CVAR, NULL, "Show Cecho Messages", &cv_cechotoggle, 65}, + + {IT_STRING | IT_CVAR, NULL, "Show Names on Minimap", &cv_showminimapnames, 70}, + {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 75}, + + {IT_STRING | IT_CVAR, NULL, "Uncapped HUD", &cv_uncappedhud, 85}, + + {IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 95}, + {IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 100}, + + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 110}, +}; + +static const char* OP_SaturnHudTooltips[] = +{ + NULL, + "Change what style the speedometer is.", + "Draw the Speedometer in Battle.", + "Displays the input display outside of Record Attack. Also adjusts the\nposition scale to match.", + "Enable the stat display.", + "Show Lap Time when doing a Lap on the Timer.", + "Enable the use of the higher resolution want icons instead of rank\nfor some places.", + "Enable colourized hud.", + "Enable the colourized itembox when colourized hud is enabled.", + "The color to use instead of the player color when\ncolourized hud is enabled.", + "Show the big 'LAP' text on a lap change.", + "Show the big Cecho Messages.", + "Show player names on the minimap.", + "Minimize the player icons on the minimap.", + "Uncaps the HUD framerate, making it appear smoother.", + "Nametag Options.", + "Driftgauge Options.", + "Move position of HUD elements.", +}; + +enum +{ + sh_header, + sh_speedometer, + sh_battlespeedo, + sh_input, + sh_laptime, + sh_statdisplay, + sh_highresport, + sh_colorhud, + sh_coloritem, + sh_colorhud_customcolor, + sh_lapemblem, + sh_cechotogle, + sh_mapname, + sh_smallmap, + sh_uncappedhud, + sh_nametagmen, + sh_driftgaugemen, + sh_hudoffsets, +}; + + static menuitem_t OP_HudOffsetMenu[] = { {IT_HEADER, NULL, "Kart Hud Offsets", NULL, 0}, @@ -2441,7 +2478,6 @@ static menuitem_t OP_AdvancedBirdMenu[] = {IT_STRING | IT_CVAR, NULL, "Fade Back In While Respawning", &cv_respawnfademusicback, 40}, {IT_STRING | IT_CVAR, NULL, "Resync Threshold", &cv_music_resync_threshold, 60}, - {IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70}, }; static const char* OP_AdvancedBirdTooltips[] = @@ -2827,10 +2863,10 @@ menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDe //WTF menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30); menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); -menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 16); -menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 16); -menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 60, 16); -menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 60, 16); +menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 36); +menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 36); +menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 60, 36); +menu_t OP_Joystick4Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 60, 36); menu_t OP_JoystickSetDef = { "M_CONTRO", @@ -2954,13 +2990,15 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOp menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30); menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30); -menu_t OP_HudOffsetDef = DEFAULTSCROLLSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 30); +menu_t OP_HudOffsetDef = DEFAULTSCROLLSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnHudDef, 30, 30); +menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30); + menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 10); menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30); -menu_t OP_NametagDef = DEFAULTMENUSTYLE(NULL, OP_NametagMenu, &OP_SaturnDef, 30, 40); -menu_t OP_DriftGaugeDef = DEFAULTMENUSTYLE(NULL, OP_DriftGaugeMenu, &OP_SaturnDef, 30, 60); +menu_t OP_NametagDef = DEFAULTMENUSTYLE(NULL, OP_NametagMenu, &OP_SaturnHudDef, 30, 40); +menu_t OP_DriftGaugeDef = DEFAULTMENUSTYLE(NULL, OP_DriftGaugeMenu, &OP_SaturnHudDef, 30, 40); menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60); menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60); @@ -3285,7 +3323,7 @@ void Bird_menu_Onchange(void) } //menu code is nice -void Saturn_menu_Onchange(void) +void SaturnHud_menu_Onchange(void) { UINT16 status; @@ -3294,8 +3332,8 @@ void Saturn_menu_Onchange(void) else status = IT_GRAYEDOUT; - OP_SaturnMenu[sm_coloritem].status = status; - OP_SaturnMenu[sm_colorhud_customcolor].status = status; + OP_SaturnHudMenu[sh_coloritem].status = status; + OP_SaturnHudMenu[sh_colorhud_customcolor].status = status; } // ========================================================================== @@ -4103,7 +4141,6 @@ boolean M_DemoResponder(event_t *ev) return eatinput; } - // // M_Drawer // Called after the view has been rendered, @@ -4114,10 +4151,12 @@ void M_Drawer(void) if (currentMenu == &MessageDef) menuactive = true; + forceshowhud = gamestate == GS_LEVEL && menuactive && (currentMenu == &OP_SaturnHudDef || currentMenu == &OP_HudOffsetDef || currentMenu == &OP_NametagDef || currentMenu == &OP_DriftGaugeDef); // holy fuick + if (menuactive) { // now that's more readable with a faded background (yeah like Quake...) - if (!WipeInAction && currentMenu != &PlaybackMenuDef) // Replay playback has its own background + if (!WipeInAction && currentMenu != &PlaybackMenuDef && !forceshowhud) // Replay playback has its own background V_DrawFadeScreen(0xFF00, 16); if (currentMenu->drawroutine) @@ -4562,7 +4601,7 @@ void M_Init(void) #endif if (!xtra_speedo && !kartzspeedo && !achi_speedo) // why bother? - OP_SaturnMenu[sm_speedometer].status = IT_GRAYEDOUT; + OP_SaturnHudMenu[sh_speedometer].status = IT_GRAYEDOUT; //if (!xtra_speedo && kartzspeedo) //OP_SaturnMenu[sm_speedometer].text = "Speedometer (No Small)"; @@ -4573,9 +4612,9 @@ void M_Init(void) if (!clr_hud) // uhguauhauguuhee { - OP_SaturnMenu[sm_colorhud].status = IT_GRAYEDOUT; - OP_SaturnMenu[sm_coloritem].status = IT_GRAYEDOUT; - OP_SaturnMenu[sm_colorhud_customcolor].status = IT_GRAYEDOUT; + OP_SaturnHudMenu[sh_colorhud].status = IT_GRAYEDOUT; + OP_SaturnHudMenu[sh_coloritem].status = IT_GRAYEDOUT; + OP_SaturnHudMenu[sh_colorhud_customcolor].status = IT_GRAYEDOUT; } if (!nametaggfx) @@ -5363,6 +5402,16 @@ static void M_DrawGenericScrollMenu(void) coolalphatimer--; } } + + if (currentMenu == &OP_SaturnHudDef) + { + if (!(OP_SaturnHudTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SaturnHudTooltips[itemOn], coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } } static void M_DrawPauseMenu(void) @@ -12456,7 +12505,7 @@ static void M_DrawControl(void) if (currentMenu->menuitems[i].status == IT_CONTROL) { - V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + V_DrawString(x, y, ((i == itemOn) ? highlightflags|V_ALLOWLOWERCASE : V_ALLOWLOWERCASE), currentMenu->menuitems[i].text); keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; @@ -12477,14 +12526,14 @@ static void M_DrawControl(void) strcat (tmp, G_KeynumToString (keys[1])); } - V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); + V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags|V_ALLOWLOWERCASE, tmp); } /*else if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);*/ else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1)) - V_DrawString(19, y+6, highlightflags, currentMenu->menuitems[i].text); + V_DrawString(19, y+6, highlightflags|V_ALLOWLOWERCASE, currentMenu->menuitems[i].text); else if (currentMenu->menuitems[i].status & IT_STRING) - V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + V_DrawString(x, y, ((i == itemOn) ? highlightflags|V_ALLOWLOWERCASE : V_ALLOWLOWERCASE), currentMenu->menuitems[i].text); y += SMALLLINEHEIGHT; } diff --git a/src/m_menu.h b/src/m_menu.h index e74fd491f..570d8a94d 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -21,6 +21,8 @@ #include "mserv.h" #include "r_things.h" // for SKINNAMESIZE +extern boolean forceshowhud; + // // MENUS // @@ -290,8 +292,8 @@ void PDistort_menu_Onchange(void); // Bird menu updating void Bird_menu_Onchange(void); -// Saturn menu updating -void Saturn_menu_Onchange(void); +// Saturn Hud menu updating +void SaturnHud_menu_Onchange(void); void M_ReplayHut(INT32 choice); void M_SetPlaybackMenuPointer(void); diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 04e51a657..a8f9550f4 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -58,7 +58,6 @@ static ps_metric_t ps_regularcount = {0}; static ps_metric_t ps_scenerycount = {0}; static ps_metric_t ps_nothinkcount = {0}; static ps_metric_t ps_otherthcount = {0}; -static ps_metric_t ps_precipcount = {0}; static ps_metric_t ps_removecount = {0}; ps_metric_t ps_checkposition_calls = {0}; @@ -173,7 +172,6 @@ perfstatrow_t thinkercount_rows[] = { {" scenery", " Scenery: ", &ps_scenerycount, PS_LEVEL}, {" nothink", " Nothink: ", &ps_nothinkcount, PS_HIDE_ZERO|PS_LEVEL}, {" other ", " Other: ", &ps_otherthcount, PS_LEVEL}, - {" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL}, {" remove ", " Pending removal:", &ps_removecount, PS_LEVEL}, {0} }; @@ -572,7 +570,6 @@ static void PS_CountThinkers(void) ps_scenerycount.value.i = 0; ps_nothinkcount.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) { @@ -590,8 +587,6 @@ static void PS_CountThinkers(void) else ps_regularcount.value.i++; } - else if (thinker->function.acp1 == (actionf_p1)P_NullPrecipThinker) - ps_precipcount.value.i++; else ps_otherthcount.value.i++; } diff --git a/src/p_inter.c b/src/p_inter.c index d22f99112..39babc14d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -463,8 +463,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else if (special->target->player->kartstuff[k_comebackmode] == 1 && P_CanPickupItem(player, 1)) { - mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); - S_StartSound(poof, special->info->seesound); + mobj_t *poof2 = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); + S_StartSound(poof2, special->info->seesound); // Karma fireworks for (i = 0; i < 5; i++) @@ -490,10 +490,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else if (special->target->player->kartstuff[k_comebackmode] == 2 && P_CanPickupItem(player, 2)) { - mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); + mobj_t *poof3 = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); UINT8 ptadd = 1; // No WANTED bonus for tricking - S_StartSound(poof, special->info->seesound); + S_StartSound(poof3, special->info->seesound); if (player->kartstuff[k_bumper] == 1) // If you have only one bumper left, and see if it's a 1v1 { @@ -1737,7 +1737,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) } target->player->playerstate = PST_DEAD; - if (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(target->player)) + if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player)) { if (netgame || multiplayer) ms = cv_respawntime.value * 1000; @@ -1748,7 +1748,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) If the time spent with the music paused is less than half a second, continue playing the song (just mute it). */ - if (( ms - cv_respawnfademusicout.value ) < 500) + if ((ms - cv_respawnfademusicout.value) < 500) S_FadeMusic(0, cv_respawnfademusicout.value); else S_FadeOutStopMusic(cv_respawnfademusicout.value); diff --git a/src/p_local.h b/src/p_local.h index fed4a2d34..725aa20d1 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -70,6 +70,7 @@ extern thinker_t thinkercap; void P_InitThinkers(void); void P_AddThinker(thinker_t *thinker); void P_RemoveThinker(thinker_t *thinker); +void P_UnlinkThinker(thinker_t *thinker); // // P_USER diff --git a/src/p_map.c b/src/p_map.c index 6051d5d1c..cb2997552 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2245,6 +2245,9 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) floatok = false; + if (dedicated) // this crashes so don't even try it + return false; + if (twodlevel) itsatwodlevel = true; else diff --git a/src/p_mobj.c b/src/p_mobj.c index a156edd43..8a0147194 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -338,7 +338,7 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state) if (state == S_NULL) { // Remove mobj - P_RemovePrecipMobj(mobj); + P_FreePrecipMobj(mobj); return false; } st = &states[state]; @@ -616,7 +616,7 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) + if (((mobj->flags & MF_NOBLOCKMAP) && (mobj->flags & MF_NOCLIP)) ? R_IsPointInSector(boundsec ? boundsec : sector, testx, testy) : R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) return P_GetZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point @@ -692,7 +692,7 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) + if (((mobj->flags & MF_NOBLOCKMAP) && (mobj->flags & MF_NOCLIP)) ? R_IsPointInSector(boundsec ? boundsec : sector, testx, testy) : R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) return P_GetZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point @@ -770,7 +770,7 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) + if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy)) return P_GetZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point @@ -847,7 +847,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) + if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy)) return P_GetZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point @@ -3603,67 +3603,89 @@ void P_RecalcPrecipInSector(sector_t *sector) // // P_NullPrecipThinker // -// For "Blank" precipitation +// Just the identification of a precip thinker. The thinker +// should never actually be called! // void P_NullPrecipThinker(precipmobj_t *mobj) { - //(void)mobj; - mobj->precipflags &= ~PCF_THUNK; - R_ResetPrecipitationMobjInterpolationState(mobj); + (void)mobj; + I_Assert("P_NullPrecipThinker should not be called" == 0); } -void P_SnowThinker(precipmobj_t *mobj) +boolean P_PrecipThinker(precipmobj_t *mobj) { + if (mobj->lastThink == leveltime) + return true; // already thinked this tick + + mobj->lastThink = leveltime; + + R_ResetPrecipitationMobjInterpolationState(mobj); P_CycleStateAnimation((mobj_t *)mobj); + if (mobj->state == &states[S_RAINRETURN]) + { + // Reset to ceiling! + if (!P_SetPrecipMobjState(mobj, mobj->info->spawnstate)) + return false; + + mobj->z = mobj->ceilingz; + mobj->momz = mobj->info->speed; + mobj->precipflags &= ~PCF_SPLASH; + R_ResetPrecipitationMobjInterpolationState(mobj); + } + + if (mobj->tics != -1) + { + if (mobj->tics) + { + mobj->tics--; + } + + if (mobj->tics == 0) + { + if ((mobj->precipflags & PCF_SPLASH) && (mobj->state->nextstate == S_NULL)) + { + // HACK: sprite changes are 1 tic late, so you would see splashes on the ceiling if not for this state. + // We need to use the settings from the previous state, since some of those are NOT 1 tic late. + INT32 frame = (mobj->frame & ~FF_FRAMEMASK); + + if (!P_SetPrecipMobjState(mobj, S_RAINRETURN)) + return false; + + mobj->frame = frame; + return true; + } + else + { + if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) + return false; + } + } + } + + if (mobj->precipflags & PCF_SPLASH) + return true; + // adjust height if ((mobj->z += mobj->momz) <= mobj->floorz) { - mobj->z = mobj->ceilingz; - R_ResetPrecipitationMobjInterpolationState(mobj); - } -} + if ((mobj->info->deathstate == S_NULL) || (mobj->precipflags & PCF_PIT)) // no splashes on sky or bottomless pits + { + mobj->z = mobj->ceilingz; + R_ResetPrecipitationMobjInterpolationState(mobj); + } + else + { + if (!P_SetPrecipMobjState(mobj, mobj->info->deathstate)) + return false; -void P_RainThinker(precipmobj_t *mobj) -{ - P_CycleStateAnimation((mobj_t *)mobj); - - if (mobj->state != &states[S_RAIN1]) - { - // cycle through states, - // calling action functions at transitions - if (mobj->tics <= 0) - return; - - if (--mobj->tics) - return; - - if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) - return; - - if (mobj->state != &states[S_RAINRETURN]) - return; - - mobj->z = mobj->ceilingz; - R_ResetPrecipitationMobjInterpolationState(mobj); - P_SetPrecipMobjState(mobj, S_RAIN1); - - return; + mobj->z = mobj->floorz; + mobj->precipflags |= PCF_SPLASH; + R_ResetPrecipitationMobjInterpolationState(mobj); + } } - // adjust height - if ((mobj->z += mobj->momz) > mobj->floorz) - return; - - // no splashes on sky or bottomless pits - if (mobj->precipflags & PCF_PIT) - { - mobj->z = mobj->ceilingz; - return; - } - - mobj->z = mobj->floorz; - P_SetPrecipMobjState(mobj, S_SPLASH1); + return true; } static void P_RingThinker(mobj_t *mobj) @@ -9903,17 +9925,21 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster) static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { + const mobjinfo_t *info = &mobjinfo[type]; state_t *st; precipmobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL); fixed_t starting_floorz; + mobj->type = type; + mobj->info = info; + mobj->x = x; mobj->y = y; - mobj->flags = mobjinfo[type].flags; + mobj->flags = info->flags; // do not set the state with P_SetMobjState, // because action routines can not be called yet - st = &states[mobjinfo[type].spawnstate]; + st = &states[info->spawnstate]; mobj->state = st; mobj->tics = st->tics; @@ -9928,7 +9954,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype mobj->ceilingz = P_GetSectorCeilingZAt(mobj->subsector->sector, x, y); mobj->z = z; - mobj->momz = mobjinfo[type].speed; + mobj->momz = info->speed; mobj->thinker.function.acp1 = (actionf_p1)P_NullPrecipThinker; P_AddThinker(&mobj->thinker); @@ -9947,21 +9973,6 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype return mobj; } -static inline precipmobj_t *P_SpawnRainMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) -{ - precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - mo->precipflags |= PCF_RAIN; - //mo->thinker.function.acp1 = (actionf_p1)P_RainThinker; - return mo; -} - -static inline precipmobj_t *P_SpawnSnowMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) -{ - precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - //mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker; - return mo; -} - // // P_RemoveMobj // @@ -10109,7 +10120,7 @@ boolean P_MobjWasRemoved(mobj_t *mobj) return true; } -void P_RemovePrecipMobj(precipmobj_t *mobj) +void P_FreePrecipMobj(precipmobj_t *mobj) { // unlink from sector and block lists P_UnsetPrecipThingPosition(mobj); @@ -10121,7 +10132,9 @@ void P_RemovePrecipMobj(precipmobj_t *mobj) } // free block - P_RemoveThinker((thinker_t *)mobj); + // Precipmobjs don't actually think using their thinker, + // so the free cannot be delayed. + P_UnlinkThinker((thinker_t*)mobj); } // Clearing out stuff for savegames @@ -10157,12 +10170,7 @@ void P_RemoveSavegameMobj(mobj_t *mobj) // free block // Here we use the same code as R_RemoveThinkerDelayed, but without reference counting (we're removing everything so it shouldn't matter) and without touching currentthinker since we aren't in P_RunThinkers - { - thinker_t *thinker = (thinker_t *)mobj; - thinker_t *next = thinker->next; - (next->prev = thinker->prev)->next = next; - Z_Free(thinker); - } + P_UnlinkThinker((thinker_t*)mobj); } static CV_PossibleValue_t respawnitemtime_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; @@ -10174,8 +10182,9 @@ consvar_t cv_suddendeath = {"suddendeath", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHE void P_SpawnPrecipitation(void) { - INT32 i, mrand; - fixed_t basex, basey, x, y, height; + INT32 i, j, k, mrand; + fixed_t basex, basey, x, y, z, height; + fixed_t precipscale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT; subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; @@ -10188,10 +10197,9 @@ void P_SpawnPrecipitation(void) basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE; basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE; - //for (j = 0; j < cv_precipdensity.value; ++j) -- density is 1 for kart always + for (j = 0; j < FRACUNIT; j += precipscale) { - INT32 floorz; - INT32 ceilingz; + UINT16 numparticles = 0; x = ((cv_lessprecip.value ? basex*1.5 : basex) + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3)); y = ((cv_lessprecip.value ? basey*1.5 : basey) + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3)); @@ -10207,37 +10215,49 @@ void P_SpawnPrecipitation(void) if (precipsector->sector->ceilingpic != skyflatnum) continue; + height = precipsector->sector->ceilingheight - precipsector->sector->floorheight; + height = FixedDiv(height, precipscale); + // Exists, but is too small for reasonable precipitation. - if (!(precipsector->sector->floorheight <= precipsector->sector->ceilingheight - (32<sector->ceilingheight; + // Hack around a quirk of this entire system, where taller sectors look like they get less precipitation. + numparticles = 1 + (height / (MAPBLOCKUNITS<<4<sector->ceilingheight; - floorz = rainmo->floorz >> FRACBITS; - ceilingz = rainmo->ceilingz >> FRACBITS; + for (k = 0; k < numparticles; k++) + { + INT32 floorz; + INT32 ceilingz; - if (floorz < ceilingz) - { - // Randomly assign a height, now that floorz is set. - rainmo->z = M_RandomRange(floorz, ceilingz) << FRACBITS; - } - else - { - // ...except if the floor is above the ceiling. - rainmo->z = ceilingz << FRACBITS; + if (curWeather == PRECIP_SNOW) + { + rainmo = P_SpawnPrecipMobj(x, y, z, MT_SNOWFLAKE); + mrand = M_RandomByte(); + if (mrand < 64) + P_SetPrecipMobjState(rainmo, S_SNOW3); + else if (mrand < 144) + P_SetPrecipMobjState(rainmo, S_SNOW2); + } + else // everything else. + rainmo = P_SpawnPrecipMobj(x, y, z, MT_RAIN); + + floorz = rainmo->floorz >> FRACBITS; + ceilingz = rainmo->ceilingz >> FRACBITS; + + if (floorz < ceilingz) + { + // Randomly assign a height, now that floorz is set. + rainmo->z = M_RandomRange(floorz, ceilingz) << FRACBITS; + } + else + { + // ...except if the floor is above the ceiling. + rainmo->z = ceilingz << FRACBITS; + } } } } diff --git a/src/p_mobj.h b/src/p_mobj.h index a824edc6a..f6b27ae49 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -254,24 +254,21 @@ typedef enum // PRECIPITATION flags ?! ?! ?! // typedef enum { - // Don't draw. - PCF_INVISIBLE = 1, - // Above pit. - PCF_PIT = 2, - // Above FOF. - PCF_FOF = 4, - // Above MOVING FOF (this means we need to keep floorz up to date...) - PCF_MOVINGFOF = 8, - // Is rain. - PCF_RAIN = 16, - // Ran the thinker this tic. - PCF_THUNK = 32, + PCF_INVISIBLE = 1, // Don't draw. + PCF_PIT = 1<<1, // Above pit. + PCF_FOF = 1<<2, // Above FOF. + PCF_MOVINGFOF = 1<<3, // Above MOVING FOF (this means we need to keep floorz up to date...) + PCF_SPLASH = 1<<4, // Splashed on the ground, return to the ceiling after the animation's over + PCF_THUNK = 1<<5, // Ran the thinker this tic. } precipflag_t; // Map Object definition. typedef struct mobj_s { // List: thinker links. thinker_t thinker; + + mobjtype_t type; + const mobjinfo_t *info; // &mobjinfo[mobj->type] // Info for drawing: position. fixed_t x, y, z; @@ -345,9 +342,6 @@ typedef struct mobj_s struct mobj_s *hnext; struct mobj_s *hprev; - mobjtype_t type; - const mobjinfo_t *info; // &mobjinfo[mobj->type] - INT32 health; // for player this is rings + 1 // Movement direction, movement generation (zig-zagging). @@ -426,6 +420,9 @@ typedef struct precipmobj_s // List: thinker links. thinker_t thinker; + mobjtype_t type; + const mobjinfo_t *info; // &mobjinfo[mobj->type] + // Info for drawing: position. fixed_t x, y, z; fixed_t old_x, old_y, old_z; // position interpolation @@ -479,6 +476,7 @@ typedef struct precipmobj_s INT32 tics; // state tic counter state_t *state; INT32 flags; // flags from mobjinfo tables + tic_t lastThink; } precipmobj_t; typedef struct actioncache_s @@ -518,10 +516,9 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb boolean P_BossTargetPlayer(mobj_t *actor, boolean closest); boolean P_SupermanLook4Players(mobj_t *actor); void P_DestroyRobots(void); -void P_SnowThinker(precipmobj_t *mobj); -void P_RainThinker(precipmobj_t *mobj); +boolean P_PrecipThinker(precipmobj_t *mobj); void P_NullPrecipThinker(precipmobj_t *mobj); -void P_RemovePrecipMobj(precipmobj_t *mobj); +void P_FreePrecipMobj(precipmobj_t *mobj); void P_SetScale(mobj_t *mobj, fixed_t newscale); void P_XYMovement(mobj_t *mo); void P_EmeraldManager(void); diff --git a/src/p_spec.c b/src/p_spec.c index 69d27270b..e5068f99b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1773,16 +1773,18 @@ void P_SwitchWeather(INT32 weathernum) if (purge) { thinker_t *think; + thinker_t *next; precipmobj_t *precipmobj; - for (think = thinkercap.next; think != &thinkercap; think = think->next) + for (think = thinkercap.next; think != &thinkercap; think = next) { + next = think->next; + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) continue; // not a precipmobj thinker precipmobj = (precipmobj_t *)think; - - P_RemovePrecipMobj(precipmobj); + P_FreePrecipMobj(precipmobj); } } else if (swap && !((swap == PRECIP_BLANK && curWeather == PRECIP_STORM_NORAIN) || (swap == PRECIP_STORM_NORAIN && curWeather == PRECIP_BLANK))) // Rather than respawn all that crap, reuse it! @@ -1795,10 +1797,13 @@ void P_SwitchWeather(INT32 weathernum) { if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) continue; // not a precipmobj thinker + precipmobj = (precipmobj_t *)think; if (swap == PRECIP_RAIN) // Snow To Rain { + precipmobj->type = MT_RAIN; // proper set the type + precipmobj->info = &mobjinfo[MT_RAIN]; precipmobj->flags = mobjinfo[MT_RAIN].flags; st = &states[mobjinfo[MT_RAIN].spawnstate]; precipmobj->state = st; @@ -1807,15 +1812,14 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->frame = st->frame; precipmobj->momz = mobjinfo[MT_RAIN].speed; - precipmobj->precipflags &= ~PCF_INVISIBLE; - - precipmobj->precipflags |= PCF_RAIN; - //think->function.acp1 = (actionf_p1)P_RainThinker; + precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to } else if (swap == PRECIP_SNOW) // Rain To Snow { INT32 z; + precipmobj->type = MT_SNOWFLAKE; // proper set the type + precipmobj->info = &mobjinfo[MT_SNOWFLAKE]; precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags; z = M_RandomByte(); @@ -1833,14 +1837,10 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->frame = st->frame; precipmobj->momz = mobjinfo[MT_SNOWFLAKE].speed; - precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_RAIN); - - //think->function.acp1 = (actionf_p1)P_SnowThinker; + precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to } else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse. { - //think->function.acp1 = (actionf_p1)P_NullPrecipThinker; - precipmobj->precipflags |= PCF_INVISIBLE; } } @@ -2179,7 +2179,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) mapmusflags |= MUSIC_FORCERESET; mapmusposition = position; - mapmusresume = 0; + + if (cv_birdmusic.value) + mapmusresume = 0; S_ChangeMusicEx(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4), position, !(line->flags & ML_EFFECT2) ? prefadems : 0, @@ -2483,7 +2485,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 422: // Cut away to another view { mobj_t *altview; - INT32 i; if (!mo || !mo->player) // only players have views return; @@ -2498,14 +2499,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) P_SetTarget(&mo->player->awayviewmobj, altview); mo->player->awayviewtics = P_AproxDistance(line->dx, line->dy)>>FRACBITS; - for (i = 0; i <= splitscreen; i++) - { - if (displayplayers[i] == (mo->player - players)) - { - R_ResetViewInterpolation(i + 1); - } - } - if (line->flags & ML_NOCLIMB) // lets you specify a vertical angle { INT32 aim; diff --git a/src/p_tick.c b/src/p_tick.c index cc2600f17..7cf876188 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -68,8 +68,6 @@ void Command_Numthinkers_f(void) CONS_Printf(M_GetText("numthinkers <#>: Count number of thinkers\n")); CONS_Printf( "\t1: P_MobjThinker\n" - /*"\t2: P_RainThinker\n" - "\t3: P_SnowThinker\n"*/ "\t2: P_NullPrecipThinker\n" "\t3: T_Friction\n" "\t4: T_Pusher\n" @@ -85,14 +83,6 @@ void Command_Numthinkers_f(void) action = (actionf_p1)P_MobjThinker; CONS_Printf(M_GetText("Number of %s: "), "P_MobjThinker"); break; - /*case 2: - action = (actionf_p1)P_RainThinker; - CONS_Printf(M_GetText("Number of %s: "), "P_RainThinker"); - break; - case 3: - action = (actionf_p1)P_SnowThinker; - CONS_Printf(M_GetText("Number of %s: "), "P_SnowThinker"); - break;*/ case 2: action = (actionf_p1)P_NullPrecipThinker; CONS_Printf(M_GetText("Number of %s: "), "P_NullPrecipThinker"); @@ -226,23 +216,41 @@ static thinker_t *currentthinker; // remove it, and set currentthinker to one node preceeding it, so // that the next step in P_RunThinkers() will get its successor. // -void P_RemoveThinkerDelayed(void *pthinker) +void P_RemoveThinkerDelayed(thinker_t *thinker) { - thinker_t *thinker = pthinker; - if (!thinker->references) - { - { - /* Remove from main thinker list */ - thinker_t *next = thinker->next; - /* Note that currentthinker is guaranteed to point to us, - * and since we're freeing our memory, we had better change that. So - * point it to thinker->prev, so the iterator will correctly move on to - * thinker->prev->next = thinker->next */ - (next->prev = currentthinker = thinker->prev)->next = next; - } - R_DestroyLevelInterpolators(thinker); - Z_Free(thinker); - } +#ifdef PARANOIA + if (thinker->next) + thinker->next = NULL; + else if (thinker->references) // Usually gets cleared up in one frame; what's going on here, then? + CONS_Printf("Number of potentially faulty references: %d\n", thinker->references); +#endif + if (thinker->references) + return; + + R_DestroyLevelInterpolators(thinker); + + /* Note that currentthinker is guaranteed to point to us, + * and since we're freeing our memory, we had better change that. So + * point it to thinker->prev, so the iterator will correctly move on to + * thinker->prev->next = thinker->next */ + currentthinker = thinker->prev; + /* Remove from main thinker list */ + P_UnlinkThinker(thinker); +} + +// +// P_UnlinkThinker() +// +// Actually removes thinker from the list and frees its memory. +// +void P_UnlinkThinker(thinker_t *thinker) +{ + thinker_t *next = thinker->next; + + I_Assert(thinker->references == 0); + + (next->prev = thinker->prev)->next = next; + Z_Free(thinker); } // @@ -260,7 +268,7 @@ void P_RemoveThinkerDelayed(void *pthinker) void P_RemoveThinker(thinker_t *thinker) { LUA_InvalidateUserdata(thinker); - thinker->function.acp1 = P_RemoveThinkerDelayed; + thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; } /* @@ -645,6 +653,7 @@ void P_Ticker(boolean run) if (run) { R_UpdateLevelInterpolators(); + R_UpdateViewInterpolation(); // Hack: ensure newview is assigned every tic. // Ensures view interpolation is T-1 to T in poor network conditions diff --git a/src/p_tick.h b/src/p_tick.h index d22995a11..11b5889ed 100644 --- a/src/p_tick.h +++ b/src/p_tick.h @@ -28,7 +28,7 @@ void P_RunChaseCameras(void); void P_Ticker(boolean run); void P_PreTicker(INT32 frames); void P_DoTeamscrambling(void); -void P_RemoveThinkerDelayed(void *pthinker); //killed +void P_RemoveThinkerDelayed(thinker_t *thinker); mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98 #endif diff --git a/src/p_user.c b/src/p_user.c index bdb03e86e..6aa3ee7a7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -499,44 +499,12 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) // Transform into Super Sonic! void P_DoSuperTransformation(player_t *player, boolean giverings) { + (void)player; + (void)giverings; + return; // SRB2kart - this is not a thing we need - player->powers[pw_super] = 1; - if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player)) - { - S_StopMusic(); - S_ChangeMusicInternal("supers", true); - } - - S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi - - // Transformation animation - //P_SetPlayerMobjState(player->mo, S_PLAY_SUPERTRANS1); - - player->mo->momx = player->mo->momy = player->mo->momz = 0; - - if (giverings) - { - player->mo->health = 51; - player->health = player->mo->health; - } - - // Just in case. - if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) - { - player->powers[pw_extralife] = 0; - player->powers[pw_invulnerability] = 0; - player->powers[pw_sneakers] = 0; - } - - if (gametype != GT_COOP) - { - HU_SetCEchoFlags(0); - HU_SetCEchoDuration(5); - HU_DoCEcho(va("%s\\is now super.\\\\\\\\", player_names[player-players])); - } - - P_PlayerFlagBurst(player, false); } + // Adds to the player's score void P_AddPlayerScore(player_t *player, UINT32 amount) { @@ -593,6 +561,7 @@ void P_PlayLivesJingle(player_t *player) void P_PlayRinglossSound(mobj_t *source, mobj_t *damager) { sfxenum_t key = P_RandomKey(2); + if (cv_kartvoices.value) { if (cv_karthitemdialog.value && source != damager && damager && damager->player && P_IsLocalPlayer(damager->player)) @@ -815,17 +784,13 @@ void P_RestoreMusic(player_t *player) if (wantedmus == 2 && cv_growmusic.value == 1) { S_ChangeMusicInternal("kgrow", true); - - if (cv_birdmusic.value) - S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); + S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); } // Item - Invincibility else if (wantedmus == 1 && cv_supermusic.value == 1) { S_ChangeMusicInternal("kinvnc", true); - - if (cv_birdmusic.value) - S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); + S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); } else { @@ -842,13 +807,12 @@ void P_RestoreMusic(player_t *player) else position = mapmusposition; - S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, - S_GetRestoreMusicFadeIn()); + S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, S_GetRestoreMusicFadeIn()); S_ClearRestoreMusicFadeInCvar(); } else S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); - + mapmusresume = 0; } } @@ -3983,6 +3947,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { P_MoveChaseCamera(player, thiscam, false); R_ResetViewInterpolation(num + 1); + R_ResetViewInterpolation(num + 1); } return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming); diff --git a/src/r_main.c b/src/r_main.c index fb3ca1c1c..e6247ceae 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -16,6 +16,7 @@ #include "doomdef.h" #include "g_game.h" #include "g_input.h" +#include "g_state.h" #include "r_local.h" #include "r_splats.h" // faB(21jan): testing #include "r_sky.h" @@ -185,6 +186,8 @@ void SendWeaponPref2(void); void SendWeaponPref3(void); void SendWeaponPref4(void); +static void Precipstuff_OnChange(void); + consvar_t cv_tailspickup = {"tailspickup", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_chasecam = {"chasecam", "On", CV_CALL, CV_OnOff, ChaseCam_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_chasecam2 = {"chasecam2", "On", CV_CALL, CV_OnOff, ChaseCam2_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -208,8 +211,9 @@ consvar_t cv_uncappedhud = {"uncappedhud", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NU consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE|CV_CALL|CV_NOINIT, drawdist_precip_cons_t, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_mobjscaleprecip = {"scaleprecipmobjscale", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grmaxinterpdist = {"gr_maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -329,6 +333,29 @@ static void FlipCam4_OnChange(void) SendWeaponPref4(); } +static void Precipstuff_OnChange(void) +{ + if (gamestate != GS_LEVEL) + return; + + thinker_t *think; + thinker_t *next; + precipmobj_t *precipmobj; + + for (think = thinkercap.next; think != &thinkercap; think = next) + { + next = think->next; + + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) + continue; // not a precipmobj thinker + + precipmobj = (precipmobj_t *)think; + P_FreePrecipMobj(precipmobj); + } + + P_SpawnPrecipitation(); +} + // // R_PointOnSide // Traverse BSP (sub) tree, @@ -1098,6 +1125,51 @@ void R_Init(void) framecount = 0; } +// +// R_IsPointInSector +// +boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y) +{ + size_t i; + size_t passes = 0; + + for (i = 0; i < sector->linecount; i++) + { + line_t *line = sector->lines[i]; + vertex_t *v1, *v2; + + if (line->frontsector == line->backsector) + continue; + + v1 = line->v1; + v2 = line->v2; + + // make sure v1 is below v2 + if (v1->y > v2->y) + { + vertex_t *tmp = v1; + v1 = v2; + v2 = tmp; + } + else if (v1->y == v2->y) + // horizontal line, we can't match this + continue; + + if (v1->y < y && y <= v2->y) + { + // if the y axis in inside the line, find the point where we intersect on the x axis... + fixed_t vx = v1->x + (INT64)(v2->x - v1->x) * (y - v1->y) / (v2->y - v1->y); + + // ...and if that point is to the left of the point, count it as inside. + if (vx < x) + passes++; + } + } + + // and odd number of passes means we're inside the polygon. + return passes % 2; +} + // // R_PointInSubsector // @@ -1841,6 +1913,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_drawdist); CV_RegisterVar(&cv_drawdist_precip); CV_RegisterVar(&cv_lessprecip); + CV_RegisterVar(&cv_mobjscaleprecip); CV_RegisterVar(&cv_fov); CV_RegisterVar(&cv_chasecam); diff --git a/src/r_main.h b/src/r_main.h index a271a3b1d..81bff3811 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -76,6 +76,7 @@ angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1); angle_t R_PlayerSliptideAngle(player_t *player); fixed_t R_ScaleFromGlobalAngle(angle_t visangle); +boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y); subsector_t *R_PointInSubsector(fixed_t x, fixed_t y); subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y); @@ -117,7 +118,7 @@ extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4; extern consvar_t cv_shadow, cv_shadowoffs; extern consvar_t cv_ffloorclip, cv_spriteclip; extern consvar_t cv_translucency; -extern consvar_t cv_drawdist, cv_drawdist_precip, cv_lessprecip; +extern consvar_t cv_drawdist, cv_drawdist_precip, cv_lessprecip, cv_mobjscaleprecip; extern consvar_t cv_fov; extern consvar_t cv_skybox; extern consvar_t cv_tailspickup; diff --git a/src/r_things.c b/src/r_things.c index 0f5da1873..ad1e3ca05 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1754,6 +1754,12 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) // uncapped/interpolation interpmobjstate_t interp = {0}; + // okay... this is a hack, but weather isn't networked, so it should be ok + if (!P_PrecipThinker(thing)) + { + return; + } + // do interpolation if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value)) { @@ -1846,7 +1852,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) if (thing->subsector->sector->cullheight) { if (R_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, viewz, gz, gzt)) - goto weatherthink; + return; } // store information in a vissprite @@ -1911,18 +1917,6 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) vis->precip = true; vis->vflip = false; vis->isScaled = false; - -weatherthink: - // okay... this is a hack, but weather isn't networked, so it should be ok - if (!(thing->precipflags & PCF_THUNK)) - { - if (thing->precipflags & PCF_RAIN) - P_RainThinker(thing); - else - P_SnowThinker(thing); - thing->precipflags |= PCF_THUNK; - } - } // R_AddSprites @@ -2058,7 +2052,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) // void R_AddPrecipitationSprites(void) { - const fixed_t drawdist = (fixed_t)(cv_drawdist_precip.value) * mapobjectscale; + fixed_t drawdist = (fixed_t)(cv_drawdist_precip.value) * (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT); INT32 xl, xh, yl, yh, bx, by; precipmobj_t *th, *next; diff --git a/src/s_sound.c b/src/s_sound.c index 0bc76bce2..f3450b6f4 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -109,8 +109,6 @@ static CV_PossibleValue_t music_resync_threshold_cons_t[] = { }; consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV_CALL, music_resync_threshold_cons_t, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagConditions, 0, NULL, NULL, 0, 0, NULL}; - consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -289,7 +287,6 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_pausemusic); CV_RegisterVar(&cv_music_resync_threshold); - CV_RegisterVar(&cv_music_resync_powerups_only); CV_RegisterVar(&cv_invincmusicfade); CV_RegisterVar(&cv_growmusicfade); @@ -1308,7 +1305,6 @@ static void *music_data; static UINT16 music_flags; static boolean music_looping; static consvar_t *music_refade_cv; -static int music_usage; static char queue_name[7]; static UINT16 queue_flags; @@ -1928,7 +1924,6 @@ static void S_UnloadMusic(void) music_looping = false; music_refade_cv = 0; - music_usage = 0; } static boolean S_PlayMusic(boolean looping, UINT32 fadeinms) @@ -1936,8 +1931,7 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms) if (S_MusicDisabled()) return false; - if (cv_birdmusic.value) - I_UpdateSongLagConditions(); + I_UpdateSongLagThreshold(); if ((!fadeinms && !I_PlaySong(looping)) || (fadeinms && !I_FadeInPlaySong(fadeinms, looping))) @@ -2132,6 +2126,9 @@ void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) void S_SetRestoreMusicFadeInCvar (consvar_t *cv) { + if (!cv_birdmusic.value) + return; + music_refade_cv = cv; } @@ -2143,17 +2140,6 @@ int S_GetRestoreMusicFadeIn (void) return 0; } -void S_SetMusicUsage (int type) -{ - music_usage = type; - I_UpdateSongLagConditions(); -} - -int S_MusicUsage (void) -{ - return music_usage; -} - /// ------------------------ /// Music Fading /// ------------------------ diff --git a/src/s_sound.h b/src/s_sound.h index 538e8713e..8787ea5e5 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -55,7 +55,6 @@ extern consvar_t cv_amigatype; //bird music stuff extern consvar_t cv_music_resync_threshold; -extern consvar_t cv_music_resync_powerups_only; extern consvar_t cv_invincmusicfade; extern consvar_t cv_growmusicfade; @@ -218,11 +217,6 @@ UINT32 S_GetMusicPosition(void); // Music Playback // -enum -{ - MUS_SPECIAL = 1,/* powerups--invincibility, grow */ -}; - // Start music track, arbitrary, given its name, and set whether looping // note: music flags 12 bits for tracknum (gme, other formats with more than one track) // 13-15 aren't used yet @@ -238,9 +232,6 @@ void S_SetRestoreMusicFadeInCvar (consvar_t *cvar); S_SetRestoreMusicFadeInCvar(0) int S_GetRestoreMusicFadeIn (void); -void S_SetMusicUsage (int type); -int S_MusicUsage (void); - // Stops the music. void S_StopMusic(void); diff --git a/src/screen.h b/src/screen.h index a6a0eb477..4f3b0b1ff 100644 --- a/src/screen.h +++ b/src/screen.h @@ -45,8 +45,8 @@ #define BASEVIDHEIGHT 200 // resolution of the graphics. // max res for png capture; seperated it so both MAXVID values can be lower for software performance reasons; OpenGL does not care about those anyways -#define MAXPNGWIDTH 3840 -#define MAXPNGHEIGHT 2160 +#define MAXPNGWIDTH 7680 +#define MAXPNGHEIGHT 4320 // global video state typedef struct viddef_s diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index eabe017c4..66ce038f5 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2670,8 +2670,8 @@ void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength, { #if !(SDL_VERSION_ATLEAST(2,0,14)) (void)device_id; - (void)left_strength; - (void)right_strength; + (void)low_strength; + (void)high_strength; #else I_Assert(device_id > 0); // Gamepad devices are always ID 1 or higher diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index da055265e..495c96e18 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -217,6 +217,10 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); static void Impl_SetWindowIcon(void); #ifdef USE_FBO_OGL +#if defined (__unix__) +static void I_FixXwaylandNvidia(void); +boolean xwaylandcrap = false; +#endif boolean downsample = false; void RefreshOGLSDLSurface(void) { @@ -225,7 +229,7 @@ void RefreshOGLSDLSurface(void) } #endif -static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) +static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_bool reposition) { static SDL_bool wasfullscreen = SDL_FALSE; Uint32 rmask; @@ -254,16 +258,18 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) } // Reposition window only in windowed mode SDL_SetWindowSize(window, width, height); - SDL_SetWindowPosition(window, - SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window)), - SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window)) - ); + if (reposition) + { + SDL_SetWindowPosition(window, + SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window)), + SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window)) + ); + } } } else { Impl_CreateWindow(fullscreen); - Impl_SetWindowIcon(); wasfullscreen = fullscreen; SDL_SetWindowSize(window, width, height); if (fullscreen) @@ -275,6 +281,12 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) #ifdef HWRENDER if (rendermode == render_opengl) { +#ifdef USE_FBO_OGL +#if defined (__unix__) + I_FixXwaylandNvidia(); +#endif + I_DownSample(); +#endif OglSdlSurface(vid.width, vid.height); } #endif @@ -749,7 +761,7 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which) #ifdef USE_FBO_OGL void I_DownSample(void) { - if (!cv_grframebuffer.value || !(rendermode == render_opengl) || (!supportFBO)) //no sense to do this crap if we cant benefit from it + if (!cv_grframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it { downsample = false; return; @@ -758,19 +770,41 @@ void I_DownSample(void) int currentDisplayIndex = SDL_GetWindowDisplayIndex(window); SDL_DisplayMode curmode; - if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) == 0) + if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0) { - if ((vid.width > curmode.w) || (vid.height > curmode.h)) //check if current resolution is higher than current display resolution - { - downsample = true; - RefreshOGLSDLSurface(); - } - else - downsample = false; // its not so no need to do crap + downsample = false; // couldnt get display info so turn the thing off + RefreshOGLSDLSurface(); + return; + } + + if ((vid.width > curmode.w) || (vid.height > curmode.h)) //check if current resolution is higher than current display resolution + { + downsample = true; + RefreshOGLSDLSurface(); } else - downsample = false; // couldnt get display info so turn the thing off + { + downsample = false; // its not so no need to do crap + RefreshOGLSDLSurface(); + } } + +#if defined (__unix__) +static void I_FixXwaylandNvidia(void) //dumbass crap, fix ur shit nvidia +{ + if (!supportFBO) + { + xwaylandcrap = false; + return; + } + + // enable fbo resize shit, update the ogl surface and turn crap back off lol + xwaylandcrap = true; + RefreshOGLSDLSurface(); + xwaylandcrap = false; + RefreshOGLSDLSurface(); +} +#endif #endif static void Impl_HandleWindowEvent(SDL_WindowEvent evt) @@ -1937,12 +1971,7 @@ INT32 VID_SetMode(INT32 modeNum) } //Impl_SetWindowName("SRB2Kart "VERSIONSTRING); -#ifdef USE_FBO_OGL - if (rendermode == render_opengl) - I_DownSample(); -#endif - - SDLSetMode(vid.width, vid.height, USE_FULLSCREEN); + SDLSetMode(vid.width, vid.height, USE_FULLSCREEN, (setmodeneeded ? SDL_TRUE : SDL_FALSE)); Impl_VideoSetupBuffer(); if (rendermode == render_soft) @@ -1962,6 +1991,63 @@ INT32 VID_SetMode(INT32 modeNum) return SDL_TRUE; } + +static SDL_bool Impl_CreateContext(void) +{ + // Renderer-specific stuff +#ifdef HWRENDER + if ((rendermode == render_opengl) + && (vid.glstate != VID_GL_LIBRARY_ERROR)) + { + if (!sdlglcontext) + sdlglcontext = SDL_GL_CreateContext(window); + if (sdlglcontext == NULL) + { + SDL_DestroyWindow(window); + I_Error("Failed to create a GL context: %s\n", SDL_GetError()); + } + SDL_GL_MakeCurrent(window, sdlglcontext); + } + else +#endif + if (rendermode == render_soft) + { + int flags = 0; // Use this to set SDL_RENDERER_* flags now + if (usesdl2soft) + flags |= SDL_RENDERER_SOFTWARE; + else if (cv_vidwait.value) + { +#if SDL_VERSION_ATLEAST(2, 0, 18) + // If SDL is new enough, we can turn off vsync later. + flags |= SDL_RENDERER_PRESENTVSYNC; +#else + // However, if it isn't, we should just silently turn vid_wait off + // This is because the renderer will be created before the config + // is read and vid_wait is set from the user's preferences, and thus + // vid_wait will have no effect. + CV_StealthSetValue(&cv_vidwait, 0); +#endif + } + +#ifdef _WIN32 + SDL_SetHint(SDL_HINT_RENDER_DRIVER, "direct3d11"); +#else + SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"); +#endif + + if (!renderer) + renderer = SDL_CreateRenderer(window, -1, flags); + if (renderer == NULL) + { + CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); + return SDL_FALSE; + } + SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT); + } + + return SDL_TRUE; +} + static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) { int flags = 0; @@ -2009,45 +2095,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) return SDL_FALSE; } - // Renderer-specific stuff -#ifdef HWRENDER - if ((rendermode == render_opengl) - && (vid.glstate != VID_GL_LIBRARY_ERROR)) - { - sdlglcontext = SDL_GL_CreateContext(window); - if (sdlglcontext == NULL) - { - SDL_DestroyWindow(window); - I_Error("Failed to create a GL context: %s\n", SDL_GetError()); - } - SDL_GL_MakeCurrent(window, sdlglcontext); - } - else -#endif - if (rendermode == render_soft) - { - flags = 0; // Use this to set SDL_RENDERER_* flags now - if (usesdl2soft) - flags |= SDL_RENDERER_SOFTWARE; - else if (cv_vidwait.value) - flags |= SDL_RENDERER_PRESENTVSYNC; - -#ifdef _WIN32 - SDL_SetHint(SDL_HINT_RENDER_DRIVER, "direct3d11"); -#else - SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"); -#endif - - renderer = SDL_CreateRenderer(window, -1, flags); - if (renderer == NULL) - { - CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); - return SDL_FALSE; - } - SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT); - } - - return SDL_TRUE; + return Impl_CreateContext(); } /* @@ -2460,5 +2508,11 @@ static void Impl_SetVsync(void) if (renderer) SDL_RenderSetVSync(renderer, cv_vidwait.value); #endif +#ifdef HWRENDER + if (!renderer && rendermode == render_opengl && sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext) + { + SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0); + } +#endif } #endif diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 806c77e47..12abb7c65 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -93,8 +93,6 @@ static UINT16 SAMPLERATE = 44100; /// ------------------------ UINT8 sound_started = false; - -static UINT32 stutter_threshold_user; static UINT32 stutter_threshold; static Mix_Music *music; @@ -626,9 +624,10 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata) if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID) return; + music_bytes += len; - if ((gamestate == GS_LEVEL) && (cv_birdmusic.value)) + if (cv_birdmusic.value && gamestate == GS_LEVEL) Countstutter(len); } @@ -1042,20 +1041,12 @@ UINT32 I_GetSongPosition(void) // 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4 } -void -I_UpdateSongLagThreshold (void) +void I_UpdateSongLagThreshold (void) { - stutter_threshold_user = cv_music_resync_threshold.value/1000.0*(4*44100); - I_UpdateSongLagConditions(); -} + if (!cv_birdmusic.value) + return; -void -I_UpdateSongLagConditions (void) -{ - if (! cv_music_resync_powerups_only.value || S_MusicUsage() == MUS_SPECIAL) - stutter_threshold = stutter_threshold_user; - else - stutter_threshold = 0; + stutter_threshold = cv_music_resync_threshold.value/1000.0*(4*44100); } /// ------------------------ diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 5bb6b7347..4adc3dae8 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -68,6 +68,12 @@ PFNglGetIntegerv pglGetIntegerv; PFNglGetString pglGetString; #endif +#if defined (__unix__) +#ifdef USE_FBO_OGL +static boolean isnvidiagpu = false; +#endif +#endif + /** \brief SDL video display surface */ INT32 oglflags = 0; @@ -166,8 +172,12 @@ boolean OglSdlSurface(INT32 w, INT32 h) maximumAnisotropy = 1; granisotropicmode_cons_t[1].value = maximumAnisotropy; + +#if defined (__unix__) #ifdef USE_FBO_OGL - I_DownSample(); + if (strstr((const char*)gl_renderer, "NVIDIA")) + isnvidiagpu = true; +#endif #endif } first_init = true; @@ -178,6 +188,7 @@ boolean OglSdlSurface(INT32 w, INT32 h) if (screen_width != w || screen_height != h) { FlushScreenTextures(); + #ifdef USE_FBO_OGL GLFramebuffer_DeleteAttachments(); #endif @@ -191,11 +202,16 @@ boolean OglSdlSurface(INT32 w, INT32 h) pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); #ifdef USE_FBO_OGL - RenderToFramebuffer = FrameBufferEnabled; - GLFramebuffer_Disable(); + RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample) +#if defined (__unix__) + || (isnvidiagpu && xwaylandcrap) +#endif + ); - if (RenderToFramebuffer && downsample) + if (RenderToFramebuffer) GLFramebuffer_Enable(); + else + GLFramebuffer_Disable(); #endif HWR_Startup(); @@ -225,14 +241,20 @@ void OglSdlFinishUpdate(boolean waitvbl) HWR_MakeScreenFinalTexture(); #ifdef USE_FBO_OGL - GLFramebuffer_Disable(); - RenderToFramebuffer = FrameBufferEnabled; + RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample) +#if defined (__unix__) + || (isnvidiagpu && xwaylandcrap) +#endif + ); + + if (RenderToFramebuffer) + GLFramebuffer_Unbind(); #endif HWR_DrawScreenFinalTexture(sdlw, sdlh); #ifdef USE_FBO_OGL - if (RenderToFramebuffer && downsample) + if (RenderToFramebuffer) GLFramebuffer_Enable(); #endif diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 503e7205a..33714f32a 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1410,7 +1410,6 @@ UINT32 I_GetSongPosition(void) } void I_UpdateSongLagThreshold (void) {} -void I_UpdateSongLagConditions (void) {} /// ------------------------ // MUSIC PLAYBACK diff --git a/src/st_stuff.c b/src/st_stuff.c index afbf74b8f..419b527c2 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -709,7 +709,7 @@ static void ST_overlayDrawer(void) } } - if (!(netgame || multiplayer) || !hu_showscores) + if ((!(netgame || multiplayer) || !hu_showscores) && !forceshowhud) { if (renderisnewtic) { @@ -718,7 +718,7 @@ static void ST_overlayDrawer(void) } // draw level title Tails - if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle)) + if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle) && !forceshowhud) ST_drawLevelTitle(); if (!hu_showscores && netgame && !mapreset) diff --git a/src/y_inter.c b/src/y_inter.c index 8527ff799..5d292f36c 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -728,16 +728,8 @@ void Y_Ticker(void) return; } - if (intertic < TICRATE || endtic != -1) - { + if (intertic < TICRATE || intertic & 1 || endtic != -1) return; - } - - if (data.match.rankingsmode && intertic & 1) - { - memset(data.match.jitter, 0, sizeof (data.match.jitter)); - return; - } if (intertype == int_race || intertype == int_match) {