Compare commits

..
64 Commits
Author SHA1 Message Date
Alug bcf876a4c4 Merge branch 'Saturn-Next' into Saturn 2025-11-17 17:52:31 +01:00
Alug 8ab15b73a9 raise version to 9.1 2025-11-17 17:05:19 +01:00
Alug 301d73a30e Merge pull request #213 from Indev450/revertsdl
Revert SDL2 to 2.28.5 and revert SDL_Mixer to 2.0.4
2025-11-17 17:26:20 +01:00
Alug 2ef4e7fcba Merge branch 'Saturn-Next' into revertsdl 2025-11-17 16:00:16 +01:00
Alug 7eb118920f SOCK_Get: recvfrom returning 0 still means its not a valid packet
0 lenght packets means, nothing
0 is still failure, just graceful, ignore that shit, those are not "valid" packets
2025-11-17 15:57:06 +01:00
Alug 2f0588355e remove old xcode stuff
apparently this does not work at all, and instead cmake can be used on macos
2025-11-17 04:56:58 +01:00
Alug 3e6830fc70 remove sdlsound, provide dummy sound instead
sdl sound was completely broken, so just provide a blank dummy interface instead, when compiling without sdl or mixer
2025-11-17 04:56:55 +01:00
Alug 2faf859e32 add mapicon packets to packettypename
so they properly show in the net debugfile
2025-11-17 04:56:15 +01:00
indev 8c31fd8a34 Allow searching for files inside luafiles 2025-11-17 03:15:23 +03:00
indev 4dd6d52550 Revert "Only skip exclude_paths if we're looking for addons (allows commands like exec find configs in luafiles)"
This reverts commit 8524465767.
Right, -file exists
2025-11-17 03:14:20 +03:00
indev 8524465767 Only skip exclude_paths if we're looking for addons (allows commands like exec find configs in luafiles) 2025-11-17 03:12:00 +03:00
Alug 91530c61ad Provide our own SDL2 dll files
this is plain 2.28.5 like before, but with a fix for the right ALT-GR key backported, so non US layouts can work properly
2025-11-16 22:22:14 +01:00
Alug 89f450db27 Revert "Simplify intermission timer code"
This reverts commit ed16c4fd9f.
2025-11-16 21:56:15 +01:00
Alug 3e212ebaad Revert "Simplify intermission timer code"
This reverts commit ed16c4fd9f.
2025-11-16 21:47:21 +01:00
Alug 14af9eb82a Revert "Merge pull request #204 from Indev450/updatesdl2again"
This reverts commit 38bfb58f78, reversing
changes made to 1fa50e12a8.
2025-11-16 21:20:31 +01:00
Alug ed5dbf74f4 Revert "Merge pull request #206 from Indev450/updatemixer"
This reverts commit ca3f40ddf1, reversing
changes made to 38bfb58f78.
2025-11-16 21:20:26 +01:00
Alug 2bf0a24ab6 Revert "comment out directsound thing"
This reverts commit 37cd720dd6.
2025-11-16 21:20:14 +01:00
Alug 88a9d6c29e Fix dedicated server build
forgor about I_HandleControllerHatRepeat
fixes https://github.com/Indev450/SRB2Kart-Saturn/issues/212
2025-11-16 20:50:15 +01:00
Alug 335b7ba737 Fix dedicated server build
forgor about I_HandleControllerHatRepeat
fixes https://github.com/Indev450/SRB2Kart-Saturn/issues/212
2025-11-16 20:50:09 +01:00
Alug 37cd720dd6 comment out directsound thing
somehow this still applied on 32 bit build
2025-11-16 19:58:17 +01:00
Alug a085abe538 remove "stun.c" from sourcefile
fixes linking on windoze
will need to handle this in cmake seperately!
2025-11-16 19:58:15 +01:00
Alug 57dc099641 Update README 2025-11-16 19:51:44 +01:00
Alug 84a3503262 comment out directsound thing
somehow this still applied on 32 bit build
2025-11-16 16:54:11 +01:00
Alug 5117bf1f85 remove "stun.c" from sourcefile
fixes linking on windoze
will need to handle this in cmake seperately!
2025-11-16 16:31:23 +01:00
Alug d4a29f2a44 this aint testing anymore :3 2025-11-16 17:18:23 +01:00
Alug 6129e7c864 Merge branch 'Saturn-Next' into Saturn 2025-11-16 17:02:58 +01:00
Alug 51371dce80 delet cv_birdmusic toggle
stuff was from ages ago, we can just check for the feature toggles instead
2025-11-16 15:27:59 +01:00
Alug 4814088265 mixer_sound/s_sound: remove all the pointless "else"
+ some tiny optimizations here and there
2025-11-16 15:27:56 +01:00
Alug 2344c391d2 Renderer: port some texture skewing fixes from SRB2
- ffloors on the frontsector in opengl now support texture skewing like software
- alot of cleanups, simplifycation and optimizations
2025-11-16 15:27:36 +01:00
Alug 105267612b git pls 2025-11-14 15:30:14 +01:00
Alug 69ef78b2e8 Merge branch 'fakeseed' into Saturn-Next 2025-11-14 15:29:38 +01:00
Alug f4349988c4 smol timing related changes
avoid mixing integer maths AFTER casting to float types, even though its all double this may lead to wonky precision issues
I_GetPrecisePrecision now also doesent always call SDL_GetPerformanceFrequency everytime, since its return value will never change since its solely dependant on the platform
and also removing some dead code
2025-11-14 15:12:54 +01:00
Alug 1b42131c6f remove md5 from sourcefile list
we handle it seperately both in make and cmake, having it here just breaks compile
2025-11-14 14:51:04 +01:00
indev c8db86379d Merge pull request #210 from Indev450/lua-check-local-addon
Automatically check if lua-spawned mobj comes from "addfilelocal addon" hook
2025-11-14 16:50:04 +03:00
Alug 40d2bf816c Merge pull request #207 from Indev450/controllerfixes
Some Controller fixes
2025-11-14 14:47:27 +01:00
Alug ca3f40ddf1 Merge pull request #206 from Indev450/updatemixer
Update sdl2_mixer to 2.8.1 for Windows
2025-11-14 14:47:16 +01:00
Alug 38bfb58f78 Merge pull request #204 from Indev450/updatesdl2again
Update SDL2 to 2.32.10 on Windows builds
2025-11-14 14:46:33 +01:00
Alug 1fa50e12a8 hw_main: some smoller optimizations
- use sqrtf for fade/tint alpha for shaderless light calc
- save recalcing the cosine/sine from angle on angled flats 3 times in HWR_RenderPlane
- precalc float "int32 min/max "
2025-11-14 13:31:57 +01:00
Alug f73e616b97 fail loudly if sdl window/renderer/gl context creation fails
this will crash eitherways, so much rather get atleast a somewhat more informative error
2025-11-14 12:35:45 +01:00
Alug fe0ade1d9c fix some shadowed variables 2025-11-14 06:00:52 +01:00
Alug 1fb60e8230 fix sourcefile for src dir 2025-11-13 19:54:09 +01:00
Alug efe7009650 PT_ReceivedGamestate: add missing SATURNPAK ifdef 2025-11-13 19:31:33 +01:00
Alug 19a4e379d7 HWR_DoWipe: always draw a black screen if it returns early
otherwise this just flashes like crazy should there ever be any issue here
2025-11-13 17:38:45 +01:00
Alug 4e8865d495 cleanup some wonky float/double maths 2025-11-13 17:38:43 +01:00
Alug dfca24b370 HWR_SkyDomeVertex: tiny optimization
save a tiny bit of float division, use float sin and cos functions, handle implicit float conversions
2025-11-13 16:45:57 +01:00
Alug a4c2fd2414 Merge branch 'Saturn-Next' into updatesdl2again 2025-11-12 19:22:07 +01:00
Alug aa985823ba speed up GL_SetPalette "take 2"
ensuring bytecolor is packed nd mypalettedata is initialized this seems to now work properly on windows
2025-11-12 19:20:43 +01:00
Alug b779c9e63d ensure byteColor_t is packed
make sure it is always sized 4 bytes and not padded at all since that is assumed to be the size
2025-11-12 19:04:39 +01:00
Alug c58e54544d initialize all remaining globals
well atleast all i can find lel
2025-11-12 16:49:44 +01:00
Alug c080fc8732 GL_UpdateTexture: fix small oversight
from when i refactored it
GL_TEXFMT_AP_88 needs to increment the image data ptr even if chromakeyed
2025-11-11 22:39:31 +01:00
Alug 76747b4677 git merge pls 2025-11-11 14:48:59 +01:00
Alug 5268fc2d19 Merge branch 'Saturn-Next' into fakeseed 2025-11-11 14:42:41 +01:00
Alug 7325c8dbfd Merge branch 'Saturn-Next' into fakeseed 2025-10-28 00:02:35 +01:00
Alug e5c18ae1f1 update ms listing if fakeseed was changed 2025-10-27 22:47:18 +01:00
Alug 4bb5b8fa04 add "Fake Seed" system
allow sending a fake player to the ms and serverbrowser when your dedicated server is empty
effectively functioning as a "seed" player without manual intervention and occupieng a server slot
2025-10-27 22:24:21 +01:00
indev eb04271c83 Actually try to do this with hooks 2025-10-23 22:52:03 +03:00
indev 54e7ad571e Check if mobj is spawned from local addon in most of lua_baselib functions related to mobjs 2025-10-23 22:00:46 +03:00
Alug 92ec4e65c1 update sdl2_mixer to 2.8.1
since we use wasapi now we can finally update this to 2.8.1 hopefully without any regressions now
2025-10-23 20:57:24 +02:00
Alug a3e97b90f6 dont force directsound for sdl versions from 2.26.5 on windows
directsound is deprecated since 13 years!
superseeded by wasapi
2.26.5 sdl brought some major improvements to resampling which fixes the issues this aimed to work around, but instead this workaround caused a plethora of issues, like breaking loops in some cases or the votescreen music
2025-10-23 20:57:21 +02:00
Alug 6f17ed0883 Merge branch 'Saturn-Next' into updatesdl2again 2025-10-16 15:07:54 +01:00
Alug 02d6fccfa9 Merge remote-tracking branch 'origin/Saturn-Next' into updatesdl2again 2025-10-10 16:40:05 +01:00
Alug 0ceaca4b2f Merge branch 'Saturn-Next' into updatesdl2again 2025-10-03 22:43:29 +01:00
Alug af9fa77501 update SDL2 to 2.32.10
Fixes keyboard input issues for certain languages when using the "native" keyboard input setting
probably fixes some other issues aswell
needs regression testing
2025-10-03 21:29:26 +01:00
Alug 2049353647 move this out of maptitle condition
it does not rely on it and may even fail
idk why i threw it in there
2025-07-27 15:11:07 +02:00
73 changed files with 1171 additions and 7084 deletions

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ We also have a Flatpak available on [Flathub](https://flathub.org/en/apps/org.sr
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2.
Currently only the Makefile build system with GCC or Clang compiler is supported.
CMake is NOT supported at the moment, but will be availible again soon.
Visual C++ (MSVC) is unsupported.
+20 -15
View File
@@ -1,15 +1,20 @@
# SDL Development Libaries
Download both the VC and MinGW packages and extract them here.
https://www.libsdl.org/download-2.0.php
## VC Package
* include
* lib
## MinGW Package
* i686-w64-mingw32
* x86_64-w64-mingw32
# SDL Development Libaries
Download both the VC and MinGW packages and extract them here.
https://www.libsdl.org/download-2.0.php
## VC Package
* include
* lib
## MinGW Package
* i686-w64-mingw32
* x86_64-w64-mingw32
# SRB2Kart Saturn note:
Due to a good amount of issues with newer SDL releases, we decided to ship our own Version of the library.
This version is just the 2.28.5 release with a fix backported for non US keyboard layouts that prevented the right ALT GR key from working properly.
It can be found under: https://github.com/alufolie91/SDL/tree/backportaltgrfix
Binary file not shown.
+65 -65
View File
@@ -1,65 +1,65 @@
#!/bin/sh
# Get the canonical path of the folder containing this script
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
# Calculate the canonical path of the prefix, relative to the folder of this script
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib
#usage="\
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
usage="\
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo 2.28.5
;;
--cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;;
--libs)
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
;;
--static-libs)
# --libs|--static-libs)
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
echo -L${exec_prefix}/lib $sdl_static_libs
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
#!/bin/sh
# Get the canonical path of the folder containing this script
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
# Calculate the canonical path of the prefix, relative to the folder of this script
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib
#usage="\
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
usage="\
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo 2.28.5
;;
--cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;;
--libs)
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
;;
--static-libs)
# --libs|--static-libs)
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
echo -L${exec_prefix}/lib $sdl_static_libs
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
Binary file not shown.
+65 -65
View File
@@ -1,65 +1,65 @@
#!/bin/sh
# Get the canonical path of the folder containing this script
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
# Calculate the canonical path of the prefix, relative to the folder of this script
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib
#usage="\
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
usage="\
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo 2.28.5
;;
--cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;;
--libs)
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
;;
--static-libs)
# --libs|--static-libs)
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
echo -L${exec_prefix}/lib $sdl_static_libs
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
#!/bin/sh
# Get the canonical path of the folder containing this script
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
# Calculate the canonical path of the prefix, relative to the folder of this script
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib
#usage="\
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
usage="\
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo 2.28.5
;;
--cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;;
--libs)
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
;;
--static-libs)
# --libs|--static-libs)
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
echo -L${exec_prefix}/lib $sdl_static_libs
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -30,7 +30,7 @@ sources+=sdl/ogl_sdl.c
endif
ifdef NOMIXER
sources+=sdl/sdl_sound.c
sources+=sdl/dummy_sound.c
else
opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c
+3 -3
View File
@@ -48,13 +48,13 @@ v_video.c
w_wad.c
y_inter.c
z_zone.cpp
r_bsp.c
r_bsp.cpp
r_data.c
r_draw.c
r_draw.cpp
r_fps.cpp
r_main.cpp
r_patch.cpp
r_patchrotation.c
r_patchrotation.cpp
r_plane.cpp
r_segs.cpp
r_skins.c
+1 -1
View File
@@ -277,7 +277,7 @@ static xcommand_t *com_commands = NULL; // current commands
#define MAX_ARGS 80
static size_t com_argc;
char *com_argv[MAX_ARGS];
char *com_argv[MAX_ARGS] = {};
static const char *com_null_string = "";
static char *com_args = NULL; // current command args or NULL
+4 -4
View File
@@ -58,7 +58,7 @@ I_mutex con_mutex;
static boolean con_started = false; // console has been initialised
boolean con_startup = false; // true at game startup, screen need refreshing
static boolean con_forcepic = true; // at startup toggle console translucency when first off
boolean con_recalc; // set true when screen size has changed
boolean con_recalc = false; // set true when screen size has changed
static tic_t con_tick; // console ticker for anim or blinking prompt cursor
// con_scrollup should use time (currenttime - lasttime)..
@@ -66,8 +66,8 @@ static tic_t con_tick; // console ticker for anim or blinking prompt cursor
static boolean consoletoggle; // true when console key pushed, ticker will handle
static boolean consoleready; // console prompt is ready
INT32 con_destlines; // vid lines used by console at final position
static INT32 con_curlines; // vid lines currently used by console
INT32 con_destlines = 0; // vid lines used by console at final position
static INT32 con_curlines; // vid lines currently used by console
static UINT8 con_hudlines; // number of console heads up message lines
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
@@ -83,7 +83,7 @@ static size_t con_totallines; // lines of console text into the console buf
static size_t con_width; // columns of chars, depend on vid mode width
static size_t con_scrollup; // how many rows of text to scroll up (pgup/pgdn)
UINT32 con_scalefactor; // text size scale factor
UINT32 con_scalefactor = 0; // text size scale factor
// hold 32 last lines of input for history
#define CON_MAXPROMPTCHARS 256
+57 -1
View File
@@ -143,6 +143,11 @@ static CV_PossibleValue_t mindelay_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL
consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz...
// allows a fake player to appear on the ms and serverlist when your dedi server is empty
static void FakeSeed_OnChange(void);
consvar_t cv_usefakeseed = {"fakeseed", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, FakeSeed_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fakeseedname = {"fakeseedname", "Player 1", CV_SAVE|CV_CALL|CV_NOINIT, NULL, FakeSeed_OnChange, 0, NULL, NULL, 0, 0, NULL};
SINT8 nodetoplayer[MAXNETNODES] = {};
SINT8 nodetoplayer2[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen)
SINT8 nodetoplayer3[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 2)
@@ -240,6 +245,13 @@ consvar_t cv_httpsource = {"http_source", "", CV_SAVE, NULL, NULL, 0, NULL, NULL
consvar_t cv_kicktime = {"kicktime", "10", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
static void FakeSeed_OnChange(void)
{
#ifdef MASTERSERVER
Update_MS();
#endif
}
static boolean UseLocalDelay(void)
{
if (dedicated || (server && server_lagless && !cv_mindelay.value) || modeattacking == ATTACKING_RECORD)
@@ -1544,6 +1556,12 @@ static boolean CL_SendJoin(void)
return HSendPacket(servernode, false, 0, sizeof(clientconfig_pak));
}
static boolean UseFakeSeed(void)
{
// due to complexity this will disable the moment a real player joins
return (dedicated && cv_usefakeseed.value && D_NumPlayers() == 0);
}
static void SV_SendServerInfo(INT32 node, tic_t servertime)
{
UINT8 *p;
@@ -1566,7 +1584,12 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.time = (tic_t)LONG(servertime);
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
// force 1 player
if (UseFakeSeed())
netbuffer->u.serverinfo.numberofplayer = (UINT8)1;
else
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
// SRB2Kart: Vanilla's gametype constants for MS support
@@ -1645,6 +1668,37 @@ static void SV_SendPlayerInfo(INT32 node)
netbuffer->packettype = PT_PLAYERINFO;
// send a fake player to trick ms and serverbrowser
if (UseFakeSeed())
{
//printf("sending fake player lmao\n");
netbuffer->u.playerinfo[0].node = 0;
// fallback to smth, make sure this is always set
if (!cv_fakeseedname.string[0])
CV_Set(&cv_fakeseedname, "Player 1");
strlcpy(netbuffer->u.playerinfo[0].name, cv_fakeseedname.string, MAXPLAYERNAME+1);
memset(netbuffer->u.playerinfo[0].address, 0, 4);
// make it appear as spectator
netbuffer->u.playerinfo[0].team = 255;
// doesent really matter what we put here lel
netbuffer->u.playerinfo[0].score = LONG(42069);
netbuffer->u.playerinfo[0].timeinserver = SHORT(42069);
netbuffer->u.playerinfo[0].skin = (UINT8)1; // no clue wtf skin 1 is, tails maybe?
netbuffer->u.playerinfo[0].data = 0;
// mark every other slot as empty
for (i = 1; i < MSCOMPAT_MAXPLAYERS; i++)
netbuffer->u.playerinfo[i].node = 255;
HSendPacket(node, false, 0, sizeof(plrinfo) * MSCOMPAT_MAXPLAYERS);
return;
}
for (i = 0; i < MSCOMPAT_MAXPLAYERS; i++)
{
if ((i >= MAXPLAYERS) || !playeringame[i])
@@ -5854,12 +5908,14 @@ static void PT_FileFragmentFromPlayer(SINT8 node)
Got_Filetxpak();
}
#ifdef SATURNPAK
static void PT_ReceivedGamestate(SINT8 node)
{
sendingsavegame[node] = false;
resendingsavegame[node] = 0;
savegameresendcooldown[node] = I_GetTime() + cv_resynchcooldown.value * TICRATE; // I_GetTime() + 5 * TICRATE;
}
#endif
/** Handles a packet received from a node that is in game
*
+2
View File
@@ -582,6 +582,8 @@ extern tic_t simulated_lag;
extern tic_t lowest_lag;
extern consvar_t cv_mindelay, cv_gentlemens;
extern consvar_t cv_usefakeseed, cv_fakeseedname;
extern consvar_t
cv_netticbuffer, cv_allownewplayer,
#ifdef SATURNJOIN
+23 -12
View File
@@ -675,6 +675,7 @@ void D_SRB2Loop(void)
tic_t entertic = 0, oldentertics = 0, realtics = 0, rendertimeout = INFTICS;
double deltatics = 0.0;
double deltasecs = 0.0;
UINT64 precision;
boolean interp = false;
boolean doDisplay = false;
@@ -710,18 +711,23 @@ void D_SRB2Loop(void)
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, W_CachePatchNum(W_GetNumForName("KARTKREW"), PU_PATCH_LOWPRIORITY), NULL);
I_FinishUpdate(); // page flip or blit buffer
precision = I_GetPrecisePrecision();
for (;;)
{
// capbudget is the minimum precise_t duration of a single loop iteration
precise_t capbudget;
precise_t enterprecise = I_GetPreciseTime();
precise_t elapsed;
precise_t enterprecise, finishprecise;
enterprecise = I_GetPreciseTime();
memset(&g_dc, 0, sizeof(g_dc));
Z_Frame_Reset();
// Casting the return value of a function is bad practice (apparently)
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
capbudget = (precise_t)budget;
const UINT32 framecap = R_GetFramerateCap();
capbudget = (framecap == 0) ? 0 : (precise_t)((double)precision / (double)framecap + 0.5); // + 0.5 instead of round
boolean ranwipe = false;
@@ -799,7 +805,7 @@ void D_SRB2Loop(void)
if (interp)
{
renderdeltatics = FloatToFixed(deltatics);
renderdeltatics = DoubleToFixed(deltatics);
// I looked at the possibility of putting in a float drawer for
// perfstats and it's very complicated, so we'll just do this instead...
@@ -848,12 +854,13 @@ void D_SRB2Loop(void)
}
#endif
// Fully completed frame made.
precise_t finishprecise = I_GetPreciseTime();
finishprecise = I_GetPreciseTime();
// Use the time before sleep for frameskip calculations:
// post-sleep time is literally being intentionally wasted
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
deltatics = deltasecs * NEWTICRATE;
elapsed = finishprecise - enterprecise;
deltasecs = (double)elapsed / (double)precision;
deltatics = deltasecs * (double)NEWTICRATE;
// If time spent this game loop exceeds a single tic,
// it's probably because of rendering.
@@ -881,12 +888,10 @@ void D_SRB2Loop(void)
if (!singletics)
{
INT64 elapsed = (INT64)(finishprecise - enterprecise);
// in the case of "match refresh rate" + vsync, don't sleep at all
const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0;
if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh)
if ((elapsed > 0) && (capbudget > elapsed) && !vsync_with_match_refresh)
{
I_SleepDuration(capbudget - elapsed);
}
@@ -894,8 +899,9 @@ void D_SRB2Loop(void)
// Capture the time once more to get the real delta time.
finishprecise = I_GetPreciseTime();
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
deltatics = deltasecs * NEWTICRATE;
elapsed = finishprecise - enterprecise;
deltasecs = (double)elapsed / (double)precision;
deltatics = deltasecs * (double)NEWTICRATE;
}
}
@@ -1920,6 +1926,10 @@ void D_SRB2Main(void)
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
R_Init();
#if SOUND==SOUND_DUMMY
sound_disabled = true;
music_disabled = true;
#else
// setting up sound
if (dedicated || M_CheckParm("-noaudio")) // combines -nosound and -nomusic
{
@@ -1941,6 +1951,7 @@ void D_SRB2Main(void)
I_InitMusic();
S_InitSfxChannels(cv_soundvolume.value);
}
#endif
S_InitMusicDefs();
+4 -4
View File
@@ -805,16 +805,16 @@ const char *packettypename[NUMPACKETTYPE] =
"TELLFILESNEEDED",
"MOREFILESNEEDED",
"PING"
"PING",
#ifdef SATURNPAK
,
"WILLRESENDGAMESTATE",
"CANRECEIVEGAMESTATE",
"RECEIVEDGAMESTATE",
"ISSATURN" // special packet to identify saturn clients
"ISSATURN", // special packet to identify saturn clients
#endif
"MAPICON", // Send map image icon (gamespy).
"NEEDMAPICON" // Request missed map icon (gamespy).
};
const char *Net_GetPacketName(UINT8 packettype)
+3
View File
@@ -760,6 +760,9 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_showping);
CV_RegisterVar(&cv_pingmeasurement);
CV_RegisterVar(&cv_usefakeseed);
CV_RegisterVar(&cv_fakeseedname);
#ifdef SEENAMES
CV_RegisterVar(&cv_allowseenames);
#endif
+24 -18
View File
@@ -808,20 +808,23 @@ static void I_SetupMumble(void)
void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
{
#ifdef HAVE_MUMBLE
double angle;
float angle;
fixed_t anglef;
if (!mumble)
return;
if (mumble->uiVersion != 2) {
wcsncpy(mumble->name, L"SRB2Kart "VERSIONSTRINGW, 256);
if (mumble->uiVersion != 2)
{
wcsncpy(mumble->name, L"SRB2Kart " VERSIONSTRINGW, 256);
wcsncpy(mumble->description, L"Sonic Robo Blast 2 Kart with integrated Mumble Link support.", 2048);
mumble->uiVersion = 2;
}
mumble->uiTick++;
if (!netgame || gamestate != GS_LEVEL) { // Zero out, but never delink.
// Zero out, but never delink.
if (!netgame || gamestate != GS_LEVEL)
{
mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
mumble->fAvatarFront[0] = 1.0f;
mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
@@ -838,31 +841,34 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
mumble->context_len = (UINT32)(p - mumble->context);
}
if (mobj) {
mumble->fAvatarPosition[0] = FIXED_TO_FLOAT(mobj->x) / MUMBLEUNIT;
mumble->fAvatarPosition[1] = FIXED_TO_FLOAT(mobj->z) / MUMBLEUNIT;
mumble->fAvatarPosition[2] = FIXED_TO_FLOAT(mobj->y) / MUMBLEUNIT;
if (mobj)
{
mumble->fAvatarPosition[0] = FixedToFloat(mobj->x) / MUMBLEUNIT;
mumble->fAvatarPosition[1] = FixedToFloat(mobj->z) / MUMBLEUNIT;
mumble->fAvatarPosition[2] = FixedToFloat(mobj->y) / MUMBLEUNIT;
anglef = AngleFixed(mobj->angle);
angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
mumble->fAvatarFront[0] = (float)cos(angle);
angle = (float)(FixedToFloat(anglef) * DEG2RAD);
mumble->fAvatarFront[0] = cosf(angle);
mumble->fAvatarFront[1] = 0.0f;
mumble->fAvatarFront[2] = (float)sin(angle);
} else {
mumble->fAvatarFront[2] = sinf(angle);
}
else
{
mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
mumble->fAvatarFront[0] = 1.0f;
mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
}
mumble->fCameraPosition[0] = FIXED_TO_FLOAT(listener.x) / MUMBLEUNIT;
mumble->fCameraPosition[1] = FIXED_TO_FLOAT(listener.z) / MUMBLEUNIT;
mumble->fCameraPosition[2] = FIXED_TO_FLOAT(listener.y) / MUMBLEUNIT;
mumble->fCameraPosition[0] = FixedToFloat(listener.x) / MUMBLEUNIT;
mumble->fCameraPosition[1] = FixedToFloat(listener.z) / MUMBLEUNIT;
mumble->fCameraPosition[2] = FixedToFloat(listener.y) / MUMBLEUNIT;
anglef = AngleFixed(listener.angle);
angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
mumble->fCameraFront[0] = (float)cos(angle);
angle = (float)(FixedToFloat(anglef) * DEG2RAD);
mumble->fCameraFront[0] = cosf(angle);
mumble->fCameraFront[1] = 0.0f;
mumble->fCameraFront[2] = (float)sin(angle);
mumble->fCameraFront[2] = sinf(angle);
#else
(void)mobj;
(void)listener;
+4 -1
View File
@@ -155,7 +155,10 @@ boolean I_UseNativeKeyboard(void)
return false;
}
void I_HandleControllerHatRepeat(void)
{
}
void I_SetBorderlessWindow(void)
{
}
+3 -3
View File
@@ -47,9 +47,9 @@
// Free slot names
// The crazy word-reading stuff uses these.
char *FREE_STATES[NUMSTATEFREESLOTS];
char *FREE_MOBJS[NUMMOBJFREESLOTS];
UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
char *FREE_STATES[NUMSTATEFREESLOTS] = {};
char *FREE_MOBJS[NUMMOBJFREESLOTS] = {};
UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1] = {}; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
#define initfreeslots() {\
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
+8 -15
View File
@@ -19,25 +19,18 @@
// This should actually be in the makefile,
// but I can't stand that gibberish. D:
#define SOUND_DUMMY 0
#define SOUND_SDL 1
#define SOUND_MIXER 2
#define SOUND_MIXER 1
#ifndef SOUND
#ifdef HAVE_SDL
// Use Mixer interface?
#ifdef HAVE_MIXER
#define SOUND SOUND_MIXER
#else
#define SOUND SOUND_DUMMY
#endif
// Use generic SDL interface.
#ifndef SOUND
#define SOUND SOUND_SDL
#endif
#else // No SDL.
// No more interfaces. :(
#define SOUND SOUND_DUMMY
#else
#define SOUND SOUND_DUMMY
#endif
#endif
@@ -114,10 +107,10 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9"
#define VERSIONSTRINGW L"Saturn v9"
#define VERSIONSTRING "Saturn v9.1"
#define VERSIONSTRINGW L"Saturn v9.1"
#define SATURN_TESTING // comment out for saturn release builds!
//#define SATURN_TESTING // comment out for saturn release builds!
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
+1 -1
View File
@@ -293,7 +293,7 @@ typedef struct
UINT8 green;
UINT8 blue;
UINT8 alpha;
} byteColor_t;
} ATTRPACK byteColor_t;
union FColorRGBA
{
+1 -1
View File
@@ -208,7 +208,7 @@ static void F_SkyScroll(INT32 scrollspeed)
INT32 intro_scenenum = 0;
INT32 intro_curtime = 0;
const char *introtext[NUMINTROSCENES];
const char *introtext[NUMINTROSCENES] = {};
static tic_t introscenetime[NUMINTROSCENES] =
{
+6 -2
View File
@@ -98,7 +98,8 @@ static fixed_t paldiv;
* \param lump Lump name to get data from
* \return fademask_t for lump
*/
static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum)
{
static char lumpname[9] = "FADEmmss";
static fademask_t fm = {NULL,0,0,0,0,0};
lumpnum_t lumpnum;
@@ -148,6 +149,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
case 0: // end marker (not bad!, but still need clearing)
goto freemask;
}
if (lsize != fm.size)
fm.mask = Z_Realloc(fm.mask, lsize, PU_STATIC, NULL);
fm.size = lsize;
@@ -361,6 +363,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
{
// get fademask first so we can tell if it exists or not
fmask = F_GetFadeMask(wipetype, wipeframe++);
if (!fmask)
break;
@@ -377,7 +380,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
HWR_DoWipe(wipetype, wipeframe-1); // send in the wipe type and wipeframe because we need to cache the graphic
else
#endif
if (rendermode != render_none) //this allows F_RunWipe to be called in dedicated servers
if (rendermode != render_none) // this allows F_RunWipe to be called in dedicated servers
F_DoWipe(fmask);
I_OsPolling();
@@ -401,6 +404,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
NetKeepAlive(); // Update the network so we don't cause timeouts
}
WipeInAction = false;
#endif
}
+5 -6
View File
@@ -44,16 +44,16 @@ consvar_t cv_addons_search_case = {"addons_search_case", "No", CV_SAVE, CV_YesNo
static CV_PossibleValue_t addons_search_type_cons_t[] = {{0, "Start"}, {1, "Anywhere"}, {0, NULL}};
consvar_t cv_addons_search_type = {"addons_search_type", "Anywhere", CV_SAVE, addons_search_type_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
char menupath[MAXFILEPATH];
size_t menupathindex[menudepth];
char menupath[MAXFILEPATH] = {};
size_t menupathindex[menudepth] = {};
size_t menudepthleft = menudepth;
char menusearchbuf[MAXSTRINGLENGTH+1];
textinput_t menusearch;
char **dirmenu, **coredirmenu; // core only local for this file
size_t sizedirmenu, sizecoredirmenu; // ditto
size_t dir_on[menudepth];
char **dirmenu = NULL, **coredirmenu = NULL; // core only local for this file
size_t sizedirmenu = 0, sizecoredirmenu = 0; // ditto
size_t dir_on[menudepth] = {};
UINT8 refreshdirmenu = 0;
char *refreshdirname = NULL;
@@ -92,7 +92,6 @@ INT32 pathisdirectory(const char *path)
// skip those folders, they will not have any addons
static const char *exclude_paths[] = {
"logs",
"luafiles",
"replay",
"mdls",
"gifs",
+1 -1
View File
@@ -2288,7 +2288,7 @@ void G_PlayerReborn(INT32 player)
}
/* I'm putting this here because lol */
fade = (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(p));
fade = (cv_fading.value && P_IsLocalPlayer(p));
if (fade)
{
+187 -128
View File
@@ -430,13 +430,13 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
blue = (float)poly_color.s.blue;
// 48 is just an arbritrary value that looked relatively okay.
tint_alpha = (float)(sqrt(tint_color.s.alpha) * 48) / 255.0f;
tint_alpha = (sqrtf((float)tint_color.s.alpha) * 48.0f) / 255.0f;
// 8 is roughly the brightness of the "close" color in Software, and 16 the brightness of the "far" color.
// 8 is too bright for dark levels, and 16 is too dark for bright levels.
// 12 is the compromise value. It doesn't look especially good anywhere, but it's the most balanced.
// (Also, as far as I can tell, fade_color's alpha is actually not used in Software, so we only use light level.)
fade_alpha = (float)(sqrt(255-light_level) * 12) / 255.0f;
fade_alpha = (sqrtf((float)(255-light_level)) * 12.0f) / 255.0f;
// Clamp the alpha values
tint_alpha = CLAMP(tint_alpha, 0.0f, 1.0f);
@@ -557,7 +557,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
size_t len;
float tempxsow, tempytow;
float scrollx = 0.0f, scrolly = 0.0f, anglef = 0.0f;
float scrollx = 0.0f, scrolly = 0.0f;
float anglef = 0.0f, cosangf = 0.0f, sinangf = 0.0f;
angle_t angle = 0;
static FOutVector *planeVerts = NULL;
@@ -571,7 +572,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
nrPlaneVerts = planepoly->numpts;
if (nrPlaneVerts < 3) //not even a triangle ?
if (nrPlaneVerts < 3) // not even a triangle ?
return;
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
@@ -654,8 +655,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
tempxsow = flatxref;
tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle));
flatxref = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));
flatyref = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));
cosangf = cosf(anglef);
sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
flatyref = (tempxsow * sinangf) + (tempytow * cosangf);
}
#define SETUP3DVERT(vert, vx, vy) {\
@@ -668,8 +671,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
{\
tempxsow = vert->s;\
tempytow = vert->t;\
vert->s = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));\
vert->t = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));\
vert->s = (tempxsow * cosangf) - (tempytow * sinangf);\
vert->t = (tempxsow * sinangf) + (tempytow * cosangf);\
}\
\
vert->x = (vx);\
@@ -1150,11 +1153,11 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
// Additionally, to remove the need to draw the sky twice, drawing a plane at the far clip boundary to the stencil buffer after other
// rendering will also allow stencil sky rendering to fill in any untouched pixels too.
FOutVector* skyWallVertexArray = NULL;
int skyWallVertexArraySize = 0;
int skyWallVertexArrayAllocSize = 65536;// what a mouthful
static FOutVector* skyWallVertexArray = NULL;
static int skyWallVertexArraySize = 0;
static int skyWallVertexArrayAllocSize = 65536;// what a mouthful
boolean gl_collect_skywalls = false;
static boolean gl_collect_skywalls = false;
static void HWR_SkyWallList_Clear(void)
{
@@ -1183,7 +1186,7 @@ static void HWR_SkyWallList_Add(FOutVector *wallVerts)
static void HWR_DrawSkyWallList(void)
{
int i;
FSurfaceInfo surf;
FSurfaceInfo surf = {};
surf.PolyColor.rgba = 0xFFFFFFFF;
@@ -1268,8 +1271,8 @@ static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
pSurf->PolyColor.s.alpha = 0x00; // This shouldn't draw anything regardless of blendmode
return false;
}
else
blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, pSurf);
blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, pSurf);
}
if (blendmode != PF_Masked && pSurf->PolyColor.s.alpha == 0x00)
@@ -1362,6 +1365,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
GLMapTexture_t *glTex = NULL;
static constexpr float FLOATMAX = INT32_MAX / (float)FRACUNIT;
static constexpr float FLOATMIN = INT32_MIN / (float)FRACUNIT;
// two sided line
if (gl_backsector)
{
@@ -1376,7 +1382,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!gl_curline->polyseg) // Don't do it for polyobjects
{
// Sky Ceilings
wallVerts[3].y = wallVerts[2].y = FixedToFloat(INT32_MAX);
wallVerts[3].y = wallVerts[2].y = FLOATMAX;
auto draw_sky_walls = [&](int vert1, int vert2, fixed_t world, fixed_t worldslope)
{
@@ -1411,7 +1417,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
// Sky Floors
wallVerts[0].y = wallVerts[1].y = FixedToFloat(INT32_MIN);
wallVerts[0].y = wallVerts[1].y = FLOATMIN;
if (gl_frontsector->floorpic == skyflatnum)
{
@@ -1455,18 +1461,21 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// check TOP TEXTURE
if (gl_toptexture && (worldhighslope < worldtopslope || worldhigh < worldtop))
{
fixed_t texheight = textureheight[gl_toptexture];
// PEGGING
// FIXME: This is probably not correct?
if (gl_linedef->flags & ML_DONTPEGTOP)
texturevpeg = 0;
else if (gl_linedef->flags & ML_EFFECT1)
texturevpeg = worldhigh + textureheight[gl_toptexture] - worldtop;
texturevpeg = worldhigh + texheight - worldtop;
else
texturevpeg = gl_backsector->ceilingheight + textureheight[gl_toptexture] - gl_frontsector->ceilingheight;
texturevpeg = gl_backsector->ceilingheight + texheight - gl_frontsector->ceilingheight;
texturevpeg += gl_sidedef->rowoffset;
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
texturevpeg %= textureheight[gl_toptexture];
texturevpeg %= texheight;
glTex = HWR_GetTexture(gl_toptexture, noencore);
@@ -1487,13 +1496,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else if (gl_linedef->flags & ML_DONTPEGTOP)
{
// Skewed by top
wallVerts[0].t = (texturevpeg + worldtop - worldhigh) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + worldtopslope - worldhighslope) * glTex->scaleY;
wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
}
else
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldtop - worldhigh) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
}
@@ -1533,7 +1542,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_bottomtexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_backsector->floorheight - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1549,14 +1558,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldlow - worldbottom) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
}
else
{
// Skewed by top
wallVerts[0].t = (texturevpeg + worldlow - worldbottom) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + worldlowslope - worldbottomslope) * glTex->scaleY;
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
}
// set top/bottom coords
@@ -1588,6 +1597,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
back = gl_linedef->backsector;
fixed_t texheight = textureheight[gl_midtexture];
if (gl_sidedef->repeatcnt)
repeats = 1 + gl_sidedef->repeatcnt;
else if (gl_linedef->flags & ML_EFFECT5 || gl_portal_state == GLPORTAL_STENCIL || gl_portal_state == GLPORTAL_DEPTH)
@@ -1604,8 +1615,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
low = back->floorheight;
repeats = (high - low) / textureheight[gl_midtexture];
if ((high - low) % textureheight[gl_midtexture])
repeats = (high - low) / texheight;
if ((high - low) % texheight)
repeats++; // tile an extra time to fill the gap -- Monster Iestyn
}
else
@@ -1637,18 +1648,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
// Find the wall's coordinates
const fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
const fixed_t midtexheight = texheight * repeats;
fixed_t rowoffset = gl_sidedef->rowoffset;
// Texture is not skewed
if (gl_linedef->flags & ML_EFFECT2)
{
if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) // Peg it to the floor
{
polybottom = std::max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset;
polytop = polybottom + midtexheight;
polybottom = std::max(gl_frontsector->floorheight, gl_backsector->floorheight) + rowoffset;
polytop = polybottom + midtexheight;
}
else // Peg it to the ceiling
// Peg it to the ceiling
else
{
polytop = std::min(front->ceilingheight, back->ceilingheight) + gl_sidedef->rowoffset;
polytop = std::min(gl_frontsector->ceilingheight, gl_backsector->ceilingheight) + rowoffset;
polybottom = polytop - midtexheight;
}
@@ -1658,16 +1673,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) // Skew the texture, but peg it to the floor
{
polybottom = popenbottom + gl_sidedef->rowoffset;
polybottom = popenbottom + rowoffset;
polytop = polybottom + midtexheight;
polybottomslope = popenbottomslope + gl_sidedef->rowoffset;
polybottomslope = popenbottomslope + rowoffset;
polytopslope = polybottomslope + midtexheight;
}
else // Skew it according to the ceiling's slope
{
polytop = popentop + gl_sidedef->rowoffset;
polytop = popentop + rowoffset;
polybottom = polytop - midtexheight;
polytopslope = popentopslope + gl_sidedef->rowoffset;
polytopslope = popentopslope + rowoffset;
polybottomslope = polytopslope - midtexheight;
}
@@ -1751,7 +1766,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
glTex = HWR_GetTexture(gl_midtexture, noencore);
fixed_t texturevpeg;
fixed_t texturevpeg;
// PEGGING
if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2))
@@ -1776,13 +1791,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
}
else
{
wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
}
//Set textures properly on single sided walls that are sloped
@@ -1819,7 +1834,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
if (gl_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector
{
wallVerts[2].y = wallVerts[3].y = FixedToFloat(INT32_MAX); // draw to top of map space
wallVerts[2].y = wallVerts[3].y = FLOATMAX; // draw to top of map space
wallVerts[0].y = FixedToFloat(worldtop);
wallVerts[1].y = FixedToFloat(worldtopslope);
@@ -1829,7 +1844,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
wallVerts[3].y = FixedToFloat(worldbottom);
wallVerts[2].y = FixedToFloat(worldbottomslope);
wallVerts[0].y = wallVerts[1].y = FixedToFloat(INT32_MIN); // draw to bottom of map space
wallVerts[0].y = wallVerts[1].y = FLOATMIN; // draw to bottom of map space
HWR_DrawSkyWall(wallVerts, &Surf);
}
@@ -1847,7 +1862,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
fixed_t high1, highslope1, low1, lowslope1;
INT32 texnum;
line_t * newline = NULL; // Multi-Property FOF
lowcut = std::max(worldbottom, worldlow);
highcut = std::min(worldtop, worldhigh);
@@ -1882,14 +1896,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
boolean do_texture_skew;
boolean dont_peg_bottom;
if (rover->master->flags & ML_TFERLINE)
{
size_t linenum = std::min((size_t)(gl_curline->linedef-gl_backsector->lines[0]), rover->master->frontsector->linecount);
newline = rover->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
do_texture_skew = newline->flags & ML_DONTPEGTOP;
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
}
else
{
do_texture_skew = rover->master->flags & ML_DONTPEGTOP;
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
}
texnum = R_GetTextureNum(side->midtexture);
h = P_GetFFloorTopZAt (rover, v1x, v1y);
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
@@ -1926,44 +1950,30 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
else
{
fixed_t texturevpeg;
boolean attachtobottom = false;
boolean slopeskew = false; // skew FOF walls with slopes?
// Wow, how was this missing from OpenGL for so long?
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
// -- Monster Iestyn 26/06/18
if (newline)
{
texturevpeg = sides[newline->sidenum[0]].rowoffset;
attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM);
slopeskew = !!(newline->flags & ML_DONTPEGTOP);
}
else
{
texturevpeg = sides[rover->master->sidenum[0]].rowoffset;
attachtobottom = !!(gl_linedef->flags & ML_DONTPEGBOTTOM);
slopeskew = !!(rover->master->flags & ML_DONTPEGTOP);
}
fixed_t texturevpeg = side->rowoffset;
glTex = HWR_GetTexture(texnum, noencore);
if (!slopeskew) // no skewing
if (!do_texture_skew) // no skewing
{
if (attachtobottom)
texturevpeg -= *rover->topheight - *rover->bottomheight;
wallVerts[3].t = (*rover->topheight - h + texturevpeg) * glTex->scaleY;
wallVerts[2].t = (*rover->topheight - hS + texturevpeg) * glTex->scaleY;
wallVerts[0].t = (*rover->topheight - l + texturevpeg) * glTex->scaleY;
wallVerts[1].t = (*rover->topheight - lS + texturevpeg) * glTex->scaleY;
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
if (!attachtobottom) // skew by top
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
wallVerts[1].t = (hS - lS + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
@@ -2032,7 +2042,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
break;
}
if (bothsides) continue;
if (bothsides)
continue;
const ffloortype_e roverflags = rover->flags;
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES))
@@ -2044,14 +2056,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
boolean do_texture_skew;
boolean dont_peg_bottom;
if (rover->master->flags & ML_TFERLINE)
{
size_t linenum = std::min((size_t)(gl_curline->linedef-gl_backsector->lines[0]), rover->master->frontsector->linecount);
newline = rover->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
do_texture_skew = newline->flags & ML_DONTPEGTOP;
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
}
else
{
do_texture_skew = rover->master->flags & ML_DONTPEGTOP;
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
}
texnum = R_GetTextureNum(side->midtexture);
h = P_GetFFloorTopZAt (rover, v1x, v1y);
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
@@ -2088,17 +2110,37 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
else
{
// Wow, how was this missing from OpenGL for so long?
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
// -- Monster Iestyn 26/06/18
fixed_t texturevpeg = side->rowoffset;
glTex = HWR_GetTexture(texnum, noencore);
if (newline)
if (!do_texture_skew) // no skewing
{
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset)) * glTex->scaleY;
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset)) * glTex->scaleY;
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
}
}
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
@@ -2166,12 +2208,13 @@ boolean checkforemptylines = true;
static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
{
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t frontf1, frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
// GZDoom method of sloped line clipping
if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope)
if (afrontsector->f_slope || afrontsector->c_slope
|| abacksector->f_slope || abacksector->c_slope)
{
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
@@ -2195,8 +2238,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
{
frontf1 = frontf2 = afrontsector->floorheight;
frontc1 = frontc2 = afrontsector->ceilingheight;
backf1 = backf2 = abacksector->floorheight;
backc1 = backc2 = abacksector->ceilingheight;
backf1 = backf2 = abacksector->floorheight;
backc1 = backc2 = abacksector->ceilingheight;
}
// using this check with portals causes weird culling issues on ante-station
@@ -2320,7 +2363,7 @@ static inline void DoAddLine(seg_t* line, angle_t angle1, angle_t angle2)
if constexpr (Type == AddLineType::kPortal)
{
if (gl_portal_state != GLPORTAL_SEARCH && !dontdraw)// no need to do this during the portal check
if (gl_portal_state != GLPORTAL_SEARCH && !dontdraw) // no need to do this during the portal check
HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D
}
else if constexpr (Type == AddLineType::kNormal)
@@ -2560,7 +2603,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
nrPlaneVerts = polysector->numVertices;
if (nrPlaneVerts < 3) //not even a triangle ?
if (nrPlaneVerts < 3) // not even a triangle ?
return;
if (nrPlaneVerts > INT16_MAX) // FIXME: exceeds plVerts size
@@ -2718,7 +2761,7 @@ static void HWR_AddPolyObjectPlanes(void)
// Polyobject Planes need their own function for drawing because they don't have extrasubsectors by themselves
// It should be okay because polyobjects should always be convex anyway
for (i = 0; i < numpolys; i++)
for (i = 0; i < numpolys; i++)
{
polyobjsector = po_ptrs[i]->lines[0]->backsector; // the in-level polyobject sector
@@ -4422,7 +4465,8 @@ static void HWR_DrawSprites(void)
HWR_DrawPrecipitationSprite(spr);
continue;
}
else if (spr->mobj)
if (spr->mobj)
{
if constexpr (Type == DrawSpritesType::kModels)
{
@@ -4475,7 +4519,7 @@ template <AddSpritesType Type>
static void HWR_AddSprites(sector_t *sec)
{
mobj_t *thing;
INT32 limit_dist;
INT32 limit_dist = 0;
// BSP is traversed by subsector.
// A sector might have been split into several
@@ -4538,14 +4582,14 @@ static void HWR_AddPrecipitationSprites(void)
return;
}
drawdist = ((fixed_t)(cv_drawdist_precip.value) * mapobjectscale);
// No to infinite precipitation draw distance.
if (cv_drawdist_precip.value == 0)
{
return;
}
drawdist = ((fixed_t)(cv_drawdist_precip.value) * mapobjectscale);
if (current_bsp_culling_distance)
drawdist = std::min((fixed_t)current_bsp_culling_distance, drawdist);
@@ -5067,42 +5111,46 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
static gl_sky_t gl_sky;
#define DEG2RADGL(a) ((a * M_PIl) / 180.0f)
static void HWR_SkyDomeVertex(gl_sky_t *sky, gl_skyvertex_t *vbo, int r, int c, signed char yflip, float delta, boolean foglayer)
{
static constexpr float radians = (float)(M_PIl / 180.0f);
static constexpr float scale = 10000.0f;
static constexpr float maxSideAngle = DEG2RADGL(60.0f);
static constexpr float maxSideAngle = 60.0f * radians;
float topAngle = DEG2RADGL(c / (float)sky->columns * 360.0f);
float topAngle = ((float)c / (float)sky->columns * 360.0f) * radians;
float sideAngle = (maxSideAngle * (float)(sky->rows - r) / (float)sky->rows);
float height = (float)(sin(sideAngle));
float realRadius = (scale * (float)cos(sideAngle));
float x = (realRadius * (float)cos(topAngle));
float height = sinf(sideAngle);
float realRadius = (scale * cosf(sideAngle));
float x = (realRadius * cosf(topAngle));
float y = (!yflip) ? scale * height : -scale * height;
float z = (realRadius * (float)sin(topAngle));
float timesRepeat = (4 * (256.0f / sky->width));
if (std::fpclassify(timesRepeat) == FP_ZERO)
timesRepeat = 1.0f;
float z = (realRadius * sinf(topAngle));
float timesRepeat;
if (!foglayer)
{
timesRepeat = (4.0f * (256.0f / (float)sky->width));
if (std::fpclassify(timesRepeat) == FP_ZERO)
timesRepeat = 1.0f;
vbo->r = 255;
vbo->g = 255;
vbo->b = 255;
vbo->a = (r == 0 ? 0 : 255);
// And the texture coordinates.
vbo->u = (-timesRepeat * c / (float)sky->columns);
if (!yflip) // Flipped Y is for the lower hemisphere.
vbo->v = (r / (float)sky->rows) + 0.5f;
vbo->u = (-timesRepeat * (float)c / (float)sky->columns);
if (!yflip) // Flipped Y is for the lower hemisphere.
vbo->v = ((float)r / (float)sky->rows) + 0.5f;
else
vbo->v = 1.0f + ((sky->rows - r) / (float)sky->rows) + 0.5f;
vbo->v = 1.0f + ((float)(sky->rows - r) / (float)sky->rows) + 0.5f;
}
if (r != 4)
{
y += 300.0f;
}
// And finally the vertex.
vbo->x = x;
@@ -5254,7 +5302,7 @@ static inline void HWR_ClearView(void)
viewwindowy,
(viewwindowx + viewwidth),
(viewwindowy + viewheight),
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
GL_ClearBuffer(false, true, true, NULL);
}
@@ -5536,14 +5584,16 @@ static void HWR_RenderFrame(player_t *player, boolean skybox)
current_bsp_culling_distance = 0;
if (!skybox && cv_glrenderdistance.value)
const INT32 renderdist = cv_glrenderdistance.value;
if (!skybox && renderdist)
{
GL_GClipRect(viewwindowx,
viewwindowy,
(viewwindowx + viewwidth),
(viewwindowy + viewheight),
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
ZCLIP_PLANE, clipping_distances[renderdist - 1]);
current_bsp_culling_distance = bsp_culling_distances[renderdist- 1];
}
portalclipline = NULL;
@@ -5936,31 +5986,33 @@ static void HWR_DoPostProcessor(player_t *player)
float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
UINT8 x, y;
INT32 WAVELENGTH;
INT32 AMPLITUDE;
INT32 FREQUENCY;
float WAVELENGTH;
float AMPLITUDE;
float FREQUENCY;
// Modifies the wave.
if (thiscam->postimg & POSTIMG_WATER)
{
WAVELENGTH = 5;
AMPLITUDE = 40;
FREQUENCY = 8;
WAVELENGTH = 5.0f;
AMPLITUDE = 40.0f;
FREQUENCY = 8.0f;
}
else
{
WAVELENGTH = 10;
AMPLITUDE = 60;
FREQUENCY = 4;
WAVELENGTH = 10.0f;
AMPLITUDE = 60.0f;
FREQUENCY = 4.0f;
}
//static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek
for (x = 0; x < SCREENVERTS; x++)
{
for (y = 0; y < SCREENVERTS; y++)
{
// Change X position based on its Y position.
v[x][y][0] = (x/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f + (float)sin((disStart+(y*WAVELENGTH))/FREQUENCY)/AMPLITUDE;
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
v[x][y][0] = x-4.5f + sinf(((disStart+((float)y * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
v[x][y][1] = y-4.5f; // (y / scale)
}
}
@@ -5986,20 +6038,27 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
}
if (wipenum > 99 || scrnnum > 99) // not a valid wipe number
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // just draw a black screen instead of flashing and crap
return; // shouldn't end up here really, the loop should've stopped running beforehand
}
// puts the numbers into the lumpname
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum);
lumpnum = W_CheckNumForName(lumpname);
if (lumpnum == LUMPERROR) // again, shouldn't be here really
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // just draw a black screen instead of flashing and crap
return;
}
lsize = W_LumpLength(lumpnum);
if (!(lsize == 256000 || lsize == 64000 || lsize == 16000 || lsize == 4000))
{
CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", lumpname);
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // just draw a black screen instead of flashing and crap
return; // again, shouldn't get here if it is a bad size
}
+26 -25
View File
@@ -25,7 +25,7 @@
// Eeeeh not sure is this right way, but it works < sry :c < sry again it had to go :c
#if defined (HWRENDER) && !defined (NOROPENGL)
#if defined (HWRENDER)
#include "../../r_fps.h" // For R_GetTimeFrac, used for the leveltime shader uniform
@@ -101,7 +101,7 @@ static LTListItem *LightTablesHead = NULL;
static RGBA_t screenPalette[256] = {0}; // the palette for the postprocessing step in palette rendering
static GLuint screenPaletteTex = 0; // 1D texture containing the screen palette
static GLuint paletteLookupTex = 0; // 3D texture containing RGB -> palette index lookup table
RGBA_t myPaletteData[256]; // the palette for converting textures to RGBA
RGBA_t myPaletteData[256] = {0}; // the palette for converting textures to RGBA
static GLint gltexformat = GL_RGB5_A1;
GLint screen_width = 0; // used by Draw2DLine()
@@ -128,7 +128,7 @@ int majorGL = 0, minorGL = 0;
//Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-)
static GLfloat modelMatrix[16];
GLfloat projMatrix[16];
GLfloat projMatrix[16] = {0};
static GLint viewport[4];
#ifdef USE_FBO_OGL
@@ -216,7 +216,7 @@ static const GLfloat byte2float[256] = {
// -----------------+
#ifdef DEBUG_TO_FILE
FILE *gllogstream;
FILE *gllogstream = NULL;
#endif
FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
@@ -1138,7 +1138,6 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect)
{ 0.0f, 0.0f, 0.0f, 0.0f},
};
const GLfloat focallength = (GLfloat)(1.0f / (GLfloat)tan(fovy * (GLfloat)M_PIl / 360.0f));
const GLfloat deltaZ = FAR_CLIPPING_PLANE - NEAR_CLIPPING_PLANE;
if ((fabsf((float)deltaZ) < 1.0E-36f) || fpclassify(aspect) == FP_ZERO)
@@ -1146,6 +1145,8 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect)
return;
}
const GLfloat focallength = (GLfloat)(1.0f / (GLfloat)tan(fovy * (GLfloat)M_PIl / 360.0f));
m[0][0] = focallength / aspect;
m[1][1] = focallength;
m[2][2] = -(FAR_CLIPPING_PLANE + NEAR_CLIPPING_PLANE) / deltaZ;
@@ -1498,14 +1499,14 @@ void GL_ReadScreenTexture(int tex, UINT8 *restrict dest, INT32 scale)
// -----------------+
void GL_SetPalette(RGBA_t *palette)
{
INT32 i;
const size_t palsize = (sizeof(RGBA_t) * 256);
for (i = 0; i < 256; i++)
// on a palette change, you have to reload all of the textures
if (memcmp(myPaletteData, palette, palsize))
{
myPaletteData[i].s = palette[i].s;
memcpy(myPaletteData, palette, palsize);
GL_Flush();
}
GL_Flush();
}
// -----------------+
@@ -1582,11 +1583,11 @@ void GL_Draw2DLine(F2DCoord * v1, F2DCoord * v2, RGBA_t Color)
// This is the preferred, 'modern' way of rendering lines -- creating a polygon.
if (fabsf(v2->x - v1->x) > FLT_EPSILON)
angle = (float)atan((v2->y-v1->y)/(v2->x-v1->x));
angle = atanf((v2->y-v1->y)/(v2->x-v1->x));
else
angle = (float)N_PI_DEMI;
dx = (float)sin(angle) / (float)screen_width;
dy = (float)cos(angle) / (float)screen_height;
dx = sinf(angle) / (float)screen_width;
dy = cosf(angle) / (float)screen_height;
p[0] = v1->x - dx; p[1] = -(v1->y + dy); p[2] = 1;
p[3] = v2->x - dx; p[4] = -(v2->y + dy); p[5] = 1;
@@ -2004,7 +2005,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
{
if (chromakeyed && (*pImgData == HWR_PATCHES_CHROMAKEY_COLORINDEX))
{
tex[idx].s = (byteColor_t){0, 0, 0, 0};
memset(&tex[idx].s, 0, sizeof(byteColor_t));
pTexInfo->flags |= TF_TRANSPARENT; // there is a hole in it
}
else
@@ -2016,10 +2017,9 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
if (texinfoformat != GL_TEXFMT_AP_88)
continue;
if (chromakeyed)
continue;
tex[idx].s.alpha = *pImgData;
if (!chromakeyed)
tex[idx].s.alpha = *pImgData;
pImgData++;
}
}
@@ -2054,9 +2054,9 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
{
for (i = 0; i < w; i++, idx++)
{
tex[idx].s.red = *pImgData;
tex[idx].s.green = *pImgData;
tex[idx].s.blue = *pImgData;
tex[idx].s.red =
tex[idx].s.green =
tex[idx].s.blue = *pImgData;
pImgData++;
tex[idx].s.alpha = *pImgData;
pImgData++;
@@ -3136,8 +3136,8 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
void GL_SetTransform(FTransform *stransform)
{
static boolean special_splitscreen;
GLdouble used_fov;
boolean shearing = false;
float used_fov;
pglLoadIdentity();
@@ -3187,7 +3187,8 @@ void GL_SetTransform(FTransform *stransform)
{
float dy = stransform->viewaiming * 2;
if (stransform->fliptype == TRANSFORM_FLIP || stransform->fliptype == TRANSFORM_MIRRORFLIP)
if (stransform->fliptype == TRANSFORM_FLIP
|| stransform->fliptype == TRANSFORM_MIRRORFLIP)
dy *= -1.0f;
pglTranslatef(0.0f, -dy/BASEVIDHEIGHT, 0.0f);
@@ -3195,11 +3196,11 @@ void GL_SetTransform(FTransform *stransform)
if (special_splitscreen)
{
used_fov = (float)(atan(tan(used_fov * M_PIl / 360) * 0.8) * 360 / M_PIl);
GL_Perspective((GLfloat)used_fov, 2*ASPECT_RATIO);
used_fov = (atanf(tanf(used_fov * (float)M_PI / 360.0f) * 0.8f) * 360.0f / (float)M_PI);
GL_Perspective(used_fov, 2*ASPECT_RATIO);
}
else
GL_Perspective((GLfloat)used_fov, ASPECT_RATIO);
GL_Perspective(used_fov, ASPECT_RATIO);
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
pglMatrixMode(GL_MODELVIEW);
+22 -22
View File
@@ -68,32 +68,32 @@
//-------------------------------------------
// heads up font
//-------------------------------------------
patch_t *hu_font[HU_FONTSIZE];
patch_t *kart_font[KART_FONTSIZE]; // SRB2kart
patch_t *tny_font[HU_FONTSIZE];
patch_t *tallnum[10]; // 0-9
patch_t *hu_font[HU_FONTSIZE] = {};
patch_t *kart_font[KART_FONTSIZE] = {}; // SRB2kart
patch_t *tny_font[HU_FONTSIZE] = {};
patch_t *tallnum[10] = {}; // 0-9
// Level title and credits fonts
patch_t *lt_font[LT_FONTSIZE];
patch_t *cred_font[CRED_FONTSIZE];
patch_t *lt_font[LT_FONTSIZE] = {};
patch_t *cred_font[CRED_FONTSIZE] = {};
// ping font
// Note: I'd like to adress that at this point we might *REALLY* want to work towards a common drawString function that can take any font we want because this is really turning into a MESS. :V -Lat'
patch_t *pingnum[10];
patch_t *pinggfx[5]; // small ping graphic
patch_t *pingmeasure[2]; // ping measurement graphic
patch_t *pingnum[10] = {};
patch_t *pinggfx[5] = {}; // small ping graphic
patch_t *pingmeasure[2] = {}; // ping measurement graphic
patch_t *ranknum[10]; // rank numbers
patch_t *ranknum[10] = {}; // rank numbers
patch_t *framecounter;
patch_t *frameslash; // framerate stuff. Used in screen.c
patch_t *framecounter = NULL;
patch_t *frameslash = NULL; // framerate stuff. Used in screen.c
static player_t *plr;
boolean chat_on; // entering a chat message?
static player_t *plr = NULL;
boolean chat_on = false; // entering a chat message?
static char w_chat_buf[HU_MAXMSGLEN + 1];
static textinput_t w_chat;
static boolean headsupactive = false;
boolean hu_showscores; // draw rankings
boolean hu_showscores = false; // draw rankings
static char hu_tick;
static tic_t hu_emoteanim = 0;
#define MAXEMOTESUGGESTIONS 8
@@ -101,14 +101,14 @@ static emote_t *emote_suggestions[MAXEMOTESUGGESTIONS] = {0};
static huddrawlist_h luahuddrawlist_scores;
patch_t *rflagico;
patch_t *bflagico;
patch_t *rmatcico;
patch_t *bmatcico;
patch_t *tallminus;
patch_t *rflagico = NULL;
patch_t *bflagico = NULL;
patch_t *rmatcico = NULL;
patch_t *bmatcico = NULL;
patch_t *tallminus = NULL;
// song credits
static patch_t *songcreditbg;
static patch_t *songcreditbg = NULL;
// -------
// protos.
@@ -122,7 +122,7 @@ consvar_t cv_showspecstuff = {"showspecstuff", "No", CV_SAVE, CV_YesNo, NULL, 0,
// KEYBOARD LAYOUTS FOR ENTERING TEXT
//======================================================================
char *shiftxform;
char *shiftxform = NULL;
char english_shiftxform[] =
{
-5
View File
@@ -41,11 +41,6 @@ typedef enum {
*/
extern UINT8 sound_started;
/** \brief info of samplerate
*/
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
extern consvar_t cv_samplerate;
#endif
/** \brief The I_GetSfx function
-4
View File
@@ -61,10 +61,6 @@ precise_t I_GetPreciseTime(void);
*/
UINT64 I_GetPrecisePrecision(void);
/** \brief Get the current time in rendering tics, including fractions.
*/
double I_GetFrameTime(void);
/** \brief Sleeps for the given duration in milliseconds. Depending on the
operating system's scheduler, the calling thread may give up its
time slice for a longer duration. The implementation should give a
+1 -2
View File
@@ -635,7 +635,7 @@ static boolean SOCK_Get(void)
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
(void *)&fromaddress, &fromlen);
if (c != ERRSOCKET)
if (c > 0)
{
#ifdef USE_STUN
if (STUN_got_response(doomcom->data, c))
@@ -649,7 +649,6 @@ static boolean SOCK_Get(void)
break;
}
#endif
// find remote node number
for (j = 1; j <= MAXNETNODES; j++) // include LAN
{
+4 -1
View File
@@ -63,7 +63,10 @@ void I_UpdateTime(fixed_t timescale)
ticratescaled = (double)((float)TICRATE * FixedToFloat(timescale));
enterprecise = I_GetPreciseTime();
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();
const precise_t elapsed = enterprecise - oldenterprecise;
const UINT64 precision = I_GetPrecisePrecision();
// explictily do this in double precision
elapsedseconds = (double)elapsed / (double)precision;
tictimer += elapsedseconds;
while (tictimer > 1.0/ticratescaled)
{
+2 -2
View File
@@ -6479,7 +6479,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
}
player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds
if (P_IsLocalPlayer(player) && cv_supermusic.value == 1 && cv_birdmusic.value)
if (cv_supermusic.value == 1 && P_IsLocalPlayer(player))
S_ChangeMusicSpecial("kinvnc");
P_RestoreMusic(player);
@@ -6683,7 +6683,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
player->mo->destscale = (6*player->mo->destscale)/8;
player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds
if (P_IsLocalPlayer(player) && cv_growmusic.value == 1 && cv_birdmusic.value )
if (cv_growmusic.value == 1 && P_IsLocalPlayer(player))
S_ChangeMusicSpecial("kgrow");
P_RestoreMusic(player);
S_StartSound(player->mo, sfx_kc5a);
+21 -7
View File
@@ -384,7 +384,9 @@ static int lib_pSpawnMobj(lua_State *L)
NOHUD
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
mobj_t *th = P_SpawnMobj(x, y, z, type);
th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -410,7 +412,9 @@ static int lib_pSpawnMissile(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ);
mobj_t *th = P_SpawnMissile(source, dest, type);
th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -427,7 +431,9 @@ static int lib_pSpawnXYZMissile(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ);
mobj_t *th = P_SpawnXYZMissile(source, dest, type, x, y, z);
th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -446,7 +452,9 @@ static int lib_pSpawnPointMissile(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ);
mobj_t *th = P_SpawnPointMissile(source, xa, ya, za, type, x, y, z);
th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -463,7 +471,9 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ);
mobj_t *th = P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle);
th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -492,7 +502,9 @@ static int lib_pSPMAngle(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ);
mobj_t *th = P_SPMAngle(source, type, angle, allowaim, flags2);
th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
@@ -506,7 +518,9 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ);
mobj_t *th = P_SpawnPlayerMissile(source, type, flags2);
th->islocal = !hook_important;
LUA_PushUserdata(L, th, META_MOBJ);
return 1;
}
+1
View File
@@ -109,6 +109,7 @@ ENUM (STRING_HOOK);
extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd.
extern int hook_defrosting;
extern bool hook_important;
void LUA_HookVoid(int hook);
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
+26 -4
View File
@@ -19,6 +19,7 @@
#include "b_bot.h"
#include "z_zone.h"
#include "m_perfstats.h"
#include "w_wad.h"
#include "lua_script.h"
#include "lua_libs.h"
@@ -39,14 +40,20 @@ LIST (stringHookNames, STRING_HOOK_LIST);
#undef LIST
typedef struct {
int id;
bool important;
} hookinfo_t;
typedef struct {
int numHooks;
int *ids;
hookinfo_t *ids;
} hook_t;
typedef struct {
int numGeneric;
int ref;
bool important;
} stringhook_t;
static hook_t hookIds[HOOK(MAX)];
@@ -56,6 +63,8 @@ static hook_t mobjHookIds[NUMMOBJTYPES][MOBJ_HOOK(MAX)];
// Lua tables are used to lookup string hook ids.
static stringhook_t stringHooks[STRING_HOOK(MAX)];
bool hook_important = true;
// This will be indexed by hook id, the value of which fetches the registry.
static int * hookRefs;
static int nextid;
@@ -109,7 +118,11 @@ static void get_table(lua_State *L)
FUNCINLINE static ATTRINLINE void add_hook_to_table(lua_State *L, int n)
{
lua_newtable(L);
lua_pushnumber(L, nextid);
lua_rawseti(L, -2, 1);
lua_pushboolean(L, wadfiles[numwadfiles-1]->important);
lua_rawseti(L, -2, 2);
lua_rawseti(L, -2, n);
}
@@ -180,7 +193,8 @@ FUNCINLINE static ATTRINLINE void add_hook(hook_t *map)
{
Z_Realloc(map->ids, (map->numHooks + 1) * sizeof *map->ids,
PU_STATIC, &map->ids);
map->ids[map->numHooks++] = nextid;
map->ids[map->numHooks].important = wadfiles[numwadfiles-1]->important;
map->ids[map->numHooks++].id = nextid;
}
FUNCINLINE static ATTRINLINE void add_mobj_hook(lua_State *L, int hook_type)
@@ -287,6 +301,7 @@ struct Hook_State {
const char * string;/* used to fetch table, ran first if set */
int top;/* index of last argument passed to hook */
int id;/* id to fetch ref */
boolean important;/* is this hook from local addon */
int values;/* num arguments passed to hook */
int results;/* num values returned by hook */
Hook_Callback results_handler;/* callback when hook successfully returns */
@@ -416,22 +431,29 @@ FUNCINLINE static ATTRINLINE void init_hook_call
hook->results_handler = results_handler;
}
FUNCINLINE static ATTRINLINE void get_hook(Hook_State *hook, const int *ids, int n)
FUNCINLINE static ATTRINLINE void get_hook(Hook_State *hook, const hookinfo_t *ids, int n)
{
hook->id = ids[n];
hook->id = ids[n].id;
hook->important = ids[n].important;
lua_getref(gL, hookRefs[hook->id]);
}
FUNCINLINE static ATTRINLINE void get_hook_from_table(Hook_State *hook, int n)
{
lua_rawgeti(gL, -1, n);
lua_rawgeti(gL, -1, 1);
hook->id = lua_tonumber(gL, -1);
lua_pop(gL, 1);
lua_rawgeti(gL, -2, 2);
hook->important = lua_toboolean(gL, -1);
lua_pop(gL, 2);
lua_getref(gL, hookRefs[hook->id]);
}
static int call_single_hook_no_copy(Hook_State *hook)
{
hook_important = hook->important;
if (lua_pcall(gL, hook->values, hook->results, EINDEX) == 0)
{
if (hook->results > 0)
+1 -1
View File
@@ -41,7 +41,7 @@ lua_State *gL = NULL;
// Mathlib global state
static lua_State *mL = NULL;
int hook_defrosting;
int hook_defrosting = 0;
// List of internal libraries to load from SRB2
static lua_CFunction liblist[] = {
+2 -2
View File
@@ -20,11 +20,11 @@
/** \brief number of arg
*/
INT32 myargc;
INT32 myargc = 0;
/** \brief string table
*/
char **myargv;
char **myargv = NULL;
/** \brief did we alloc myargv ourselves?
*/
+2 -2
View File
@@ -25,10 +25,10 @@
// Map triggers for linedef executors
// 32 triggers, one bit each
UINT32 unlocktriggers;
UINT32 unlocktriggers = 0;
// The meat of this system lies in condition sets
conditionset_t conditionSets[MAXCONDITIONSETS];
conditionset_t conditionSets[MAXCONDITIONSETS] = {};
// Default Emblem locations
emblem_t emblemlocations[MAXEMBLEMS] =
+4 -9
View File
@@ -145,19 +145,19 @@ I_mutex m_menu_mutex;
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
const char *quitmsg[NUM_QUITMESSAGES];
const char *quitmsg[NUM_QUITMESSAGES] = {};
// Stuff for customizing the player select screen Tails 09-22-2003
description_t description[MAXSKINS];
description_t description[MAXSKINS] = {};
INT32 mapwads[NUMMAPS];
INT32 mapwads[NUMMAPS] = {};
boolean browselocalskins = false;
boolean menuactive = false;
boolean fromlevelselect = false;
char menu_text_input_buf[MAXSTRINGLENGTH];
char menu_text_input_buf[MAXSTRINGLENGTH] = {};
static textinput_t menuinput;
static INT32 coolalphatimer = 9;
@@ -171,7 +171,6 @@ typedef enum
} levellist_mode_t;
levellist_mode_t levellistmode = LLM_CREATESERVER;
UINT8 maplistoption = 0;
static char joystickInfo[8][29];
@@ -181,10 +180,6 @@ static float serverlistslidex;
static INT32 serverlistsearched[MAXSERVERLIST] = {0};
static UINT32 serverlistsearchedcount = 0;
//static saveinfo_t savegameinfo[MAXSAVEGAMES]; // Extra info about the save games.
INT16 startmap; // Mario, NiGHTS, or just a plain old normal game?
static INT16 itemOn = 1; // menu item skull is on, Hack by Tails 09-18-2002
static INT16 skullAnimCounter = 10; // skull animation counter
static boolean interpTimerHackAllow = 0;
-3
View File
@@ -272,9 +272,6 @@ extern CV_PossibleValue_t gametype_cons_t[];
extern char dummystaffname[22];
extern INT16 startmap;
extern INT32 ultimate_selectable;
#define MAXSAVEGAMES 31 //note: last save game is "no save"
#define NOSAVESLOT MAXSAVEGAMES-1 //slot where Play Without Saving appears
+3 -19
View File
@@ -2026,11 +2026,10 @@ static menuitem_t OP_BirdMenu[] =
//{IT_STRING | IT_CVAR, NULL, "Encore Choices", &cv_encorevotes, 90},
{IT_HEADER, NULL, "Music", NULL, 70},
{IT_STRING | IT_CVAR, NULL, "Music Features", &cv_birdmusic, 80},
{IT_STRING | IT_CVAR, NULL, "Resume Level Music", &cv_resume, 95},
{IT_STRING | IT_CVAR, NULL, "Restart Special Music", &cv_resetspecialmusic, 105},
{IT_STRING | IT_CVAR, NULL, "Resume Level Music", &cv_resume, 80},
{IT_STRING | IT_CVAR, NULL, "Restart Special Music", &cv_resetspecialmusic, 95},
{IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 130},
{IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120},
};
static const char* OP_BirdTooltips[] =
@@ -2044,7 +2043,6 @@ static const char* OP_BirdTooltips[] =
//"Only show one battle choice in map vote",
//"Amount of encore choices in map vote.",
NULL,
"Global toggle for all bird music features.",
"Resume level music from last position after music change.",
"Restart Special music if item is used again.",
"Options for advanced music settings.",
@@ -2058,7 +2056,6 @@ enum
viewpointext,
freeplaytext,
headermusic,
birdmusic,
lvlresum,
spclresum,
advmusic,
@@ -2885,19 +2882,6 @@ void Bird_menu_Onchange(void)
OP_AdvancedBirdMenu[fadegrow].status = status;
OP_AdvancedBirdMenu[respawnfadeout].status = status;
OP_AdvancedBirdMenu[respawnfadein].status = status;
if (cv_birdmusic.value)
{
OP_BirdMenu[lvlresum].status = IT_STRING | IT_CVAR;
OP_BirdMenu[spclresum].status = IT_STRING | IT_CVAR;
OP_BirdMenu[advmusic].status = IT_STRING | IT_SUBMENU;
}
else
{
OP_BirdMenu[lvlresum].status = IT_GRAYEDOUT;
OP_BirdMenu[spclresum].status = IT_GRAYEDOUT;
OP_BirdMenu[advmusic].status = IT_GRAYEDOUT;
}
}
//menu code is nice
+10 -3
View File
@@ -89,10 +89,10 @@ consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAV
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
int ms_QueryId;
int ms_QueryId = 0;
I_mutex ms_QueryId_mutex;
msg_server_t *ms_ServerList;
msg_server_t *ms_ServerList = NULL;
I_mutex ms_ServerList_mutex;
#endif
@@ -608,10 +608,17 @@ Update_parameters (void)
}
#endif/*MASTERSERVER*/
}
#ifdef MASTERSERVER
void Update_MS(void)
{
Update_parameters();
}
#endif
#ifdef MASTERSERVER
static void MasterServer_OnChange(void)
{
UnregisterServer();
Set_api(cv_masterserver.string);
+2
View File
@@ -88,6 +88,8 @@ char *GetMODVersion(int id);
#endif
char *GetMasterServerRules(void);
void Update_MS(void);
#endif
void AddMServCommands(void);
-3
View File
@@ -24,9 +24,6 @@
// CEILINGS
// ==========================================================================
// the list of ceilings moving currently, including crushers
INT32 ceilmovesound = sfx_None;
/** Moves a moving ceiling.
*
* \param ceiling Thinker for the ceiling to be moved.
+2 -2
View File
@@ -869,7 +869,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->angle = special->angle;
for (UINT8 i = 0; i <= splitscreen; i++)
for (i = 0; i <= splitscreen; i++)
{
if (player == P_GetLocalPlayerForNum(i))
{
@@ -1605,7 +1605,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
target->player->playerstate = PST_DEAD;
if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player))
if (cv_fading.value && P_IsLocalPlayer(target->player))
{
if (netgame || multiplayer)
ms = cv_respawntime.value * 1000;
-2
View File
@@ -474,8 +474,6 @@ void P_DoNightsScore(player_t *player);
//
#include "p_spec.h"
extern INT32 ceilmovesound;
// Factor to scale scrolling effect into mobj-carrying properties = 3/32.
// (This is so scrolling floors and objects on them can move at same speed.)
#define CARRYFACTOR (FRACUNIT-ORIG_FRICTION)
+5 -10
View File
@@ -10758,7 +10758,7 @@ void P_SpawnPlayer(INT32 playernum)
{
if (!p->spectator)
{
for (UINT8 i = 0; i <= splitscreen; i++)
for (i = 0; i <= splitscreen; i++)
{
if (playernum == P_GetLocalPlayerNumForNum(i))
{
@@ -10776,17 +10776,12 @@ void P_AfterPlayerSpawn(INT32 playernum)
mobj_t *mobj = p->mo;
UINT8 i;
if (playernum == consoleplayer)
localangle[0] = mobj->angle;
else if (splitscreen)
for (i = 0; i <= splitscreen; i++)
{
for (i = 1; i <= splitscreen; i++)
if (playernum == P_GetLocalPlayerNumForNum(i))
{
if (playernum == displayplayers[i])
{
localangle[i] = mobj->angle;
break;
}
localangle[i] = mobj->angle;
break;
}
}
+5 -5
View File
@@ -90,14 +90,14 @@
//
// The Polyobjects
polyobj_t *PolyObjects;
INT32 numPolyObjects;
polyobj_t *PolyObjects = NULL;
INT32 numPolyObjects = 0;
// Polyobject Blockmap -- initialized in P_LoadBlockMap
polymaplink_t **polyblocklinks;
polymaplink_t **polyblocklinks = NULL;
static size_t *KnownPolySides;
static size_t KnownPolySidesCount;
static size_t *KnownPolySides = NULL;
static size_t KnownPolySidesCount = 0;
//
// Static Data
+2 -1
View File
@@ -2653,7 +2653,8 @@ static void P_SetupPlayer(void)
spbplace = -1;
startedInFreePlay = true;
for (UINT8 nump = 0, i = 0; i < MAXPLAYERS; i++)
UINT8 nump = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
{
+1 -2
View File
@@ -38,7 +38,6 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope)
fixed_t light = FRACUNIT;
fixed_t extralight = 0;
if (slope->normal.z == 0)
{
slope->lightOffset = 0;
@@ -296,7 +295,7 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line)
// Find furthest vertex from the reference line. It, along with the two ends
// of the line, will define the plane.
for(i = 0; i < sector->linecount; i++)
for (i = 0; i < sector->linecount; i++)
{
line_t *li = sector->lines[i];
vertex_t tempv;
-1
View File
@@ -4798,7 +4798,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
ffloor->master = master;
ffloor->norender = INFTICS;
// Scan the thinkers to check for special conditions applying to this FOF.
// If we have thinkers sorted by sector, just check the relevant ones;
// otherwise, check them all. Apologies for the ugly loop...
+2 -1
View File
@@ -700,6 +700,7 @@ void P_RestoreMusic(player_t *player)
if (P_EndingMusic(player))
return;
// Event - Level Start
if (leveltime < MUSICSTARTTIME)
S_StartMapMusic();
else // see also where time overs are handled - search for "lives = 2" in this file
@@ -5193,7 +5194,7 @@ void P_PlayerAfterThink(player_t *player)
player->mo->tracer->target->health += cmd->sidemove;
player->mo->angle += cmd->sidemove << ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
for (UINT8 i = 0; i <= splitscreen; i++)
for (i = 0; i <= splitscreen; i++)
{
if (player == P_GetLocalPlayerForNum(i))
{
+22
View File
@@ -442,6 +442,28 @@ fixed_t R_ScaleFromGlobalAngle(angle_t visangle)
return 64*FRACUNIT;
}
line_t *R_GetFFloorLine(const line_t *line, const ffloor_t *pfloor, const sector_t *sector)
{
if (pfloor->master->flags & ML_TFERLINE)
{
size_t linenum = std::min<size_t>((size_t)(line - sector->lines[0]), pfloor->master->frontsector->linecount);
return pfloor->master->frontsector->lines[0] + linenum;
}
else
return pfloor->master;
}
side_t *R_GetFFloorSide(const line_t *line, const ffloor_t *pfloor, const sector_t *sector)
{
if (pfloor->master->flags & ML_TFERLINE)
{
line_t *newline = R_GetFFloorLine(line, pfloor, sector);
return &sides[newline->sidenum[0]];
}
else
return &sides[pfloor->master->sidenum[0]];
}
//
// R_DoCulling
// Checks viewz and top/bottom heights of an item against culling planes
+3
View File
@@ -150,6 +150,9 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
#define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y)
#define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2))
line_t *R_GetFFloorLine(const line_t *line, const ffloor_t *pfloor, const sector_t *sector);
side_t *R_GetFFloorSide(const line_t *line, const ffloor_t *pfloor, const sector_t *sector);
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh);
+34 -43
View File
@@ -617,6 +617,11 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor)
return false;
}
static fixed_t R_GetSlopeTextureSlide(pslope_t *slope, angle_t lineangle)
{
return FixedMul(slope->zdelta, FINECOSINE((lineangle-slope->xydirection)>>ANGLETOFINESHIFT));
}
//
// R_RenderThickSideRange
// Renders all the thick sides in the given range.
@@ -633,16 +638,15 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
lightlist_t *light;
r_lightlist_t *rlight;
INT32 range;
line_t *newline = NULL;
// Render FOF sides kinda like normal sides, with the frac and step and everything
// NOTE: INT64 instead of fixed_t because overflow concerns
INT64 top_frac, top_step, bottom_frac, bottom_step;
// skew FOF walls with slopes?
boolean slopeskew = false;
fixed_t ffloortextureslide = 0;
INT32 oldx = -1;
fixed_t oldtexturecolumn = -1;
fixed_t left_top, left_bottom; // needed here for slope skewing
pslope_t *skewslope = NULL;
boolean do_texture_skew;
boolean dont_peg_bottom;
boolean fog = false;
boolean fuzzy = false;
@@ -650,7 +654,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
// Calculate light table.
// Use different light tables
// for horizontal / vertical / diagonal. Diagonal?
@@ -659,16 +662,23 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
curline = drawseg->curline;
backsector = pfloor->target;
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture);
sidedef = R_GetFFloorSide(curline->linedef, pfloor, pfloor->target);
R_SetColumnFunc(BASEDRAWFUNC);
if (pfloor->master->flags & ML_TFERLINE)
{
size_t linenum = std::min((size_t)(curline->linedef-backsector->lines[0]), pfloor->master->frontsector->linecount);
newline = pfloor->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
line_t *newline = R_GetFFloorLine(curline->linedef, pfloor, pfloor->target);
do_texture_skew = newline->flags & ML_DONTPEGTOP;
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
}
else
{
do_texture_skew = pfloor->master->flags & ML_DONTPEGTOP;
dont_peg_bottom = curline->linedef->flags & ML_DONTPEGBOTTOM;
}
texnum = R_GetTextureNum(sidedef->midtexture);
if (pfloor->flags & FF_TRANSLUCENT)
{
@@ -828,54 +838,35 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
mceilingclip = drawseg->sprtopclip;
dc->texheight = textureheight[texnum]>>FRACBITS;
// calculate both left endrawseg
// calculate both left ends
left_top = P_GetFFloorTopZAt (pfloor, drawseg->leftpos.x, drawseg->leftpos.y) - viewz;
left_bottom = P_GetFFloorBottomZAt(pfloor, drawseg->leftpos.x, drawseg->leftpos.y) - viewz;
skewslope = *pfloor->t_slope; // skew using top slope by default
if (newline)
if (do_texture_skew)
{
if (newline->flags & ML_DONTPEGTOP)
slopeskew = true;
}
else if (pfloor->master->flags & ML_DONTPEGTOP)
slopeskew = true;
if (slopeskew)
skewslope = *pfloor->t_slope; // skew using top slope by default
dc->texturemid = left_top;
}
else
dc->texturemid = *pfloor->topheight - viewz;
if (newline)
offsetvalue = sidedef->rowoffset;
if (dont_peg_bottom)
{
offsetvalue = sides[newline->sidenum[0]].rowoffset;
if (newline->flags & ML_DONTPEGBOTTOM)
if (do_texture_skew)
{
skewslope = *pfloor->b_slope; // skew using bottom slope
if (slopeskew)
dc->texturemid = left_bottom;
else
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
dc->texturemid = left_bottom;
}
}
else
{
offsetvalue = sides[pfloor->master->sidenum[0]].rowoffset;
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
{
skewslope = *pfloor->b_slope; // skew using bottom slope
if (slopeskew)
dc->texturemid = left_bottom;
else
else
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
}
}
if (slopeskew && skewslope)
if (skewslope)
{
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
ffloortextureslide = FixedMul(skewslope->zdelta, FINECOSINE((lineangle-skewslope->xydirection)>>ANGLETOFINESHIFT));
ffloortextureslide = R_GetSlopeTextureSlide(skewslope, lineangle);
}
dc->texturemid += offsetvalue;
@@ -921,9 +912,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
// skew FOF walls
if (ffloortextureslide)
{
if (oldx != -1)
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x]));
oldx = dc->x;
if (oldtexturecolumn != -1)
dc->texturemid += FixedMul(ffloortextureslide, (oldtexturecolumn-maskedtexturecol[dc->x]));
oldtexturecolumn = drawseg->thicksidecol[dc->x];
}
// Calculate bounds
+27 -28
View File
@@ -57,10 +57,6 @@ static void AmigaType_OnChange(void);
#endif
#endif
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
consvar_t cv_samplerate = {"samplerate", "44100", 0, CV_Unsigned, NULL, 22050, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
#endif
static CV_PossibleValue_t audbuffersize_cons_t[] = {{128, "128"}, {256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}};
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
@@ -114,7 +110,6 @@ consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_
consvar_t cv_resetspecialmusic = {"resetspecialmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_birdmusic = {"birdmusicstuff", "No", CV_SAVE|CV_CALL, CV_YesNo, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_keepmusic = {"keepmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skipintromusic = {"skipintromusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -215,26 +210,33 @@ static INT32 S_getChannel(const void *origin, sfxinfo_t *sfxinfo)
if (!channels[cnum].sfxinfo)
break;
const boolean samesoundplaying = channels[cnum].sfxinfo == sfxinfo;
// Now checks if same sound is being played, rather
// than just one sound per mobj
else if (sfxinfo == channels[cnum].sfxinfo && (sfxinfo->pitch & SF_NOMULTIPLESOUND))
if (samesoundplaying && (sfxinfo->pitch & SF_NOMULTIPLESOUND))
{
return -1;
}
else if (sfxinfo == channels[cnum].sfxinfo && sfxinfo->singularity == true)
if (samesoundplaying && sfxinfo->singularity == true)
{
S_StopChannel(cnum);
break;
}
else if (origin && channels[cnum].origin == origin && channels[cnum].sfxinfo == sfxinfo)
const boolean sameorigin = origin && channels[cnum].origin == origin;
if (sameorigin && samesoundplaying)
{
if (sfxinfo->pitch & SF_NOINTERRUPT)
return -1;
else
S_StopChannel(cnum);
S_StopChannel(cnum);
break;
}
else if (origin && channels[cnum].origin == origin
if (sameorigin
&& channels[cnum].sfxinfo->name != sfxinfo->name
&& (channels[cnum].sfxinfo->pitch & SF_TOTALLYSINGLE) && (sfxinfo->pitch & SF_TOTALLYSINGLE))
{
@@ -276,10 +278,7 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&stereoreverse);
CV_RegisterVar(&cv_cachesound);
#if defined(HAVE_SDL) && SOUND==SOUND_SDL
CV_RegisterVar(&cv_samplerate);
#endif
//CV_RegisterVar(&cv_resetmusic);
CV_RegisterVar(&cv_gamesounds);
CV_RegisterVar(&cv_gamedigimusic);
@@ -303,7 +302,6 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_resume);
CV_RegisterVar(&cv_fading);
CV_RegisterVar(&cv_birdmusic);
// bird music stuff end
CV_RegisterVar(&cv_keepmusic);
@@ -1276,8 +1274,7 @@ static musicdef_t *S_AddMusicCredit(void)
struct cursongcredit cursongcredit = {0}; // Currently displayed song credit info
static boolean
ReadMusicDefFields (UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
static boolean ReadMusicDefFields(UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
{
musicdef_t *def;
@@ -1488,7 +1485,7 @@ void S_InitMusicDefs(void)
//
musicdef_t *S_FindMusicCredit(const char *musname)
{
UINT32 hash = quickncasehash (musname, 6);
UINT32 hash = quickncasehash(musname, 6);
musicdef_t *def;
for (INT32 i = 0; i < nummusicdefs; ++i)
@@ -1647,7 +1644,8 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname)
{
if (S_MusicExists(mname, false, true)) // check non midis first
return W_GetNumForName(va("o_%s", mname));
else if (S_MusicExists(mname, true, false))
if (S_MusicExists(mname, true, false))
{
#ifdef NO_MIDI
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
@@ -1687,8 +1685,8 @@ static boolean S_LoadMusic(const char *mname)
music.data = mdata;
return true;
}
else
return false;
return false;
}
static void S_UnloadMusic(void)
@@ -1847,7 +1845,7 @@ void S_StopMusic(void)
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
return;
mapmusic.resume = (cv_birdmusic.value && fasticmp(music.name, mapmusic.name)) ? I_GetSongPosition() : 0;
mapmusic.resume = (cv_resume.value && fasticmp(music.name, mapmusic.name)) ? I_GetSongPosition() : 0;
S_SetKeepMusResume();
@@ -1899,7 +1897,7 @@ void S_SetMusicVolume(INT32 volume)
void S_SetRestoreMusicFadeInCvar(consvar_t *cv)
{
music_refade_cv = cv_birdmusic.value ? cv : 0;
music_refade_cv = cv;
}
int S_GetRestoreMusicFadeIn(void)
@@ -1928,8 +1926,8 @@ boolean S_FadeMusicFromVolume(UINT8 target_volume, INT16 source_volume, UINT32 m
{
if (source_volume < 0)
return I_FadeSong(target_volume, ms, NULL);
else
return I_FadeSongFromVolume(target_volume, source_volume, ms, NULL);
return I_FadeSongFromVolume(target_volume, source_volume, ms, NULL);
}
boolean S_FadeOutStopMusic(UINT32 ms)
@@ -2081,6 +2079,7 @@ void S_InitMapMusic(void)
{
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, keepmusic.resume, 0, 500);
}
return;
}
@@ -2094,7 +2093,7 @@ void S_InitMapMusic(void)
return;
if (leveltime < MUSICSTARTTIME) // SRB2Kart
S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic();
S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); // S_StopMusic();
}
void S_StartMapMusic(void)
@@ -2362,7 +2361,7 @@ static void AmigaType_OnChange(void)
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga_type", cv_amigatype.string);
if (sound_started)
S_RestartMusic(); //need to restart the music system or else it wont work
S_RestartMusic(); // need to restart the music system or else it wont work
}
#endif
#endif
-1
View File
@@ -68,7 +68,6 @@ extern consvar_t cv_resetspecialmusic;
extern consvar_t cv_resume;
extern consvar_t cv_fading;
extern consvar_t cv_birdmusic;
extern consvar_t cv_keepmusic;
extern consvar_t cv_skipintromusic;
+336
View File
@@ -0,0 +1,336 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief SDL interface for sound
#include <math.h>
#include "../doomdef.h"
#include "../i_sound.h"
#include "../s_sound.h"
/** \brief Sound subsystem runing and waiting
*/
UINT8 sound_started = false;
/** \brief The I_GetSfx function
*
* \param sfx sfx to setup
*
* \return data for sfx
*/
void *I_GetSfx(sfxinfo_t *sfx)
{
(void)sfx;
return NULL;
}
/** \brief The I_FreeSfx function
*
* \param sfx sfx to be freed up
*
* \return void
*/
void I_FreeSfx(sfxinfo_t *sfx)
{
(void)sfx;
}
/** \brief Init at program start...
*/
void I_StartupSound(void){}
/** \brief ... shut down and relase at program termination.
*/
void I_ShutdownSound(void){}
/// ------------------------
/// SFX I/O
/// ------------------------
/** \brief Starts a sound in a particular sound channel.
* \param id sfxid
* \param vol volume for sound
* \param sep left-right balancle
* \param pitch not used
* \param priority not used
*
* \return sfx handle
*/
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, INT32 channel)
{
(void)id;
(void)vol;
(void)sep;
(void)channel;
return 0;
}
/** \brief Stops a sound channel.
*
* \param handle stop sfx handle
*
* \return void
*/
void I_StopSound(INT32 handle)
{
(void)handle;
}
/** \brief Some digital sound drivers need this.
*/
void I_UpdateSound(void){}
/** \brief Called by S_*() functions to see if a channel is still playing.
*
* \param handle sfx handle
*
* \return 0 if no longer playing, 1 if playing.
*/
boolean I_SoundIsPlaying(INT32 handle)
{
(void)handle;
return false;
}
/** \brief Updates the sfx handle
*
* \param handle sfx handle
* \param vol volume
* \param sep separation
* \param pitch ptich
*
* \return void
*/
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep)
{
(void)handle;
(void)vol;
(void)sep;
}
/** \brief The I_SetSfxVolume function
*
* \param volume volume to set at
*
* \return void
*/
void I_SetSfxVolume(UINT8 volume)
{
(void)volume;
}
/// ------------------------
// MUSIC SYSTEM
/// ------------------------
/** \brief Init the music systems
*/
void I_InitMusic(void){}
/** \brief Shutdown the music systems
*/
void I_ShutdownMusic(void){}
/// ------------------------
// MUSIC PROPERTIES
/// ------------------------
musictype_t I_SongType(void)
{
return MU_NONE;
}
boolean I_SongPlaying(void)
{
return false;
}
boolean I_SongPaused(void)
{
return false;
}
/// ------------------------
// MUSIC EFFECTS
/// ------------------------
boolean I_SetSongSpeed(float speed)
{
(void)speed;
return false;
}
/// ------------------------
// MUSIC SEEKING
/// ------------------------
UINT32 I_GetSongLength(void)
{
return 0;
}
boolean I_SetSongLoopPoint(UINT32 looppoint)
{
(void)looppoint;
return false;
}
UINT32 I_GetSongLoopPoint(void)
{
return 0;
}
boolean I_SetSongPosition(UINT32 position)
{
(void)position;
return false;
}
UINT32 I_GetSongPosition(void)
{
return 0;
}
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
/** \brief Registers a song handle to song data.
*
* \param data pointer to song data
* \param len len of data
*
* \return song handle
*
* \todo Remove this
*/
boolean I_LoadSong(char *data, size_t len)
{
(void)data;
(void)len;
return false;
}
/** \brief See ::I_LoadSong, then think backwards
*
* \param handle song handle
*
* \sa I_LoadSong
* \todo remove midi handle
*/
void I_UnloadSong(void){}
/** \brief Called by anything that wishes to start music
*
* \param handle Song handle
* \param looping looping it if true
*
* \return if true, it's playing the song
*
* \todo pass music name, not handle
*/
boolean I_PlaySong(boolean looping)
{
(void)looping;
return false;
}
/** \brief Stops a song over 3 seconds
*
* \param handle Song handle
* \return void
*
* /todo drop handle
*/
void I_StopSong(void){}
/** \brief PAUSE game handling.
*
* \param handle song handle
*
* \return void
*/
void I_PauseSong(void){}
/** \brief RESUME game handling
*
* \param handle song handle
*
* \return void
*/
void I_ResumeSong(void){}
/** \brief The I_SetMusicVolume function
*
* \param volume volume to set at
*
* \return void
*/
void I_SetMusicVolume(UINT8 volume)
{
(void)volume;
}
boolean I_SetSongTrack(INT32 track)
{
(void)track;
return false;
}
/// ------------------------
/// MUSIC FADING
/// ------------------------
void I_SetInternalMusicVolume(UINT8 volume)
{
(void)volume;
}
void I_StopFadingSong(void){}
boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void))
{
(void)target_volume;
(void)source_volume;
(void)ms;
(void)callback;
return false;
}
boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
{
(void)target_volume;
(void)ms;
(void)callback;
return false;
}
boolean I_FadeOutStopSong(UINT32 ms)
{
(void)ms;
return false;
}
boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
{
(void)ms;
(void)looping;
return false;
}
void I_UpdateSongLagThreshold(void)
{
}
+1 -1
View File
@@ -53,7 +53,7 @@ extern int SDL_main(int argc, char *argv[]);
#ifdef LOGMESSAGES
FILE *logstream = NULL;
char logfilename[1024];
char logfilename[1024] = {};
#endif
#ifndef DOXYGEN
+21 -68
View File
@@ -227,7 +227,7 @@ typedef struct
char buffer[256];
} feild_t;
feild_t tty_con;
feild_t tty_con = {};
// lock to prevent clearing partial lines, since not everything
// printed ends on a newline.
@@ -1229,7 +1229,7 @@ static void I_SetupMumble(void)
void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
{
#ifdef HAVE_MUMBLE
double angle;
float angle;
fixed_t anglef;
if (!mumble)
@@ -1243,7 +1243,9 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
}
mumble->uiTick++;
if (!netgame || gamestate != GS_LEVEL) { // Zero out, but never delink.
// Zero out, but never delink.
if (!netgame || gamestate != GS_LEVEL)
{
mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
mumble->fAvatarFront[0] = 1.0f;
mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
@@ -1262,30 +1264,32 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
if (mobj)
{
mumble->fAvatarPosition[0] = FIXED_TO_FLOAT(mobj->x) / MUMBLEUNIT;
mumble->fAvatarPosition[1] = FIXED_TO_FLOAT(mobj->z) / MUMBLEUNIT;
mumble->fAvatarPosition[2] = FIXED_TO_FLOAT(mobj->y) / MUMBLEUNIT;
mumble->fAvatarPosition[0] = FixedToFloat(mobj->x) / MUMBLEUNIT;
mumble->fAvatarPosition[1] = FixedToFloat(mobj->z) / MUMBLEUNIT;
mumble->fAvatarPosition[2] = FixedToFloat(mobj->y) / MUMBLEUNIT;
anglef = AngleFixed(mobj->angle);
angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
mumble->fAvatarFront[0] = (float)cos(angle);
angle = (float)(FixedToFloat(anglef) * DEG2RAD);
mumble->fAvatarFront[0] = cosf(angle);
mumble->fAvatarFront[1] = 0.0f;
mumble->fAvatarFront[2] = (float)sin(angle);
} else {
mumble->fAvatarFront[2] = sinf(angle);
}
else
{
mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
mumble->fAvatarFront[0] = 1.0f;
mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
}
mumble->fCameraPosition[0] = FIXED_TO_FLOAT(listener.x) / MUMBLEUNIT;
mumble->fCameraPosition[1] = FIXED_TO_FLOAT(listener.z) / MUMBLEUNIT;
mumble->fCameraPosition[2] = FIXED_TO_FLOAT(listener.y) / MUMBLEUNIT;
mumble->fCameraPosition[0] = FixedToFloat(listener.x) / MUMBLEUNIT;
mumble->fCameraPosition[1] = FixedToFloat(listener.z) / MUMBLEUNIT;
mumble->fCameraPosition[2] = FixedToFloat(listener.y) / MUMBLEUNIT;
anglef = AngleFixed(listener.angle);
angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
mumble->fCameraFront[0] = (float)cos(angle);
angle = (float)(FixedToFloat(anglef) * DEG2RAD);
mumble->fCameraFront[0] = cosf(angle);
mumble->fCameraFront[1] = 0.0f;
mumble->fCameraFront[2] = (float)sin(angle);
mumble->fCameraFront[2] = sinf(angle);
#else
(void)mobj;
(void)listener;
@@ -1308,55 +1312,7 @@ precise_t I_GetPreciseTime(void)
UINT64 I_GetPrecisePrecision(void)
{
return SDL_GetPerformanceFrequency();
}
static UINT32 frame_rate;
static double frame_frequency;
static UINT64 frame_epoch;
static double elapsed_frames;
static void I_InitFrameTime(const UINT64 now, const UINT32 cap)
{
frame_rate = cap;
frame_epoch = now;
//elapsed_frames = 0.0;
if (frame_rate == 0)
{
// Shouldn't be used, but just in case...?
frame_frequency = 1.0;
return;
}
frame_frequency = timer_frequency / (double)frame_rate;
}
double I_GetFrameTime(void)
{
const UINT64 now = SDL_GetPerformanceCounter();
const UINT32 cap = R_GetFramerateCap();
if (cap != frame_rate)
{
// Maybe do this in a OnChange function for cv_fpscap?
I_InitFrameTime(now, cap);
}
if (frame_rate == 0)
{
// Always advance a frame.
elapsed_frames += 1.0;
}
else
{
elapsed_frames += (now - frame_epoch) / frame_frequency;
}
frame_epoch = now; // moving epoch
return elapsed_frames;
return timer_frequency;
}
//
@@ -1365,9 +1321,6 @@ double I_GetFrameTime(void)
void I_StartupTimer(void)
{
timer_frequency = SDL_GetPerformanceFrequency();
I_InitFrameTime(0, R_GetFramerateCap());
elapsed_frames = 0.0;
}
void I_Sleep(UINT32 ms)
+10 -8
View File
@@ -151,9 +151,9 @@ static UINT32 localPalette[256];
Uint16 realwidth = BASEVIDWIDTH;
Uint16 realheight = BASEVIDHEIGHT;
#define HalfWarpMouse(x,y) if (wrapmouseok) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2))
static SDL_bool exposevideo = SDL_FALSE;
static SDL_bool usesdl2soft = SDL_FALSE;
static SDL_bool borderlesswindow = SDL_FALSE;
static SDL_bool exposevideo = SDL_FALSE;
static SDL_bool usesdl2soft = SDL_FALSE;
static SDL_bool borderlesswindow = SDL_FALSE;
// SDL2 vars
SDL_Window *window = NULL;
@@ -1676,7 +1676,11 @@ static SDL_bool Impl_CreateContext(void)
I_Error("Failed to create a GL context: %s\n", SDL_GetError());
}
SDL_GL_MakeCurrent(window, sdlglcontext);
if (SDL_GL_MakeCurrent(window, sdlglcontext) < 0)
{
SDL_DestroyWindow(window);
I_Error("Failed to set up GL context: %s\n", SDL_GetError());
}
return SDL_TRUE;
}
@@ -1714,8 +1718,7 @@ static SDL_bool Impl_CreateContext(void)
if (renderer == NULL)
{
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
return SDL_FALSE;
I_Error("Couldn't create rendering context: %s\n", SDL_GetError());
}
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
@@ -1768,8 +1771,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
if (window == NULL)
{
CONS_Printf(M_GetText("Couldn't create window: %s\n"), SDL_GetError());
return SDL_FALSE;
I_Error("Couldn't create window: %s\n", SDL_GetError());
}
return Impl_CreateContext();
Whitespace-only changes.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+61 -89
View File
@@ -181,7 +181,8 @@ void I_StartupSound(void)
CONS_Debug(DBG_DETAILED, "SDL Audio already started\n");
return;
}
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError());
// call to start audio failed -- we do not have it
@@ -606,8 +607,8 @@ static UINT32 get_adjusted_position(UINT32 position)
UINT32 looppoint = I_GetSongLoopPoint();
return position >= length ? (position % (length-looppoint)) : position;
}
else
return position;
return position;
}
static void do_fading_callback(void)
@@ -624,7 +625,7 @@ static void Countstutter(int len)
{
UINT32 bytes;
if (!cv_birdmusic.value || gamestate != GS_LEVEL)
if (gamestate != GS_LEVEL)
return;
if (hu_stopped)
@@ -693,11 +694,13 @@ static UINT32 music_fade(UINT32 interval, void *param)
do_fading_callback();
return 0;
}
else if (songpaused) // don't decrement timer
if (songpaused) // don't decrement timer
{
return interval;
}
else if ((fading_timer -= 10) <= 0)
if ((fading_timer -= 10) <= 0)
{
internal_volume = fading_target;
Mix_VolumeMusic(get_real_volume(music_volume));
@@ -705,20 +708,18 @@ static UINT32 music_fade(UINT32 interval, void *param)
do_fading_callback();
return 0;
}
else
{
UINT8 delta = abs(fading_target - fading_source);
fixed_t factor = FixedDiv(fading_duration - fading_timer, fading_duration);
if (fading_target < fading_source)
internal_volume = max(min(internal_volume, fading_source - FixedMul(delta, factor)), fading_target);
else if (fading_target > fading_source)
internal_volume = min(max(internal_volume, fading_source + FixedMul(delta, factor)), fading_target);
UINT8 delta = abs(fading_target - fading_source);
fixed_t factor = FixedMul(delta, FixedDiv(fading_duration - fading_timer, fading_duration));
Mix_VolumeMusic(get_real_volume(music_volume));
if (fading_target < fading_source)
internal_volume = max(min(internal_volume, fading_source - factor), fading_target);
else if (fading_target > fading_source)
internal_volume = min(max(internal_volume, fading_source + factor), fading_target);
return interval;
}
Mix_VolumeMusic(get_real_volume(music_volume));
return interval;
}
#ifdef HAVE_LIBGME
@@ -792,7 +793,6 @@ musictype_t I_SongType(void)
#ifdef HAVE_LIBGME
if (gme)
return MU_GME;
else
#endif
#ifdef HAVE_OPENMPT
if (openmpt_mhandle)
@@ -822,10 +822,10 @@ boolean I_SongPlaying(void)
{
return (
#ifdef HAVE_LIBGME
(I_SongType() == MU_GME && gme) ||
(gme && I_SongType() == MU_GME) ||
#endif
#ifdef HAVE_OPENMPT
(I_SongType() == MU_MOD_EX && openmpt_mhandle) ||
(openmpt_mhandle && I_SongType() == MU_MOD_EX) ||
#endif
music != NULL
);
@@ -844,7 +844,6 @@ boolean I_SetSongSpeed(float speed)
{
if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME
if (gme)
{
@@ -853,7 +852,6 @@ boolean I_SetSongSpeed(float speed)
SDL_UnlockAudio();
return true;
}
else
#endif
#ifdef HAVE_OPENMPT
if (openmpt_mhandle)
@@ -917,30 +915,26 @@ UINT32 I_GetSongLength(void)
return max(length, 0);
}
else
#endif
#ifdef HAVE_OPENMPT
if (openmpt_mhandle)
{
return (UINT32)(openmpt_module_get_duration_seconds(openmpt_mhandle) * 1000.);
}
else
#endif
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
{
return 0;
}
else
{
// VERY IMPORTANT to set your LENGTHMS= in your song files, folks!
// SDL mixer can't read music length itself.
length = (UINT32)(song_length*1000);
if (!length)
CONS_Debug(DBG_DETAILED, "Getting music length: music is missing LENGTHMS= tag. Needed for seeking.\n");
// VERY IMPORTANT to set your LENGTHMS= in your song files, folks!
// SDL mixer can't read music length itself.
length = (UINT32)(song_length*1000);
return length;
}
if (!length)
CONS_Debug(DBG_DETAILED, "Getting music length: music is missing LENGTHMS= tag. Needed for seeking.\n");
return length;
}
boolean I_SetSongLoopPoint(UINT32 looppoint)
@@ -980,18 +974,16 @@ UINT32 I_GetSongLoopPoint(void)
looppoint = info->intro_length > 0 ? info->intro_length : 0;
gme_free_info(info);
return max(looppoint, 0);
}
else
#endif
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
{
return 0;
}
else
{
return (UINT32)(loop_point * 1000);
}
return (UINT32)(loop_point * 1000);
}
boolean I_SetSongPosition(UINT32 position)
@@ -1021,7 +1013,6 @@ boolean I_SetSongPosition(UINT32 position)
// else
// return true;
}
else
#endif
#ifdef HAVE_OPENMPT
if (openmpt_mhandle)
@@ -1031,40 +1022,38 @@ boolean I_SetSongPosition(UINT32 position)
openmpt_module_set_position_seconds(openmpt_mhandle, (double)(get_adjusted_position(position)/1000.0L)); // returns new position
return true;
}
else
#endif
if (!music || I_SongType() == MU_MID)
{
return false;
}
else if (I_SongType() == MU_MOD)
if (I_SongType() == MU_MOD)
{
return Mix_SetMusicPosition(position); // Goes by channels
}
// Because SDL mixer can't identify song length, if you have
// a position input greater than the real length, then
// music_bytes becomes inaccurate.
length = I_GetSongLength(); // get it in MS
if (length)
position = get_adjusted_position(position);
Mix_RewindMusic(); // needed for mp3
if (Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
music_bytes = (UINT32)(position/1000.0L*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition)
else
{
// Because SDL mixer can't identify song length, if you have
// a position input greater than the real length, then
// music_bytes becomes inaccurate.
// NOTE: This block fires on incorrect song format,
// NOT if position input is greater than song length.
music_bytes = 0;
length = I_GetSongLength(); // get it in MS
music_stutter_bytes = 0;
if (length)
position = get_adjusted_position(position);
Mix_RewindMusic(); // needed for mp3
if (Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
music_bytes = (UINT32)(position/1000.0L*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition)
else
// NOTE: This block fires on incorrect song format,
// NOT if position input is greater than song length.
music_bytes = 0;
music_stutter_bytes = 0;
return true;
}
return true;
}
UINT32 I_GetSongPosition(void)
@@ -1097,7 +1086,6 @@ UINT32 I_GetSongPosition(void)
return max(position, 0);
}
else
#endif
#ifdef HAVE_OPENMPT
if (openmpt_mhandle)
@@ -1105,19 +1093,16 @@ UINT32 I_GetSongPosition(void)
// So return unadjusted. See note in SetMusicPosition: we adjust for that.
return (UINT32)(openmpt_module_get_position_seconds(openmpt_mhandle)*1000.);
//return get_adjusted_position((UINT32)(openmpt_module_get_position_seconds(openmpt_mhandle)*1000.));
else
#endif
if (!music || I_SongType() == MU_MID)
{
return 0;
}
else
{
return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz
// 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel)
// This is hardcoded in I_StartupSound. Other formats for factor:
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
}
return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz
// 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel)
// This is hardcoded in I_StartupSound. Other formats for factor:
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
}
void I_UpdateSongLagThreshold(void)
@@ -1235,8 +1220,8 @@ boolean I_LoadSong(char *data, size_t len)
CONS_Alert(CONS_ERROR, "openmpt_module_create_from_memory2: %s\n", mod_err_str);
return false;
}
else
return true; // All good and we're ready for music playback!
return true; // All good and we're ready for music playback!
}
#endif
@@ -1331,31 +1316,20 @@ boolean I_PlaySong(boolean looping)
return true;
}
else
#endif
#ifdef HAVE_OPENMPT
if (openmpt_mhandle)
{
openmpt_module_select_subsong(openmpt_mhandle, 0);
openmpt_module_set_render_param(openmpt_mhandle, OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT, cv_stereosep.value); //have a feeling some might like it
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
openmpt_module_ctl_set_text(openmpt_mhandle, "dither", "1");
openmpt_module_ctl_set_boolean(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigafilter.value);
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga_type", cv_amigatype.string);
#else
openmpt_module_ctl_set(openmpt_mhandle, "dither", "1");
#endif
openmpt_module_set_render_param(openmpt_mhandle, OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT, cv_stereosep.value); //have a feeling some might like it
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
openmpt_module_ctl_set_boolean(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigafilter.value);
#else
openmpt_module_ctl_set(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigafilter.value ? "1" : "0");
#endif
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga_type", cv_amigatype.string);
#endif
openmpt_module_set_render_param(openmpt_mhandle, OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH, cv_modfilter.value);
if (looping)
openmpt_module_set_repeat_count(openmpt_mhandle, -1); // Always repeat
@@ -1363,7 +1337,6 @@ boolean I_PlaySong(boolean looping)
Mix_HookMusic(mix_openmpt, openmpt_mhandle);
return true;
}
else
#endif
if (!music)
return false;
@@ -1504,7 +1477,6 @@ boolean I_SetSongTrack(INT32 track)
return false;
}
else
#endif
#ifdef HAVE_OPENMPT
if (openmpt_mhandle)
-1405
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -972,7 +972,7 @@ sfxinfo_t S_sfx[NUMSFX] =
// initialized to NULL
};
char freeslotnames[sfx_freeslot0 + NUMSFXFREESLOTS + NUMSKINSFXSLOTS][7];
char freeslotnames[sfx_freeslot0 + NUMSFXFREESLOTS + NUMSKINSFXSLOTS][7] = {};
// Prepare free sfx slots to add sfx at run time
void S_InitRuntimeSounds (void)
+9 -9
View File
@@ -61,13 +61,13 @@ tic_t directortoggletimer = 0;
// STATUS BAR DATA
//
patch_t *facerankprefix[MAXSKINS]; // ranking
patch_t *facewantprefix[MAXSKINS]; // wanted
patch_t *facemmapprefix[MAXSKINS]; // minimap
patch_t *facerankprefix[MAXSKINS] = {}; // ranking
patch_t *facewantprefix[MAXSKINS] = {}; // wanted
patch_t *facemmapprefix[MAXSKINS] = {}; // minimap
patch_t *localfacerankprefix[MAXLOCALSKINS]; // ranking
patch_t *localfacewantprefix[MAXLOCALSKINS]; // wanted
patch_t *localfacemmapprefix[MAXLOCALSKINS]; // minimap
patch_t *localfacerankprefix[MAXLOCALSKINS] = {}; // ranking
patch_t *localfacewantprefix[MAXLOCALSKINS] = {}; // wanted
patch_t *localfacemmapprefix[MAXLOCALSKINS] = {}; // minimap
/*char *facerankprefix_name[MAXSKINS]; // ranking
char *facewantprefix_name[MAXSKINS]; // wanted
@@ -91,8 +91,8 @@ static patch_t *envelope;
#endif
// current player for overlay drawing
player_t *stplyr;
UINT8 stplyrnum;
player_t *stplyr = NULL;
UINT8 stplyrnum = 0;
// SRB2kart
@@ -342,7 +342,7 @@ void ST_changeDemoView(void)
// STATUS BAR OVERLAY
// =========================================================================
boolean st_overlay;
boolean st_overlay = true;
// =========================================================================
// INTERNAL DRAWING
-1
View File
@@ -141,7 +141,6 @@ static boolean InitCube(void)
#define diffcons(cv) (!fastcmp(cv.string, cv.defaultvalue))
#define diffconsbrightness(cv) (cv.value != 0)
#define diffconssat(cv) (cv.value != 10)
doingbrightness = diffcons(cv_globalbrightness);
+1 -1
View File
@@ -107,7 +107,7 @@ static const char pat_end[] = {0x50, 0x4b, 0x05, 0x06, 0x00};
// GLOBALS
//===========================================================================
UINT16 numwadfiles = 0; // number of active wadfiles
wadfile_t *wadfiles[MAX_WADFILES]; // 0 to numwadfiles-1 are valid
wadfile_t *wadfiles[MAX_WADFILES] = {}; // 0 to numwadfiles-1 are valid
// W_Shutdown
// Closes all of the WAD files before quitting
+12 -2
View File
@@ -552,8 +552,18 @@ void Y_Ticker(void)
intertic++;
if ((timer && !--timer)
|| (intertic == endtic))
// multiplayer uses timer (based on cv_inttime)
if (timer)
{
if (!--timer)
{
Y_EndIntermission();
Y_FollowIntermission();
return;
}
}
// single player is hardcoded to go away after awhile
else if (intertic == endtic)
{
Y_EndIntermission();
Y_FollowIntermission();