Compare commits

..
85 Commits
Author SHA1 Message Date
Gustaf Alhäll 89cecb88f5 Update license info 2025-12-06 19:45:35 +01:00
Gustaf Alhäll baf5c8d66b Fix music looping on digital 2025-12-06 19:45:32 +01:00
Gustaf Alhäll 72000c4546 Fix memory leak in AATree string trees 2025-12-06 19:45:29 +01:00
Gustaf Alhäll 82b774b2c3 Fix use-after-free when mobj is removed while still playing sounds 2025-12-06 19:45:27 +01:00
Gustaf Alhäll 3818b9ad1a Limit audio channels to 2 2025-12-05 00:22:09 +01:00
Alug ca8e811bd9 sdl_sound: attempt to fix sounds cutting off
i suck at explaining so just trust. :chonkbuncle:
Game sound handling has no idea which sound it is playing/checking, so a sound that ended frees its slot and it might get occupied again without the game knowing
so just encode the channel number into the sound so we can actually check
2025-12-04 17:52:38 +01:00
Alug 97ca034037 sdl_sound: handle explicit float conversions 2025-12-04 17:52:35 +01:00
Alug ac46f7ed00 add missing Fluidsynth ifdefs 2025-12-04 17:52:32 +01:00
Gustaf Alhäll 0afed59329 Fix MIDI music looping 2025-12-04 17:52:30 +01:00
Gustaf Alhäll ec3a1fee70 Tweak audio settings 2025-12-04 17:52:25 +01:00
Alug 5e8c0c3806 Add chorus and reverb settings to MIDI 2025-12-04 17:52:22 +01:00
Gustaf Alhäll 05ea898345 Fix Haiku build 2025-12-04 17:52:11 +01:00
Gustaf Alhäll 0c1fdc0be8 Fine-tune volume settings 2025-12-04 17:52:08 +01:00
Gustaf Alhäll 0e4c72e6f6 Implement MIDI seeking 2025-12-04 17:52:05 +01:00
Alug 29b83903ef delet the bird music resynching stuff
idk who even wants this, its pain, and even more pain to adapt
2025-12-04 17:52:03 +01:00
Alug 1cae09fa11 sdl_audio: use float M_PI for S_CURVE
meant for floats, prevents implicit double conversions
2025-12-04 17:51:59 +01:00
Alug 4a56819bc3 makefile: move openmpt stuff to before sdl stuff
seems to fix linking openmpt without mixer for some reason oh well
2025-12-01 16:49:11 +01:00
Alug 567a48aac3 sdl_sound: fix -Wmaybe-uninitialized warning 2025-12-01 16:49:08 +01:00
Alug d100401c5f this shouldnt be in sourcefile oops 2025-12-01 16:49:05 +01:00
Alug 6dee9fa561 add back "nearest" resampling from mixer
sdls own resampler uses linear interpolation, which sounds super muffled to me
some may like this, but i dont want to change how the game "sounds"
2025-12-01 16:49:01 +01:00
Alug 5bd7a09d9f force 44100khz sample rate
sounds better to me honestly
2025-12-01 16:48:56 +01:00
Alug 47477c2d03 make gme and tracker music slightly louder
prob needs some adjustment, but both were always quite quiet
2025-12-01 16:48:53 +01:00
Alug cd128a1084 lock audio stream in I_PlaySong
seems to fix weird crashes with gme
2025-12-01 16:48:49 +01:00
Alug 34f2afa3d9 add "audiobuffersize" handling
uses the SDL_AUDIO_DEVICE_SAMPLE_FRAMES hint
2025-12-01 16:48:46 +01:00
Alug 22f285edec disable sound precache for sdl sound 2025-12-01 16:48:43 +01:00
Alug 592abdef96 pitch is a float 2025-12-01 16:48:40 +01:00
Alug a27eee8e2f add few missing audiostream unlocks 2025-12-01 16:48:37 +01:00
Alug 904019d24b fix startup playing a super loud bit of music 2025-12-01 16:48:32 +01:00
Alug c6ca5a6f0f i_video: few type fixes for sdl3 2025-12-01 16:48:29 +01:00
Alug 2392f0484c remove hwr_shutdown call
honestly this didnt help with the issue i had, game should already release all the memory on quit anyways.
this just makes it take longer to quit
2025-12-01 16:48:26 +01:00
Alug 986a131a36 fix a few warnings 2025-12-01 16:48:23 +01:00
Alug e9685ef3e8 port srb2classics sdl audio system
still needs a little work reimplementing everything we got

from: https://codeberg.org/srb2classic/srb2classic/pulls/177
2025-12-01 16:48:18 +01:00
Alug 59f194cb9d fuckit SDL3 2025-12-01 16:48:15 +01:00
Alug 99d5590435 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-30 19:34:36 +01:00
Alug 9b2cfe51d6 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-28 18:24:07 +01:00
Alug 66619f42f9 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-28 18:07:35 +01:00
Alug 890677e2b5 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-27 23:33:28 +01:00
Alug 1105526eb1 fix perfstats freaking out 2025-11-26 10:10:14 +01:00
Alug d963df36f1 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-26 10:10:12 +01:00
Alug 846967cb91 fix compile with HAVE_DISCORDRPC 2025-11-25 20:21:15 +01:00
Alug 6c8862ee4b Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-25 20:16:18 +01:00
Alug a49ea4defd Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 22:43:26 +01:00
Alug 3c776b321d Optimize: move a few strlen calls out of loops
when applicable and the input does not get modified within the loop
needs some testing incase i oversaw something
2025-11-24 20:52:03 +01:00
Alug 1ed9bfc9b4 Merge branch 'vidmodestuff' into Saturn-Testing 2025-11-24 20:50:04 +01:00
Alug a05413d925 fix erronous "Could not set custom resolution" warning on startup
the cvars may have not been initialised yet to anything
just return -2 and ignore
2025-11-24 20:49:45 +01:00
Alug fa9637fba4 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 18:29:05 +01:00
Alug 7f50a09bcd Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 00:35:31 +01:00
Alug e25191d7df Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 00:30:49 +01:00
Alug f4d8a903e8 Merge branch 'vidmodestuff' into Saturn-Testing 2025-11-23 23:21:54 +01:00
Alug 8a8cbffd12 I_CheckDesktopRes: use SDL_GetCurrentDisplayMode
instead of SDL_GetDesktopDisplayMode, as the former only returns the display mode from when the window was created, which might not reflect the actual current desktop mode.
Maybe fixes some resolutions being incorrectly reported asa having visual issues
2025-11-23 23:21:47 +01:00
Alug 0adf356325 HACK: abuse batching system for sprites and drawnodes
use batching system without sorting for order sensitive things like sprites and transparent stuff
even despite not being "optimally" sorted, drawing them in one go, instead of directly still gives a nice speed increase in certain cases (on my ryzen 5600 i get around 120fps+ on teiai towers starting area!)
2025-11-23 23:08:09 +01:00
Alug 0fef290858 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-23 22:52:10 +01:00
Alug 2516873ba1 fix signed integer overflow in polygon hash calculation
also gives a speedup on some maps lul
2025-11-22 18:55:30 +01:00
Alug c650394c31 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-22 18:13:54 +01:00
Alug 1fb6c63097 fix dedi compile 2025-11-21 14:45:44 +01:00
Alug e95382075c Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-21 00:00:29 +01:00
Alug 2d9776d792 OpenGL: keep around our drawnodes memory
no need to constantly reallocate new memory
we dont have renderer switch, and the next level will render drawnodes anyways
those wont grow super big also, so theres no big worry about wasting tons of memory
yes i like ceepeepee vectors, how can you tell
2025-11-19 19:27:36 +01:00
Alug 7fa3d119e8 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-19 19:26:41 +01:00
Alug e65741acaa Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-18 16:33:38 +01:00
Alug b36ab31a56 Merge remote-tracking branch 'origin/vidmodestuff' into Saturn-Testing 2025-11-18 16:33:35 +01:00
Alug a335da3473 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-18 16:21:05 +01:00
Alug c312380944 check if our desired screen res already is in the videomode list
before deciding to rebuild the whole list when changing the resolution cvars
2025-11-18 05:22:50 +01:00
Alug b5bb2b42bf I_FillScreenResolutionsList: shrink list if it is too large
we check against MAXMODEDESCS, which is the maximum of modes the videomode can list
just in case we really get a display with a fuckton of resolutions, which most likely wont ever be the case though
this just removes the smallest modes from the list (accounting for the canonicals), to keep things simple
2025-11-18 04:55:50 +01:00
Alug d074f375ca M_VideoModeMenu: make sure red marked modes take precedence 2025-11-18 04:55:45 +01:00
Alug 6fd14f0a80 M_VideoModeMenu: remove old video mode dupe check 2025-11-18 04:55:41 +01:00
Alug d6bbb2c1b3 use static buffer for windowedModes names
no need to worry about memory management here :chaosleep:
2025-11-18 04:55:36 +01:00
Alug fa66b87965 cmp_resolutions: compare by numbers directly
instead by comparing it with strings
2025-11-18 04:55:30 +01:00
Alug c59d5db03e Merge remote-tracking branch 'origin/Saturn-Next' into vidmodestuff 2025-11-18 04:55:22 +01:00
Alug d2f3d5aa4d anew the testing branch
wiped it out completely
2025-11-17 20:26:49 +01:00
Alug 913b8878d8 Optimize: Use doomednum lookup also when (re)spawning mapthings
not just for loading savegame thinkers
Actually even provides slight runtime performance improvement, but mostly makes levelload faster
2025-11-17 20:26:07 +01:00
Alug f02b9f953e Merge branch 'vidmodestuff' into Saturn-Testing 2025-11-17 20:25:49 +01:00
Alug b6edc90553 mark resolutions listed above the current dektop resolution in red
as they lead to visual errors in openglmode without fbo support
2025-11-09 22:20:57 +01:00
Alug 23735121ff raise MAXWINMODES to 128
YES WINDOWS THANKS VERY MUCH SUPER COOL OF YOU
2025-11-09 20:40:03 +01:00
Alug 20950b698f make sure the default 320x200 mode exists 2025-11-09 20:39:58 +01:00
Alug 44df85d6a4 reduce the scope of this 2025-11-09 20:41:24 +01:00
Alug 42d53f1f6f Merge branch 'Saturn-Next' into vidmodestuff 2025-11-09 20:36:00 +01:00
Alug 48f2d0ff83 make sure our custom res fits within MAXVIDMODES
33 are alot so this probably will never be the case (i hope)
2025-11-09 20:21:30 +01:00
Alug 517723f9c1 handle custom res differently + make VID_NumModes return actual vidmodes
custom resolutions now will be put into the resolution list
which means they are selectable from the menu
2025-11-09 20:16:44 +01:00
Alug 6915077e0f refresh the video menu list if our resolution list changes
if you move the gamewindow to a different display, the video menu will now upadate to the new resolutions
2025-11-09 19:16:36 +01:00
Alug 406dbf333d use a video_mode_t thing for our custom resolution
perhaps we may merge it into windowedmodes? not sure
but this works for now
2025-11-09 19:13:38 +01:00
Alug a730dfd212 fix checking for if display changed 2025-11-09 19:13:35 +01:00
Alug 3058d365f3 no need to call I_FillScreenResolutionsList everywhere
its fine after startup, and when we move our window
2025-11-09 19:13:31 +01:00
Alug ccc453e0b0 fix windowmoved never resetting 2025-11-09 19:13:28 +01:00
Alug c3d02090e4 WIP: remove hardcoded resolutions
much thanks dsda-doom for most of the code for this
TODO:
- resolution menu needs to refresh if the list changes
- clean up
- handle custom resolutions more sane
- figure out the best maximum resolution list size the menu can display
2025-11-09 19:13:25 +01:00
Alug 20cd7621c3 delet numVidModes
wasnt doing anything
2025-11-09 19:13:22 +01:00
79 changed files with 3863 additions and 1759 deletions

No files matched your search

+1 -8
View File
@@ -13,12 +13,10 @@ Mainly for use in visual-only addons like secondcolor.
**Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account. **Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account.
## hud.setVoteBackground(name[, time\_per\_frame]) ## hud.setVoteBackground(name)
Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER). Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER).
If time\_per\_frame is set, each frame will last this amount of tics, default value is 2
## hud.add(fn, "vote") and hud.add(fn, "intermission") ## hud.add(fn, "vote") and hud.add(fn, "intermission")
Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument. Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument.
@@ -122,11 +120,6 @@ v.interpLatch(false)
``` ```
When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes. When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes.
## cameras[] global array
Local player cameras that can be accessed outside of hud hooks.
`#cameras` will return amount of available cameras. (0 on dedicated server, 1 with 1 player, 4 with 4p splitscreen, etc)
## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields ## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields
Same fields as in SRB2 2.2 Same fields as in SRB2 2.2
+10 -6
View File
@@ -972,6 +972,14 @@ Public License instead of this License. But first, please read
Copyright (C) 1995-2018 Free Software Foundation, Inc. Copyright (C) 1995-2018 Free Software Foundation, Inc.
https://www.gnu.org/software/gettext/ https://www.gnu.org/software/gettext/
- FluidSynth
Copyright (C) 2000-2025 Peter Hanappe and others.
https://www.fluidsynth.org/
- libsndfile
Copyright (C) 1999-2016 Erik de Castro Lopo
https://libsndfile.github.io/libsndfile/
- mpg123 - mpg123
Copyright (c) 1995-2013 by Michael Hipp and others, Copyright (c) 1995-2013 by Michael Hipp and others,
free software under the terms of the LGPL v2.1 free software under the terms of the LGPL v2.1
@@ -1699,12 +1707,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
zlib License zlib License
applies to: applies to:
- Simple DirectMedia Layer - Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
https://www.libsdl.org/hg.php https://libsdl.org/
- SDL_mixer: An audio mixer library based on the SDL library
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
https://www.libsdl.org/projects/SDL_mixer/
- zlib - zlib
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
+41
View File
@@ -0,0 +1,41 @@
# Find FluidSynth
# Once done, this will define
#
# FLUIDSYNTH_FOUND - system has FluidSynth
# FLUIDSYNTH_INCLUDE_DIRS - FluidSynth include directories
# FLUIDSYNTH_LIBRARIES - link libraries
include(LibFindMacros)
libfind_pkg_check_modules(FLUIDSYNTH_PKGCONF FLUIDSYNTH)
# includes
find_path(FLUIDSYNTH_INCLUDE_DIR
NAMES fluidsynth.h
PATHS
${FLUIDSYNTH_PKGCONF_INCLUDE_DIRS}
)
# library
find_library(FLUIDSYNTH_LIBRARY
NAMES fluidsynth
PATHS
${FLUIDSYNTH_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
# set include dir variables
set(FLUIDSYNTH_PROCESS_INCLUDES FLUIDSYNTH_INCLUDE_DIR)
set(FLUIDSYNTH_PROCESS_LIBS FLUIDSYNTH_LIBRARY)
libfind_process(FLUIDSYNTH)
if(FLUIDSYNTH_FOUND AND NOT TARGET FluidSynth::libfluidsynth)
add_library(FluidSynth::libfluidsynth UNKNOWN IMPORTED)
set_target_properties(
FluidSynth::libfluidsynth
PROPERTIES
IMPORTED_LOCATION "${FLUIDSYNTH_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FLUIDSYNTH_INCLUDE_DIR}"
)
endif()
-1
View File
@@ -1,4 +1,3 @@
/cscope.out /cscope.out
*.json *.json
*.idx *.idx
*.gdb_history
+1 -1
View File
@@ -8,6 +8,7 @@ passthru_opts+=\
HAVE_MINIUPNPC\ HAVE_MINIUPNPC\
HAVE_DISCORDRPC DEVELOP\ HAVE_DISCORDRPC DEVELOP\
NOHOLEPUNCH\ NOHOLEPUNCH\
NOOPENMPT\
# build with debugging information # build with debugging information
ifdef DEBUGMODE ifdef DEBUGMODE
@@ -91,7 +92,6 @@ endif
default_packages:=\ default_packages:=\
LIBGME/libgme/LIBGME\ LIBGME/libgme/LIBGME\
OPENMPT/libopenmpt/LIBOPENMPT\
ZLIB/zlib\ ZLIB/zlib\
$(foreach p,$(default_packages),\ $(foreach p,$(default_packages),\
+13 -9
View File
@@ -29,8 +29,19 @@ ifndef NOHW
sources+=sdl/ogl_sdl.c sources+=sdl/ogl_sdl.c
endif endif
ifndef NOOPENMPT
LIBOPENMPT_PKGCONFIG?=libopenmpt
$(eval $(call Use_pkg_config,LIBOPENMPT))
opts+=-DHAVE_OPENMPT
endif
NOMIXER=1
ifdef NOMIXER ifdef NOMIXER
sources+=sdl/dummy_sound.c #sources+=sdl/dummy_sound.c
sources+=sdl/sdl_sound.c
SNDFILE_PKGCONFIG?=sndfile
$(eval $(call Use_pkg_config,SNDFILE))
else else
opts+=-DHAVE_MIXER opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c sources+=sdl/mixer_sound.c
@@ -45,15 +56,8 @@ opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c sources+=sdl/i_threads.c
endif endif
ifdef SDL_PKGCONFIG SDL_PKGCONFIG?=sdl3
$(eval $(call Use_pkg_config,SDL)) $(eval $(call Use_pkg_config,SDL))
else
SDL_CONFIG?=$(call Prefix,sdl2-config)
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
$(if $(STATIC),--static-libs,--libs))
$(eval $(call Propogate_flags,SDL))
endif
ifdef MINGW ifdef MINGW
ifndef NOSDLMAIN ifndef NOSDLMAIN
+3 -3
View File
@@ -79,14 +79,14 @@ $(eval $(call _set,LIBOPENMPT))
lib:=../libs/SDL2_mixer/$(mingw) lib:=../libs/SDL2_mixer/$(mingw)
ifdef SDL ifdef SDL
mixer_opts:=-I$(lib)/include/SDL2 mixer_opts:=-I$(lib)/include/SDL3
mixer_libs:=-L$(lib)/lib mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw) lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL2\ SDL_opts:=-I$(lib)/include/SDL3\
$(mixer_opts) -Dmain=SDL_main $(mixer_opts) -Dmain=SDL_main
SDL_libs:=-L$(lib)/lib $(mixer_libs)\ SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL2main -lSDL2 -mwindows -lmingw32 -lSDL3main -lSDL3 -mwindows
$(eval $(call _set,SDL)) $(eval $(call _set,SDL))
endif endif
+1 -1
View File
@@ -1,4 +1,3 @@
string.c
am_map.c am_map.c
b_bot.c b_bot.c
command.c command.c
@@ -43,6 +42,7 @@ s_sound.c
screen.c screen.c
sounds.c sounds.c
st_stuff.c st_stuff.c
string.c
tables.c tables.c
v_video.c v_video.c
w_wad.c w_wad.c
+11 -11
View File
@@ -47,7 +47,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
{ {
cmd->forwardmove = sonic->player->cmd.forwardmove; cmd->forwardmove = sonic->player->cmd.forwardmove;
cmd->angleturn = abs((signed)(tails->angle - sonic->angle)) >> TICCMD_REDUCE; cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16;
if (sonic->angle < tails->angle) if (sonic->angle < tails->angle)
cmd->angleturn = -cmd->angleturn; cmd->angleturn = -cmd->angleturn;
} else if (dist > FixedMul(512*FRACUNIT, tails->scale)) } else if (dist > FixedMul(512*FRACUNIT, tails->scale))
@@ -139,13 +139,13 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
// Don't mess with bot inputs during these unhandled movement conditions. // Don't mess with bot inputs during these unhandled movement conditions.
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway. // The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
if (forward) if (forward)
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
if (backward) if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS >> TICCMD_REDUCE; cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
if (left || strafeleft) if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
if (right || straferight) if (right || straferight)
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
} else { } else {
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing" // In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
if (left || right) if (left || right)
@@ -163,23 +163,23 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
right = true; right = true;
} }
if (left || strafeleft) if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
if (right || straferight) if (right || straferight)
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
} }
} else { } else {
if (forward) if (forward)
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
if (backward) if (backward)
cmd->forwardmove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
if (left) if (left)
cmd->angleturn += 1280; cmd->angleturn += 1280;
if (right) if (right)
cmd->angleturn -= 1280; cmd->angleturn -= 1280;
if (strafeleft) if (strafeleft)
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
if (straferight) if (straferight)
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
} }
if (jump) if (jump)
cmd->buttons |= BT_DRIFT; cmd->buttons |= BT_DRIFT;
-51
View File
@@ -93,57 +93,6 @@ LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
/* }====================================================== */ /* }====================================================== */
/*
** {======================================================
** 'luaL_resourcetryagain'
** This function uses 'errno' to check whether the last error was
** related to lack of resources (e.g., not enough memory or too many
** open files). If so, the function performs a full garbage collection
** to try to release resources, and then it returns 1 to signal to
** the caller that it is worth trying again the failed operation.
** Otherwise, it returns 0. Because error codes are not ANSI C, the
** code must handle any combination of error codes that are defined.
** =======================================================
*/
LUALIB_API int luaL_resourcetryagain (lua_State *L) {
/* these are the resource-related errors in Linux */
#if defined(EMFILE) || defined(ENFILE) || defined(ENOMEM)
#if !defined(EMFILE) /* too many open files in the process */
#define EMFILE -1 /* if not defined, use an impossible value */
#endif
#if !defined(ENFILE) /* too many open files in the system */
#define ENFILE -1
#endif
#if !defined(ENOMEM) /* not enough memory */
#define ENOMEM -1
#endif
if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
CONS_Alert(CONS_WARNING, "%s, force calling lua garbage collector\n", strerror(errno));
lua_gc(L, LUA_GCCOLLECT, 0); /* try to release resources with a full GC */
return 1; /* signal to try again the creation */
}
#endif
return 0; /* else, asume errors are not due to lack of resources */
}
/* }====================================================== */
/*
** {======================================================
** Userdata's metatable manipulation
** =======================================================
*/
LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
const char *const lst[]) { const char *const lst[]) {
const char *name = (def) ? luaL_optstring(L, narg, def) : const char *name = (def) ? luaL_optstring(L, narg, def) :
-2
View File
@@ -95,8 +95,6 @@ LUALIB_API FUNCREPORT int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]); const char *const lst[]);
LUALIB_API int (luaL_resourcetryagain) (lua_State *L);
LUALIB_API int (luaL_ref) (lua_State *L, int t); LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
+15 -23
View File
@@ -58,6 +58,12 @@ static int pushresult (lua_State *L, int i, const char *filename) {
} }
static void fileerror (lua_State *L, int arg, const char *filename) {
lua_pushfstring(L, "%s: %s", filename, strerror(errno));
luaL_argerror(L, arg, lua_tostring(L, -1));
}
#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) #define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
@@ -159,24 +165,6 @@ static int StartsWith(const char *a, const char *b) // this is wolfs being lazy
return 0; return 0;
} }
/*
** Equivalent to 'fopen', but if it fails due to a lack of resources
** (see 'luaL_resourcetryagain'), do an "emergency" garbage collection to try
** to close some files and then tries to open the file again.
*/
static FILE *trytoopen (lua_State *L, const char *path, const char *mode) {
FILE *f = fopen(path, mode);
if (f == NULL && luaL_resourcetryagain(L)) /* resource failure? */
f = fopen(path, mode); /* try to open again */
return f;
}
static void opencheck (lua_State *L, const char *fname, const char *mode) {
FILE **p = newfile(L);
*p = trytoopen(L, fname, mode);
if (l_unlikely(*p == NULL))
luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno));
}
static int io_open(lua_State *L) static int io_open(lua_State *L)
{ {
@@ -224,7 +212,7 @@ static int io_open(lua_State *L)
} }
pf = newfile(L); pf = newfile(L);
*pf = trytoopen(L, destFilename, mode); *pf = fopen(destFilename, mode);
return (*pf == NULL) ? pushresult(L, 0, filename) : 1; return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
} }
@@ -232,8 +220,6 @@ static int io_open(lua_State *L)
static int io_tmpfile (lua_State *L) { static int io_tmpfile (lua_State *L) {
FILE **pf = newfile(L); FILE **pf = newfile(L);
*pf = tmpfile(); *pf = tmpfile();
if (*pf == NULL && luaL_resourcetryagain(L)) /* resource failure? */
*pf = tmpfile(); /* try to open again */
return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
} }
@@ -252,7 +238,10 @@ static int g_iofile (lua_State *L, int f, const char *mode) {
if (!lua_isnoneornil(L, 1)) { if (!lua_isnoneornil(L, 1)) {
const char *filename = lua_tostring(L, 1); const char *filename = lua_tostring(L, 1);
if (filename) { if (filename) {
opencheck(L, filename, mode); FILE **pf = newfile(L);
*pf = fopen(filename, mode);
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
} }
else { else {
tofile(L); /* check that it's a valid file handle */ tofile(L); /* check that it's a valid file handle */
@@ -301,7 +290,10 @@ static int io_lines (lua_State *L) {
} }
else { else {
const char *filename = luaL_checkstring(L, 1); const char *filename = luaL_checkstring(L, 1);
opencheck(L, filename, "r"); FILE **pf = newfile(L);
*pf = fopen(filename, "r");
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
aux_lines(L, lua_gettop(L), 1); aux_lines(L, lua_gettop(L), 1);
return 1; return 1;
} }
+5 -2
View File
@@ -237,10 +237,13 @@ void COM_ImmedExecute(const char *ptext)
char line[1024] = ""; char line[1024] = "";
INT32 quotes; INT32 quotes;
while (i < strlen(ptext)) const size_t txtlength = strlen(ptext);
while (i < txtlength)
{ {
quotes = 0; quotes = 0;
for (j = 0; i < strlen(ptext); i++,j++)
for (j = 0; i < txtlength; i++,j++)
{ {
if (ptext[i] == '\"' && !quotes && i > 0 && ptext[i-1] != ' ') // Malformed command if (ptext[i] == '\"' && !quotes && i > 0 && ptext[i-1] != ' ') // Malformed command
return; return;
+4 -12
View File
@@ -169,8 +169,6 @@ static CV_PossibleValue_t menuhighlight_cons_t[] =
}; };
consvar_t cons_menuhighlight = {"menuhighlight", "Gametype Default", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cons_menuhighlight = {"menuhighlight", "Gametype Default", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cons_consoleprintinmenu = {"consoleprintinmenu", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void CON_Print(char *msg); static void CON_Print(char *msg);
// //
@@ -428,7 +426,6 @@ void CON_Init(void)
CV_RegisterVar(&cons_backpic); CV_RegisterVar(&cons_backpic);
CV_RegisterVar(&cons_backcolor); CV_RegisterVar(&cons_backcolor);
CV_RegisterVar(&cons_menuhighlight); CV_RegisterVar(&cons_menuhighlight);
CV_RegisterVar(&cons_consoleprintinmenu);
COM_AddCommand("bind", CONS_Bind_f); COM_AddCommand("bind", CONS_Bind_f);
} }
else else
@@ -589,18 +586,12 @@ static void CON_ChangeHeight(void)
// Handles Console moves in/out of screen (per frame) // Handles Console moves in/out of screen (per frame)
// //
void CON_MoveConsole(void) static void CON_MoveConsole(void)
{ {
static fixed_t fracmovement = 0; static fixed_t fracmovement = 0;
Lock_state(); Lock_state();
if (con_curlines == con_destlines)
{
Unlock_state();
return;
}
// instant // instant
if (!cons_speed.value) if (!cons_speed.value)
{ {
@@ -1593,12 +1584,13 @@ void CON_Drawer(void)
} }
// console movement // console movement
CON_MoveConsole(); if (con_curlines != con_destlines)
CON_MoveConsole();
if (con_curlines > 0) if (con_curlines > 0)
CON_DrawConsole(); CON_DrawConsole();
else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS || (cons_consoleprintinmenu.value && gamestate == GS_TITLESCREEN)) || gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS)
CON_DrawHudlines(); CON_DrawHudlines();
Unlock_state(); Unlock_state();
-2
View File
@@ -36,7 +36,6 @@ extern INT32 con_destlines;
extern UINT32 con_scalefactor; // console text scale factor extern UINT32 con_scalefactor; // console text scale factor
extern consvar_t cons_backcolor, cons_menuhighlight; extern consvar_t cons_backcolor, cons_menuhighlight;
extern consvar_t cons_consoleprintinmenu;
extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\ extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\
*skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *brownmap, *peachmap; *skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *brownmap, *peachmap;
@@ -52,7 +51,6 @@ void CON_ClearHUD(void); // clear heads up messages
void CON_Ticker(void); void CON_Ticker(void);
void CON_Drawer(void); void CON_Drawer(void);
void CON_MoveConsole(void);
void CONS_Error(const char *msg); // print out error msg, and wait a key void CONS_Error(const char *msg); // print out error msg, and wait a key
// force console to move out // force console to move out
+55 -25
View File
@@ -1457,12 +1457,14 @@ static inline void CL_DrawConnectionStatus(void)
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, dldlength, 8, 160); V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, dldlength, 8, 160);
memset(tempname, 0, sizeof(tempname)); memset(tempname, 0, sizeof(tempname));
// offset filename to just the name only part // offset filename to just the name only part
filename += strlen(filename) - nameonlylength(filename); filename += strlen(filename) - nameonlylength(filename);
const size_t filenamelength = strlen(filename);
if (strlen(filename) > sizeof(tempname)-1) // too long to display fully if (filenamelength > sizeof(tempname)-1) // too long to display fully
{ {
size_t endhalfpos = strlen(filename)-10; size_t endhalfpos = filenamelength-10;
// display as first 14 chars + ... + last 10 chars // display as first 14 chars + ... + last 10 chars
// which should add up to 27 if our math(s) is correct // which should add up to 27 if our math(s) is correct
snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos); snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos);
@@ -2069,7 +2071,6 @@ static void CL_LoadReceivedSavegame(boolean reloading)
length = FIL_ReadFile(tmpsave, &save.buffer); length = FIL_ReadFile(tmpsave, &save.buffer);
CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length)); CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length));
if (!length) if (!length)
{ {
I_Error("Can't read savegame sent"); I_Error("Can't read savegame sent");
@@ -2153,7 +2154,7 @@ static void CL_ReloadReceivedSavegame(void)
// we dont have P_ForceLocalAngle so were setting it manually here // we dont have P_ForceLocalAngle so were setting it manually here
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= splitscreen; i++)
{ {
P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << TICCMD_REDUCE)); P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << 16));
} }
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
@@ -2192,8 +2193,12 @@ static void SendAskInfo(INT32 node)
HSendPacket(node, false, 0, sizeof (askinfo_pak)); HSendPacket(node, false, 0, sizeof (askinfo_pak));
} }
serverelem_t serverlist[MAXSERVERLIST] = {}; serverelem_t serverlist[MAXSERVERLIST];
UINT32 serverlistcount = 0; UINT32 serverlistcount = 0;
UINT32 serverlistultimatecount = 0;
static boolean resendserverlistnode[MAXNETNODES];
static tic_t serverlistepoch;
static void SL_ClearServerList(INT32 connectedserver) static void SL_ClearServerList(INT32 connectedserver)
{ {
@@ -2206,7 +2211,8 @@ static void SL_ClearServerList(INT32 connectedserver)
serverlist[i].node = 0; serverlist[i].node = 0;
} }
serverlistcount = 0; serverlistcount = 0;
//memset(serverlist, 0, sizeof(serverlist));
memset(resendserverlistnode, 0, sizeof resendserverlistnode);
} }
static UINT32 SL_SearchServer(INT32 node) static UINT32 SL_SearchServer(INT32 node)
@@ -2223,6 +2229,8 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
{ {
UINT32 i; UINT32 i;
resendserverlistnode[node] = false;
// search if not already on it // search if not already on it
i = SL_SearchServer(node); i = SL_SearchServer(node);
if (i == UINT32_MAX) if (i == UINT32_MAX)
@@ -2256,7 +2264,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
M_SortServerList(); M_SortServerList();
} }
void CL_UpdateServerList(void) void CL_UpdateServerList (void)
{ {
SL_ClearServerList(0); SL_ClearServerList(0);
@@ -2274,12 +2282,14 @@ void CL_UpdateServerList(void)
SendAskInfo(BROADCASTADDR); SendAskInfo(BROADCASTADDR);
} }
void CL_QueryServerList(msg_server_t *server_list) void CL_QueryServerList (msg_server_t *server_list)
{ {
INT32 i; INT32 i;
CL_UpdateServerList(); CL_UpdateServerList();
serverlistepoch = I_GetTime();
for (i = 0; server_list[i].header.buffer[0]; i++) for (i = 0; server_list[i].header.buffer[0]; i++)
{ {
// Make sure MS version matches our own, to // Make sure MS version matches our own, to
@@ -2292,20 +2302,42 @@ void CL_QueryServerList(msg_server_t *server_list)
if (node == -1) if (node == -1)
continue; // no more node free, or resolution failure continue; // no more node free, or resolution failure
SendAskInfo(node); SendAskInfo(node);
resendserverlistnode[node] = true;
// Leave this node open. It'll be closed if the
// request times out (CL_TimeoutServerList).
}
}
// Force close the connection so that servers can't eat serverlistultimatecount = i;
// up nodes forever if we never get a reply back from them }
// (usually when they've not forwarded their ports).
// #define SERVERLISTRESENDRATE NEWTICRATE
// Don't worry, we'll get in contact with the working
// servers again when they send SERVERINFO to us later! void CL_TimeoutServerList(void)
// {
// (Note: as a side effect this probably means every if (netgame && serverlistultimatecount > serverlistcount)
// server in the list will probably be using the same node (e.g. node 1), {
// not that it matters which nodes they use when const tic_t timediff = I_GetTime() - serverlistepoch;
// the connections are closed afterwards anyway) const tic_t timetoresend = timediff % SERVERLISTRESENDRATE;
// -- Monster Iestyn 12/11/18 const boolean timedout = timediff > connectiontimeout;
Net_CloseConnection(node|FORCECLOSE);
if (timedout || (timediff > 0 && timetoresend == 0))
{
INT32 node;
for (node = 1; node < MAXNETNODES; ++node)
{
if (resendserverlistnode[node])
{
if (timedout)
Net_CloseConnection(node|FORCECLOSE);
else
SendAskInfo(node);
}
}
if (timedout)
serverlistultimatecount = serverlistcount;
} }
} }
} }
@@ -4495,7 +4527,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
DEBFILE("spawning me\n"); DEBFILE("spawning me\n");
} }
P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << TICCMD_REDUCE)); P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << 16));
D_SendPlayerConfig(); D_SendPlayerConfig();
addedtogame = true; addedtogame = true;
@@ -6442,7 +6474,6 @@ static void SV_SendTics(void)
continue; continue;
DEBFILE(va("Sent %d anyway\n", realfirsttic)); DEBFILE(va("Sent %d anyway\n", realfirsttic));
} }
realfirsttic = max(realfirsttic, firstticstosend); realfirsttic = max(realfirsttic, firstticstosend);
// compute the length of the packet and cut it if too large // compute the length of the packet and cut it if too large
@@ -6588,8 +6619,7 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
// -- Monster Iestyn 16/01/18 // -- Monster Iestyn 16/01/18
break; break;
} }
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle>>16) | TICCMD_RECEIVED);
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle >> TICCMD_REDUCE) | TICCMD_RECEIVED);
if (!tic) // failsafe for gametic == 0 -- Monster Iestyn 16/01/18 if (!tic) // failsafe for gametic == 0 -- Monster Iestyn 16/01/18
break; break;
+2
View File
@@ -516,6 +516,7 @@ typedef struct
extern serverelem_t serverlist[MAXSERVERLIST]; extern serverelem_t serverlist[MAXSERVERLIST];
extern UINT32 serverlistcount; extern UINT32 serverlistcount;
extern UINT32 serverlistultimatecount;
extern INT32 mapchangepending; extern INT32 mapchangepending;
// Points inside doomcom // Points inside doomcom
@@ -626,6 +627,7 @@ void CL_ClearPlayer(INT32 playernum);
void CL_RemovePlayer(INT32 playernum, INT32 reason); void CL_RemovePlayer(INT32 playernum, INT32 reason);
void CL_QueryServerList(msg_server_t *list); void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(void); void CL_UpdateServerList(void);
void CL_TimeoutServerList(void);
void CL_AbortConnection(void); void CL_AbortConnection(void);
+5 -4
View File
@@ -792,9 +792,9 @@ void D_SRB2Loop(void)
} }
else if (!dedicated) else if (!dedicated)
{ {
// always update console movement // always update console and hud
// otherwise it will takes literal ages to open // otherwise it may take minutes to open it
CON_MoveConsole(); CON_Drawer();
} }
} }
@@ -885,6 +885,7 @@ void D_ClearState(void)
CURLAbortFile(); CURLAbortFile();
SV_StopServer(); SV_StopServer();
SV_ResetServer(); SV_ResetServer();
serverlistultimatecount = 0;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
CL_ClearPlayer(i); CL_ClearPlayer(i);
@@ -1263,7 +1264,7 @@ static void IdentifyVersion(void)
if (AddIWAD("extra3.kart", srb2waddir)) if (AddIWAD("extra3.kart", srb2waddir))
found_extra3_kart = true; found_extra3_kart = true;
#if !defined (HAVE_SDL) || defined (HAVE_MIXER) #if defined (HAVE_SDL)
#define MUSICTEST(str) \ #define MUSICTEST(str) \
musicpath = va(pandf, srb2waddir, str);\ musicpath = va(pandf, srb2waddir, str);\
handle = W_OpenWadFile(&musicpath, false); \ handle = W_OpenWadFile(&musicpath, false); \
+1 -7
View File
@@ -492,7 +492,6 @@ void Net_AckTicker(void)
ackpak[i].acknum = 0; ackpak[i].acknum = 0;
continue; continue;
} }
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime, DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
NODETIMEOUT, I_GetTime())); NODETIMEOUT, I_GetTime()));
memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length); memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
@@ -1225,7 +1224,7 @@ void D_SetDoomcom(void)
if (doomcom) if (doomcom)
return; return;
doomcom = Z_Calloc(sizeof(doomcom_t), PU_STATIC, NULL); doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
doomcom->id = DOOMCOM_ID; doomcom->id = DOOMCOM_ID;
doomcom->numslots = doomcom->numnodes = 1; doomcom->numslots = doomcom->numnodes = 1;
} }
@@ -1267,7 +1266,6 @@ boolean D_CheckNetGame(void)
ret = true; ret = true;
if (client && netgame) if (client && netgame)
netgame = false; netgame = false;
server = true; // WTF? server always true??? server = true; // WTF? server always true???
// no! The deault mode is server. Client is set elsewhere // no! The deault mode is server. Client is set elsewhere
// when the client executes connect command. // when the client executes connect command.
@@ -1303,7 +1301,6 @@ boolean D_CheckNetGame(void)
if (doomcom->id != DOOMCOM_ID) if (doomcom->id != DOOMCOM_ID)
I_Error("Doomcom buffer invalid!"); I_Error("Doomcom buffer invalid!");
if (doomcom->numnodes > MAXNETNODES) if (doomcom->numnodes > MAXNETNODES)
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES); I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
@@ -1312,17 +1309,14 @@ boolean D_CheckNetGame(void)
{ {
char filename[21]; char filename[21];
INT32 k = doomcom->consoleplayer - 1; INT32 k = doomcom->consoleplayer - 1;
if (M_IsNextParm()) if (M_IsNextParm())
k = atoi(M_GetNextParm()) - 1; k = atoi(M_GetNextParm()) - 1;
while (!debugfile && k < MAXPLAYERS) while (!debugfile && k < MAXPLAYERS)
{ {
k++; k++;
sprintf(filename, "debug%d.txt", k); sprintf(filename, "debug%d.txt", k);
debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w"); debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w");
} }
if (debugfile) if (debugfile)
CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename)); CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename));
else else
+3 -32
View File
@@ -144,7 +144,6 @@ static void Command_Addfile(void);
static void Command_Addskins(void); static void Command_Addskins(void);
static void Command_GLocalSkin(void); static void Command_GLocalSkin(void);
static void Command_ListWADS_f(void); static void Command_ListWADS_f(void);
static void Command_LocateLump_f(void);
static void Command_ListDoomednums_f(void); static void Command_ListDoomednums_f(void);
static void Command_ListUnusedSprites_f(void); static void Command_ListUnusedSprites_f(void);
static void Command_RunSOC(void); static void Command_RunSOC(void);
@@ -271,7 +270,7 @@ consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk
// haha I've beaten you now, ONLINE // haha I've beaten you now, ONLINE
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE|CV_CALL, CV_YesNo, ShowLocalskinMenu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -639,7 +638,6 @@ void D_RegisterServerCommands(void)
COM_AddCommand("addfile", Command_Addfile); COM_AddCommand("addfile", Command_Addfile);
COM_AddCommand("addskins", Command_Addskins); COM_AddCommand("addskins", Command_Addskins);
COM_AddCommand("listwad", Command_ListWADS_f); COM_AddCommand("listwad", Command_ListWADS_f);
COM_AddCommand("locatelump", Command_LocateLump_f);
COM_AddCommand("listmapthings", Command_ListDoomednums_f); COM_AddCommand("listmapthings", Command_ListDoomednums_f);
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f); COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
@@ -939,7 +937,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_chatbacktint); CV_RegisterVar(&cv_chatbacktint);
CV_RegisterVar(&cv_chatcentertext); CV_RegisterVar(&cv_chatcentertext);
CV_RegisterVar(&cv_songcredits); CV_RegisterVar(&cv_songcredits);
CV_RegisterVar(&cv_pausesongcredits);
CV_RegisterVar(&cv_showfreeplay); CV_RegisterVar(&cv_showfreeplay);
CV_RegisterVar(&cv_skinselectspin); CV_RegisterVar(&cv_skinselectspin);
CV_RegisterVar(&cv_showallmaps); CV_RegisterVar(&cv_showallmaps);
@@ -1006,7 +1003,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_usemouse); CV_RegisterVar(&cv_usemouse);
CV_RegisterVar(&cv_invertmouse); CV_RegisterVar(&cv_invertmouse);
CV_RegisterVar(&cv_mousexsens); CV_RegisterVar(&cv_mousesens);
CV_RegisterVar(&cv_mouseysens); CV_RegisterVar(&cv_mouseysens);
CV_RegisterVar(&cv_mousevisible); CV_RegisterVar(&cv_mousevisible);
@@ -2650,6 +2647,7 @@ static void Command_Map_f(void)
return; return;
} }
M_ClearMenus(true);
last_map_cmd = I_GetTime(); last_map_cmd = I_GetTime();
@@ -2832,8 +2830,6 @@ static void Command_Map_f(void)
fromlevelselect = false; fromlevelselect = false;
M_ClearMenus(true);
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false); D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
} }
@@ -4724,31 +4720,6 @@ static void Command_ListWADS_f(void)
} }
} }
static void Command_LocateLump_f(void)
{
if (COM_Argc() == 1)
{
CONS_Printf("Usage: locatelump <lump1>[ <lump2>[ ...]]\n");
return;
}
for (size_t i = 1; i < COM_Argc(); ++i)
{
const char *name = COM_Argv(i);
lumpnum_t num = W_CheckNumForName(name);
const char *wadname = "(not found)";
if (num != LUMPERROR)
{
wadname = wadfiles[WADFILENUM(num)]->filename;
}
CONS_Printf("%s - %s\n", name, wadname);
}
}
#define MAXDOOMEDNUM 4095 #define MAXDOOMEDNUM 4095
static void Command_ListDoomednums_f(void) static void Command_ListDoomednums_f(void)
+6 -5
View File
@@ -1079,12 +1079,14 @@ void CloseNetFile(void)
// Receiving a file? // Receiving a file?
for (i = 0; i < MAX_WADFILES; i++) for (i = 0; i < MAX_WADFILES; i++)
{
if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file) if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file)
{ {
fclose(fileneeded[i].file); fclose(fileneeded[i].file);
// File is not complete delete it // File is not complete delete it
remove(fileneeded[i].filename); remove(fileneeded[i].filename);
} }
}
// Remove PT_FILEFRAGMENT from acknowledge list // Remove PT_FILEFRAGMENT from acknowledge list
Net_AbortPacketType(PT_FILEFRAGMENT); Net_AbortPacketType(PT_FILEFRAGMENT);
@@ -1098,17 +1100,16 @@ void nameonly(char *s)
void *ns; void *ns;
for (j = strlen(s); j != (size_t)-1; j--) for (j = strlen(s); j != (size_t)-1; j--)
{
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/')) if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
{ {
ns = &(s[j+1]); ns = &(s[j+1]);
len = strlen(ns); len = strlen(ns);
#if 0 memmove(s, ns, len+1);
memcpy(s, ns, len+1);
#else
memmove(s, ns, len+1);
#endif
return; return;
} }
}
} }
// Returns the length in characters of the last element of a path. // Returns the length in characters of the last element of a path.
+3 -8
View File
@@ -46,20 +46,15 @@ typedef enum
// Mainly movements/button commands per game tick, // Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency. // plus a checksum for internal state consistency.
// ticcmd turning bits
#define TICCMD_REDUCE 16
// ticcmd latency mask
#define TICCMD_LATENCYMASK 0xFF
// bits in angleturn // bits in angleturn
#define TICCMD_RECEIVED (0x01) /* Actual tic recieved from client */ #define TICCMD_RECEIVED 1
#define TICCMD_XY 2
typedef struct typedef struct
{ {
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50) SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
SINT8 sidemove; // -MAXPLMOVE to MAXPLMOVE (50) SINT8 sidemove; // -MAXPLMOVE to MAXPLMOVE (50)
INT16 angleturn; // << TICCMD_REDUCE for angle delta - saved as 1 byte into demos INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
INT16 aiming; // vertical aiming, see G_BuildTicCmd INT16 aiming; // vertical aiming, see G_BuildTicCmd
UINT16 buttons; UINT16 buttons;
INT16 driftturn; // SRB2Kart: Used for getting drift turn speed INT16 driftturn; // SRB2Kart: Used for getting drift turn speed
+4
View File
@@ -115,6 +115,10 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h)
return -1; return -1;
} }
void VID_RefreshModeList(void)
{
}
void VID_PrepareModeList(void) void VID_PrepareModeList(void)
{ {
} }
+5 -4
View File
@@ -20,6 +20,7 @@
// but I can't stand that gibberish. D: // but I can't stand that gibberish. D:
#define SOUND_DUMMY 0 #define SOUND_DUMMY 0
#define SOUND_MIXER 1 #define SOUND_MIXER 1
#define SOUND_SDL 2
#ifndef SOUND #ifndef SOUND
#ifdef HAVE_SDL #ifdef HAVE_SDL
@@ -27,7 +28,7 @@
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
#define SOUND SOUND_MIXER #define SOUND SOUND_MIXER
#else #else
#define SOUND SOUND_DUMMY #define SOUND SOUND_SDL
#endif #endif
#else #else
#define SOUND SOUND_DUMMY #define SOUND SOUND_DUMMY
@@ -107,10 +108,10 @@ extern char logfilename[1024];
#else #else
#define VERSION 1 // Game version #define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number #define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9.2" #define VERSIONSTRING "Saturn v9.x - Testing"
#define VERSIONSTRINGW L"Saturn v9.2" #define VERSIONSTRINGW L"Saturn v9.x - Testing "
//#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! // Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users! // And change CMakeLists.txt (not src/, but in root), for CMake users!
+1 -1
View File
@@ -542,7 +542,7 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
#else #else
#define DEBUGFILE #define DEBUGFILE
#ifdef DEBUGFILE #ifdef DEBUGFILE
#define DEBFILE(msg) { if (UNLIKELY(debugfile)) { fputs(msg, debugfile); fflush(debugfile); } } #define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } }
#else #else
#define DEBFILE(msg) {} #define DEBFILE(msg) {}
#endif #endif
+1 -1
View File
@@ -644,7 +644,7 @@ void F_CreditDrawer(void)
sc = FRACUNIT; // quick hack so I don't have to add another field to credits_pics sc = FRACUNIT; // quick hack so I don't have to add another field to credits_pics
} }
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), colormap); V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH_LOWPRIORITY), colormap);
} }
// Dim the background // Dim the background
+63 -93
View File
@@ -246,12 +246,10 @@ void G_ReadDemoExtraData(void)
{ {
extradata = READUINT8(demobuf.p); extradata = READUINT8(demobuf.p);
player_t *player = &players[p];
if (extradata & DXD_RESPAWN) if (extradata & DXD_RESPAWN)
{ {
if (player->mo) if (players[p].mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..? P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
} }
if (extradata & DXD_SKIN) if (extradata & DXD_SKIN)
@@ -266,11 +264,11 @@ void G_ReadDemoExtraData(void)
kartspeed = READUINT8(demobuf.p); kartspeed = READUINT8(demobuf.p);
kartweight = READUINT8(demobuf.p); kartweight = READUINT8(demobuf.p);
if (!fasticmp(skins[player->skin].name, name)) if (!fasticmp(skins[players[p].skin].name, name))
FindClosestSkinForStats(p, kartspeed, kartweight); FindClosestSkinForStats(p, kartspeed, kartweight);
player->kartspeed = kartspeed; players[p].kartspeed = kartspeed;
player->kartweight = kartweight; players[p].kartweight = kartweight;
} }
if (extradata & DXD_COLOR) if (extradata & DXD_COLOR)
@@ -281,9 +279,9 @@ void G_ReadDemoExtraData(void)
for (i = 0; i < MAXSKINCOLORS; i++) for (i = 0; i < MAXSKINCOLORS; i++)
if (fasticmp(KartColor_Names[i], name)) // SRB2kart if (fasticmp(KartColor_Names[i], name)) // SRB2kart
{ {
player->skincolor = i; players[p].skincolor = i;
if (player->mo) if (players[p].mo)
player->mo->color = i; players[p].mo->color = i;
break; break;
} }
} }
@@ -302,17 +300,17 @@ void G_ReadDemoExtraData(void)
switch (extradata) switch (extradata)
{ {
case DXD_PST_PLAYING: case DXD_PST_PLAYING:
player->pflags |= PF_WANTSTOJOIN; // fuck you players[p].pflags |= PF_WANTSTOJOIN; // fuck you
break; break;
case DXD_PST_SPECTATING: case DXD_PST_SPECTATING:
player->pflags &= ~PF_WANTSTOJOIN; // double-fuck you players[p].pflags &= ~PF_WANTSTOJOIN; // double-fuck you
if (!playeringame[p]) if (!playeringame[p])
{ {
CL_ClearPlayer(p); CL_ClearPlayer(p);
playeringame[p] = true; playeringame[p] = true;
G_AddPlayer(p); G_AddPlayer(p);
player->spectator = true; players[p].spectator = true;
// There's likely an off-by-one error in timing recording or playback of joins. This hacks around it so I don't have to find out where that is. \o/ // There's likely an off-by-one error in timing recording or playback of joins. This hacks around it so I don't have to find out where that is. \o/
if (oldcmd[p].forwardmove) if (oldcmd[p].forwardmove)
@@ -320,11 +318,11 @@ void G_ReadDemoExtraData(void)
} }
else else
{ {
player->spectator = true; players[p].spectator = true;
if (player->mo) if (players[p].mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL); P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL);
else else
player->playerstate = PST_REBORN; players[p].playerstate = PST_REBORN;
} }
break; break;
case DXD_PST_LEFT: case DXD_PST_LEFT:
@@ -332,7 +330,7 @@ void G_ReadDemoExtraData(void)
break; break;
} }
G_ResetViews(false); // dont reset our freecam pls thx! G_ResetViews();
// maybe these are necessary? // maybe these are necessary?
if (G_BattleGametype()) if (G_BattleGametype())
@@ -1134,29 +1132,7 @@ void G_GhostTicker(void)
for (g = ghosts, p = NULL; g; g = g->next) for (g = ghosts, p = NULL; g; g = g->next)
{ {
// Skip normal demo data. // Skip normal demo data.
UINT8 ziptic; UINT8 ziptic = READUINT8(g->p);
if (g->done)
{
continue;
}
ziptic = READUINT8(g->p);
fadeghost:
// Demo ends after ghost data.
if (ziptic == DEMOMARKER)
{
g->mo->momx = g->mo->momy = g->mo->momz = 0;
g->done = true;
if (p)
{
p->next = g->next;
}
continue;
}
#ifdef DEMO_COMPAT_100 #ifdef DEMO_COMPAT_100
if (g->version != 0x0001) if (g->version != 0x0001)
@@ -1164,14 +1140,8 @@ fadeghost:
#endif #endif
while (ziptic != DW_END) // Get rid of extradata stuff while (ziptic != DW_END) // Get rid of extradata stuff
{ {
if (ziptic < MAXPLAYERS) if (ziptic == 0) // Only support player 0 info for now
{ {
#ifdef DEVELOP
UINT8 playerid = ziptic;
#endif
// We want to skip *any* player extradata because some demos have extradata for bogus players,
// but if there is tic data later for those players *then* we'll consider it invalid.
ziptic = READUINT8(g->p); ziptic = READUINT8(g->p);
if (ziptic & DXD_SKIN) if (ziptic & DXD_SKIN)
@@ -1183,26 +1153,13 @@ fadeghost:
if (ziptic & DXD_NAME) if (ziptic & DXD_NAME)
g->p += 16; // yea g->p += 16; // yea
if (ziptic & DXD_PLAYSTATE) if (ziptic & DXD_PLAYSTATE && READUINT8(g->p) != DXD_PST_PLAYING)
{ I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
UINT8 playstate = READUINT8(g->p);
if (playstate != DXD_PST_PLAYING)
{
#ifdef DEVELOP
CONS_Alert(CONS_WARNING, "Ghost demo has non-playing playstate for player %d\n", playerid + 1);
#endif
;
}
}
} }
else if (ziptic == DW_RNG) else if (ziptic == DW_RNG)
{
g->p += 4; // RNG seed g->p += 4; // RNG seed
}
else else
{ I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
I_Error("Ghost is not a record attack ghost DXD (ziptic = %u)", ziptic); //@TODO lmao don't blow up like this
}
ziptic = READUINT8(g->p); ziptic = READUINT8(g->p);
} }
@@ -1225,7 +1182,7 @@ fadeghost:
if (ziptic & ZT_DRIFT) if (ziptic & ZT_DRIFT)
g->p += 2; g->p += 2;
if (ziptic & ZT_LATENCY) if (ziptic & ZT_LATENCY)
g->p++; g->p += 1;
// Grab ghost data. // Grab ghost data.
ziptic = READUINT8(g->p); ziptic = READUINT8(g->p);
@@ -1234,12 +1191,10 @@ fadeghost:
if (g->version != 0x0001) if (g->version != 0x0001)
{ {
#endif #endif
if (ziptic == DEMOMARKER) // Had to end early for some reason
goto fadeghost;
if (ziptic == 0xFF) if (ziptic == 0xFF)
goto skippedghosttic; // Didn't write ghost info this frame goto skippedghosttic; // Didn't write ghost info this frame
if (ziptic != 0) else if (ziptic != 0)
I_Error("Ghost is not a record attack ghost ZIPTIC"); //@TODO lmao don't blow up like this I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
ziptic = READUINT8(g->p); ziptic = READUINT8(g->p);
#ifdef DEMO_COMPAT_100 #ifdef DEMO_COMPAT_100
} }
@@ -1410,7 +1365,7 @@ fadeghost:
{ {
#endif #endif
if (READUINT8(g->p) != 0xFF) // Make sure there isn't other ghost data here. if (READUINT8(g->p) != 0xFF) // Make sure there isn't other ghost data here.
I_Error("Ghost is not a record attack ghost GHOSTEND"); //@TODO lmao don't blow up like this I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
#ifdef DEMO_COMPAT_100 #ifdef DEMO_COMPAT_100
} }
#endif #endif
@@ -1430,6 +1385,20 @@ skippedghosttic:
break; break;
} }
// Demo ends after ghost data.
if (*g->p == DEMOMARKER)
{
g->mo->momx = g->mo->momy = g->mo->momz = 0;
if (p)
p->next = g->next;
else
ghosts = g->next;
Z_Free(g);
continue;
}
p = g; p = g;
} }
} }
@@ -1624,7 +1593,7 @@ void G_ConfirmRewind(tic_t rewindtime)
displayplayers[2] = olddp3; displayplayers[2] = olddp3;
displayplayers[3] = olddp4; displayplayers[3] = olddp4;
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();
G_ResetViews(true); G_ResetViews();
for (i = splitscreen; i >= 0; i--) for (i = splitscreen; i >= 0; i--)
P_ResetCamera(&players[displayplayers[i]], &camera[i]); P_ResetCamera(&players[displayplayers[i]], &camera[i]);
@@ -2612,7 +2581,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read file '%s'.\n"), defdemoname); snprintf(msg, 1024, M_GetText("Failed to read file '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing; gameaction = ga_nothing;
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
return; return;
} }
@@ -2624,7 +2593,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read lump '%s'.\n"), defdemoname); snprintf(msg, 1024, M_GetText("Failed to read lump '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing; gameaction = ga_nothing;
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
return; return;
} }
else // it's an internal demo else // it's an internal demo
@@ -2644,7 +2613,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2670,7 +2639,7 @@ void G_DoPlayDemo(char *defdemoname)
default: default:
snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2681,7 +2650,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2698,7 +2667,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2756,7 +2725,7 @@ void G_DoPlayDemo(char *defdemoname)
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out. if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out.
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
@@ -2794,16 +2763,6 @@ void G_DoPlayDemo(char *defdemoname)
#endif #endif
demobuf.p += 4; // Extrainfo location demobuf.p += 4; // Extrainfo location
// ...*map* not loaded?
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
{
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
#ifdef DEMO_COMPAT_100 #ifdef DEMO_COMPAT_100
if (demo.version == 0x0001) if (demo.version == 0x0001)
{ {
@@ -2831,7 +2790,17 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s features a character that is not currently loaded.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s features a character that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
// ...*map* not loaded?
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
{
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2854,7 +2823,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2892,7 +2861,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2941,7 +2910,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with spectators, and is thus invalid.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with spectators, and is thus invalid.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2953,7 +2922,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER); M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -3563,6 +3532,7 @@ void G_FreeGhosts(void)
ghosts = NULL; ghosts = NULL;
} }
boolean G_CheckDemoStatus(void) boolean G_CheckDemoStatus(void)
{ {
G_FreeGhosts(); G_FreeGhosts();
-1
View File
@@ -149,7 +149,6 @@ typedef struct demoghost {
UINT8 checksum[16]; UINT8 checksum[16];
UINT8 *buffer, *p, color; UINT8 *buffer, *p, color;
UINT16 version; UINT16 version;
boolean done;
mobj_t oldmo, *mo; mobj_t oldmo, *mo;
struct demoghost *next; struct demoghost *next;
} demoghost; } demoghost;
+14 -16
View File
@@ -312,8 +312,6 @@ consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, N
static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}}; static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}};
consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pausesongcredits = {"pausesongcredits", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// Show "FREE PLAY" when you're alone. :( // Show "FREE PLAY" when you're alone. :(
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -664,7 +662,7 @@ INT16 G_ClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle) else if (*aiming < -limitangle)
*aiming = -limitangle; *aiming = -limitangle;
return (INT16)((*aiming) >> TICCMD_REDUCE); return (INT16)((*aiming)>>16);
} }
INT16 G_SoftwareClipAimingPitch(INT32 *aiming) INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
@@ -677,7 +675,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle) else if (*aiming < -limitangle)
*aiming = -limitangle; *aiming = -limitangle;
return (INT16)((*aiming) >> TICCMD_REDUCE); return (INT16)((*aiming)>>16);
} }
INT32 JoyAxis(axis_input_e axissel, UINT8 player) INT32 JoyAxis(axis_input_e axissel, UINT8 player)
@@ -961,7 +959,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// Kart, don't build a ticcmd if someone is resynching or the server is stopped too so we don't fly off course in bad conditions // Kart, don't build a ticcmd if someone is resynching or the server is stopped too so we don't fly off course in bad conditions
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN) || hu_resynching) if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN) || hu_resynching)
{ {
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE); cmd->angleturn = (INT16)(lang >> 16);
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
return; return;
} }
@@ -969,7 +967,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// dumbass thing so we can use a few buttons but dont accidentally drive away // dumbass thing so we can use a few buttons but dont accidentally drive away
if (player->spectator || freecam) if (player->spectator || freecam)
{ {
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE); cmd->angleturn = (INT16)(lang >> 16);
G_BuildLocalTiccmd(cmd, ssplayer, freecam); G_BuildLocalTiccmd(cmd, ssplayer, freecam);
// let lua override everything // let lua override everything
@@ -1129,7 +1127,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
mousex = mousey = 0; mousex = mousey = mlooky = 0;
if (forward > MAXPLMOVE) if (forward > MAXPLMOVE)
forward = MAXPLMOVE; forward = MAXPLMOVE;
@@ -1168,10 +1166,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn || (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|| (player->kartstuff[k_respawn]) // Respawning || (player->kartstuff[k_respawn]) // Respawning
|| (player->spectator || objectplacing))) // Not a physical player || (player->spectator || objectplacing))) // Not a physical player
lang += (cmd->angleturn << TICCMD_REDUCE); lang += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE); cmd->angleturn = (INT16)(lang >> 16);
cmd->latency = modeattacking ? 0 : (leveltime & TICCMD_LATENCYMASK); // Send leveltime when this tic was generated to the server for control lag calculations cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
if (!hu_stopped) if (!hu_stopped)
{ {
@@ -1752,15 +1750,14 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
// Increment a viewpoint by offset from the current player. A negative value // Increment a viewpoint by offset from the current player. A negative value
// decrements. // decrements.
// //
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam) void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
{ {
INT32 *displayplayerp, oldview; INT32 *displayplayerp, oldview;
displayplayerp = &displayplayers[viewnum-1]; displayplayerp = &displayplayers[viewnum-1];
oldview = (*displayplayerp); oldview = (*displayplayerp);
// turn off the freecam // turn off the freecam
if (resetfreecam) camera[viewnum-1].freecam = false;
camera[viewnum-1].freecam = false;
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive); G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
@@ -1774,7 +1771,7 @@ void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean res
// Ensures all viewpoints are valid // Ensures all viewpoints are valid
// Also demotes splitscreen down to one player. // Also demotes splitscreen down to one player.
// //
void G_ResetViews(boolean resetfreecam) void G_ResetViews(void)
{ {
UINT8 splits; UINT8 splits;
UINT8 viewd; UINT8 viewd;
@@ -1798,7 +1795,7 @@ void G_ResetViews(boolean resetfreecam)
*/ */
for (viewd = 1; viewd <= splits; ++viewd) for (viewd = 1; viewd <= splits; ++viewd)
{ {
G_AdjustViewEx(viewd, 0, false, resetfreecam); G_AdjustView(viewd, 0, false);
} }
} }
@@ -1879,7 +1876,7 @@ void G_Ticker(boolean run)
G_CopyTiccmd(cmd, &netcmds[buf][i], 1); G_CopyTiccmd(cmd, &netcmds[buf][i], 1);
// Use the leveltime sent in the player's ticcmd to determine control lag // Use the leveltime sent in the player's ticcmd to determine control lag
cmd->latency = modeattacking ? 0 : min(((leveltime & TICCMD_LATENCYMASK) - cmd->latency) & TICCMD_LATENCYMASK, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max cmd->latency = modeattacking ? 0 : min(((leveltime & 0xFF) - cmd->latency) & 0xFF, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
} }
} }
@@ -1887,6 +1884,7 @@ void G_Ticker(boolean run)
switch (gamestate) switch (gamestate)
{ {
case GS_LEVEL: case GS_LEVEL:
for (; ra_timeskip < starttime - TICRATE*4; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now. for (; ra_timeskip < starttime - TICRATE*4; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now.
{ {
if (demo.title) if (demo.title)
+3 -4
View File
@@ -50,7 +50,7 @@ extern INT16 rw_maximums[NUM_WEAPONS];
// used in game menu // used in game menu
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/; extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/;
extern consvar_t cv_songcredits, cv_pausesongcredits; extern consvar_t cv_songcredits;
extern consvar_t cv_showfreeplay; extern consvar_t cv_showfreeplay;
extern consvar_t cv_growmusic, cv_supermusic; extern consvar_t cv_growmusic, cv_supermusic;
extern consvar_t cv_pauseifunfocused; extern consvar_t cv_pauseifunfocused;
@@ -262,10 +262,9 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive);
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse); INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse);
INT32 G_CountPlayersPotentiallyViewable(boolean active); INT32 G_CountPlayersPotentiallyViewable(boolean active);
void G_ResetViews(boolean resetfreecam); void G_ResetViews(void);
void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive); void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam); void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
#define G_AdjustView(v,o,oa) G_AdjustViewEx(v,o,oa, true)
void G_AddPlayer(INT32 playernum); void G_AddPlayer(INT32 playernum);
+11 -15
View File
@@ -34,7 +34,7 @@ static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"
static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "Off"}, {0, NULL}}; static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "Off"}, {0, NULL}};
// mouse values are used once // mouse values are used once
consvar_t cv_mousexsens = {"mousexsens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -125,17 +125,17 @@ static void led_off_handle4(void)
G_ResetPlayerGamepadIndicatorColor(3); G_ResetPlayerGamepadIndicatorColor(3);
} }
INT32 mousex = 0, mousey = 0; INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
// joystick values are repeated // joystick values are repeated
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {}; INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
INT32 joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {};
// current state of the keys: true if pushed // current state of the keys: true if pushed
UINT8 gamekeydown[NUMINPUTS] = {}; UINT8 gamekeydown[NUMINPUTS];
// two key codes (or virtual key) per game control // two key codes (or virtual key) per game control
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2] = {}; INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
typedef struct typedef struct
{ {
@@ -192,8 +192,9 @@ void G_MapEventsToControls(event_t *ev)
case ev_mouse: // buttons are virtual keys case ev_mouse: // buttons are virtual keys
if (menuactive || CON_Ready() || chat_on) if (menuactive || CON_Ready() || chat_on)
break; break;
mousex = (INT32)(ev->data2*((cv_mousexsens.value*cv_mousexsens.value)/110.0f + 0.1f)); mousex = (INT32)(ev->data2*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mouseysens.value*cv_mouseysens.value)/110.0f + 0.1f)); mousey = (INT32)(ev->data3*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mlooky = (INT32)(ev->data3*((cv_mouseysens.value*cv_mousesens.value)/110.0f + 0.1f));
break; break;
case ev_joystick: // buttons are virtual keys case ev_joystick: // buttons are virtual keys
@@ -214,7 +215,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick3: case ev_joystick3:
i = ev->data1; i = ev->data1;
if (i >= JOYAXISSET || menuactive) if (i >= JOYAXISSET)
break; break;
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2; if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3; if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
@@ -222,7 +223,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick4: case ev_joystick4:
i = ev->data1; i = ev->data1;
if (i >= JOYAXISSET || menuactive) if (i >= JOYAXISSET)
break; break;
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2; if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3; if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
@@ -973,13 +974,8 @@ void G_DeviceLEDTick(void)
newcolor = G_GetSkinColorForGamepad(i); newcolor = G_GetSkinColorForGamepad(i);
// compiler be absolutely tripping
// delet this if this gets fixed within gcc
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
if (curcolor[i] == newcolor) // dont update if same colour if (curcolor[i] == newcolor) // dont update if same colour
continue; continue;
#pragma GCC diagnostic pop
G_SetPlayerGamepadIndicatorColor(i, newcolor); G_SetPlayerGamepadIndicatorColor(i, newcolor);
curcolor[i] = newcolor; curcolor[i] = newcolor;
+2 -1
View File
@@ -109,7 +109,7 @@ typedef enum
} gamecontrols_e; } gamecontrols_e;
// mouse values are used once // mouse values are used once
extern consvar_t cv_mousexsens, cv_mouseysens; extern consvar_t cv_mousesens, cv_mouseysens;
extern consvar_t cv_controlperkey; extern consvar_t cv_controlperkey;
extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
@@ -117,6 +117,7 @@ extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
extern INT32 mousex, mousey; extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET]; extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
+14 -8
View File
@@ -214,7 +214,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2; const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
const GLMipmap_t *texture1 = poly1->hash & 0x80000000 ? NULL : poly1->texture; const GLMipmap_t *texture1 = poly1->hash & 0x80000000 ? NULL : poly1->texture;
const GLMipmap_t *texture2 = poly2->hash & 0x80000000 ? NULL : poly2->texture; const GLMipmap_t *texture2 = poly1->hash & 0x80000000 ? NULL : poly2->texture;
// skywalls and horizon lines must retain their order for horizon lines to work // skywalls and horizon lines must retain their order for horizon lines to work
if (!texture1 && !texture2) if (!texture1 && !texture2)
@@ -237,7 +237,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
// This function organizes the geometry collected by HWR_ProcessPolygon calls into batches and uses // This function organizes the geometry collected by HWR_ProcessPolygon calls into batches and uses
// the rendering backend to draw them. // the rendering backend to draw them.
void HWR_RenderBatches(void) void HWR_RenderBatches(boolean sort)
{ {
int finalVertexWritePos = 0; // position in finalVertexArray int finalVertexWritePos = 0; // position in finalVertexArray
int finalIndexWritePos = 0; // position in finalVertexIndexArray int finalIndexWritePos = 0; // position in finalVertexIndexArray
@@ -288,10 +288,13 @@ void HWR_RenderBatches(void)
polygonArraySorted[i] = &polygonArray[i]; polygonArraySorted[i] = &polygonArray[i];
} }
// sort polygons if (sort)
PS_START_TIMING(ps_hw_batchsorttime); {
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders)); // sort polygons
PS_STOP_TIMING(ps_hw_batchsorttime); PS_START_TIMING(ps_hw_batchsorttime);
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
PS_STOP_TIMING(ps_hw_batchsorttime);
}
// sort order // sort order
// 1. shader // 1. shader
@@ -300,7 +303,9 @@ void HWR_RenderBatches(void)
// 4. colors + light level // 4. colors + light level
// not sure about what order of the last 2 should be, or if it even matters // not sure about what order of the last 2 should be, or if it even matters
PS_START_TIMING(ps_hw_batchdrawtime); // dont overwrite this on consecutive calls
if (!sort)
PS_START_TIMING(ps_hw_batchdrawtime);
currentShader = polygonArraySorted[0]->shader; currentShader = polygonArraySorted[0]->shader;
currentTexture = polygonArraySorted[0]->texture; currentTexture = polygonArraySorted[0]->texture;
@@ -495,7 +500,8 @@ void HWR_RenderBatches(void)
polygonArraySize = 0; polygonArraySize = 0;
unsortedVertexArraySize = 0; unsortedVertexArraySize = 0;
PS_STOP_TIMING(ps_hw_batchdrawtime); if (!sort)
PS_STOP_TIMING(ps_hw_batchdrawtime);
} }
#endif // HWRENDER #endif // HWRENDER
+1 -1
View File
@@ -37,7 +37,7 @@ typedef struct
void HWR_StartBatching(void); void HWR_StartBatching(void);
void HWR_SetCurrentTexture(GLMipmap_t *texture); void HWR_SetCurrentTexture(GLMipmap_t *texture);
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial); void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial);
void HWR_RenderBatches(void); void HWR_RenderBatches(boolean sort);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
+164 -149
View File
@@ -14,6 +14,7 @@
#ifdef HWRENDER #ifdef HWRENDER
#include <algorithm> #include <algorithm>
#include <vector>
#include "../doomstat.h" #include "../doomstat.h"
#include "../doomdef.h" #include "../doomdef.h"
@@ -642,8 +643,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
pv = planepoly->pts; pv = planepoly->pts;
// reference point for flat texture coord for each vertex around the polygon // reference point for flat texture coord for each vertex around the polygon
flatxref = static_cast<float>(static_cast<fixed_t>(pv->x) & (~flatflag)) / fflatsize; flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize);
flatyref = static_cast<float>(static_cast<fixed_t>(pv->y) & (~flatflag)) / fflatsize; flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize);
if (!isceiling) // it's a floor if (!isceiling) // it's a floor
{ {
@@ -660,13 +661,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
if (angle) // Only needs to be done if there's an altered angle if (angle) // Only needs to be done if there's an altered angle
{ {
// This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = flatxref; tempxsow = flatxref;
tempytow = flatyref; tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle)); anglef = ANG2RAD(InvAngle(angle));
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
cosangf = cosf(anglef); cosangf = cosf(anglef);
sinangf = sinf(anglef); sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf); flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
@@ -810,7 +807,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
} }
} }
} }
#undef SETUP3DVERT
} }
#ifdef WALLSPLATS #ifdef WALLSPLATS
@@ -1370,8 +1366,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// x offset the texture // x offset the texture
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset; const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
const float cliplow = static_cast<float>(texturehpeg); const float cliplow = (float)texturehpeg;
const float cliphigh = static_cast<float>(texturehpeg) + static_cast<float>(gl_curline->length); const float cliphigh = ((float)texturehpeg + (float)gl_curline->length);
FUINT lightnum = gl_frontsector->lightlevel; FUINT lightnum = gl_frontsector->lightlevel;
extracolormap_t *colormap = gl_frontsector->extra_colormap; extracolormap_t *colormap = gl_frontsector->extra_colormap;
@@ -1385,8 +1381,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture); const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
GLMapTexture_t *glTex = NULL; GLMapTexture_t *glTex = NULL;
static constexpr float FLOATMAX = static_cast<float>(INT32_MAX) / static_cast<float>(FRACUNIT); static constexpr float FLOATMAX = (float)INT32_MAX / (float)FRACUNIT;
static constexpr float FLOATMIN = static_cast<float>(INT32_MIN) / static_cast<float>(FRACUNIT); static constexpr float FLOATMIN = (float)INT32_MIN / (float)FRACUNIT;
// two sided line // two sided line
if (gl_backsector) if (gl_backsector)
@@ -1499,8 +1495,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_toptexture, noencore); glTex = HWR_GetTexture(gl_toptexture, noencore);
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg) * glTex->scaleY; wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX; wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1508,23 +1504,23 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1)) if (!(gl_linedef->flags & ML_EFFECT1))
{ {
// Unskewed // Unskewed
wallVerts[3].t -= static_cast<float>(worldtop - gl_frontsector->ceilingheight) * glTex->scaleY; wallVerts[3].t -= (worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY; wallVerts[2].t -= (worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= static_cast<float>(worldhigh - gl_backsector->ceilingheight) * glTex->scaleY; wallVerts[0].t -= (worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY; wallVerts[1].t -= (worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
} }
else if (gl_linedef->flags & ML_DONTPEGTOP) else if (gl_linedef->flags & ML_DONTPEGTOP)
{ {
// Skewed by top // Skewed by top
wallVerts[0].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY; wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY; wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
} }
else else
{ {
// Skewed by bottom // Skewed by bottom
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - static_cast<float>(worldtop - worldhigh) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldtopslope - worldhighslope) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
} }
// set top/bottom coords // set top/bottom coords
@@ -1561,8 +1557,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_bottomtexture, noencore); glTex = HWR_GetTexture(gl_bottomtexture, noencore);
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg * glTex->scaleY); wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(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[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1570,22 +1566,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1)) if (!(gl_linedef->flags & ML_EFFECT1))
{ {
// Unskewed // Unskewed
wallVerts[0].t -= static_cast<float>(worldbottom - gl_frontsector->floorheight) * glTex->scaleY; wallVerts[0].t -= (worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY; wallVerts[1].t -= (worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= static_cast<float>(worldlow - gl_backsector->floorheight) * glTex->scaleY; wallVerts[3].t -= (worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldlowslope - gl_backsector->floorheight) * glTex->scaleY; wallVerts[2].t -= (worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
} }
else if (gl_linedef->flags & ML_DONTPEGBOTTOM) else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{ {
// Skewed by bottom // Skewed by bottom
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldlowslope - worldbottomslope) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
} }
else else
{ {
// Skewed by top // Skewed by top
wallVerts[0].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY; wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY; wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
} }
// set top/bottom coords // set top/bottom coords
@@ -1747,13 +1743,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_midtexture, noencore); glTex = HWR_GetTexture(gl_midtexture, noencore);
// Left side // Left side
wallVerts[3].t = static_cast<float>(texturevpeg * glTex->scaleY); wallVerts[3].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = static_cast<float>(h - l + texturevpeg) * glTex->scaleY; wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX; wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
// Right side // Right side
wallVerts[2].t = texturevpegslope * glTex->scaleY; wallVerts[2].t = texturevpegslope * glTex->scaleY;
wallVerts[1].t = static_cast<float>(hS - lS + texturevpegslope) * glTex->scaleY; wallVerts[1].t = (hS - lS + texturevpegslope) * glTex->scaleY;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
// set top/bottom coords // set top/bottom coords
@@ -1796,28 +1792,28 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else else
texturevpeg = gl_sidedef->rowoffset; // top of texture at top texturevpeg = gl_sidedef->rowoffset; // top of texture at top
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY); wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX; wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
// Texture correction for slopes // Texture correction for slopes
if (gl_linedef->flags & ML_EFFECT2) if (gl_linedef->flags & ML_EFFECT2)
{ {
wallVerts[3].t += static_cast<float>(gl_frontsector->ceilingheight - worldtop) * glTex->scaleY; wallVerts[3].t += (gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += static_cast<float>(gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY; wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += static_cast<float>(gl_frontsector->floorheight - worldbottom) * glTex->scaleY; wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += static_cast<float>(gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY; wallVerts[1].t += (gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
} }
else if (gl_linedef->flags & ML_DONTPEGBOTTOM) else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{ {
wallVerts[3].t = wallVerts[0].t + static_cast<float>(worldbottom - worldtop) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + static_cast<float>((worldbottomslope - worldtopslope)) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
} }
else else
{ {
wallVerts[0].t = wallVerts[3].t - static_cast<float>(worldbottom - worldtop) * glTex->scaleY; wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - static_cast<float>(worldbottomslope - worldtopslope) * glTex->scaleY; wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
} }
//Set textures properly on single sided walls that are sloped //Set textures properly on single sided walls that are sloped
@@ -1982,24 +1978,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom) if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight); texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY; wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY; wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
} }
else else
{ {
if (!dont_peg_bottom) // skew by top if (!dont_peg_bottom) // skew by top
{ {
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY); wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
} }
else // skew by bottom else // skew by bottom
{ {
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY); wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
} }
} }
@@ -2142,24 +2138,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom) if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight); texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY; wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY; wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
} }
else else
{ {
if (!dont_peg_bottom) // skew by top if (!dont_peg_bottom) // skew by top
{ {
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY); wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
} }
else // skew by bottom else // skew by bottom
{ {
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY); wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
} }
} }
@@ -2500,10 +2496,8 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord)
// Find the corners of the box // Find the corners of the box
// that define the edges from current viewpoint. // that define the edges from current viewpoint.
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
viewx < bspcoord[BOXRIGHT] ? 1 : 2) + (viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5) if (boxpos == 5)
return true; return true;
@@ -2623,7 +2617,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
INT32 flatflag; INT32 flatflag;
size_t len; size_t len;
float scrollx = 0.0f, scrolly = 0.0f; float scrollx = 0.0f, scrolly = 0.0f;
float anglef = 0.0f, cosangf = 0.0f, sinangf = 0.0f;
angle_t angle = 0; angle_t angle = 0;
FSurfaceInfo Surf; FSurfaceInfo Surf;
fixed_t tempxsow, tempytow; fixed_t tempxsow, tempytow;
@@ -2645,14 +2638,12 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
return; return;
} }
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
// Allocate plane-vertex buffer if we need to // Allocate plane-vertex buffer if we need to
if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts) if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts)
{ {
numAllocedPlaneVerts = (UINT16)nrPlaneVerts; numAllocedPlaneVerts = (UINT16)nrPlaneVerts;
Z_Free(planeVerts); Z_Free(planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof(FOutVector), PU_LEVEL, &planeVerts); Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts);
} }
height = FixedToFloat(fixedheight); height = FixedToFloat(fixedheight);
@@ -2695,51 +2686,72 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
flatxref = FixedToFloat(polysector->origVerts[0].x); flatxref = FixedToFloat(polysector->origVerts[0].x);
flatyref = FixedToFloat(polysector->origVerts[0].y); flatyref = FixedToFloat(polysector->origVerts[0].y);
flatxref = static_cast<float>(static_cast<fixed_t>(flatxref) & (~flatflag)) / fflatsize; flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize);
flatyref = static_cast<float>(static_cast<fixed_t>(flatyref) & (~flatflag)) / fflatsize; flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize);
if (!isceiling) // it's a floor // transform
v3d = planeVerts;
if (FOFsector != NULL)
{ {
scrollx = FixedToFloat(sec->floor_xoffs)/fflatsize; if (!isceiling) // it's a floor
scrolly = FixedToFloat(sec->floor_yoffs)/fflatsize; {
angle = sec->floorpic_angle; scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->floor_yoffs)/fflatsize;
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(FOFsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->ceiling_yoffs)/fflatsize;
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
} }
else // it's a ceiling else if (gl_frontsector)
{ {
scrollx = FixedToFloat(sec->ceiling_xoffs)/fflatsize; if (!isceiling) // it's a floor
scrolly = FixedToFloat(sec->ceiling_yoffs)/fflatsize; {
angle = sec->ceilingpic_angle; scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->floor_yoffs)/fflatsize;
angle = gl_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(gl_frontsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->ceiling_yoffs)/fflatsize;
angle = gl_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
} }
if (angle) // Only needs to be done if there's an altered angle if (angle) // Only needs to be done if there's an altered angle
{ {
// This needs to be done so that it scrolls in a different direction after rotation like software // This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = flatxref; tempxsow = FloatToFixed(scrollx);
tempytow = flatyref; tempytow = FloatToFixed(scrolly);
anglef = ANG2RAD(InvAngle(angle)); scrollx = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
scrolly = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
// This needs to be done so everything aligns after rotation // This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does // It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
cosangf = cosf(anglef); tempxsow = FloatToFixed(flatxref);
sinangf = sinf(anglef); tempytow = FloatToFixed(flatyref);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf); flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
flatyref = (tempxsow * sinangf) + (tempytow * cosangf); flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
} }
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++, v3d++) for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
{ {
// Go from the polysector's original vertex locations // Hurdler: add scrolling texture on floor/ceiling
// Means the flat is offset based on the original vertex locations v3d->s = (float)((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations
v3d->s = ((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); v3d->t = (float)(flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations
v3d->t = (flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly);
// Need to rotate before translate // Need to rotate before translate
if (angle) // Only needs to be done if there's an altered angle if (angle) // Only needs to be done if there's an altered angle
{ {
tempxsow = v3d->s; tempxsow = FloatToFixed(v3d->s);
tempytow = v3d->t; tempytow = FloatToFixed(v3d->t);
v3d->s = (tempxsow * cosangf) - (tempytow * sinangf); v3d->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
v3d->t = (tempxsow * sinangf) + (tempytow * cosangf); v3d->t = (FixedToFloat(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
} }
v3d->x = FixedToFloat(polysector->vertices[i]->x); v3d->x = FixedToFloat(polysector->vertices[i]->x);
@@ -3446,13 +3458,13 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f) if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
{ {
// Always a pixel above the floor, perfectly flat. // Always a pixel above the floor, perfectly flat.
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - static_cast<float>(gpatch->topoffset) * this_scale - static_cast<float>(floorheight+3); swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset * this_scale - (floorheight+3);
// Now transform the TOP vertices along the floor in the direction of the camera // Now transform the TOP vertices along the floor in the direction of the camera
swallVerts[3].x = spr->x1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos; swallVerts[3].x = spr->x1 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos; swallVerts[2].x = spr->x2 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin; swallVerts[3].z = spr->z1 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin; swallVerts[2].z = spr->z2 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
} }
else else
{ {
@@ -3460,10 +3472,10 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset - (floorheight+3); swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset - (floorheight+3);
// Now transform the TOP vertices along the floor in the direction of the camera // Now transform the TOP vertices along the floor in the direction of the camera
swallVerts[3].x = spr->x1 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos; swallVerts[3].x = spr->x1 + (gpatch->height + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos; swallVerts[2].x = spr->x2 + (gpatch->height + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin; swallVerts[3].z = spr->z1 + (gpatch->height + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin; swallVerts[2].z = spr->z2 + (gpatch->height + offset) * gl_viewsin;
} }
// We also need to move the bottom ones away when shadowoffs is on // We also need to move the bottom ones away when shadowoffs is on
@@ -4174,6 +4186,7 @@ static int CompareVisSprites(const void *p1, const void *p2)
static void HWR_SortVisSprites(void) static void HWR_SortVisSprites(void)
{ {
UINT32 i; UINT32 i;
for (i = 0; i < gl_visspritecount; i++) for (i = 0; i < gl_visspritecount; i++)
{ {
gl_vsprorder[i] = HWR_GetVisSprite(i); gl_vsprorder[i] = HWR_GetVisSprite(i);
@@ -4242,38 +4255,29 @@ typedef struct
// initial size of drawnode array // initial size of drawnode array
#define DRAWNODES_INIT_SIZE 64 #define DRAWNODES_INIT_SIZE 64
gl_drawnode_t *drawnodes = NULL; // no reason to waste all the allocations since every map will have atleast one translucent thing
INT32 numdrawnodes = 0; static std::vector<gl_drawnode_t> drawnodes;
INT32 alloceddrawnodes = 0;
static void *HWR_CreateDrawNode(gl_drawnode_type_t type) static void *HWR_CreateDrawNode(gl_drawnode_type_t type)
{ {
gl_drawnode_t *drawnode; // if we didnt alloc anything yet, reserve atleast 64 nodes
// dont declare with it as we want our size to be 0!
drawnodes.reserve(DRAWNODES_INIT_SIZE);
if (!drawnodes) drawnodes.emplace_back();
{ drawnodes.back().type = type;
alloceddrawnodes = DRAWNODES_INIT_SIZE;
drawnodes = static_cast<gl_drawnode_t*>(Z_Malloc(alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes));
}
else if (numdrawnodes >= alloceddrawnodes)
{
alloceddrawnodes *= 2;
Z_Realloc(drawnodes, alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes);
}
drawnode = &drawnodes[numdrawnodes++];
drawnode->type = type;
// not sure if returning different pointers to a union is necessary // not sure if returning different pointers to a union is necessary
switch (type) switch (type)
{ {
case DRAWNODE_PLANE: case DRAWNODE_PLANE:
return &drawnode->u.plane; return &drawnodes.back().u.plane;
case DRAWNODE_POLYOBJECT_PLANE: case DRAWNODE_POLYOBJECT_PLANE:
return &drawnode->u.polyplane; return &drawnodes.back().u.polyplane;
case DRAWNODE_WALL: case DRAWNODE_WALL:
return &drawnode->u.wall; return &drawnodes.back().u.wall;
} }
return NULL; return NULL;
} }
@@ -4337,11 +4341,15 @@ static int CompareDrawNodePlanes(const void *p1, const void *p2)
// Sorts and renders the list of drawnodes for the scene being rendered. // Sorts and renders the list of drawnodes for the scene being rendered.
static void HWR_RenderDrawNodes(void) static void HWR_RenderDrawNodes(void)
{ {
INT32 i = 0, run_start = 0; size_t i = 0, run_start = 0;
static std::vector<INT32> sortindex;
sortindex.reserve(DRAWNODES_INIT_SIZE);
// Array for storing the rendering order. // Array for storing the rendering order.
// A list of indices into the drawnodes array. // A list of indices into the drawnodes array.
INT32 *sortindex;
const size_t numdrawnodes = drawnodes.size();
if (!numdrawnodes) if (!numdrawnodes)
return; return;
@@ -4350,7 +4358,7 @@ static void HWR_RenderDrawNodes(void)
PS_START_TIMING(ps_hw_nodesorttime); PS_START_TIMING(ps_hw_nodesorttime);
sortindex = static_cast<INT32*>(Z_Malloc(sizeof(INT32) * numdrawnodes, PU_STATIC, NULL)); sortindex.resize(numdrawnodes);
// Reversed order // Reversed order
for (i = 0; i < numdrawnodes; i++) for (i = 0; i < numdrawnodes; i++)
@@ -4366,7 +4374,7 @@ static void HWR_RenderDrawNodes(void)
if (drawnodes[sortindex[run_start]].type == DRAWNODE_PLANE) if (drawnodes[sortindex[run_start]].type == DRAWNODE_PLANE)
{ {
// found it, now look for run end // found it, now look for run end
INT32 run_end; // (inclusive) size_t run_end; // (inclusive)
for (i = run_start+1; i < numdrawnodes; i++) for (i = run_start+1; i < numdrawnodes; i++)
{ {
@@ -4379,7 +4387,7 @@ static void HWR_RenderDrawNodes(void)
if (run_end > run_start) // if there are multiple consecutive planes, not just one if (run_end > run_start) // if there are multiple consecutive planes, not just one
{ {
// consecutive run of planes found, now sort it // consecutive run of planes found, now sort it
qs22j(sortindex + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes); qs22j(sortindex.data() + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes);
} }
run_start = run_end + 1; // continue looking for runs coming right after this one run_start = run_end + 1; // continue looking for runs coming right after this one
@@ -4398,6 +4406,9 @@ static void HWR_RenderDrawNodes(void)
// Okay! Let's draw it all! Woo! // Okay! Let's draw it all! Woo!
GL_SetTransform(&atransform); GL_SetTransform(&atransform);
if (LIKELY(cv_glbatching.value))
HWR_StartBatching();
for (i = 0; i < numdrawnodes; i++) for (i = 0; i < numdrawnodes; i++)
{ {
gl_drawnode_t *drawnode = &drawnodes[sortindex[i]]; gl_drawnode_t *drawnode = &drawnodes[sortindex[i]];
@@ -4451,9 +4462,10 @@ static void HWR_RenderDrawNodes(void)
PS_STOP_TIMING(ps_hw_nodedrawtime); PS_STOP_TIMING(ps_hw_nodedrawtime);
numdrawnodes = 0; if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(false);
Z_Free(sortindex); drawnodes.clear(); // clear so our size is 0 again!
} }
@@ -5141,8 +5153,6 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
z2 = tr_y - x2 * rightsin; z2 = tr_y - x2 * rightsin;
x1 = tr_x + x1 * rightcos; x1 = tr_x + x1 * rightcos;
x2 = tr_x - x2 * rightcos; x2 = tr_x - x2 * rightcos;
//y1 = tr_y + y1 * rightcos;
//y2 = tr_y - y2 * rightcos;
// //
// store information in a vissprite // store information in a vissprite
@@ -5321,7 +5331,7 @@ void HWR_BuildSkyDome(void)
} }
// precompute to save a bit of division // precompute to save a bit of division
static constexpr float FINEDEGREE = (360.0f/static_cast<float>(FINEANGLES)); static constexpr float FINEDEGREE = (360.0f/(float)FINEANGLES);
static void HWR_DrawSkyBackground(void) static void HWR_DrawSkyBackground(void)
{ {
@@ -5339,7 +5349,7 @@ static void HWR_DrawSkyBackground(void)
//04/01/2000: Hurdler: added for T&L //04/01/2000: Hurdler: added for T&L
// It should replace all other gl_viewxxx when finished // It should replace all other gl_viewxxx when finished
HWR_SetTransformAiming(&dometransform); HWR_SetTransformAiming(&dometransform);
dometransform.angley = static_cast<float>((viewangle-ANGLE_270) >> ANGLETOFINESHIFT)*(FINEDEGREE); dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(FINEDEGREE);
HWR_GetTexture(texturetranslation[skytexture], false); HWR_GetTexture(texturetranslation[skytexture], false);
@@ -5384,7 +5394,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
if (cv_glshearing.value) if (cv_glshearing.value)
{ {
fixed_t fixedaiming = AIMINGTODY(aimingangle); fixed_t fixedaiming = AIMINGTODY(aimingangle);
trans->viewaiming = FixedToFloat(fixedaiming) * (static_cast<float>(vid.width) / static_cast<float>(vid.height)) / (static_cast<float>(BASEVIDWIDTH) / static_cast<float>(BASEVIDHEIGHT)); trans->viewaiming = FixedToFloat(fixedaiming) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT);
if (splitscreen == 1) // only for 2 player splitscreen if (splitscreen == 1) // only for 2 player splitscreen
trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used) trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
trans->shearing = true; trans->shearing = true;
@@ -5396,7 +5406,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
gl_aimingangle = aimingangle; gl_aimingangle = aimingangle;
} }
trans->anglex = static_cast<float>(gl_aimingangle >> ANGLETOFINESHIFT)*(FINEDEGREE); trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
} }
void HWR_SetTransform(float fpov) void HWR_SetTransform(float fpov)
@@ -5415,11 +5425,11 @@ void HWR_SetTransform(float fpov)
atransform.z = gl_viewz; atransform.z = gl_viewz;
atransform.scalex = 1; atransform.scalex = 1;
atransform.scaley = static_cast<float>(vid.width) / static_cast<float>(vid.height); atransform.scaley = (float)vid.width/vid.height;
atransform.scalez = 1; atransform.scalez = 1;
HWR_SetTransformAiming(&atransform); HWR_SetTransformAiming(&atransform);
atransform.angley = static_cast<float>(viewangle >> ANGLETOFINESHIFT)*(FINEDEGREE); atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
yaw = 270.0f - atransform.angley; yaw = 270.0f - atransform.angley;
inv_yaw = 180.0f - yaw; inv_yaw = 180.0f - yaw;
@@ -5430,8 +5440,8 @@ void HWR_SetTransform(float fpov)
// only needed for sprite billboarding // only needed for sprite billboarding
if (cv_glspritebillboarding.value && !cv_glshearing.value) if (cv_glspritebillboarding.value && !cv_glshearing.value)
{ {
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle >> ANGLETOFINESHIFT)); gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle >> ANGLETOFINESHIFT)); gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
} }
atransform.fovangle = fpov; // Tails atransform.fovangle = fpov; // Tails
@@ -5459,6 +5469,7 @@ void HWR_SetTransform(float fpov)
void HWR_ClearClipper(void) void HWR_ClearClipper(void)
{ {
const angle_t a1 = gld_FrustumAngle(gl_aimingangle); const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
gld_clipper_Clear(); gld_clipper_Clear();
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1); gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
#ifdef HAVE_SPHEREFRUSTRUM #ifdef HAVE_SPHEREFRUSTRUM
@@ -5543,7 +5554,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
{ {
if (allow_portals && rootportal) if (allow_portals && rootportal)
{ {
HWR_PortalFrame(rootportal);// for portalclipsector, it could have gone null from search HWR_PortalFrame(rootportal); // for portalclipsector, it could have gone null from search
HWR_PortalClipping(rootportal); HWR_PortalClipping(rootportal);
} }
} }
@@ -5593,7 +5604,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
PS_STOP_TIMING(ps_bsptime); PS_STOP_TIMING(ps_bsptime);
if (LIKELY(cv_glbatching.value)) if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(); HWR_RenderBatches(true);
// Check for new console commands. // Check for new console commands.
NetUpdate(); NetUpdate();
@@ -5620,11 +5631,15 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
HWR_SortVisSprites(); HWR_SortVisSprites();
PS_STOP_TIMING(ps_hw_spritesorttime); PS_STOP_TIMING(ps_hw_spritesorttime);
PS_START_TIMING(ps_hw_spritedrawtime); PS_START_TIMING(ps_hw_spritedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_StartBatching();
if (UNLIKELY(cv_glmdls.value)) if (UNLIKELY(cv_glmdls.value))
HWR_DrawSprites<DrawSpritesType::kModels>(); HWR_DrawSprites<DrawSpritesType::kModels>();
else else
HWR_DrawSprites<DrawSpritesType::kSprites>(); HWR_DrawSprites<DrawSpritesType::kSprites>();
PS_STOP_TIMING(ps_hw_spritedrawtime); PS_STOP_TIMING(ps_hw_spritedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(false);
ps_numdrawnodes.value.i = 0; ps_numdrawnodes.value.i = 0;
ps_hw_nodesorttime.value.p = 0; ps_hw_nodesorttime.value.p = 0;
@@ -5692,7 +5707,7 @@ static void HWR_RollTransform(FTransform *tr, angle_t roll)
{ {
if (roll != 0) if (roll != 0)
{ {
tr->rollangle = static_cast<float>(roll) / static_cast<float>(ANG1); tr->rollangle = roll / (float)ANG1;
tr->roll = true; tr->roll = true;
tr->rollx = 1.0f; tr->rollx = 1.0f;
tr->rollz = 0.0f; tr->rollz = 0.0f;
@@ -6092,7 +6107,7 @@ static void HWR_DoPostProcessor(void)
for (y = 0; y < SCREENVERTS; y++) for (y = 0; y < SCREENVERTS; y++)
{ {
// Change X position based on its Y position. // Change X position based on its Y position.
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale) 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) v[x][y][1] = y-4.5f; // (y / scale)
} }
} }
+7 -1
View File
@@ -2209,10 +2209,16 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
UNIFORM_1(shader->uniforms[gluniform_light_contrast], shader_light_contrast, pglUniform1f); UNIFORM_1(shader->uniforms[gluniform_light_contrast], shader_light_contrast, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_light_backlight], shader_light_backlight, pglUniform1f); UNIFORM_1(shader->uniforms[gluniform_light_backlight], shader_light_backlight, pglUniform1f);
} }
else
{
UNIFORM_3(shader->uniforms[gluniform_light_dir], 0, 0, 0, pglUniform3f);
UNIFORM_1(shader->uniforms[gluniform_light_contrast], 0, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_light_backlight], 0, pglUniform1f);
}
UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f); UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f);
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)vid.width, (GLfloat)vid.height, pglUniform2f); UNIFORM_2(shader->uniforms[gluniform_scr_resolution], vid.width, vid.height, pglUniform2f);
#undef UNIFORM_1 #undef UNIFORM_1
#undef UNIFORM_2 #undef UNIFORM_2
+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
#ifdef HAVE_SDL #ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED #define _MATH_DEFINES_DEFINED
#include "SDL_opengl.h" //Alam_GBC: Simple, yes? #include <SDL3/SDL_opengl.h> //Alam_GBC: Simple, yes?
#else #else
#include <GL/gl.h> #include <GL/gl.h>
+25 -18
View File
@@ -596,12 +596,12 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
} }
// Only servers/admins can CSAY. // Only servers/admins can CSAY.
if(!server && !(IsPlayerAdmin(consoleplayer))) if (!server && !(IsPlayerAdmin(consoleplayer)))
flags &= ~HU_CSAY; flags &= ~HU_CSAY;
// We handle HU_SERVER_SAY, not the caller. // We handle HU_SERVER_SAY, not the caller.
flags &= ~HU_SERVER_SAY; flags &= ~HU_SERVER_SAY;
if(dedicated && !(flags & HU_CSAY)) if (dedicated && !(flags & HU_CSAY))
flags |= HU_SERVER_SAY; flags |= HU_SERVER_SAY;
buf[0] = target; buf[0] = target;
@@ -615,17 +615,20 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
strlcat(msg, COM_Argv(ix + usedargs), msgspace); strlcat(msg, COM_Argv(ix + usedargs), msgspace);
} }
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm const size_t msglength = strlen(msg);
if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
{ {
// what we're gonna do now is check if the node exists // what we're gonna do now is check if the node exists
// with that logic, characters 4 and 5 are our numbers: // with that logic, characters 4 and 5 are our numbers:
const char *newmsg; const char *newmsg;
INT32 spc = 1; // used if nodenum[1] is a space. INT32 spc = 1; // used if nodenum[1] is a space.
char *nodenum = (char*) malloc(3); CLEANUP(pfree) char *nodenum = (char*) malloc(3);
memcpy(nodenum, msg+3, 2); memcpy(nodenum, msg+3, 2);
nodenum[2] = '\0'; nodenum[2] = '\0';
// check for undesirable characters in our "number" // check for undesirable characters in our "number"
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9'))) if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
{ {
// check if nodenum[1] is a space // check if nodenum[1] is a space
if (nodenum[1] == ' ') if (nodenum[1] == ' ')
@@ -634,23 +637,21 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
else else
{ {
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false); HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return; return;
} }
} }
// I'm very bad at C, I swear I am, additional checks eww! // I'm very bad at C, I swear I am, additional checks eww!
if (spc != 0) if (spc != 0)
{ {
if (msg[5] != ' ') if (msg[5] != ' ')
{ {
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false); HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return; return;
} }
} }
target = atoi((const char*) nodenum); // turn that into a number target = atoi((const char*) nodenum); // turn that into a number
free(nodenum);
//CONS_Printf("%d\n", target); //CONS_Printf("%d\n", target);
// check for target player, if it doesn't exist then we can't send the message! // check for target player, if it doesn't exist then we can't send the message!
@@ -661,12 +662,13 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
return; return;
} }
buf[0] = target; buf[0] = target;
newmsg = msg+5+spc; newmsg = msg+5+spc;
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1); strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
} }
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf); SendNetXCmd(XD_SAY, buf, msglength + 1 + msg-buf);
} }
/** Send a message to everyone. /** Send a message to everyone.
@@ -917,10 +919,12 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
return; return;
} }
const size_t msglength = strlen(msg);
//check for invalid characters (0x80 or above) //check for invalid characters (0x80 or above)
{ {
size_t i; size_t i;
const size_t j = strlen(msg); const size_t j = msglength;
for (i = 0; i < j; i++) for (i = 0; i < j; i++)
{ {
if (msg[i] & 0x80) if (msg[i] & 0x80)
@@ -967,7 +971,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
} }
// Handle "/me" actions, but only in messages to everyone. // Handle "/me" actions, but only in messages to everyone.
if (target == 0 && strlen(msg) > 4 && strnicmp(msg, "/me ", 4) == 0) if (target == 0 && msglength > 4 && strnicmp(msg, "/me ", 4) == 0)
{ {
msg += 4; msg += 4;
action = true; action = true;
@@ -1149,10 +1153,12 @@ static boolean HU_clearChatSpaces(void)
size_t i = 0; // Used to just check our message size_t i = 0; // Used to just check our message
char c; // current character we're iterating. char c; // current character we're iterating.
boolean nothingbutspaces = true; boolean nothingbutspaces = true;
const size_t chatlength = strlen(w_chat_buf);
for (; i < strlen(w_chat_buf); i++) // iterate through message and eradicate all spaces that don't belong. for (; i < chatlength; i++) // iterate through message and eradicate all spaces that don't belong.
{ {
c = w_chat_buf[i]; c = w_chat_buf[i];
if (!c) if (!c)
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here. break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
@@ -1161,6 +1167,7 @@ static boolean HU_clearChatSpaces(void)
nothingbutspaces = false; nothingbutspaces = false;
} }
} }
return nothingbutspaces; return nothingbutspaces;
} }
@@ -1207,11 +1214,11 @@ static void HU_SendChatMessage(void)
return; return;
} }
size_t len = strlen(msg); const size_t msglength = strlen(msg);
if (len >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute if (msglength >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
{ {
if (len > 6) if (msglength > 6)
DoMute(msg+6); DoMute(msg+6);
else else
HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false); HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false);
@@ -1219,7 +1226,7 @@ static void HU_SendChatMessage(void)
return; return;
} }
if (len > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
{ {
INT32 spc = 1; // used if nodenum[1] is a space. INT32 spc = 1; // used if nodenum[1] is a space.
const char *newmsg; const char *newmsg;
@@ -1731,7 +1738,7 @@ static void HU_drawChatLog(INT32 offset)
{ {
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy))) if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
{ {
M_DrawEmote(x+dx+2, y+dy+1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT); M_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
dx += EMOTEWIDTH - charwidth; dx += EMOTEWIDTH - charwidth;
} }
j += emotelen; j += emotelen;
@@ -1991,7 +1998,7 @@ static void HU_DrawChat(void)
longest_name_length = max(longest_name_length, strlen(player_names[i])); longest_name_length = max(longest_name_length, strlen(player_names[i]));
} }
for(i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (!playeringame[i]) if (!playeringame[i])
continue; continue;
+2 -2
View File
@@ -80,8 +80,6 @@ typedef struct
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data #define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
extern doomcom_t *doomcom;
#ifdef HOLEPUNCH #ifdef HOLEPUNCH
typedef struct typedef struct
{ {
@@ -93,6 +91,8 @@ typedef struct
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data #define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
#endif #endif
extern doomcom_t *doomcom;
/** \brief return packet in doomcom struct /** \brief return packet in doomcom struct
*/ */
extern boolean (*I_NetGet)(void); extern boolean (*I_NetGet)(void);
-2
View File
@@ -158,8 +158,6 @@ UINT32 I_GetSongLoopPoint(void);
boolean I_SetSongPosition(UINT32 position); boolean I_SetSongPosition(UINT32 position);
UINT32 I_GetSongPosition(void); UINT32 I_GetSongPosition(void);
void I_UpdateSongLagThreshold (void);
/// ------------------------ /// ------------------------
// MUSIC PLAYBACK // MUSIC PLAYBACK
/// ------------------------ /// ------------------------
+5 -6
View File
@@ -568,12 +568,13 @@ void Command_Numnodes(void)
#ifdef HOLEPUNCH #ifdef HOLEPUNCH
/* not one of the reserved "local" addresses */ /* not one of the reserved "local" addresses */
static boolean is_external_address(UINT32 p) static boolean
is_external_address (UINT32 p)
{ {
UINT8 a = (p & 255); UINT8 a = (p & 255);
UINT8 b = ((p >> 8) & 255); UINT8 b = ((p >> 8) & 255);
if (p == (UINT32)~0) /* 255.255.255.255 */ if (p == (UINT32)~0)/* 255.255.255.255 */
return 0; return 0;
switch (a) switch (a)
@@ -583,7 +584,7 @@ static boolean is_external_address(UINT32 p)
case 127: case 127:
return false; return false;
case 172: case 172:
return (b & ~15) != 16; /* 16 - 31 */ return (b & ~15) != 16;/* 16 - 31 */
case 192: case 192:
return b != 168; return b != 168;
default: default:
@@ -762,7 +763,6 @@ static void SOCK_Send(void)
if (myfamily[i] == broadcastaddress[j].any.sa_family) if (myfamily[i] == broadcastaddress[j].any.sa_family)
{ {
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]); c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
if (c == ERRSOCKET) if (c == ERRSOCKET)
{ {
e = errno; e = errno;
@@ -780,7 +780,6 @@ static void SOCK_Send(void)
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family) if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
{ {
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]); c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET) if (c == ERRSOCKET)
{ {
e = errno; e = errno;
@@ -793,7 +792,6 @@ static void SOCK_Send(void)
else else
{ {
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]); c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET) if (c == ERRSOCKET)
{ {
e = errno; e = errno;
@@ -1062,6 +1060,7 @@ static boolean UDP_Socket(void)
#endif #endif
const char *serv; const char *serv;
for (s = 0; s < mysocketses; s++) for (s = 0; s < mysocketses; s++)
mysockets[s] = ERRSOCKET; mysockets[s] = ERRSOCKET;
for (s = 0; s < MAXNETNODES+1; s++) for (s = 0; s < MAXNETNODES+1; s++)
+2
View File
@@ -95,6 +95,7 @@ INT32 VID_SetMode(INT32 modenum);
*/ */
const char *VID_GetModeName(INT32 modenum); const char *VID_GetModeName(INT32 modenum);
void VID_RefreshModeList(void);
void VID_PrepareModeList(void); void VID_PrepareModeList(void);
/** \brief can video system do fullscreen /** \brief can video system do fullscreen
@@ -121,6 +122,7 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale);
UINT32 I_GetRefreshRate(void); UINT32 I_GetRefreshRate(void);
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height);
boolean I_CheckNativeRes(void); boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void); void I_SetBorderlessWindow(void);
+4 -2
View File
@@ -568,7 +568,7 @@ static patch_t *kp_racefinish[6];
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES]; static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
static patch_t *kp_winnernum[NUMPOSFRAMES]; static patch_t *kp_winnernum[NUMPOSFRAMES];
patch_t *kp_facenum[MAXPLAYERS+1]; static patch_t *kp_facenum[MAXPLAYERS+1];
static patch_t *kp_facehighlight[8]; static patch_t *kp_facehighlight[8];
static patch_t *kp_rankbumper; static patch_t *kp_rankbumper;
@@ -4468,7 +4468,9 @@ static void K_drawLapStartAnim(void)
V_DrawFixedPatch(leftx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2, 6)], NULL); V_DrawFixedPatch(leftx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2, 6)], NULL);
char *lapnum = va("%02d", stplyr->laps + 1); char *lapnum = va("%02d", stplyr->laps + 1);
for (int i = 0; i < (int)strlen(lapnum); i++) const size_t laplength = strlen(lapnum);
for (int i = 0; i < (int)laplength; i++)
{ {
int digit = lapnum[i] - '0'; int digit = lapnum[i] - '0';
int frame = min(2, progress/2 - 8 - (i*2)); int frame = min(2, progress/2 - 8 - (i*2));
-3
View File
@@ -41,9 +41,6 @@ extern consvar_t cv_battlespeedo;
extern consvar_t cv_multiitemicon; extern consvar_t cv_multiitemicon;
extern consvar_t cv_huditemamount; extern consvar_t cv_huditemamount;
// for use in timeattack menu
extern patch_t *kp_facenum[MAXPLAYERS+1];
#define NUMSPEEDOSTUFF 8 #define NUMSPEEDOSTUFF 8
extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF]; extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
#define NUMDGAUGESTUFF 6 #define NUMDGAUGESTUFF 6
+54 -50
View File
@@ -5179,24 +5179,6 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
return wtarg; return wtarg;
} }
static INT32 K_GetEngineClass(const player_t *player)
{
INT32 speed, weight;
speed = (player->kartspeed - 1) / 3;
weight = (player->kartweight - 1) / 3;
#define LOCKSTAT(stat) \
if (stat < 0) { stat = 0; } \
if (stat > 2) { stat = 2; }
LOCKSTAT(speed);
LOCKSTAT(weight);
#undef LOCKSTAT
return (speed + (3*weight));
}
// Engine Sounds. // Engine Sounds.
static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
{ {
@@ -5207,7 +5189,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
static const UINT8 dampenval = 48; // 255 * 48 = close enough to FRACUNIT/6 static const UINT8 dampenval = 48; // 255 * 48 = close enough to FRACUNIT/6
INT32 class; // engine class number INT32 class, s, w; // engine class number
UINT8 volume = 255; UINT8 volume = 255;
fixed_t volumedampen = FRACUNIT; fixed_t volumedampen = FRACUNIT;
@@ -5243,7 +5225,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
targetsnd = (((6 * cmd->forwardmove) / 25) + ((player->speed / mapobjectscale) / 5)) / 2; targetsnd = (((6 * cmd->forwardmove) / 25) + ((player->speed / mapobjectscale) / 5)) / 2;
} }
if (targetsnd < 0) { targetsnd = 0; } if (targetsnd < 0) { targetsnd = 0; }
if (targetsnd > 12) { targetsnd = 12; } if (targetsnd > 12) { targetsnd = 12; }
if (player->kartstuff[k_enginesnd] < targetsnd) { player->kartstuff[k_enginesnd]++; } if (player->kartstuff[k_enginesnd] < targetsnd) { player->kartstuff[k_enginesnd]++; }
@@ -5320,7 +5302,17 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
return; return;
} }
class = K_GetEngineClass(player); s = (player->kartspeed - 1) / 3;
w = (player->kartweight - 1) / 3;
#define LOCKSTAT(stat) \
if (stat < 0) { stat = 0; } \
if (stat > 2) { stat = 2; }
LOCKSTAT(s);
LOCKSTAT(w);
#undef LOCKSTAT
class = s + (3*w);
S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class * numsnds), volume); S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class * numsnds), volume);
} }
@@ -5739,7 +5731,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_UpdateInvincibilitySounds(player); // Also thanks, VAda! K_UpdateInvincibilitySounds(player); // Also thanks, VAda!
// Plays the music during and after the starting countdown. // Plays the music during and after the starting countdown.
if ((leveltime <= MUSICSTARTTIME) && P_IsLocalPlayer(player)) if (P_IsLocalPlayer(player))
S_StartMapMusic(); S_StartMapMusic();
} }
@@ -5919,33 +5911,45 @@ static void K_KartDrift(player_t *player, boolean onground)
// Holding the Jump button will enable drifting. // Holding the Jump button will enable drifting.
// Drift Release (Moved here so you can't "chain" drifts) // Drift Release (Moved here so you can't "chain" drifts)
if (onground && player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] < dsone
&& onground)
{ {
if (player->kartstuff[k_driftcharge] < dsone) player->kartstuff[k_driftcharge] = 0;
{ }
player->kartstuff[k_driftcharge] = 0; else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
} // || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
else if (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo) && (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
{ && onground)
if (player->kartstuff[k_driftboost] < 20) {
player->kartstuff[k_driftboost] = 20; if (player->kartstuff[k_driftboost] < 20)
S_StartSound(player->mo, sfx_s23c); player->kartstuff[k_driftboost] = 20;
player->kartstuff[k_driftcharge] = 0; S_StartSound(player->mo, sfx_s23c);
} //K_SpawnDashDustRelease(player);
else if (player->kartstuff[k_driftcharge] < dsthree) player->kartstuff[k_driftcharge] = 0;
{ }
if (player->kartstuff[k_driftboost] < 50) else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
player->kartstuff[k_driftboost] = 50; // || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
S_StartSound(player->mo, sfx_s23c); && player->kartstuff[k_driftcharge] < dsthree
player->kartstuff[k_driftcharge] = 0; && onground)
} {
else if (player->kartstuff[k_driftcharge] >= dsthree) if (player->kartstuff[k_driftboost] < 50)
{ player->kartstuff[k_driftboost] = 50;
if (player->kartstuff[k_driftboost] < 125) S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftboost] = 125; //K_SpawnDashDustRelease(player);
S_StartSound(player->mo, sfx_s23c); player->kartstuff[k_driftcharge] = 0;
player->kartstuff[k_driftcharge] = 0; }
} else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] >= dsthree
&& onground)
{
if (player->kartstuff[k_driftboost] < 125)
player->kartstuff[k_driftboost] = 125;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
player->kartstuff[k_driftcharge] = 0;
} }
// Drifting: left or right? // Drifting: left or right?
@@ -6023,8 +6027,8 @@ static void K_KartDrift(player_t *player, boolean onground)
// Sound whenever you get a different tier of sparks // Sound whenever you get a different tier of sparks
if (driftblue if (driftblue
|| driftred || driftred
|| driftrainbow) || driftrainbow)
{ {
//S_StartSound(player->mo, sfx_s3ka2); //S_StartSound(player->mo, sfx_s3ka2);
if (P_IsLocalPlayer(player)) // UGHGHGH... if (P_IsLocalPlayer(player)) // UGHGHGH...
+10 -65
View File
@@ -149,8 +149,7 @@ enum cameraf {
camera_momx, camera_momx,
camera_momy, camera_momy,
camera_momz, camera_momz,
camera_pnum, camera_pnum
camera_freecam,
}; };
@@ -170,7 +169,6 @@ static const char *const camera_opt[] = {
"momy", "momy",
"momz", "momz",
"pnum", "pnum",
"freecam",
NULL}; NULL};
enum hudpatch { enum hudpatch {
@@ -389,43 +387,10 @@ static int camera_get(lua_State *L)
case camera_pnum: case camera_pnum:
lua_pushinteger(L, camnum); lua_pushinteger(L, camnum);
break; break;
case camera_freecam:
lua_pushboolean(L, cam->freecam);
break;
} }
return 1; return 1;
} }
static int lib_getCamera(lua_State *L)
{
// No cameras on dedicated
if (dedicated)
return 0;
if (lua_type(L, 2) == LUA_TNUMBER)
{
int i = lua_tonumber(L, 2);
if (i < 0 || i > splitscreen)
return 0;
LUA_PushUserdata(L, &camera[i], META_CAMERA);
return 1;
}
return 0;
}
static int lib_lenCamera(lua_State *L)
{
if (dedicated)
lua_pushinteger(L, 0);
else
lua_pushinteger(L, splitscreen+1); // splitscreen == 0 -> 1 active camera, splitscreen == 1 -> 2 cameras and so on
return 1;
}
// //
// lib_draw // lib_draw
// //
@@ -1287,33 +1252,23 @@ extern int lib_hudadd(lua_State *L);
static int lib_hudsetvotebackground(lua_State *L) static int lib_hudsetvotebackground(lua_State *L)
{ {
// Reset to default
memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix)); memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix));
VoteScreen.timePerAnimFrame = 2;
if (!lua_isnoneornil(L, 1)) if (lua_isnoneornil(L, 1))
{ {
const char *prefix = luaL_checkstring(L, 1); return 0;
if (strlen(prefix) != 4)
{
return luaL_argerror(L, 1, "prefix should 4 characters wide");
}
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
} }
if (!lua_isnoneornil(L, 2)) const char *prefix = luaL_checkstring(L, 1);
if (strlen(prefix) != 4)
{ {
INT32 time_per_frame = luaL_checkinteger(L, 2); return luaL_argerror(L, 1, "prefix should 4 characters wide");
if (time_per_frame <= 0)
return luaL_argerror(L, 2, "time per frame should be 1 or more");
VoteScreen.timePerAnimFrame = time_per_frame;
} }
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
// Update background if we're already on vote screen // Update background if we're already on vote screen
if (gamestate == GS_VOTING) if (gamestate == GS_VOTING)
Y_VoteScreenCheck(); Y_VoteScreenCheck();
@@ -1416,16 +1371,6 @@ int LUA_HudLib(lua_State *L)
lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "__index");
lua_pop(L,1); lua_pop(L,1);
lua_newuserdata(L, 0);
lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getCamera);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, lib_lenCamera);
lua_setfield(L, -2, "__len");
lua_setmetatable(L, -2);
lua_setglobal(L, "cameras");
camera_fields_ref = Lua_CreateFieldTable(L, camera_opt); camera_fields_ref = Lua_CreateFieldTable(L, camera_opt);
luaL_register(L, "hud", lib_hud); luaL_register(L, "hud", lib_hud);
+6 -4
View File
@@ -49,17 +49,19 @@ aatree_t *M_AATreeAlloc(UINT32 flags)
return aatree; return aatree;
} }
static void M_AATreeFree_Node(aatree_node_t *node) static void M_AATreeFree_Node(aatree_node_t *node, bool is_string)
{ {
if (node->left) M_AATreeFree_Node(node->left); if (node->left) M_AATreeFree_Node(node->left, is_string);
if (node->right) M_AATreeFree_Node(node->right); if (node->right) M_AATreeFree_Node(node->right, is_string);
if (is_string)
Z_Free(node->value);
Z_Free(node); Z_Free(node);
} }
void M_AATreeFree(aatree_t *aatree) void M_AATreeFree(aatree_t *aatree)
{ {
if (aatree->root) if (aatree->root)
M_AATreeFree_Node(aatree->root); M_AATreeFree_Node(aatree->root, (aatree->flags & AATREE_STRING) == AATREE_STRING);
Z_Free(aatree); Z_Free(aatree);
} }
+1 -1
View File
@@ -908,7 +908,7 @@ void OP_ObjectplaceMovement(player_t *player)
ticcmd_t *cmd = &player->cmd; ticcmd_t *cmd = &player->cmd;
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING))) if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
player->mo->angle = (cmd->angleturn << TICCMD_REDUCE); player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
ticruned++; ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED)) if (!(cmd->angleturn & TICCMD_RECEIVED))
+261 -344
View File
@@ -88,8 +88,8 @@
#include "z_zone.h" #include "z_zone.h"
#include "mserv.h" #include "mserv.h"
#if defined(HAVE_SDL) #if defined (HAVE_SDL)
#include "SDL.h" #include <SDL3/SDL.h>
#if SDL_VERSION_ATLEAST(2,0,0) #if SDL_VERSION_ATLEAST(2,0,0)
#include "sdl/sdlmain.h" // JOYSTICK_HOTPLUG #include "sdl/sdlmain.h" // JOYSTICK_HOTPLUG
#endif #endif
@@ -197,30 +197,7 @@ static INT32 vidm_column_size;
#define SETUPM_IP_MAXSIZE ((28-1)*8) #define SETUPM_IP_MAXSIZE ((28-1)*8)
static char setupm_ip[64]; static char setupm_ip[64];
static textinput_t setupm_input_ip; static textinput_t setupm_input_ip;
static UINT8 setupm_pselect = 1;
static fixed_t multi_tics;
static state_t *multi_state;
// this is set before entering the MultiPlayer setup menu,
// for either player 1 or 2
static char setupm_name[MAXPLAYERNAME+1];
static textinput_t setupm_input;
static player_t *setupm_player;
static consvar_t *setupm_cvskin;
static consvar_t *setupm_cvcolor;
static consvar_t *setupm_cvname;
static UINT8 setupm_skinxpos;
static INT32 setupm_fakeskin;
static INT32 setupm_fakecolor;
static UINT8 setupm_pselect = 1;
//variables used for other skin select menus
static UINT8 setupm_skinypos;
static INT32 setupm_skinselect;
static boolean setupm_skinlockedselect;
static UINT8 setupm_playernum; //brap
// //
// PROTOTYPES // PROTOTYPES
@@ -256,7 +233,6 @@ static char *M_GetConditionString(condition_t cond);
// Misc. Main Menu // Misc. Main Menu
static void M_Options(INT32 choice); static void M_Options(INT32 choice);
static void M_Multiplayer(INT32 choice); static void M_Multiplayer(INT32 choice);
static void M_CameraMenu(INT32 choice);
static void M_LocalSkinMenu(INT32 choice); static void M_LocalSkinMenu(INT32 choice);
static void M_LocalSkinChange(INT32 choice); static void M_LocalSkinChange(INT32 choice);
static void M_Manual(INT32 choice); static void M_Manual(INT32 choice);
@@ -306,7 +282,6 @@ static void M_SetupMultiHandler(INT32 choice);
// Options // Options
// Split into multiple parts due to size // Split into multiple parts due to size
static void M_VideoModeMenu(INT32 choice);
static void M_Setup1PControlsMenu(void); static void M_Setup1PControlsMenu(void);
static void M_Setup2PControlsMenu(void); static void M_Setup2PControlsMenu(void);
static void M_Setup3PControlsMenu(void); static void M_Setup3PControlsMenu(void);
@@ -529,7 +504,6 @@ static INT32 M_ShiftChar(INT32 ch)
// Pretty and consistent ^u^ // Pretty and consistent ^u^
// See also G_GetGametypeColor. // See also G_GetGametypeColor.
// //
static INT32 highlightflags, recommendedflags, warningflags; static INT32 highlightflags, recommendedflags, warningflags;
inline static void M_GetGametypeColor(void) inline static void M_GetGametypeColor(void)
@@ -649,28 +623,22 @@ void Nextmap_OnChange(void)
SP_ReplayMenu[i].status = IT_DISABLED; SP_ReplayMenu[i].status = IT_DISABLED;
SP_GuestReplayMenu[i].status = IT_DISABLED; SP_GuestReplayMenu[i].status = IT_DISABLED;
} }
SP_ReplayMenu[4].status = IT_DISABLED; SP_ReplayMenu[4].status = IT_DISABLED;
SP_GhostMenu[3].status = IT_DISABLED; SP_GhostMenu[3].status = IT_DISABLED;
SP_GhostMenu[4].status = IT_DISABLED; SP_GhostMenu[4].status = IT_DISABLED;
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string))) if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string))) {
{
SP_ReplayMenu[0].status = IT_WHITESTRING|IT_CALL; SP_ReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
active |= 3; active |= 3;
} }
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string))) {
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string)))
{
SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL; SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
active |= 3; active |= 3;
} }
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string))) {
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string)))
{
SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL; SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
active |= 3; active |= 3;
@@ -693,8 +661,7 @@ void Nextmap_OnChange(void)
active |= 1; active |= 1;
} }
if (active) if (active) {
{
if (active & 1) if (active & 1)
SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU; SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU;
if (active & 2) if (active & 2)
@@ -806,11 +773,6 @@ static void Splitplayers_OnChange(void)
setupm_pselect = 1; setupm_pselect = 1;
} }
void ShowLocalskinMenu_Onchange(void)
{
OP_MainMenu[localskin].status = (!cv_showlocalskinmenus.value) ? (IT_DISABLED) : (IT_CALL|IT_STRING);
}
// current menudef // current menudef
menu_t *currentMenu = &MainDef; menu_t *currentMenu = &MainDef;
@@ -931,7 +893,7 @@ static void M_CheckStringItem(void)
// special case: name input, cap it to prevent writing outside the textbox // special case: name input, cap it to prevent writing outside the textbox
// kinda ugly but itll work // kinda ugly but itll work
if (cv == setupm_cvname) if (cv == &cv_playername)
M_TextInputInit(&menuinput, menu_text_input_buf, MAXPLAYERNAME +1); M_TextInputInit(&menuinput, menu_text_input_buf, MAXPLAYERNAME +1);
else else
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf); M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
@@ -1042,6 +1004,18 @@ boolean M_Responder(event_t *ev)
ch = KEY_RIGHTARROW; ch = KEY_RIGHTARROW;
break; break;
} }
if (menuactive)
{
if (currentMenu == &MISC_ChangeLevelDef || currentMenu == &MP_OfflineServerDef || currentMenu == &MP_ServerDef)
{
if (ch == gamecontrol[0][gc_fire][0]
|| ch == gamecontrol[0][gc_fire][1])
{
COM_ImmedExecute("add kartencore 1");
}
}
}
} }
else if (menuactive) else if (menuactive)
{ {
@@ -1233,19 +1207,6 @@ boolean M_Responder(event_t *ev)
if ((ch == gamecontrol[0][gc_brake][0] || ch == gamecontrol[0][gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game if ((ch == gamecontrol[0][gc_brake][0] || ch == gamecontrol[0][gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game
ch = KEY_ESCAPE; ch = KEY_ESCAPE;
if (currentMenu == &MISC_ChangeLevelDef ||
currentMenu == &MP_OfflineServerDef ||
currentMenu == &MP_ServerDef)
{
if (ch == gamecontrol[0][gc_fire][0]
|| ch == gamecontrol[0][gc_fire][1])
{
if (M_SecretUnlocked(SECRET_ENCORE))
COM_ImmedExecute("add kartencore 1");
return true;
}
}
routine = currentMenu->menuitems[itemOn].itemaction; routine = currentMenu->menuitems[itemOn].itemaction;
// Handle menuitems which need a specific key handling // Handle menuitems which need a specific key handling
@@ -1976,6 +1937,8 @@ void M_Ticker(void)
} }
I_unlock_mutex(ms_ServerList_mutex); I_unlock_mutex(ms_ServerList_mutex);
#endif #endif
CL_TimeoutServerList();
} }
// //
@@ -2732,12 +2695,6 @@ static void M_DrawPauseMenu(void)
} }
#endif #endif
musicdef_t *def;
if (cv_pausesongcredits.value && (def = S_FindMusicCredit(S_MusicName())) != NULL)
{
V_DrawThinString(2, 2, V_SNAPTOTOP|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x1F"" %s", def->source));
}
M_DrawGenericMenu(); M_DrawGenericMenu();
} }
@@ -2868,8 +2825,9 @@ static void M_DrawCenteredMenu(void)
static inline size_t M_StringHeight(const char *string) static inline size_t M_StringHeight(const char *string)
{ {
size_t h = 8, i; size_t h = 8, i;
const size_t strlength = strlen(string);
for (i = 0; i < strlen(string); i++) for (i = 0; i < strlength; i++)
if (string[i] == '\n') if (string[i] == '\n')
h += 8; h += 8;
@@ -3401,6 +3359,8 @@ static void M_DrawTemperature(INT32 x, fixed_t t)
// bounds check // bounds check
if (t > FRACUNIT) if (t > FRACUNIT)
t = FRACUNIT; t = FRACUNIT;
/*else if (t < 0) -- not needed
t = 0;*/
// scale // scale
if (t > 1) if (t > 1)
@@ -4007,7 +3967,6 @@ menudemo_t *demolist = NULL; // Replays that that have been checked to match wit
// Locked behind Lock_search_state // Locked behind Lock_search_state
menudemo_t *demolist_all = NULL; // All replays menudemo_t *demolist_all = NULL; // All replays
size_t demolist_all_size = 0;
boolean replaynamesloaded = false; boolean replaynamesloaded = false;
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
@@ -4040,14 +3999,14 @@ static void ReplayNamesLoadThread(void* userdata)
{ {
Lock_search_state(); Lock_search_state();
size_t demolist_all_size_local = demolist_all_size; size_t demolist_all_size = sizedirmenu;
menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*demolist_all_size_local); menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*sizedirmenu);
memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*demolist_all_size_local); memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*sizedirmenu);
char *replaydirpath = (char*)userdata; char *replaydirpath = (char*)userdata;
Unlock_search_state(); Unlock_search_state();
for (size_t i = 0; i < demolist_all_size_local; ++i) for (size_t i = 0; i < demolist_all_size; ++i)
{ {
if (demolist_all_local[i].type != MD_SUBDIR) if (demolist_all_local[i].type != MD_SUBDIR)
{ {
@@ -4063,9 +4022,9 @@ static void ReplayNamesLoadThread(void* userdata)
Lock_search_state(); Lock_search_state();
if (fastcmp(menupath, replaydirpath) && demolist_all) if (fastcmp(menupath, replaydirpath))
{ {
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*demolist_all_size); memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu);
replaynamesloaded = true; replaynamesloaded = true;
} }
@@ -4199,7 +4158,6 @@ static void PrepReplayList(boolean reset)
Z_Free(demolist_all); Z_Free(demolist_all);
demolist_all = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL); demolist_all = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
demolist_all_size = sizedirmenu;
for (i = 0; i < sizedirmenu; i++) for (i = 0; i < sizedirmenu; i++)
{ {
@@ -4248,7 +4206,6 @@ void M_ReplayHut(INT32 choice)
} }
else if (!demo.inreplayhut) else if (!demo.inreplayhut)
dir_on[menudepthleft] = 0; dir_on[menudepthleft] = 0;
demo.inreplayhut = true; demo.inreplayhut = true;
replayScrollTitle = 0; replayScrollDelay = TICRATE; replayScrollDir = 1; replayScrollTitle = 0; replayScrollDelay = TICRATE; replayScrollDir = 1;
@@ -4340,9 +4297,6 @@ static void M_HandleReplayHutList(INT32 choice)
if (!replaynamesloaded) if (!replaynamesloaded)
return; return;
if (replayqueryfound == 0)
return;
switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE]) switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE])
{ {
case EXT_FOLDER: case EXT_FOLDER:
@@ -4441,140 +4395,136 @@ static void DrawReplayHutReplayInfo(void)
UINT8 *colormap; UINT8 *colormap;
INT32 x, y, w, h; INT32 x, y, w, h;
const menudemo_t *replaydemolist = &demolist[dir_on[menudepthleft]]; switch (demolist[dir_on[menudepthleft]].type)
switch (replaydemolist->type)
{ {
case MD_NOTLOADED: case MD_NOTLOADED:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information..."); V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information...");
break;
case MD_INVALID:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
break;
case MD_SUBDIR:
break; // Can't think of anything to draw here right now
case MD_OUTDATED:
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", demolist[dir_on[menudepthleft]].version));
/* FALLTHRU */
default:
// Draw level stuff
x = 15; y = 15;
// A 160x100 image of the level as entry MAPxxP
//CONS_Printf("%d %s\n", demolist[dir_on[menudepthleft]].map, G_BuildMapName(demolist[dir_on[menudepthleft]].map));
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(demolist[dir_on[menudepthleft]].map)));
if (lumpnum != LUMPERROR)
patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH);
else
patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH);
if (!(demolist[dir_on[menudepthleft]].kartspeed & DF_ENCORE))
V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch);
else
{
w = patch->width;
h = patch->height;
V_DrawSmallScaledPatch(x+(w>>1), y, V_SNAPTOTOP|V_FLIP, patch);
{
static angle_t rubyfloattime = 0;
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, (patch_t *)W_CachePatchName("RUBYICON", PU_PATCH), NULL);
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
}
}
x += 85;
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
{
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
if (title)
{
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
}
}
else
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
INT32 datew = 0;
if (demolist[dir_on[menudepthleft]].date[0] != '\0')
{
datew = V_StringWidth(demolist[dir_on[menudepthleft]].date, 0);
V_DrawThinString(x, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("%s", demolist[dir_on[menudepthleft]].date));
}
if (demolist[dir_on[menudepthleft]].numlaps)
V_DrawThinString(x+datew, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("(%d laps)", demolist[dir_on[menudepthleft]].numlaps));
V_DrawString(x, y+20, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].gametype == GT_RACE ?
va("Race (%s speed)", kartspeed_cons_t[demolist[dir_on[menudepthleft]].kartspeed & ~DF_ENCORE].strvalue) :
"Battle Mode");
if (!demolist[dir_on[menudepthleft]].standings[0].ranking)
{
// No standings were loaded!
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
break; break;
}
case MD_INVALID: V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played."); V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[0].name);
break;
case MD_SUBDIR: if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
break; // Can't think of anything to draw here right now {
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
}
else
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
}
case MD_OUTDATED: if (demolist[dir_on[menudepthleft]].standings[0].timeorscore == (UINT32_MAX-1))
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", replaydemolist->version)); {
/* FALLTHRU */ V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
default: }
// Draw level stuff else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
x = 15; y = 15; {
V_DrawRightAlignedString(x+84, y+40, V_SNAPTOTOP, va("%d'%02d\"%02d",
G_TicsToMinutes(demolist[dir_on[menudepthleft]].standings[0].timeorscore, true),
G_TicsToSeconds(demolist[dir_on[menudepthleft]].standings[0].timeorscore),
G_TicsToCentiseconds(demolist[dir_on[menudepthleft]].standings[0].timeorscore)
));
}
else
{
V_DrawString(x+32, y+40, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[0].timeorscore));
}
// A 160x100 image of the level as entry MAPxxP // Character face!
//CONS_Printf("%d %s\n", replaydemolist->map, G_BuildMapName(replaydemolist->map)); if (demolist[dir_on[menudepthleft]].standings[0].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR)
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(replaydemolist->map))); {
if (lumpnum != LUMPERROR) patch = facewantprefix[demolist[dir_on[menudepthleft]].standings[0].skin];
patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH); colormap = R_GetTranslationColormap(
else demolist[dir_on[menudepthleft]].standings[0].skin,
patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH); demolist[dir_on[menudepthleft]].standings[0].color,
GTC_MENUCACHE);
}
else
{
patch = (patch_t *)W_CachePatchName("M_NOWANT", PU_PATCH);
colormap = R_GetTranslationColormap(
TC_RAINBOW,
demolist[dir_on[menudepthleft]].standings[0].color,
GTC_MENUCACHE);
}
if (!(replaydemolist->kartspeed & DF_ENCORE)) V_DrawMappedPatch(BASEVIDWIDTH-15 - patch->width, y+20, V_SNAPTOTOP, patch, colormap);
V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch);
else
{
w = patch->width;
h = patch->height;
V_DrawSmallScaledPatch(x+(w>>1), y, V_SNAPTOTOP|V_FLIP, patch);
{ break;
static angle_t rubyfloattime = 0;
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, (patch_t *)W_CachePatchName("RUBYICON", PU_PATCH), NULL);
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
}
}
x += 85;
if (mapheaderinfo[replaydemolist->map-1])
{
char *title = G_BuildMapTitle(replaydemolist->map);
if (title)
{
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
}
}
else
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
INT32 datew = 0;
if (replaydemolist->date[0] != '\0')
{
datew = V_StringWidth(replaydemolist->date, 0);
V_DrawThinString(x, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("%s", replaydemolist->date));
}
if (replaydemolist->numlaps)
V_DrawThinString(x+datew, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("(%d laps)", replaydemolist->numlaps));
V_DrawString(x, y+20, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->gametype == GT_RACE ?
va("Race (%s speed)", kartspeed_cons_t[replaydemolist->kartspeed & ~DF_ENCORE].strvalue) :
"Battle Mode");
if (!replaydemolist->standings[0].ranking)
{
// No standings were loaded!
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
break;
}
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->standings[0].name);
if (replaydemolist->gametype == GT_RACE)
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
}
else
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
}
const UINT32 timeorscore = replaydemolist->standings[0].timeorscore;
if (timeorscore == (UINT32_MAX-1))
{
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
}
else if (replaydemolist->gametype == GT_RACE)
{
V_DrawRightAlignedString(x+84, y+40, V_SNAPTOTOP, va("%d'%02d\"%02d",
G_TicsToMinutes(timeorscore, true),
G_TicsToSeconds(timeorscore),
G_TicsToCentiseconds(timeorscore)
));
}
else
{
V_DrawString(x+32, y+40, V_SNAPTOTOP, va("%d", timeorscore));
}
// Character face!
if (replaydemolist->standings[0].skin < numskins && W_CheckNumForName(skins[replaydemolist->standings[0].skin].facewant) != LUMPERROR)
{
patch = facewantprefix[replaydemolist->standings[0].skin];
colormap = R_GetTranslationColormap(
replaydemolist->standings[0].skin,
replaydemolist->standings[0].color,
GTC_MENUCACHE);
}
else
{
patch = (patch_t *)W_CachePatchName("M_NOWANT", PU_PATCH);
colormap = R_GetTranslationColormap(
TC_RAINBOW,
replaydemolist->standings[0].color,
GTC_MENUCACHE);
}
V_DrawMappedPatch(BASEVIDWIDTH-15 - patch->width, y+20, V_SNAPTOTOP, patch, colormap);
break;
} }
} }
@@ -4640,7 +4590,7 @@ static void M_DrawReplayHut(void)
if (i == itemOn) if (i == itemOn)
cursory = localy; cursory = localy;
if ((currentMenu->menuitems[i].status & IT_DISPLAY) == IT_STRING) if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT, currentMenu->menuitems[i].text); V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT, currentMenu->menuitems[i].text);
else else
V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[i].text); V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[i].text);
@@ -4720,7 +4670,8 @@ static void M_DrawReplayHut(void)
} }
// Draw the cursor // Draw the cursor
V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT,
(patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
V_DrawString(currentMenu->x, cursory, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[itemOn].text); V_DrawString(currentMenu->x, cursory, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[itemOn].text);
// Now draw some replay info! // Now draw some replay info!
@@ -4752,38 +4703,34 @@ static void M_DrawReplayStartMenu(void)
M_DrawGenericBackgroundMenu(); M_DrawGenericBackgroundMenu();
const menudemo_t *replaydemolist = &demolist[dir_on[menudepthleft]];
#define STARTY 62-(replayScrollTitle>>1) #define STARTY 62-(replayScrollTitle>>1)
// Draw rankings beyond first // Draw rankings beyond first
for (i = 1; i < MAXPLAYERS && replaydemolist->standings[i].ranking; i++) for (i = 1; i < MAXPLAYERS && demolist[dir_on[menudepthleft]].standings[i].ranking; i++)
{ {
patch_t *patch; patch_t *patch;
UINT8 *colormap; UINT8 *colormap;
V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20, V_SNAPTOTOP|highlightflags, va("%2d", replaydemolist->standings[i].ranking)); V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20, V_SNAPTOTOP|highlightflags, va("%2d", demolist[dir_on[menudepthleft]].standings[i].ranking));
V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->standings[i].name); V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[i].name);
const UINT32 timeorscore = replaydemolist->standings[i].timeorscore; if (demolist[dir_on[menudepthleft]].standings[i].timeorscore == UINT32_MAX-1)
if (timeorscore == UINT32_MAX-1)
V_DrawThinString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, "NO CONTEST"); V_DrawThinString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, "NO CONTEST");
else if (replaydemolist->gametype == GT_RACE) else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
V_DrawRightAlignedString(BASEVIDWIDTH-40, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d'%02d\"%02d", V_DrawRightAlignedString(BASEVIDWIDTH-40, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d'%02d\"%02d",
G_TicsToMinutes(timeorscore, true), G_TicsToMinutes(demolist[dir_on[menudepthleft]].standings[i].timeorscore, true),
G_TicsToSeconds(timeorscore), G_TicsToSeconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore),
G_TicsToCentiseconds(timeorscore) G_TicsToCentiseconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore)
)); ));
else else
V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", timeorscore)); V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[i].timeorscore));
// Character face! // Character face!
if (replaydemolist->standings[i].skin < numskins && W_CheckNumForName(skins[replaydemolist->standings[i].skin].facerank) != LUMPERROR) if (demolist[dir_on[menudepthleft]].standings[i].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR)
{ {
patch = facerankprefix[replaydemolist->standings[i].skin]; patch = facerankprefix[demolist[dir_on[menudepthleft]].standings[i].skin];
colormap = R_GetTranslationColormap( colormap = R_GetTranslationColormap(
replaydemolist->standings[i].skin, demolist[dir_on[menudepthleft]].standings[i].skin,
replaydemolist->standings[i].color, demolist[dir_on[menudepthleft]].standings[i].color,
GTC_MENUCACHE); GTC_MENUCACHE);
} }
else else
@@ -4791,7 +4738,7 @@ static void M_DrawReplayStartMenu(void)
patch = (patch_t *)W_CachePatchName("M_NORANK", PU_PATCH); patch = (patch_t *)W_CachePatchName("M_NORANK", PU_PATCH);
colormap = R_GetTranslationColormap( colormap = R_GetTranslationColormap(
TC_RAINBOW, TC_RAINBOW,
replaydemolist->standings[i].color, demolist[dir_on[menudepthleft]].standings[i].color,
GTC_MENUCACHE); GTC_MENUCACHE);
} }
@@ -4828,10 +4775,10 @@ static void M_DrawReplayStartMenu(void)
V_DrawFill(10, 10, 300, 60, V_SNAPTOTOP|239); V_DrawFill(10, 10, 300, 60, V_SNAPTOTOP|239);
DrawReplayHutReplayInfo(); DrawReplayHutReplayInfo();
V_DrawString(10, 72, V_SNAPTOTOP|highlightflags|V_ALLOWLOWERCASE, replaydemolist->title); V_DrawString(10, 72, V_SNAPTOTOP|highlightflags|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].title);
// Draw a warning prompt if needed // Draw a warning prompt if needed
switch (replaydemolist->addonstatus) switch (demolist[dir_on[menudepthleft]].addonstatus)
{ {
case DFILE_ERROR_CANNOTLOAD: case DFILE_ERROR_CANNOTLOAD:
warning = "Some addons in this replay cannot be loaded.\nYou can watch anyway, but desyncs may occur."; warning = "Some addons in this replay cannot be loaded.\nYou can watch anyway, but desyncs may occur.";
@@ -4860,9 +4807,6 @@ static void M_DrawReplayStartMenu(void)
void M_ResetDemoList(void) void M_ResetDemoList(void)
{ {
Lock_search_state();
replaynamesloaded = false;
Z_Free(demolist_all); Z_Free(demolist_all);
demolist_all = NULL; demolist_all = NULL;
@@ -4870,8 +4814,6 @@ void M_ResetDemoList(void)
demolist = NULL; demolist = NULL;
demo.inreplayhut = false; demo.inreplayhut = false;
Unlock_search_state();
} }
static boolean M_QuitReplayHut(void) static boolean M_QuitReplayHut(void)
@@ -4884,16 +4826,6 @@ static boolean M_QuitReplayHut(void)
return true; return true;
} }
// same as M_QuitReplayHut, but calls M_StopMessage
void M_ReturnToTitleFromError(void)
{
M_StopMessage(0);
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
menuactive = false;
D_StartTitle();
M_ResetDemoList();
}
static void M_HutStartReplay(INT32 choice) static void M_HutStartReplay(INT32 choice)
{ {
(void)choice; (void)choice;
@@ -6258,27 +6190,11 @@ void M_DrawTimeAttackMenu(void)
SHOWMODDEDGAME SHOWMODDEDGAME
const INT32 skinnum = max(cv_chooseskin.value-1, 0); // dont think its needed but better safe than sorry!
const skin_t *skin = &skins[skinnum];
// Character face! // Character face!
if (W_CheckNumForName(skin->facewant) != LUMPERROR) if (W_CheckNumForName(skins[cv_chooseskin.value-1].facewant) != LUMPERROR)
{ {
const INT32 charx = (BASEVIDWIDTH-x - facewantprefix[skinnum]->width); UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor.value, GTC_MENUCACHE);
V_DrawMappedPatch(BASEVIDWIDTH-x - facewantprefix[cv_chooseskin.value-1]->width, y, 0, facewantprefix[cv_chooseskin.value-1], colormap);
UINT8 *colormap = NULL;
colormap = R_GetTranslationColormap(skinnum, cv_playercolor.value, GTC_MENUCACHE);
V_DrawMappedPatch(charx, y, 0, facewantprefix[skinnum], colormap);
// draw stats
// speed
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE);
V_DrawFixedPatch((charx-6) << FRACBITS, (y-5) << FRACBITS, 3*FRACUNIT/2, 0, kp_facenum[min(9, max(1, skin->kartspeed))], colormap);
// weight
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE);
V_DrawFixedPatch((charx+25) << FRACBITS, (y+25) << FRACBITS, 3*FRACUNIT/2, 0, kp_facenum[min(9, max(1, skin->kartweight))], colormap);
// idk if kp_facenum are the best numbers for this case? but works with some scaling lul
} }
for (i = 0; i < currentMenu->numitems; ++i) for (i = 0; i < currentMenu->numitems; ++i)
@@ -6308,7 +6224,7 @@ void M_DrawTimeAttackMenu(void)
} }
else else
{ {
const char *str = ((cv == &cv_chooseskin) ? skin->realname : cv->string); const char *str = ((cv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : cv->string);
INT32 soffset = 40, strw = V_StringWidth(str, 0); INT32 soffset = 40, strw = V_StringWidth(str, 0);
// hack to keep the menu from overlapping the level icon // hack to keep the menu from overlapping the level icon
@@ -6353,12 +6269,10 @@ void M_DrawTimeAttackMenu(void)
{ {
tic_t lap = 0, time = 0; tic_t lap = 0, time = 0;
const recorddata_t *currecord = mainrecords[cv_nextmap.value-1]; if (mainrecords[cv_nextmap.value-1])
if (currecord)
{ {
lap = currecord->lap; lap = mainrecords[cv_nextmap.value-1]->lap;
time = currecord->time; time = mainrecords[cv_nextmap.value-1]->time;
} }
V_DrawFill((BASEVIDWIDTH - vid.scaledwidth)>>1, 78, vid.scaledwidth, 36, 239); V_DrawFill((BASEVIDWIDTH - vid.scaledwidth)>>1, 78, vid.scaledwidth, 36, 239);
@@ -6380,7 +6294,6 @@ void M_DrawTimeAttackMenu(void)
y = currentMenu->y+SP_TimeAttackMenu[i].alphaKey; y = currentMenu->y+SP_TimeAttackMenu[i].alphaKey;
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, SP_TimeAttackMenu[i].text); V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, SP_TimeAttackMenu[i].text);
ncv = (consvar_t *)SP_TimeAttackMenu[i].itemaction; ncv = (consvar_t *)SP_TimeAttackMenu[i].itemaction;
if (SP_TimeAttackMenu[i].status & IT_CV_STRING) if (SP_TimeAttackMenu[i].status & IT_CV_STRING)
{ {
M_DrawTextBox(x + 32, y - 8, MAXPLAYERNAME, 1); M_DrawTextBox(x + 32, y - 8, MAXPLAYERNAME, 1);
@@ -6388,7 +6301,7 @@ void M_DrawTimeAttackMenu(void)
} }
else else
{ {
const char *str = ((ncv == &cv_chooseskin) ? skin->realname : ncv->string); const char *str = ((ncv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : ncv->string);
INT32 soffset = 40, strw = V_StringWidth(str, 0); INT32 soffset = 40, strw = V_StringWidth(str, 0);
// hack to keep the menu from overlapping the level icon // hack to keep the menu from overlapping the level icon
@@ -6893,22 +6806,12 @@ static void M_Connect(INT32 choice)
COM_BufAddText(va("connect node %d\n", serverlist[serverlistsearched[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE]].node)); COM_BufAddText(va("connect node %d\n", serverlist[serverlistsearched[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE]].node));
} }
static void M_ResetServerList(void)
{
serverlistpage = 0;
oldserverlistpage = 0;
serverlistslidex = 0.0f;
memset(serverlistsearched, 0, sizeof(serverlistsearched));
serverlistsearchedcount = 0;
}
static void M_Refresh(INT32 choice) static void M_Refresh(INT32 choice)
{ {
(void)choice; (void)choice;
// first page of servers // first page of servers
M_ResetServerList(); serverlistpage = 0;
CL_UpdateServerList(); CL_UpdateServerList();
@@ -6939,7 +6842,14 @@ static void M_DrawServerCountAndHorizontalBar(void)
break; break;
default: default:
if (serverlistcount > 0) if (serverlistultimatecount > serverlistcount)
{
text = va("%d/%d servers found%.*s",
serverlistcount,
serverlistultimatecount,
I_GetTime() / NEWTICRATE % 4, "...");
}
else if (serverlistcount > 0)
{ {
text = va("%d servers found", serverlistcount); text = va("%d servers found", serverlistcount);
} }
@@ -7123,7 +7033,7 @@ static int ServerListEntryComparator_modified(const void *entry1, const void *en
void M_SortServerList(void) void M_SortServerList(void)
{ {
switch (cv_serversort.value) switch(cv_serversort.value)
{ {
case 0: // Ping. case 0: // Ping.
qs22j(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_time); qs22j(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_time);
@@ -7198,7 +7108,7 @@ static void M_ConnectMenu(INT32 choice)
// we don't request a restart unless the filelist differs // we don't request a restart unless the filelist differs
// first page of servers // first page of servers
M_ResetServerList(); serverlistpage = 0;
CL_UpdateServerList(); CL_UpdateServerList();
@@ -7416,8 +7326,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
patch_t *PictureOfLevel; patch_t *PictureOfLevel;
INT32 x, y, w, i, oldval, trans, dupadjust = (vid.scaledwidth - BASEVIDWIDTH)>>1; INT32 x, y, w, i, oldval, trans, dupadjust = (vid.scaledwidth - BASEVIDWIDTH)>>1;
// so it doesent show in record attack menu if (levellistmode != LLM_RECORDATTACK) // so it doesent show in record attack menu
if (levellistmode != LLM_RECORDATTACK && M_SecretUnlocked(SECRET_ENCORE)) // gotta have it unlocked first ofc
{ {
char encoretoggle[32] = {0}; char encoretoggle[32] = {0};
const char *item1 = gamecontrol[0][gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][0]) : NULL; const char *item1 = gamecontrol[0][gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][0]) : NULL;
@@ -7910,6 +7819,28 @@ static void M_HandleConnectIP(INT32 choice)
// ======================== // ========================
// Tails 03-02-2002 // Tails 03-02-2002
static fixed_t multi_tics;
static state_t *multi_state;
// this is set before entering the MultiPlayer setup menu,
// for either player 1 or 2
static char setupm_name[MAXPLAYERNAME+1];
static textinput_t setupm_input;
static player_t *setupm_player;
static consvar_t *setupm_cvskin;
static consvar_t *setupm_cvcolor;
static consvar_t *setupm_cvname;
static UINT8 setupm_skinxpos;
static INT32 setupm_fakeskin;
static INT32 setupm_fakecolor;
//variables used for other skin select menus
static UINT8 setupm_skinypos;
static INT32 setupm_skinselect;
static boolean setupm_skinlockedselect;
static UINT8 setupm_playernum; //brap
#define SELECTEDSTATSCOUNT skinstatscount[setupm_skinxpos][setupm_skinypos] #define SELECTEDSTATSCOUNT skinstatscount[setupm_skinxpos][setupm_skinypos]
#define LASTSELECTEDSTAT skinstats[setupm_skinxpos][setupm_skinypos][skinstatscount[setupm_skinxpos][setupm_skinypos]] #define LASTSELECTEDSTAT skinstats[setupm_skinxpos][setupm_skinypos][skinstatscount[setupm_skinxpos][setupm_skinypos]]
@@ -8967,6 +8898,9 @@ static void M_DoSetupMultiPlayer(UINT8 pnum)
multi_state = cv_skinselectspin.value == SKINSELECTSPIN_PAIN ? &states[S_KART_PAIN] : &states[mobjinfo[MT_PLAYER].seestate]; multi_state = cv_skinselectspin.value == SKINSELECTSPIN_PAIN ? &states[S_KART_PAIN] : &states[mobjinfo[MT_PLAYER].seestate];
multi_tics = multi_state->tics*FRACUNIT; multi_tics = multi_state->tics*FRACUNIT;
M_TextInputInit(&setupm_input, setupm_name, sizeof(setupm_name));
M_TextInputSetString(&setupm_input, cv_playername.string);
switch (pnum) switch (pnum)
{ {
case 1: case 1:
@@ -8995,9 +8929,6 @@ static void M_DoSetupMultiPlayer(UINT8 pnum)
break; break;
} }
M_TextInputInit(&setupm_input, setupm_name, sizeof(setupm_name));
M_TextInputSetString(&setupm_input, setupm_cvname->string);
setupm_skinxpos = 4; setupm_skinxpos = 4;
setupm_skinypos = 0; setupm_skinypos = 0;
setupm_skinlockedselect = false; setupm_skinlockedselect = false;
@@ -9685,14 +9616,11 @@ static void M_ResetControls(INT32 choice)
// =============== // ===============
//added : 30-01-98: //added : 30-01-98:
#define MAXCOLUMNMODES 12 //max modes displayed in one column
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
static modedesc_t modedescs[MAXMODEDESCS]; static modedesc_t modedescs[MAXMODEDESCS];
static void M_VideoModeMenu(INT32 choice) void M_VideoModeMenu(INT32 choice)
{ {
INT32 i, j, vdup, nummodes, width, height; INT32 i, nummodes, width, height;
const char *desc; const char *desc;
(void)choice; (void)choice;
@@ -9706,54 +9634,30 @@ static void M_VideoModeMenu(INT32 choice)
nummodes = VID_NumModes(); nummodes = VID_NumModes();
// DOS does not skip mode 0, because mode 0 is ALWAYS present // DOS does not skip mode 0, because mode 0 is ALWAYS present
i = 0; for (i = 0; i < nummodes && vidm_nummodes < MAXMODEDESCS; i++)
for (; i < nummodes && vidm_nummodes < MAXMODEDESCS; i++)
{ {
desc = VID_GetModeName(i); desc = VID_GetModeName(i);
if (desc)
{
vdup = 0;
// when a resolution exists both under VGA and VESA, keep the if (!desc)
// VESA mode, which is always a higher modenum continue;
for (j = 0; j < vidm_nummodes; j++)
{
if (fastcmp(modedescs[j].desc, desc))
{
// mode(0): 320x200 is always standard VGA, not vesa
if (modedescs[j].modenum)
{
modedescs[j].modenum = i;
vdup = 1;
if (i == vid.modenum) modedescs[vidm_nummodes].modenum = i;
vidm_selected = j; modedescs[vidm_nummodes].desc = desc;
}
else
vdup = 1;
break; if (i == vid.modenum)
} vidm_selected = vidm_nummodes;
}
if (!vdup) // Pull out the width and height
{ sscanf(desc, "%u%*c%u", &width, &height);
modedescs[vidm_nummodes].modenum = i;
modedescs[vidm_nummodes].desc = desc;
if (i == vid.modenum) // Show resolutions above desktop res as red.
vidm_selected = vidm_nummodes; if (I_CheckAboveDesktopRes(width, height))
modedescs[vidm_nummodes].goodratio = 2;
// Show multiples of 320x200 as green.
else if (SCR_IsAspectCorrect(width, height))
modedescs[vidm_nummodes].goodratio = 1;
// Pull out the width and height vidm_nummodes++;
sscanf(desc, "%u%*c%u", &width, &height);
// Show multiples of 320x200 as green.
if (SCR_IsAspectCorrect(width, height))
modedescs[vidm_nummodes].goodratio = 1;
vidm_nummodes++;
}
}
} }
vidm_column_size = (vidm_nummodes+2) / 3; vidm_column_size = (vidm_nummodes+2) / 3;
@@ -9792,13 +9696,6 @@ static void M_DrawHUDOptions(void)
V_DrawRightAlignedString(x, y, highlightflags, "("); V_DrawRightAlignedString(x, y, highlightflags, "(");
} }
static void M_CameraMenu(INT32 choice)
{
(void)choice;
OP_CamOptionsDef.prevMenu = currentMenu;
M_SetupNextMenu(&OP_CamOptionsDef);
}
static void M_LocalSkinMenu(INT32 choice) static void M_LocalSkinMenu(INT32 choice)
{ {
(void)choice; (void)choice;
@@ -9949,7 +9846,11 @@ static void M_DrawVideoMode(void)
V_DrawString(row, col, highlightflags|MENUCAPS, modedescs[i].desc); V_DrawString(row, col, highlightflags|MENUCAPS, modedescs[i].desc);
// Show multiples of 320x200 as green. // Show multiples of 320x200 as green.
else else
V_DrawString(row, col, ((modedescs[i].goodratio) ? recommendedflags : 0)|MENUCAPS, modedescs[i].desc); {
const UINT8 goodratio = modedescs[i].goodratio;
const INT32 goodflag = ((goodratio == 2) ? warningflags : (goodratio == 1) ? recommendedflags : 0);
V_DrawString(row, col, goodflag|MENUCAPS, modedescs[i].desc);
}
col += 8; col += 8;
if ((i % vidm_column_size) == (vidm_column_size-1)) if ((i % vidm_column_size) == (vidm_column_size-1))
@@ -9973,7 +9874,6 @@ static void M_DrawVideoMode(void)
va("Wait %d second%s", testtime, (testtime > 1) ? "s" : "")); va("Wait %d second%s", testtime, (testtime > 1) ? "s" : ""));
M_CentreText(OP_VideoModeDef.y + 158, M_CentreText(OP_VideoModeDef.y + 158,
"or press ESC to return"); "or press ESC to return");
} }
else else
{ {
@@ -9989,9 +9889,26 @@ static void M_DrawVideoMode(void)
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 138, V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 138,
recommendedflags|MENUCAPS, "Marked modes are recommended."); recommendedflags|MENUCAPS, "Marked modes are recommended.");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 146, V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 146,
highlightflags|MENUCAPS, "Other modes may have visual errors."); warningflags|MENUCAPS, "Marked modes are above Desktop resolution");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 158,
highlightflags|MENUCAPS, "Larger modes may have performance issues."); if (rendermode == render_opengl)
{
#ifdef USE_FBO_OGL
if (!cv_glframebuffer.value)
#endif
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 154,
warningflags|MENUCAPS, "and will have visual errors in OpenGL mode.");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 166,
highlightflags|MENUCAPS, "Other modes may have visual errors.");
}
else
{
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 154,
highlightflags|MENUCAPS, "Other modes may have visual errors.");
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 166,
highlightflags|MENUCAPS, "Larger modes may have performance issues.");
}
} }
// Draw the cursor for the VidMode menu // Draw the cursor for the VidMode menu
+5 -3
View File
@@ -223,6 +223,11 @@ extern menu_t *currentMenu;
extern menu_t MainDef; extern menu_t MainDef;
extern menu_t SP_LoadDef; extern menu_t SP_LoadDef;
#define MAXCOLUMNMODES 12 //max modes displayed in one column
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
extern menu_t OP_VideoModeDef;
void M_VideoModeMenu(INT32 choice);
// Call upon joystick hotplug // Call upon joystick hotplug
void M_SetupJoystickMenu(INT32 choice); void M_SetupJoystickMenu(INT32 choice);
extern menu_t OP_JoystickSetDef; extern menu_t OP_JoystickSetDef;
@@ -301,15 +306,12 @@ void SaturnHud_menu_Onchange(void);
void GameFocus_menu_Onchange (void); void GameFocus_menu_Onchange (void);
void ShowLocalskinMenu_Onchange(void);
#ifdef HWRENDER #ifdef HWRENDER
void M_UpdateOGLMenu(void); void M_UpdateOGLMenu(void);
#endif #endif
void M_ResetDemoList(void); void M_ResetDemoList(void);
void M_ReplayHut(INT32 choice); void M_ReplayHut(INT32 choice);
void M_ReturnToTitleFromError(void);
void M_SetPlaybackMenuPointer(void); void M_SetPlaybackMenuPointer(void);
void Nextmap_OnChange(void); void Nextmap_OnChange(void);
+56 -53
View File
@@ -600,7 +600,7 @@ static menuitem_t OP_MainMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Game Focus Options...", &OP_FocusOptionsDef, 33}, {IT_SUBMENU|IT_STRING, NULL, "Game Focus Options...", &OP_FocusOptionsDef, 33},
{IT_SUBMENU|IT_STRING, NULL, "HUD Options...", &OP_HUDOptionsDef, 46}, {IT_SUBMENU|IT_STRING, NULL, "HUD Options...", &OP_HUDOptionsDef, 46},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 56}, {IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 56},
{IT_SUBMENU|IT_STRING, NULL, "Gameplay Options...", &OP_GameOptionsDef, 66}, {IT_SUBMENU|IT_STRING, NULL, "Gameplay Options...", &OP_GameOptionsDef, 66},
{IT_SUBMENU|IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 76}, {IT_SUBMENU|IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 76},
@@ -610,7 +610,7 @@ static menuitem_t OP_MainMenu[] =
{IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 109}, {IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 109},
{IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 119}, {IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 119},
{IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...", &OP_AccessibilityDef, 132}, {IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...",&OP_AccessibilityDef, 132},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 142}, {IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 142},
{IT_SUBMENU|IT_STRING, NULL, "Bird...", &OP_BirdDef, 152}, {IT_SUBMENU|IT_STRING, NULL, "Bird...", &OP_BirdDef, 152},
@@ -800,7 +800,7 @@ static menuitem_t OP_MouseOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20}, {IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20},
{IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30}, {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousexsens, 40}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousesens, 40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse Y Speed", &cv_mouseysens, 50}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse Y Speed", &cv_mouseysens, 50},
}; };
@@ -1153,6 +1153,13 @@ static menuitem_t OP_SoundAdvancedMenu[] =
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 35}, {IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 35},
#endif #endif
#ifdef HAVE_FLUIDSYNTH
{IT_HEADER, NULL, "MIDI Settings", NULL, NULL, OPENMPT_MENUOFFSET},
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Sound Font File", NULL, &cv_midisoundfontpath, OPENMPT_MENUOFFSET+12},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chorus", NULL, &cv_midichorus, OPENMPT_MENUOFFSET+40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Reverb", NULL, &cv_midireverb, OPENMPT_MENUOFFSET+50},
#endif
{IT_HEADER, NULL, "Misc", NULL, 45}, {IT_HEADER, NULL, "Misc", NULL, 45},
{IT_STRING | IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 55}, {IT_STRING | IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 55},
@@ -1180,6 +1187,11 @@ static const char* OP_SoundAdvancedTooltips[] =
"Which Amiga should be used for .mod playback?", "Which Amiga should be used for .mod playback?",
#endif #endif
"How far should the four channels in .mod be panned?", "How far should the four channels in .mod be panned?",
#endif
#ifdef HAVE_FLUIDSYNTH
"Which MIDI soundfont to use",
"Controls the chorus of MIDI playback\n setting this too high might cause some instruments to be overexposed",
"Controls the reverb of MIDI playback\n setting this too high might cause notes to be drawn out",
#endif #endif
NULL, NULL,
"How many times is the same sound allowed to play at once?\nIf 0 theres no limit.", "How many times is the same sound allowed to play at once?\nIf 0 theres no limit.",
@@ -1325,14 +1337,13 @@ static menuitem_t OP_HUDOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95}, {IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95},
// highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 110 (see M_DrawHUDOptions) // highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 110 (see M_DrawHUDOptions)
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120}, {IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
{IT_STRING | IT_CVAR, NULL, "Show Console Prints in Menu",&cons_consoleprintinmenu, 130},
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 145}, {IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 135},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 155}, {IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 145},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 165}, {IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 155},
}; };
static menuitem_t OP_CamOptionsMenu[] = static menuitem_t OP_CamOptionsMenu[] =
@@ -1646,7 +1657,7 @@ static menuitem_t OP_AccessibilityMenu[] =
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60}, {IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65}, {IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 65},
{IT_HEADER, NULL, "Audio", NULL, 75}, {IT_HEADER, NULL, "Audio", NULL, 75},
@@ -1849,16 +1860,15 @@ static menuitem_t OP_SaturnHudMenu[] =
{IT_STRING|IT_CVAR, NULL, "Player Angle Visual", &cv_showminimapangle, 150}, {IT_STRING|IT_CVAR, NULL, "Player Angle Visual", &cv_showminimapangle, 150},
{IT_STRING|IT_CVAR, NULL, "Music Credits", &cv_songcredits, 160}, {IT_STRING|IT_CVAR, NULL, "Music Credits", &cv_songcredits, 160},
{IT_STRING|IT_CVAR, NULL, "Music Credits on Pause", &cv_pausesongcredits, 165},
{IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 175}, {IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 170},
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 185}, {IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 180},
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 195}, {IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 190},
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 200}, {IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 195},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 210}, {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 205},
}; };
static const char* OP_SaturnHudTooltips[] = static const char* OP_SaturnHudTooltips[] =
@@ -1885,7 +1895,6 @@ static const char* OP_SaturnHudTooltips[] =
"Erratically rotate player icons during spinouts.", "Erratically rotate player icons during spinouts.",
"Visualize the player facing angle.", "Visualize the player facing angle.",
"Show the Music Credits and which style.", "Show the Music Credits and which style.",
"Show the Music Credits while in pause menu.",
"Make the Intermission screen look like in beta versions of Kart!\nEither with background or just the rest.", "Make the Intermission screen look like in beta versions of Kart!\nEither with background or just the rest.",
"Show the Director Toggle prompt when spectating.", "Show the Director Toggle prompt when spectating.",
"Nametag Options.", "Nametag Options.",
@@ -1973,46 +1982,47 @@ static menuitem_t OP_HudOffsetMenu[] =
// absolutely crazy how many people put work into this at this point <3 // absolutely crazy how many people put work into this at this point <3
static menuitem_t OP_SaturnCreditsMenu[] = static menuitem_t OP_SaturnCreditsMenu[] =
{ {
// in no particular order besides me and indev <3
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0}, {IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
{IT_STRING2+IT_SPACE, NULL, "Alug Indev", NULL, 10}, {IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Haya Nepdisk", NULL, 20}, {IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy xyzzy", NULL, 30}, {IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Chearii riomccloud", NULL, 40}, {IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe PAS", NULL, 50}, {IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "$HOME yama", NULL, 60}, {IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Achii scizor300", NULL, 70}, {IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Superjustinbros Lugent", NULL, 80}, {IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100},
{IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150},
{IT_HEADER, NULL, "", NULL, 74}, {IT_HEADER, NULL, "", NULL, 124},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 110}, {IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 120}, {IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 130}, {IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200},
{IT_STRING2+IT_SPACE, NULL, "jin Mompi", NULL, 140}, {IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210},
{IT_STRING2+IT_SPACE, NULL, "Phoenix", NULL, 150},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 130}, {IT_HEADER, NULL, "Special Thanks <3", NULL, 168},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 140}, {IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 178},
{IT_STRING2+IT_SPACE, NULL, "Blankart", NULL, 150}, {IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 188},
{IT_STRING2+IT_SPACE, NULL, "SRB2 Legacy", NULL, 160}, {IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 198},
{IT_STRING2+IT_SPACE, NULL, "SRB2 Classic", NULL, 170},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 190},
{IT_STRING+IT_SPACE, NULL, "", NULL, 228}, // dummy text I {IT_STRING+IT_SPACE, NULL, "", NULL, 198}, // dummy text I
{IT_STRING, NULL, "", NULL, 278}, // dummy text II {IT_STRING, NULL, "", NULL, 258}, // dummy text II
}; };
// sry we dont have space for this anymore :c < now we have again, for now..... TODO: finally stop being a lazy ass and make a cool credits screen // sry we dont have space for this anymore :c
static const char* OP_CreditTooltips[] = /*static const char* OP_CreditTooltips[] =
{ {
// this sucks lol note to self: we need as many NULLs as we have entries in OP_SaturnCreditsMenu - 1 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
"Thanks everyone! <3" "Thanks everyone! <3"
}; };*/
static menuitem_t OP_BirdMenu[] = static menuitem_t OP_BirdMenu[] =
@@ -2182,9 +2192,6 @@ static menuitem_t OP_AdvancedBirdMenu[] =
{IT_STRING | IT_CVAR, NULL, "Fade Back from Grow", &cv_growmusicfade, 20}, {IT_STRING | IT_CVAR, NULL, "Fade Back from Grow", &cv_growmusicfade, 20},
{IT_STRING | IT_CVAR, NULL, "Fade Out Before Respawning", &cv_respawnfademusicout, 30}, {IT_STRING | IT_CVAR, NULL, "Fade Out Before Respawning", &cv_respawnfademusicout, 30},
{IT_STRING | IT_CVAR, NULL, "Fade Back In While Respawning", &cv_respawnfademusicback, 40}, {IT_STRING | IT_CVAR, NULL, "Fade Back In While Respawning", &cv_respawnfademusicback, 40},
{IT_STRING | IT_CVAR, NULL, "Resync Threshold", &cv_music_resync_threshold, 60},
{IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70},
}; };
static const char* OP_AdvancedBirdTooltips[] = static const char* OP_AdvancedBirdTooltips[] =
@@ -2194,8 +2201,6 @@ static const char* OP_AdvancedBirdTooltips[] =
"Fade in music after Grow.", "Fade in music after Grow.",
"Fade out music before respawning.", "Fade out music before respawning.",
"Fade in music while respawning.", "Fade in music while respawning.",
"Threshold for syncing music.",
"Only sync special music.",
}; };
enum enum
@@ -2205,8 +2210,6 @@ enum
fadegrow, fadegrow,
respawnfadeout, respawnfadeout,
respawnfadein, respawnfadein,
syncthreshold,
syncspecialonly,
}; };
menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS]; menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS];
@@ -2619,7 +2622,7 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &O
menu_t OP_AccessibilityDef = DEFAULTSCROLLSTYLE(NULL, OP_AccessibilityMenu, &OP_MainDef, 30, 30, OP_AccessibilityTooltips); menu_t OP_AccessibilityDef = DEFAULTSCROLLSTYLE(NULL, OP_AccessibilityMenu, &OP_MainDef, 30, 30, OP_AccessibilityTooltips);
menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30, OP_SaturnTooltips); menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30, OP_SaturnTooltips);
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 2, OP_CreditTooltips); // OP_CreditTooltips no space :c menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 0, NULL); // OP_CreditTooltips no space :c
menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30, OP_SaturnHudTooltips); menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30, OP_SaturnHudTooltips);
menu_t OP_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30, OP_PlayerDistortTooltips); menu_t OP_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30, OP_PlayerDistortTooltips);
+7 -6
View File
@@ -1693,22 +1693,23 @@ char *M_GetToken(const char *inputString)
} }
const char * M_Ftrim (double f) const char * M_Ftrim(double f)
{ {
static char dig[9];/* "0." + 6 digits (6 is printf's default) */ static char dig[9];/* "0." + 6 digits (6 is printf's default) */
int i; int i;
/* I know I said it's the default, but just in case... */ /* I know I said it's the default, but just in case... */
sprintf(dig, "%.6f", fabs(modf(f, &f))); sprintf(dig, "%.6f", fabs(modf(f, &f)));
/* trim trailing zeroes */ /* trim trailing zeroes */
for (i = strlen(dig)-1; dig[i] == '0'; --i) for (i = strlen(dig)-1; dig[i] == '0'; --i)
; ;
if (dig[i] == '.')/* :NOTHING: */ if (dig[i] == '.')/* :NOTHING: */
return ""; return "";
else
{ dig[i + 1] = '\0';
dig[i + 1] = '\0'; return &dig[1];/* skip the 0 */
return &dig[1];/* skip the 0 */
}
} }
/** Count bits in a number. /** Count bits in a number.
+2 -1
View File
@@ -687,7 +687,8 @@ void T_ContinuousFalling(levelspecthink_t *faller)
// P_SectorCheckWater // P_SectorCheckWater
// //
// Like P_MobjCheckWater, but takes a sector instead of a mobj. // Like P_MobjCheckWater, but takes a sector instead of a mobj.
static fixed_t P_SectorCheckWater(sector_t *analyzesector, sector_t *elevatorsec) static fixed_t P_SectorCheckWater(sector_t *analyzesector,
sector_t *elevatorsec)
{ {
fixed_t watertop; fixed_t watertop;
+3
View File
@@ -272,6 +272,9 @@ extern consvar_t cv_gravity;
void P_RespawnSpecials(void); void P_RespawnSpecials(void);
extern mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
void CalculateDoomednumToMobjtype(void);
mobj_t *P_AllocateMobj(void); mobj_t *P_AllocateMobj(void);
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
+39 -32
View File
@@ -10448,6 +10448,21 @@ void P_PrecipitationEffects(void)
} }
} }
mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
void CalculateDoomednumToMobjtype(void)
{
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++)
{
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX)
{
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i;
}
}
}
// //
// P_RespawnSpecials // P_RespawnSpecials
// //
@@ -10527,11 +10542,9 @@ void P_RespawnSpecials(void)
ss = R_PointInSubsector(x, y); ss = R_PointInSubsector(x, y);
// find which type to spawn // find which type to spawn
for (i = 0; i < NUMMOBJTYPES; i++) i = g_doomednum_to_mobjtype[mthing->type];
if (mthing->type == mobjinfo[i].doomednum)
break;
if (i == NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17 if (i <= MT_NULL || i >= NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
{ {
// 3D Mode start Thing is unlikely to be added to the que, // 3D Mode start Thing is unlikely to be added to the que,
// so don't bother checking for that specific type // so don't bother checking for that specific type
@@ -10972,11 +10985,9 @@ void P_SpawnMapThing(mapthing_t *mthing)
if (objectplacing) if (objectplacing)
{ {
// find which type to spawn // find which type to spawn
for (i = 0; i < NUMMOBJTYPES; i++) i = g_doomednum_to_mobjtype[mthing->type];
if (mthing->type == mobjinfo[i].doomednum)
break;
if (i == NUMMOBJTYPES) if (i <= MT_NULL || i >= NUMMOBJTYPES)
{ {
if (mthing->type == 3328) // 3D Mode start Thing if (mthing->type == 3328) // 3D Mode start Thing
return; return;
@@ -11044,13 +11055,9 @@ void P_SpawnMapThing(mapthing_t *mthing)
} }
// find which type to spawn // find which type to spawn
for (i = 0; i < NUMMOBJTYPES; i++) i = g_doomednum_to_mobjtype[mthing->type];
{
if (mthing->type == mobjinfo[i].doomednum)
break;
}
if (i == NUMMOBJTYPES) if (i <= MT_NULL || i >= NUMMOBJTYPES)
{ {
if (mthing->type == 3328) // 3D Mode start Thing if (mthing->type == 3328) // 3D Mode start Thing
return; return;
@@ -11743,32 +11750,32 @@ ML_NOCLIMB : Direction not controllable
if (mobj->flags & MF_MONITOR) if (mobj->flags & MF_MONITOR)
{ {
// flag for strong/weak random boxes // flag for strong/weak random boxes
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum || if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum || i == MT_SNEAKERTV || i == MT_INV ||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum || i == MT_WHITETV || i == MT_GREENTV ||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum || i == MT_YELLOWTV || i == MT_BLUETV ||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum || i == MT_BLACKTV || i == MT_PITYTV ||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum) i == MT_RECYCLETV || i == MT_MIXUPBOX)
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
} }
else if (
else if (mthing->type != mobjinfo[MT_AXIS].doomednum && i != MT_AXIS &&
mthing->type != mobjinfo[MT_AXISTRANSFER].doomednum && i != MT_AXISTRANSFER &&
mthing->type != mobjinfo[MT_AXISTRANSFERLINE].doomednum && i != MT_AXISTRANSFERLINE &&
mthing->type != mobjinfo[MT_NIGHTSBUMPER].doomednum && i != MT_NIGHTSBUMPER &&
mthing->type != mobjinfo[MT_STARPOST].doomednum) i != MT_STARPOST)
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
} }
if (mthing->options & MTF_OBJECTSPECIAL) if (mthing->options & MTF_OBJECTSPECIAL)
{ {
// flag for strong/weak random boxes // flag for strong/weak random boxes
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum || if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum || i == MT_SNEAKERTV || i == MT_INV ||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum || i == MT_WHITETV || i == MT_GREENTV ||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum || i == MT_YELLOWTV || i == MT_BLUETV ||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum || i == MT_BLACKTV || i == MT_PITYTV ||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum) i == MT_RECYCLETV || i == MT_MIXUPBOX)
mobj->flags2 |= MF2_STRONGBOX; mobj->flags2 |= MF2_STRONGBOX;
// Requires you to be in bonus time to activate // Requires you to be in bonus time to activate
+6 -1
View File
@@ -285,7 +285,7 @@ typedef struct mobj_s
// Info for drawing: position. // Info for drawing: position.
fixed_t x, y, z; fixed_t x, y, z;
fixed_t old_x, old_y, old_z; // position interpolation fixed_t old_x, old_y, old_z; // position interpolation
fixed_t old_z2; // ok guess we need that... fixed_t old_x2, old_y2, old_z2;
// More list: links in sector (if needed) // More list: links in sector (if needed)
struct mobj_s *bnext; struct mobj_s *bnext;
@@ -297,6 +297,7 @@ typedef struct mobj_s
// More drawing info: to determine current sprite. // More drawing info: to determine current sprite.
angle_t angle, pitch, roll; // orientation angle_t angle, pitch, roll; // orientation
angle_t old_angle, old_pitch, old_roll; // orientation interpolation angle_t old_angle, old_pitch, old_roll; // orientation interpolation
angle_t old_angle2, old_pitch2, old_roll2;
angle_t rollangle; angle_t rollangle;
spritenum_t sprite; // used to find patch_t and flip value spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h UINT32 frame; // frame number, plus bits see p_pspr.h
@@ -306,7 +307,9 @@ typedef struct mobj_s
fixed_t spritexscale, spriteyscale; fixed_t spritexscale, spriteyscale;
fixed_t spritexoffset, spriteyoffset; fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale; fixed_t old_spritexscale, old_spriteyscale;
fixed_t old_spritexscale2, old_spriteyscale2;
fixed_t old_spritexoffset, old_spriteyoffset; fixed_t old_spritexoffset, old_spriteyoffset;
fixed_t old_spritexoffset2, old_spriteyoffset2;
INT16 lightlevel; // Add to sector lightlevel, -255 - 255 INT16 lightlevel; // Add to sector lightlevel, -255 - 255
fixed_t realxscale, realyscale; // funn-E streeetch fixed_t realxscale, realyscale; // funn-E streeetch
@@ -317,6 +320,7 @@ typedef struct mobj_s
//sloperollangle //sloperollangle
angle_t sloperoll, slopepitch; angle_t sloperoll, slopepitch;
angle_t old_sloperoll, old_slopepitch; angle_t old_sloperoll, old_slopepitch;
angle_t old_sloperoll2, old_slopepitch2;
angle_t pitch_sprite, roll_sprite; angle_t pitch_sprite, roll_sprite;
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@@ -391,6 +395,7 @@ typedef struct mobj_s
fixed_t scale; fixed_t scale;
fixed_t old_scale; // interpolation fixed_t old_scale; // interpolation
fixed_t old_scale2;
fixed_t destscale; fixed_t destscale;
fixed_t scalespeed; fixed_t scalespeed;
-19
View File
@@ -1965,21 +1965,6 @@ FUNCINLINE static ATTRINLINE player_t *LoadPlayer(UINT32 player)
// Loads a mobj_t from a save game // Loads a mobj_t from a save game
// //
static mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
static void CalculateDoomednumToMobjtype(void)
{
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++)
{
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX)
{
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i;
}
}
}
static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker) static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
{ {
mobj_t *mobj; mobj_t *mobj;
@@ -2879,10 +2864,6 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
if (READUINT32(save->p) != ARCHIVEBLOCK_THINKERS) if (READUINT32(save->p) != ARCHIVEBLOCK_THINKERS)
I_Error("Bad $$$.sav at archive block Thinkers"); I_Error("Bad $$$.sav at archive block Thinkers");
// Pre-calculate this lookup, because it was wasting
// a shit ton of time loading mobj thinkers.
CalculateDoomednumToMobjtype();
// remove all the current thinkers // remove all the current thinkers
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = next) for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = next)
{ {
+10 -4
View File
@@ -680,11 +680,11 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat)
if (i == numlevelflats) if (i == numlevelflats)
{ {
// store the name // store the name
strlcpy(levelflat->name, flatname, sizeof(levelflat->name)); strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strupr(levelflat->name); strupr(levelflat->name);
// store the flat lump number // store the flat lump number
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name); levelflat->lumpnum = R_GetFlatNumForName(flatname);
levelflat->baselumpnum = LUMPERROR; levelflat->baselumpnum = LUMPERROR;
P_CheckCyanFlat(levelflat); P_CheckCyanFlat(levelflat);
@@ -727,11 +727,11 @@ INT32 P_AddLevelFlatRuntime(const char *flatname)
levelflat = levelflats+i; levelflat = levelflats+i;
// store the name // store the name
strlcpy(levelflat->name, flatname, sizeof(levelflat->name)); strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strupr(levelflat->name); strupr(levelflat->name);
// store the flat lump number // store the flat lump number
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name); levelflat->lumpnum = R_GetFlatNumForName(flatname);
levelflat->baselumpnum = LUMPERROR; levelflat->baselumpnum = LUMPERROR;
P_CheckCyanFlat(levelflat); P_CheckCyanFlat(levelflat);
@@ -812,6 +812,8 @@ static void P_LoadSectors(UINT8 *data)
ss->tag = SHORT(ms->tag); ss->tag = SHORT(ms->tag);
ss->flags |= SF_FLIPSPECIAL_FLOOR; ss->flags |= SF_FLIPSPECIAL_FLOOR;
ss->soundorg.thinker.function = (actionf_p1)P_MobjThinker;
} }
// set the sky flat num // set the sky flat num
@@ -2861,6 +2863,10 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
P_ResetDynamicSlopes(); P_ResetDynamicSlopes();
// Pre-calculate this lookup, because it was wasting
// a shit ton of time loading mobj thinkers.
CalculateDoomednumToMobjtype();
P_SpawnMapThings(); P_SpawnMapThings();
P_SpawnEmblems(!fromnetsave); P_SpawnEmblems(!fromnetsave);
+117 -7
View File
@@ -53,7 +53,7 @@ mobj_t *skyboxmo[2] = {};
#define MAXFLATSIZE (2048<<FRACBITS) #define MAXFLATSIZE (2048<<FRACBITS)
/** Animated texture definition. /** Animated texture definition.
* Used for loading an ANIMATED lump from a wad. * Used for ::harddefs and for loading an ANIMATED lump from a wad.
* *
* Animations are defined by the first and last frame (i.e., flat or texture). * Animations are defined by the first and last frame (i.e., flat or texture).
* The animation sequence uses all flats between the start and end entry, in * The animation sequence uses all flats between the start and end entry, in
@@ -97,6 +97,104 @@ anim_t *lastanim = NULL;
anim_t *anims = NULL; /// \todo free leak anim_t *anims = NULL; /// \todo free leak
static size_t maxanims; static size_t maxanims;
//
// P_InitPicAnims
//
/** Hardcoded animation sequences.
* Used if no ANIMATED lump is found in a loaded wad.
*/
static animdef_t harddefs[] =
{
// flat animations.
{false, "LITEY3", "LITEY1", 4},
{false, "FWATER16", "FWATER1", 4},
{false, "BWATER16", "BWATER01", 4},
{false, "LWATER16", "LWATER1", 4},
{false, "WATER7", "WATER0", 4},
{false, "LAVA4", "LAVA1", 8},
{false, "DLAVA4", "DLAVA1", 8},
{false, "RLAVA8", "RLAVA1", 8},
{false, "LITER3", "LITER1", 8},
{false, "SURF08", "SURF01", 4},
{false, "CHEMG16", "CHEMG01", 4}, // THZ Chemical gunk
{false, "GOOP16", "GOOP01", 4}, // Green chemical gunk
{false, "OIL16", "OIL01", 4}, // Oil
{false, "THZBOXF4", "THZBOXF1", 2}, // Moved up with the flats
{false, "ALTBOXF4", "ALTBOXF1", 2},
{false, "LITEB3", "LITEB1", 4},
{false, "LITEN3", "LITEN1", 4},
{false, "ACZRFL1H", "ACZRFL1A", 4},
{false, "ACZRFL2H", "ACZRFL2A", 4},
{false, "EGRIDF3", "EGRIDF1", 4},
{false, "ERZFAN4", "ERZFAN1", 1},
{false, "ERZFANR4", "ERZFANR1", 1},
{false, "DISCO4", "DISCO1", 15},
// animated textures
{true, "GFALL4", "GFALL1", 2}, // Short waterfall
{true, "CFALL4", "CFALL1", 2}, // Long waterfall
{true, "TFALL4", "TFALL1", 2}, // THZ Chemical fall
{true, "AFALL4", "AFALL1", 2}, // Green Chemical fall
{true, "QFALL4", "QFALL1", 2}, // Quicksand fall
{true, "Q2FALL4", "Q2FALL1", 2},
{true, "Q3FALL4", "Q3FALL1", 2},
{true, "Q4FALL4", "Q4FALL1", 2},
{true, "Q5FALL4", "Q5FALL1", 2},
{true, "Q6FALL4", "Q6FALL1", 2},
{true, "Q7FALL4", "Q7FALL1", 2},
{true, "LFALL4", "LFALL1", 2},
{true, "MFALL4", "MFALL1", 2},
{true, "OFALL4", "OFALL1", 2},
{true, "DLAVA4", "DLAVA1", 8},
{true, "ERZLASA2", "ERZLASA1", 1},
{true, "ERZLASB4", "ERZLASB1", 1},
{true, "ERZLASC4", "ERZLASC1", 1},
{true, "THZBOX04", "THZBOX01", 2},
{true, "ALTBOX04", "ALTBOX01", 2},
{true, "SFALL4", "SFALL1", 4}, // Lava fall
{true, "RVZFALL8", "RVZFALL1", 4},
{true, "BFALL4", "BFALL1", 2}, // HPZ waterfall
{true, "GREYW3", "GREYW1", 4},
{true, "BLUEW3", "BLUEW1", 4},
{true, "COMP6", "COMP4", 4},
{true, "RED3", "RED1", 4},
{true, "YEL3", "YEL1", 4},
{true, "ACWRFL1D", "ACWRFL1A", 1},
{true, "ACWRFL2D", "ACWRFL2A", 1},
{true, "ACWRFL3D", "ACWRFL3A", 1},
{true, "ACWRFL4D", "ACWRFL4A", 1},
{true, "ACWRP1D", "ACWRP1A", 1},
{true, "ACWRP2D", "ACWRP2A", 1},
{true, "ACZRP1D", "ACZRP1A", 1},
{true, "ACZRP2D", "ACZRP2A", 1},
{true, "OILFALL4", "OILFALL1", 2},
{true, "SOLFALL4", "SOLFALL1", 2},
{true, "DOWN1C", "DOWN1A", 4},
{true, "DOWN2C", "DOWN2A", 4},
{true, "DOWN3D", "DOWN3A", 4},
{true, "DOWN4C", "DOWN4A", 4},
{true, "DOWN5C", "DOWN5A", 4},
{true, "UP1C", "UP1A", 4},
{true, "UP2C", "UP2A", 4},
{true, "UP3D", "UP3A", 4},
{true, "UP4C", "UP4A", 4},
{true, "UP5C", "UP5A", 4},
{true, "EGRID3", "EGRID1", 4},
{true, "ERFANW4", "ERFANW1", 1},
{true, "ERFANX4", "ERFANX1", 1},
{true, "DISCOD4", "DISCOD1", 15},
{true, "DANCE4", "DANCE1", 8},
{true, "SKY135", "SKY132", 2},
{true, "APPLMS4", "APPLMS1", 2},
{true, "APBOXW3", "APBOXW1", 2},
{true, "ERZLAZC4", "ERZLAZC1", 4},
// End of line
{ -1, "", "", 0},
};
// Animating line specials // Animating line specials
// Init animated textures // Init animated textures
@@ -110,7 +208,7 @@ void P_ParseAnimationDefintion(SINT8 istexture);
/** Sets up texture and flat animations. /** Sets up texture and flat animations.
* *
* Converts an ::animdef_t array loaded from a lump into * Converts an ::animdef_t array loaded from ::harddefs or a lump into
* ::anim_t format. * ::anim_t format.
* *
* Issues an error if any animation cycles are invalid. * Issues an error if any animation cycles are invalid.
@@ -156,9 +254,7 @@ void P_InitPicAnims(void)
{ {
memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
animdefs[i].endname[8] = '\0';
memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes
animdefs[i].startname[8] = '\0';
memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
} }
@@ -179,6 +275,11 @@ void P_InitPicAnims(void)
strncpy(animdefs[maxanims].startname, "", 9); strncpy(animdefs[maxanims].startname, "", 9);
animdefs[maxanims].speed = 0; animdefs[maxanims].speed = 0;
} }
else
{
animdefs = harddefs;
for (maxanims = 0; animdefs[maxanims].istexture != -1; maxanims++);
}
if (anims) if (anims)
free(anims); free(anims);
@@ -217,7 +318,10 @@ void P_InitPicAnims(void)
animdefs[i].startname, animdefs[i].endname); animdefs[i].startname, animdefs[i].endname);
} }
lastanim->speed = LONG(animdefs[i].speed); if (animdefs == harddefs)
lastanim->speed = animdefs[i].speed;
else
lastanim->speed = LONG(animdefs[i].speed);
lastanim++; lastanim++;
} }
@@ -226,7 +330,8 @@ void P_InitPicAnims(void)
// Clear animdefs now that we're done with it. // Clear animdefs now that we're done with it.
// We'll only be using anims from now on. // We'll only be using anims from now on.
Z_Free(animdefs); if (animdefs != harddefs)
Z_Free(animdefs);
animdefs = NULL; animdefs = NULL;
} }
@@ -3881,7 +3986,12 @@ DoneSection2:
player->tossdelay = 3; player->tossdelay = 3;
} }
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (player->laps >= (unsigned)cv_numlaps.value) if (player->laps >= (unsigned)cv_numlaps.value)
{ {
if (P_IsLocalPlayer(player)) if (P_IsLocalPlayer(player))
+136 -146
View File
@@ -78,6 +78,7 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
mo->momy += FixedMul(move, FINESINE(angle)); mo->momy += FixedMul(move, FINESINE(angle));
} }
// //
// P_InstaThrust // P_InstaThrust
// Moves the given origin along a given angle instantly. // Moves the given origin along a given angle instantly.
@@ -238,11 +239,10 @@ void P_GiveEmerald(boolean spawnObj)
if (spawnObj) if (spawnObj)
{ {
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i]) if (playeringame[i])
P_SetMobjState(P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD), P_SetMobjState(P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD),
mobjinfo[MT_GOTEMERALD].spawnstate + em); mobjinfo[MT_GOTEMERALD].spawnstate + em);
}
} }
} }
@@ -352,9 +352,9 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
player->mo->z++; player->mo->z++;
if (player->mo->eflags & MFE_UNDERWATER) if (player->mo->eflags & MFE_UNDERWATER)
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT, 2600*FRACUNIT), false); P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false);
else else
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT, 10*FRACUNIT), false); P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false);
} }
ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); // SRB2kart ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); // SRB2kart
@@ -619,11 +619,11 @@ boolean P_EndingMusic(player_t *player)
// Check for if this is valid or not // Check for if this is valid or not
if (splitscreen) if (splitscreen)
{ {
for (UINT8 i = 0; i <= splitscreen; i++) if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER))
{ || (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER))
if (!(players[displayplayers[i]].exiting || (players[displayplayers[i]].pflags & PF_TIMEOVER))) || ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER)))
return false; || ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER)))))
} return false;
bestlocalplayer = &players[displayplayers[0]]; bestlocalplayer = &players[displayplayers[0]];
bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : getPlayerPos(&players[displayplayers[0]])); bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : getPlayerPos(&players[displayplayers[0]]));
@@ -703,74 +703,71 @@ void P_RestoreMusic(player_t *player)
// Event - Level Start // Event - Level Start
if (leveltime < MUSICSTARTTIME) if (leveltime < MUSICSTARTTIME)
{
S_StartMapMusic(); S_StartMapMusic();
return; else // see also where time overs are handled - search for "lives = 2" in this file
}
// see also where time overs are handled - search for "lives = 2" in this file
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen)
{ {
INT32 bestlocaltimer = 1; INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen)
{
INT32 bestlocaltimer = 1;
#define setbests(p) \ #define setbests(p) \
if (players[p].playerstate == PST_LIVE) \ if (players[p].playerstate == PST_LIVE) \
{ \ { \
if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \ if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \
{ wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \ { wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \ else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \ { wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
} }
setbests(displayplayers[0]);
setbests(displayplayers[0]); setbests(displayplayers[1]);
setbests(displayplayers[1]); if (splitscreen > 1)
if (splitscreen > 1) setbests(displayplayers[2]);
setbests(displayplayers[2]); if (splitscreen > 2)
if (splitscreen > 2) setbests(displayplayers[3]);
setbests(displayplayers[3]);
#undef setbests #undef setbests
}
else
{
if (player->playerstate == PST_LIVE)
{
if (player->kartstuff[k_growshrinktimer] > 1)
wantedmus = 2;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
} }
}
// Item - Grow
if (wantedmus == 2 && cv_growmusic.value == 1)
{
S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value == 1)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else
{
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
position = mapmusic.resume;
else else
position = mapmusic.position; {
if (player->playerstate == PST_LIVE)
{
if (player->kartstuff[k_growshrinktimer] > 1)
wantedmus = 2;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
}
}
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn()); // Item - Grow
S_ClearRestoreMusicFadeInCvar(); if (wantedmus == 2 && cv_growmusic.value == 1)
mapmusic.resume = 0; {
S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value == 1)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else
{
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
position = mapmusic.resume;
else
position = mapmusic.position;
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar();
mapmusic.resume = 0;
}
} }
} }
@@ -974,18 +971,7 @@ fixed_t P_GetPlayerHeight(player_t *player)
// //
fixed_t P_GetPlayerSpinHeight(player_t *player) fixed_t P_GetPlayerSpinHeight(player_t *player)
{ {
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale), 2*FRACUNIT/3); return FixedMul(FixedMul(player->mo->info->height, player->mo->scale),2*FRACUNIT/3);
}
//
// P_GetLocalPlayerNumForNum
//
// Returns the player number
// on the local machine for given number.
//
INT32 P_GetLocalPlayerNumForNum(UINT8 pnum)
{
return (pnum == 0 ? consoleplayer : displayplayers[pnum]);
} }
// //
@@ -999,6 +985,17 @@ player_t *P_GetLocalPlayerForNum(UINT8 pnum)
return (&players[P_GetLocalPlayerNumForNum(pnum)]); return (&players[P_GetLocalPlayerNumForNum(pnum)]);
} }
//
// P_GetLocalPlayerNumForNum
//
// Returns the player number
// on the local machine for given number.
//
INT32 P_GetLocalPlayerNumForNum(UINT8 pnum)
{
return (pnum == 0 ? consoleplayer : displayplayers[pnum]);
}
INT32 P_GetLocalPlayerNumForPlayer(const player_t *player) INT32 P_GetLocalPlayerNumForPlayer(const player_t *player)
{ {
for (UINT8 i = 0; i <= splitscreen; i++) for (UINT8 i = 0; i <= splitscreen; i++)
@@ -1025,9 +1022,7 @@ boolean P_IsLocalPlayer(const player_t *player)
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= splitscreen; i++)
{ {
if (player == P_GetLocalPlayerForNum(i)) if (player == P_GetLocalPlayerForNum(i))
{
return true; return true;
}
} }
return false; return false;
@@ -1046,9 +1041,7 @@ boolean P_IsLocalPlayerNum(UINT8 pnum)
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= splitscreen; i++)
{ {
if (pnum == P_GetLocalPlayerNumForNum(i)) if (pnum == P_GetLocalPlayerNumForNum(i))
{
return true; return true;
}
} }
return false; return false;
@@ -1076,9 +1069,7 @@ boolean P_IsDisplayPlayer(const player_t *player)
} }
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{
return true; return true;
}
} }
return false; return false;
@@ -1238,20 +1229,19 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
mobj->flags &= ~MF_DONTENCOREMAP; mobj->flags &= ~MF_DONTENCOREMAP;
// Copy interpolation data :) // Copy interpolation data :)
// old_x - mobj->momx - hack to preserve vanilla look ghost->old_x = mobj->old_x2;
ghost->old_x = mobj->old_x - mobj->momx; ghost->old_y = mobj->old_y2;
ghost->old_y = mobj->old_y - mobj->momy; ghost->old_z = mobj->old_z2;
ghost->old_z = mobj->old_z2; // Slopes..... ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2);
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle : mobj->old_angle); ghost->old_pitch = mobj->old_pitch2;
ghost->old_pitch = mobj->old_pitch; ghost->old_roll = mobj->old_roll2;
ghost->old_roll = mobj->old_roll; ghost->old_sloperoll = mobj->old_sloperoll2;
ghost->old_sloperoll = mobj->old_sloperoll; ghost->old_slopepitch = mobj->old_slopepitch2;
ghost->old_slopepitch = mobj->old_slopepitch; ghost->old_scale = mobj->old_scale2;
ghost->old_scale = mobj->old_scale; ghost->old_spritexscale = mobj->old_spritexscale2;
ghost->old_spritexscale = mobj->old_spritexscale; ghost->old_spriteyscale = mobj->old_spriteyscale2;
ghost->old_spriteyscale = mobj->old_spriteyscale; ghost->old_spritexoffset = mobj->old_spritexoffset2;
ghost->old_spritexoffset = mobj->old_spritexoffset; ghost->old_spriteyoffset = mobj->old_spriteyoffset2;
ghost->old_spriteyoffset = mobj->old_spriteyoffset;
return ghost; return ghost;
} }
@@ -1265,9 +1255,7 @@ void P_DoPlayerExit(player_t *player)
if (player->exiting || mapreset) if (player->exiting || mapreset)
return; return;
const boolean islocalplayer = P_IsLocalPlayer(player); if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
if (islocalplayer && (!player->spectator && !demo.playback))
legitimateexit = true; legitimateexit = true;
if (player->griefstrikes > 0) if (player->griefstrikes > 0)
@@ -1282,7 +1270,7 @@ void P_DoPlayerExit(player_t *player)
{ {
const int soundid = K_IsPlayerLosing(player) ? sfx_klose: sfx_kwin; // fix godjjsa win sounds const int soundid = K_IsPlayerLosing(player) ? sfx_klose: sfx_kwin; // fix godjjsa win sounds
if (islocalplayer) if (P_IsLocalPlayer(player))
{ {
sfxenum_t sfx_id = K_GetMobjSkin(player->mo)->soundsid[S_sfx[soundid].skinsound]; sfxenum_t sfx_id = K_GetMobjSkin(player->mo)->soundsid[S_sfx[soundid].skinsound];
S_StartSound(NULL, sfx_id); S_StartSound(NULL, sfx_id);
@@ -1336,13 +1324,12 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL) if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue; continue;
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) > topheight) if (mo->z + (mo->height/2) > topheight)
continue; continue;
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) < bottomheight) if (mo->z + (mo->height/2) < bottomheight)
continue; continue;
@@ -1373,13 +1360,12 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + flipoffset > topheight) if (mo->z + flipoffset > topheight)
continue; continue;
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) + flipoffset < bottomheight) if (mo->z + (mo->height/2) + flipoffset < bottomheight)
continue; continue;
@@ -1561,12 +1547,13 @@ static void P_CheckBouncySectors(player_t *player)
if (top) if (top)
{ {
fixed_t newmom; fixed_t newmom;
pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) // Hit top pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
slope = *rover->t_slope; slope = *rover->t_slope;
else // Hit bottom } else { // Hit bottom
slope = *rover->b_slope; slope = *rover->b_slope;
}
momentum.x = player->mo->momx; momentum.x = player->mo->momx;
momentum.y = player->mo->momy; momentum.y = player->mo->momy;
@@ -1657,8 +1644,7 @@ static void P_CheckQuicksand(player_t *player)
for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next) for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next)
{ {
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS)) continue;
continue;
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
@@ -1716,8 +1702,10 @@ static void P_CheckInvincibilityTimer(player_t *player)
{ {
if (!player->powers[pw_super]) if (!player->powers[pw_super])
{ {
player->mo->color = player->skincolor; {
G_GhostAddColor((INT32)(player - players), GHC_NORMAL); player->mo->color = player->skincolor;
G_GhostAddColor((INT32) (player - players), GHC_NORMAL);
}
// If you had a shield, restore its visual significance // If you had a shield, restore its visual significance
P_SpawnShieldOrb(player); P_SpawnShieldOrb(player);
@@ -1742,7 +1730,7 @@ static void P_DoBubbleBreath(player_t *player)
else else
zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4)); zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4));
if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE))) if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator)
return; return;
if (P_RandomChance(FRACUNIT/16)) if (P_RandomChance(FRACUNIT/16))
@@ -1756,6 +1744,9 @@ static void P_DoBubbleBreath(player_t *player)
bubble->destscale = player->mo->scale; bubble->destscale = player->mo->scale;
P_SetScale(bubble, bubble->destscale); P_SetScale(bubble, bubble->destscale);
} }
//if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles
//return;
} }
// //
@@ -1868,10 +1859,10 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
if (!P_CheckSight(player->mo, mo2)) if (!P_CheckSight(player->mo, mo2))
continue; // if your psychic powers can't "see" it don't bother continue; // if your psychic powers can't "see" it don't bother
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
if (mo2->health > 0) if (mo2->health > 0)
{ {
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
P_Thrust(mo2, an, thrust); P_Thrust(mo2, an, thrust);
if (mo2->type == MT_GOLDBUZZ || mo2->type == MT_REDBUZZ) if (mo2->type == MT_GOLDBUZZ || mo2->type == MT_REDBUZZ)
@@ -1921,7 +1912,7 @@ static void P_3dMovement(player_t *player)
if (analogmove) if (analogmove)
{ {
movepushangle = (cmd->angleturn << TICCMD_REDUCE); movepushangle = (cmd->angleturn<<16 /* not FRACBITS */);
} }
else else
{ {
@@ -2021,17 +2012,12 @@ static void P_3dMovement(player_t *player)
// The rest is unaffected. // The rest is unaffected.
angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection; angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection;
if (player->mo->standingslope->zdelta < 0) // Direction goes down, so thrustangle needs to face toward if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward
{ if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) {
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270)
{
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
} }
} } else { // Direction goes up, so thrustangle needs to face away
else // Direction goes up, so thrustangle needs to face away if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) {
{
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270)
{
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
} }
} }
@@ -2086,7 +2072,7 @@ static void P_SpectatorMovement(player_t *player)
{ {
ticcmd_t *cmd = &player->cmd; ticcmd_t *cmd = &player->cmd;
player->mo->angle = (angle_t)(cmd->angleturn << TICCMD_REDUCE); player->mo->angle = (angle_t)(cmd->angleturn<<16 /* not FRACBITS */);
ticruned++; ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED)) if (!(cmd->angleturn & TICCMD_RECEIVED))
@@ -2114,6 +2100,10 @@ static void P_SpectatorMovement(player_t *player)
// Quake-style flying spectators :D // Quake-style flying spectators :D
player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming)); player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming));
} }
/*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
{
P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*mapobjectscale);
}*/
} }
void P_BlackOw(player_t *player) void P_BlackOw(player_t *player)
@@ -2288,7 +2278,7 @@ static void P_MovePlayer(player_t *player)
{ {
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames. // KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced. // Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
angle_diff = cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE); angle_diff = cmd->angleturn - (player->mo->angle>>16);
max_left_turn = player->lturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS]; max_left_turn = player->lturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
max_right_turn = player->rturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS]; max_right_turn = player->rturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
@@ -2301,18 +2291,18 @@ static void P_MovePlayer(player_t *player)
else else
{ {
// Try to keep normal turning as accurate to 1.0.1 as possible to reduce replay desyncs. // Try to keep normal turning as accurate to 1.0.1 as possible to reduce replay desyncs.
player->mo->angle = cmd->angleturn << TICCMD_REDUCE; player->mo->angle = cmd->angleturn<<16;
add_delta = false; add_delta = false;
} }
//CONS_Printf("applied turn: %d\n", angle_diff); //CONS_Printf("applied turn: %d\n", angle_diff);
if (add_delta) { if (add_delta) {
player->mo->angle += angle_diff << TICCMD_REDUCE; player->mo->angle += angle_diff<<16;
player->mo->angle &= ~0xFFFF; // Try to keep the turning somewhat similar to how it was before? player->mo->angle &= ~0xFFFF; // Try to keep the turning somewhat similar to how it was before?
//CONS_Printf("leftover turn (%s): %5d or %4d%%\n", //CONS_Printf("leftover turn (%s): %5d or %4d%%\n",
// player_names[player-players], // player_names[player-players],
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)), // (INT16) (cmd->angleturn - (player->mo->angle>>16)),
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)) * 100 / (angle_diff ? angle_diff : 1)); // (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ? angle_diff : 1));
} }
} }
@@ -2742,9 +2732,6 @@ boolean P_LookForEnemies(player_t *player)
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING))) if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
continue; // not a valid enemy continue; // not a valid enemy
if (mo->type == MT_PLAYER) // Don't chase after other players!
continue;
if (mo->health <= 0) // dead if (mo->health <= 0) // dead
continue; continue;
@@ -2772,6 +2759,9 @@ boolean P_LookForEnemies(player_t *player)
&& abs(player->mo->y-mo->y) > player->mo->radius)) && abs(player->mo->y-mo->y) > player->mo->radius))
continue; // not in your 2d plane continue; // not in your 2d plane
if (mo->type == MT_PLAYER) // Don't chase after other players!
continue;
if (closestmo && P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y), if (closestmo && P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y),
player->mo->z-mo->z) > P_AproxDistance(P_AproxDistance(player->mo->x-closestmo->x, player->mo->z-mo->z) > P_AproxDistance(P_AproxDistance(player->mo->x-closestmo->x,
player->mo->y-closestmo->y), player->mo->z-closestmo->z)) player->mo->y-closestmo->y), player->mo->z-closestmo->z))
@@ -3177,7 +3167,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
lang = cam->localangle; lang = cam->localangle;
laim = cam->localaiming; laim = cam->localaiming;
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE); cmd->angleturn = (INT16)(lang >> 16);
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
const boolean analogjoystickmove = cv_usejoystick[num].value && !Joystick[num].bGamepadStyle; const boolean analogjoystickmove = cv_usejoystick[num].value && !Joystick[num].bGamepadStyle;
@@ -3273,7 +3263,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
axis = JoyAxis(AXISLOOK, forplayer); axis = JoyAxis(AXISLOOK, forplayer);
laim += (mousey<<19)*player_invert; laim += (mlooky<<19)*player_invert;
if (InputDown(gc_lookup, forplayer) || (usejoystick && axis < 0)) if (InputDown(gc_lookup, forplayer) || (usejoystick && axis < 0))
{ {
@@ -3312,7 +3302,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
} }
mousex = mousey = 0; mousex = mousey = mlooky = 0;
if (forward > MAXPLMOVE) if (forward > MAXPLMOVE)
forward = MAXPLMOVE; forward = MAXPLMOVE;
@@ -3330,7 +3320,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->sidemove = (SINT8)(cmd->sidemove + side); cmd->sidemove = (SINT8)(cmd->sidemove + side);
} }
lang += (cmd->angleturn << TICCMD_REDUCE); lang += (cmd->angleturn << 16);
cam->localangle = lang; cam->localangle = lang;
if (!cam->reset_aiming) if (!cam->reset_aiming)
@@ -3360,7 +3350,7 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
cam->aiming = cmd->aiming << FRACBITS; cam->aiming = cmd->aiming << FRACBITS;
} }
cam->angle = cmd->angleturn << TICCMD_REDUCE; cam->angle = cmd->angleturn << 16;
// camera movement: // camera movement:
if (!cam->button_a_held) if (!cam->button_a_held)
@@ -3840,7 +3830,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// Sometimes stale ticcmds send a weird angle at the start of the race. // Sometimes stale ticcmds send a weird angle at the start of the race.
// P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here. // P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here.
if (cv_demoangturn.value && leveltime > starttime) if (cv_demoangturn.value && leveltime > starttime)
focusangle = player->cmd.angleturn << TICCMD_REDUCE; focusangle = player->cmd.angleturn << 16;
else else
focusangle = mo->angle; // Just use something known sane. focusangle = mo->angle; // Just use something known sane.
focusaiming = 0; focusaiming = 0;
+3 -5
View File
@@ -515,15 +515,13 @@ const INT32 checkcoord[12][4] =
static boolean R_CheckBBox(const fixed_t *bspcoord) static boolean R_CheckBBox(const fixed_t *bspcoord)
{ {
angle_t angle1, angle2; angle_t angle1, angle2;
INT32 sx1, sx2; INT32 sx1, sx2, boxpos;
const INT32* check; const INT32* check;
// Find the corners of the box // Find the corners of the box
// that define the edges from current viewpoint. // that define the edges from current viewpoint.
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) +
viewx < bspcoord[BOXRIGHT] ? 1 : 2) + (viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5) if (boxpos == 5)
return true; return true;
+15 -4
View File
@@ -722,10 +722,6 @@ void R_AddMobjInterpolator(mobj_t *mobj)
interpolated_mobjs.push_back(mobj); interpolated_mobjs.push_back(mobj);
// Maybe not the best place for it, but for first tic this old_z is 0,
// so when R_ResetMobjInterpolationState is called old_z2 will be set to 0
mobj->old_z = mobj->z;
R_ResetMobjInterpolationState(mobj); R_ResetMobjInterpolationState(mobj);
mobj->resetinterp = true; mobj->resetinterp = true;
} }
@@ -767,7 +763,22 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
if (rendermode == render_none) if (rendermode == render_none)
return; return;
mobj->old_x2 = mobj->old_x;
mobj->old_y2 = mobj->old_y;
mobj->old_z2 = mobj->old_z; mobj->old_z2 = mobj->old_z;
mobj->old_angle2 = mobj->old_angle;
mobj->old_scale2 = mobj->old_scale;
// rotation humor
mobj->old_pitch2 = mobj->old_pitch;
mobj->old_roll2 = mobj->old_roll;
mobj->old_slopepitch2 = mobj->old_slopepitch;
mobj->old_sloperoll2 = mobj->old_sloperoll;
mobj->old_spritexscale2 = mobj->old_spritexscale;
mobj->old_spriteyscale2 = mobj->old_spriteyscale;
mobj->old_spritexoffset2 = mobj->old_spritexoffset;
mobj->old_spriteyoffset2 = mobj->old_spriteyoffset;
mobj->old_x = mobj->x; mobj->old_x = mobj->x;
mobj->old_y = mobj->y; mobj->old_y = mobj->y;
+5 -9
View File
@@ -567,7 +567,6 @@ static void R_InitTextureMapping(void)
else if (t > viewwidth+1) else if (t > viewwidth+1)
t = viewwidth+1; t = viewwidth+1;
} }
viewangletox[i] = t; viewangletox[i] = t;
} }
@@ -1110,8 +1109,7 @@ static void R_SetupCommonFrame(player_t * player)
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam) static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
{ {
if (player->awayviewtics && player->awayviewmobj if (player->awayviewtics && player->awayviewmobj)
&& !(thiscam && thiscam->freecam)) // dont force this if we wanna freecam!
{ {
newview->aim = player->awayviewaiming; newview->aim = player->awayviewaiming;
newview->angle = player->awayviewmobj->angle; newview->angle = player->awayviewmobj->angle;
@@ -1278,10 +1276,9 @@ void R_SetupFrame(UINT8 pnum, boolean skybox)
R_SetupAimingFrame(player, thiscam); R_SetupAimingFrame(player, thiscam);
if (player->awayviewtics && player->awayviewmobj // cut-away view stuff if (player->awayviewtics && player->awayviewmobj) // cut-away view stuff
&& !(thiscam && thiscam->freecam)) // dont force this when we wanna freecam!
{ {
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN whos altview man? viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
I_Assert(viewmobj != NULL); I_Assert(viewmobj != NULL);
newview->x = viewmobj->x; newview->x = viewmobj->x;
@@ -1340,7 +1337,7 @@ static void R_PortalFrame(portal_t *portal)
} }
} }
static void Mask_Pre(maskcount_t* m) static void Mask_Pre (maskcount_t* m)
{ {
m->drawsegs[0] = ds_p - drawsegs; m->drawsegs[0] = ds_p - drawsegs;
m->vissprites[0] = visspritecount; m->vissprites[0] = visspritecount;
@@ -1350,7 +1347,7 @@ static void Mask_Pre(maskcount_t* m)
m->viewsector = viewsector; m->viewsector = viewsector;
} }
static void Mask_Post(maskcount_t* m) static void Mask_Post (maskcount_t* m)
{ {
m->drawsegs[1] = ds_p - drawsegs; m->drawsegs[1] = ds_p - drawsegs;
m->vissprites[1] = visspritecount; m->vissprites[1] = visspritecount;
@@ -1432,7 +1429,6 @@ void R_RenderPlayerView(player_t *player)
// Clear buffers. // Clear buffers.
R_ClearPlanes(); R_ClearPlanes();
if (viewmorph.use) if (viewmorph.use)
{ {
portalclipstart = viewmorph.x1; portalclipstart = viewmorph.x1;
+19 -17
View File
@@ -58,7 +58,7 @@ static void AmigaType_OnChange(void);
#endif #endif
static CV_PossibleValue_t audbuffersize_cons_t[] = {{128, "128"}, {256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}}; 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}; consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL|CV_NOINIT, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
// stereo reverse // stereo reverse
consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -94,14 +94,6 @@ consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_
consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
//bird music stuff //bird music stuff
static CV_PossibleValue_t music_resync_threshold_cons_t[] = {
{0, "MIN"},
{1000, "MAX"},
{0}
};
consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV_CALL, music_resync_threshold_cons_t, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -281,6 +273,12 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_gamesounds); CV_RegisterVar(&cv_gamesounds);
CV_RegisterVar(&cv_gamedigimusic); CV_RegisterVar(&cv_gamedigimusic);
#ifdef HAVE_FLUIDSYNTH
CV_RegisterVar(&cv_midisoundfontpath);
CV_RegisterVar(&cv_midichorus);
CV_RegisterVar(&cv_midireverb);
#endif
CV_RegisterVar(&cv_samesoundlimit); CV_RegisterVar(&cv_samesoundlimit);
// bird music stuff // bird music stuff
@@ -288,9 +286,6 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_playsoundifunfocused); CV_RegisterVar(&cv_playsoundifunfocused);
CV_RegisterVar(&cv_pausemusic); CV_RegisterVar(&cv_pausemusic);
CV_RegisterVar(&cv_music_resync_threshold);
CV_RegisterVar(&cv_music_resync_powerups_only);
CV_RegisterVar(&cv_invincmusicfade); CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade); CV_RegisterVar(&cv_growmusicfade);
@@ -362,6 +357,7 @@ boolean S_SoundDisabled(void)
int S_CacheSound(void) int S_CacheSound(void)
{ {
#if SOUND == SOUND_MIXER
if (sound_disabled) if (sound_disabled)
return SOUNDCACHE_OFF; return SOUNDCACHE_OFF;
@@ -369,6 +365,9 @@ int S_CacheSound(void)
return SOUNDCACHE_PRECACHE; return SOUNDCACHE_PRECACHE;
return cv_cachesound.value; return cv_cachesound.value;
#else
return SOUNDCACHE_OFF;
#endif
} }
// Stop all sounds, load level info, THEN start sounds. // Stop all sounds, load level info, THEN start sounds.
@@ -772,9 +771,14 @@ void S_UpdateSounds(void)
volume = c->volume; // 8 bits internal volume precision volume = c->volume; // 8 bits internal volume precision
sep = NORM_SEP; sep = NORM_SEP;
if (P_MobjWasRemoved(c->origin))
{
// origin was removed, stop the music
S_StopChannel(cnum);
}
// check non-local sounds for distance clipping // check non-local sounds for distance clipping
// or modify their params // or modify their params
if (c->origin) else
{ {
boolean itsUs = false; boolean itsUs = false;
@@ -1642,7 +1646,7 @@ UINT32 S_GetMusicPosition(void)
static lumpnum_t S_GetMusicLumpNum(const char *mname) static lumpnum_t S_GetMusicLumpNum(const char *mname)
{ {
if (S_MusicExists(mname, false, true)) // check non midis first if (S_MusicExists(mname, false, true)) // check non midis first
return W_GetNumForName(va("o_%s", mname)); return W_GetNumForName(va("O_%s", mname));
if (S_MusicExists(mname, true, false)) if (S_MusicExists(mname, true, false))
{ {
@@ -1650,7 +1654,7 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname)
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); 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);
return LUMPERROR; return LUMPERROR;
#else #else
return W_GetNumForName(va("d_%s", mname)); return W_GetNumForName(va("D_%s", mname));
#endif #endif
} }
@@ -1709,8 +1713,6 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
if (S_MusicDisabled()) if (S_MusicDisabled())
return false; return false;
I_UpdateSongLagThreshold();
if ((!fadeinms && !I_PlaySong(looping)) || if ((!fadeinms && !I_PlaySong(looping)) ||
(fadeinms && !I_FadeInPlaySong(fadeinms, looping))) (fadeinms && !I_FadeInPlaySong(fadeinms, looping)))
{ {
+6 -3
View File
@@ -54,10 +54,13 @@ extern consvar_t cv_amigatype;
#endif #endif
#endif #endif
//bird music stuff #ifdef HAVE_FLUIDSYNTH
extern consvar_t cv_music_resync_threshold; extern consvar_t cv_midisoundfontpath;
extern consvar_t cv_music_resync_powerups_only; extern consvar_t cv_midichorus;
extern consvar_t cv_midireverb;
#endif
//bird music stuff
extern consvar_t cv_invincmusicfade; extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade; extern consvar_t cv_growmusicfade;
+2 -2
View File
@@ -42,8 +42,8 @@ INT32 setmodeneeded = 0; // video mode change needed if > 0 (the mode number to
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}}; static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
//added : 03-02-98: default screen mode, as loaded/saved in config //added : 03-02-98: default screen mode, as loaded/saved in config
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_frameskip = {"frameskip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_frameskip = {"frameskip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+25 -24
View File
@@ -46,8 +46,8 @@
#include "SDL_image.h" #include "SDL_image.h"
#else #else
// SDLCALL terms removed from original SDL_image declarations // SDLCALL terms removed from original SDL_image declarations
int IMG_isXPM(SDL_RWops *src); int IMG_isXPM(SDL_IOStream *src);
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src); SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src);
SDL_Surface *IMG_ReadXPMFromArray(const char **xpm); SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
#define IMG_SetError SDL_SetError #define IMG_SetError SDL_SetError
#define IMG_GetError SDL_GetError #define IMG_GetError SDL_GetError
@@ -56,7 +56,7 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
#ifdef LOAD_XPM #ifdef LOAD_XPM
/* See if an image is contained in a data source */ /* See if an image is contained in a data source */
int IMG_isXPM(SDL_RWops *src) int IMG_isXPM(SDL_IOStream *src)
{ {
Sint64 start; Sint64 start;
int is_XPM; int is_XPM;
@@ -64,14 +64,14 @@ int IMG_isXPM(SDL_RWops *src)
if ( !src ) if ( !src )
return 0; return 0;
start = SDL_RWtell(src); start = SDL_TellIO(src);
is_XPM = 0; is_XPM = 0;
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) { if ( SDL_ReadIO(src, magic, sizeof(magic)) ) {
if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) { if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {
is_XPM = 1; is_XPM = 1;
} }
} }
SDL_RWseek(src, start, RW_SEEK_SET); SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
return(is_XPM); return(is_XPM);
} }
@@ -933,7 +933,7 @@ static const char *error;
* If len > 0, it's assumed to be at least len chars (for efficiency). * If len > 0, it's assumed to be at least len chars (for efficiency).
* Return NULL and set error upon EOF or parse error. * Return NULL and set error upon EOF or parse error.
*/ */
static const char *get_next_line(const char ***lines, SDL_RWops *src, int len) static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len)
{ {
char *linebufnew; char *linebufnew;
@@ -943,7 +943,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
char c; char c;
int n; int n;
do { do {
if (SDL_RWread(src, &c, 1, 1) <= 0) { if (SDL_ReadIO(src, &c, 1) <= 0) {
error = "Premature end of data"; error = "Premature end of data";
return NULL; return NULL;
} }
@@ -960,7 +960,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
} }
linebuf = linebufnew; linebuf = linebufnew;
} }
if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) { if (SDL_ReadIO(src, linebuf, len - 1) <= 0) {
error = "Premature end of data"; error = "Premature end of data";
return NULL; return NULL;
} }
@@ -980,7 +980,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
} }
linebuf = linebufnew; linebuf = linebufnew;
} }
if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) { if (SDL_ReadIO(src, linebuf + n, 1) <= 0) {
error = "Premature end of data"; error = "Premature end of data";
return NULL; return NULL;
} }
@@ -1005,7 +1005,7 @@ do { \
} while (0) } while (0)
/* read XPM from either array or RWops */ /* read XPM from either array or RWops */
static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src) static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
{ {
Sint64 start = 0; Sint64 start = 0;
SDL_Surface *image = NULL; SDL_Surface *image = NULL;
@@ -1027,7 +1027,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
buflen = 0; buflen = 0;
if (src) if (src)
start = SDL_RWtell(src); start = SDL_TellIO(src);
if (xpm) if (xpm)
xpmlines = &xpm; xpmlines = &xpm;
@@ -1065,14 +1065,15 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
/* Create the new surface */ /* Create the new surface */
if (ncolors <= 256) { if (ncolors <= 256) {
indexed = 1; indexed = 1;
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8, image = SDL_CreateSurface(w, h,
0, 0, 0, 0); SDL_PIXELFORMAT_INDEX8);
im_colors = image->format->palette->colors; SDL_Palette *palette = SDL_CreateSurfacePalette(image);
image->format->palette->ncolors = ncolors; im_colors = palette->colors;
palette->ncolors = ncolors;
} else { } else {
indexed = 0; indexed = 0;
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, image = SDL_CreateSurface(w, h,
0xff0000, 0x00ff00, 0x0000ff, 0); SDL_GetPixelFormatForMasks(32, 0xff0000, 0x00ff00, 0x0000ff, 0));
} }
if (!image) { if (!image) {
/* Hmm, some SDL error (out of memory?) */ /* Hmm, some SDL error (out of memory?) */
@@ -1128,7 +1129,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
add_colorhash(colors, nextkey, cpp, pixel); add_colorhash(colors, nextkey, cpp, pixel);
nextkey += cpp; nextkey += cpp;
if (rgb == 0xffffffff) if (rgb == 0xffffffff)
SDL_SetColorKey(image, SDL_TRUE, pixel); SDL_SetSurfaceColorKey(image, true, pixel);
break; break;
} }
} }
@@ -1164,9 +1165,9 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
done: done:
if (error) { if (error) {
if ( src ) if ( src )
SDL_RWseek(src, start, RW_SEEK_SET); SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
if ( image ) { if ( image ) {
SDL_FreeSurface(image); SDL_DestroySurface(image);
image = NULL; image = NULL;
} }
IMG_SetError("%s", error); IMG_SetError("%s", error);
@@ -1180,7 +1181,7 @@ done:
} }
/* Load a XPM type image from an RWops datasource */ /* Load a XPM type image from an RWops datasource */
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src) SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
{ {
if ( !src ) { if ( !src ) {
/* The error message has been set in SDL_RWFromFile */ /* The error message has been set in SDL_RWFromFile */
@@ -1203,14 +1204,14 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
#else /* not LOAD_XPM */ #else /* not LOAD_XPM */
/* See if an image is contained in a data source */ /* See if an image is contained in a data source */
int IMG_isXPM(SDL_RWops *src) int IMG_isXPM(SDL_IOStream *src)
{ {
return(0); return(0);
} }
/* Load a XPM type image from an SDL datasource */ /* Load a XPM type image from an SDL datasource */
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src) SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
{ {
return(NULL); return(NULL);
} }
+2 -2
View File
@@ -27,10 +27,10 @@
#ifdef HAVE_SDL #ifdef HAVE_SDL
#include "SDL.h" #include <SDL3/SDL.h>
#ifndef NOLOADSO #ifndef NOLOADSO
#include "SDL_loadso.h" #include <SDL3/SDL_loadso.h>
#endif #endif
#define _CREATE_DLL_ // necessary for Unix AND Windows #define _CREATE_DLL_ // necessary for Unix AND Windows
+1 -1
View File
@@ -36,7 +36,7 @@
#ifdef HAVE_SDL #ifdef HAVE_SDL
#ifdef HAVE_TTF #ifdef HAVE_TTF
#include "SDL.h" #include <SDL3/SDL.h>
#include "i_ttf.h" #include "i_ttf.h"
#endif #endif
+59 -52
View File
@@ -67,13 +67,15 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#ifdef HAVE_SDL #ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED #define _MATH_DEFINES_DEFINED
#include "SDL.h" #include <SDL3/SDL.h>
#include <SDL3/SDL_joystick.h>
#include <SDL3/SDL_gamepad.h>
#ifdef HAVE_TTF #ifdef HAVE_TTF
#include "i_ttf.h" #include "i_ttf.h"
#endif #endif
#include "SDL_cpuinfo.h" #include <SDL3/SDL_cpuinfo.h>
#define HAVE_SDLCPUINFO #define HAVE_SDLCPUINFO
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) #if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
@@ -213,13 +215,13 @@ static char returnWadPath[256];
#include "../byteptr.h" #include "../byteptr.h"
#endif #endif
SDL_bool consolevent = SDL_FALSE; bool consolevent = false;
SDL_bool framebuffer = SDL_FALSE; bool framebuffer = false;
UINT8 keyboard_started = false; UINT8 keyboard_started = false;
#ifdef HAVE_TERMIOS #ifdef HAVE_TERMIOS
// TERMIOS console code from Quake3: thank you! // TERMIOS console code from Quake3: thank you!
SDL_bool stdin_active = SDL_TRUE; bool stdin_active = true;
typedef struct typedef struct
{ {
@@ -282,7 +284,7 @@ static void I_ShutdownConsole(void)
if (consolevent) if (consolevent)
{ {
I_OutputMsg("Shutdown tty console\n"); I_OutputMsg("Shutdown tty console\n");
consolevent = SDL_FALSE; consolevent = false;
tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc); tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc);
} }
} }
@@ -297,11 +299,11 @@ static void I_StartupConsole(void)
signal(SIGTTIN, SIG_IGN); signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN); signal(SIGTTOU, SIG_IGN);
consolevent = static_cast<SDL_bool>(!M_CheckParm("-noconsole")); consolevent = static_cast<bool>(!M_CheckParm("-noconsole"));
framebuffer = static_cast<SDL_bool>( M_CheckParm("-framebuffer")); framebuffer = static_cast<bool>( M_CheckParm("-framebuffer"));
if (framebuffer) if (framebuffer)
consolevent = SDL_FALSE; consolevent = false;
if (!consolevent) if (!consolevent)
return; return;
@@ -309,7 +311,7 @@ static void I_StartupConsole(void)
if (isatty(STDIN_FILENO)!=1) if (isatty(STDIN_FILENO)!=1)
{ {
I_OutputMsg("stdin is not a tty, tty console mode failed\n"); I_OutputMsg("stdin is not a tty, tty console mode failed\n");
consolevent = SDL_FALSE; consolevent = false;
return; return;
} }
@@ -511,7 +513,7 @@ static void I_StartupConsole(void)
if (gotConsole) if (gotConsole)
{ {
SetConsoleTitleA("SRB2Kart Console"); SetConsoleTitleA("SRB2Kart Console");
consolevent = SDL_TRUE; consolevent = true;
} }
//Let get the real console HANDLE, because Mingw's Bash is bad! //Let get the real console HANDLE, because Mingw's Bash is bad!
@@ -544,7 +546,7 @@ static inline void I_StartupConsole(void)
framebuffer = M_CheckParm("-framebuffer"); framebuffer = M_CheckParm("-framebuffer");
if (framebuffer) if (framebuffer)
consolevent = SDL_FALSE; consolevent = false;
} }
static inline void I_ShutdownConsole(void){} static inline void I_ShutdownConsole(void){}
#endif #endif
@@ -693,7 +695,7 @@ void I_OutputMsg(const char *fmt, ...)
// //
// I_GetKey // I_GetKey
// //
INT32 I_GetKey (void) INT32 I_GetKey(void)
{ {
// Warning: I_GetKey empties the event queue till next keypress // Warning: I_GetKey empties the event queue till next keypress
event_t *ev; event_t *ev;
@@ -723,7 +725,7 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
{ {
if (JoySet->dev) if (JoySet->dev)
{ {
SDL_GameControllerClose(JoySet->dev); SDL_CloseGamepad(JoySet->dev);
} }
JoySet->dev = NULL; JoySet->dev = NULL;
@@ -765,15 +767,15 @@ void I_JoyScale4(void)
} }
// Cheat to get the device index for a joystick handle // Cheat to get the device index for a joystick handle
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev) INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev)
{ {
SDL_Joystick *joystick = NULL; SDL_Joystick *joystick = NULL;
joystick = SDL_GameControllerGetJoystick(dev); joystick = SDL_GetGamepadJoystick(dev);
if (joystick) if (joystick)
{ {
return SDL_JoystickInstanceID(joystick); return SDL_GetJoystickID(joystick);
} }
return -1; return -1;
@@ -883,7 +885,7 @@ void I_ShutdownJoystick(UINT8 index)
*/ */
static int joy_open(int playerIndex, int joyIndex) static int joy_open(int playerIndex, int joyIndex)
{ {
SDL_GameController *newdev = NULL; SDL_Gamepad *newdev = NULL;
int num_joy = 0; int num_joy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
@@ -892,7 +894,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1; return -1;
} }
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0) if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
{ {
CONS_Printf(M_GetText("Game Controller subsystem not started\n")); CONS_Printf(M_GetText("Game Controller subsystem not started\n"));
return -1; return -1;
@@ -901,7 +903,7 @@ static int joy_open(int playerIndex, int joyIndex)
if (joyIndex <= 0) if (joyIndex <= 0)
return -1; return -1;
num_joy = SDL_NumJoysticks(); SDL_GetJoysticks(&num_joy);
if (num_joy == 0) if (num_joy == 0)
{ {
@@ -909,7 +911,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1; return -1;
} }
newdev = SDL_GameControllerOpen(joyIndex-1); newdev = SDL_OpenGamepad(joyIndex-1);
// Handle the edge case where the device <-> joystick index assignment can change due to hotplugging // Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
// This indexing is SDL's responsibility and there's not much we can do about it. // This indexing is SDL's responsibility and there's not much we can do about it.
@@ -924,8 +926,8 @@ static int joy_open(int playerIndex, int joyIndex)
if (JoyInfo[playerIndex].dev) if (JoyInfo[playerIndex].dev)
{ {
if (JoyInfo[playerIndex].dev == newdev // same device, nothing to do if (JoyInfo[playerIndex].dev == newdev // same device, nothing to do
|| (newdev == NULL && SDL_GameControllerGetAttached(JoyInfo[playerIndex].dev))) // we failed, but already have a working device || (newdev == NULL && SDL_GamepadConnected(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
return SDL_CONTROLLER_AXIS_MAX; return SDL_GAMEPAD_AXIS_COUNT;
// Else, we're changing devices, so send neutral joy events // Else, we're changing devices, so send neutral joy events
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n"); CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n");
@@ -942,13 +944,13 @@ static int joy_open(int playerIndex, int joyIndex)
} }
else else
{ {
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev)); CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GetGamepadName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].axises = SDL_CONTROLLER_AXIS_MAX; JoyInfo[playerIndex].axises = SDL_GAMEPAD_AXIS_COUNT;
if (JoyInfo[playerIndex].axises > JOYAXISSET*2) if (JoyInfo[playerIndex].axises > JOYAXISSET*2)
JoyInfo[playerIndex].axises = JOYAXISSET*2; JoyInfo[playerIndex].axises = JOYAXISSET*2;
JoyInfo[playerIndex].buttons = SDL_CONTROLLER_BUTTON_MAX ; // dpad is 4 buttons JoyInfo[playerIndex].buttons = SDL_GAMEPAD_BUTTON_COUNT; // dpad is 4 buttons
if (JoyInfo[playerIndex].buttons > JOYBUTTONS) if (JoyInfo[playerIndex].buttons > JOYBUTTONS)
JoyInfo[playerIndex].buttons = JOYBUTTONS; JoyInfo[playerIndex].buttons = JOYBUTTONS;
@@ -968,7 +970,7 @@ static int joy_open(int playerIndex, int joyIndex)
void I_InitJoystick(UINT8 index) void I_InitJoystick(UINT8 index)
{ {
UINT8 i; UINT8 i;
SDL_GameController *newcontroller = NULL; SDL_Gamepad *newcontroller = NULL;
// not sure if this is the best place to put this // not sure if this is the best place to put this
SDL_SetHint(SDL_HINT_AUTO_UPDATE_SENSORS, "0"); SDL_SetHint(SDL_HINT_AUTO_UPDATE_SENSORS, "0");
@@ -986,15 +988,16 @@ void I_InitJoystick(UINT8 index)
{ {
CONS_Printf("I_InitJoystick()...\n"); CONS_Printf("I_InitJoystick()...\n");
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK))
{ {
CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError()); CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
return; return;
} }
} }
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
{ {
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) if (!SDL_InitSubSystem(SDL_INIT_GAMEPAD))
{ {
CONS_Printf(M_GetText("Couldn't initialize gamepads: %s\n"), SDL_GetError()); CONS_Printf(M_GetText("Couldn't initialize gamepads: %s\n"), SDL_GetError());
return; return;
@@ -1007,7 +1010,7 @@ void I_InitJoystick(UINT8 index)
JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0; JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0;
if (cv_usejoystick[index].value) if (cv_usejoystick[index].value)
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1); newcontroller = SDL_OpenGamepad(cv_usejoystick[index].value-1);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
@@ -1047,7 +1050,7 @@ void I_InitJoystick(UINT8 index)
if (i == MAXSPLITSCREENPLAYERS) if (i == MAXSPLITSCREENPLAYERS)
{ {
// Joystick didn't end up being used // Joystick didn't end up being used
SDL_GameControllerClose(newcontroller); SDL_CloseGamepad(newcontroller);
} }
} }
@@ -1082,10 +1085,10 @@ static void I_ShutdownInput(void)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
I_ShutdownJoystick(i); I_ShutdownJoystick(i);
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == SDL_INIT_GAMECONTROLLER) if (SDL_WasInit(SDL_INIT_GAMEPAD) == SDL_INIT_GAMEPAD)
{ {
CONS_Printf("Shutting down gamecontroller system\n"); CONS_Printf("Shutting down gamecontroller system\n");
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER); SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
I_OutputMsg("I_Joystick: SDL's Game Controller system has been shutdown\n"); I_OutputMsg("I_Joystick: SDL's Game Controller system has been shutdown\n");
} }
@@ -1102,7 +1105,9 @@ INT32 I_NumJoys(void)
INT32 numjoy = 0; INT32 numjoy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
numjoy = SDL_NumJoysticks(); {
SDL_GetJoysticks(&numjoy);
}
return numjoy; return numjoy;
} }
@@ -1117,7 +1122,7 @@ const char *I_GetJoyName(INT32 joyindex)
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
{ {
tempname = SDL_JoystickNameForIndex(joyindex); tempname = SDL_GetJoystickNameForID(joyindex);
if (tempname) if (tempname)
{ {
@@ -1137,14 +1142,14 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength,
(void)high_strength; (void)high_strength;
(void)duration; (void)duration;
#else #else
SDL_GameController *controller = JoyInfo[playernum].dev; SDL_Gamepad *controller = JoyInfo[playernum].dev;
if (controller == NULL) if (controller == NULL)
{ {
return; return;
} }
SDL_GameControllerRumble(controller, low_strength, high_strength, duration); SDL_RumbleGamepad(controller, low_strength, high_strength, duration);
#endif #endif
} }
@@ -1156,14 +1161,14 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
(void)green; (void)green;
(void)blue; (void)blue;
#else #else
SDL_GameController *controller = JoyInfo[playernum].dev; SDL_Gamepad *controller = JoyInfo[playernum].dev;
if (controller == NULL) if (controller == NULL)
{ {
return; return;
} }
SDL_GameControllerSetLED(controller, red, green, blue); SDL_SetGamepadLED(controller, red, green, blue);
#endif #endif
} }
@@ -1816,10 +1821,7 @@ static void I_Fork(void)
INT32 I_StartupSystem(void) INT32 I_StartupSystem(void)
{ {
SDL_version SDLcompiled; int SDLlinked = SDL_GetVersion();
SDL_version SDLlinked;
SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked);
I_StartupConsole(); I_StartupConsole();
#ifdef NEWSIGNALHANDLER #ifdef NEWSIGNALHANDLER
// This is useful when debugging. It lets GDB attach to // This is useful when debugging. It lets GDB attach to
@@ -1835,15 +1837,15 @@ INT32 I_StartupSystem(void)
#endif #endif
I_RegisterSignals(); I_RegisterSignals();
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n", I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch); SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
I_OutputMsg("Linked with SDL version: %d.%d.%d\n", I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
SDLlinked.major, SDLlinked.minor, SDLlinked.patch); SDL_VERSIONNUM_MAJOR(SDLlinked), SDL_VERSIONNUM_MINOR(SDLlinked), SDL_VERSIONNUM_MICRO(SDLlinked));
#if (SDL_VERSION_ATLEAST(2, 0, 18)) #if (SDL_VERSION_ATLEAST(2, 0, 18))
SDL_SetHint(SDL_HINT_APP_NAME, "SRB2Kart Saturn"); SDL_SetHint(SDL_HINT_APP_NAME, "SRB2Kart Saturn");
#endif #endif
if (SDL_Init(0) < 0) if (!SDL_Init(0))
I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no.... I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
#ifndef NOMUMBLE #ifndef NOMUMBLE
I_SetupMumble(); I_SetupMumble();
@@ -1856,12 +1858,12 @@ INT32 I_StartupSystem(void)
// //
FUNCNORETURN void ATTRNORETURN I_Quit(void) FUNCNORETURN void ATTRNORETURN I_Quit(void)
{ {
static SDL_bool quiting = SDL_FALSE; static bool quiting = false;
/* prevent recursive I_Quit() */ /* prevent recursive I_Quit() */
if (quiting) goto death; if (quiting) goto death;
SDL_ShowCursor(SDL_TRUE); SDL_ShowCursor();
quiting = SDL_FALSE; quiting = false;
I_ShutdownConsole(); I_ShutdownConsole();
M_SaveConfig(NULL); //save game config, cvars.. M_SaveConfig(NULL); //save game config, cvars..
D_SaveBan(); // save the ban list D_SaveBan(); // save the ban list
@@ -2314,12 +2316,17 @@ static void pathonly(char *s)
size_t j; size_t j;
for (j = strlen(s); j != (size_t)-1; j--) for (j = strlen(s); j != (size_t)-1; j--)
{
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/')) if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
{ {
if (s[j] == ':') s[j+1] = 0; if (s[j] == ':')
else s[j] = 0; s[j+1] = 0;
else
s[j] = 0;
return; return;
} }
}
} }
/** \brief search for srb2.srb in the given path /** \brief search for srb2.srb in the given path
+25 -30
View File
@@ -12,7 +12,7 @@
#include "../doomdef.h" #include "../doomdef.h"
#include "../i_threads.h" #include "../i_threads.h"
#include <SDL.h> #include <SDL3/SDL.h>
typedef void * (*Create_fn)(void); typedef void * (*Create_fn)(void);
@@ -45,7 +45,7 @@ static I_mutex i_thread_pool_mutex;
static I_mutex i_mutex_pool_mutex; static I_mutex i_mutex_pool_mutex;
static I_mutex i_cond_pool_mutex; static I_mutex i_cond_pool_mutex;
static SDL_atomic_t i_threads_running = {1}; static SDL_AtomicInt i_threads_running = {1};
static Link static Link
Insert_link ( Insert_link (
@@ -103,13 +103,13 @@ Identity (
){ ){
void * id; void * id;
id = SDL_AtomicGetPtr(anchor); id = SDL_GetAtomicPointer(anchor);
if (! id) if (! id)
{ {
I_lock_mutex(&pool_mutex); I_lock_mutex(&pool_mutex);
{ {
id = SDL_AtomicGetPtr(anchor); id = SDL_GetAtomicPointer(anchor);
if (! id) if (! id)
{ {
@@ -120,7 +120,7 @@ Identity (
Insert_link(pool_anchor, New_link(id)); Insert_link(pool_anchor, New_link(id));
SDL_AtomicSetPtr(anchor, id); SDL_SetAtomicPointer(anchor, id);
} }
} }
I_unlock_mutex(pool_mutex); I_unlock_mutex(pool_mutex);
@@ -139,11 +139,11 @@ Worker (
(*th->entry)(th->userdata); (*th->entry)(th->userdata);
if (SDL_AtomicGet(&i_threads_running)) if (SDL_GetAtomicInt(&i_threads_running))
{ {
I_lock_mutex(&i_thread_pool_mutex); I_lock_mutex(&i_thread_pool_mutex);
{ {
if (SDL_AtomicGet(&i_threads_running)) if (SDL_GetAtomicInt(&i_threads_running))
{ {
SDL_DetachThread(th->thread); SDL_DetachThread(th->thread);
Free_link(&i_thread_pool, link); Free_link(&i_thread_pool, link);
@@ -176,7 +176,7 @@ I_spawn_thread (
{ {
link = Insert_link(&i_thread_pool, New_link(th)); link = Insert_link(&i_thread_pool, New_link(th));
if (SDL_AtomicGet(&i_threads_running)) if (SDL_GetAtomicInt(&i_threads_running))
{ {
th->thread = SDL_CreateThread( th->thread = SDL_CreateThread(
(SDL_ThreadFunction)Worker, (SDL_ThreadFunction)Worker,
@@ -194,7 +194,7 @@ I_spawn_thread (
int int
I_thread_is_stopped (void) I_thread_is_stopped (void)
{ {
return ( ! SDL_AtomicGet(&i_threads_running) ); return ( ! SDL_GetAtomicInt(&i_threads_running) );
} }
void void
@@ -220,13 +220,13 @@ I_stop_threads (void)
Link next; Link next;
Thread th; Thread th;
SDL_mutex * mutex; SDL_Mutex * mutex;
SDL_cond * cond; SDL_Condition * cond;
if (i_threads_running.value) if (i_threads_running.value)
{ {
/* rely on the good will of thread-san */ /* rely on the good will of thread-san */
SDL_AtomicSet(&i_threads_running, 0); SDL_SetAtomicInt(&i_threads_running, 0);
I_lock_mutex(&i_thread_pool_mutex); I_lock_mutex(&i_thread_pool_mutex);
{ {
@@ -267,7 +267,7 @@ I_stop_threads (void)
next = link->next; next = link->next;
cond = link->data; cond = link->data;
SDL_DestroyCond(cond); SDL_DestroyCondition(cond);
free(link); free(link);
} }
@@ -282,7 +282,7 @@ void
I_lock_mutex ( I_lock_mutex (
I_mutex * anchor I_mutex * anchor
){ ){
SDL_mutex * mutex; SDL_Mutex * mutex;
mutex = Identity( mutex = Identity(
&i_mutex_pool, &i_mutex_pool,
@@ -291,16 +291,14 @@ I_lock_mutex (
(Create_fn)SDL_CreateMutex (Create_fn)SDL_CreateMutex
); );
if (SDL_LockMutex(mutex) == -1) SDL_LockMutex(mutex);
abort();
} }
void void
I_unlock_mutex ( I_unlock_mutex (
I_mutex id I_mutex id
){ ){
if (SDL_UnlockMutex(id) == -1) SDL_UnlockMutex(id);
abort();
} }
void void
@@ -308,49 +306,46 @@ I_hold_cond (
I_cond * cond_anchor, I_cond * cond_anchor,
I_mutex mutex_id I_mutex mutex_id
){ ){
SDL_cond * cond; SDL_Condition * cond;
cond = Identity( cond = Identity(
&i_cond_pool, &i_cond_pool,
i_cond_pool_mutex, i_cond_pool_mutex,
cond_anchor, cond_anchor,
(Create_fn)SDL_CreateCond (Create_fn)SDL_CreateCondition
); );
if (SDL_CondWait(cond, mutex_id) == -1) SDL_WaitCondition(cond, mutex_id);
abort();
} }
void void
I_wake_one_cond ( I_wake_one_cond (
I_cond * anchor I_cond * anchor
){ ){
SDL_cond * cond; SDL_Condition * cond;
cond = Identity( cond = Identity(
&i_cond_pool, &i_cond_pool,
i_cond_pool_mutex, i_cond_pool_mutex,
anchor, anchor,
(Create_fn)SDL_CreateCond (Create_fn)SDL_CreateCondition
); );
if (SDL_CondSignal(cond) == -1) SDL_SignalCondition(cond);
abort();
} }
void void
I_wake_all_cond ( I_wake_all_cond (
I_cond * anchor I_cond * anchor
){ ){
SDL_cond * cond; SDL_Condition * cond;
cond = Identity( cond = Identity(
&i_cond_pool, &i_cond_pool,
i_cond_pool_mutex, i_cond_pool_mutex,
anchor, anchor,
(Create_fn)SDL_CreateCond (Create_fn)SDL_CreateCondition
); );
if (SDL_CondBroadcast(cond) == -1) SDL_BroadcastCondition(cond);
abort();
} }
+3 -3
View File
@@ -16,7 +16,7 @@
/// \file /// \file
/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems. /// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
#if defined(HAVE_SDL) && defined(HAVE_TTF) #if defined (HAVE_SDL) && defined (HAVE_TTF)
#include "SDL.h" #include "SDL.h"
#include "SDL_ttf.h" #include "SDL_ttf.h"
#include "../doomdef.h" #include "../doomdef.h"
@@ -236,14 +236,14 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
// what's the point of trying to display an error? // what's the point of trying to display an error?
// SDL_ttf is not started, can't display anything to screen (presumably)... // SDL_ttf is not started, can't display anything to screen (presumably)...
if (SDL_InitSubSystem(initflags) < 0) if (!SDL_InitSubSystem(initflags))
I_Error("Couldn't initialize SDL: %s\n", SDL_GetError()); I_Error("Couldn't initialize SDL: %s\n", SDL_GetError());
TTFSurface = SDL_SetVideoMode(res.width, res.height, bitsperpixel, vidmodeflags); TTFSurface = SDL_SetVideoMode(res.width, res.height, bitsperpixel, vidmodeflags);
if (!TTFSurface) if (!TTFSurface)
I_Error("Couldn't set SDL Video resolution: %s\n", SDL_GetError()); I_Error("Couldn't set SDL Video resolution: %s\n", SDL_GetError());
if (TTF_Init() < 0) if (!TTF_Init())
I_Error("Couldn't start SDL_ttf: %s\n", TTF_GetError()); I_Error("Couldn't start SDL_ttf: %s\n", TTF_GetError());
// look for default font in many directories // look for default font in many directories
+480 -299
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -20,7 +20,7 @@
#ifdef HAVE_SDL #ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED #define _MATH_DEFINES_DEFINED
#include "SDL.h" #include <SDL3/SDL.h>
#include "sdlmain.h" #include "sdlmain.h"
@@ -96,7 +96,7 @@ boolean VID_LoadOGLAPI(void)
if (M_CheckParm("-OGLlib") && M_IsNextParm()) if (M_CheckParm("-OGLlib") && M_IsNextParm())
OGLLibname = M_GetNextParm(); OGLLibname = M_GetNextParm();
if (SDL_GL_LoadLibrary(OGLLibname) != 0) if (!SDL_GL_LoadLibrary(OGLLibname))
{ {
CONS_Alert(CONS_ERROR, "Could not load OpenGL Library: %s\n", SDL_GetError()); CONS_Alert(CONS_ERROR, "Could not load OpenGL Library: %s\n", SDL_GetError());
if (!M_CheckParm("-OGLlib")) if (!M_CheckParm("-OGLlib"))
+1962
View File
File diff suppressed because it is too large. Load diff
+7 -5
View File
@@ -23,14 +23,16 @@
extern "C" { extern "C" {
#endif #endif
extern SDL_bool consolevent; extern bool consolevent;
extern SDL_bool framebuffer; extern bool framebuffer;
#include "../m_fixed.h" #include "../m_fixed.h"
// SDL2 stub macro // SDL2 stub macro
#define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__) #define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
#include <SDL3/SDL_gamepad.h>
// So m_menu knows whether to store cv_usejoystick value or string // So m_menu knows whether to store cv_usejoystick value or string
#define JOYSTICK_HOTPLUG #define JOYSTICK_HOTPLUG
@@ -41,9 +43,9 @@ extern SDL_bool framebuffer;
typedef struct SDLJoyInfo_s typedef struct SDLJoyInfo_s
{ {
/// Controller handle /// Controller handle
SDL_GameController *dev; SDL_Gamepad *dev;
/// Controller index /// Controller index
INT32 id; SDL_JoystickID id;
/// number of old joystick /// number of old joystick
int oldjoy; int oldjoy;
/// number of axies /// number of axies
@@ -71,7 +73,7 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
void I_ShutdownJoystick(UINT8 index); void I_ShutdownJoystick(UINT8 index);
// Cheat to get the device index for a game controller handle // Cheat to get the device index for a game controller handle
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev); INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev);
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination // Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
void I_UpdateJoystickDeviceIndex(UINT8 player); void I_UpdateJoystickDeviceIndex(UINT8 player);
+9 -3
View File
@@ -2992,7 +2992,9 @@ INT32 V_CreditStringWidth(const char *string)
if (!string) if (!string)
return 0; return 0;
for (i = 0; i < strlen(string); i++) const size_t strlength = strlen(string);
for (i = 0; i < strlength; i++)
{ {
c = toupper(string[i]) - CRED_FONTSTART; c = toupper(string[i]) - CRED_FONTSTART;
if (c < 0 || c >= CRED_FONTSIZE) if (c < 0 || c >= CRED_FONTSIZE)
@@ -3070,7 +3072,9 @@ INT32 V_LevelNameWidth(const char *string)
INT32 c, w = 0; INT32 c, w = 0;
size_t i; size_t i;
for (i = 0; i < strlen(string); i++) const size_t strlength = strlen(string);
for (i = 0; i < strlength; i++)
{ {
c = toupper(string[i]) - LT_FONTSTART; c = toupper(string[i]) - LT_FONTSTART;
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c]) if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
@@ -3089,7 +3093,9 @@ INT32 V_LevelNameHeight(const char *string)
INT32 c, w = 0; INT32 c, w = 0;
size_t i; size_t i;
for (i = 0; i < strlen(string); i++) const size_t strlength = strlen(string);
for (i = 0; i < strlength; i++)
{ {
c = toupper(string[i]) - LT_FONTSTART; c = toupper(string[i]) - LT_FONTSTART;
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c]) if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
+16 -19
View File
@@ -352,7 +352,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol)
if (pnum == whiteplayer) if (pnum == whiteplayer)
{ {
UINT8 cursorframe = (intertic / 4) % 8; UINT8 cursorframe = (intertic / 4) % 8;
V_DrawScaledPatch(x+16, y-4, 0, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH)); V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
} }
STRBUFCPY(strtime, standings->name[i]); STRBUFCPY(strtime, standings->name[i]);
@@ -831,9 +831,6 @@ void Y_VoteScreenCheck(void)
VoteScreen.foundLuaVoteFrames = VoteScreen.foundLuaVoteWideFrames = 0; VoteScreen.foundLuaVoteFrames = VoteScreen.foundLuaVoteWideFrames = 0;
VoteScreen.currentAnimFrame = 0; VoteScreen.currentAnimFrame = 0;
if (VoteScreen.timePerAnimFrame == 0)
VoteScreen.timePerAnimFrame = 2;
INT32 i = 1; INT32 i = 1;
// check for lua vote background replacements // check for lua vote background replacements
@@ -859,8 +856,8 @@ void Y_VoteScreenCheck(void)
// non lua vote background handling // non lua vote background handling
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH); boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
VoteScreen.widebgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY); VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
VoteScreen.bgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY); VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
} }
// //
@@ -908,7 +905,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
// Draw non animated patch // Draw non animated patch
if (!tempfoundAnimLuaVoteFrames) if (!tempfoundAnimLuaVoteFrames)
{ {
votebg = (patch_t *)W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY); votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg); Y_VoteBackgroundDrawer(votebg);
return; return;
} }
@@ -921,11 +918,11 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
nextframe = (VoteScreen.currentAnimFrame + 1); nextframe = (VoteScreen.currentAnimFrame + 1);
votebg = (patch_t *)W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY); votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg); Y_VoteBackgroundDrawer(votebg);
if (renderisnewtic && (votetic % VoteScreen.timePerAnimFrame == 0) && !paused) if (renderisnewtic && (votetic % 2 == 0) && !paused)
VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe; VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe;
} }
@@ -1189,7 +1186,7 @@ void Y_VoteDrawer(void)
if (!splitscreen && i == consoleplayer) if (!splitscreen && i == consoleplayer)
{ {
UINT8 cursorframe = (votetic / 4) % 8; UINT8 cursorframe = (votetic / 4) % 8;
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH)); V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
} }
} }
@@ -1449,14 +1446,14 @@ static void Y_InitVoteDrawing(void)
// setup the background patches // setup the background patches
Y_VoteScreenCheck(); Y_VoteScreenCheck();
VoteScreen.cursor[0] = (patch_t*)W_CachePatchName("M_CURSOR", PU_PATCH); VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[1] = (patch_t*)W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[2] = (patch_t*)W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[3] = (patch_t*)W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[4] = (patch_t*)W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.randomlvl = (patch_t*)W_CachePatchName("RANDOMLV", PU_PATCH); VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH_LOWPRIORITY);
VoteScreen.rubyicon = (patch_t*)W_CachePatchName("RUBYICON", PU_PATCH); VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH_LOWPRIORITY);
} }
void Y_StartVote(void) void Y_StartVote(void)
@@ -1541,9 +1538,9 @@ void Y_StartVote(void)
{ {
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1))); lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
if (lumpnum != LUMPERROR) if (lumpnum != LUMPERROR)
levelinfo[i].pic = (patch_t *)W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH); levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH_LOWPRIORITY);
else else
levelinfo[i].pic = (patch_t *)W_CachePatchName("BLANKLVL", PU_PATCH); levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH_LOWPRIORITY);
} }
} }
-1
View File
@@ -79,7 +79,6 @@ typedef struct
char luaPrefix[5]; // prefix for lua votescreens char luaPrefix[5]; // prefix for lua votescreens
INT32 currentAnimFrame; // current animated background frame INT32 currentAnimFrame; // current animated background frame
INT32 timePerAnimFrame; // time for 1 frame in ticks, 2 by default
INT32 foundLuaVoteFrames; // normal lua patch frames INT32 foundLuaVoteFrames; // normal lua patch frames
INT32 foundLuaVoteWideFrames; // widescreen lua patch frames INT32 foundLuaVoteWideFrames; // widescreen lua patch frames