Compare commits

..
101 Commits
Author SHA1 Message Date
Alug 467ecf8224 fix adding bogus resolutions into the resolution list when setting a new defaultres
CV_SetValue will call the callbacks each, which means when it sets the width, the height cvar will not be updated yet, which most definitely will not be in the modelist, so it will add it regardless
2026-02-03 22:02:17 +01:00
Alug 2077315f24 Merge branch 'Saturn-Next' into vidmodestuff 2025-12-27 15:13:31 +01:00
Alug 67e74b5874 fix w_wad oopsie 2025-12-27 15:13:20 +01:00
Alug 9bea6eddbd fix dedi build missing I_CheckAboveDesktopRes 2025-12-27 15:09:38 +01:00
Alug f4e5f7249c Merge branch 'Saturn-Next' into vidmodestuff 2025-12-27 15:09:02 +01:00
Alug 9639ace28a fix dedicated server build warnings 2025-12-27 15:07:13 +01:00
Alug a2616778cc fix another -Wnull-dereference warning 2025-12-27 15:06:50 +01:00
Alug 495c34dd40 fix gcc version detection fallback stuff
latest_gcc_version should always just be X.x not X.x.x
this broke some warning flags for me
2025-12-27 13:02:30 +01:00
Alug b0bf588c27 fix some null pointer dereferences
and enable -Wnull-dereference by default
2025-12-27 10:52:21 +01:00
Alug 35e4f35f6e fix some shadowed variables, enable -Wshadow by default 2025-12-27 10:32:16 +01:00
LJ Sonic 7866b769cc Do not archive table values for nil keys 2025-12-27 00:00:39 +01:00
Alug 1af1e42dab FBO: remove nvidia xwayland hack
this has been a non issue since a while now, so can remove this (we shouldnt work around driver bugs anyways)
2025-12-26 23:20:42 +01:00
Alug 40bd3e5e19 simplify opengl vsync set 2025-12-26 23:20:39 +01:00
Alug 25dd3b4976 Revert "Fix static memory being re-tagged as purgable"
This reverts commit c544cf9a7c.
2025-12-26 21:44:58 +01:00
Alug 0fe3086a5a Fixup the doomednum lookup
properly match the old linear lookup by returning the FIRST match for doomednum
also shrinks the array, doomednum max is 4095, no need for such massive array, also fixed a off by
should fix some join desynchs and desynchs on certain maps
2025-12-26 18:58:41 +01:00
Alug c9afd4a2cd G_GetDemoDate: make safer and use static memory
bunch of smaller issues before, no real checks for strltol and potential free on a null pointer lul
also skips replays with shorter than 10 char names and handles errors better
2025-12-24 00:06:17 +01:00
indev 7518a6f181 Revert "Sort directories too in replay list"
This reverts commit 7c848f4be5.
2025-12-24 01:36:02 +03:00
indev 2bf4c44259 Revert "Actually add filepath to directories to sort them"
This reverts commit 1c95e5f40e.
2025-12-24 01:36:00 +03:00
indev 1c95e5f40e Actually add filepath to directories to sort them 2025-12-24 01:23:20 +03:00
indev 7c848f4be5 Sort directories too in replay list 2025-12-24 00:54:39 +03:00
Alug a4af254643 Revert "dont call I_Quit from within "quit_handler", let it signal main loop to quit"
This reverts commit a2feaa7fde.
2025-12-22 20:16:04 +01:00
Alug 860dc37fe4 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-12-18 19:13:47 +01:00
Alug 8b3d55fbc8 HWR_ProcessSeg: port softwares code to skip rendering inner sides that are "joined" to other fofs
This seems to improve performance on maps with moderate to lots of fofs quite a bit.
On maps with only a few fofs, this makes no difference or has very very little regression
Need to test and check if there are any visual errors, but so far everything seems good
2025-12-18 19:11:37 +01:00
Alug 0540b5656a 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-12-18 19:11:26 +01:00
Alug 6c98440f27 Remove pure attribute from fasticmp
While i assume this to be fine currently, i quite frankly dont trust the srb2 codebase enough aswell as preventing any future issues if there should ever be need to switch locales, since toupper WILL change behaviour in such cases which does not qualify as pure
2025-12-16 17:52:13 +01:00
indev 3828a9f8e0 Add flipcammode toggle for using local flipcam settings instead of player flags 2025-12-11 22:58:45 +03:00
Alug 2c7c9ec32a fastcmp.h: mark fastcmp functions as pure
this might let the compiler optimize aways subsequent calls in some cases
strcmp etc from glibc also does it
prayin nothin changes the locale at runtime lmao
2025-12-11 20:28:31 +01:00
indev 1ccd3e37bc Init playerinfo[i].node to 255 so if playerinfo packet gets lost, server join screen doesn't display empty player names 2025-12-11 21:37:31 +03:00
Alug 6ad344f65d findfile: let files added with "-file" look in addon/downloads folders first
due to https://github.com/Indev450/SRB2Kart-Saturn/commit/956fc099adcd7f33993c43c8ee3aea64df3fe9b4
IWADS shouldnt use findfile anymore
If there should be such case we can always expose the startupiwad count to check if were currently searching for iwads iirc
2025-12-11 18:19:21 +01:00
indev 1c289d73ca Oopsie 2025-12-11 17:54:03 +03:00
indev 44ba69cf53 Move lite steer and turn smoothing cvars into individual player controls menu 2025-12-11 17:35:35 +03:00
indev 4cea0c1414 Add autoaccel into accessibility menu 2025-12-11 16:43:59 +03:00
Alug 4ee468f5c6 Accessability: Add "Auto Acceleration" feature
ported from hostmod
2025-12-11 14:27:09 +01:00
Alug 9a58eb3010 G_BuildLocalTiccmd: remove "moveinput" variable
checking both cmd->buttons aswell as cmd->driftturn already handles those cases
2025-12-11 14:27:06 +01:00
Alug 59ff5e61bf Revert "Fix use-after-free when mobj is removed while still playing sounds"
This reverts commit 3bdc745bd1.
2025-12-10 19:13:07 +01:00
Alug 821c061f82 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-12-10 18:22:34 +01:00
Gustaf Alhäll eb4d9bbdd5 Fix decompression warning when starting a server 2025-12-09 17:57:02 +01:00
Alug c19c80d797 command.c: fix "alias" command crashing when no aliases were registered
if we dont have aliases list how do we check the next alias in the list aswell?
2025-12-07 21:08:38 +01:00
Alug a2feaa7fde dont call I_Quit from within "quit_handler", let it signal main loop to quit
fixes an issue for me which led to having the game threads getting stuck when sending an interrupt signal to the game due to some thread issues with the sdl subsystems

shoutout to dsda doom for this
2025-12-07 20:27:57 +01:00
Alug 3cb4e86b48 i_system: "fix" recursive i_quit
well this still aint working all to great, but atleast this allows me to quit the game if it gets stuck without having to always send a kill signal to it

copy pasted from what the dedicated build does
2025-12-07 20:24:18 +01:00
Alug ed758fc921 g_demo: check for maplump existance directly
cant really rely on mapheaderinfo to tell us if some map exists or not
2025-12-07 20:23:57 +01:00
Alug a191c8b71e g_demo: screw you LF2_EXISTSHACK 2025-12-07 19:04:21 +01:00
Gustaf Alhäll 3f2e0bd349 Fix memory leak in AATree string trees 2025-12-06 19:40:54 +01:00
Gustaf Alhäll 3bdc745bd1 Fix use-after-free when mobj is removed while still playing sounds 2025-12-06 19:40:49 +01:00
Alug f578781418 put "string.c" earliest in sourcefile
otherwise Windows is unable to find nongnu_strcasestr
2025-12-06 15:45:45 +01:00
indev 0bb63ee0af Use size_t there 2025-12-06 17:34:05 +03:00
Alug 2ae9563ab3 Menu: fix camera options from within accessability options returning to the main menu
really wonky setup, but some other menus do similar things...
2025-12-05 19:13:01 +01:00
indev 6b429e4388 Add locatelump command 2025-12-05 20:35:48 +03:00
Alug 0321b0d94a m_menu: do some cleanup - replay drawers 2025-12-05 17:29:49 +01:00
Alug ac57b7fd2d Menu: show stats for current skin in Time Attack menu
+ some cleanup
2025-12-05 17:29:46 +01:00
Alug 7013e63142 Menus: dont advertise encore toggle if its not unlocked yet!
this wont do anything anyways besides telling you you havent unlocked it yet
so can just hide it
2025-12-05 17:29:43 +01:00
Alug 4e1ef7c0cd Revert "remove the wonky double tap input for controllers"
This reverts commit 9e2fd091a8.

causes some wonky issues still, will need to look into it more, but for now revert
2025-12-05 15:11:51 +01:00
Alug 892f2253ea p_spec: remove hardcoded animdefs table
srb2.srb includes an ANIMDEFS file which WILL override this anyways and includes any of these.
so no need to complicate the code with this
2025-12-05 14:58:19 +01:00
Alug bebe62346f fix Flat loading code passing non null terminated strings to W_CheckNumForName 2025-12-05 14:58:15 +01:00
indev 834a94e429 Ok i guess we still need old_z2 :ChonkBunckle: 2025-12-05 03:10:41 +03:00
indev fcf833ff48 Move ghost mobj old_x2 hack into P_SpawnGhostMobj to cover all cases where it would matter
ty lug <3
2025-12-05 03:10:41 +03:00
indev f2a27539d3 Experimental: remove mobj->old_x2, old_y2, etc fields 2025-12-05 03:10:41 +03:00
Alug 05d26654df p_user: do some tiny cleanups 2025-12-05 01:07:18 +01:00
Alug cee6a27340 mark debugfile with UNLIKELY
this is for debug, and esp network debug which barely anyone ever needs, so can tell compiler better branch hint
2025-12-05 01:07:14 +01:00
Alug 66e35a9d67 k_kart: slightly cleanup driftrelease code 2025-12-05 00:29:31 +01:00
indev ad096ccd42 Update LUASTUFF.md 2025-12-04 19:21:30 +03:00
Alug 7a9e81828a forgot to remove this oops 2025-12-04 15:41:20 +01:00
Alug 71e7dacb56 r_opengl: dont set directional light model shader uniforms if we dont use them 2025-12-04 01:26:43 +01:00
Alug f9c0ee865f make those ternaries a little prettier lul 2025-12-04 01:23:42 +01:00
Alug 154eaaf027 hw_main: cleanup and simplify HWR_RenderPolyObjectPlane 2025-12-04 01:23:39 +01:00
Alug 66f5f9b2a2 hw_main: handle implicit float conversion cases explicitly 2025-12-04 01:23:36 +01:00
Alug b27275b887 hw_batching: fix typo in non shader polygon comparitor
checked poly1 against poly1 sky
2025-12-03 18:15:30 +01:00
indev c81c2c1d8d Add option to show current song credits in pause menu 2025-12-03 15:47:38 +03:00
indev ccfab57a8c Add 'time per frame' argument for hud.setVoteBackground 2025-12-02 23:59:02 +03:00
Alug 56d1343f1b dont call CON_Drawer during frameskip, just call CON_MoveConsole instead
fixes the issue at hand, without making the console flicker in gifs
sigh....
2025-12-02 20:49:56 +01:00
indev b273bc3ca8 Hide localskins menus immediately when option is changed
@Alug :blobhug:
2025-12-02 22:12:49 +03:00
Alug d4f58a885b add toggle to let console prints show in main menus
if you want this for some reason
2025-12-02 20:07:56 +01:00
Alug 04458f18f8 m_menu: fix splitscreen players being unable to change the names from player setup
smol oversight :blobcatpats:
2025-12-02 19:43:05 +01:00
indev 64152eea0d Fix few possible multithreading bugs related to ReplayNamesLoadThread 2025-12-02 20:59:27 +03:00
indev 0e0a690e3c Print a warning when luaL_resourcetryagain force triggers garbage collector 2025-12-02 20:39:38 +03:00
Alug f283d3ca43 suppress wrong "-Warray-bounds" warning in G_DeviceLEDTick
newer gcc does this for whatever reason, its fine
splitscreen will never call this out of its bounds
2025-12-02 18:40:30 +01:00
Alug 982fff959f blua: attempt emergency garbo collection on file io operations if they fail
ports of
https://github.com/lua/lua/commit/e885dee5ab4dbee2457ee2023340e848fdabdef9

and

https://github.com/lua/lua/commit/3d838f635cc81ec3332f9a904992db1c6d8a46ad

prevents massive memory leaks and other issues due to faulty lua scripts
2025-12-02 18:31:32 +01:00
Alug b0e968e3c3 raise version number to 9.2 2025-12-02 15:54:53 +01:00
Alug e5bbb14ce0 replayhut: fix race condition in M_ResetDemoList freeing the demolist vars
in rare cases this could free the data the thread is currently using
so we gotta wait for it to finish first
2025-12-02 14:59:12 +01:00
Alug 327cca2e8e change freecam condition for awayview
shouldnt change the behavior much as we wont see anything without a camera, but this is explicit about what exactly is wanted (i.e. thiscam may be null, we only check due to null deref, we only care about if freecam is active)
2025-12-02 12:48:47 +01:00
Alug e02e9a12d7 ticcmd: replace magic numbers with constants
names lifted from RR
2025-12-02 12:48:43 +01:00
Alug 9e2fd091a8 remove the wonky double tap input for controllers
finally figured out what occasionally messed up my bound controls lol
why in the world is this even a thing for controllers??
2025-12-02 00:58:18 +01:00
Alug 0a04fca634 remove mlooky, rename mousesens to mousexsens, make mouse y sensitivity not be affected by x sensitivity
mlooky basically just took the place of mousey, which did nothing before, but is a better name
2025-12-02 00:55:59 +01:00
Alug 8a3f793324 g_input: init some globals that were missed 2025-12-02 00:43:27 +01:00
Alug e91892849c dont let splitplayers 3 and 4 input gamecontrols in the menu
oversight lul
2025-12-02 00:43:22 +01:00
Alug 6b4e3c9d13 update saturn credits
phew so every line now has two names
otherwise we cannot fit everything and anyone into this anymore
this even allowed to put back the tooltip at the bottom
i still want to redo the credits completely at some point with some cool stuff though
2025-12-01 23:41:27 +01:00
indev 5f55b81fbf Fix M_ClearMenus being called too early in map command func 2025-12-02 00:51:40 +03:00
Alug ca68bab002 fix more cases of dangerous PU_PATCH_LOWPRIORITY 2025-12-01 22:31:20 +01:00
Alug 339eb1879e fix the credits freeing our HUD item patches
goddamit i hate PU_PATCH_LOWPRIORITY
2025-12-01 22:24:42 +01:00
indev 1adb49c65c Fix emotes being slightly offset in chat log 2025-12-02 00:02:55 +03:00
Alug 1d33a05a85 Fix some Serverbrowser issues
- Fix serverlist results not being properly reset, which lead to reopening/refreshing the serverlist to show the old state, selecting one of those "old" servers then lead to just connecting to nothing
- Fix the resfresh button making servers disappear if hit too often too fast (from srb2)

https://codeberg.org/srb2classic/srb2classic/commit/3acc312923da0fe5e07c0517d9bff9e8b657b1eb
2025-12-01 21:57:57 +01:00
Alug cfcd20d44a G_AdjustViewEx and macro for G_AdjustView
neppy likes it more which is fair so we do this too
2025-12-01 21:08:30 +01:00
Alug 204607e272 replays: always check if map is loaded not just in old 1.0 replays
cause like, otherwise it will just I_Error which is worse lol
like this we just get thrown back to titlescreen
2025-12-01 21:03:57 +01:00
Alug b89a8ca6f9 replays: properly throw player back to titlescreen from replay error
fixes the game becoming stuck in limbo state if replay fails to start
2025-12-01 21:03:57 +01:00
indev d4aa352d59 Don't try to open replay if no replays are found 2025-12-01 22:49:36 +03:00
Alug c489841732 Fix record attack ghosts sometimes crashing
due to ghosts occasionally ending to early and game interpreting them as still valid uhhhhh
lets pray this wont explode or cause any weird issues......

credits to RR

REVERT THIS ONCE I GO AND FIXUP THE REPLAY MESS
2025-12-01 20:19:11 +01:00
Alug a6a97b4c4f add gdb_history to gitignore 2025-12-01 20:19:03 +01:00
indev fba070f82e Expose cameras to lua outside of hud hooks 2025-12-01 21:08:24 +03:00
Alug 10c117f95f dont reset freecam if the player you are "supposed to be watching" specs in replays
this aint pretty, but im too lazy to make it pretty sincerly
2025-12-01 18:23:51 +01:00
Alug bceda5beb4 dont force awayview when in freecam 2025-12-01 18:23:48 +01:00
Alug c50c936b1f 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-11-30 20:28:46 +01:00
93 changed files with 1960 additions and 3655 deletions

No files matched your search

+8 -1
View File
@@ -13,10 +13,12 @@ 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) ## hud.setVoteBackground(name[, time\_per\_frame])
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.
@@ -120,6 +122,11 @@ 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
+6 -10
View File
@@ -972,14 +972,6 @@ 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
@@ -1707,8 +1699,12 @@ 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-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
https://libsdl.org/ https://www.libsdl.org/hg.php
- 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
@@ -1,41 +0,0 @@
# 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,3 +1,4 @@
/cscope.out /cscope.out
*.json *.json
*.idx *.idx
*.gdb_history
+2 -2
View File
@@ -64,7 +64,7 @@ endif
# This must have high to low order. # This must have high to low order.
gcc_versions:=\ gcc_versions:=\
151 150 15\ 152 151 150 15\
142 141 140 14\ 142 141 140 14\
132 131 130 13\ 132 131 130 13\
123 122 121 120 12\ 123 122 121 120 12\
@@ -77,7 +77,7 @@ gcc_versions:=\
55 54 53 52 51 50\ 55 54 53 52 51 50\
49 48 47 46 45 44 43 42 41 40 49 48 47 46 45 44 43 42 41 40
latest_gcc_version:=15.1.1 latest_gcc_version:=15.2
# Automatically set version flag, but not if one was # Automatically set version flag, but not if one was
# manually set. And don't bother if this is a clean only # manually set. And don't bother if this is a clean only
+1 -1
View File
@@ -8,7 +8,6 @@ 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
@@ -92,6 +91,7 @@ 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),\
+9 -13
View File
@@ -29,19 +29,8 @@ 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
@@ -56,8 +45,15 @@ opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c sources+=sdl/i_threads.c
endif endif
SDL_PKGCONFIG?=sdl3 ifdef SDL_PKGCONFIG
$(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
+1 -1
View File
@@ -20,7 +20,7 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
CXXFLAGS+= -Wno-aggregate-return CXXFLAGS+= -Wno-aggregate-return
# -W -Wno-unused # -W -Wno-unused
WFLAGS:=-Wall -Wno-trigraphs WFLAGS:=-Wall -Wno-trigraphs -Wnull-dereference
ifndef GCC295 ifndef GCC295
#WFLAGS+=-Wno-packed #WFLAGS+=-Wno-packed
endif endif
+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/SDL3 mixer_opts:=-I$(lib)/include/SDL2
mixer_libs:=-L$(lib)/lib mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw) lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL3\ SDL_opts:=-I$(lib)/include/SDL2\
$(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 -lSDL3main -lSDL3 -mwindows -lmingw32 -lSDL2main -lSDL2 -mwindows
$(eval $(call _set,SDL)) $(eval $(call _set,SDL))
endif endif
+1 -1
View File
@@ -1,3 +1,4 @@
string.c
am_map.c am_map.c
b_bot.c b_bot.c
command.c command.c
@@ -42,7 +43,6 @@ 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
-4
View File
@@ -226,10 +226,6 @@ const char *I_LocateWad(void)
return "/sdcard/srb2"; return "/sdcard/srb2";
} }
void I_GetJoystickEvents(void){}
void I_GetJoystick2Events(void){}
char *I_GetEnv(const char *name) char *I_GetEnv(const char *name)
{ {
LOGW("I_GetEnv() called?!"); LOGW("I_GetEnv() called?!");
+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))>>16; cmd->angleturn = abs((signed)(tails->angle - sonic->angle)) >> TICCMD_REDUCE;
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>>16; cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (backward) if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16; cmd->forwardmove -= MAXPLMOVE<<FRACBITS >> TICCMD_REDUCE;
if (left || strafeleft) if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16; cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (right || straferight) if (right || straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16; cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
} 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>>16; cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (right || straferight) if (right || straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16; cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
} }
} else { } else {
if (forward) if (forward)
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16; cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (backward) if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16; cmd->forwardmove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
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>>16; cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (straferight) if (straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16; cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
} }
if (jump) if (jump)
cmd->buttons |= BT_DRIFT; cmd->buttons |= BT_DRIFT;
+51
View File
@@ -93,6 +93,57 @@ 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,6 +95,8 @@ 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);
+23 -15
View File
@@ -58,12 +58,6 @@ 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))
@@ -165,6 +159,24 @@ 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)
{ {
@@ -212,7 +224,7 @@ static int io_open(lua_State *L)
} }
pf = newfile(L); pf = newfile(L);
*pf = fopen(destFilename, mode); *pf = trytoopen(L, destFilename, mode);
return (*pf == NULL) ? pushresult(L, 0, filename) : 1; return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
} }
@@ -220,6 +232,8 @@ 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;
} }
@@ -238,10 +252,7 @@ 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) {
FILE **pf = newfile(L); opencheck(L, filename, mode);
*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 */
@@ -290,10 +301,7 @@ static int io_lines (lua_State *L) {
} }
else { else {
const char *filename = luaL_checkstring(L, 1); const char *filename = luaL_checkstring(L, 1);
FILE **pf = newfile(L); opencheck(L, filename, "r");
*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;
} }
+2 -2
View File
@@ -655,7 +655,7 @@ static void COM_Alias_f(void)
CONS_Printf(M_GetText("All aliases that start with \x87'%s'\x80 are:\n"), begin); CONS_Printf(M_GetText("All aliases that start with \x87'%s'\x80 are:\n"), begin);
int count = 0; int count = 0;
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next) for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
{ {
if (strncmp(begin, head->name, szBegin) == 0) if (strncmp(begin, head->name, szBegin) == 0)
{ {
@@ -676,7 +676,7 @@ static void COM_Alias_f(void)
/* Display alias subtext, show all aliases. */ /* Display alias subtext, show all aliases. */
CONS_Printf(M_GetText("alias <name> <command>: create a shortcut command that executes other command(s)\n")); CONS_Printf(M_GetText("alias <name> <command>: create a shortcut command that executes other command(s)\n"));
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next) for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
{ {
CONS_Printf(alias_format, head->name, head->value); CONS_Printf(alias_format, head->name, head->value);
} }
+12 -4
View File
@@ -169,6 +169,8 @@ 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);
// //
@@ -426,6 +428,7 @@ 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
@@ -586,12 +589,18 @@ static void CON_ChangeHeight(void)
// Handles Console moves in/out of screen (per frame) // Handles Console moves in/out of screen (per frame)
// //
static void CON_MoveConsole(void) 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)
{ {
@@ -1584,13 +1593,12 @@ void CON_Drawer(void)
} }
// console movement // console movement
if (con_curlines != con_destlines) CON_MoveConsole();
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) || gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS || (cons_consoleprintinmenu.value && gamestate == GS_TITLESCREEN))
CON_DrawHudlines(); CON_DrawHudlines();
Unlock_state(); Unlock_state();
+2
View File
@@ -36,6 +36,7 @@ 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;
@@ -51,6 +52,7 @@ 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
+32 -51
View File
@@ -1777,6 +1777,9 @@ static void SV_SendPlayerInfo(INT32 node)
static void SV_SendMapIcon(INT32 node) static void SV_SendMapIcon(INT32 node)
{ {
if (node == 0)
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom); doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
const char *map = va("%sP", G_BuildMapName(gamemap)); const char *map = va("%sP", G_BuildMapName(gamemap));
@@ -2071,6 +2074,7 @@ 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");
@@ -2154,7 +2158,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 << 16)); P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << TICCMD_REDUCE));
} }
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
@@ -2193,12 +2197,8 @@ 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)
{ {
@@ -2211,8 +2211,7 @@ 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)
@@ -2229,8 +2228,6 @@ 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)
@@ -2264,7 +2261,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);
@@ -2282,14 +2279,12 @@ 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
@@ -2302,42 +2297,20 @@ 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).
}
}
serverlistultimatecount = i; // Force close the connection so that servers can't eat
} // 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
void CL_TimeoutServerList(void) // servers again when they send SERVERINFO to us later!
{ //
if (netgame && serverlistultimatecount > serverlistcount) // (Note: as a side effect this probably means every
{ // server in the list will probably be using the same node (e.g. node 1),
const tic_t timediff = I_GetTime() - serverlistepoch; // not that it matters which nodes they use when
const tic_t timetoresend = timediff % SERVERLISTRESENDRATE; // the connections are closed afterwards anyway)
const boolean timedout = timediff > connectiontimeout; // -- Monster Iestyn 12/11/18
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;
} }
} }
} }
@@ -3504,6 +3477,9 @@ void CL_Reset(void)
memset(player_muted, 0, sizeof(player_muted)); memset(player_muted, 0, sizeof(player_muted));
for (INT32 i = 0; i < MAXPLAYERS; ++i)
playerinfo[i].node = 255;
// D_StartTitle should get done now, but the calling function will handle it // D_StartTitle should get done now, but the calling function will handle it
} }
@@ -4292,6 +4268,9 @@ void D_ClientServerInit(void)
#endif #endif
D_LoadBan(false); D_LoadBan(false);
for (INT32 i = 0; i < MAXPLAYERS; ++i)
playerinfo[i].node = 255;
gametic = 0; gametic = 0;
localgametic = 0; localgametic = 0;
@@ -4527,7 +4506,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 << 16)); P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << TICCMD_REDUCE));
D_SendPlayerConfig(); D_SendPlayerConfig();
addedtogame = true; addedtogame = true;
@@ -6474,6 +6453,7 @@ 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
@@ -6619,7 +6599,8 @@ 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,7 +516,6 @@ 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
@@ -627,7 +626,6 @@ 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);
+4 -5
View File
@@ -792,9 +792,9 @@ void D_SRB2Loop(void)
} }
else if (!dedicated) else if (!dedicated)
{ {
// always update console and hud // always update console movement
// otherwise it may take minutes to open it // otherwise it will takes literal ages to open
CON_Drawer(); CON_MoveConsole();
} }
} }
@@ -885,7 +885,6 @@ 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);
@@ -1264,7 +1263,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) #if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#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); \
+7 -1
View File
@@ -492,6 +492,7 @@ 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);
@@ -1224,7 +1225,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;
} }
@@ -1266,6 +1267,7 @@ 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.
@@ -1301,6 +1303,7 @@ 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);
@@ -1309,14 +1312,17 @@ 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
+33 -4
View File
@@ -144,6 +144,7 @@ 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);
@@ -270,7 +271,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_YesNo, 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_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};
@@ -638,6 +639,7 @@ 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);
@@ -937,6 +939,7 @@ 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);
@@ -994,6 +997,8 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_litesteer[i]); CV_RegisterVar(&cv_litesteer[i]);
CV_RegisterVar(&cv_autoaccel[i]);
CV_RegisterVar(&cv_usejoystick[i]); CV_RegisterVar(&cv_usejoystick[i]);
CV_RegisterVar(&cv_joyscale[i]); CV_RegisterVar(&cv_joyscale[i]);
CV_RegisterVar(&cv_rumble[i]); CV_RegisterVar(&cv_rumble[i]);
@@ -1003,7 +1008,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_usemouse); CV_RegisterVar(&cv_usemouse);
CV_RegisterVar(&cv_invertmouse); CV_RegisterVar(&cv_invertmouse);
CV_RegisterVar(&cv_mousesens); CV_RegisterVar(&cv_mousexsens);
CV_RegisterVar(&cv_mouseysens); CV_RegisterVar(&cv_mouseysens);
CV_RegisterVar(&cv_mousevisible); CV_RegisterVar(&cv_mousevisible);
@@ -2647,7 +2652,6 @@ static void Command_Map_f(void)
return; return;
} }
M_ClearMenus(true);
last_map_cmd = I_GetTime(); last_map_cmd = I_GetTime();
@@ -2830,6 +2834,8 @@ 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);
} }
@@ -4720,7 +4726,30 @@ static void Command_ListWADS_f(void)
} }
} }
#define MAXDOOMEDNUM 4095 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);
}
}
static void Command_ListDoomednums_f(void) static void Command_ListDoomednums_f(void)
{ {
+6 -2
View File
@@ -1163,8 +1163,12 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
filestatus_t homecheck; // store result of last file search filestatus_t homecheck; // store result of last file search
boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third) boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third)
// skip for startup, our mainwads wont be in there // see IdentifyVersion
if (loaded_config) // Iwads skip findfile due to passing fullpath to W_OpenWadFile
#if 0
// skip for Iwads, as they wont be in there
if (!startupiwadcount)
#endif
{ {
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0') if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
{ {
+8 -3
View File
@@ -46,15 +46,20 @@ 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 1 #define TICCMD_RECEIVED (0x01) /* Actual tic recieved from client */
#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; // <<16 for angle delta - saved as 1 byte into demos INT16 angleturn; // << TICCMD_REDUCE 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
+3 -7
View File
@@ -167,6 +167,8 @@ static char returnWadPath[256];
#include "../i_video.h" #include "../i_video.h"
#include "../i_sound.h" #include "../i_sound.h"
#include "../i_system.h" #include "../i_system.h"
#include "../i_time.h"
#include "../i_net.h"
#include "../screen.h" //vid.WndParent #include "../screen.h" //vid.WndParent
#include "../d_net.h" #include "../d_net.h"
#include "../g_game.h" #include "../g_game.h"
@@ -196,8 +198,6 @@ UINT8 keyboard_started = false;
#ifdef HAVE_TERMIOS #ifdef HAVE_TERMIOS
// TERMIOS console code from Quake3: thank you! // TERMIOS console code from Quake3: thank you!
boolean stdin_active = true;
typedef struct typedef struct
{ {
size_t cursor; size_t cursor;
@@ -699,11 +699,7 @@ void I_JoyScale4(void)
*/ */
void I_ShutdownJoystick(void) void I_ShutdownJoystick(UINT8 index)
{
}
void I_GetJoystickEvents(UINT8 index)
{ {
(void)index; (void)index;
} }
+7
View File
@@ -129,6 +129,13 @@ INT32 VID_SetMode(INT32 modeNum)
return true; return true;
} }
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height)
{
(void)width;
(void)height;
return false;
}
void I_StartupGraphics(void) void I_StartupGraphics(void)
{ {
} }
+3 -4
View File
@@ -20,7 +20,6 @@
// 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
@@ -28,7 +27,7 @@
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
#define SOUND SOUND_MIXER #define SOUND SOUND_MIXER
#else #else
#define SOUND SOUND_SDL #define SOUND SOUND_DUMMY
#endif #endif
#else #else
#define SOUND SOUND_DUMMY #define SOUND SOUND_DUMMY
@@ -108,8 +107,8 @@ 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.x - Testing" #define VERSIONSTRING "Saturn v9.2"
#define VERSIONSTRINGW L"Saturn v9.x - Testing " #define VERSIONSTRINGW L"Saturn v9.2"
#define SATURN_TESTING // comment out for saturn release builds! #define SATURN_TESTING // comment out for saturn release builds!
+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 (debugfile) { fputs(msg, debugfile); fflush(debugfile); } } #define DEBFILE(msg) { if (UNLIKELY(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_LOWPRIORITY), 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), colormap);
} }
// Dim the background // Dim the background
+2 -2
View File
@@ -10,7 +10,7 @@ FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c)
} }
// case-sensitive of the above // case-sensitive of the above
FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c) FUNCINLINE static ATTRINLINE PUREFUNC boolean fastcmp(const char *s, const char *c)
{ {
for (; *s && *s == *c; s++, c++) ; for (; *s && *s == *c; s++, c++) ;
return (*s == *c); // make sure both strings ended return (*s == *c); // make sure both strings ended
@@ -18,7 +18,7 @@ FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
// length-limited of the above // length-limited of the above
// only true if both strings are at least l characters long AND match, case-sensitively! // only true if both strings are at least l characters long AND match, case-sensitively!
FUNCINLINE static ATTRINLINE boolean fastncmp(const char *s, const char *c, UINT16 l) FUNCINLINE static ATTRINLINE PUREFUNC boolean fastncmp(const char *s, const char *c, UINT16 l)
{ {
for (; *s && *s == *c && --l; s++, c++) ; for (; *s && *s == *c && --l; s++, c++) ;
return !l; // make sure you reached the end return !l; // make sure you reached the end
+155 -86
View File
@@ -55,6 +55,8 @@
#include "k_stats.h" // SRB2kart #include "k_stats.h" // SRB2kart
#include "r_fps.h" // frame interpolation/uncapped #include "r_fps.h" // frame interpolation/uncapped
#include <errno.h>
#ifdef HAVE_DISCORDRPC #ifdef HAVE_DISCORDRPC
#include "discord.h" #include "discord.h"
#endif #endif
@@ -246,10 +248,12 @@ 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 (players[p].mo) if (player->mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..? P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
} }
if (extradata & DXD_SKIN) if (extradata & DXD_SKIN)
@@ -264,11 +268,11 @@ void G_ReadDemoExtraData(void)
kartspeed = READUINT8(demobuf.p); kartspeed = READUINT8(demobuf.p);
kartweight = READUINT8(demobuf.p); kartweight = READUINT8(demobuf.p);
if (!fasticmp(skins[players[p].skin].name, name)) if (!fasticmp(skins[player->skin].name, name))
FindClosestSkinForStats(p, kartspeed, kartweight); FindClosestSkinForStats(p, kartspeed, kartweight);
players[p].kartspeed = kartspeed; player->kartspeed = kartspeed;
players[p].kartweight = kartweight; player->kartweight = kartweight;
} }
if (extradata & DXD_COLOR) if (extradata & DXD_COLOR)
@@ -279,9 +283,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
{ {
players[p].skincolor = i; player->skincolor = i;
if (players[p].mo) if (player->mo)
players[p].mo->color = i; player->mo->color = i;
break; break;
} }
} }
@@ -300,17 +304,17 @@ void G_ReadDemoExtraData(void)
switch (extradata) switch (extradata)
{ {
case DXD_PST_PLAYING: case DXD_PST_PLAYING:
players[p].pflags |= PF_WANTSTOJOIN; // fuck you player->pflags |= PF_WANTSTOJOIN; // fuck you
break; break;
case DXD_PST_SPECTATING: case DXD_PST_SPECTATING:
players[p].pflags &= ~PF_WANTSTOJOIN; // double-fuck you player->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);
players[p].spectator = true; player->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)
@@ -318,11 +322,11 @@ void G_ReadDemoExtraData(void)
} }
else else
{ {
players[p].spectator = true; player->spectator = true;
if (players[p].mo) if (player->mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL); P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL);
else else
players[p].playerstate = PST_REBORN; player->playerstate = PST_REBORN;
} }
break; break;
case DXD_PST_LEFT: case DXD_PST_LEFT:
@@ -330,7 +334,7 @@ void G_ReadDemoExtraData(void)
break; break;
} }
G_ResetViews(); G_ResetViews(false); // dont reset our freecam pls thx!
// maybe these are necessary? // maybe these are necessary?
if (G_BattleGametype()) if (G_BattleGametype())
@@ -1132,7 +1136,29 @@ 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 = READUINT8(g->p); UINT8 ziptic;
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)
@@ -1140,8 +1166,14 @@ void G_GhostTicker(void)
#endif #endif
while (ziptic != DW_END) // Get rid of extradata stuff while (ziptic != DW_END) // Get rid of extradata stuff
{ {
if (ziptic == 0) // Only support player 0 info for now if (ziptic < MAXPLAYERS)
{ {
#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)
@@ -1153,13 +1185,26 @@ void G_GhostTicker(void)
if (ziptic & DXD_NAME) if (ziptic & DXD_NAME)
g->p += 16; // yea g->p += 16; // yea
if (ziptic & DXD_PLAYSTATE && READUINT8(g->p) != DXD_PST_PLAYING) if (ziptic & DXD_PLAYSTATE)
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);
} }
@@ -1182,7 +1227,7 @@ void G_GhostTicker(void)
if (ziptic & ZT_DRIFT) if (ziptic & ZT_DRIFT)
g->p += 2; g->p += 2;
if (ziptic & ZT_LATENCY) if (ziptic & ZT_LATENCY)
g->p += 1; g->p++;
// Grab ghost data. // Grab ghost data.
ziptic = READUINT8(g->p); ziptic = READUINT8(g->p);
@@ -1191,10 +1236,12 @@ void G_GhostTicker(void)
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
else if (ziptic != 0) if (ziptic != 0)
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 ZIPTIC"); //@TODO lmao don't blow up like this
ziptic = READUINT8(g->p); ziptic = READUINT8(g->p);
#ifdef DEMO_COMPAT_100 #ifdef DEMO_COMPAT_100
} }
@@ -1365,7 +1412,7 @@ void G_GhostTicker(void)
{ {
#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"); //@TODO lmao don't blow up like this I_Error("Ghost is not a record attack ghost GHOSTEND"); //@TODO lmao don't blow up like this
#ifdef DEMO_COMPAT_100 #ifdef DEMO_COMPAT_100
} }
#endif #endif
@@ -1385,20 +1432,6 @@ 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;
} }
} }
@@ -1593,7 +1626,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(); G_ResetViews(true);
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]);
@@ -2370,49 +2403,69 @@ static long G_GetCreationTime(char *filepath)
static char *G_GetDemoDate(menudemo_t *pdemo) static char *G_GetDemoDate(menudemo_t *pdemo)
{ {
char *datetime; char *endPos = NULL;
datetime = malloc(sizeof(pdemo->date)); // mallocma balls static char datetime[11];
// no mallocma balls... :c
if (!datetime)
{
return NULL;
}
time_t file_time = 0; time_t file_time = 0;
const char *format = NULL;
struct tm *tm_buf = NULL;
CLEANUP(pfree) char *filename = NULL;
// get le filepath // get le filepath
char *filename;
filename = strdup(pdemo->filepath); filename = strdup(pdemo->filepath);
#if defined (_WIN32)
if (!filename) if (!filename)
{ {
// if we cant get a filename try just getting the file create time #if defined (_WIN32)
// if we cant get a filename try just getting the file creation time
file_time = G_GetCreationTime(pdemo->filepath); file_time = G_GetCreationTime(pdemo->filepath);
goto skipfilenametime; goto skipfilenametime;
}
#else #else
if (!filename)
{
free(datetime);
return NULL; return NULL;
}
#endif #endif
}
// get the actual filename Zzz... // get the actual filename Zzz...
nameonly(filename); nameonly(filename);
// convert it to long Zzz.... // the first 10 characters of a replay name usually is a unix timestamp
file_time = strtol(filename, NULL, 10);
free(filename); // dont need this anymore a // not long enough to contain a valid timestamp
if (strlen(filename) < 10)
{
#if defined (_WIN32)
// try to get file creation time
file_time = G_GetCreationTime(pdemo->filepath);
goto skipfilenametime;
#else
return NULL;
#endif
}
#ifndef AVOID_ERRNO
errno = 0;
#endif
// get the timestamp as actual numbers lul
file_time = strtol(filename, &endPos, 10);
if (endPos == filename // Empty string
#ifndef AVOID_ERRNO
|| errno == ERANGE // Number out-of-range
#endif
|| file_time < 0) // Number is not positive
{
#if defined (_WIN32)
// just try and get the creation time then
file_time = G_GetCreationTime(pdemo->filepath);
#else
return NULL;
#endif
}
#if defined (_WIN32) #if defined (_WIN32)
skipfilenametime: skipfilenametime:
#endif #endif
// then throw it into localtime to get an actual human readable format lmao // then throw it into localtime to get an actual human readable format lmao
struct tm *tm_buf = NULL;
tm_buf = localtime(&file_time); tm_buf = localtime(&file_time);
// cant believe we ended up in 1970 // cant believe we ended up in 1970
@@ -2425,14 +2478,10 @@ skipfilenametime:
tm_buf = localtime(&file_time); tm_buf = localtime(&file_time);
if (tm_buf == NULL || tm_buf->tm_year <= 110) if (tm_buf == NULL || tm_buf->tm_year <= 110)
{
free(datetime);
return NULL; return NULL;
}
goto gotcreationtime; goto gotcreationtime;
#else #else
free(datetime);
return NULL; return NULL;
#endif #endif
} }
@@ -2441,17 +2490,27 @@ skipfilenametime:
gotcreationtime: gotcreationtime:
#endif #endif
const char *format;
// US ppl are special (: // US ppl are special (:
if (cv_demodateformat.value == 2) if (cv_demodateformat.value == 2)
format = "%m.%d.%Y"; format = "%m.%d.%Y";
else if (cv_demodateformat.value == 1) else if (cv_demodateformat.value == 1)
format = "%d.%m.%Y"; format = "%d.%m.%Y";
else else
format = strstr(setlocale(LC_TIME, NULL), "en_US") ? "%m.%d.%Y" : "%d.%m.%Y"; {
const char *locale = setlocale(LC_TIME, NULL);
strftime(datetime, sizeof(pdemo->date), format, tm_buf); if (locale == NULL)
format = "%d.%m.%Y"; // fallback to non US format
else if (strstr(locale, "en_US"))
format = "%m.%d.%Y";
else
format = "%d.%m.%Y";
}
if (strftime(datetime, sizeof(datetime), format, tm_buf) == 0)
{
return NULL;
}
return datetime; return datetime;
} }
@@ -2460,6 +2519,7 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
{ {
UINT8 infobuffer[96], *info_p; UINT8 infobuffer[96], *info_p;
UINT16 pdemoversion; UINT16 pdemoversion;
char *demodate = NULL;
size_t count; size_t count;
FILE *handle = fopen(pdemo->filepath, "rb"); FILE *handle = fopen(pdemo->filepath, "rb");
@@ -2498,13 +2558,13 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
memcpy(pdemo->title, info_p, 64); memcpy(pdemo->title, info_p, 64);
// demo date // demo date
char *demodate;
demodate = G_GetDemoDate(pdemo); demodate = G_GetDemoDate(pdemo);
if (demodate) if (demodate)
strncpy(pdemo->date, demodate, sizeof(pdemo->date)); {
strlcpy(pdemo->date, demodate, sizeof(pdemo->date));
}
free(demodate);
break; break;
#ifdef DEMO_COMPAT_100 #ifdef DEMO_COMPAT_100
case 0x0001: case 0x0001:
@@ -2581,7 +2641,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
return; return;
} }
@@ -2593,7 +2653,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
return; return;
} }
else // it's an internal demo else // it's an internal demo
@@ -2613,7 +2673,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2639,7 +2699,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2650,7 +2710,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2667,7 +2727,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2725,7 +2785,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
@@ -2763,6 +2823,16 @@ void G_DoPlayDemo(char *defdemoname)
#endif #endif
demobuf.p += 4; // Extrainfo location demobuf.p += 4; // Extrainfo location
// ...*map* not loaded?
if (!gamemap || (gamemap > NUMMAPS) || (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR))
{
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)
{ {
@@ -2790,7 +2860,7 @@ 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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2800,7 +2870,7 @@ void G_DoPlayDemo(char *defdemoname)
{ {
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname); snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg); CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2823,7 +2893,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2861,7 +2931,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2910,7 +2980,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -2922,7 +2992,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, NULL, MM_NOTHING); M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback(); G_ResetDemoPlayback();
return; return;
} }
@@ -3532,7 +3602,6 @@ void G_FreeGhosts(void)
ghosts = NULL; ghosts = NULL;
} }
boolean G_CheckDemoStatus(void) boolean G_CheckDemoStatus(void)
{ {
G_FreeGhosts(); G_FreeGhosts();
+1
View File
@@ -149,6 +149,7 @@ 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;
+90 -22
View File
@@ -312,6 +312,8 @@ 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};
@@ -452,6 +454,14 @@ consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS] = {
{"litesteer4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL} {"litesteer4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
}; };
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
{"autoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"autoaccel2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"autoaccel3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"autoaccel4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
};
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}}; static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -662,7 +672,7 @@ INT16 G_ClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle) else if (*aiming < -limitangle)
*aiming = -limitangle; *aiming = -limitangle;
return (INT16)((*aiming)>>16); return (INT16)((*aiming) >> TICCMD_REDUCE);
} }
INT16 G_SoftwareClipAimingPitch(INT32 *aiming) INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
@@ -675,7 +685,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle) else if (*aiming < -limitangle)
*aiming = -limitangle; *aiming = -limitangle;
return (INT16)((*aiming)>>16); return (INT16)((*aiming) >> TICCMD_REDUCE);
} }
INT32 JoyAxis(axis_input_e axissel, UINT8 player) INT32 JoyAxis(axis_input_e axissel, UINT8 player)
@@ -798,6 +808,10 @@ static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16}; static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
//
// G_HandleLocalDriftturn
// Hack for Lua menus that check directional inputs with driftturn
//
static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer) static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
{ {
INT32 axis = 0; INT32 axis = 0;
@@ -860,9 +874,8 @@ static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
// //
static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam) static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
{ {
boolean moveinput = false;
INT32 axis = 0; INT32 axis = 0;
const boolean usejoystick = (cv_usejoystick[(ssplayer-1)].value); const boolean usejoystick = cv_usejoystick[(ssplayer-1)].value;
// check for inputs and return button commands // check for inputs and return button commands
// for stuff like joining with item button, saltyhop, honking, etc. // for stuff like joining with item button, saltyhop, honking, etc.
@@ -897,15 +910,11 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
#undef CHECKINPUT #undef CHECKINPUT
moveinput = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer)
|| InputDown(gc_aimforward, ssplayer) || InputDown(gc_aimbackward, ssplayer) ||
(usejoystick && JoyAxis(AXISAIM, ssplayer) != 0) || (usejoystick && JoyAxis(AXISTURN, ssplayer) != 0));
axis = JoyAxis(AXISLOOKBACK, ssplayer); axis = JoyAxis(AXISLOOKBACK, ssplayer);
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0)); camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
// Reset to our spec player if we watch someone else. // Reset to our spec player if we watch someone else.
if ((moveinput || cmd->buttons) if ((cmd->driftturn || cmd->buttons)
&& displayplayers[0] != consoleplayer && ssplayer == 1) && displayplayers[0] != consoleplayer && ssplayer == 1)
{ {
if (cv_director.value) if (cv_director.value)
@@ -917,6 +926,63 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
} }
} }
//
// G_HandleAutoAcceleration
//
static void G_HandleAutoAcceleration(ticcmd_t *cmd, player_t *player, UINT8 forplayer)
{
if (!cv_autoaccel[forplayer].value)
return;
if (gamestate != GS_LEVEL)
return;
// dont accel before and during countdown
if (leveltime <= starttime)
return;
// dont do this in menus or when console is onscreen
if (menuactive || CON_Ready())
return;
// gotta have a player that aint respawning
if (!player->mo || player->kartstuff[k_respawn])
return;
// dont need for "finished" players
if (player->exiting || (player->pflags & PF_TIMEOVER))
return;
// dont do during spinout
if (player->kartstuff[k_spinouttimer])
return;
// spectators and freecam dont need special handling, see G_BuildTiccmd
if (cmd->buttons & BT_BRAKE)
{
if (cmd->buttons & BT_DRIFT ||
player->kartstuff[k_sneakertimer] ||
player->kartstuff[k_squishedtimer])
{
cmd->forwardmove = (SINT8)forwardmove[0];
cmd->buttons |= BT_ACCELERATE;
}
else
{
// allows us to drive backwards if we need to
if (cmd->forwardmove > 0)
cmd->forwardmove = 0;
cmd->buttons &= ~BT_ACCELERATE;
}
}
else
{
cmd->forwardmove = (SINT8)forwardmove[1];
cmd->buttons |= BT_ACCELERATE;
}
}
// //
// G_BuildTiccmd // G_BuildTiccmd
// Builds a ticcmd from all of the available inputs // Builds a ticcmd from all of the available inputs
@@ -959,7 +1025,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 >> 16); cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
return; return;
} }
@@ -967,7 +1033,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 >> 16); cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
G_BuildLocalTiccmd(cmd, ssplayer, freecam); G_BuildLocalTiccmd(cmd, ssplayer, freecam);
// let lua override everything // let lua override everything
@@ -1064,7 +1130,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer]) if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer])
{ {
cmd->buttons |= BT_ACCELERATE; cmd->buttons |= BT_ACCELERATE;
forward = forwardmove[1]; // 50 forward = forwardmove[1]; // 50
} }
else if (analogjoystickmove && axis > 0) else if (analogjoystickmove && axis > 0)
{ {
@@ -1127,7 +1193,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
mousex = mousey = mlooky = 0; mousex = mousey = 0;
if (forward > MAXPLMOVE) if (forward > MAXPLMOVE)
forward = MAXPLMOVE; forward = MAXPLMOVE;
@@ -1145,6 +1211,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->sidemove = (SINT8)(cmd->sidemove + side); cmd->sidemove = (SINT8)(cmd->sidemove + side);
} }
G_HandleAutoAcceleration(cmd, player, forplayer);
//{ SRB2kart - Drift support //{ SRB2kart - Drift support
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn // Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
// limit turning to angleturn[1] to stop mouselook letting you look too fast // limit turning to angleturn[1] to stop mouselook letting you look too fast
@@ -1166,10 +1234,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<<16); lang += (cmd->angleturn << TICCMD_REDUCE);
cmd->angleturn = (INT16)(lang >> 16); cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations cmd->latency = modeattacking ? 0 : (leveltime & TICCMD_LATENCYMASK); // Send leveltime when this tic was generated to the server for control lag calculations
if (!hu_stopped) if (!hu_stopped)
{ {
@@ -1750,14 +1818,15 @@ 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_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive) void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam)
{ {
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
camera[viewnum-1].freecam = false; if (resetfreecam)
camera[viewnum-1].freecam = false;
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive); G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
@@ -1771,7 +1840,7 @@ void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
// 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(void) void G_ResetViews(boolean resetfreecam)
{ {
UINT8 splits; UINT8 splits;
UINT8 viewd; UINT8 viewd;
@@ -1795,7 +1864,7 @@ void G_ResetViews(void)
*/ */
for (viewd = 1; viewd <= splits; ++viewd) for (viewd = 1; viewd <= splits; ++viewd)
{ {
G_AdjustView(viewd, 0, false); G_AdjustViewEx(viewd, 0, false, resetfreecam);
} }
} }
@@ -1876,7 +1945,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 & 0xFF) - cmd->latency) & 0xFF, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max cmd->latency = modeattacking ? 0 : min(((leveltime & TICCMD_LATENCYMASK) - cmd->latency) & TICCMD_LATENCYMASK, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
} }
} }
@@ -1884,7 +1953,6 @@ 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)
+6 -3
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; extern consvar_t cv_songcredits, cv_pausesongcredits;
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;
@@ -74,6 +74,8 @@ extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
// Hud offsets // Hud offsets
@@ -262,9 +264,10 @@ 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(void); void G_ResetViews(boolean resetfreecam);
void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive); void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive); void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam);
#define G_AdjustView(v,o,oa) G_AdjustViewEx(v,o,oa, true)
void G_AddPlayer(INT32 playernum); void G_AddPlayer(INT32 playernum);
+15 -11
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_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mousexsens = {"mousexsens", "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, mousey; INT32 mousex = 0, mousey = 0;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
// joystick values are repeated // joystick values are repeated
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET]; INT32 joyxmove[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,9 +192,8 @@ 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_mousesens.value*cv_mousesens.value)/110.0f + 0.1f)); mousex = (INT32)(ev->data2*((cv_mousexsens.value*cv_mousexsens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f)); mousey = (INT32)(ev->data3*((cv_mouseysens.value*cv_mouseysens.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
@@ -215,7 +214,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick3: case ev_joystick3:
i = ev->data1; i = ev->data1;
if (i >= JOYAXISSET) if (i >= JOYAXISSET || menuactive)
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;
@@ -223,7 +222,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick4: case ev_joystick4:
i = ev->data1; i = ev->data1;
if (i >= JOYAXISSET) if (i >= JOYAXISSET || menuactive)
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;
@@ -974,8 +973,13 @@ 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;
+1 -2
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_mousesens, cv_mouseysens; extern consvar_t cv_mousexsens, 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,7 +117,6 @@ 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];
+8 -14
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 = poly1->hash & 0x80000000 ? NULL : poly2->texture; const GLMipmap_t *texture2 = poly2->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(boolean sort) void HWR_RenderBatches(void)
{ {
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,13 +288,10 @@ void HWR_RenderBatches(boolean sort)
polygonArraySorted[i] = &polygonArray[i]; polygonArraySorted[i] = &polygonArray[i];
} }
if (sort) // sort polygons
{ PS_START_TIMING(ps_hw_batchsorttime);
// sort polygons qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
PS_START_TIMING(ps_hw_batchsorttime); PS_STOP_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
@@ -303,9 +300,7 @@ void HWR_RenderBatches(boolean sort)
// 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
// dont overwrite this on consecutive calls PS_START_TIMING(ps_hw_batchdrawtime);
if (!sort)
PS_START_TIMING(ps_hw_batchdrawtime);
currentShader = polygonArraySorted[0]->shader; currentShader = polygonArraySorted[0]->shader;
currentTexture = polygonArraySorted[0]->texture; currentTexture = polygonArraySorted[0]->texture;
@@ -500,8 +495,7 @@ void HWR_RenderBatches(boolean sort)
polygonArraySize = 0; polygonArraySize = 0;
unsortedVertexArraySize = 0; unsortedVertexArraySize = 0;
if (!sort) PS_STOP_TIMING(ps_hw_batchdrawtime);
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(boolean sort); void HWR_RenderBatches(void);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
+2 -5
View File
@@ -619,7 +619,6 @@ static void HWR_PrecacheLevelFlats(void)
// lookup for flats that may´ve been already loaded // lookup for flats that may´ve been already loaded
// too lazy to make a hashtable or smth so unordered set will do :carbuncle: // too lazy to make a hashtable or smth so unordered set will do :carbuncle:
std::unordered_set<UINT32> flatpresent; std::unordered_set<UINT32> flatpresent;
lumpnum_t lump;
size_t i, j; size_t i, j;
INT32 k; INT32 k;
@@ -649,9 +648,8 @@ static void HWR_PrecacheLevelFlats(void)
const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic; const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
const levelflat_t *levelflat = &levelflats[pic]; const levelflat_t *levelflat = &levelflats[pic];
lump = levelflat->lumpnum;
load_flat(lump, R_NoEncore(sec, ceiling)); load_flat(levelflat->lumpnum, R_NoEncore(sec, ceiling));
if (levelflat->speed) // is it an animated flat ? if (levelflat->speed) // is it an animated flat ?
{ {
@@ -672,9 +670,8 @@ static void HWR_PrecacheLevelFlats(void)
for (i = 0; i < numlevelflats; i++) for (i = 0; i < numlevelflats; i++)
{ {
const levelflat_t *levelflat = &levelflats[i]; const levelflat_t *levelflat = &levelflats[i];
lump = levelflat->lumpnum;
load_flat(lump, false); load_flat(levelflat->lumpnum, false);
if (levelflat->speed) // is it an animated flat ? if (levelflat->speed) // is it an animated flat ?
{ {
+203 -171
View File
@@ -643,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 = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize); flatxref = static_cast<float>(static_cast<fixed_t>(pv->x) & (~flatflag)) / fflatsize;
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize); flatyref = static_cast<float>(static_cast<fixed_t>(pv->y) & (~flatflag)) / fflatsize;
if (!isceiling) // it's a floor if (!isceiling) // it's a floor
{ {
@@ -661,9 +661,13 @@ 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);
@@ -807,6 +811,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
} }
} }
} }
#undef SETUP3DVERT
} }
#ifdef WALLSPLATS #ifdef WALLSPLATS
@@ -1366,8 +1371,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 = (float)texturehpeg; const float cliplow = static_cast<float>(texturehpeg);
const float cliphigh = ((float)texturehpeg + (float)gl_curline->length); const float cliphigh = static_cast<float>(texturehpeg) + static_cast<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;
@@ -1381,8 +1386,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 = (float)INT32_MAX / (float)FRACUNIT; static constexpr float FLOATMAX = static_cast<float>(INT32_MAX) / static_cast<float>(FRACUNIT);
static constexpr float FLOATMIN = (float)INT32_MIN / (float)FRACUNIT; static constexpr float FLOATMIN = static_cast<float>(INT32_MIN) / static_cast<float>(FRACUNIT);
// two sided line // two sided line
if (gl_backsector) if (gl_backsector)
@@ -1495,8 +1500,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 = texturevpeg * glTex->scaleY; wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = static_cast<float>(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;
@@ -1504,23 +1509,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 -= (worldtop - gl_frontsector->ceilingheight) * glTex->scaleY; wallVerts[3].t -= static_cast<float>(worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= (worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY; wallVerts[2].t -= static_cast<float>(worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= (worldhigh - gl_backsector->ceilingheight) * glTex->scaleY; wallVerts[0].t -= static_cast<float>(worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= (worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY; wallVerts[1].t -= static_cast<float>(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 = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY; wallVerts[0].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY; wallVerts[1].t = static_cast<float>(texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
} }
else else
{ {
// Skewed by bottom // Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t - static_cast<float>(worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldtopslope - worldhighslope) * glTex->scaleY;
} }
// set top/bottom coords // set top/bottom coords
@@ -1557,8 +1562,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 = texturevpeg * glTex->scaleY; wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg * glTex->scaleY);
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = static_cast<float>(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;
@@ -1566,22 +1571,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 -= (worldbottom - gl_frontsector->floorheight) * glTex->scaleY; wallVerts[0].t -= static_cast<float>(worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= (worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY; wallVerts[1].t -= static_cast<float>(worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= (worldlow - gl_backsector->floorheight) * glTex->scaleY; wallVerts[3].t -= static_cast<float>(worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= (worldlowslope - gl_backsector->floorheight) * glTex->scaleY; wallVerts[2].t -= static_cast<float>(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 = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldlowslope - worldbottomslope) * glTex->scaleY;
} }
else else
{ {
// Skewed by top // Skewed by top
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY; wallVerts[0].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY; wallVerts[1].t = static_cast<float>(texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
} }
// set top/bottom coords // set top/bottom coords
@@ -1743,13 +1748,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 = texturevpeg * glTex->scaleY; wallVerts[3].t = static_cast<float>(texturevpeg * glTex->scaleY);
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY; wallVerts[0].t = static_cast<float>(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 = (hS - lS + texturevpegslope) * glTex->scaleY; wallVerts[1].t = static_cast<float>(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
@@ -1792,28 +1797,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 = texturevpeg * glTex->scaleY; wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = static_cast<float>(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 += (gl_frontsector->ceilingheight - worldtop) * glTex->scaleY; wallVerts[3].t += static_cast<float>(gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY; wallVerts[2].t += static_cast<float>(gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * glTex->scaleY; wallVerts[0].t += static_cast<float>(gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += (gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY; wallVerts[1].t += static_cast<float>(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 + (worldbottom - worldtop) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t + static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t + static_cast<float>((worldbottomslope - worldtopslope)) * glTex->scaleY;
} }
else else
{ {
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY; wallVerts[0].t = wallVerts[3].t - static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY; wallVerts[1].t = wallVerts[2].t - static_cast<float>(worldbottomslope - worldtopslope) * glTex->scaleY;
} }
//Set textures properly on single sided walls that are sloped //Set textures properly on single sided walls that are sloped
@@ -1876,6 +1881,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// Used for height comparisons and etc across FOFs and slopes // Used for height comparisons and etc across FOFs and slopes
fixed_t high1, highslope1, low1, lowslope1; fixed_t high1, highslope1, low1, lowslope1;
fixed_t high2, highslope2, low2, lowslope2;
INT32 texnum; INT32 texnum;
@@ -1888,19 +1894,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{ {
for (rover = gl_backsector->ffloors; rover; rover = rover->next) for (rover = gl_backsector->ffloors; rover; rover = rover->next)
{ {
boolean bothsides = false;
// Skip if it exists on both sectors.
ffloor_t * r2;
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
if (rover->master == r2->master)
{
bothsides = true;
break;
}
if (bothsides)
continue;
const ffloortype_e roverflags = rover->flags; const ffloortype_e roverflags = rover->flags;
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || (roverflags & FF_INVERTSIDES)) if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || (roverflags & FF_INVERTSIDES))
@@ -1912,6 +1905,45 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope)) if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue; continue;
ffloor_t * r2;
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
{
if (r2->master == rover->master) // Skip if same control line.
break;
const ffloortype_e r2flags = r2->flags;
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
continue;
if (rover->flags & FF_EXTRA)
{
if (!(r2flags & FF_CUTEXTRA))
continue;
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
continue;
}
else
{
if (!(r2flags & FF_CUTSOLIDS))
continue;
}
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
continue;
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
continue;
break;
}
if (r2)
continue;
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector); side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
boolean do_texture_skew; boolean do_texture_skew;
@@ -1978,24 +2010,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 = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY; wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY; wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = static_cast<float>((*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 = texturevpeg * glTex->scaleY; wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
} }
else // skew by bottom else // skew by bottom
{ {
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
} }
} }
@@ -2048,19 +2080,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{ {
for (rover = gl_frontsector->ffloors; rover; rover = rover->next) for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
{ {
boolean bothsides = false;
// Skip if it exists on both sectors.
ffloor_t * r2;
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
if (rover->master == r2->master)
{
bothsides = true;
break;
}
if (bothsides)
continue;
const ffloortype_e roverflags = rover->flags; const ffloortype_e roverflags = rover->flags;
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES)) if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES))
@@ -2072,6 +2091,44 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope)) if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue; continue;
ffloor_t * r2;
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
{
if (r2->master == rover->master) // Skip if same control line.
break;
const ffloortype_e r2flags = r2->flags;
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
continue;
if (rover->flags & FF_EXTRA)
{
if (!(r2flags & FF_CUTEXTRA))
continue;
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
continue;
}
else
{
if (!(r2flags & FF_CUTSOLIDS))
continue;
}
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
continue;
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
continue;
break;
}
if (r2)
continue;
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector); side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
boolean do_texture_skew; boolean do_texture_skew;
@@ -2138,24 +2195,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 = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY; wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY; wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = static_cast<float>((*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 = texturevpeg * glTex->scaleY; wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY; wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY; wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
} }
else // skew by bottom else // skew by bottom
{ {
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY; wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY; wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
} }
} }
@@ -2496,8 +2553,10 @@ 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 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) + const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
(viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8); viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5) if (boxpos == 5)
return true; return true;
@@ -2617,6 +2676,7 @@ 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;
@@ -2638,12 +2698,14 @@ 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);
@@ -2686,72 +2748,51 @@ 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 = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize); flatxref = static_cast<float>(static_cast<fixed_t>(flatxref) & (~flatflag)) / fflatsize;
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize); flatyref = static_cast<float>(static_cast<fixed_t>(flatyref) & (~flatflag)) / fflatsize;
// transform if (!isceiling) // it's a floor
v3d = planeVerts;
if (FOFsector != NULL)
{ {
if (!isceiling) // it's a floor scrollx = FixedToFloat(sec->floor_xoffs)/fflatsize;
{ scrolly = FixedToFloat(sec->floor_yoffs)/fflatsize;
scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize; angle = sec->floorpic_angle;
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 if (gl_frontsector) else // it's a ceiling
{ {
if (!isceiling) // it's a floor scrollx = FixedToFloat(sec->ceiling_xoffs)/fflatsize;
{ scrolly = FixedToFloat(sec->ceiling_yoffs)/fflatsize;
scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize; angle = sec->ceilingpic_angle;
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 = FloatToFixed(scrollx); tempxsow = flatxref;
tempytow = FloatToFixed(scrolly); tempytow = flatyref;
scrollx = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); anglef = ANG2RAD(InvAngle(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
tempxsow = FloatToFixed(flatxref); cosangf = cosf(anglef);
tempytow = FloatToFixed(flatyref); sinangf = sinf(anglef);
flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); flatyref = (tempxsow * sinangf) + (tempytow * cosangf);
} }
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++) for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++, v3d++)
{ {
// Hurdler: add scrolling texture on floor/ceiling // Go from the polysector's original vertex locations
v3d->s = (float)((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations // Means the flat is offset based on the original vertex locations
v3d->t = (float)(flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations v3d->s = ((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx);
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 = FloatToFixed(v3d->s); tempxsow = v3d->s;
tempytow = FloatToFixed(v3d->t); tempytow = v3d->t;
v3d->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); v3d->s = (tempxsow * cosangf) - (tempytow * sinangf);
v3d->t = (FixedToFloat(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); v3d->t = (tempxsow * sinangf) + (tempytow * cosangf);
} }
v3d->x = FixedToFloat(polysector->vertices[i]->x); v3d->x = FixedToFloat(polysector->vertices[i]->x);
@@ -3458,13 +3499,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 - gpatch->topoffset * this_scale - (floorheight+3); 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);
// 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 + ((gpatch->height * this_scale) + offset) * gl_viewcos; swallVerts[3].x = spr->x1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + ((gpatch->height * this_scale) + offset) * gl_viewcos; swallVerts[2].x = spr->x2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + ((gpatch->height * this_scale) + offset) * gl_viewsin; swallVerts[3].z = spr->z1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((gpatch->height * this_scale) + offset) * gl_viewsin; swallVerts[2].z = spr->z2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
} }
else else
{ {
@@ -3472,10 +3513,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 + (gpatch->height + offset) * gl_viewcos; swallVerts[3].x = spr->x1 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + (gpatch->height + offset) * gl_viewcos; swallVerts[2].x = spr->x2 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (gpatch->height + offset) * gl_viewsin; swallVerts[3].z = spr->z1 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + (gpatch->height + offset) * gl_viewsin; swallVerts[2].z = spr->z2 + (static_cast<float>(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
@@ -4406,9 +4447,6 @@ 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]];
@@ -4462,9 +4500,6 @@ static void HWR_RenderDrawNodes(void)
PS_STOP_TIMING(ps_hw_nodedrawtime); PS_STOP_TIMING(ps_hw_nodedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(false);
drawnodes.clear(); // clear so our size is 0 again! drawnodes.clear(); // clear so our size is 0 again!
} }
@@ -5153,6 +5188,8 @@ 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
@@ -5331,7 +5368,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/(float)FINEANGLES); static constexpr float FINEDEGREE = (360.0f/static_cast<float>(FINEANGLES));
static void HWR_DrawSkyBackground(void) static void HWR_DrawSkyBackground(void)
{ {
@@ -5349,7 +5386,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 = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(FINEDEGREE); dometransform.angley = static_cast<float>((viewangle-ANGLE_270) >> ANGLETOFINESHIFT)*(FINEDEGREE);
HWR_GetTexture(texturetranslation[skytexture], false); HWR_GetTexture(texturetranslation[skytexture], false);
@@ -5394,7 +5431,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) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT); trans->viewaiming = FixedToFloat(fixedaiming) * (static_cast<float>(vid.width) / static_cast<float>(vid.height)) / (static_cast<float>(BASEVIDWIDTH) / static_cast<float>(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;
@@ -5406,7 +5443,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
gl_aimingangle = aimingangle; gl_aimingangle = aimingangle;
} }
trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(FINEDEGREE); trans->anglex = static_cast<float>(gl_aimingangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
} }
void HWR_SetTransform(float fpov) void HWR_SetTransform(float fpov)
@@ -5425,11 +5462,11 @@ void HWR_SetTransform(float fpov)
atransform.z = gl_viewz; atransform.z = gl_viewz;
atransform.scalex = 1; atransform.scalex = 1;
atransform.scaley = (float)vid.width/vid.height; atransform.scaley = static_cast<float>(vid.width) / static_cast<float>(vid.height);
atransform.scalez = 1; atransform.scalez = 1;
HWR_SetTransformAiming(&atransform); HWR_SetTransformAiming(&atransform);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE); atransform.angley = static_cast<float>(viewangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
yaw = 270.0f - atransform.angley; yaw = 270.0f - atransform.angley;
inv_yaw = 180.0f - yaw; inv_yaw = 180.0f - yaw;
@@ -5440,8 +5477,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
@@ -5469,7 +5506,6 @@ 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
@@ -5502,7 +5538,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
player_t *viewplayer = &players[displayplayers[viewssnum]]; player_t *viewplayer = &players[displayplayers[viewssnum]];
const float fpov = FixedToFloat(R_GetPlayerFov(viewplayer)); const float fpov = FixedToFloat(R_GetPlayerFov(viewplayer));
auto reset_viewstate = [&](const float fpov) auto reset_viewstate = [&]()
{ {
HWR_SetTransform(fpov); HWR_SetTransform(fpov);
HWR_ClearSprites(); HWR_ClearSprites();
@@ -5522,7 +5558,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
currentportallist = &portallist; currentportallist = &portallist;
HWR_SetPortalState(GLPORTAL_SEARCH); HWR_SetPortalState(GLPORTAL_SEARCH);
reset_viewstate(fpov); reset_viewstate();
if (rootportal) if (rootportal)
{ {
@@ -5548,13 +5584,13 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
// draw normal things in current frame in current incremented stencil buffer area // draw normal things in current frame in current incremented stencil buffer area
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level); HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
reset_viewstate(fpov); reset_viewstate();
if constexpr (Type == RenderViewpointType::kPortal) if constexpr (Type == RenderViewpointType::kPortal)
{ {
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);
} }
} }
@@ -5604,7 +5640,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(true); HWR_RenderBatches();
// Check for new console commands. // Check for new console commands.
NetUpdate(); NetUpdate();
@@ -5631,15 +5667,11 @@ 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;
@@ -5707,7 +5739,7 @@ static void HWR_RollTransform(FTransform *tr, angle_t roll)
{ {
if (roll != 0) if (roll != 0)
{ {
tr->rollangle = roll / (float)ANG1; tr->rollangle = static_cast<float>(roll) / static_cast<float>(ANG1);
tr->roll = true; tr->roll = true;
tr->rollx = 1.0f; tr->rollx = 1.0f;
tr->rollz = 0.0f; tr->rollz = 0.0f;
@@ -6107,7 +6139,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+((float)y * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale) v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<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)
} }
} }
+1 -7
View File
@@ -2209,16 +2209,10 @@ 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], vid.width, vid.height, pglUniform2f); UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)vid.width, (GLfloat)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 <SDL3/SDL_opengl.h> //Alam_GBC: Simple, yes? #include "SDL_opengl.h" //Alam_GBC: Simple, yes?
#else #else
#include <GL/gl.h> #include <GL/gl.h>
+1 -1
View File
@@ -1738,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, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT); M_DrawEmote(x+dx+2, y+dy+1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
dx += EMOTEWIDTH - charwidth; dx += EMOTEWIDTH - charwidth;
} }
j += emotelen; j += emotelen;
+2 -2
View File
@@ -80,6 +80,8 @@ 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
{ {
@@ -91,8 +93,6 @@ 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,6 +158,8 @@ 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
/// ------------------------ /// ------------------------
+4
View File
@@ -29,6 +29,10 @@ extern "C" {
*/ */
#define MAX_QUIT_FUNCS 16 #define MAX_QUIT_FUNCS 16
void I_GetConsoleEvents(void);
extern boolean consolevent;
extern boolean framebuffer;
/** \brief Graphic system had started up /** \brief Graphic system had started up
*/ */
+6 -5
View File
@@ -568,13 +568,12 @@ void Command_Numnodes(void)
#ifdef HOLEPUNCH #ifdef HOLEPUNCH
/* not one of the reserved "local" addresses */ /* not one of the reserved "local" addresses */
static boolean static boolean is_external_address(UINT32 p)
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)
@@ -584,7 +583,7 @@ 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:
@@ -763,6 +762,7 @@ 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,6 +780,7 @@ 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;
@@ -792,6 +793,7 @@ 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;
@@ -1060,7 +1062,6 @@ 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++)
+9 -2
View File
@@ -127,8 +127,6 @@ boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void); void I_SetBorderlessWindow(void);
void I_HandleControllerHatRepeat(void);
#ifdef USE_FBO_OGL #ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void); void RefreshOGLSDLSurface(void);
@@ -137,6 +135,15 @@ boolean UseScreenFBO(void);
extern boolean downsample; extern boolean downsample;
#endif #endif
// So we can call this from i_video event loop
void I_ShutdownJoystick(UINT8 index);
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
void I_UpdateJoystickDeviceIndex(UINT8 player);
void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer);
void I_HandleControllerHatRepeat(void);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
+2
View File
@@ -19,6 +19,8 @@
#include "sounds.h" #include "sounds.h"
#include "m_fixed.h" #include "m_fixed.h"
#define MAXDOOMEDNUM 4095
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date! // dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
// For great modding!! // For great modding!!
+1 -1
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];
static patch_t *kp_facenum[MAXPLAYERS+1]; 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;
+3
View File
@@ -41,6 +41,9 @@ 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
+50 -54
View File
@@ -5179,6 +5179,24 @@ 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)
{ {
@@ -5189,7 +5207,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, s, w; // engine class number INT32 class; // engine class number
UINT8 volume = 255; UINT8 volume = 255;
fixed_t volumedampen = FRACUNIT; fixed_t volumedampen = FRACUNIT;
@@ -5225,7 +5243,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]++; }
@@ -5302,17 +5320,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
return; return;
} }
s = (player->kartspeed - 1) / 3; class = K_GetEngineClass(player);
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);
} }
@@ -5731,7 +5739,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 (P_IsLocalPlayer(player)) if ((leveltime <= MUSICSTARTTIME) && P_IsLocalPlayer(player))
S_StartMapMusic(); S_StartMapMusic();
} }
@@ -5911,45 +5919,33 @@ 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 ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) if (onground && 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)
{ {
player->kartstuff[k_driftcharge] = 0; if (player->kartstuff[k_driftcharge] < dsone)
} {
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) player->kartstuff[k_driftcharge] = 0;
// || (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 && player->kartstuff[k_driftcharge] < dstwo) else if (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
&& onground) {
{ if (player->kartstuff[k_driftboost] < 20)
if (player->kartstuff[k_driftboost] < 20) player->kartstuff[k_driftboost] = 20;
player->kartstuff[k_driftboost] = 20; S_StartSound(player->mo, sfx_s23c);
S_StartSound(player->mo, sfx_s23c); player->kartstuff[k_driftcharge] = 0;
//K_SpawnDashDustRelease(player); }
player->kartstuff[k_driftcharge] = 0; else if (player->kartstuff[k_driftcharge] < dsthree)
} {
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) if (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)) player->kartstuff[k_driftboost] = 50;
&& player->kartstuff[k_driftcharge] < dsthree S_StartSound(player->mo, sfx_s23c);
&& onground) player->kartstuff[k_driftcharge] = 0;
{ }
if (player->kartstuff[k_driftboost] < 50) else if (player->kartstuff[k_driftcharge] >= dsthree)
player->kartstuff[k_driftboost] = 50; {
S_StartSound(player->mo, sfx_s23c); if (player->kartstuff[k_driftboost] < 125)
//K_SpawnDashDustRelease(player); player->kartstuff[k_driftboost] = 125;
player->kartstuff[k_driftcharge] = 0; S_StartSound(player->mo, sfx_s23c);
} 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?
@@ -6027,8 +6023,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...
+65 -10
View File
@@ -149,7 +149,8 @@ enum cameraf {
camera_momx, camera_momx,
camera_momy, camera_momy,
camera_momz, camera_momz,
camera_pnum camera_pnum,
camera_freecam,
}; };
@@ -169,6 +170,7 @@ static const char *const camera_opt[] = {
"momy", "momy",
"momz", "momz",
"pnum", "pnum",
"freecam",
NULL}; NULL};
enum hudpatch { enum hudpatch {
@@ -387,10 +389,43 @@ 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
// //
@@ -1252,22 +1287,32 @@ 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))
{ {
return 0; const char *prefix = luaL_checkstring(L, 1);
if (strlen(prefix) != 4)
{
return luaL_argerror(L, 1, "prefix should 4 characters wide");
}
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
} }
const char *prefix = luaL_checkstring(L, 1); if (!lua_isnoneornil(L, 2))
if (strlen(prefix) != 4)
{ {
return luaL_argerror(L, 1, "prefix should 4 characters wide"); INT32 time_per_frame = luaL_checkinteger(L, 2);
}
strncpy(VoteScreen.luaPrefix, prefix, 4); if (time_per_frame <= 0)
strupr(VoteScreen.luaPrefix); return luaL_argerror(L, 2, "time per frame should be 1 or more");
VoteScreen.timePerAnimFrame = time_per_frame;
}
// 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)
@@ -1371,6 +1416,16 @@ 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);
+20 -17
View File
@@ -1064,9 +1064,13 @@ static void ArchiveTables(UINT8 **p)
{ {
// Write key // Write key
e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this. e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise) if (e == 1)
n++; // the table contained a new table we'll have to archive. :(
else if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
{ {
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -2), luaL_typename(gL, -2), i); CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -2), luaL_typename(gL, -2), i);
lua_pop(gL, 1);
continue;
} }
else if (e == 3) // nil key due to invalid userdata. NOT an error. else if (e == 3) // nil key due to invalid userdata. NOT an error.
{ {
@@ -1077,15 +1081,12 @@ static void ArchiveTables(UINT8 **p)
// Write value // Write value
e = ArchiveValue(p, TABLESINDEX, -1); e = ArchiveValue(p, TABLESINDEX, -1);
if (e == 1) if (e == 1)
{
n++; // the table contained a new table we'll have to archive. :( n++; // the table contained a new table we'll have to archive. :(
}
else if (e == 2) // invalid value type else if (e == 2) // invalid value type
{
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -2), luaL_typename(gL, -1)); CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -2), luaL_typename(gL, -1));
}
lua_pop(gL, 1); lua_pop(gL, 1);
} }
lua_pop(gL, 1); lua_pop(gL, 1);
WRITEUINT8(*p, ARCH_TEND); WRITEUINT8(*p, ARCH_TEND);
@@ -1276,13 +1277,21 @@ static void UnArchiveTables(UINT8 **p, boolean network)
UINT8 ret; UINT8 ret;
ret = UnArchiveValue(p, TABLESINDEX, network); ret = UnArchiveValue(p, TABLESINDEX, network);
if (ret == 3) if (ret == 1) // End of table
break;
else if (ret == 2) // Key contains a new table
n++;
else if (ret == 3)
{ {
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n"); //CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
lua_pushnil(gL); lua_pushnil(gL);
} }
else if (ret == 1) // read key
break; if (lua_isnil(gL, -1)) // If key is nil, skip this entry
{
lua_pop(gL, 1);
continue;
}
ret = UnArchiveValue(p, TABLESINDEX, network); ret = UnArchiveValue(p, TABLESINDEX, network);
if (ret == 1) if (ret == 1)
@@ -1291,21 +1300,15 @@ static void UnArchiveTables(UINT8 **p, boolean network)
lua_pop(gL, 1); // Pop key lua_pop(gL, 1); // Pop key
break; break;
} }
else if (ret == 2) // read value
n++;
else if (ret == 3) else if (ret == 3)
{ {
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n"); //CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
lua_pushnil(gL); lua_pushnil(gL);
} }
else if (ret == 2) // read value
n++;
if (lua_isnil(gL, -2)) // if key is nil (if a function etc was accidentally saved) lua_rawset(gL, -3);
{
CONS_Alert(CONS_ERROR, "A nil key in table %d was found! (Invalid key type or corrupted save?)\n", i);
lua_pop(gL, 2); // pop key and value instead of setting them in the table, to prevent Lua panic errors
}
else
lua_rawset(gL, -3);
} }
lua_pop(gL, 1); lua_pop(gL, 1);
+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<<16 /* not FRACBITS */); player->mo->angle = (cmd->angleturn << TICCMD_REDUCE);
ticruned++; ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED)) if (!(cmd->angleturn & TICCMD_RECEIVED))
+335 -232
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 <SDL3/SDL.h> #include "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,7 +197,30 @@ 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
@@ -233,6 +256,7 @@ 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);
@@ -504,6 +528,7 @@ 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)
@@ -623,22 +648,28 @@ 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;
@@ -661,7 +692,8 @@ 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)
@@ -773,6 +805,11 @@ 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;
@@ -893,7 +930,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 == &cv_playername) if (cv == setupm_cvname)
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);
@@ -1004,18 +1041,6 @@ 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)
{ {
@@ -1207,6 +1232,19 @@ 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
@@ -1937,8 +1975,6 @@ void M_Ticker(void)
} }
I_unlock_mutex(ms_ServerList_mutex); I_unlock_mutex(ms_ServerList_mutex);
#endif #endif
CL_TimeoutServerList();
} }
// //
@@ -2695,6 +2731,12 @@ 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();
} }
@@ -3359,8 +3401,6 @@ 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)
@@ -3967,6 +4007,7 @@ 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
@@ -3999,14 +4040,14 @@ static void ReplayNamesLoadThread(void* userdata)
{ {
Lock_search_state(); Lock_search_state();
size_t demolist_all_size = sizedirmenu; size_t demolist_all_size_local = demolist_all_size;
menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*sizedirmenu); menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*demolist_all_size_local);
memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*sizedirmenu); memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*demolist_all_size_local);
char *replaydirpath = (char*)userdata; char *replaydirpath = (char*)userdata;
Unlock_search_state(); Unlock_search_state();
for (size_t i = 0; i < demolist_all_size; ++i) for (size_t i = 0; i < demolist_all_size_local; ++i)
{ {
if (demolist_all_local[i].type != MD_SUBDIR) if (demolist_all_local[i].type != MD_SUBDIR)
{ {
@@ -4022,9 +4063,9 @@ static void ReplayNamesLoadThread(void* userdata)
Lock_search_state(); Lock_search_state();
if (fastcmp(menupath, replaydirpath)) if (fastcmp(menupath, replaydirpath) && demolist_all)
{ {
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu); memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*demolist_all_size);
replaynamesloaded = true; replaynamesloaded = true;
} }
@@ -4158,6 +4199,7 @@ 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++)
{ {
@@ -4206,6 +4248,7 @@ 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;
@@ -4297,6 +4340,9 @@ 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:
@@ -4395,136 +4441,140 @@ static void DrawReplayHutReplayInfo(void)
UINT8 *colormap; UINT8 *colormap;
INT32 x, y, w, h; INT32 x, y, w, h;
switch (demolist[dir_on[menudepthleft]].type) const menudemo_t *replaydemolist = &demolist[dir_on[menudepthleft]];
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;
}
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner"); case MD_INVALID:
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[0].name); V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
break;
if (demolist[dir_on[menudepthleft]].gametype == GT_RACE) case MD_SUBDIR:
{ 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");
}
if (demolist[dir_on[menudepthleft]].standings[0].timeorscore == (UINT32_MAX-1)) case MD_OUTDATED:
{ V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", replaydemolist->version));
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest"); /* FALLTHRU */
} default:
else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE) // Draw level stuff
{ 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));
}
// Character face! // A 160x100 image of the level as entry MAPxxP
if (demolist[dir_on[menudepthleft]].standings[0].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR) //CONS_Printf("%d %s\n", replaydemolist->map, G_BuildMapName(replaydemolist->map));
{ lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(replaydemolist->map)));
patch = facewantprefix[demolist[dir_on[menudepthleft]].standings[0].skin]; if (lumpnum != LUMPERROR)
colormap = R_GetTranslationColormap( patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH);
demolist[dir_on[menudepthleft]].standings[0].skin, else
demolist[dir_on[menudepthleft]].standings[0].color, patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH);
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);
}
V_DrawMappedPatch(BASEVIDWIDTH-15 - patch->width, y+20, V_SNAPTOTOP, patch, colormap); if (!(replaydemolist->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);
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;
} }
} }
@@ -4590,7 +4640,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);
@@ -4670,8 +4720,7 @@ static void M_DrawReplayHut(void)
} }
// Draw the cursor // Draw the cursor
V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT, V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
(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!
@@ -4703,34 +4752,38 @@ 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 && demolist[dir_on[menudepthleft]].standings[i].ranking; i++) for (i = 1; i < MAXPLAYERS && replaydemolist->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", demolist[dir_on[menudepthleft]].standings[i].ranking)); V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20, V_SNAPTOTOP|highlightflags, va("%2d", replaydemolist->standings[i].ranking));
V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[i].name); V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->standings[i].name);
if (demolist[dir_on[menudepthleft]].standings[i].timeorscore == UINT32_MAX-1) const UINT32 timeorscore = replaydemolist->standings[i].timeorscore;
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 (demolist[dir_on[menudepthleft]].gametype == GT_RACE) else if (replaydemolist->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(demolist[dir_on[menudepthleft]].standings[i].timeorscore, true), G_TicsToMinutes(timeorscore, true),
G_TicsToSeconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore), G_TicsToSeconds(timeorscore),
G_TicsToCentiseconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore) G_TicsToCentiseconds(timeorscore)
)); ));
else else
V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[i].timeorscore)); V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", timeorscore));
// Character face! // Character face!
if (demolist[dir_on[menudepthleft]].standings[i].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR) if (replaydemolist->standings[i].skin < numskins && W_CheckNumForName(skins[replaydemolist->standings[i].skin].facerank) != LUMPERROR)
{ {
patch = facerankprefix[demolist[dir_on[menudepthleft]].standings[i].skin]; patch = facerankprefix[replaydemolist->standings[i].skin];
colormap = R_GetTranslationColormap( colormap = R_GetTranslationColormap(
demolist[dir_on[menudepthleft]].standings[i].skin, replaydemolist->standings[i].skin,
demolist[dir_on[menudepthleft]].standings[i].color, replaydemolist->standings[i].color,
GTC_MENUCACHE); GTC_MENUCACHE);
} }
else else
@@ -4738,7 +4791,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,
demolist[dir_on[menudepthleft]].standings[i].color, replaydemolist->standings[i].color,
GTC_MENUCACHE); GTC_MENUCACHE);
} }
@@ -4775,10 +4828,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, demolist[dir_on[menudepthleft]].title); V_DrawString(10, 72, V_SNAPTOTOP|highlightflags|V_ALLOWLOWERCASE, replaydemolist->title);
// Draw a warning prompt if needed // Draw a warning prompt if needed
switch (demolist[dir_on[menudepthleft]].addonstatus) switch (replaydemolist->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.";
@@ -4807,6 +4860,9 @@ 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;
@@ -4814,6 +4870,8 @@ 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)
@@ -4826,6 +4884,16 @@ 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;
@@ -6190,11 +6258,27 @@ 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(skins[cv_chooseskin.value-1].facewant) != LUMPERROR) if (W_CheckNumForName(skin->facewant) != LUMPERROR)
{ {
UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor.value, GTC_MENUCACHE); const INT32 charx = (BASEVIDWIDTH-x - facewantprefix[skinnum]->width);
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)
@@ -6224,7 +6308,7 @@ void M_DrawTimeAttackMenu(void)
} }
else else
{ {
const char *str = ((cv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : cv->string); const char *str = ((cv == &cv_chooseskin) ? skin->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
@@ -6269,10 +6353,12 @@ void M_DrawTimeAttackMenu(void)
{ {
tic_t lap = 0, time = 0; tic_t lap = 0, time = 0;
if (mainrecords[cv_nextmap.value-1]) const recorddata_t *currecord = mainrecords[cv_nextmap.value-1];
if (currecord)
{ {
lap = mainrecords[cv_nextmap.value-1]->lap; lap = currecord->lap;
time = mainrecords[cv_nextmap.value-1]->time; time = currecord->time;
} }
V_DrawFill((BASEVIDWIDTH - vid.scaledwidth)>>1, 78, vid.scaledwidth, 36, 239); V_DrawFill((BASEVIDWIDTH - vid.scaledwidth)>>1, 78, vid.scaledwidth, 36, 239);
@@ -6294,6 +6380,7 @@ 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);
@@ -6301,7 +6388,7 @@ void M_DrawTimeAttackMenu(void)
} }
else else
{ {
const char *str = ((ncv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : ncv->string); const char *str = ((ncv == &cv_chooseskin) ? skin->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
@@ -6806,12 +6893,22 @@ 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
serverlistpage = 0; M_ResetServerList();
CL_UpdateServerList(); CL_UpdateServerList();
@@ -6842,14 +6939,7 @@ static void M_DrawServerCountAndHorizontalBar(void)
break; break;
default: default:
if (serverlistultimatecount > serverlistcount) if (serverlistcount > 0)
{
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);
} }
@@ -7033,7 +7123,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);
@@ -7108,7 +7198,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
serverlistpage = 0; M_ResetServerList();
CL_UpdateServerList(); CL_UpdateServerList();
@@ -7326,7 +7416,8 @@ 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;
if (levellistmode != LLM_RECORDATTACK) // so it doesent show in record attack menu // 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;
@@ -7819,28 +7910,6 @@ 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]]
@@ -8898,9 +8967,6 @@ 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:
@@ -8929,6 +8995,9 @@ 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;
@@ -9289,29 +9358,32 @@ static void M_SetupControlsMenu(UINT8 pnum)
break; break;
} }
OP_AllControlsMenu[4].itemaction = &cv_litesteer[pnum];
OP_AllControlsMenu[5].itemaction = &cv_turnsmooth[pnum];
if (pnum > 0) if (pnum > 0)
{ {
// Hide P1-only controls // Hide P1-only controls
OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Chat
OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings OP_AllControlsMenu[10].status = IT_GRAYEDOUT2; // Rankings
OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Pause OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Pause
OP_AllControlsMenu[18].status = IT_GRAYEDOUT2; // Screenshot OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // Screenshot
OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // GIF OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // GIF
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // System Menu OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // System Menu
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Console OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Console
OP_AllControlsMenu[37].status = IT_GRAYEDOUT2; // Director OP_AllControlsMenu[41].status = IT_GRAYEDOUT2; // Director
} }
else else
{ {
// Unhide P1-only controls // Unhide P1-only controls
OP_AllControlsMenu[15].status = IT_CONTROL; // Chat OP_AllControlsMenu[19].status = IT_CONTROL; // Chat
OP_AllControlsMenu[16].status = IT_CONTROL; // Rankings OP_AllControlsMenu[10].status = IT_CONTROL; // Rankings
OP_AllControlsMenu[17].status = IT_CONTROL; // Pause OP_AllControlsMenu[21].status = IT_CONTROL; // Pause
OP_AllControlsMenu[18].status = IT_CONTROL; // Screenshot OP_AllControlsMenu[22].status = IT_CONTROL; // Screenshot
OP_AllControlsMenu[19].status = IT_CONTROL; // GIF OP_AllControlsMenu[23].status = IT_CONTROL; // GIF
OP_AllControlsMenu[20].status = IT_CONTROL; // System Menu OP_AllControlsMenu[24].status = IT_CONTROL; // System Menu
OP_AllControlsMenu[21].status = IT_CONTROL; // Console OP_AllControlsMenu[25].status = IT_CONTROL; // Console
OP_AllControlsMenu[37].status = IT_CONTROL; // Director OP_AllControlsMenu[41].status = IT_CONTROL; // Director
} }
M_SetupNextMenu(&OP_AllControlsDef); M_SetupNextMenu(&OP_AllControlsDef);
@@ -9425,12 +9497,36 @@ static void M_DrawControl(void)
else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1)) else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1))
V_DrawString(19, y+6, highlightflags|V_ALLOWLOWERCASE, currentMenu->menuitems[i].text); V_DrawString(19, y+6, highlightflags|V_ALLOWLOWERCASE, currentMenu->menuitems[i].text);
else if (currentMenu->menuitems[i].status & IT_STRING) else if (currentMenu->menuitems[i].status & IT_STRING)
{
V_DrawString(x, y, ((i == itemOn) ? highlightflags|V_ALLOWLOWERCASE : V_ALLOWLOWERCASE), currentMenu->menuitems[i].text); V_DrawString(x, y, ((i == itemOn) ? highlightflags|V_ALLOWLOWERCASE : V_ALLOWLOWERCASE), currentMenu->menuitems[i].text);
if (currentMenu->menuitems[i].status & IT_CVAR)
{
consvar_t *cv = (consvar_t *)currentMenu->menuitems[i].itemaction;
// IT_HEADER matches IT_CVAR, for some reason...
if (cv)
{
INT32 w = V_StringWidth(cv->string, 0);
V_DrawString(BASEVIDWIDTH - x - w, y,
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|MENUCAPS, cv->string);
if (i == itemOn)
{
V_DrawCharacter(BASEVIDWIDTH - x - 10 - w - (skullAnimCounter/5), y,
'\x1C' | highlightflags, false); // left arrow
V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
'\x1D' | highlightflags, false); // right arrow
}
}
}
}
y += SMALLLINEHEIGHT; y += SMALLLINEHEIGHT;
} }
V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
M_DoToolTips(currentMenu);
} }
#undef controlheight #undef controlheight
@@ -9696,6 +9792,13 @@ 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;
+5 -2
View File
@@ -306,12 +306,15 @@ 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);
@@ -400,7 +403,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
NULL\ NULL\
} }
#define CONTROLMENUSTYLE(source, prev)\ #define CONTROLMENUSTYLE(source, prev, tooltip)\
{\ {\
"M_CONTRO",\ "M_CONTRO",\
sizeof (source)/sizeof (menuitem_t),\ sizeof (source)/sizeof (menuitem_t),\
@@ -411,7 +414,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
26, 40,\ 26, 40,\
0,\ 0,\
NULL,\ NULL,\
NULL\ tooltip\
} }
#define IMAGEDEF(source)\ #define IMAGEDEF(source)\
+91 -81
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_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 56}, {IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 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},
@@ -648,17 +648,6 @@ static menuitem_t OP_ControlsMenu[] =
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 55}, {IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 55},
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 75}, {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 75},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P1)", &cv_turnsmooth[0], 85},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P2)", &cv_turnsmooth[1], 95},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P3)", &cv_turnsmooth[2], 105},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P4)", &cv_turnsmooth[3], 115},
// i hate our menus sincerly
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P1)", &cv_litesteer[0], 135},
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P2)", &cv_litesteer[1], 145},
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P3)", &cv_litesteer[2], 155},
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P4)", &cv_litesteer[3], 165},
}; };
static const char* OP_ControlsTooltips[] = static const char* OP_ControlsTooltips[] =
@@ -669,15 +658,6 @@ static const char* OP_ControlsTooltips[] =
"Setup player 4 controls.", "Setup player 4 controls.",
"Options for mouse control.", "Options for mouse control.",
"Allowed amount of controls per key.", "Allowed amount of controls per key.",
"Turn smoothing for non-analog turning (Player 1).",
"Turn smoothing for non-analog turning (Player 2).",
"Turn smoothing for non-analog turning (Player 3).",
"Turn smoothing for non-analog turning (Player 4).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 1).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 2).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 3).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 4).",
}; };
static menuitem_t OP_AllControlsMenu[] = static menuitem_t OP_AllControlsMenu[] =
@@ -685,6 +665,13 @@ static menuitem_t OP_AllControlsMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0}, {IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
{IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8}, {IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8},
{IT_HEADER, NULL, "Control Options", NULL, 0},
{IT_SPACE, NULL, NULL, NULL, 0},
// Cvars are set in M_SetupControlsMenu
{IT_STRING|IT_CVAR, NULL, "Lite Steer", &cv_litesteer[0], 18},
{IT_STRING|IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth[0], 26},
//{IT_SPACE, NULL, NULL, NULL, 0}, //{IT_SPACE, NULL, NULL, NULL, 0},
{IT_HEADER, NULL, "Gameplay Controls", NULL, 0}, {IT_HEADER, NULL, "Gameplay Controls", NULL, 0},
{IT_SPACE, NULL, NULL, NULL, 0}, {IT_SPACE, NULL, NULL, NULL, 0},
@@ -733,6 +720,17 @@ static menuitem_t OP_AllControlsMenu[] =
{IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, {IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 },
}; };
// Has to be same length as OP_AllControlsMenu, but otherwise its mostly empty
static const char* OP_AllControlsTooltips[sizeof(OP_AllControlsMenu)/sizeof(OP_AllControlsMenu[0])] = {
NULL,
NULL,
NULL,
NULL,
"Hold DOWN on d-pad/keyboard for shallow turns.",
"Turn smoothing for non-analog turning.",
// The rest is null, for now
};
#define OP_JOYMENU(pnum) \ #define OP_JOYMENU(pnum) \
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \ {IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[pnum] , 15}, \ {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[pnum] , 15}, \
@@ -800,7 +798,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_mousesens, 40}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousexsens, 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,13 +1151,6 @@ 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},
@@ -1187,11 +1178,6 @@ 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.",
@@ -1337,13 +1323,14 @@ 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, 135}, {IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 145},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 145}, {IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 155},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 155}, {IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 165},
}; };
static menuitem_t OP_CamOptionsMenu[] = static menuitem_t OP_CamOptionsMenu[] =
@@ -1352,16 +1339,19 @@ static menuitem_t OP_CamOptionsMenu[] =
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Field of View",&cv_fov, 30}, {IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Field of View",&cv_fov, 30},
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 50}, {IT_STRING | IT_CVAR, NULL, "Flipcam Mode", &cv_flipcammode, 40},
{IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 60},
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 70}, {IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 60},
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 80}, {IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 70},
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 80},
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 90},
}; };
static const char* OP_CamOptionsTooltips[] = static const char* OP_CamOptionsTooltips[] =
{ {
NULL, NULL,
"Player field of view.", "Player field of view.",
"Change flipcam mode.\nDisplayplayer - use currently viewed player option.\nLocal - use local flipcam toggle option.",
NULL, NULL,
NULL, NULL,
NULL, NULL,
@@ -1657,12 +1647,19 @@ 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_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 65}, {IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65},
{IT_HEADER, NULL, "Audio", NULL, 75}, {IT_HEADER, NULL, "Audio", NULL, 75},
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85}, {IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85},
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90}, {IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90},
{IT_HEADER, NULL, "Controls", NULL, 100},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 110},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 115},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 120},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 125},
}; };
static const char* OP_AccessibilityTooltips[] = static const char* OP_AccessibilityTooltips[] =
@@ -1684,6 +1681,11 @@ static const char* OP_AccessibilityTooltips[] =
NULL, NULL,
"Reverse left and right channels of audio.", "Reverse left and right channels of audio.",
"Change how often the same Sound is allowed to play at once.", "Change how often the same Sound is allowed to play at once.",
NULL,
"Automatically hold acceleration button (Player 1).",
"Automatically hold acceleration button (Player 2).",
"Automatically hold acceleration button (Player 3).",
"Automatically hold acceleration button (Player 4).",
}; };
static menuitem_t OP_SaturnMenu[] = static menuitem_t OP_SaturnMenu[] =
@@ -1860,15 +1862,16 @@ 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, 170}, {IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 175},
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 180}, {IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 185},
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 190}, {IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 195},
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 195}, {IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 200},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 205}, {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 210},
}; };
static const char* OP_SaturnHudTooltips[] = static const char* OP_SaturnHudTooltips[] =
@@ -1895,6 +1898,7 @@ 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.",
@@ -1982,47 +1986,46 @@ 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", NULL, 10}, {IT_STRING2+IT_SPACE, NULL, "Alug Indev", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20}, {IT_STRING2+IT_SPACE, NULL, "Haya Nepdisk", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30}, {IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy xyzzy", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40}, {IT_STRING2+IT_SPACE, NULL, "Chearii riomccloud", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50}, {IT_STRING2+IT_SPACE, NULL, "chromaticpipe PAS", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60}, {IT_STRING2+IT_SPACE, NULL, "$HOME yama", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70}, {IT_STRING2+IT_SPACE, NULL, "Achii scizor300", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80}, {IT_STRING2+IT_SPACE, NULL, "Superjustinbros Lugent", 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, 124}, {IT_HEADER, NULL, "", NULL, 74},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180}, {IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190}, {IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200}, {IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210}, {IT_STRING2+IT_SPACE, NULL, "jin Mompi", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Phoenix", NULL, 150},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 168}, {IT_HEADER, NULL, "Special Thanks <3", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 178}, {IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 188}, {IT_STRING2+IT_SPACE, NULL, "Blankart", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 198}, {IT_STRING2+IT_SPACE, NULL, "SRB2 Legacy", NULL, 160},
{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, 198}, // dummy text I {IT_STRING+IT_SPACE, NULL, "", NULL, 228}, // dummy text I
{IT_STRING, NULL, "", NULL, 258}, // dummy text II {IT_STRING, NULL, "", NULL, 278}, // dummy text II
}; };
// sry we dont have space for this anymore :c // 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
/*static const char* OP_CreditTooltips[] = static const char* OP_CreditTooltips[] =
{ {
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, // 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,
"Thanks everyone! <3" "Thanks everyone! <3"
};*/ };
static menuitem_t OP_BirdMenu[] = static menuitem_t OP_BirdMenu[] =
@@ -2192,6 +2195,9 @@ 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[] =
@@ -2201,6 +2207,8 @@ 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
@@ -2210,6 +2218,8 @@ enum
fadegrow, fadegrow,
respawnfadeout, respawnfadeout,
respawnfadein, respawnfadein,
syncthreshold,
syncspecialonly,
}; };
menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS]; menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS];
@@ -2483,7 +2493,7 @@ menu_t OP_MainDef =
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 40, 15, OP_ControlsTooltips); menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 40, 15, OP_ControlsTooltips);
//WTF //WTF
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips); menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips);
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef, OP_AllControlsTooltips);
menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 30, 36, NULL); menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 30, 36, NULL);
menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 30, 36, NULL); menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 30, 36, NULL);
menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36, NULL); menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36, NULL);
@@ -2622,7 +2632,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, 0, NULL); // OP_CreditTooltips no space :c menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 2, OP_CreditTooltips); // 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);
+5 -4
View File
@@ -1346,14 +1346,15 @@ void M_MinimapGenerate(void)
minigen = AM_MinimapGenerate(mul); minigen = AM_MinimapGenerate(mul);
if (minigen == NULL || minigen->buf == NULL) if (minigen == NULL || minigen->buf == NULL)
goto failure; {
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
return;
}
M_CreateScreenShotPalette(); M_CreateScreenShotPalette();
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette); ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
failure: free(minigen->buf);
if (minigen->buf != NULL)
free(minigen->buf);
if (ret) if (ret)
{ {
+1 -2
View File
@@ -687,8 +687,7 @@ 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, static fixed_t P_SectorCheckWater(sector_t *analyzesector, sector_t *elevatorsec)
sector_t *elevatorsec)
{ {
fixed_t watertop; fixed_t watertop;
+1 -1
View File
@@ -272,7 +272,7 @@ extern consvar_t cv_gravity;
void P_RespawnSpecials(void); void P_RespawnSpecials(void);
extern mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX]; extern mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1];
void CalculateDoomednumToMobjtype(void); void CalculateDoomednumToMobjtype(void);
mobj_t *P_AllocateMobj(void); mobj_t *P_AllocateMobj(void);
+25 -7
View File
@@ -3237,7 +3237,22 @@ void P_DestroyRobots(void)
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person // the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
void P_CalcChasePostImg(player_t *player, camera_t *thiscam) void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
{ {
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP); boolean player_flipcam = false;
if (cv_flipcammode.value == 0)
player_flipcam = player->pflags & PF_FLIPCAM;
else
{
INT32 pnum = P_GetLocalPlayerNumForPlayer(player);
// Shouldn't happen but just in case
if (pnum == -1)
pnum = 0;
player_flipcam = cv_flipcam[pnum].value;
}
const boolean flipcam = (player_flipcam && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
UINT8 postimgtype = 0; UINT8 postimgtype = 0;
if (encoremode) if (encoremode)
@@ -10448,17 +10463,20 @@ void P_PrecipitationEffects(void)
} }
} }
mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX]; mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1] = {};
void CalculateDoomednumToMobjtype(void) void CalculateDoomednumToMobjtype(void)
{ {
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype)); memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++) for (size_t i = 0; i < NUMMOBJTYPES; i++)
{ {
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX) const INT32 doomednum = mobjinfo[i].doomednum;
if (doomednum > 0 && doomednum <= MAXDOOMEDNUM)
{ {
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i; if (g_doomednum_to_mobjtype[doomednum] == MT_NULL)
g_doomednum_to_mobjtype[doomednum] = (mobjtype_t)i;
} }
} }
} }
@@ -10536,7 +10554,7 @@ void P_RespawnSpecials(void)
if (mthing) if (mthing)
{ {
mobjtype_t i; mobjtype_t i = MT_NULL;
x = mthing->x << FRACBITS; x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS; y = mthing->y << FRACBITS;
ss = R_PointInSubsector(x, y); ss = R_PointInSubsector(x, y);
@@ -10972,7 +10990,7 @@ INT32 numhuntemeralds = 0;
// //
void P_SpawnMapThing(mapthing_t *mthing) void P_SpawnMapThing(mapthing_t *mthing)
{ {
mobjtype_t i; mobjtype_t i = MT_NULL;
mobj_t *mobj; mobj_t *mobj;
fixed_t x, y, z; fixed_t x, y, z;
subsector_t *ss; subsector_t *ss;
+1 -6
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_x2, old_y2, old_z2; fixed_t old_z2; // ok guess we need that...
// More list: links in sector (if needed) // More list: links in sector (if needed)
struct mobj_s *bnext; struct mobj_s *bnext;
@@ -297,7 +297,6 @@ 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
@@ -307,9 +306,7 @@ 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
@@ -320,7 +317,6 @@ 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
@@ -395,7 +391,6 @@ 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;
+1 -2
View File
@@ -1385,8 +1385,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta,
if (mo->player) if (mo->player)
{ {
angle_t localangle = P_GetLocalAngle(mo->player); P_ForceLocalAngle(mo->player, P_GetLocalAngle(mo->player) + delta);
P_ForceLocalAngle(mo->player, localangle + delta);
} }
} }
} }
+4 -6
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(flatname); levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
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(flatname); levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
levelflat->baselumpnum = LUMPERROR; levelflat->baselumpnum = LUMPERROR;
P_CheckCyanFlat(levelflat); P_CheckCyanFlat(levelflat);
@@ -812,8 +812,6 @@ 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
+7 -117
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 ::harddefs and for loading an ANIMATED lump from a wad. * Used 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,104 +97,6 @@ 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
@@ -208,7 +110,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 ::harddefs or a lump into * Converts an ::animdef_t array loaded from 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.
@@ -254,7 +156,9 @@ 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
} }
@@ -275,11 +179,6 @@ 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);
@@ -318,10 +217,7 @@ void P_InitPicAnims(void)
animdefs[i].startname, animdefs[i].endname); animdefs[i].startname, animdefs[i].endname);
} }
if (animdefs == harddefs) lastanim->speed = LONG(animdefs[i].speed);
lastanim->speed = animdefs[i].speed;
else
lastanim->speed = LONG(animdefs[i].speed);
lastanim++; lastanim++;
} }
@@ -330,8 +226,7 @@ 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.
if (animdefs != harddefs) Z_Free(animdefs);
Z_Free(animdefs);
animdefs = NULL; animdefs = NULL;
} }
@@ -3986,12 +3881,7 @@ 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))
+143 -133
View File
@@ -78,7 +78,6 @@ 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.
@@ -239,10 +238,11 @@ 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)
{ {
if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER)) for (UINT8 i = 0; i <= splitscreen; i++)
|| (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER)) {
|| ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) if (!(players[displayplayers[i]].exiting || (players[displayplayers[i]].pflags & PF_TIMEOVER)))
|| ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) return false;
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,71 +703,74 @@ void P_RestoreMusic(player_t *player)
// Event - Level Start // Event - Level Start
if (leveltime < MUSICSTARTTIME) if (leveltime < MUSICSTARTTIME)
S_StartMapMusic();
else // 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 S_StartMapMusic();
return;
}
if (splitscreen) // 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
INT32 bestlocaltimer = 1;
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[1]); setbests(displayplayers[0]);
if (splitscreen > 1) setbests(displayplayers[1]);
setbests(displayplayers[2]); if (splitscreen > 1)
if (splitscreen > 2) setbests(displayplayers[2]);
setbests(displayplayers[3]); if (splitscreen > 2)
setbests(displayplayers[3]);
#undef setbests #undef setbests
} }
else else
{
if (player->playerstate == PST_LIVE)
{ {
if (player->playerstate == PST_LIVE) if (player->kartstuff[k_growshrinktimer] > 1)
{ wantedmus = 2;
if (player->kartstuff[k_growshrinktimer] > 1) else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 2; wantedmus = 1;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
}
} }
}
// Item - Grow // Item - Grow
if (wantedmus == 2 && cv_growmusic.value == 1) if (wantedmus == 2 && cv_growmusic.value == 1)
{ {
S_ChangeMusicInternal("kgrow", true); S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
} }
// Item - Invincibility // Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value == 1) else if (wantedmus == 1 && cv_supermusic.value == 1)
{ {
S_ChangeMusicInternal("kinvnc", true); S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
} }
else else
{ {
#if 0 #if 0
// Event - Final Lap // Event - Final Lap
// Still works for GME, but disabled for consistency // Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1)) if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f); S_SpeedMusic(1.2f);
#endif #endif
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
position = mapmusic.resume; position = mapmusic.resume;
else else
position = mapmusic.position; position = mapmusic.position;
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn()); S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar(); S_ClearRestoreMusicFadeInCvar();
mapmusic.resume = 0; mapmusic.resume = 0;
}
} }
} }
@@ -971,18 +974,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_GetLocalPlayerForNum
//
// Returns the player
// on the local machine for given number.
//
player_t *P_GetLocalPlayerForNum(UINT8 pnum)
{
return (&players[P_GetLocalPlayerNumForNum(pnum)]);
} }
// //
@@ -996,6 +988,17 @@ INT32 P_GetLocalPlayerNumForNum(UINT8 pnum)
return (pnum == 0 ? consoleplayer : displayplayers[pnum]); return (pnum == 0 ? consoleplayer : displayplayers[pnum]);
} }
//
// P_GetLocalPlayerForNum
//
// Returns the player
// on the local machine for given number.
//
player_t *P_GetLocalPlayerForNum(UINT8 pnum)
{
return (&players[P_GetLocalPlayerNumForNum(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++)
@@ -1022,7 +1025,9 @@ 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;
@@ -1041,7 +1046,9 @@ 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;
@@ -1069,7 +1076,9 @@ 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;
@@ -1229,19 +1238,20 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
mobj->flags &= ~MF_DONTENCOREMAP; mobj->flags &= ~MF_DONTENCOREMAP;
// Copy interpolation data :) // Copy interpolation data :)
ghost->old_x = mobj->old_x2; // old_x - mobj->momx - hack to preserve vanilla look
ghost->old_y = mobj->old_y2; ghost->old_x = mobj->old_x - mobj->momx;
ghost->old_z = mobj->old_z2; ghost->old_y = mobj->old_y - mobj->momy;
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2); ghost->old_z = mobj->old_z2; // Slopes.....
ghost->old_pitch = mobj->old_pitch2; ghost->old_angle = (mobj->player ? mobj->player->old_frameangle : mobj->old_angle);
ghost->old_roll = mobj->old_roll2; ghost->old_pitch = mobj->old_pitch;
ghost->old_sloperoll = mobj->old_sloperoll2; ghost->old_roll = mobj->old_roll;
ghost->old_slopepitch = mobj->old_slopepitch2; ghost->old_sloperoll = mobj->old_sloperoll;
ghost->old_scale = mobj->old_scale2; ghost->old_slopepitch = mobj->old_slopepitch;
ghost->old_spritexscale = mobj->old_spritexscale2; ghost->old_scale = mobj->old_scale;
ghost->old_spriteyscale = mobj->old_spriteyscale2; ghost->old_spritexscale = mobj->old_spritexscale;
ghost->old_spritexoffset = mobj->old_spritexoffset2; ghost->old_spriteyscale = mobj->old_spriteyscale;
ghost->old_spriteyoffset = mobj->old_spriteyoffset2; ghost->old_spritexoffset = mobj->old_spritexoffset;
ghost->old_spriteyoffset = mobj->old_spriteyoffset;
return ghost; return ghost;
} }
@@ -1255,7 +1265,9 @@ void P_DoPlayerExit(player_t *player)
if (player->exiting || mapreset) if (player->exiting || mapreset)
return; return;
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback)) const boolean islocalplayer = P_IsLocalPlayer(player);
if (islocalplayer && (!player->spectator && !demo.playback))
legitimateexit = true; legitimateexit = true;
if (player->griefstrikes > 0) if (player->griefstrikes > 0)
@@ -1270,7 +1282,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 (P_IsLocalPlayer(player)) if (islocalplayer)
{ {
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);
@@ -1324,12 +1336,13 @@ 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;
@@ -1360,12 +1373,13 @@ 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;
@@ -1547,13 +1561,12 @@ static void P_CheckBouncySectors(player_t *player)
if (top) if (top)
{ {
fixed_t newmom; fixed_t newmom;
pslope_t *slope; pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
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;
@@ -1644,7 +1657,8 @@ 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)) continue; if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
@@ -1702,10 +1716,8 @@ static void P_CheckInvincibilityTimer(player_t *player)
{ {
if (!player->powers[pw_super]) if (!player->powers[pw_super])
{ {
{ player->mo->color = player->skincolor;
player->mo->color = player->skincolor; G_GhostAddColor((INT32)(player - players), GHC_NORMAL);
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);
@@ -1730,7 +1742,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->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator) if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)))
return; return;
if (P_RandomChance(FRACUNIT/16)) if (P_RandomChance(FRACUNIT/16))
@@ -1744,9 +1756,6 @@ 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;
} }
// //
@@ -1859,10 +1868,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)
@@ -1912,7 +1921,7 @@ static void P_3dMovement(player_t *player)
if (analogmove) if (analogmove)
{ {
movepushangle = (cmd->angleturn<<16 /* not FRACBITS */); movepushangle = (cmd->angleturn << TICCMD_REDUCE);
} }
else else
{ {
@@ -2012,12 +2021,17 @@ 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 }
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) { else // Direction goes up, so thrustangle needs to face away
{
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270)
{
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
} }
} }
@@ -2072,7 +2086,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<<16 /* not FRACBITS */); player->mo->angle = (angle_t)(cmd->angleturn << TICCMD_REDUCE);
ticruned++; ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED)) if (!(cmd->angleturn & TICCMD_RECEIVED))
@@ -2100,10 +2114,6 @@ 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)
@@ -2278,7 +2288,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>>16); angle_diff = cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE);
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];
@@ -2291,18 +2301,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<<16; player->mo->angle = cmd->angleturn << TICCMD_REDUCE;
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<<16; player->mo->angle += angle_diff << TICCMD_REDUCE;
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>>16)), // (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)),
// (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ? angle_diff : 1)); // (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)) * 100 / (angle_diff ? angle_diff : 1));
} }
} }
@@ -2732,6 +2742,9 @@ 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;
@@ -2759,9 +2772,6 @@ 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))
@@ -3167,7 +3177,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 >> 16); cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
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;
@@ -3263,7 +3273,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
axis = JoyAxis(AXISLOOK, forplayer); axis = JoyAxis(AXISLOOK, forplayer);
laim += (mlooky<<19)*player_invert; laim += (mousey<<19)*player_invert;
if (InputDown(gc_lookup, forplayer) || (usejoystick && axis < 0)) if (InputDown(gc_lookup, forplayer) || (usejoystick && axis < 0))
{ {
@@ -3302,7 +3312,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
} }
mousex = mousey = mlooky = 0; mousex = mousey = 0;
if (forward > MAXPLMOVE) if (forward > MAXPLMOVE)
forward = MAXPLMOVE; forward = MAXPLMOVE;
@@ -3320,7 +3330,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 << 16); lang += (cmd->angleturn << TICCMD_REDUCE);
cam->localangle = lang; cam->localangle = lang;
if (!cam->reset_aiming) if (!cam->reset_aiming)
@@ -3350,7 +3360,7 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
cam->aiming = cmd->aiming << FRACBITS; cam->aiming = cmd->aiming << FRACBITS;
} }
cam->angle = cmd->angleturn << 16; cam->angle = cmd->angleturn << TICCMD_REDUCE;
// camera movement: // camera movement:
if (!cam->button_a_held) if (!cam->button_a_held)
@@ -3830,7 +3840,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 << 16; focusangle = player->cmd.angleturn << TICCMD_REDUCE;
else else
focusangle = mo->angle; // Just use something known sane. focusangle = mo->angle; // Just use something known sane.
focusaiming = 0; focusaiming = 0;
+5 -3
View File
@@ -515,13 +515,15 @@ 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, boxpos; INT32 sx1, sx2;
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.
boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) + const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
(viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8); viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5) if (boxpos == 5)
return true; return true;
+4 -15
View File
@@ -722,6 +722,10 @@ 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;
} }
@@ -763,22 +767,7 @@ 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;
+14 -5
View File
@@ -182,6 +182,9 @@ consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS] = {
{"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL} {"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
}; };
static CV_PossibleValue_t flipcammode_cons_t[] = {{0, "Displayplayer"}, {1, "Local"}, {0, NULL}};
consvar_t cv_flipcammode = {"flipcammode", "Displayplayer", CV_SAVE, flipcammode_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -567,6 +570,7 @@ 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;
} }
@@ -1109,7 +1113,8 @@ 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;
@@ -1276,9 +1281,10 @@ 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 viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN whos altview man?
I_Assert(viewmobj != NULL); I_Assert(viewmobj != NULL);
newview->x = viewmobj->x; newview->x = viewmobj->x;
@@ -1337,7 +1343,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;
@@ -1347,7 +1353,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;
@@ -1429,6 +1435,7 @@ 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;
@@ -1542,6 +1549,8 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_flipcam[i]); CV_RegisterVar(&cv_flipcam[i]);
} }
CV_RegisterVar(&cv_flipcammode);
// Enough for dedicated server // Enough for dedicated server
if (dedicated) if (dedicated)
return; return;
+1
View File
@@ -205,6 +205,7 @@ extern consvar_t cv_showhud, cv_translucenthud, cv_uncappedhud;
extern consvar_t cv_homremoval; extern consvar_t cv_homremoval;
extern consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_flipcammode;
extern consvar_t cv_shadow, cv_shadowoffs; extern consvar_t cv_shadow, cv_shadowoffs;
extern consvar_t cv_ffloorclip, cv_spriteclip; extern consvar_t cv_ffloorclip, cv_spriteclip;
extern consvar_t cv_softcyancut; extern consvar_t cv_softcyancut;
+5 -5
View File
@@ -2229,12 +2229,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
lowcutslope = std::max(worldbottomslope, worldlowslope) + viewz; lowcutslope = std::max(worldbottomslope, worldlowslope) + viewz;
highcutslope = std::min(worldtopslope, worldhighslope) + viewz; highcutslope = std::min(worldtopslope, worldhighslope) + viewz;
auto check_fof_offscreen = [&](ffloor_t* rover, INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope) auto check_fof_offscreen = [&](ffloor_t* rrover, INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope)
{ {
return ((P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= bottom + viewz return ((P_GetFFloorTopZAt (rrover, segleft .x, segleft .y) <= bottom + viewz
&& P_GetFFloorTopZAt (rover, segright.x, segright.y) <= bottomslope + viewz) && P_GetFFloorTopZAt (rrover, segright.x, segright.y) <= bottomslope + viewz)
|| ( P_GetFFloorBottomZAt (rover, segleft .x, segleft .y) >= top + viewz || ( P_GetFFloorBottomZAt (rrover, segleft .x, segleft .y) >= top + viewz
&& P_GetFFloorBottomZAt (rover, segright.x, segright.y) >= topslope + viewz)); && P_GetFFloorBottomZAt (rrover, segright.x, segright.y) >= topslope + viewz));
}; };
if (frontsector->ffloors && backsector->ffloors) if (frontsector->ffloors && backsector->ffloors)
+1 -1
View File
@@ -1577,7 +1577,7 @@ static void R_ProjectSprite(mobj_t *thing)
else else
blendmode = thing->blendmode; blendmode = thing->blendmode;
if (thing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) if (thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK
else if (thing->frame & FF_TRANSMASK) else if (thing->frame & FF_TRANSMASK)
{ {
+20 -19
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|CV_NOINIT, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL, 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,6 +94,14 @@ 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};
@@ -273,12 +281,6 @@ 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
@@ -286,6 +288,9 @@ 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);
@@ -357,7 +362,6 @@ 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;
@@ -365,9 +369,6 @@ 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.
@@ -771,14 +772,9 @@ 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
else if (c->origin)
{ {
boolean itsUs = false; boolean itsUs = false;
@@ -1495,6 +1491,9 @@ musicdef_t *S_FindMusicCredit(const char *musname)
{ {
def = S_GetMusicCredit(i); def = S_GetMusicCredit(i);
if (!def)
continue;
if (hash != def->hash) if (hash != def->hash)
continue; continue;
@@ -1646,7 +1645,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))
{ {
@@ -1654,7 +1653,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
} }
@@ -1713,6 +1712,8 @@ 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)))
{ {
+3 -6
View File
@@ -54,13 +54,10 @@ extern consvar_t cv_amigatype;
#endif #endif
#endif #endif
#ifdef HAVE_FLUIDSYNTH
extern consvar_t cv_midisoundfontpath;
extern consvar_t cv_midichorus;
extern consvar_t cv_midireverb;
#endif
//bird music stuff //bird music stuff
extern consvar_t cv_music_resync_threshold;
extern consvar_t cv_music_resync_powerups_only;
extern consvar_t cv_invincmusicfade; extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade; extern consvar_t cv_growmusicfade;
+3 -2
View File
@@ -315,8 +315,9 @@ void SCR_CheckDefaultMode(void)
void SCR_SetDefaultMode(void) void SCR_SetDefaultMode(void)
{ {
// remember the default screen size // remember the default screen size
CV_SetValue(&cv_scr_width, vid.width); CV_StealthSetValue(&cv_scr_width, vid.width);
CV_SetValue(&cv_scr_height, vid.height); CV_StealthSetValue(&cv_scr_height, vid.height);
VID_RefreshModeList(); // probably not needed but justin käs
} }
// Change fullscreen on/off according to cv_fullscreen // Change fullscreen on/off according to cv_fullscreen
+24 -25
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_IOStream *src); int IMG_isXPM(SDL_RWops *src);
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src); SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *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_IOStream *src) int IMG_isXPM(SDL_RWops *src)
{ {
Sint64 start; Sint64 start;
int is_XPM; int is_XPM;
@@ -64,14 +64,14 @@ int IMG_isXPM(SDL_IOStream *src)
if ( !src ) if ( !src )
return 0; return 0;
start = SDL_TellIO(src); start = SDL_RWtell(src);
is_XPM = 0; is_XPM = 0;
if ( SDL_ReadIO(src, magic, sizeof(magic)) ) { if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) { if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {
is_XPM = 1; is_XPM = 1;
} }
} }
SDL_SeekIO(src, start, SDL_IO_SEEK_SET); SDL_RWseek(src, start, RW_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_IOStream *src, int len) static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
{ {
char *linebufnew; char *linebufnew;
@@ -943,7 +943,7 @@ static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len
char c; char c;
int n; int n;
do { do {
if (SDL_ReadIO(src, &c, 1) <= 0) { if (SDL_RWread(src, &c, 1, 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_IOStream *src, int len
} }
linebuf = linebufnew; linebuf = linebufnew;
} }
if (SDL_ReadIO(src, linebuf, len - 1) <= 0) { if (SDL_RWread(src, linebuf, len - 1, 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_IOStream *src, int len
} }
linebuf = linebufnew; linebuf = linebufnew;
} }
if (SDL_ReadIO(src, linebuf + n, 1) <= 0) { if (SDL_RWread(src, linebuf + n, 1, 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_IOStream *src) static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *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_IOStream *src)
buflen = 0; buflen = 0;
if (src) if (src)
start = SDL_TellIO(src); start = SDL_RWtell(src);
if (xpm) if (xpm)
xpmlines = &xpm; xpmlines = &xpm;
@@ -1065,15 +1065,14 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
/* Create the new surface */ /* Create the new surface */
if (ncolors <= 256) { if (ncolors <= 256) {
indexed = 1; indexed = 1;
image = SDL_CreateSurface(w, h, image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
SDL_PIXELFORMAT_INDEX8); 0, 0, 0, 0);
SDL_Palette *palette = SDL_CreateSurfacePalette(image); im_colors = image->format->palette->colors;
im_colors = palette->colors; image->format->palette->ncolors = ncolors;
palette->ncolors = ncolors;
} else { } else {
indexed = 0; indexed = 0;
image = SDL_CreateSurface(w, h, image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
SDL_GetPixelFormatForMasks(32, 0xff0000, 0x00ff00, 0x0000ff, 0)); 0xff0000, 0x00ff00, 0x0000ff, 0);
} }
if (!image) { if (!image) {
/* Hmm, some SDL error (out of memory?) */ /* Hmm, some SDL error (out of memory?) */
@@ -1129,7 +1128,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
add_colorhash(colors, nextkey, cpp, pixel); add_colorhash(colors, nextkey, cpp, pixel);
nextkey += cpp; nextkey += cpp;
if (rgb == 0xffffffff) if (rgb == 0xffffffff)
SDL_SetSurfaceColorKey(image, true, pixel); SDL_SetColorKey(image, SDL_TRUE, pixel);
break; break;
} }
} }
@@ -1165,9 +1164,9 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
done: done:
if (error) { if (error) {
if ( src ) if ( src )
SDL_SeekIO(src, start, SDL_IO_SEEK_SET); SDL_RWseek(src, start, RW_SEEK_SET);
if ( image ) { if ( image ) {
SDL_DestroySurface(image); SDL_FreeSurface(image);
image = NULL; image = NULL;
} }
IMG_SetError("%s", error); IMG_SetError("%s", error);
@@ -1181,7 +1180,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_IOStream *src) SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
{ {
if ( !src ) { if ( !src ) {
/* The error message has been set in SDL_RWFromFile */ /* The error message has been set in SDL_RWFromFile */
@@ -1204,14 +1203,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_IOStream *src) int IMG_isXPM(SDL_RWops *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_IOStream *src) SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
{ {
return(NULL); return(NULL);
} }
+2 -2
View File
@@ -27,10 +27,10 @@
#ifdef HAVE_SDL #ifdef HAVE_SDL
#include <SDL3/SDL.h> #include "SDL.h"
#ifndef NOLOADSO #ifndef NOLOADSO
#include <SDL3/SDL_loadso.h> #include "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 <SDL3/SDL.h> #include "SDL.h"
#include "i_ttf.h" #include "i_ttf.h"
#endif #endif
+50 -51
View File
@@ -67,15 +67,13 @@ 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 <SDL3/SDL.h> #include "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 <SDL3/SDL_cpuinfo.h> #include "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__))
@@ -215,14 +213,12 @@ static char returnWadPath[256];
#include "../byteptr.h" #include "../byteptr.h"
#endif #endif
bool consolevent = false; boolean consolevent = false;
bool framebuffer = false; boolean 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!
bool stdin_active = true;
typedef struct typedef struct
{ {
size_t cursor; size_t cursor;
@@ -299,8 +295,8 @@ static void I_StartupConsole(void)
signal(SIGTTIN, SIG_IGN); signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN); signal(SIGTTOU, SIG_IGN);
consolevent = static_cast<bool>(!M_CheckParm("-noconsole")); consolevent = static_cast<SDL_bool>(!M_CheckParm("-noconsole"));
framebuffer = static_cast<bool>( M_CheckParm("-framebuffer")); framebuffer = static_cast<SDL_bool>( M_CheckParm("-framebuffer"));
if (framebuffer) if (framebuffer)
consolevent = false; consolevent = false;
@@ -695,7 +691,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;
@@ -725,7 +721,7 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
{ {
if (JoySet->dev) if (JoySet->dev)
{ {
SDL_CloseGamepad(JoySet->dev); SDL_GameControllerClose(JoySet->dev);
} }
JoySet->dev = NULL; JoySet->dev = NULL;
@@ -767,15 +763,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_Gamepad *dev) static INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev)
{ {
SDL_Joystick *joystick = NULL; SDL_Joystick *joystick = NULL;
joystick = SDL_GetGamepadJoystick(dev); joystick = SDL_GameControllerGetJoystick(dev);
if (joystick) if (joystick)
{ {
return SDL_GetJoystickID(joystick); return SDL_JoystickInstanceID(joystick);
} }
return -1; return -1;
@@ -885,7 +881,7 @@ void I_ShutdownJoystick(UINT8 index)
*/ */
static int joy_open(int playerIndex, int joyIndex) static int joy_open(int playerIndex, int joyIndex)
{ {
SDL_Gamepad *newdev = NULL; SDL_GameController *newdev = NULL;
int num_joy = 0; int num_joy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
@@ -894,7 +890,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1; return -1;
} }
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0) if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 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;
@@ -903,7 +899,7 @@ static int joy_open(int playerIndex, int joyIndex)
if (joyIndex <= 0) if (joyIndex <= 0)
return -1; return -1;
SDL_GetJoysticks(&num_joy); num_joy = SDL_NumJoysticks();
if (num_joy == 0) if (num_joy == 0)
{ {
@@ -911,7 +907,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1; return -1;
} }
newdev = SDL_OpenGamepad(joyIndex-1); newdev = SDL_GameControllerOpen(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.
@@ -926,8 +922,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_GamepadConnected(JoyInfo[playerIndex].dev))) // we failed, but already have a working device || (newdev == NULL && SDL_GameControllerGetAttached(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
return SDL_GAMEPAD_AXIS_COUNT; return SDL_CONTROLLER_AXIS_MAX;
// 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");
@@ -944,13 +940,13 @@ static int joy_open(int playerIndex, int joyIndex)
} }
else else
{ {
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GetGamepadName(JoyInfo[playerIndex].dev)); CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].axises = SDL_GAMEPAD_AXIS_COUNT; JoyInfo[playerIndex].axises = SDL_CONTROLLER_AXIS_MAX;
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_GAMEPAD_BUTTON_COUNT; // dpad is 4 buttons JoyInfo[playerIndex].buttons = SDL_CONTROLLER_BUTTON_MAX ; // dpad is 4 buttons
if (JoyInfo[playerIndex].buttons > JOYBUTTONS) if (JoyInfo[playerIndex].buttons > JOYBUTTONS)
JoyInfo[playerIndex].buttons = JOYBUTTONS; JoyInfo[playerIndex].buttons = JOYBUTTONS;
@@ -970,7 +966,7 @@ static int joy_open(int playerIndex, int joyIndex)
void I_InitJoystick(UINT8 index) void I_InitJoystick(UINT8 index)
{ {
UINT8 i; UINT8 i;
SDL_Gamepad *newcontroller = NULL; SDL_GameController *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");
@@ -988,16 +984,15 @@ void I_InitJoystick(UINT8 index)
{ {
CONS_Printf("I_InitJoystick()...\n"); CONS_Printf("I_InitJoystick()...\n");
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK)) if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
{ {
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_GAMEPAD)) if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1)
{ {
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;
@@ -1010,7 +1005,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_OpenGamepad(cv_usejoystick[index].value-1); newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
@@ -1050,7 +1045,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_CloseGamepad(newcontroller); SDL_GameControllerClose(newcontroller);
} }
} }
@@ -1085,10 +1080,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_GAMEPAD) == SDL_INIT_GAMEPAD) if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == SDL_INIT_GAMECONTROLLER)
{ {
CONS_Printf("Shutting down gamecontroller system\n"); CONS_Printf("Shutting down gamecontroller system\n");
SDL_QuitSubSystem(SDL_INIT_GAMEPAD); SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
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");
} }
@@ -1105,9 +1100,7 @@ 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;
} }
@@ -1122,7 +1115,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_GetJoystickNameForID(joyindex); tempname = SDL_JoystickNameForIndex(joyindex);
if (tempname) if (tempname)
{ {
@@ -1142,14 +1135,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_Gamepad *controller = JoyInfo[playernum].dev; SDL_GameController *controller = JoyInfo[playernum].dev;
if (controller == NULL) if (controller == NULL)
{ {
return; return;
} }
SDL_RumbleGamepad(controller, low_strength, high_strength, duration); SDL_GameControllerRumble(controller, low_strength, high_strength, duration);
#endif #endif
} }
@@ -1161,14 +1154,14 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
(void)green; (void)green;
(void)blue; (void)blue;
#else #else
SDL_Gamepad *controller = JoyInfo[playernum].dev; SDL_GameController *controller = JoyInfo[playernum].dev;
if (controller == NULL) if (controller == NULL)
{ {
return; return;
} }
SDL_SetGamepadLED(controller, red, green, blue); SDL_GameControllerSetLED(controller, red, green, blue);
#endif #endif
} }
@@ -1821,7 +1814,10 @@ static void I_Fork(void)
INT32 I_StartupSystem(void) INT32 I_StartupSystem(void)
{ {
int SDLlinked = SDL_GetVersion(); SDL_version SDLcompiled;
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
@@ -1837,15 +1833,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",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION); SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
I_OutputMsg("Linked with SDL version: %d.%d.%d\n", I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
SDL_VERSIONNUM_MAJOR(SDLlinked), SDL_VERSIONNUM_MINOR(SDLlinked), SDL_VERSIONNUM_MICRO(SDLlinked)); SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
#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)) if (SDL_Init(0) < 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();
@@ -1853,17 +1849,20 @@ INT32 I_StartupSystem(void)
return 0; return 0;
} }
boolean is_quitting = false;
// //
// I_Quit // I_Quit
// //
FUNCNORETURN void ATTRNORETURN I_Quit(void) FUNCNORETURN void ATTRNORETURN I_Quit(void)
{ {
static bool quiting = false;
/* prevent recursive I_Quit() */ /* prevent recursive I_Quit() */
if (quiting) goto death; if (is_quitting)
SDL_ShowCursor(); abort();
quiting = false;
is_quitting = true;
SDL_ShowCursor(SDL_TRUE);
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
@@ -1890,7 +1889,7 @@ FUNCNORETURN void ATTRNORETURN I_Quit(void)
} }
if (myargmalloc) if (myargmalloc)
free(myargv); // Deallocate allocated memory free(myargv); // Deallocate allocated memory
death:
W_Shutdown(); W_Shutdown();
exit(0); exit(0);
} }
+30 -25
View File
@@ -12,7 +12,7 @@
#include "../doomdef.h" #include "../doomdef.h"
#include "../i_threads.h" #include "../i_threads.h"
#include <SDL3/SDL.h> #include <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_AtomicInt i_threads_running = {1}; static SDL_atomic_t i_threads_running = {1};
static Link static Link
Insert_link ( Insert_link (
@@ -103,13 +103,13 @@ Identity (
){ ){
void * id; void * id;
id = SDL_GetAtomicPointer(anchor); id = SDL_AtomicGetPtr(anchor);
if (! id) if (! id)
{ {
I_lock_mutex(&pool_mutex); I_lock_mutex(&pool_mutex);
{ {
id = SDL_GetAtomicPointer(anchor); id = SDL_AtomicGetPtr(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_SetAtomicPointer(anchor, id); SDL_AtomicSetPtr(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_GetAtomicInt(&i_threads_running)) if (SDL_AtomicGet(&i_threads_running))
{ {
I_lock_mutex(&i_thread_pool_mutex); I_lock_mutex(&i_thread_pool_mutex);
{ {
if (SDL_GetAtomicInt(&i_threads_running)) if (SDL_AtomicGet(&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_GetAtomicInt(&i_threads_running)) if (SDL_AtomicGet(&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_GetAtomicInt(&i_threads_running) ); return ( ! SDL_AtomicGet(&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_Condition * cond; SDL_cond * 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_SetAtomicInt(&i_threads_running, 0); SDL_AtomicSet(&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_DestroyCondition(cond); SDL_DestroyCond(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,14 +291,16 @@ I_lock_mutex (
(Create_fn)SDL_CreateMutex (Create_fn)SDL_CreateMutex
); );
SDL_LockMutex(mutex); if (SDL_LockMutex(mutex) == -1)
abort();
} }
void void
I_unlock_mutex ( I_unlock_mutex (
I_mutex id I_mutex id
){ ){
SDL_UnlockMutex(id); if (SDL_UnlockMutex(id) == -1)
abort();
} }
void void
@@ -306,46 +308,49 @@ I_hold_cond (
I_cond * cond_anchor, I_cond * cond_anchor,
I_mutex mutex_id I_mutex mutex_id
){ ){
SDL_Condition * cond; SDL_cond * 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_CreateCondition (Create_fn)SDL_CreateCond
); );
SDL_WaitCondition(cond, mutex_id); if (SDL_CondWait(cond, mutex_id) == -1)
abort();
} }
void void
I_wake_one_cond ( I_wake_one_cond (
I_cond * anchor I_cond * anchor
){ ){
SDL_Condition * cond; SDL_cond * cond;
cond = Identity( cond = Identity(
&i_cond_pool, &i_cond_pool,
i_cond_pool_mutex, i_cond_pool_mutex,
anchor, anchor,
(Create_fn)SDL_CreateCondition (Create_fn)SDL_CreateCond
); );
SDL_SignalCondition(cond); if (SDL_CondSignal(cond) == -1)
abort();
} }
void void
I_wake_all_cond ( I_wake_all_cond (
I_cond * anchor I_cond * anchor
){ ){
SDL_Condition * cond; SDL_cond * cond;
cond = Identity( cond = Identity(
&i_cond_pool, &i_cond_pool,
i_cond_pool_mutex, i_cond_pool_mutex,
anchor, anchor,
(Create_fn)SDL_CreateCondition (Create_fn)SDL_CreateCond
); );
SDL_BroadcastCondition(cond); if (SDL_CondBroadcast(cond) == -1)
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)) if (SDL_InitSubSystem(initflags) < 0)
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()) if (TTF_Init() < 0)
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
+234 -242
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -461,7 +461,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
gme_track_info(emu, &info, 0); gme_track_info(emu, &info, 0);
len = (info->play_length * 441 / 10) << 2; len = (info->play_length * 441 / 10) << 2;
mem = Z_Malloc(len, PU_SOUND, 0); mem = Z_Malloc(len, PU_SOUND, NULL);
gme_play(emu, len >> 1, mem); gme_play(emu, len >> 1, mem);
gme_free_info(info); gme_free_info(info);
@@ -499,7 +499,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
gme_track_info(emu, &info, 0); gme_track_info(emu, &info, 0);
len = (info->play_length * 441 / 10) << 2; len = (info->play_length * 441 / 10) << 2;
mem = Z_Malloc(len, PU_SOUND, 0); mem = Z_Malloc(len, PU_SOUND, NULL);
gme_play(emu, len >> 1, mem); gme_play(emu, len >> 1, mem);
gme_free_info(info); gme_free_info(info);
+4 -40
View File
@@ -20,7 +20,7 @@
#ifdef HAVE_SDL #ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED #define _MATH_DEFINES_DEFINED
#include <SDL3/SDL.h> #include "SDL.h"
#include "sdlmain.h" #include "sdlmain.h"
@@ -63,25 +63,15 @@ PFNglGetString pglGetString;
#endif #endif
#ifdef USE_FBO_OGL #ifdef USE_FBO_OGL
#if defined (__unix__)
static boolean xwaylandcrap = false;
#endif
boolean UseScreenFBO(void) boolean UseScreenFBO(void)
{ {
return ((supportFBO && cv_glframebuffer.value && downsample) return (supportFBO && cv_glframebuffer.value && downsample);
#if defined (__unix__)
|| (supportFBO && xwaylandcrap)
#endif
);
} }
#endif #endif
/** \brief SDL video display surface /** \brief SDL video display surface
*/ */
INT32 oglflags = 0; INT32 oglflags = 0;
SDL_GLContext sdlglcontext = NULL;
void *GetGLFunc(const char *proc) void *GetGLFunc(const char *proc)
{ {
@@ -96,7 +86,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)) if (SDL_GL_LoadLibrary(OGLLibname) != 0)
{ {
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"))
@@ -201,17 +191,6 @@ boolean OglSdlSurface(INT32 w, INT32 h)
supportNPO2tex = true; supportNPO2tex = true;
glanisotropicmode_cons_t[1].value = maximumAnisotropy; glanisotropicmode_cons_t[1].value = maximumAnisotropy;
#if defined (__unix__)
#ifdef USE_FBO_OGL
// TODO: delet this since nvidia fixed their shit on 575
char videodriver[4] = {'S','D','L',0};
if (supportFBO && strstr((const char*)gl_renderer, "NVIDIA")
&& (*strncpy(videodriver, SDL_GetCurrentVideoDriver(), sizeof(videodriver)-1) != '\0')
&& (strncasecmp("x11", videodriver, 4) == 0))
xwaylandcrap = true;
#endif
#endif
} }
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0); SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
@@ -241,22 +220,14 @@ boolean OglSdlSurface(INT32 w, INT32 h)
\return void \return void
*/ */
void OglSdlFinishUpdate(boolean waitvbl) void OglSdlFinishUpdate(SDL_Window *window)
{ {
static boolean oldwaitvbl = false;
int sdlw, sdlh; int sdlw, sdlh;
#ifdef USE_FBO_OGL #ifdef USE_FBO_OGL
const boolean usefbo = UseScreenFBO(); const boolean usefbo = UseScreenFBO();
#endif #endif
if (oldwaitvbl != waitvbl)
{
SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
}
oldwaitvbl = waitvbl;
SDL_GetWindowSize(window, &sdlw, &sdlh); SDL_GetWindowSize(window, &sdlw, &sdlh);
HWR_MakeScreenFinalTexture(); HWR_MakeScreenFinalTexture();
@@ -289,13 +260,6 @@ void OglSdlFinishUpdate(boolean waitvbl)
if (!I_CheckNativeRes() || WipeInAction) if (!I_CheckNativeRes() || WipeInAction)
#endif #endif
HWR_DrawScreenFinalTexture(realwidth, realheight, false); HWR_DrawScreenFinalTexture(realwidth, realheight, false);
#if defined (__unix__)
#ifdef USE_FBO_OGL
if (loaded_config)
xwaylandcrap = false;
#endif
#endif
} }
#endif //HWRENDER #endif //HWRENDER
+1 -3
View File
@@ -20,11 +20,9 @@
boolean OglSdlSurface(INT32 w, INT32 h); boolean OglSdlSurface(INT32 w, INT32 h);
void OglSdlFinishUpdate(boolean vidwait); void OglSdlFinishUpdate(SDL_Window *window);
boolean VID_LoadOGLAPI(void); boolean VID_LoadOGLAPI(void);
extern SDL_Renderer *renderer;
extern SDL_GLContext sdlglcontext;
extern Uint16 realwidth; extern Uint16 realwidth;
extern Uint16 realheight; extern Uint16 realheight;
-1962
View File
File diff suppressed because it is too large. Load diff
+2 -22
View File
@@ -23,16 +23,11 @@
extern "C" { extern "C" {
#endif #endif
extern bool consolevent;
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
@@ -43,9 +38,9 @@ extern bool framebuffer;
typedef struct SDLJoyInfo_s typedef struct SDLJoyInfo_s
{ {
/// Controller handle /// Controller handle
SDL_Gamepad *dev; SDL_GameController *dev;
/// Controller index /// Controller index
SDL_JoystickID id; INT32 id;
/// number of old joystick /// number of old joystick
int oldjoy; int oldjoy;
/// number of axies /// number of axies
@@ -69,21 +64,6 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
#define SDL_JDEADZONE 153 #define SDL_JDEADZONE 153
#undef SDL_JDEADZONE #undef SDL_JDEADZONE
// So we can call this from i_video event loop
void I_ShutdownJoystick(UINT8 index);
// Cheat to get the device index for a game controller handle
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev);
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
void I_UpdateJoystickDeviceIndex(UINT8 player);
void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer);
void I_GetConsoleEvents(void);
// Needed for some WIN32 functions
extern SDL_Window *window;
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
+20 -1
View File
@@ -1997,11 +1997,16 @@ void *W_CachePatchNameRotated(const char *name, INT32 rotationangle, INT32 tag)
rspr = (rotsprite_t *)W_GetCachedRotPatchPwad(WADFILENUM(num),LUMPNUM(num)); rspr = (rotsprite_t *)W_GetCachedRotPatchPwad(WADFILENUM(num),LUMPNUM(num));
if (rspr == NULL)
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
if (rspr->patches[idx] == NULL) if (rspr->patches[idx] == NULL)
{ {
INT32 xpivot = 0, ypivot = 0; INT32 xpivot = 0, ypivot = 0;
ptr = (patch_t *)W_CachePatchNum(num, PU_PATCH); ptr = (patch_t *)W_CachePatchNum(num, PU_PATCH);
if (ptr == NULL)
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
// >y pivot centered // >y pivot centered
// >x pivot not centered // >x pivot not centered
@@ -2612,6 +2617,9 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
// Remember that we're assuming that the WAD will have a specific set of lumps in a specific order. // Remember that we're assuming that the WAD will have a specific set of lumps in a specific order.
UINT8 *wadData = (UINT8*)(W_CacheLumpNum(lumpnum, PU_LEVEL)); UINT8 *wadData = (UINT8*)(W_CacheLumpNum(lumpnum, PU_LEVEL));
if (wadData == NULL)
I_Error("vres_GetMap: Invalid WadData!\n");
filelump_t *fileinfo = (filelump_t *)(wadData + LONG(((wadinfo_t *)wadData)->infotableofs)); filelump_t *fileinfo = (filelump_t *)(wadData + LONG(((wadinfo_t *)wadData)->infotableofs));
i = LONG(((wadinfo_t *)wadData)->numlumps); i = LONG(((wadinfo_t *)wadData)->numlumps);
@@ -2628,6 +2636,8 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
} }
vlumps = (virtlump_t*)(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL)); vlumps = (virtlump_t*)(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL));
if (vlumps == NULL)
I_Error("vres_GetMap: Out of memory!\n");
// Build the lumps, skipping over empty entries. // Build the lumps, skipping over empty entries.
for (i = 0, realentry = 0; i < numlumps; realentry++) for (i = 0, realentry = 0; i < numlumps; realentry++)
@@ -2663,7 +2673,11 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
lumpnum_t lumppos = lumpnum + 1; lumpnum_t lumppos = lumpnum + 1;
for (i = LUMPNUM(lumppos); i < wadfiles[WADFILENUM(lumpnum)]->numlumps; i++, lumppos++, numlumps++) for (i = LUMPNUM(lumppos); i < wadfiles[WADFILENUM(lumpnum)]->numlumps; i++, lumppos++, numlumps++)
{ {
if (memcmp(W_CheckNameForNum(lumppos), "MAP", 3) == 0 || W_LumpLength(lumppos) == 0) const char *name = W_CheckNameForNum(lumppos);
if (name == NULL)
continue;
if (memcmp(name, "MAP", 3) == 0 || W_LumpLength(lumppos) == 0)
{ {
break; break;
} }
@@ -2671,10 +2685,15 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
numlumps++; numlumps++;
vlumps = (virtlump_t*)(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL)); vlumps = (virtlump_t*)(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL));
if (vlumps == NULL)
I_Error("vres_GetMap: Out of memory!\n");
for (i = 0; i < numlumps; i++, lumpnum++) for (i = 0; i < numlumps; i++, lumpnum++)
{ {
// Check if it is map marker. It is not always first lump sadly, so we need to expect it anywhere // Check if it is map marker. It is not always first lump sadly, so we need to expect it anywhere
const char *name = W_CheckNameForNum(lumpnum); const char *name = W_CheckNameForNum(lumpnum);
if (name == NULL)
continue;
if (strlen(name) == 5 && memcmp(name, "MAP", 3) == 0) if (strlen(name) == 5 && memcmp(name, "MAP", 3) == 0)
{ {
+19 -16
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, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH)); V_DrawScaledPatch(x+16, y-4, 0, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
} }
STRBUFCPY(strtime, standings->name[i]); STRBUFCPY(strtime, standings->name[i]);
@@ -831,6 +831,9 @@ 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
@@ -856,8 +859,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 = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY); VoteScreen.widebgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY); VoteScreen.bgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
} }
// //
@@ -905,7 +908,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
// Draw non animated patch // Draw non animated patch
if (!tempfoundAnimLuaVoteFrames) if (!tempfoundAnimLuaVoteFrames)
{ {
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY); votebg = (patch_t *)W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg); Y_VoteBackgroundDrawer(votebg);
return; return;
} }
@@ -918,11 +921,11 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
nextframe = (VoteScreen.currentAnimFrame + 1); nextframe = (VoteScreen.currentAnimFrame + 1);
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY); votebg = (patch_t *)W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg); Y_VoteBackgroundDrawer(votebg);
if (renderisnewtic && (votetic % 2 == 0) && !paused) if (renderisnewtic && (votetic % VoteScreen.timePerAnimFrame == 0) && !paused)
VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe; VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe;
} }
@@ -1186,7 +1189,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, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH)); V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
} }
} }
@@ -1446,14 +1449,14 @@ static void Y_InitVoteDrawing(void)
// setup the background patches // setup the background patches
Y_VoteScreenCheck(); Y_VoteScreenCheck();
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[0] = (patch_t*)W_CachePatchName("M_CURSOR", PU_PATCH);
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[1] = (patch_t*)W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[2] = (patch_t*)W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[3] = (patch_t*)W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY); VoteScreen.cursor[4] = (patch_t*)W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH_LOWPRIORITY); VoteScreen.randomlvl = (patch_t*)W_CachePatchName("RANDOMLV", PU_PATCH);
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH_LOWPRIORITY); VoteScreen.rubyicon = (patch_t*)W_CachePatchName("RUBYICON", PU_PATCH);
} }
void Y_StartVote(void) void Y_StartVote(void)
@@ -1538,9 +1541,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 = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH_LOWPRIORITY); levelinfo[i].pic = (patch_t *)W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
else else
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH_LOWPRIORITY); levelinfo[i].pic = (patch_t *)W_CachePatchName("BLANKLVL", PU_PATCH);
} }
} }
+1
View File
@@ -79,6 +79,7 @@ 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
-3
View File
@@ -651,9 +651,6 @@ void Z_ChangeTag(void *ptr, INT32 tag)
I_Error("Internal memory management error: " I_Error("Internal memory management error: "
"tried to make block purgable but it has no owner"); "tried to make block purgable but it has no owner");
// No, please, don't make my PU_STATIC patch NULL! It supposed to be always valid!
if (block->tag < 10) return;
block->tag = tag; block->tag = tag;
} }