Compare commits

..
177 Commits
Author SHA1 Message Date
Alug f58772a570 z_zone: add asserts if zone memory functions are called from non main thread
also taken from srb2classic thanks!
2026-02-02 18:14:38 +01:00
Alug f7c065b22e refactor i_thread stuff
based on https://codeberg.org/srb2classic/srb2classic/commit/3670a7c1c193185cf4921de8955c96e63fbecc62
and other things from srb2classic
this also now allows to check if a thread failed to spawn and reduces duped stuff and such
2026-02-02 18:14:35 +01:00
Alug 55c8546d68 do not use Zone Memory for masterserver rules
this gets called from within non main threads!
zone memory is not thread safe!
2026-02-02 17:27:23 +01:00
Alug 1762f18116 delet all the Z_Free checks
Z_Free already checks its input internally!
2026-02-02 16:12:38 +01:00
Alug e4dbf1ce11 plug a potential memory leak in M_SaveConfig 2026-02-02 16:11:57 +01:00
Alug 10b9d96259 hw_clip: replace "RoundToInt" with lrint
prefer to use standard lib functions if possible
lrint does the same thing (well ofc as long as no one touches the rounding direction löl) and is even quite a lot faster (though this is negligible in this case)
2026-02-02 16:11:54 +01:00
indev b23154fd93 Prevent replays menu scoll bar from disappearing 2026-02-02 02:28:33 +03:00
Alug b0ee972178 r_plane: fix visplane hashing overflowing
shift into "int" to prevent super large values during multiply
2026-02-01 20:52:48 +01:00
Alug 544e1d3b21 "fix" overflow in R_InitViewMapping with high resolutions 2026-02-01 17:07:18 +01:00
Alug 0ca6947f99 fix a few type issues 2026-02-01 16:27:25 +01:00
indev 3122c08039 Add focus options for gamepad led and rumble 2026-02-01 02:49:03 +03:00
indev 7a279a6fd9 Prefix autoaccel cvars with 'kart' to avoid conflict with hostmod 2026-01-28 19:19:02 +03:00
Alug c4581bd9a6 Only save and keep track of controller ids on SDL versions 2.32.4 and up
Older versions break and have unstable ids on Windows, cant check for linux but ill just add a version check at this point
This was part of updating sdl with v9, which got reverted due to other issues but this was not reverted oopsie
2026-01-24 18:20:54 +01:00
Alug bb47b976a7 software: fix drawseg xrange item coord type being too small
both sprite and drawseg coords are int32
might fix some clipping issues
2026-01-23 18:33:11 +01:00
Alug 6c419ff22e fix few more implicit double/float conversions 2026-01-23 18:33:08 +01:00
Alug 522904527f add missing HAVE_CURL 2026-01-23 10:08:35 +01:00
Alug 30539371c2 more cmake stuffs
-add LTO option, enabled by default
-set optimization level to O3 and O0 for debug builds
-add ASAN and UBSAN options
-always compile with gnu debug symbols
2026-01-22 14:46:12 +01:00
Alug e2ecc315b4 cmake: attempt to fix dedicated build uhh building 2026-01-22 14:44:47 +01:00
Alug eb2f186205 Merge pull request #221 from P-AS/morecmakefixes
CMake fixes cherry-picked from srb2-legacy
2026-01-22 14:43:38 +01:00
Alug bbf06b3376 add "vid.udup" same as vid.dup but not scaled with "highreshudscale" 2026-01-22 14:26:24 +01:00
Alug a1f70b0b31 opengl: attempt to scale vhs effect "fuzzyness"
this makes it appear more or less the same in all resolutions, similar to software, while also improving performance quite a bit on higher resolutions
2026-01-22 14:26:23 +01:00
Alug 2e0f5c02a4 opengl: make vhs effect bars be affected by "fuzzines"
makes stuff slightly slower, but matches the software effect
2026-01-22 14:25:57 +01:00
Alug 0f7001ef5c opengl: tiny optimiazation for vhs effect
dont call rand within the loop, use xorshift instead
while not massive, we dont need to call rand thousands of times, the xorshift is visually indistinguishable
this is still rather slow due to the crapton of draw calls and should best be replaced by a shader or something
2026-01-22 14:25:54 +01:00
PAS 4600da5782 restore SRB2_SDL2_EXE_NAME 2026-01-21 15:54:32 -05:00
indev a3557fadef P_PlayRinglossSound from lua might desynch so print warning about that 2026-01-21 23:38:41 +03:00
Alug d9a67faf47 fix windoze compile 2026-01-21 21:11:52 +01:00
PAS 96eaf8850e Add path suffix for libgme cmake module 2026-01-21 15:01:51 -05:00
PAS e7efd46419 Fix FindGME pkg-config command, update LibFindMacros.cmake 2026-01-21 15:01:33 -05:00
PAS 346b1456cd CMake: Fix FindOPENMPT 2026-01-21 14:59:01 -05:00
PAS 9f5a5a735b Allow changing Cpak generator (from upstream) 2026-01-21 14:58:32 -05:00
PAS 8e4b304bed CMake: don't configure before CPACK_PACKAGE_DESCRIPTION_SUMMARY is set 2026-01-21 14:51:17 -05:00
Alug 607fbc54fc Merge pull request #220 from Indev450/fixcmake2
Fixup CMake, but simpler
2026-01-21 20:45:24 +01:00
Alug 276cf0a8cb fix string.c include
whoops, not sure why that was even done like that
string.c will include strcasestr.c and SRB2_HAVE_STRLCPY will ensure eitherways we dont use the included strlcpy stuff
2026-01-21 20:04:19 +01:00
Alug 59c9af97c2 joy_open: make debug prints actually print the player number 2026-01-21 19:54:03 +01:00
Alug 4e75d99026 simplify LUA_Alloc
Z_Realloc already handles everything internally, no need to manually free anything
2026-01-21 19:49:55 +01:00
Alug 8e91c16e97 cmake: enable gnu extensions
we rely on some of them like the cleanup macro
dont want those breaking or smth
2026-01-21 19:34:44 +01:00
Alug 186421fe85 cmake: link with peethread 2026-01-21 19:23:36 +01:00
Alug af952870c3 fix fbo oopsie 2026-01-21 19:22:40 +01:00
Alug 4eeb0b4b20 update readme to reflect this 2026-01-21 19:16:05 +01:00
Alug cb2c65e9d9 more cmake fixups
- skip asset install for linux
- pass fwrapv flag
- fix asset hash stuff
- pass rdynamic flag
- add saturn specific stuff, saturnpak, saturnjoin, libbacktrace and fix screen fbo stuff
2026-01-21 19:09:50 +01:00
cobalt2727 f7bbde3982 fix ARM builds being completely broken
If merged, this is the quickest approach to resolve https://github.com/STJr/SRB2/issues/513

...alternatively, we could just remove the option altogether but I don't have the time right now to test whether it's needed or not

To the best of my knowledge, this covers all possible amd64 `CMAKE_SYSTEM_PROCESSOR` values based on what I'm seeing at https://stackoverflow.com/questions/70475665/what-are-the-possible-values-of-cmake-system-processor
2026-01-21 18:24:53 +01:00
Alug c9fc3b4820 fixup cmake for macos
mostly based on the patch from https://github.com/Bijman/srb2bld
with some changes from https://github.com/Indev450/SRB2Kart-Saturn/pull/216
but doesent completely replace the build system with what blan has
compiles fine on nix, but needs testing on mac
2026-01-21 18:23:21 +01:00
Alug f5195dd137 Merge branch 'crashissuereports' into Saturn-Next 2026-01-20 17:32:30 +01:00
Alug 5289f13891 Show report issue button also on I_Error
also make wrapper functions for everything, to reduce code dupe
2026-01-20 17:32:22 +01:00
Alug 073b35690b dont attempt to show sdl message box on non dedicated builds running as dedicated 2026-01-20 17:32:19 +01:00
Alug 43d3ac102d HWR_RenderPlane: cleanup code that does nothing 2026-01-20 15:42:37 +01:00
Alug aa96f9ceb3 V_DrawVhsEffect: fix scaling with highreshudscale, fix downwards bar going out of screen bounds
this shouldnt account for highreshudscale at all
on very high resolutions the bars are still only half size, but atleast they dont become minuscule or just dont draw at all
also ensures both bars are clamped, on some resolutions sometimes they just go out of visible screen range
2026-01-20 14:57:18 +01:00
Alug 104b8260fb add reducevfx to accesability menu
If there are things that should be handled by that toggle def feel free to suggest them!
2026-01-19 14:35:10 +01:00
Alug edebc728ef remove unused stuff from joyinfo 2026-01-18 19:00:05 +01:00
Alug 08e7ce3b5b m_menu: clean up the skin display stuff a little 2026-01-16 13:27:20 +01:00
Alug 29f187b751 fix some windoze specific "-Wzero-as-null-pointer-constant" warnings 2026-01-16 12:53:34 +01:00
indev ac3a1ad5eb Add gcc 13.3 into list of supported versions 2026-01-16 12:02:21 +03:00
indev 1b8d7b1541 I_Error when dedi tries to go to main error
This will not fix the issue entirely but will at least prevent server
getting stuck and backtrace will show where did it try to go into menu from
2026-01-16 11:11:36 +03:00
Alug b812d61da2 Merge branch 'crashissuereports' into Saturn-Next 2026-01-14 12:58:44 +01:00
indev 6fd64383d3 This isn't ceepeepee rn :SmolBuncle: 2026-01-12 22:33:30 +03:00
Alug e984e7a6c8 Merge branch 'menumodels' into Saturn-Next 2026-01-12 19:13:21 +01:00
Alug 96f90ff9c4 push back models even further
bigger models still had parts being culled, hope this is generous enough idk
2026-01-12 19:13:17 +01:00
Alug 51aec0e012 Merge branch 'menumodels' into Saturn-Next 2026-01-12 18:40:38 +01:00
Alug faadd3e89f support the uhhh localskin setup with 3d models 2026-01-12 18:40:00 +01:00
Alug 0c091256f4 tiny cleanup + warning fix 2026-01-12 18:30:11 +01:00
indev 7a0fb01626 Make glOrtho remap coordinates to vid.width and vid.height, this makes calculating coordinates in HWR_Draw2DModel easier 2026-01-12 18:30:08 +01:00
Alug c01818e2e3 simplify skinnum bounds check
lul
2026-01-12 18:30:06 +01:00
Alug e17a8a505c fix the culling issues
i hope this is right.......
2026-01-12 18:30:03 +01:00
indev ab654deba7 Make HWR_Draw2DModel not depend on resolution, make 3d skin select use skinselectspin cvar 2026-01-12 18:29:58 +01:00
Alug b145d7fd0e WIP: show 3d models in player setup
this is incredibly ugly and hacked together
theres some weird culling issues and shit doesent really "scale" with different resolutions which needs to be fixed
but it kinda works
2026-01-12 18:29:55 +01:00
Alug 264c9e38ad d_netfil: dont use zone memory in CURLGetFile 2026-01-11 19:46:46 +01:00
indev e88773da4e How did i miss the = 2026-01-11 13:08:23 +03:00
indev 310f67a06c Fix smol mistake in strcasestr 2026-01-11 03:49:07 +03:00
indev 0914d5b8e2 -Wzero-as-null-pointer-constant is valid for c only since GCC 15.2 (from what i see) 2026-01-11 00:49:48 +03:00
Alug 291a4dbb25 disable midnight channel border flicker with "reducevfx" 2026-01-09 13:01:30 +01:00
Alug 8fe3d13935 fix InitColorLUT 2026-01-09 11:08:22 +01:00
Alug bdc326b14e leveltime be tic_t
:chaosleep:
2026-01-08 00:43:43 +01:00
Alug d938e38ad3 Acessability: add basic "reducevfx" toggle to disable/reduce certain effects
toggles certain effects, which may be troublesome to some players

-disabled hyudoro flashing, instead makes player translucent
- Makes rainbow colour effects, such as invul, change colours very slowly
- Disables underwater and heatwave screen effects
- Disables palette flashing
- Disables vhs effect

not the most pretty implementation, but im lazy and this works

feel free to suggest more things
2026-01-08 00:40:24 +01:00
Alug 3d4772455b K_SpawnSparkleTrail: check for blend effect apply outside the loop
tiny optimization
2026-01-08 00:40:24 +01:00
Alug e1f0089627 enable "Wzero-as-null-pointer-constant", fix cases of it
prevent ambiguity
shoutout blankart for making me aware this exists
2026-01-08 00:40:24 +01:00
Alug edbebbf082 fix wrong type for K_DriftSparkColor
all the colour stuff is still a bit of a mess, but generally its handled as an uint8
2026-01-02 18:34:13 +01:00
Alug 242dee499d initialize more globals that have been missed 2026-01-02 18:34:10 +01:00
Alug a2de1e24c5 d_cliserv: fix casts from nan to int type
in few cases the files totalsize might be 0, which results in a nan, casting that to int type is undefined behavior
2025-12-28 17:46:44 +01:00
Alug c0cce90e60 properly handle getcwd error in IdentifyVersion
if getcwd fails, the buffer contents will be undefined
so we shall just overwrite it again with "."
2025-12-27 15:34:26 +01:00
Alug 67e74b5874 fix w_wad oopsie 2025-12-27 15:13:20 +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 f38ca9aa28 Signal Handler: Add button to report issues to github
mostly based on what srb2 does with some stuff from srb2-legacy
the button will attempt to open the issue page on the saturn git when a crash occurs
2025-12-27 12:41:41 +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
154 changed files with 3733 additions and 5425 deletions

No files matched your search

+38 -29
View File
@@ -1,14 +1,46 @@
cmake_minimum_required(VERSION 3.5)
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
# Version change is fine.
project(SRB2
VERSION 1.6
LANGUAGES C)
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
endif()
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
# Version change is fine.
project(SRB2
VERSION 1.6
LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_EXTENSIONS OFF) # optional but recommended: disables GNU extensions, forces pure ISO C++
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_C_EXTENSIONS ON)
##### PACKAGE CONFIGURATION #####
set(SRB2_CPACK_GENERATOR "" CACHE STRING "Generator to use for making a package. E.g., ZIP, TGZ, DragNDrop (OSX only). Leave blank for default generator.")
if("${SRB2_CPACK_GENERATOR}" STREQUAL "")
if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(SRB2_CPACK_GENERATOR "ZIP")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(SRB2_CPACK_GENERATOR "TGZ")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(SRB2_CPACK_GENERATOR "TGZ")
endif()
endif()
set(CPACK_GENERATOR ${SRB2_CPACK_GENERATOR})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2 Kart" CACHE STRING "Program name for display purposes")
set(CPACK_PACKAGE_VENDOR "Kart Krew" CACHE STRING "Vendor name for display purposes")
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
include(CPack)
# Set up CMAKE path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
@@ -73,6 +105,7 @@ endif()
# OS macros
if (UNIX)
add_definitions(-DUNIXCOMMON)
add_link_options(-rdynamic) # Use -rdynamic so a backtrace log shows function names
endif()
if(CMAKE_COMPILER_IS_GNUCC)
@@ -95,14 +128,12 @@ set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# Set EXE names so the assets CMakeLists can refer to its target
set(SRB2_SDL2_EXE_NAME srb2kart CACHE STRING "Executable binary output name")
set(SRB2_WIN_EXE_NAME srb2kartdd CACHE STRING "Executable binary output name for DirectDraw build")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
add_subdirectory(src)
add_subdirectory(assets)
## config.h generation
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
include(GitUtilities)
@@ -111,25 +142,3 @@ git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
##### PACKAGE CONFIGURATION #####
if(${CMAKE_SYSTEM} MATCHES "Windows")
set(CPACK_GENERATOR "ZIP")
endif()
if(${CMAKE_SYSTEM} MATCHES "Linux")
set(CPACK_GENERATOR "TGZ")
endif()
if(${CMAKE_SYSTEM} MATCHES "Darwin")
set(CPACK_GENERATOR "DragNDrop")
endif()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2 Kart" CACHE STRING "Program name for display purposes")
set(CPACK_PACKAGE_VENDOR "Kart Krew" CACHE STRING "Vendor name for display purposes")
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
include(CPack)
+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.
## 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).
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 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.
## 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
Same fields as in SRB2 2.2
+3 -3
View File
@@ -22,14 +22,14 @@ We also have a Flatpak available on [Flathub](https://flathub.org/en/apps/org.sr
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2.
Currently only the Makefile build system with GCC or Clang compiler is supported.
CMake is NOT supported at the moment, but will be availible again soon.
For Windows only the Makefile build system with GCC or Clang compiler is supported.
Visual C++ (MSVC) is unsupported.
64-bit Windows builds are supported and recommended over 32-bit builds, they will build automatically when using the MSYS2 MinGW 64-bit executable (requires the mingw-w64-x86_64-gcc package), no extra flags needed!
The specific DLLs can be found under /libs/dll-binaries/(i686 for 32bit/x86_64 for 64-bit)/ or in the Release packages
MacOS and Linux can be build with CMake, but it is recommended to use the Makefile for Linux over CMake
Alternatively the [srb2bld](https://github.com/Bijman/srb2bld) script by Bijman can be used aswell!
## Disclaimer
+5
View File
@@ -1,5 +1,10 @@
## Assets Target Configuration ##
if(${CMAKE_SYSTEM} MATCHES Linux)
# Asset installation isn't part of the Linux target
return()
endif()
# For prepending the current source path, later
FUNCTION(PREPEND var prefix)
SET(listVar "")
+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.
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
Copyright (c) 1995-2013 by Michael Hipp and others,
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
applies to:
- Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
https://libsdl.org/
Copyright (C) 1997-2018 Sam Lantinga <slouken@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
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()
+3 -2
View File
@@ -1,6 +1,6 @@
include(LibFindMacros)
libfind_pkg_check_modules(GME_PKGCONF GME)
libfind_pkg_check_modules(GME_PKGCONF LIBGME)
find_path(GME_INCLUDE_DIR
NAMES gme.h
@@ -8,6 +8,7 @@ find_path(GME_INCLUDE_DIR
${GME_PKGCONF_INCLUDE_DIRS}
"/usr/include/gme"
"/usr/local/include/gme"
PATH_SUFFIXES gme
)
find_library(GME_LIBRARY
@@ -20,4 +21,4 @@ find_library(GME_LIBRARY
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
set(GME_PROCESS_LIBS GME_LIBRARY)
libfind_process(GME)
libfind_process(GME)
+3 -2
View File
@@ -1,6 +1,6 @@
include(LibFindMacros)
libfind_pkg_check_modules(OPENMPT_PKGCONF OPENMPT)
libfind_pkg_check_modules(OPENMPT_PKGCONF LIBOPENMPT)
find_path(OPENMPT_INCLUDE_DIR
NAMES libopenmpt.h
@@ -8,6 +8,7 @@ find_path(OPENMPT_INCLUDE_DIR
${OPENMPT_PKGCONF_INCLUDE_DIRS}
"/usr/include/libopenmpt"
"/usr/local/include/libopenmpt"
PATH_SUFFIXES libopenmpt
)
find_library(OPENMPT_LIBRARY
@@ -20,4 +21,4 @@ find_library(OPENMPT_LIBRARY
set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR)
set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY)
libfind_process(OPENMPT)
libfind_process(OPENMPT)
+33
View File
@@ -0,0 +1,33 @@
include(LibFindMacros)
libfind_pkg_check_modules(LIBBACKTRACE_PKGCONF LIBBACKTRACE)
find_path(LIBBACKTRACE_INCLUDE_DIR
NAMES backtrace.h
PATHS
${LIBBACKTRACE_PKGCONF_INCLUDE_DIRS}
"/usr/include"
"/usr/local/include"
)
find_library(LIBBACKTRACE_LIBRARY
NAMES backtrace
PATHS
${LIBBACKTRACE_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
set(LIBBACKTRACE_PROCESS_INCLUDES LIBBACKTRACE_INCLUDE_DIR)
set(LIBBACKTRACE_PROCESS_LIBS LIBBACKTRACE_LIBRARY)
libfind_process(LIBBACKTRACE)
if(LIBBACKTRACE_FOUND AND NOT TARGET libbacktrace)
add_library(libbacktrace UNKNOWN IMPORTED)
set_target_properties(
libbacktrace
PROPERTIES
IMPORTED_LOCATION "${LIBBACKTRACE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBBACKTRACE_INCLUDE_DIR}"
)
endif()
+37 -18
View File
@@ -1,4 +1,4 @@
# Version 2.2
# Version 2.4
# Public Domain, originally written by Lasse Kärkkäinen <tronic>
# Maintained at https://github.com/Tronic/cmake-modules
# Please send your improvements as pull requests on Github.
@@ -52,6 +52,10 @@ function (libfind_pkg_detect PREFIX)
if (libraryargs)
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
endif()
# Read pkg-config version
if (${PREFIX}_PKGCONF_VERSION)
set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE)
endif()
endfunction()
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
@@ -125,24 +129,39 @@ function (libfind_process PREFIX)
# Process deps to add to
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
if (DEFINED ${i}_INCLUDE_OPTS)
# The package seems to export option lists that we can use, woohoo!
list(APPEND includeopts ${${i}_INCLUDE_OPTS})
else()
if (DEFINED ${i}_INCLUDE_DIR)
# Singular forms can be used
list(APPEND includeopts ${i}_INCLUDE_DIR)
else()
if (DEFINED ${i}_INCLUDE_DIRS)
# Plural forms can be used
list(APPEND includeopts ${i}_INCLUDE_DIRS)
else()
# Oh no, we don't know the option names
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes. Aieeh!")
endif()
endif()
endif()
if (DEFINED ${i}_LIBRARY_OPTS)
# The package seems to export option lists that we can use, woohoo!
list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
else()
# If plural forms don't exist or they equal singular forms
if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
({i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
if (DEFINED ${i}_LIBRARY)
# Singular forms can be used
if (DEFINED ${i}_INCLUDE_DIR)
list(APPEND includeopts ${i}_INCLUDE_DIR)
endif()
if (DEFINED ${i}_LIBRARY)
list(APPEND libraryopts ${i}_LIBRARY)
endif()
list(APPEND libraryopts ${i}_LIBRARY)
else()
# Oh no, we don't know the option names
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
if (DEFINED ${i}_LIBRARIES)
# Plural forms can be used
list(APPEND libraryopts ${i}_LIBRARIES)
else()
# Oh no, we don't know the option names
message(FATAL_ERROR "We couldn't determine config variable names for ${i} libraries. Aieeh!")
endif()
endif()
endif()
endforeach()
@@ -209,12 +228,12 @@ function (libfind_process PREFIX)
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
endif()
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
endif()
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
return()
endif()
+1
View File
@@ -1,3 +1,4 @@
/cscope.out
*.json
*.idx
*.gdb_history
+88 -31
View File
@@ -2,6 +2,8 @@
# Core sources
set(SRB2_CORE_SOURCES
core/memory.cpp
core/thread_pool.cpp
am_map.c
b_bot.c
command.c
@@ -18,17 +20,21 @@ set(SRB2_CORE_SOURCES
f_wipe.c
filesrch.c
g_game.c
g_demo.c
g_input.c
hu_stuff.c
i_tcp.c
info.c
k_hud.c
lzf.c
m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
m_cheat.c
m_curl.c
m_cond.c
m_emotes.cpp
m_fixed.c
m_menu.c
m_textinput.c
@@ -40,19 +46,25 @@ set(SRB2_CORE_SOURCES
mserv.c
http-mserv.c
qs22j.c
r_skins.c
s_sound.c
screen.c
sounds.c
st_stuff.c
#string.c
string.c
tables.c
v_video.c
w_wad.c
y_inter.c
z_zone.c
z_zone.cpp
)
set(SRB2_CORE_HEADERS
core/memory.h
core/thread_pool.h
m_curl.h
m_emotes.h
k_hud.h
am_map.h
b_bot.h
byteptr.h
@@ -78,6 +90,7 @@ set(SRB2_CORE_HEADERS
fastcmp.h
filesrch.h
g_game.h
g_demo.h
g_input.h
g_state.h
hu_stuff.h
@@ -109,6 +122,7 @@ set(SRB2_CORE_HEADERS
md5.h
mserv.h
qs22j.h
r_skins.h
s_sound.h
screen.h
sounds.h
@@ -123,18 +137,18 @@ set(SRB2_CORE_HEADERS
)
set(SRB2_CORE_RENDER_SOURCES
r_bsp.c
r_bsp.cpp
r_data.c
r_draw.c
r_fps.c
r_main.c
r_patch.c
r_patchrotation.c
r_plane.c
r_segs.c
r_draw.cpp
r_fps.cpp
r_main.cpp
r_patch.cpp
r_patchrotation.cpp
r_plane.cpp
r_segs.cpp
r_sky.c
r_splats.c
r_things.c
r_things.cpp
r_portal.c
r_bsp.h
@@ -162,7 +176,7 @@ set(SRB2_CORE_GAME_SOURCES
p_inter.c
p_lights.c
p_map.c
p_maputl.c
p_maputl.cpp
p_mobj.c
p_polyobj.c
p_saveg.c
@@ -177,6 +191,7 @@ set(SRB2_CORE_GAME_SOURCES
k_kart.c
k_stats.c
i_time.c
i_threads.c
p_local.h
p_maputl.h
@@ -193,10 +208,6 @@ set(SRB2_CORE_GAME_SOURCES
k_stats.h
)
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif()
prepend_sources(SRB2_CORE_SOURCES)
prepend_sources(SRB2_CORE_HEADERS)
prepend_sources(SRB2_CORE_RENDER_SOURCES)
@@ -226,10 +237,23 @@ set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
"Enable hardware rendering through OpenGL.")
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
"Use statically linked OpenGL. NOT RECOMMENDED.")
set(SRB2_CONFIG_USE_FBO_OGL ON CACHE BOOL
"Enable OpenGL FBO Downsampling support.")
set(SRB2_CONFIG_DEDICATED OFF CACHE BOOL
"Build a dedicated server.")
set(SRB2_CONFIG_LIBBACKTRACE ON CACHE BOOL
"Enable using libbacktrace for crashlogs.")
set(SRB2_CONFIG_LTO ON CACHE BOOL
"Enable link time optimizations, improves performance at the cost of longer link times.")
set(SRB2_CONFIG_ASAN OFF CACHE BOOL
"Compile with AddressSanitizer (libasan).")
set(SRB2_CONFIG_UBSAN OFF CACHE BOOL
"Compile with UndefinedBehaviorSanitizer (libubsan).")
set(SRB2_CONFIG_SATURNPAK ON CACHE BOOL
"Enable Saturn specific special packet. Required for using the newer resynch system")
set(SRB2_CONFIG_SATURNJOIN ON CACHE BOOL
"Enable Saturn specific allowjoin toggle.")
set(SRB2_CONFIG_SCREENFBO ON CACHE BOOL
"Enable hardware renderer (OpenGL) FBO downsampling support")
if(${SRB2_CONFIG_DEDICATED})
set(SRB2_CONFIG_HAVE_GME NO)
@@ -469,16 +493,36 @@ if(${SRB2_CONFIG_HAVE_CURL})
endif()
endif()
if(${SRB2_CONFIG_LIBBACKTRACE})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(LIBBACKTRACE_FOUND ON)
set(LIBBACKTRACE_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libbacktrace/include)
set(LIBBACKTRACE_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libbacktrace/lib/x86_64 -lbacktrace")
else() # 32-bit
message(WARNING "libbacktrace is unsupported on 32-bit builds.")
endif()
else()
find_package(libbacktrace)
endif()
if(${LIBBACKTRACE_FOUND})
set(SRB2_HAVE_LIBBACKTRACE ON)
add_definitions(-DHAVE_LIBBACKTRACE)
else()
message(WARNING "You have specified that libbacktrace is available but it was not found.")
endif()
endif()
if(${SRB2_CONFIG_HWRENDER})
add_definitions(-DHWRENDER)
set(SRB2_HWRENDER_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_shaders.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
@@ -493,7 +537,6 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gl.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
@@ -512,7 +555,6 @@ if(${SRB2_CONFIG_HWRENDER})
set(SRB2_R_OPENGL_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
)
endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
@@ -525,25 +567,40 @@ if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
endif()
endif()
if(${SRB2_CONFIG_HWRENDER})
if(${SRB2_CONFIG_USE_FBO_OGL})
set(SRB2_USE_FBO_OGL ON)
add_definitions(-DUSE_FBO_OGL)
endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_SCREENFBO})
add_definitions(-DUSE_FBO_OGL)
endif()
if(${SRB2_CONFIG_SATURNPAK})
add_definitions(-DDOSATURNPAK)
endif()
if(${SRB2_CONFIG_SATURNJOIN})
add_definitions(-DDOSATURNJOIN)
endif()
# Targets
# Compatibility flag with later versions of GCC
# We should really fix our code to not need this
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64|em64t|EM64T)")
add_compile_options(-mno-ms-bitfields)
endif()
add_compile_options(-Wno-trigraphs)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
# TODO: fix prng and P_CreateBlockmap overflow at some point
add_compile_options(-fwrapv)
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
add_compile_options(-O0)
else()
add_compile_options(-O3)
endif()
add_compile_options(-g)
add_definitions(-DCMAKECONFIG)
#add_library(SRB2Core STATIC
-5
View File
@@ -8,11 +8,6 @@ ifdef MINGW
libs+=-mconsole
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=dedicated/i_threads.c
endif
NOOPENMPT=1
NOLIBGME=1
NOHW=1
+3 -3
View File
@@ -64,9 +64,9 @@ endif
# This must have high to low order.
gcc_versions:=\
151 150 15\
152 151 150 15\
142 141 140 14\
132 131 130 13\
133 132 131 130 13\
123 122 121 120 12\
114 113 112 111 110 11\
105 104 103 102 101 100 10\
@@ -77,7 +77,7 @@ gcc_versions:=\
55 54 53 52 51 50\
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
# manually set. And don't bother if this is a clean only
+6 -1
View File
@@ -8,7 +8,6 @@ passthru_opts+=\
HAVE_MINIUPNPC\
HAVE_DISCORDRPC DEVELOP\
NOHOLEPUNCH\
NOOPENMPT\
# build with debugging information
ifdef DEBUGMODE
@@ -28,6 +27,11 @@ endif
sources+=$(call List,hardware/Sourcefile)
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=i_threads.c
endif
ifndef NOMD5
sources+=md5.c
endif
@@ -92,6 +96,7 @@ endif
default_packages:=\
LIBGME/libgme/LIBGME\
OPENMPT/libopenmpt/LIBOPENMPT\
ZLIB/zlib\
$(foreach p,$(default_packages),\
+9 -18
View File
@@ -29,19 +29,8 @@ ifndef NOHW
sources+=sdl/ogl_sdl.c
endif
ifndef NOOPENMPT
LIBOPENMPT_PKGCONFIG?=libopenmpt
$(eval $(call Use_pkg_config,LIBOPENMPT))
opts+=-DHAVE_OPENMPT
endif
NOMIXER=1
ifdef NOMIXER
#sources+=sdl/dummy_sound.c
sources+=sdl/sdl_sound.c
SNDFILE_PKGCONFIG?=sndfile
$(eval $(call Use_pkg_config,SNDFILE))
sources+=sdl/dummy_sound.c
else
opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c
@@ -51,13 +40,15 @@ sources+=sdl/mixer_sound.c
endif
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
SDL_PKGCONFIG?=sdl3
ifdef SDL_PKGCONFIG
$(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
ifndef NOSDLMAIN
+4 -1
View File
@@ -20,7 +20,10 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
CXXFLAGS+= -Wno-aggregate-return
# -W -Wno-unused
WFLAGS:=-Wall -Wno-trigraphs
WFLAGS:=-Wall -Wno-trigraphs -Wnull-dereference
ifdef GCC152
WFLAGS+=-Wzero-as-null-pointer-constant
endif
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
+3 -3
View File
@@ -79,14 +79,14 @@ $(eval $(call _set,LIBOPENMPT))
lib:=../libs/SDL2_mixer/$(mingw)
ifdef SDL
mixer_opts:=-I$(lib)/include/SDL3
mixer_opts:=-I$(lib)/include/SDL2
mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL3\
SDL_opts:=-I$(lib)/include/SDL2\
$(mixer_opts) -Dmain=SDL_main
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL3main -lSDL3 -mwindows
-lmingw32 -lSDL2main -lSDL2 -mwindows
$(eval $(call _set,SDL))
endif
+1 -1
View File
@@ -1,3 +1,4 @@
string.c
am_map.c
b_bot.c
command.c
@@ -42,7 +43,6 @@ s_sound.c
screen.c
sounds.c
st_stuff.c
string.c
tables.c
v_video.c
w_wad.c
-4
View File
@@ -226,10 +226,6 @@ const char *I_LocateWad(void)
return "/sdcard/srb2";
}
void I_GetJoystickEvents(void){}
void I_GetJoystick2Events(void){}
char *I_GetEnv(const char *name)
{
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))
{
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)
cmd->angleturn = -cmd->angleturn;
} 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.
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
if (forward)
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove -= MAXPLMOVE<<FRACBITS >> TICCMD_REDUCE;
if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (right || straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
} else {
// 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)
@@ -163,23 +163,23 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
right = true;
}
if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (right || straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
}
} else {
if (forward)
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (left)
cmd->angleturn += 1280;
if (right)
cmd->angleturn -= 1280;
if (strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
}
if (jump)
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,
const char *const lst[]) {
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,
const char *const lst[]);
LUALIB_API int (luaL_resourcetryagain) (lua_State *L);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
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))
@@ -165,6 +159,24 @@ static int StartsWith(const char *a, const char *b) // this is wolfs being lazy
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)
{
@@ -212,7 +224,7 @@ static int io_open(lua_State *L)
}
pf = newfile(L);
*pf = fopen(destFilename, mode);
*pf = trytoopen(L, destFilename, mode);
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) {
FILE **pf = newfile(L);
*pf = tmpfile();
if (*pf == NULL && luaL_resourcetryagain(L)) /* resource failure? */
*pf = tmpfile(); /* try to open again */
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)) {
const char *filename = lua_tostring(L, 1);
if (filename) {
FILE **pf = newfile(L);
*pf = fopen(filename, mode);
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
opencheck(L, filename, mode);
}
else {
tofile(L); /* check that it's a valid file handle */
@@ -290,10 +301,7 @@ static int io_lines (lua_State *L) {
}
else {
const char *filename = luaL_checkstring(L, 1);
FILE **pf = newfile(L);
*pf = fopen(filename, "r");
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
opencheck(L, filename, "r");
aux_lines(L, lua_gettop(L), 1);
return 1;
}
+1 -1
View File
@@ -527,7 +527,7 @@ static int str_find_aux (lua_State *L, int find) {
if (find) {
lua_pushinteger(L, s1-s+1); /* start */
lua_pushinteger(L, res-s); /* end */
return push_captures(&ms, NULL, 0) + 2;
return push_captures(&ms, NULL, NULL) + 2;
}
else
return push_captures(&ms, s1, res);
+3 -3
View File
@@ -772,10 +772,10 @@ union luai_Cast { double l_d; long l_l; };
#include <stdio.h>
#if defined(__GNUC__)
#define l_likely(x) (__builtin_expect(((x) != 0), 1))
#define l_unlikely(x) (__builtin_expect(((x) != 0), 0))
#define l_likely(x) (__builtin_expect(!!(x), 1))
#define l_unlikely(x) (__builtin_expect(!!(x), 0))
#else
#define l_likely(x) (x)
#define l_likely(x) (x)
#define l_unlikely(x) (x)
#endif
+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);
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)
{
@@ -676,7 +676,7 @@ static void COM_Alias_f(void)
/* Display alias subtext, show all aliases. */
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);
}
+3 -3
View File
@@ -13,13 +13,13 @@
#ifndef __COMMAND_H__
#define __COMMAND_H__
#include <stdio.h>
#include "doomdef.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "doomdef.h"
//===================================
// Command buffer & command execution
//===================================
+3 -38
View File
@@ -11,21 +11,6 @@
#ifdef CMAKECONFIG
// Base SRB2 hashes
#define ASSET_HASH_SRB2_SRB "${SRB2_ASSET_srb2.srb_HASH}"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}"
#endif
// SRB2Kart-specific hashes
#define ASSET_HASH_GFX_KART "${SRB2_ASSET_gfx.kart_HASH}"
#define ASSET_HASH_TEXTURES_KART "${SRB2_ASSET_textures.kart_HASH}"
#define ASSET_HASH_CHARS_KART "${SRB2_ASSET_chars.kart_HASH}"
#define ASSET_HASH_MAPS_KART "${SRB2_ASSET_maps.kart_HASH}"
#ifdef USE_PATCH_KART
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
#endif
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
@@ -33,30 +18,10 @@
#else
/* Manually defined asset hashes for non-CMake builds
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
* Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
* Last updated 2020 / 08 / 30 - Kart v1.3 - patch.kart
* Last updated 2022 / 08 / 16 - Kart v1.4 - Main assets
* Last updated 2022 / 08 / 19 - Kart v1.5 - gfx.kart
* Last updated 2022 / 11 / 01 - Kart v1.6 - gfx.kart, maps.kart
*/
#define SRB2_COMP_REVISION ""
#define SRB2_COMP_BRANCH ""
// Base SRB2 hashes
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4"
#endif
// SRB2Kart-specific hashes
#define ASSET_HASH_GFX_KART "06f86ee16136eb8a7043b15001797034"
#define ASSET_HASH_TEXTURES_KART "abb53d56aba47c3a8cb0f764da1c8b80"
#define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964"
#define ASSET_HASH_MAPS_KART "d051e55141ba736582228c456953cd98"
#ifdef USE_PATCH_KART
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
#endif
#define CMAKE_ASSETS_DIR ""
#endif
#endif
+15 -7
View File
@@ -44,14 +44,14 @@
#define MAXHUDLINES 20
#ifdef HAVE_THREADS
I_mutex con_mutex;
I_Mutex con_mutex;
// g_in_exiting_signal_handler is an evil hack
// to avoid infinite SIGABRT recursion in the signal handler
// due to poisoned locks or mach-o kernel not supporting locks in signals
// or something like that. idk
# define Lock_state() if (!g_in_exiting_signal_handler) { I_lock_mutex(&con_mutex); }
# define Unlock_state() if (!g_in_exiting_signal_handler) { I_unlock_mutex(con_mutex); }
# define Lock_state() if (!g_in_exiting_signal_handler) { I_LockMutex(&con_mutex); }
# define Unlock_state() if (!g_in_exiting_signal_handler) { I_UnlockMutex(con_mutex); }
#else/*HAVE_THREADS*/
# define Lock_state()
# define Unlock_state()
@@ -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_consoleprintinmenu = {"consoleprintinmenu", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void CON_Print(char *msg);
//
@@ -426,6 +428,7 @@ void CON_Init(void)
CV_RegisterVar(&cons_backpic);
CV_RegisterVar(&cons_backcolor);
CV_RegisterVar(&cons_menuhighlight);
CV_RegisterVar(&cons_consoleprintinmenu);
COM_AddCommand("bind", CONS_Bind_f);
}
else
@@ -586,12 +589,18 @@ static void CON_ChangeHeight(void)
// Handles Console moves in/out of screen (per frame)
//
static void CON_MoveConsole(void)
void CON_MoveConsole(void)
{
static fixed_t fracmovement = 0;
Lock_state();
if (con_curlines == con_destlines)
{
Unlock_state();
return;
}
// instant
if (!cons_speed.value)
{
@@ -1584,13 +1593,12 @@ void CON_Drawer(void)
}
// console movement
if (con_curlines != con_destlines)
CON_MoveConsole();
CON_MoveConsole();
if (con_curlines > 0)
CON_DrawConsole();
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();
Unlock_state();
+3 -1
View File
@@ -22,7 +22,7 @@ void CON_Init(void);
boolean CON_Responder(event_t *ev);
#ifdef HAVE_THREADS
extern I_mutex con_mutex;
extern I_Mutex con_mutex;
#endif
// set true when screen size has changed, to adapt console
@@ -36,6 +36,7 @@ extern INT32 con_destlines;
extern UINT32 con_scalefactor; // console text scale factor
extern consvar_t cons_backcolor, cons_menuhighlight;
extern consvar_t cons_consoleprintinmenu;
extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\
*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_Drawer(void);
void CON_MoveConsole(void);
void CONS_Error(const char *msg); // print out error msg, and wait a key
// force console to move out
+81 -92
View File
@@ -332,7 +332,7 @@ void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(const UINT8 **p, INT32 playernu
#ifdef PARANOIA
if (id >= MAXNETXCMD)
I_Error("Command id %d too big", id);
if (listnetxcmd[id] != 0)
if (listnetxcmd[id] != NULL)
I_Error("Command id %d already used", id);
#endif
listnetxcmd[id] = cmd_f;
@@ -365,7 +365,7 @@ void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_
CONS_Alert(CONS_NOTICE, M_GetText("NetXCmd buffer full, delaying netcmd %d... (size: %d, needed: %s)\n"), id, localtextcmd[playerid][0], sizeu1(nparam));
if (buf == NULL)
{
textcmdbuf[playerid] = Z_Malloc(sizeof(textcmdbuf_t), PU_STATIC, NULL);
textcmdbuf[playerid] = (textcmdbuf_t*)Z_Malloc(sizeof(textcmdbuf_t), PU_STATIC, NULL);
textcmdbuf[playerid]->cmd[0] = 0;
textcmdbuf[playerid]->next = NULL;
WriteNetXCmd(textcmdbuf[playerid]->cmd, id, param, nparam);
@@ -377,7 +377,7 @@ void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_
if (buf->cmd[0]+2+nparam > MAXTEXTCMD)
{
buf->next = Z_Malloc(sizeof(textcmdbuf_t), PU_STATIC, NULL);
buf->next = (textcmdbuf_t*)Z_Malloc(sizeof(textcmdbuf_t), PU_STATIC, NULL);
buf->next->cmd[0] = 0;
buf->next->next = NULL;
WriteNetXCmd(buf->next->cmd, id, param, nparam);
@@ -454,13 +454,13 @@ static UINT8* D_GetTextcmd(tic_t tic, INT32 playernum)
// If we don't have an entry for the tic, make it.
if (!textcmdtic)
{
textcmdtic = *tctprev = Z_Calloc(sizeof (textcmdtic_t), PU_STATIC, NULL);
textcmdtic = *tctprev = (textcmdtic_t*)Z_Calloc(sizeof (textcmdtic_t), PU_STATIC, NULL);
textcmdtic->tic = tic;
}
// If we don't have an entry for the player, make it.
if (!textcmdtic->playercmds[playernum])
textcmdtic->playercmds[playernum] = Z_Calloc(MAXTEXTCMD, PU_STATIC, NULL);
textcmdtic->playercmds[playernum] = (UINT8*)Z_Calloc(MAXTEXTCMD, PU_STATIC, NULL);
return textcmdtic->playercmds[playernum];
}
@@ -1141,7 +1141,7 @@ typedef enum
static void GetPackets(void);
static cl_mode_t cl_mode = CL_SEARCHING;
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
// Player name send/load
@@ -1182,7 +1182,7 @@ static void CV_LoadPlayerNames(UINT8 **p)
//
// Keep the local client informed of our status.
//
static inline void CL_DrawConnectionStatus(void)
static void CL_DrawConnectionStatus(void)
{
INT32 ccstime = I_GetTime();
@@ -1217,24 +1217,26 @@ static inline void CL_DrawConnectionStatus(void)
case CL_DOWNLOADSAVEGAME:
if (filedownload.current != -1)
{
UINT32 currentsize = fileneeded[filedownload.current].currentsize;
UINT32 totalsize = fileneeded[filedownload.current].totalsize;
INT32 dldlength;
INT32 dldlength = 0;
fileneeded_t *file = &fileneeded[filedownload.current];
UINT32 currentsize = file->currentsize;
UINT32 totalsize = file->totalsize;
cltext = M_GetText("Downloading game state...");
Net_GetNetStat();
dldlength = (INT32)((currentsize/(double)totalsize) * 256);
if (totalsize != 0)
dldlength = (INT32)((currentsize/(double)totalsize) * 256);
if (dldlength > 256)
dldlength = 256;
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 111);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 96);
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %4uK/%4uK",currentsize>>10,totalsize>>10));
va(" %4uK/%4uK", currentsize>>10, totalsize>>10));
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va("%3.1fK/s ", ((double)getbps)/1024));
va("%3.1fK/s ", ((double)getbps)/1024.0));
}
else
cltext = M_GetText("Waiting to download game state...");
@@ -1270,29 +1272,30 @@ static inline void CL_DrawConnectionStatus(void)
{
if (cl_mode == CL_CHECKFILES)
{
INT32 totalfileslength;
INT32 totalfileslength = 0;
INT32 checkednum = 0;
INT32 i;
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
//ima just count files here
// ima just count files here
for (i = 0; i < fileneedednum; i++)
if (fileneeded[i].status != FS_NOTCHECKED)
checkednum++;
// Loading progress
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, "Checking server addons...");
totalfileslength = (INT32)((checkednum/(double)(fileneedednum)) * 256);
if (fileneedednum != 0)
totalfileslength = (INT32)((checkednum/(double)fileneedednum) * 256);
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
va(" %2u/%2u Files",checkednum,fileneedednum));
va(" %2u/%2u Files", checkednum, fileneedednum));
}
else if (cl_mode == CL_LOADFILES)
{
INT32 totalfileslength;
INT32 totalfileslength = 0;
INT32 loadcompletednum = 0;
INT32 i;
@@ -1305,12 +1308,13 @@ static inline void CL_DrawConnectionStatus(void)
// Loading progress
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, "Loading server addons...");
totalfileslength = (INT32)((loadcompletednum/(double)(fileneedednum)) * 256);
if (fileneedednum != 0)
totalfileslength = (INT32)((loadcompletednum/(double)fileneedednum) * 256);
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
va(" %2u/%2u Files",loadcompletednum,fileneedednum));
va(" %2u/%2u Files", loadcompletednum, fileneedednum));
}
else if (cl_mode == CL_VIEWSERVER)
{
@@ -1438,19 +1442,22 @@ static inline void CL_DrawConnectionStatus(void)
}
else if (filedownload.current != -1)
{
INT32 dldlength;
INT32 totalfileslength;
UINT32 totaldldsize;
INT32 dldlength = 0;
INT32 totalfileslength = 0;
UINT32 totaldldsize = 0;
static char tempname[28];
fileneeded_t *file = &fileneeded[filedownload.current];
char *filename = file->filename;
UINT32 currentsize = file->currentsize;
UINT32 totalsize = file->totalsize;
// Draw the bottom box.
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-58-8, 32, 1);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-14, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
Net_GetNetStat();
dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256);
if (totalsize != 0)
dldlength = (INT32)((currentsize/(double)totalsize) * 256);
if (dldlength > 256)
dldlength = 256;
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, 256, 8, 175);
@@ -1483,29 +1490,30 @@ static inline void CL_DrawConnectionStatus(void)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP|MENUCAPS,
va(M_GetText("\"%s\""), tempname));
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE|MENUCAPS,
va(" %4uK/%4uK",file->currentsize>>10,file->totalsize>>10));
va(" %4uK/%4uK", currentsize>>10, totalsize>>10));
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE|MENUCAPS,
va("%3.1fK/s ", ((double)getbps)/1024));
va("%3.1fK/s ", ((double)getbps)/1024.0));
// Download progress
if (file->currentsize != file->totalsize)
totaldldsize = filedownload.completedsize+file->currentsize; //Add in single file progress download if applicable
if (currentsize != totalsize)
totaldldsize = filedownload.completedsize+currentsize; // Add in single file progress download if applicable
else
totaldldsize = filedownload.completedsize;
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP|MENUCAPS, "Overall Download Progress");
totalfileslength = (INT32)((totaldldsize/(double)filedownload.totalsize) * 256);
if (filedownload.totalsize != 0)
totalfileslength = (INT32)((totaldldsize/(double)filedownload.totalsize) * 256);
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
if (filedownload.totalsize>>20 >= 10) //display in MB if over 10MB
if (filedownload.totalsize>>20 >= 10) // display in MB if over 10MB
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
va(" %4uM/%4uM",totaldldsize>>20,filedownload.totalsize>>20));
va(" %4uM/%4uM", totaldldsize>>20, filedownload.totalsize>>20));
else
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
va(" %4uK/%4uK",totaldldsize>>10,filedownload.totalsize>>10));
va(" %4uK/%4uK", totaldldsize>>10, filedownload.totalsize>>10));
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
va("%2u/%2u Files ", filedownload.completednum, filedownload.totalnum));
@@ -1777,6 +1785,9 @@ static void SV_SendPlayerInfo(INT32 node)
static void SV_SendMapIcon(INT32 node)
{
if (node == 0)
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
const char *map = va("%sP", G_BuildMapName(gamemap));
@@ -1952,7 +1963,7 @@ static boolean SV_ResendingSavegameToAnyone(void)
static void SV_SendSaveGame(INT32 node, boolean resending)
{
size_t length, compressedlen;
savebuffer_t save = {0};
savebuffer_t save = {};
UINT8 *compressedsave;
UINT8 *buffertosend;
@@ -2022,7 +2033,7 @@ static consvar_t cv_dumpconsistency = {"dumpconsistency", "Off", CV_NETVAR, CV_O
static void SV_SavedGame(void)
{
size_t length;
savebuffer_t save = {0};
savebuffer_t save = {};
char tmpsave[264];
if (!cv_dumpconsistency.value)
@@ -2062,7 +2073,7 @@ static void SV_SavedGame(void)
static void CL_LoadReceivedSavegame(boolean reloading)
{
savebuffer_t save = {0};
savebuffer_t save = {};
size_t length, decompressedlen;
char tmpsave[264];
@@ -2071,6 +2082,7 @@ static void CL_LoadReceivedSavegame(boolean reloading)
length = FIL_ReadFile(tmpsave, &save.buffer);
CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length));
if (!length)
{
I_Error("Can't read savegame sent");
@@ -2154,7 +2166,7 @@ static void CL_ReloadReceivedSavegame(void)
// we dont have P_ForceLocalAngle so were setting it manually here
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++)
@@ -2193,12 +2205,8 @@ static void SendAskInfo(INT32 node)
HSendPacket(node, false, 0, sizeof (askinfo_pak));
}
serverelem_t serverlist[MAXSERVERLIST];
serverelem_t serverlist[MAXSERVERLIST] = {};
UINT32 serverlistcount = 0;
UINT32 serverlistultimatecount = 0;
static boolean resendserverlistnode[MAXNETNODES];
static tic_t serverlistepoch;
static void SL_ClearServerList(INT32 connectedserver)
{
@@ -2211,8 +2219,7 @@ static void SL_ClearServerList(INT32 connectedserver)
serverlist[i].node = 0;
}
serverlistcount = 0;
memset(resendserverlistnode, 0, sizeof resendserverlistnode);
//memset(serverlist, 0, sizeof(serverlist));
}
static UINT32 SL_SearchServer(INT32 node)
@@ -2229,8 +2236,6 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
{
UINT32 i;
resendserverlistnode[node] = false;
// search if not already on it
i = SL_SearchServer(node);
if (i == UINT32_MAX)
@@ -2264,7 +2269,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
M_SortServerList();
}
void CL_UpdateServerList (void)
void CL_UpdateServerList(void)
{
SL_ClearServerList(0);
@@ -2282,14 +2287,12 @@ void CL_UpdateServerList (void)
SendAskInfo(BROADCASTADDR);
}
void CL_QueryServerList (msg_server_t *server_list)
void CL_QueryServerList(msg_server_t *server_list)
{
INT32 i;
CL_UpdateServerList();
serverlistepoch = I_GetTime();
for (i = 0; server_list[i].header.buffer[0]; i++)
{
// Make sure MS version matches our own, to
@@ -2302,42 +2305,20 @@ void CL_QueryServerList (msg_server_t *server_list)
if (node == -1)
continue; // no more node free, or resolution failure
SendAskInfo(node);
resendserverlistnode[node] = true;
// Leave this node open. It'll be closed if the
// request times out (CL_TimeoutServerList).
}
}
serverlistultimatecount = i;
}
#define SERVERLISTRESENDRATE NEWTICRATE
void CL_TimeoutServerList(void)
{
if (netgame && serverlistultimatecount > serverlistcount)
{
const tic_t timediff = I_GetTime() - serverlistepoch;
const tic_t timetoresend = timediff % SERVERLISTRESENDRATE;
const boolean timedout = timediff > connectiontimeout;
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;
// 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).
//
// Don't worry, we'll get in contact with the working
// servers again when they send SERVERINFO to us later!
//
// (Note: as a side effect this probably means every
// server in the list will probably be using the same node (e.g. node 1),
// not that it matters which nodes they use when
// the connections are closed afterwards anyway)
// -- Monster Iestyn 12/11/18
Net_CloseConnection(node|FORCECLOSE);
}
}
}
@@ -2849,11 +2830,11 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
F_TitleScreenDrawer();
CL_DrawConnectionStatus();
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
I_LockMutex(&m_menu_mutex);
#endif
M_Drawer(); //Needed for drawing messageboxes on the connection screen
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
I_UnlockMutex(m_menu_mutex);
#endif
I_UpdateNoVsync(); // page flip or blit buffer
if (moviemode)
@@ -3504,6 +3485,9 @@ void CL_Reset(void)
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
}
@@ -4292,6 +4276,9 @@ void D_ClientServerInit(void)
#endif
D_LoadBan(false);
for (INT32 i = 0; i < MAXPLAYERS; ++i)
playerinfo[i].node = 255;
gametic = 0;
localgametic = 0;
@@ -4527,7 +4514,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
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();
addedtogame = true;
@@ -6474,6 +6461,7 @@ static void SV_SendTics(void)
continue;
DEBFILE(va("Sent %d anyway\n", realfirsttic));
}
realfirsttic = max(realfirsttic, firstticstosend);
// compute the length of the packet and cut it if too large
@@ -6619,7 +6607,8 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
// -- Monster Iestyn 16/01/18
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
break;
@@ -7198,12 +7187,12 @@ void NetUpdate(void)
{
resptime = nowtime;
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
I_LockMutex(&m_menu_mutex);
#endif
M_Ticker();
refreshdirmenu = 0;
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
I_UnlockMutex(m_menu_mutex);
#endif
CON_Ticker();
}
@@ -7248,7 +7237,7 @@ void CL_ClearRewinds(void)
rewind_t *CL_SaveRewindPoint(size_t demopos)
{
savebuffer_t save = {0};
savebuffer_t save = {};
rewind_t *rewind;
if (rewindhead && rewindhead->leveltime + REWIND_POINT_INTERVAL > leveltime)
@@ -7271,7 +7260,7 @@ rewind_t *CL_SaveRewindPoint(size_t demopos)
rewind_t *CL_RewindToTime(tic_t time)
{
savebuffer_t save = {0};
savebuffer_t save = {};
rewind_t *rewind;
while (rewindhead && rewindhead->leveltime > time)
-2
View File
@@ -516,7 +516,6 @@ typedef struct
extern serverelem_t serverlist[MAXSERVERLIST];
extern UINT32 serverlistcount;
extern UINT32 serverlistultimatecount;
extern INT32 mapchangepending;
// Points inside doomcom
@@ -627,7 +626,6 @@ void CL_ClearPlayer(INT32 playernum);
void CL_RemovePlayer(INT32 playernum, INT32 reason);
void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(void);
void CL_TimeoutServerList(void);
void CL_AbortConnection(void);
+46 -20
View File
@@ -80,6 +80,31 @@
#include "lua_script.h"
/* Manually defined asset hashes for non-CMake builds
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
* Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
* Last updated 2020 / 08 / 30 - Kart v1.3 - patch.kart
* Last updated 2022 / 08 / 16 - Kart v1.4 - Main assets
* Last updated 2022 / 08 / 19 - Kart v1.5 - gfx.kart
* Last updated 2022 / 11 / 01 - Kart v1.6 - gfx.kart, maps.kart
*/
// Base SRB2 hashes
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4"
#endif
// SRB2Kart-specific hashes
#define ASSET_HASH_GFX_KART "06f86ee16136eb8a7043b15001797034"
#define ASSET_HASH_TEXTURES_KART "abb53d56aba47c3a8cb0f764da1c8b80"
#define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964"
#define ASSET_HASH_MAPS_KART "d051e55141ba736582228c456953cd98"
#ifdef USE_PATCH_KART
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
#endif
#ifdef CMAKECONFIG
#include "config.h"
#else
@@ -198,13 +223,13 @@ void D_ProcessEvents(void)
// Menu input
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
I_LockMutex(&m_menu_mutex);
#endif
{
eaten = M_Responder(ev);
}
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
I_UnlockMutex(m_menu_mutex);
#endif
if (eaten)
@@ -219,13 +244,13 @@ void D_ProcessEvents(void)
// console input
#ifdef HAVE_THREADS
I_lock_mutex(&con_mutex);
I_LockMutex(&con_mutex);
#endif
{
eaten = CON_Responder(ev);
}
#ifdef HAVE_THREADS
I_unlock_mutex(con_mutex);
I_UnlockMutex(con_mutex);
#endif
if (eaten)
@@ -552,11 +577,11 @@ static boolean D_Display(void)
vid.recalc = false;
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
I_LockMutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of everything...
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
I_UnlockMutex(m_menu_mutex);
#endif
// focus lost moved to M_Drawer
@@ -639,7 +664,7 @@ void D_SRB2Loop(void)
tic_t entertic = 0, oldentertics = 0, realtics = 0, rendertimeout = INFTICS;
double deltatics = 0.0;
double deltasecs = 0.0;
UINT64 precision;
UINT64 precision = 0;
boolean interp = false;
boolean doDisplay = false;
@@ -792,9 +817,9 @@ void D_SRB2Loop(void)
}
else if (!dedicated)
{
// always update console and hud
// otherwise it may take minutes to open it
CON_Drawer();
// always update console movement
// otherwise it will takes literal ages to open
CON_MoveConsole();
}
}
@@ -882,10 +907,11 @@ void D_ClearState(void)
// okay, stop now
// (otherwise the game still thinks we're playing!)
#ifdef HAVE_CURL
CURLAbortFile();
#endif
SV_StopServer();
SV_ResetServer();
serverlistultimatecount = 0;
for (i = 0; i < MAXPLAYERS; i++)
CL_ClearPlayer(i);
@@ -947,6 +973,9 @@ void D_ClearState(void)
//
void D_StartTitle(void)
{
if (dedicated)
I_Error("D_StartTitle is called on dedicated server");
D_ClearState();
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
F_StartTitleScreen();
@@ -1187,17 +1216,13 @@ static void IdentifyVersion(void)
#endif
char tempsrb2path[256] = ".";
getcwd(tempsrb2path, 256);
if (getcwd(tempsrb2path, 256) == NULL)
strcpy(tempsrb2path, ".");
// get the current directory (possible problem on NT with "." as current dir)
if (!srb2waddir)
{
if (tempsrb2path[0])
srb2waddir = tempsrb2path;
else
{
srb2waddir = ".";
}
srb2waddir = tempsrb2path;
}
#if (1) // reduce the amount of findfile by only using full cwd in this func
@@ -1264,7 +1289,7 @@ static void IdentifyVersion(void)
if (AddIWAD("extra3.kart", srb2waddir))
found_extra3_kart = true;
#if defined (HAVE_SDL)
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#define MUSICTEST(str) \
musicpath = va(pandf, srb2waddir, str);\
handle = W_OpenWadFile(&musicpath, false); \
@@ -1870,7 +1895,8 @@ void D_SRB2Main(void)
if (M_CheckParm("-warp") && M_IsNextParm())
{
const char *word = M_GetNextParm();
pstartmap = G_FindMapByNameOrCode(word, 0);
pstartmap = G_FindMapByNameOrCode(word, NULL);
if (! pstartmap)
I_Error("Cannot find a map remotely named '%s'\n", word);
else
+9 -3
View File
@@ -59,7 +59,7 @@ static INT16 reboundsize[MAXREBOUND];
static INT32 rebound_head, rebound_tail;
/// \brief max length per packet
INT16 hardware_MAXPACKETLENGTH;
INT16 hardware_MAXPACKETLENGTH = 0;
boolean (*I_NetGet)(void) = NULL;
void (*I_NetSend)(void) = NULL;
@@ -96,7 +96,7 @@ INT32 ticruned = 0, ticmiss = 0;
// globals
INT32 getbps = 0, sendbps = 0;
float lostpercent = 0, duppercent = 0, gamelostpercent = 0;
float lostpercent = 0.0f, duppercent = 0.0f, gamelostpercent = 0.0f;
INT32 packetheaderlength = 0;
boolean Net_GetNetStat(void)
@@ -492,6 +492,7 @@ void Net_AckTicker(void)
ackpak[i].acknum = 0;
continue;
}
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
NODETIMEOUT, I_GetTime()));
memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
@@ -1224,7 +1225,7 @@ void D_SetDoomcom(void)
if (doomcom)
return;
doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
doomcom = Z_Calloc(sizeof(doomcom_t), PU_STATIC, NULL);
doomcom->id = DOOMCOM_ID;
doomcom->numslots = doomcom->numnodes = 1;
}
@@ -1266,6 +1267,7 @@ boolean D_CheckNetGame(void)
ret = true;
if (client && netgame)
netgame = false;
server = true; // WTF? server always true???
// no! The deault mode is server. Client is set elsewhere
// when the client executes connect command.
@@ -1301,6 +1303,7 @@ boolean D_CheckNetGame(void)
if (doomcom->id != DOOMCOM_ID)
I_Error("Doomcom buffer invalid!");
if (doomcom->numnodes > MAXNETNODES)
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
@@ -1309,14 +1312,17 @@ boolean D_CheckNetGame(void)
{
char filename[21];
INT32 k = doomcom->consoleplayer - 1;
if (M_IsNextParm())
k = atoi(M_GetNextParm()) - 1;
while (!debugfile && k < MAXPLAYERS)
{
k++;
sprintf(filename, "debug%d.txt", k);
debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w");
}
if (debugfile)
CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename));
else
+46 -12
View File
@@ -54,6 +54,9 @@
#include "fastcmp.h"
#include "m_perfstats.h"
#include "r_data.h"
#include "r_skins.h"
#ifdef NETGAME_DEVMODE
#define CV_RESTRICT CV_NETVAR
#else
@@ -144,6 +147,7 @@ static void Command_Addfile(void);
static void Command_Addskins(void);
static void Command_GLocalSkin(void);
static void Command_ListWADS_f(void);
static void Command_LocateLump_f(void);
static void Command_ListDoomednums_f(void);
static void Command_ListUnusedSprites_f(void);
static void Command_RunSOC(void);
@@ -248,7 +252,7 @@ consvar_t cv_competitionboxes = {"competitionboxes", "Random", CV_NETVAR|CV_CHEA
#ifdef SEENAMES
static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}};
consvar_t cv_seenames = {"seenames", "Off", CV_SAVE, seenames_cons_t, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_seenames = {"seenames", "Off", CV_SAVE, seenames_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_allowseenames = {"allowseenames", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
@@ -270,7 +274,7 @@ consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk
// 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_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};
@@ -457,16 +461,16 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pingicon = {"pingicon", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pingicon = {"pingicon", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t cv_pingstyle_cons_t[] = {{0, "New"}, {1, "Old"}, {0, NULL}};
consvar_t cv_pingstyle = {"pingstyle", "New", CV_SAVE, cv_pingstyle_cons_t, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pingstyle = {"pingstyle", "New", CV_SAVE, cv_pingstyle_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showdownloadprompt = {"showdownloadprompt", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showdownloadprompt = {"showdownloadprompt", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// Intermission time Tails 04-19-2002
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
@@ -638,6 +642,7 @@ void D_RegisterServerCommands(void)
COM_AddCommand("addfile", Command_Addfile);
COM_AddCommand("addskins", Command_Addskins);
COM_AddCommand("listwad", Command_ListWADS_f);
COM_AddCommand("locatelump", Command_LocateLump_f);
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
@@ -937,6 +942,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_chatbacktint);
CV_RegisterVar(&cv_chatcentertext);
CV_RegisterVar(&cv_songcredits);
CV_RegisterVar(&cv_pausesongcredits);
CV_RegisterVar(&cv_showfreeplay);
CV_RegisterVar(&cv_skinselectspin);
CV_RegisterVar(&cv_showallmaps);
@@ -994,6 +1000,8 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_litesteer[i]);
CV_RegisterVar(&cv_autoaccel[i]);
CV_RegisterVar(&cv_usejoystick[i]);
CV_RegisterVar(&cv_joyscale[i]);
CV_RegisterVar(&cv_rumble[i]);
@@ -1001,9 +1009,12 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_gamepadled[i]);
}
CV_RegisterVar(&cv_gamepadledifunfocused);
CV_RegisterVar(&cv_rumbleifunfocused);
CV_RegisterVar(&cv_usemouse);
CV_RegisterVar(&cv_invertmouse);
CV_RegisterVar(&cv_mousesens);
CV_RegisterVar(&cv_mousexsens);
CV_RegisterVar(&cv_mouseysens);
CV_RegisterVar(&cv_mousevisible);
@@ -2647,8 +2658,6 @@ static void Command_Map_f(void)
return;
}
M_ClearMenus(true);
last_map_cmd = I_GetTime();
size_t first_option;
@@ -2785,7 +2794,7 @@ static void Command_Map_f(void)
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
else
{
if (!mapheaderinfo[newmapnum-1])
if (mapheaderinfo[newmapnum-1] == NULL)
{
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
return;
@@ -2830,6 +2839,8 @@ static void Command_Map_f(void)
fromlevelselect = false;
M_ClearMenus(true);
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
}
@@ -4720,7 +4731,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)
{
+20 -11
View File
@@ -112,7 +112,7 @@ static fileused_t transferFiles[UINT8_MAX + 1];
INT32 fileneedednum = 0; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
#ifdef HAVE_THREADS
static I_mutex downloadmutex;
static I_Mutex downloadmutex;
#endif
char downloaddir[512] = "DOWNLOAD";
@@ -131,6 +131,8 @@ static UINT32 curl_origtotalfilesize;
static char *curl_realname = NULL;
fileneeded_t *curl_curfile = NULL;
HTTP_login *curl_logins = NULL;
static void CURLGetFile(void);
#endif
/** Fills a serverinfo packet with information about wad files loaded.
@@ -1163,8 +1165,12 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
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)
// skip for startup, our mainwads wont be in there
if (loaded_config)
// see IdentifyVersion
// 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')
{
@@ -1301,6 +1307,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
if (!multi_handle)
{
cc = curl_global_init(CURL_GLOBAL_ALL);
if (cc < 0)
{
I_OutputMsg("libcurl: curl_global_init() returned %d\n", cc);
@@ -1309,6 +1316,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
{
multi_handle = curl_multi_init();
}
if (!multi_handle)
{
I_OutputMsg("libcurl: curl_multi_init() failed\n");
@@ -1419,7 +1427,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
filedownload.http_running = true;
#ifdef HAVE_THREADS
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
(void)!I_SpawnThread("http-download", (I_ThreadFn)CURLGetFile, NULL);
#endif
}
else
@@ -1432,15 +1440,15 @@ void CURLAbortFile(void)
#ifdef HAVE_THREADS
// lock and unlock to wait for the download thread to exit
I_lock_mutex(&downloadmutex);
I_unlock_mutex(downloadmutex);
I_LockMutex(&downloadmutex);
I_UnlockMutex(downloadmutex);
#endif
}
void CURLGetFile(void)
static void CURLGetFile(void)
{
#ifdef HAVE_THREADS
I_lock_mutex(&downloadmutex);
I_LockMutex(&downloadmutex);
#endif
CURLMcode mc; /* return code used by curl_multi_wait() */
CURLcode easyres; /* Return from easy interface */
@@ -1479,7 +1487,8 @@ void CURLGetFile(void)
e = m->easy_handle;
easyres = m->data.result;
char *filename = Z_StrDup(curl_realname);
char *filename = malloc(strlen(curl_realname)+1);
strcpy(filename, curl_realname);
nameonly(filename);
if (easyres != CURLE_OK)
@@ -1517,7 +1526,7 @@ void CURLGetFile(void)
}
}
Z_Free(filename);
free(filename);
curl_curfile->file = NULL;
filedownload.remaining--;
mc = curl_multi_remove_handle(multi_handle, e);
@@ -1540,7 +1549,7 @@ void CURLGetFile(void)
filedownload.http_running = false;
#ifdef HAVE_THREADS
I_unlock_mutex(downloadmutex);
I_UnlockMutex(downloadmutex);
#endif
}
-1
View File
@@ -119,7 +119,6 @@ size_t nameonlylength(const char *s);
#ifdef HAVE_CURL
void CURLPrepareFile(const char* url, int dfilenum);
void CURLAbortFile(void);
void CURLGetFile(void);
HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next);
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
#endif
+8 -3
View File
@@ -46,15 +46,20 @@ typedef enum
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
// ticcmd turning bits
#define TICCMD_REDUCE 16
// ticcmd latency mask
#define TICCMD_LATENCYMASK 0xFF
// bits in angleturn
#define TICCMD_RECEIVED 1
#define TICCMD_XY 2
#define TICCMD_RECEIVED (0x01) /* Actual tic recieved from client */
typedef struct
{
SINT8 forwardmove; // -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
UINT16 buttons;
INT16 driftturn; // SRB2Kart: Used for getting drift turn speed
+93 -22
View File
@@ -1,21 +1,75 @@
# Declare dedicated interface sources
target_sourcefile(c)
set(SRB2_DEDICATED_SOURCES
i_system.c
i_main.c
i_video.c
i_sound.c
i_threads.c
dosstr.c
endtxt.c
)
target_sources(SRB2SDL2 PRIVATE)
set(SRB2_DEDICATED_HEADERS
endtxt.h
)
source_group("Interface Code" FILES ${SRB2_DEDICATED_SOURCES} ${SRB2_DEDICATED_HEADERS})
set(SRB2_DEDICATED_TOTAL_SOURCES
${SRB2_CORE_SOURCES}
${SRB2_CORE_HEADERS}
${SRB2_PNG_SOURCES}
${SRB2_PNG_HEADERS}
${SRB2_CORE_RENDER_SOURCES}
${SRB2_CORE_GAME_SOURCES}
${SRB2_LUA_SOURCES}
${SRB2_LUA_HEADERS}
${SRB2_BLUA_SOURCES}
${SRB2_BLUA_HEADERS}
${SRB2_DEDICATED_SOURCES}
${SRB2_DEDICATED_HEADERS}
)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
if(${CMAKE_SYSTEM} MATCHES Windows)
target_sources(SRB2SDL2 PRIVATE
../win32/win_dbg.c
../win32/Srb2win.rc)
set(SRB2_DEDICATED_TOTAL_SOURCES ${SRB2_DEDICATED_TOTAL_SOURCES}
${CMAKE_SOURCE_DIR}/src/win32/win_dbg.c
${CMAKE_SOURCE_DIR}/src/win32/Srb2win.rc
)
endif()
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_DEDICATED_TOTAL_SOURCES})
if(${CMAKE_SYSTEM} MATCHES Windows)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2legacy)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2kartd)
elseif(${CMAKE_SYSTEM} MATCHES Linux)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME lsrb2dlegacy)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME lsrb2kartd)
else()
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2legacy)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2kartd)
endif()
if(${CMAKE_SYSTEM} MATCHES Darwin)
find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation")
target_link_libraries(SRB2SDL2 PRIVATE
${CORE_FOUNDATION_LIBRARY}
)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
# Configure the app bundle icon and plist properties
target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns")
set_target_properties(SRB2SDL2 PROPERTIES
MACOSX_BUNDLE_ICON_FILE "Srb2mac"
MACOSX_BUNDLE_BUNDLE_NAME "Sonic Robo Blast 2"
MACOSX_BUNDLE_BUNDLE_VERSION ${SRB2_VERSION}
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns"
)
endif()
if(${CMAKE_SYSTEM} MATCHES Darwin)
@@ -24,25 +78,27 @@ if(${CMAKE_SYSTEM} MATCHES Darwin)
${CORE_LIB}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${CURL_LIBRARIES}
)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
else()
target_link_libraries(SRB2SDL2 PRIVATE
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${CURL_LIBRARIES}
)
if(${CMAKE_SYSTEM} MATCHES Linux)
target_link_libraries(SRB2SDL2 PRIVATE
m
rt
pthread
)
endif()
endif()
#target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION})
if(${SRB2_HAVE_LIBBACKTRACE})
target_link_libraries(SRB2SDL2 PRIVATE ${LIBBACKTRACE_LIBRARIES})
endif()
if(${CMAKE_SYSTEM} MATCHES Windows)
target_link_libraries(SRB2SDL2 PRIVATE
@@ -60,20 +116,35 @@ target_include_directories(SRB2SDL2 PRIVATE
target_compile_definitions(SRB2SDL2 PRIVATE
-DDEDICATED
-DHAVE_THREADS
)
## strip debug symbols into separate file when using gcc
if(CMAKE_COMPILER_IS_GNUCC)
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
message(STATUS "Will make separate debug symbols in *.debug")
add_custom_command(TARGET SRB2SDL2 POST_BUILD
COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
)
endif()
if(SRB2_CONFIG_LTO AND NOT SRB2_CONFIG_DEBUGMODE)
set_property(TARGET SRB2SDL2 PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if(SRB2_CONFIG_ASAN)
target_compile_options(SRB2SDL2 PRIVATE -fsanitize=address)
target_link_options(SRB2SDL2 PRIVATE -fsanitize=address)
endif()
if(SRB2_CONFIG_UBSAN)
target_compile_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
target_link_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
endif()
## strip debug symbols into separate file when using gcc
# if(CMAKE_COMPILER_IS_GNUCC)
# if(${CMAKE_BUILD_TYPE} MATCHES Debug)
# message(STATUS "Will make separate debug symbols in *.debug")
# add_custom_command(TARGET SRB2SDL2 POST_BUILD
# COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
# COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
# COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
# )
# endif()
# endif()
#### Installation ####
if(${CMAKE_SYSTEM} MATCHES Darwin)
install(TARGETS SRB2SDL2
-1
View File
@@ -2,6 +2,5 @@ i_system.c
i_main.c
i_video.c
i_sound.c
i_threads.c
dosstr.c
endtxt.c
+5 -13
View File
@@ -167,6 +167,8 @@ static char returnWadPath[256];
#include "../i_video.h"
#include "../i_sound.h"
#include "../i_system.h"
#include "../i_time.h"
#include "../i_net.h"
#include "../screen.h" //vid.WndParent
#include "../d_net.h"
#include "../g_game.h"
@@ -178,10 +180,6 @@ static char returnWadPath[256];
#include "../m_argv.h"
#ifdef MAC_ALERT
#include "macosx/mac_alert.h"
#endif
#include "../d_main.h"
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
@@ -196,8 +194,6 @@ UINT8 keyboard_started = false;
#ifdef HAVE_TERMIOS
// TERMIOS console code from Quake3: thank you!
boolean stdin_active = true;
typedef struct
{
size_t cursor;
@@ -699,11 +695,7 @@ void I_JoyScale4(void)
*/
void I_ShutdownJoystick(void)
{
}
void I_GetJoystickEvents(UINT8 index)
void I_ShutdownJoystick(UINT8 index)
{
(void)index;
}
@@ -1389,8 +1381,8 @@ INT32 I_StartupSystem(void)
I_Fork();
#endif
#ifdef HAVE_THREADS
I_start_threads();
I_AddExitFunc(I_stop_threads);
I_StartThreads();
I_AddExitFunc(I_StopThreads);
#endif
I_RegisterSignals();
#ifndef NOMUMBLE
-4
View File
@@ -115,10 +115,6 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h)
return -1;
}
void VID_RefreshModeList(void)
{
}
void VID_PrepareModeList(void)
{
}
+35 -13
View File
@@ -20,7 +20,6 @@
// but I can't stand that gibberish. D:
#define SOUND_DUMMY 0
#define SOUND_MIXER 1
#define SOUND_SDL 2
#ifndef SOUND
#ifdef HAVE_SDL
@@ -28,7 +27,7 @@
#ifdef HAVE_MIXER
#define SOUND SOUND_MIXER
#else
#define SOUND SOUND_SDL
#define SOUND SOUND_DUMMY
#endif
#else
#define SOUND SOUND_DUMMY
@@ -41,22 +40,45 @@
#define ASMCALL
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include "doomtype.h"
#ifdef __cplusplus /* Only when compiled as C++ */
#include <algorithm> /* std::min, std::max, std::sort, … */
#endif
#ifdef __cplusplus
// Force libc++ to expose std::min/std::max even when <cmath> is included first (Apple clang quirk)
#ifndef _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
#define _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
#endif
#ifndef _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
#endif
// Optional: only try <version> if it actually exists (newer Xcode)
#if __has_include(<version>)
#include <version>
#endif
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <cstring>
#include <climits>
extern "C" {
#else
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#include <limits.h>
#endif
#include <sys/types.h>
@@ -108,8 +130,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9.x - Testing"
#define VERSIONSTRINGW L"Saturn v9.x - Testing "
#define VERSIONSTRING "Saturn v9.2"
#define VERSIONSTRINGW L"Saturn v9.2"
#define SATURN_TESTING // comment out for saturn release builds!
+1 -1
View File
@@ -542,7 +542,7 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
#else
#define 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
#define DEBFILE(msg) {}
#endif
+5
View File
@@ -223,6 +223,8 @@ typedef int32_t boolean;
#define FUNCNOINLINE __attribute__((noinline))
#define FUNCWARNRV __attribute__((warn_unused_result))
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
#ifdef __i386__ // i386 only
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
@@ -268,6 +270,9 @@ typedef int32_t boolean;
#ifndef FUNCTARGET
#define FUNCTARGET(x)
#endif
#ifndef FUNCWARNRV
#define FUNCWARNRV
#endif
#ifndef ATTRPACK
#define ATTRPACK
#endif
+3 -5
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
}
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
@@ -1172,9 +1172,7 @@ void F_StartWaitingPlayers(void)
randskin = M_RandomKey(numskins);
boolean waithires = skins[randskin].flags && SF_HIRES;
if (waitcolormap)
Z_Free(waitcolormap);
Z_Free(waitcolormap);
waitcolormap = R_GetTranslationColormap(randskin, skins[randskin].prefcolor, 0);
if (waithires)
@@ -1318,7 +1316,7 @@ boolean F_ContinueResponder(event_t *event)
keypressed = true;
imcontinuing = true;
continuetime = TICRATE;
S_StartSound(0, sfx_itemup);
S_StartSound(NULL, sfx_itemup);
return true;
}
+2 -2
View File
@@ -388,11 +388,11 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
if (rendermode != render_none && drawMenu)
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
I_LockMutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of wipes
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
I_UnlockMutex(m_menu_mutex);
#endif
}
+2 -2
View File
@@ -10,7 +10,7 @@ FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c)
}
// 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++) ;
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
// 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++) ;
return !l; // make sure you reached the end
+11 -10
View File
@@ -49,7 +49,7 @@ size_t menupathindex[menudepth] = {};
size_t menudepthleft = menudepth;
char menusearchbuf[MAXSTRINGLENGTH+1];
textinput_t menusearch;
textinput_t menusearch = {};
char **dirmenu = NULL, **coredirmenu = NULL; // core only local for this file
size_t sizedirmenu = 0, sizecoredirmenu = 0; // ditto
@@ -271,10 +271,13 @@ static boolean filemenucmp(char *haystack, char *needle)
{
static char localhaystack[128];
strlcpy(localhaystack, haystack, 128);
if (!cv_addons_search_case.value)
strupr(localhaystack);
if (cv_addons_search_type.value)
return (strstr(localhaystack, needle) != 0);
return (strstr(localhaystack, needle) != NULL);
return (!strncmp(localhaystack, needle, menusearch.length));
}
@@ -314,8 +317,7 @@ void closefilemenu(boolean validsize)
coredirmenu = NULL;
}
if (refreshdirname)
Z_Free(refreshdirname);
Z_Free(refreshdirname);
refreshdirname = NULL;
}
@@ -343,8 +345,7 @@ void searchfilemenu(char *tempname)
if (!menusearch.length)
{
if (dirmenu)
Z_Free(dirmenu);
Z_Free(dirmenu);
dirmenu = coredirmenu;
sizedirmenu = sizecoredirmenu;
@@ -386,8 +387,8 @@ void searchfilemenu(char *tempname)
I_Error("searchfilemenu(): could not create \"No results...\".");
sizedirmenu = 1;
dir_on[menudepthleft] = 0;
if (tempname)
Z_Free(tempname);
Z_Free(tempname);
return;
}
@@ -502,8 +503,8 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
{
closedir(dirhandle);
closefilemenu(false);
if (tempname)
Z_Free(tempname);
Z_Free(tempname);
return false;
}
+156 -87
View File
@@ -55,6 +55,8 @@
#include "k_stats.h" // SRB2kart
#include "r_fps.h" // frame interpolation/uncapped
#include <errno.h>
#ifdef HAVE_DISCORDRPC
#include "discord.h"
#endif
@@ -74,7 +76,7 @@ static tic_t demostarttime; // for comparative timing purposes
//@TODO put these all in a struct for namespacing purposes?
static char demoname[128];
savebuffer_t demobuf = {0};
savebuffer_t demobuf = {};
static UINT8 *demotime_p, *demoinfo_p;
static UINT8 *demoend;
static UINT8 demoflags;
@@ -246,10 +248,12 @@ void G_ReadDemoExtraData(void)
{
extradata = READUINT8(demobuf.p);
player_t *player = &players[p];
if (extradata & DXD_RESPAWN)
{
if (players[p].mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
if (player->mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
}
if (extradata & DXD_SKIN)
@@ -264,11 +268,11 @@ void G_ReadDemoExtraData(void)
kartspeed = 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);
players[p].kartspeed = kartspeed;
players[p].kartweight = kartweight;
player->kartspeed = kartspeed;
player->kartweight = kartweight;
}
if (extradata & DXD_COLOR)
@@ -279,9 +283,9 @@ void G_ReadDemoExtraData(void)
for (i = 0; i < MAXSKINCOLORS; i++)
if (fasticmp(KartColor_Names[i], name)) // SRB2kart
{
players[p].skincolor = i;
if (players[p].mo)
players[p].mo->color = i;
player->skincolor = i;
if (player->mo)
player->mo->color = i;
break;
}
}
@@ -300,17 +304,17 @@ void G_ReadDemoExtraData(void)
switch (extradata)
{
case DXD_PST_PLAYING:
players[p].pflags |= PF_WANTSTOJOIN; // fuck you
player->pflags |= PF_WANTSTOJOIN; // fuck you
break;
case DXD_PST_SPECTATING:
players[p].pflags &= ~PF_WANTSTOJOIN; // double-fuck you
player->pflags &= ~PF_WANTSTOJOIN; // double-fuck you
if (!playeringame[p])
{
CL_ClearPlayer(p);
playeringame[p] = true;
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/
if (oldcmd[p].forwardmove)
@@ -318,11 +322,11 @@ void G_ReadDemoExtraData(void)
}
else
{
players[p].spectator = true;
if (players[p].mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL);
player->spectator = true;
if (player->mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL);
else
players[p].playerstate = PST_REBORN;
player->playerstate = PST_REBORN;
}
break;
case DXD_PST_LEFT:
@@ -330,7 +334,7 @@ void G_ReadDemoExtraData(void)
break;
}
G_ResetViews();
G_ResetViews(false); // dont reset our freecam pls thx!
// maybe these are necessary?
if (G_BattleGametype())
@@ -1132,7 +1136,29 @@ void G_GhostTicker(void)
for (g = ghosts, p = NULL; g; g = g->next)
{
// 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
if (g->version != 0x0001)
@@ -1140,8 +1166,14 @@ void G_GhostTicker(void)
#endif
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);
if (ziptic & DXD_SKIN)
@@ -1153,13 +1185,26 @@ void G_GhostTicker(void)
if (ziptic & DXD_NAME)
g->p += 16; // yea
if (ziptic & DXD_PLAYSTATE && READUINT8(g->p) != DXD_PST_PLAYING)
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
if (ziptic & DXD_PLAYSTATE)
{
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)
{
g->p += 4; // RNG seed
}
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);
}
@@ -1182,7 +1227,7 @@ void G_GhostTicker(void)
if (ziptic & ZT_DRIFT)
g->p += 2;
if (ziptic & ZT_LATENCY)
g->p += 1;
g->p++;
// Grab ghost data.
ziptic = READUINT8(g->p);
@@ -1191,10 +1236,12 @@ void G_GhostTicker(void)
if (g->version != 0x0001)
{
#endif
if (ziptic == DEMOMARKER) // Had to end early for some reason
goto fadeghost;
if (ziptic == 0xFF)
goto skippedghosttic; // Didn't write ghost info this frame
else if (ziptic != 0)
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
if (ziptic != 0)
I_Error("Ghost is not a record attack ghost ZIPTIC"); //@TODO lmao don't blow up like this
ziptic = READUINT8(g->p);
#ifdef DEMO_COMPAT_100
}
@@ -1365,7 +1412,7 @@ void G_GhostTicker(void)
{
#endif
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
}
#endif
@@ -1385,20 +1432,6 @@ skippedghosttic:
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;
}
}
@@ -1593,7 +1626,7 @@ void G_ConfirmRewind(tic_t rewindtime)
displayplayers[2] = olddp3;
displayplayers[3] = olddp4;
R_ExecuteSetViewSize();
G_ResetViews();
G_ResetViews(true);
for (i = splitscreen; i >= 0; 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)
{
char *datetime;
datetime = malloc(sizeof(pdemo->date)); // mallocma balls
// no mallocma balls... :c
if (!datetime)
{
return NULL;
}
char *endPos = NULL;
static char datetime[11];
time_t file_time = 0;
const char *format = NULL;
struct tm *tm_buf = NULL;
CLEANUP(pfree) char *filename = NULL;
// get le filepath
char *filename;
filename = strdup(pdemo->filepath);
#if defined (_WIN32)
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);
goto skipfilenametime;
}
#else
if (!filename)
{
free(datetime);
return NULL;
}
#endif
}
// get the actual filename Zzz...
nameonly(filename);
// convert it to long Zzz....
file_time = strtol(filename, NULL, 10);
free(filename); // dont need this anymore a
// the first 10 characters of a replay name usually is a unix timestamp
// 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)
skipfilenametime:
#endif
// then throw it into localtime to get an actual human readable format lmao
struct tm *tm_buf = NULL;
tm_buf = localtime(&file_time);
// cant believe we ended up in 1970
@@ -2425,14 +2478,10 @@ skipfilenametime:
tm_buf = localtime(&file_time);
if (tm_buf == NULL || tm_buf->tm_year <= 110)
{
free(datetime);
return NULL;
}
goto gotcreationtime;
#else
free(datetime);
return NULL;
#endif
}
@@ -2441,17 +2490,27 @@ skipfilenametime:
gotcreationtime:
#endif
const char *format;
// US ppl are special (:
if (cv_demodateformat.value == 2)
format = "%m.%d.%Y";
else if (cv_demodateformat.value == 1)
format = "%d.%m.%Y";
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;
}
@@ -2460,6 +2519,7 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
{
UINT8 infobuffer[96], *info_p;
UINT16 pdemoversion;
char *demodate = NULL;
size_t count;
FILE *handle = fopen(pdemo->filepath, "rb");
@@ -2498,13 +2558,13 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
memcpy(pdemo->title, info_p, 64);
// demo date
char *demodate;
demodate = G_GetDemoDate(pdemo);
if (demodate)
strncpy(pdemo->date, demodate, sizeof(pdemo->date));
{
strlcpy(pdemo->date, demodate, sizeof(pdemo->date));
}
free(demodate);
break;
#ifdef DEMO_COMPAT_100
case 0x0001:
@@ -2581,7 +2641,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read file '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing;
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
return;
}
@@ -2593,7 +2653,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read lump '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing;
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
return;
}
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);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2639,7 +2699,7 @@ void G_DoPlayDemo(char *defdemoname)
default:
snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
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);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
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);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2725,7 +2785,7 @@ void G_DoPlayDemo(char *defdemoname)
CONS_Alert(CONS_ERROR, "%s", msg);
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();
return;
@@ -2763,6 +2823,16 @@ void G_DoPlayDemo(char *defdemoname)
#endif
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
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);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
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);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2823,7 +2893,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2861,7 +2931,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
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);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
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);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -3532,7 +3602,6 @@ void G_FreeGhosts(void)
ghosts = NULL;
}
boolean G_CheckDemoStatus(void)
{
G_FreeGhosts();
+1
View File
@@ -149,6 +149,7 @@ typedef struct demoghost {
UINT8 checksum[16];
UINT8 *buffer, *p, color;
UINT16 version;
boolean done;
mobj_t oldmo, *mo;
struct demoghost *next;
} demoghost;
+102 -37
View File
@@ -132,7 +132,7 @@ UINT8 skincolor_bluering = SKINCOLOR_STEEL;
tic_t countdowntimer = 0;
boolean countdowntimeup = false;
cutscene_t *cutscenes[128];
cutscene_t *cutscenes[128] = {};
INT16 nextmapoverride = 0;
boolean skipstats = false;
@@ -144,7 +144,7 @@ mobj_t *blueflag = NULL;
mapthing_t *rflagpoint = NULL;
mapthing_t *bflagpoint = NULL;
struct quake quake;
struct quake quake = {};
// Map Header Information
mapheader_t* mapheaderinfo[NUMMAPS] = {};
@@ -228,7 +228,7 @@ tic_t racecountdown = 0, exitcountdown = 0; // for racing
fixed_t gravity = 0;
fixed_t mapobjectscale = FRACUNIT;
struct maplighting maplighting;
struct maplighting maplighting = {};
INT16 autobalance = 0; //for CTF team balance
INT16 teamscramble = 0; //for CTF team scramble
@@ -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}};
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. :(
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}
};
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
{"kartautoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"kartautoaccel2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"kartautoaccel3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"kartautoaccel4", "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}};
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -513,11 +523,8 @@ void G_ClearRecords(void)
INT16 i;
for (i = 0; i < NUMMAPS; ++i)
{
if (mainrecords[i])
{
Z_Free(mainrecords[i]);
mainrecords[i] = NULL;
}
Z_Free(mainrecords[i]);
mainrecords[i] = NULL;
}
}
@@ -662,7 +669,7 @@ INT16 G_ClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle)
*aiming = -limitangle;
return (INT16)((*aiming)>>16);
return (INT16)((*aiming) >> TICCMD_REDUCE);
}
INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
@@ -675,7 +682,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle)
*aiming = -limitangle;
return (INT16)((*aiming)>>16);
return (INT16)((*aiming) >> TICCMD_REDUCE);
}
INT32 JoyAxis(axis_input_e axissel, UINT8 player)
@@ -798,6 +805,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 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)
{
INT32 axis = 0;
@@ -860,9 +871,8 @@ static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
//
static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
{
boolean moveinput = false;
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
// for stuff like joining with item button, saltyhop, honking, etc.
@@ -897,15 +907,11 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
#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);
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
// Reset to our spec player if we watch someone else.
if ((moveinput || cmd->buttons)
if ((cmd->driftturn || cmd->buttons)
&& displayplayers[0] != consoleplayer && ssplayer == 1)
{
if (cv_director.value)
@@ -917,6 +923,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
// Builds a ticcmd from all of the available inputs
@@ -959,7 +1022,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
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);
return;
}
@@ -967,7 +1030,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
if (player->spectator || freecam)
{
cmd->angleturn = (INT16)(lang >> 16);
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
G_BuildLocalTiccmd(cmd, ssplayer, freecam);
// let lua override everything
@@ -1064,7 +1127,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer])
{
cmd->buttons |= BT_ACCELERATE;
forward = forwardmove[1]; // 50
forward = forwardmove[1]; // 50
}
else if (analogjoystickmove && axis > 0)
{
@@ -1127,7 +1190,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->aiming = G_ClipAimingPitch(&laim);
mousex = mousey = mlooky = 0;
mousex = mousey = 0;
if (forward > MAXPLMOVE)
forward = MAXPLMOVE;
@@ -1145,6 +1208,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->sidemove = (SINT8)(cmd->sidemove + side);
}
G_HandleAutoAcceleration(cmd, player, forplayer);
//{ 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
// limit turning to angleturn[1] to stop mouselook letting you look too fast
@@ -1166,10 +1231,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|| (player->kartstuff[k_respawn]) // Respawning
|| (player->spectator || objectplacing))) // Not a physical player
lang += (cmd->angleturn<<16);
lang += (cmd->angleturn << TICCMD_REDUCE);
cmd->angleturn = (INT16)(lang >> 16);
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->latency = modeattacking ? 0 : (leveltime & TICCMD_LATENCYMASK); // Send leveltime when this tic was generated to the server for control lag calculations
if (!hu_stopped)
{
@@ -1750,14 +1815,15 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
// Increment a viewpoint by offset from the current player. A negative value
// decrements.
//
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam)
{
INT32 *displayplayerp, oldview;
displayplayerp = &displayplayers[viewnum-1];
oldview = (*displayplayerp);
// turn off the freecam
camera[viewnum-1].freecam = false;
if (resetfreecam)
camera[viewnum-1].freecam = false;
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
@@ -1771,7 +1837,7 @@ void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
// Ensures all viewpoints are valid
// Also demotes splitscreen down to one player.
//
void G_ResetViews(void)
void G_ResetViews(boolean resetfreecam)
{
UINT8 splits;
UINT8 viewd;
@@ -1795,7 +1861,7 @@ void G_ResetViews(void)
*/
for (viewd = 1; viewd <= splits; ++viewd)
{
G_AdjustView(viewd, 0, false);
G_AdjustViewEx(viewd, 0, false, resetfreecam);
}
}
@@ -1876,7 +1942,7 @@ void G_Ticker(boolean run)
G_CopyTiccmd(cmd, &netcmds[buf][i], 1);
// 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 +1950,6 @@ void G_Ticker(boolean run)
switch (gamestate)
{
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.
{
if (demo.title)
@@ -3433,7 +3498,7 @@ void G_LoadGameData(void)
INT32 i, j;
UINT8 modded = false;
UINT8 rtemp;
savebuffer_t save = {0};
savebuffer_t save = {};
//For records
tic_t rectime;
@@ -3566,7 +3631,7 @@ void G_SaveGameData(boolean force)
size_t length;
INT32 i, j;
UINT8 btemp;
savebuffer_t save = {0};
savebuffer_t save = {};
(void)force;
char backupfile[MAX_WADPATH+4];
@@ -3737,7 +3802,7 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
size_t length;
char vcheck[VERSIONSIZE];
char savename[255];
savebuffer_t save = {0};
savebuffer_t save = {};
// memset savedata to all 0, fixes calling perfectly valid saves corrupt because of bots
memset(&savedata, 0, sizeof(savedata));
@@ -3823,7 +3888,7 @@ void G_SaveGame(UINT32 savegameslot)
boolean saved;
char savename[256] = "";
const char *backup;
savebuffer_t save = {0};
savebuffer_t save = {};
sprintf(savename, savegamename, savegameslot);
backup = va("%s",savename);
@@ -4093,7 +4158,7 @@ static void measurekeywords(mapsearchfreq_t *fr,
PU_STATIC, NULL);
for (qp = strtok(va("%s", q), " ");
qp && fr->total < 255;
qp = strtok(0, " "))
qp = strtok(NULL, " "))
{
if (( sp = strcasestr(s, qp) ))
{
@@ -4174,7 +4239,7 @@ INT32 G_FindMap(const char *mapname, char **foundmapnamep,
{
newmapnum = mapnum;
newmapname = realmapname;
realmapname = 0;
realmapname = NULL;
Z_Free(apromapname);
if (!wanttable)
break;
@@ -4195,7 +4260,7 @@ INT32 G_FindMap(const char *mapname, char **foundmapnamep,
{
apromapnum = mapnum;
apromapname = realmapname;
realmapname = 0;
realmapname = NULL;
}
}
else/* ...match individual keywords */
+7 -3
View File
@@ -50,7 +50,7 @@ extern INT16 rw_maximums[NUM_WEAPONS];
// 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_songcredits;
extern consvar_t cv_songcredits, cv_pausesongcredits;
extern consvar_t cv_showfreeplay;
extern consvar_t cv_growmusic, cv_supermusic;
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_autoaccel[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
// Hud offsets
@@ -128,6 +130,7 @@ extern consvar_t cv_spinoutroll;
extern consvar_t cv_squishdance, cv_squishdancespeed;
extern consvar_t cv_playerblendeffects;
extern consvar_t cv_reducevfx;
extern consvar_t cv_cechotoggle;
@@ -262,9 +265,10 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive);
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse);
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_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);
+18 -13
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}};
// 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_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -81,6 +81,9 @@ consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = {
{"gamepadled4", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
};
consvar_t cv_gamepadledifunfocused = {"gamepadledunfocused", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_rumbleifunfocused = {"rumbleifunfocused", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void rumble_off_handle(void)
{
if (!cv_rumble[0].value)
@@ -125,17 +128,17 @@ static void led_off_handle4(void)
G_ResetPlayerGamepadIndicatorColor(3);
}
INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
INT32 mousex = 0, mousey = 0;
// 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
UINT8 gamekeydown[NUMINPUTS];
UINT8 gamekeydown[NUMINPUTS] = {};
// two key codes (or virtual key) per game control
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2] = {};
typedef struct
{
@@ -192,9 +195,8 @@ void G_MapEventsToControls(event_t *ev)
case ev_mouse: // buttons are virtual keys
if (menuactive || CON_Ready() || chat_on)
break;
mousex = (INT32)(ev->data2*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mlooky = (INT32)(ev->data3*((cv_mouseysens.value*cv_mousesens.value)/110.0f + 0.1f));
mousex = (INT32)(ev->data2*((cv_mousexsens.value*cv_mousexsens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mouseysens.value*cv_mouseysens.value)/110.0f + 0.1f));
break;
case ev_joystick: // buttons are virtual keys
@@ -215,7 +217,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick3:
i = ev->data1;
if (i >= JOYAXISSET)
if (i >= JOYAXISSET || menuactive)
break;
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
@@ -223,7 +225,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick4:
i = ev->data1;
if (i >= JOYAXISSET)
if (i >= JOYAXISSET || menuactive)
break;
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
@@ -931,7 +933,7 @@ void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color)
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (cv_gamepadled[playernum].value == 0
if (cv_gamepadled[playernum].value == 0 || (window_notinfocus && cv_gamepadledifunfocused.value == 0)
|| color >= MAXTRANSLATIONS)
{
return;
@@ -946,6 +948,8 @@ void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color)
static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
{
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (cv_gamepadled[playernum].value == 0)
{
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
@@ -990,6 +994,7 @@ void G_ResetDeviceLED(void)
static void G_ResetPlayerDeviceRumble(INT32 playernum)
{
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
I_GamepadRumble(playernum, 0, 0, 0);
}
@@ -1007,7 +1012,7 @@ void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_stre
{
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (cv_rumble[playernum].value == 0)
if (cv_rumble[playernum].value == 0 || (window_notinfocus && cv_rumbleifunfocused.value == 0))
{
return;
}
+4 -2
View File
@@ -109,15 +109,17 @@ typedef enum
} gamecontrols_e;
// 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_turnsmooth[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_gamepadledifunfocused;
extern consvar_t cv_rumbleifunfocused;
extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
+9 -15
View File
@@ -214,7 +214,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
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
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
// the rendering backend to draw them.
void HWR_RenderBatches(boolean sort)
void HWR_RenderBatches(void)
{
int finalVertexWritePos = 0; // position in finalVertexArray
int finalIndexWritePos = 0; // position in finalVertexIndexArray
@@ -288,13 +288,10 @@ void HWR_RenderBatches(boolean sort)
polygonArraySorted[i] = &polygonArray[i];
}
if (sort)
{
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
PS_STOP_TIMING(ps_hw_batchsorttime);
}
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
PS_STOP_TIMING(ps_hw_batchsorttime);
// sort order
// 1. shader
@@ -303,9 +300,7 @@ void HWR_RenderBatches(boolean sort)
// 4. colors + light level
// not sure about what order of the last 2 should be, or if it even matters
// dont overwrite this on consecutive calls
if (!sort)
PS_START_TIMING(ps_hw_batchdrawtime);
PS_START_TIMING(ps_hw_batchdrawtime);
currentShader = polygonArraySorted[0]->shader;
currentTexture = polygonArraySorted[0]->texture;
@@ -396,7 +391,7 @@ void HWR_RenderBatches(boolean sort)
nextSurfaceInfo = nextEntry->surf;
if (nextPolyFlags & PF_NoTexture)
nextTexture = 0;
nextTexture = NULL;
if (useshader && currentShader != nextShader)
{
@@ -500,8 +495,7 @@ void HWR_RenderBatches(boolean sort)
polygonArraySize = 0;
unsortedVertexArraySize = 0;
if (!sort)
PS_STOP_TIMING(ps_hw_batchdrawtime);
PS_STOP_TIMING(ps_hw_batchdrawtime);
}
#endif // HWRENDER
+1 -1
View File
@@ -37,7 +37,7 @@ typedef struct
void HWR_StartBatching(void);
void HWR_SetCurrentTexture(GLMipmap_t *texture);
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
} // extern "C"
+2 -5
View File
@@ -619,7 +619,6 @@ static void HWR_PrecacheLevelFlats(void)
// lookup for flats that may´ve been already loaded
// too lazy to make a hashtable or smth so unordered set will do :carbuncle:
std::unordered_set<UINT32> flatpresent;
lumpnum_t lump;
size_t i, j;
INT32 k;
@@ -649,9 +648,8 @@ static void HWR_PrecacheLevelFlats(void)
const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
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 ?
{
@@ -672,9 +670,8 @@ static void HWR_PrecacheLevelFlats(void)
for (i = 0; i < numlevelflats; 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 ?
{
+1 -1
View File
@@ -335,7 +335,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
floatangle = 2.0 + (45.0 + ((double)tilt / 1.9)) * clipfov / 90.0;
if (floatangle >= 180.0)
return 0xffffffff;
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
a1 = (angle_t)lrint(ANG1 * floatangle);
return a1;
}
+3
View File
@@ -80,6 +80,9 @@ UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
void GL_ClearLightTables(void);
void GL_SetScreenPalette(RGBA_t *palette);
void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex,
FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
#ifdef __cplusplus
} // extern "C"
#endif
+244 -201
View File
@@ -101,7 +101,8 @@ sector_t *gl_backsector = NULL;
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
// values for bsp culling
// slightly higher than the far clipping plane to compensate for impreciseness
static constexpr INT32 bsp_culling_distances[] = {(1024+512)*FRACUNIT, (2048+512)*FRACUNIT, (4096+512)*FRACUNIT,
static constexpr INT32 bsp_culling_distances[] = {
(1024+512)*FRACUNIT, (2048+512)*FRACUNIT, (4096+512)*FRACUNIT,
(6144+512)*FRACUNIT, (8192+512)*FRACUNIT, (12288+512)*FRACUNIT, (16384+512)*FRACUNIT};
// Performance stats
@@ -587,15 +588,11 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
// Get the slope pointer to simplify future code
if (sec->f_slope && !isceiling)
if (!isceiling && sec->f_slope)
slope = sec->f_slope;
else if (sec->c_slope && isceiling)
else if (isceiling && sec->c_slope)
slope = sec->c_slope;
// Set fixedheight to the slope's height from our viewpoint, if we have a slope
if (slope)
fixedheight = P_GetSlopeZAt(slope, viewx, viewy);
height = FixedToFloat(fixedheight);
// Allocate plane-vertex buffer if we need to
@@ -643,8 +640,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
pv = planepoly->pts;
// reference point for flat texture coord for each vertex around the polygon
flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize);
flatxref = static_cast<float>(static_cast<fixed_t>(pv->x) & (~flatflag)) / fflatsize;
flatyref = static_cast<float>(static_cast<fixed_t>(pv->y) & (~flatflag)) / fflatsize;
if (!isceiling) // it's a floor
{
@@ -661,9 +658,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
{
// This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = flatxref;
tempytow = flatyref;
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);
sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
@@ -683,18 +684,19 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
vert->s = (tempxsow * cosangf) - (tempytow * sinangf);\
vert->t = (tempxsow * sinangf) + (tempytow * cosangf);\
}\
\
if (slope)\
{\
fixedheight = P_GetSlopeZAt(slope, FloatToFixed((vx)), FloatToFixed((vy)));\
height = FixedToFloat(fixedheight);\
}\
\
vert->x = (vx);\
vert->y = height;\
vert->z = (vy);\
\
if (slope)\
{\
fixedheight = P_GetSlopeZAt(slope, FloatToFixed((vx)), FloatToFixed((vy)));\
vert->y = FixedToFloat(fixedheight);\
}\
}
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++)
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++, pv++)
SETUP3DVERT(v3d, pv->x, pv->y);
if (slope)
@@ -807,6 +809,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
}
}
}
#undef SETUP3DVERT
}
#ifdef WALLSPLATS
@@ -1366,8 +1369,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// x offset the texture
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
const float cliplow = (float)texturehpeg;
const float cliphigh = ((float)texturehpeg + (float)gl_curline->length);
const float cliplow = static_cast<float>(texturehpeg);
const float cliphigh = static_cast<float>(texturehpeg) + static_cast<float>(gl_curline->length);
FUINT lightnum = gl_frontsector->lightlevel;
extracolormap_t *colormap = gl_frontsector->extra_colormap;
@@ -1381,8 +1384,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
GLMapTexture_t *glTex = NULL;
static constexpr float FLOATMAX = (float)INT32_MAX / (float)FRACUNIT;
static constexpr float FLOATMIN = (float)INT32_MIN / (float)FRACUNIT;
static constexpr float FLOATMAX = static_cast<float>(INT32_MAX) / static_cast<float>(FRACUNIT);
static constexpr float FLOATMIN = static_cast<float>(INT32_MIN) / static_cast<float>(FRACUNIT);
// two sided line
if (gl_backsector)
@@ -1495,8 +1498,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_toptexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg) * 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[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1504,23 +1507,23 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[3].t -= (worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= (worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= (worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= (worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[3].t -= static_cast<float>(worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= static_cast<float>(worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGTOP)
{
// Skewed by top
wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
wallVerts[0].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
}
else
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - static_cast<float>(worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldtopslope - worldhighslope) * glTex->scaleY;
}
// set top/bottom coords
@@ -1557,8 +1560,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_bottomtexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg * 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[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1566,22 +1569,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[0].t -= (worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= (worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= (worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= (worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[0].t -= static_cast<float>(worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= static_cast<float>(worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldlowslope - worldbottomslope) * glTex->scaleY;
}
else
{
// Skewed by top
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
wallVerts[0].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
}
// set top/bottom coords
@@ -1743,13 +1746,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_midtexture, noencore);
// Left side
wallVerts[3].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
wallVerts[3].t = static_cast<float>(texturevpeg * glTex->scaleY);
wallVerts[0].t = static_cast<float>(h - l + texturevpeg) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
// Right side
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;
// set top/bottom coords
@@ -1780,10 +1783,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// Single sided line... Deal only with the middletexture (if one exists)
if (gl_midtexture && gl_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL
{
glTex = HWR_GetTexture(gl_midtexture, noencore);
fixed_t texturevpeg;
glTex = HWR_GetTexture(gl_midtexture, noencore);
// PEGGING
if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2))
texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset;
@@ -1792,28 +1795,28 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
texturevpeg = gl_sidedef->rowoffset; // top of texture at top
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * 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[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
// Texture correction for slopes
if (gl_linedef->flags & ML_EFFECT2)
{
wallVerts[3].t += (gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += (gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
wallVerts[3].t += static_cast<float>(gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += static_cast<float>(gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += static_cast<float>(gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += static_cast<float>(gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t + static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + static_cast<float>((worldbottomslope - worldtopslope)) * glTex->scaleY;
}
else
{
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[3].t - static_cast<float>(worldbottom - worldtop) * 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
@@ -1870,12 +1873,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
//Hurdler: 3d-floors test
if (!gl_drawing_stencil && gl_backsector && gl_frontsector->tag != gl_backsector->tag && (gl_backsector->ffloors || gl_frontsector->ffloors))
{
ffloor_t * rover;
fixed_t highcut = 0, lowcut = 0;
ffloor_t *rover;
fixed_t highcut = 0, lowcut = 0;
fixed_t lowcutslope = 0, highcutslope = 0;
// Used for height comparisons and etc across FOFs and slopes
fixed_t high1, highslope1, low1, lowslope1;
fixed_t high2, highslope2, low2, lowslope2;
INT32 texnum;
@@ -1888,19 +1892,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
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;
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || (roverflags & FF_INVERTSIDES))
@@ -1912,6 +1903,45 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
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);
boolean do_texture_skew;
@@ -1978,24 +2008,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
}
}
@@ -2048,19 +2078,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
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;
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES))
@@ -2072,6 +2089,44 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
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);
boolean do_texture_skew;
@@ -2138,24 +2193,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
}
}
@@ -2496,8 +2551,10 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord)
// Find the corners of the box
// that define the edges from current viewpoint.
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5)
return true;
@@ -2617,6 +2674,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
INT32 flatflag;
size_t len;
float scrollx = 0.0f, scrolly = 0.0f;
float anglef = 0.0f, cosangf = 0.0f, sinangf = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
@@ -2638,12 +2696,14 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
return;
}
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
// Allocate plane-vertex buffer if we need to
if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts)
{
numAllocedPlaneVerts = (UINT16)nrPlaneVerts;
Z_Free(planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof(FOutVector), PU_LEVEL, &planeVerts);
}
height = FixedToFloat(fixedheight);
@@ -2686,72 +2746,51 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
flatxref = FixedToFloat(polysector->origVerts[0].x);
flatyref = FixedToFloat(polysector->origVerts[0].y);
flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize);
flatxref = static_cast<float>(static_cast<fixed_t>(flatxref) & (~flatflag)) / fflatsize;
flatyref = static_cast<float>(static_cast<fixed_t>(flatyref) & (~flatflag)) / fflatsize;
// transform
v3d = planeVerts;
if (FOFsector != NULL)
if (!isceiling) // it's a floor
{
if (!isceiling) // it's a floor
{
scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->floor_yoffs)/fflatsize;
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(FOFsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->ceiling_yoffs)/fflatsize;
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
scrollx = FixedToFloat(sec->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(sec->floor_yoffs)/fflatsize;
angle = sec->floorpic_angle;
}
else if (gl_frontsector)
else // it's a ceiling
{
if (!isceiling) // it's a floor
{
scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->floor_yoffs)/fflatsize;
angle = gl_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(gl_frontsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->ceiling_yoffs)/fflatsize;
angle = gl_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
scrollx = FixedToFloat(sec->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(sec->ceiling_yoffs)/fflatsize;
angle = sec->ceilingpic_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 = FloatToFixed(scrollx);
tempytow = FloatToFixed(scrolly);
scrollx = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
scrolly = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
tempxsow = flatxref;
tempytow = flatyref;
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
tempxsow = FloatToFixed(flatxref);
tempytow = FloatToFixed(flatyref);
flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
cosangf = cosf(anglef);
sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
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
v3d->s = (float)((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's 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
// Go from the polysector's original vertex locations
// 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
if (angle) // Only needs to be done if there's an altered angle
{
tempxsow = FloatToFixed(v3d->s);
tempytow = FloatToFixed(v3d->t);
v3d->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
v3d->t = (FixedToFloat(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
tempxsow = v3d->s;
tempytow = v3d->t;
v3d->s = (tempxsow * cosangf) - (tempytow * sinangf);
v3d->t = (tempxsow * sinangf) + (tempytow * cosangf);
}
v3d->x = FixedToFloat(polysector->vertices[i]->x);
@@ -2906,7 +2945,7 @@ static void HWR_Subsector(size_t num)
static sector_t tempsec; //SoM: 4/7/2000
INT32 floorlightlevel;
INT32 ceilinglightlevel;
INT32 locFloorHeight, locCeilingHeight;
INT32 locFloorHeight = 0, locCeilingHeight = 0;
INT32 cullFloorHeight, cullCeilingHeight;
INT32 light = 0;
extracolormap_t *floorcolormap;
@@ -2952,11 +2991,12 @@ static void HWR_Subsector(size_t num)
cullFloorHeight = P_GetSectorFloorZAt (gl_frontsector, viewx, viewy);
cullCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, viewx, viewy);
locFloorHeight = P_GetSectorFloorZAt (gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
locCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
if (gl_frontsector->ffloors)
{
locFloorHeight = P_GetSectorFloorZAt (gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
locCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
boolean anyMoved = gl_frontsector->moved;
if (anyMoved == false)
@@ -3011,8 +3051,7 @@ static void HWR_Subsector(size_t num)
{
HWR_GetFlat(levelflats[gl_frontsector->floorpic].lumpnum, R_NoEncore(gl_frontsector, false));
HWR_RenderPlane(sub, &extrasubsectors[num], false,
// Hack to make things continue to work around slopes.
locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight,
gl_frontsector->floorheight,
// We now return you to your regularly scheduled rendering.
PF_Occlude, floorlightlevel, levelflats[gl_frontsector->floorpic].lumpnum, NULL, 255, floorcolormap);
}
@@ -3027,8 +3066,7 @@ static void HWR_Subsector(size_t num)
{
HWR_GetFlat(levelflats[gl_frontsector->ceilingpic].lumpnum, R_NoEncore(gl_frontsector, true));
HWR_RenderPlane(sub, &extrasubsectors[num], true,
// Hack to make things continue to work around slopes.
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight,
gl_frontsector->ceilingheight,
// We now return you to your regularly scheduled rendering.
PF_Occlude, ceilinglightlevel, levelflats[gl_frontsector->ceilingpic].lumpnum, NULL, 255, ceilingcolormap);
}
@@ -3458,13 +3496,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)
{
// 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
swallVerts[3].x = spr->x1 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
swallVerts[3].x = spr->x1 + ((static_cast<float>(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 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
}
else
{
@@ -3472,10 +3510,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);
// 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[2].x = spr->x2 + (gpatch->height + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (gpatch->height + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + (gpatch->height + offset) * gl_viewsin;
swallVerts[3].x = spr->x1 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (static_cast<float>(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
@@ -3745,8 +3783,15 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
}
if (cv_playerfade.value && sprmo->player)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(sprmo), Surf.PolyColor.s.alpha);
if (sprmo->player)
{
// make hyu´d players translucent with reducevfx, could be done better, but im lazy as crap
if (cv_reducevfx.value && sprmo->player->kartstuff[k_hyudorotimer] > 0)
Surf.PolyColor.s.alpha = FixedMul(FRACUNIT/2, Surf.PolyColor.s.alpha);
if (cv_playerfade.value)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(sprmo), Surf.PolyColor.s.alpha);
}
if (HWR_UseShader())
{
@@ -4035,8 +4080,15 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
}
if (cv_playerfade.value && sprmo->player)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(sprmo), Surf.PolyColor.s.alpha);
if (sprmo->player)
{
// make hyu´d players translucent with reducevfx, could be done better, but im lazy as crap
if (cv_reducevfx.value && sprmo->player->kartstuff[k_hyudorotimer] > 0)
Surf.PolyColor.s.alpha = FixedMul(FRACUNIT/2, Surf.PolyColor.s.alpha);
if (cv_playerfade.value)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(sprmo), Surf.PolyColor.s.alpha);
}
if (HWR_UseShader())
{
@@ -4406,9 +4458,6 @@ static void HWR_RenderDrawNodes(void)
// Okay! Let's draw it all! Woo!
GL_SetTransform(&atransform);
if (LIKELY(cv_glbatching.value))
HWR_StartBatching();
for (i = 0; i < numdrawnodes; i++)
{
gl_drawnode_t *drawnode = &drawnodes[sortindex[i]];
@@ -4462,9 +4511,6 @@ static void HWR_RenderDrawNodes(void)
PS_STOP_TIMING(ps_hw_nodedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(false);
drawnodes.clear(); // clear so our size is 0 again!
}
@@ -5153,6 +5199,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
z2 = tr_y - x2 * rightsin;
x1 = tr_x + x1 * rightcos;
x2 = tr_x - x2 * rightcos;
//y1 = tr_y + y1 * rightcos;
//y2 = tr_y - y2 * rightcos;
//
// store information in a vissprite
@@ -5331,7 +5379,7 @@ void HWR_BuildSkyDome(void)
}
// 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)
{
@@ -5349,7 +5397,7 @@ static void HWR_DrawSkyBackground(void)
//04/01/2000: Hurdler: added for T&L
// It should replace all other gl_viewxxx when finished
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);
@@ -5394,9 +5442,9 @@ static void HWR_SetTransformAiming(FTransform *trans)
if (cv_glshearing.value)
{
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
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.125f; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
trans->shearing = true;
gl_aimingangle = 0;
}
@@ -5406,7 +5454,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
gl_aimingangle = aimingangle;
}
trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
trans->anglex = static_cast<float>(gl_aimingangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
}
void HWR_SetTransform(float fpov)
@@ -5425,11 +5473,11 @@ void HWR_SetTransform(float fpov)
atransform.z = gl_viewz;
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;
HWR_SetTransformAiming(&atransform);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
atransform.angley = static_cast<float>(viewangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
yaw = 270.0f - atransform.angley;
inv_yaw = 180.0f - yaw;
@@ -5440,8 +5488,8 @@ void HWR_SetTransform(float fpov)
// only needed for sprite billboarding
if (cv_glspritebillboarding.value && !cv_glshearing.value)
{
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle >> ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle >> ANGLETOFINESHIFT));
}
atransform.fovangle = fpov; // Tails
@@ -5469,7 +5517,6 @@ void HWR_SetTransform(float fpov)
void HWR_ClearClipper(void)
{
const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
gld_clipper_Clear();
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
#ifdef HAVE_SPHEREFRUSTRUM
@@ -5502,7 +5549,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
player_t *viewplayer = &players[displayplayers[viewssnum]];
const float fpov = FixedToFloat(R_GetPlayerFov(viewplayer));
auto reset_viewstate = [&](const float fpov)
auto reset_viewstate = [&]()
{
HWR_SetTransform(fpov);
HWR_ClearSprites();
@@ -5522,7 +5569,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
currentportallist = &portallist;
HWR_SetPortalState(GLPORTAL_SEARCH);
reset_viewstate(fpov);
reset_viewstate();
if (rootportal)
{
@@ -5548,13 +5595,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
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
reset_viewstate(fpov);
reset_viewstate();
if constexpr (Type == RenderViewpointType::kPortal)
{
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);
}
}
@@ -5604,7 +5651,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
PS_STOP_TIMING(ps_bsptime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(true);
HWR_RenderBatches();
// Check for new console commands.
NetUpdate();
@@ -5631,15 +5678,11 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
HWR_SortVisSprites();
PS_STOP_TIMING(ps_hw_spritesorttime);
PS_START_TIMING(ps_hw_spritedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_StartBatching();
if (UNLIKELY(cv_glmdls.value))
HWR_DrawSprites<DrawSpritesType::kModels>();
else
HWR_DrawSprites<DrawSpritesType::kSprites>();
PS_STOP_TIMING(ps_hw_spritedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(false);
ps_numdrawnodes.value.i = 0;
ps_hw_nodesorttime.value.p = 0;
@@ -5707,7 +5750,7 @@ static void HWR_RollTransform(FTransform *tr, angle_t roll)
{
if (roll != 0)
{
tr->rollangle = roll / (float)ANG1;
tr->rollangle = static_cast<float>(roll) / static_cast<float>(ANG1);
tr->roll = true;
tr->rollx = 1.0f;
tr->rollz = 0.0f;
@@ -6068,7 +6111,7 @@ static void HWR_DoPostProcessor(void)
const camera_t *thiscam = &camera[0];
// Not supported in splitscreen - someone want to add support?
const boolean screenwave = (!splitscreen && (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT));
const boolean screenwave = (!splitscreen && !cv_reducevfx.value && (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT));
// Capture the screen for intermission and screen waving
if ((lastdraw || screenwave) && gamestate != GS_INTERMISSION)
@@ -6107,7 +6150,7 @@ static void HWR_DoPostProcessor(void)
for (y = 0; y < SCREENVERTS; y++)
{
// 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)
}
}
+122 -3
View File
@@ -579,7 +579,7 @@ md2found:
fclose(f);
}
void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added after startup
void HWR_AddPlayerMD2(INT32 skin, boolean local) // For MD2's that were added after startup
{
FILE *f;
char name[20], filename[32];
@@ -1198,8 +1198,15 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
}
if (cv_playerfade.value && spr->mobj->player)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
if (spr->mobj->player)
{
// make hyu´d players translucent with reducevfx, could be done better, but im lazy as crap
if (cv_reducevfx.value && spr->mobj->player->kartstuff[k_hyudorotimer] > 0)
Surf.PolyColor.s.alpha = FixedMul(FRACUNIT/2, Surf.PolyColor.s.alpha);
if (cv_playerfade.value)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
}
// dont forget to enabled the depth test because we can't do this like
// before: polygons models are not sorted
@@ -1468,4 +1475,116 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
}
}
// mostly copy paste of HWR_DrawMD2
// very ugly but our model code kinda sucks
void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t color, const UINT8 *colormap, fixed_t scale, INT32 frame, angle_t angle)
{
patch_t *gpatch, *blendgpatch;
GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL;
FTransform p;
FSurfaceInfo Surf;
if (!md2->model)
{
char filename[64];
CONS_Debug(DBG_RENDER, "Loading model... (%s)\n", md2->filename);
sprintf(filename, "mdls/%s", md2->filename);
md2->model = md2_readModel(filename);
if (md2->model)
{
md2_printModelInfo(md2->model);
GL_CreateModelVBOs(md2->model);
}
else
{
md2->error = true;
return;
}
}
if (md2->model->meshes[0].numFrames > 0)
frame = frame % md2->model->meshes[0].numFrames;
else
frame = 0;
gpatch = (patch_t *)(md2->glpatch);
if (gpatch)
hwrPatch = ((GLPatch_t *)gpatch->hardware);
if (!gpatch || !hwrPatch ||
((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile))
md2_loadTexture(md2);
gpatch = (patch_t*)(md2->glpatch);
if (gpatch)
hwrPatch = ((GLPatch_t *)gpatch->hardware);
blendgpatch = (patch_t*)(md2->blendglpatch);
if (blendgpatch)
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
if ((gpatch && hwrPatch && hwrPatch->mipmap->format) &&
(!blendgpatch || !hwrBlendPatch ||
((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile)))
md2_loadBlendTexture(md2);
blendgpatch = (patch_t*)(md2->blendglpatch);
if (blendgpatch)
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
memset(&Surf, 0x00, sizeof(FSurfaceInfo));
Surf.PolyColor.rgba = 0xFFFFFFFF;
Surf.PolyFlags = PF_Occlude | PF_Modulated;
Surf.LightInfo.light_level = 255;
Surf.LightInfo.fade_start = 0;
Surf.LightInfo.fade_end = 31;
if (color != SKINCOLOR_NONE &&
blendgpatch && hwrBlendPatch->mipmap->format &&
gpatch->width == blendgpatch->width && gpatch->height == blendgpatch->height)
{
INT32 tcskinnum = TC_DEFAULT;
if (color)
tcskinnum = skinnum;
HWR_GetBlendedTexture(gpatch, blendgpatch, tcskinnum, colormap, color);
}
else if (hwrPatch && hwrPatch->mipmap->format)
{
GL_SetTexture(hwrPatch->mipmap);
}
memset(&p, 0x00, sizeof(FTransform));
p.x = x*vid.dup + (float)(vid.width - BASEVIDWIDTH*vid.dup)/2.f;
p.y = -420.f; // push it back to prevent wonky culling, idk lul
p.z = y*vid.dup + (float)(vid.height - BASEVIDHEIGHT*vid.dup)/2.f;
p.angley = FixedToFloat(AngleFixed(angle));
p.anglex = 0.f;
p.anglez = 0.f;
p.roll = false;
p.fliptype = TRANSFORM_NONE;
const float fscale = FixedToFloat(scale*vid.dup);
GL_Draw2DModel(
md2->model,
frame,
0.f,
0.f,
-1,
&p,
fscale,
fscale,
true, // flip it vertically lul
false,
&Surf
);
}
#endif //HWRENDER
+3
View File
@@ -45,6 +45,9 @@ void HWR_InitMD2(void);
void HWR_DrawMD2(gl_vissprite_t *spr);
void HWR_AddPlayerMD2(INT32 skin, boolean local);
void HWR_AddSpriteMD2(size_t spritenum);
void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum,
skincolors_t color, const UINT8 *colormap,
fixed_t scale, INT32 frame, angle_t angle);
#ifdef __cplusplus
} // extern "C"
+14 -14
View File
@@ -274,7 +274,7 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
if (!f)
return NULL;
retModel = (model_t*)Z_Calloc(sizeof(model_t), ztag, 0);
retModel = (model_t*)Z_Calloc(sizeof(model_t), ztag, NULL);
//size_t fileLen;
@@ -288,13 +288,13 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
{
texPos++;
namelen = strlen(texPos) + 1;
texturefilename = (char*)Z_Malloc(namelen, PU_CACHE, 0);
texturefilename = (char*)Z_Malloc(namelen, PU_CACHE, NULL);
strcpy(texturefilename, texPos);
}
else
{
namelen = strlen(fileName) + 1;
texturefilename = (char*)Z_Malloc(namelen, PU_CACHE, 0);
texturefilename = (char*)Z_Malloc(namelen, PU_CACHE, NULL);
strcpy(texturefilename, fileName);
}
@@ -316,7 +316,7 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
header = (md2header_t*)buffer;
retModel->numMeshes = 1; // MD2 only has one mesh
retModel->meshes = (mesh_t*)Z_Calloc(sizeof(mesh_t) * retModel->numMeshes, ztag, 0);
retModel->meshes = (mesh_t*)Z_Calloc(sizeof(mesh_t) * retModel->numMeshes, ztag, NULL);
retModel->meshes[0].numFrames = header->numFrames;
// const float WUNITS = 1.0f;
// float dataScale = WUNITS;
@@ -332,7 +332,7 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
if (retModel->numMaterials <= 0) // Always at least one skin, duh
retModel->numMaterials = 1;
retModel->materials = (material_t*)Z_Calloc(sizeof(material_t)*retModel->numMaterials, ztag, 0);
retModel->materials = (material_t*)Z_Calloc(sizeof(material_t)*retModel->numMaterials, ztag, NULL);
// int t;
for (t = 0; t < retModel->numMaterials; t++)
@@ -409,9 +409,9 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
float *uvptr;
dataScale = 0.015624f; // 1 / 64.0f
retModel->meshes[0].tinyframes = (tinyframe_t*)Z_Calloc(sizeof(tinyframe_t)*header->numFrames, ztag, 0);
retModel->meshes[0].tinyframes = (tinyframe_t*)Z_Calloc(sizeof(tinyframe_t)*header->numFrames, ztag, NULL);
retModel->meshes[0].numVertices = header->numXYZ;
retModel->meshes[0].uvs = (float*)Z_Malloc(sizeof(float) * 2 * retModel->meshes[0].numVertices, ztag, 0);
retModel->meshes[0].uvs = (float*)Z_Malloc(sizeof(float) * 2 * retModel->meshes[0].numVertices, ztag, NULL);
ptr = (char*)frames;
for (i = 0; i < header->numFrames; i++, ptr += header->framesize)
@@ -423,12 +423,12 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
md2vertex_t *vertex;
md2frame_t *framePtr = (md2frame_t*)ptr;
retModel->meshes[0].tinyframes[i].vertices = (short*)Z_Malloc(sizeof(short) * 3 * header->numXYZ, ztag, 0);
retModel->meshes[0].tinyframes[i].normals = (char*)Z_Malloc(sizeof(char) * 3 * header->numXYZ, ztag, 0);
retModel->meshes[0].tinyframes[i].vertices = (short*)Z_Malloc(sizeof(short) * 3 * header->numXYZ, ztag, NULL);
retModel->meshes[0].tinyframes[i].normals = (char*)Z_Malloc(sizeof(char) * 3 * header->numXYZ, ztag, NULL);
// if (retModel->materials[0].lightmap)
// retModel->meshes[0].tinyframes[i].tangents = (char*)malloc(sizeof(char));//(char*)Z_Malloc(sizeof(char)*3*header->numVerts, ztag);
retModel->meshes[0].indices = (unsigned short*)Z_Malloc(sizeof(unsigned short) * 3 * header->numTris, ztag, 0);
retModel->meshes[0].indices = (unsigned short*)Z_Malloc(sizeof(unsigned short) * 3 * header->numTris, ztag, NULL);
vertptr = retModel->meshes[0].tinyframes[i].vertices;
normptr = retModel->meshes[0].tinyframes[i].normals;
@@ -484,8 +484,8 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
char *ptr;
retModel->meshes[0].numVertices = header->numTris * 3;
retModel->meshes[0].frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t)*header->numFrames, ztag, 0);
retModel->meshes[0].uvs = (float*)Z_Malloc(sizeof(float) * 2 * retModel->meshes[0].numVertices, ztag, 0);
retModel->meshes[0].frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t)*header->numFrames, ztag, NULL);
retModel->meshes[0].uvs = (float*)Z_Malloc(sizeof(float) * 2 * retModel->meshes[0].numVertices, ztag, NULL);
trisPtr = tris;
uvptr = retModel->meshes[0].uvs;
@@ -507,8 +507,8 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
md2vertex_t *vertex;
md2frame_t *framePtr = (md2frame_t*)ptr;
retModel->meshes[0].frames[i].normals = (float*)Z_Malloc(sizeof(float) * 3 * header->numTris * 3, ztag, 0);
retModel->meshes[0].frames[i].vertices = (float*)Z_Malloc(sizeof(float) * 3 * header->numTris * 3, ztag, 0);
retModel->meshes[0].frames[i].normals = (float*)Z_Malloc(sizeof(float) * 3 * header->numTris * 3, ztag, NULL);
retModel->meshes[0].frames[i].vertices = (float*)Z_Malloc(sizeof(float) * 3 * header->numTris * 3, ztag, NULL);
// if (retModel->materials[0].lightmap)
// retModel->meshes[0].frames[i].tangents = (float*)malloc(sizeof(float));//(float*)Z_Malloc(sizeof(float)*3*header->numTris*3, ztag);
//float *vertptr, *normptr;
+12 -12
View File
@@ -168,7 +168,7 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat)
if (!f)
return NULL;
retModel = (model_t*)Z_Calloc(sizeof(model_t), ztag, 0);
retModel = (model_t*)Z_Calloc(sizeof(model_t), ztag, NULL);
// find length of file
fseek(f, 0, SEEK_END);
@@ -201,7 +201,7 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat)
if (retModel->numMaterials <= 0) // Always at least one skin, duh
retModel->numMaterials = 1;
retModel->materials = (material_t*)Z_Calloc(sizeof(material_t)*retModel->numMaterials, ztag, 0);
retModel->materials = (material_t*)Z_Calloc(sizeof(material_t)*retModel->numMaterials, ztag, NULL);
for (t = 0; t < retModel->numMaterials; t++)
{
@@ -225,7 +225,7 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat)
retModel->materials[t].spheremap = false;
}
retModel->meshes = (mesh_t*)Z_Calloc(sizeof(mesh_t)*retModel->numMeshes, ztag, 0);
retModel->meshes = (mesh_t*)Z_Calloc(sizeof(mesh_t)*retModel->numMeshes, ztag, NULL);
matCount = 0;
for (i = 0, surfEnd = 0; i < mdh->numSurfaces; i++)
@@ -298,9 +298,9 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat)
unsigned short *indexptr;
md3Triangle *mdT;
retModel->meshes[i].tinyframes = (tinyframe_t*)Z_Calloc(sizeof(tinyframe_t)*mdS->numFrames, ztag, 0);
retModel->meshes[i].tinyframes = (tinyframe_t*)Z_Calloc(sizeof(tinyframe_t)*mdS->numFrames, ztag, NULL);
retModel->meshes[i].numVertices = mdS->numVerts;
retModel->meshes[i].uvs = (float*)Z_Malloc(sizeof(float)*2*mdS->numVerts, ztag, 0);
retModel->meshes[i].uvs = (float*)Z_Malloc(sizeof(float)*2*mdS->numVerts, ztag, NULL);
for (j = 0; j < mdS->numFrames; j++)
{
short *vertptr;
@@ -308,12 +308,12 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat)
// char *tanptr;
int k;
md3Vertex *mdV = (md3Vertex*)((char*)mdS + mdS->offsetXYZNormal + (mdS->numVerts*j*sizeof(md3Vertex)));
retModel->meshes[i].tinyframes[j].vertices = (short*)Z_Malloc(sizeof(short)*3*mdS->numVerts, ztag, 0);
retModel->meshes[i].tinyframes[j].normals = (char*)Z_Malloc(sizeof(char)*3*mdS->numVerts, ztag, 0);
retModel->meshes[i].tinyframes[j].vertices = (short*)Z_Malloc(sizeof(short)*3*mdS->numVerts, ztag, NULL);
retModel->meshes[i].tinyframes[j].normals = (char*)Z_Malloc(sizeof(char)*3*mdS->numVerts, ztag, NULL);
// if (retModel->materials[0].lightmap)
// retModel->meshes[i].tinyframes[j].tangents = (char*)malloc(sizeof(char));//(char*)Z_Malloc(sizeof(char)*3*mdS->numVerts, ztag);
retModel->meshes[i].indices = (unsigned short*)Z_Malloc(sizeof(unsigned short) * 3 * mdS->numTriangles, ztag, 0);
retModel->meshes[i].indices = (unsigned short*)Z_Malloc(sizeof(unsigned short) * 3 * mdS->numTriangles, ztag, NULL);
vertptr = retModel->meshes[i].tinyframes[j].vertices;
normptr = retModel->meshes[i].tinyframes[j].normals;
@@ -374,16 +374,16 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat)
int k;
retModel->meshes[i].numVertices = mdS->numTriangles * 3;//mdS->numVerts;
retModel->meshes[i].frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t)*mdS->numFrames, ztag, 0);
retModel->meshes[i].uvs = (float*)Z_Malloc(sizeof(float)*2*mdS->numTriangles*3, ztag, 0);
retModel->meshes[i].frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t)*mdS->numFrames, ztag, NULL);
retModel->meshes[i].uvs = (float*)Z_Malloc(sizeof(float)*2*mdS->numTriangles*3, ztag, NULL);
for (j = 0; j < mdS->numFrames; j++)
{
float *vertptr;
float *normptr;
md3Vertex *mdV = (md3Vertex*)((char*)mdS + mdS->offsetXYZNormal + (mdS->numVerts*j*sizeof(md3Vertex)));
retModel->meshes[i].frames[j].vertices = (float*)Z_Malloc(sizeof(float)*3*mdS->numTriangles*3, ztag, 0);
retModel->meshes[i].frames[j].normals = (float*)Z_Malloc(sizeof(float)*3*mdS->numTriangles*3, ztag, 0);
retModel->meshes[i].frames[j].vertices = (float*)Z_Malloc(sizeof(float)*3*mdS->numTriangles*3, ztag, NULL);
retModel->meshes[i].frames[j].normals = (float*)Z_Malloc(sizeof(float)*3*mdS->numTriangles*3, ztag, NULL);
// if (retModel->materials[i].lightmap)
// retModel->meshes[i].frames[j].tangents = (float*)malloc(sizeof(float));//(float*)Z_Malloc(sizeof(float)*3*mdS->numTriangles*3, ztag);
vertptr = retModel->meshes[i].frames[j].vertices;
+9 -9
View File
@@ -189,7 +189,7 @@ model_t *LoadModel(const char *filename, int ztag)
return NULL;
}
model->mdlFilename = (char*)Z_Malloc(strlen(filename)+1, ztag, 0);
model->mdlFilename = (char*)Z_Malloc(strlen(filename)+1, ztag, NULL);
strcpy(model->mdlFilename, filename);
Optimize(model);
@@ -237,7 +237,7 @@ void GenerateVertexNormals(model_t *model)
{
mdlframe_t *frame = &mesh->frames[j];
int memTag = PU_STATIC;
float *newNormals = (float*)Z_Malloc(sizeof(float)*3*mesh->numTriangles*3, memTag, 0);
float *newNormals = (float*)Z_Malloc(sizeof(float)*3*mesh->numTriangles*3, memTag, NULL);
int k;
float *vertPtr = frame->vertices;
float *oldNormals;
@@ -309,7 +309,7 @@ static boolean AddMaterialToList(materiallist_t **head, material_t *material)
}
// Didn't find it, so add to the list
newMatNode = (materiallist_t*)Z_Malloc(sizeof(materiallist_t), PU_CACHE, 0);
newMatNode = (materiallist_t*)Z_Malloc(sizeof(materiallist_t), PU_CACHE, NULL);
newMatNode->material = material;
ListAdd(newMatNode, (listitem_t**)head);
return true;
@@ -351,7 +351,7 @@ void Optimize(model_t *model)
}
memTag = PU_STATIC;
newMeshes = (mesh_t*)Z_Calloc(sizeof(mesh_t) * numMeshes, memTag, 0);
newMeshes = (mesh_t*)Z_Calloc(sizeof(mesh_t) * numMeshes, memTag, NULL);
i = 0;
for (node = matListHead; node; node = node->next)
@@ -377,14 +377,14 @@ void Optimize(model_t *model)
newMesh->numFrames = 1;
newMesh->numTriangles = numTriangles;
newMesh->numVertices = numTriangles * 3;
newMesh->uvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, 0);
newMesh->frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t), memTag, 0);
newMesh->uvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, NULL);
newMesh->frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t), memTag, NULL);
curFrame = &newMesh->frames[0];
curFrame->material = curMat;
curFrame->normals = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
curFrame->vertices = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
curFrame->colors = (char*)Z_Malloc(sizeof(char)*4*numTriangles*3, memTag, 0);
curFrame->normals = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, NULL);
curFrame->vertices = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, NULL);
curFrame->colors = (char*)Z_Malloc(sizeof(char)*4*numTriangles*3, memTag, NULL);
// Now traverse the meshes of the model, adding in
// vertices/normals/uvs that match the current material
+77 -30
View File
@@ -98,10 +98,10 @@ static size_t textureBufferSize = 0;
static LTListItem *LightTablesTail = NULL;
static LTListItem *LightTablesHead = NULL;
static RGBA_t screenPalette[256] = {0}; // the palette for the postprocessing step in palette rendering
static RGBA_t screenPalette[256] = {}; // the palette for the postprocessing step in palette rendering
static GLuint screenPaletteTex = 0; // 1D texture containing the screen palette
static GLuint paletteLookupTex = 0; // 3D texture containing RGB -> palette index lookup table
RGBA_t myPaletteData[256] = {0}; // the palette for converting textures to RGBA
RGBA_t myPaletteData[256] = {}; // the palette for converting textures to RGBA
static GLint gltexformat = GL_RGB5_A1;
GLint screen_width = 0; // used by Draw2DLine()
@@ -127,9 +127,9 @@ GLuint gl_num_extensions;
int majorGL = 0, minorGL = 0;
//Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-)
GLfloat modelMatrix[16] = {0};
GLfloat projMatrix[16] = {0};
static GLint viewport[4];
GLfloat modelMatrix[16] = {};
GLfloat projMatrix[16] = {};
static GLint viewport[4];
#ifdef USE_FBO_OGL
enum
@@ -171,7 +171,7 @@ boolean supportstencil = false;
// flush all of the stored textures, leaving them unavailable at times such as between levels
// These need to start at 0 and be set to their number, and be reset to 0 when deleted so that Intel GPUs
// can know when the textures aren't there, as textures are always considered resident in their virtual memory
static GLuint screenTextures[NUMSCREENTEXTURES] = {0};
static GLuint screenTextures[NUMSCREENTEXTURES] = {};
#define byte2float(byte) (GLfloat)(byte / 255.0f)
@@ -404,6 +404,14 @@ static PFNglEnableClientState pglEnableClientState;
typedef void (APIENTRY * PFNglDisableClientState) (GLenum cap);
static PFNglDisableClientState pglDisableClientState;
typedef void (APIENTRY * PFNglOrtho) (GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top,
GLdouble nearVal,
GLdouble farVal);
static PFNglOrtho pglOrtho;
/* Lighting */
typedef void (APIENTRY * PFNglShadeModel) (GLenum mode);
static PFNglShadeModel pglShadeModel;
@@ -745,7 +753,7 @@ typedef struct gl_shaderstate_s
static gl_shaderstate_t gl_shaderstate;
// Shader info
static float shader_leveltime = 0;
static float shader_leveltime = 0.0f;
static float shader_light_x = 0.0f;
static float shader_light_y = 0.0f;
static float shader_light_z = 0.0f;
@@ -858,6 +866,8 @@ void SetupGLFunc4(void)
GetGLfunc(glUniform3fv);
GetGLfunc(glGetUniformLocation);
GetGLfunc(glOrtho);
#ifdef GLDEBUGMESSAGE
GetGLfunc(glDebugMessageCallback);
#endif
@@ -2209,16 +2219,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_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_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_2
@@ -3096,6 +3100,39 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
pglDisable(GL_NORMALIZE);
}
void GL_Draw2DModel(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex,
FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
{
// save our matrix´s
pglMatrixMode(GL_PROJECTION);
pglPushMatrix();
pglMatrixMode(GL_MODELVIEW);
pglPushMatrix();
pglMatrixMode(GL_PROJECTION);
pglLoadIdentity();
// switch to ortho mode to make our lives easier
// thisll make sure our coords will be remapped to pixel coords
pglOrtho(0.0f, (float)vid.width, (float)vid.height, 0.0f, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
pglMatrixMode(GL_MODELVIEW);
pglLoadIdentity();
pglEnable(GL_DEPTH_TEST);
pglDepthMask(GL_TRUE);
pglClear(GL_DEPTH_BUFFER_BIT);
GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex,
pos, hscale, vscale, flipped, hflipped, Surface);
// restore the matrix´s
pglMatrixMode(GL_PROJECTION);
pglPopMatrix();
pglMatrixMode(GL_MODELVIEW);
pglPopMatrix();
}
// -----------------+
// SetTransform :
// -----------------+
@@ -3554,22 +3591,30 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
1.0f, -1.0f, 1.0f
};
xfix = 1/((float)screen_texsizew/(float)screen_width);
yfix = 1/((float)screen_texsizeh/(float)screen_height);
const GLfloat scrwf = (float)screen_width;
const GLfloat scrwh = (float)screen_height;
xfix = 1/((float)screen_texsizew/scrwf);
yfix = 1/((float)screen_texsizeh/scrwh);
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
// Slight fuzziness
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
const float stride = 2.f/scrwh;
uint32_t r = rand();
for (i = 0; i < 1; i += stride)
const float ystep = 2.f/scrwh * (float)vid.udup/4.f;
for (i = 0; i < 1; i += ystep)
{
fix[2] = (float)(rand() % 128) / -22000.f * xfix;
// avoid calling rand thousands of times
r ^= r >> 13;
r ^= r >> 11;
r ^= r << 21;
fix[2] = (float)(r & 127) / -22000.f * xfix;
fix[0] = fix[2];
fix[6] = fix[0] + xfix;
fix[4] = fix[2] + xfix;
@@ -3587,8 +3632,8 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
}
// Upward bar
//GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
//pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
color[0] = color[1] = color[2] = 190;
color[3] = 250;
@@ -3611,13 +3656,14 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
fix[1] = fix[7] += (fix[3] - fix[7])*2;
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
// Downward bar
//GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
//pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
fix[0] = 0.0f;
fix[6] = xfix;
@@ -3636,6 +3682,7 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
fix[1] = fix[7] += (fix[3] - fix[7])*2;
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
@@ -3675,7 +3722,7 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
{
float xfix, yfix;
float origaspect, newaspect;
float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen
float xoff = 1.0f, yoff = 1.0f; // xoffset and yoffset for the polygon to have black bars around the screen
static float off[12] =
{
@@ -3698,19 +3745,19 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
if (origaspect < newaspect)
{
xoff = origaspect / newaspect;
yoff = 1;
yoff = 1.0f;
}
else if (origaspect > newaspect)
{
xoff = 1;
xoff = 1.0f;
yoff = newaspect / origaspect;
}
// float off[12];
off[0] = off[3] = -xoff;
off[1] = off[10] = -yoff;
off[4] = off[7] = yoff;
off[6] = off[9] = xoff;
off[4] = off[7] = yoff;
off[6] = off[9] = xoff;
// float fix[8];
fix[3] = fix[5] = yfix;
+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
#ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED
#include <SDL3/SDL_opengl.h> //Alam_GBC: Simple, yes?
#include "SDL_opengl.h" //Alam_GBC: Simple, yes?
#else
#include <GL/gl.h>
+13 -13
View File
@@ -62,7 +62,7 @@ static int hms_started;
static char *hms_api;
#ifdef HAVE_THREADS
static I_mutex hms_api_mutex;
static I_Mutex hms_api_mutex;
#endif
static char *hms_server_token;
@@ -90,9 +90,9 @@ Printf_url (const char *url)
boolean startup;
#ifdef HAVE_THREADS
I_lock_mutex(&con_mutex);
I_LockMutex(&con_mutex);
startup = con_startup;
I_unlock_mutex(con_mutex);
I_UnlockMutex(con_mutex);
#else
startup = con_startup;
#endif
@@ -183,19 +183,19 @@ HMS_connect (const char *format, ...)
}
#ifdef HAVE_THREADS
I_lock_mutex(&hms_api_mutex);
I_LockMutex(&hms_api_mutex);
#endif
seek = strlen(hms_api) + 1;/* + '/' */
va_start (ap, format);
url = malloc(seek + vsnprintf(0, 0, format, ap) + sizeof HMS_QUERY_VERSION - 1 + token_length + 1);
url = malloc(seek + vsnprintf(NULL, 0, format, ap) + sizeof HMS_QUERY_VERSION - 1 + token_length + 1);
va_end (ap);
sprintf(url, "%s/", hms_api);
#ifdef HAVE_THREADS
I_unlock_mutex(hms_api_mutex);
I_UnlockMutex(hms_api_mutex);
#endif
va_start (ap, format);
@@ -471,18 +471,18 @@ HMS_fetch_servers (msg_server_t *list, int query_id)
*end = '\0';
address = strtok(p, " ");
port = strtok(0, " ");
contact = strtok(0, "");
port = strtok(NULL, " ");
contact = strtok(NULL, "");
if (address && port)
{
#ifdef HAVE_THREADS
I_lock_mutex(&ms_QueryId_mutex);
I_LockMutex(&ms_QueryId_mutex);
{
if (query_id != ms_QueryId)
doing_shit = 0;
}
I_unlock_mutex(ms_QueryId_mutex);
I_UnlockMutex(ms_QueryId_mutex);
if (! doing_shit)
break;
@@ -539,7 +539,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
if (HMS_do(hms))
{
version = strtok(hms->buffer, " ");
version_name = strtok(0, "\n");
version_name = strtok(NULL, "\n");
if (version && version_name)
{
@@ -611,14 +611,14 @@ void
HMS_set_api (char *api)
{
#ifdef HAVE_THREADS
I_lock_mutex(&hms_api_mutex);
I_LockMutex(&hms_api_mutex);
#endif
{
free(hms_api);
hms_api = Strip_trailing_slashes(api);
}
#ifdef HAVE_THREADS
I_unlock_mutex(hms_api_mutex);
I_UnlockMutex(hms_api_mutex);
#endif
}
+16 -13
View File
@@ -1072,8 +1072,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
HU_AddChatText(va(fmt2, prefix, cstart, dispname, textcolor, msg), cv_chatnotifications.value); // add to chat
if (tempchar)
Z_Free(tempchar);
Z_Free(tempchar);
}
#ifdef _DEBUG
// I just want to point out while I'm here that because the data is still
@@ -1484,6 +1483,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
x = 0;
}
}
return newstring;
}
@@ -1522,7 +1522,7 @@ static void HU_drawMiniChat(void)
emote_t *emote = NULL;
int emotelen = 0;
while(msg[j]) // iterate through msg
while (msg[j]) // iterate through msg
{
if (msg[j] < HU_FONTSTART) // don't draw
{
@@ -1554,19 +1554,21 @@ static void HU_drawMiniChat(void)
{
j++;
}
prev_linereturn = false;
dx += charwidth;
if (dx >= boxw)
{
dx = 0;
linescount += 1;
}
}
dy = 0;
dx = 0;
msglines += linescount+1;
if (msg)
Z_Free(msg);
Z_Free(msg);
}
y = chaty - charheight*(msglines+1);
@@ -1598,7 +1600,7 @@ static void HU_drawMiniChat(void)
emote_t *emote = NULL;
int emotelen = 0;
while(msg[j]) // iterate through msg
while (msg[j]) // iterate through msg
{
if (msg[j] < HU_FONTSTART) // don't draw
{
@@ -1643,16 +1645,17 @@ static void HU_drawMiniChat(void)
dx += charwidth;
prev_linereturn = false;
if (dx >= boxw)
{
dx = 0;
dy += charheight;
}
}
dy += charheight;
dx = 0;
if (msg)
Z_Free(msg);
Z_Free(msg);
}
// decrement addy and make that shit smooth:
@@ -1704,7 +1707,7 @@ static void HU_drawChatLog(INT32 offset)
V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box
for (i=0; i<chat_nummsg_log; i++) // iterate through our chatlog
for (i = 0; i < chat_nummsg_log; i++) // iterate through our chatlog
{
INT32 clrflag = 0;
INT32 j = 0;
@@ -1713,7 +1716,7 @@ static void HU_drawChatLog(INT32 offset)
emote_t *emote = NULL;
int emotelen = 0;
while(msg[j]) // iterate through msg
while (msg[j]) // iterate through msg
{
if (msg[j] < HU_FONTSTART) // don't draw
{
@@ -1738,7 +1741,7 @@ static void HU_drawChatLog(INT32 offset)
{
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;
}
j += emotelen;
@@ -1758,10 +1761,10 @@ static void HU_drawChatLog(INT32 offset)
dy += charheight;
}
}
dy += charheight;
dx = 0;
if (msg)
Z_Free(msg);
Z_Free(msg);
}
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
+2 -2
View File
@@ -80,6 +80,8 @@ typedef struct
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
extern doomcom_t *doomcom;
#ifdef HOLEPUNCH
typedef struct
{
@@ -91,8 +93,6 @@ typedef struct
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
#endif
extern doomcom_t *doomcom;
/** \brief return packet in doomcom struct
*/
extern boolean (*I_NetGet)(void);
+2
View File
@@ -158,6 +158,8 @@ UINT32 I_GetSongLoopPoint(void);
boolean I_SetSongPosition(UINT32 position);
UINT32 I_GetSongPosition(void);
void I_UpdateSongLagThreshold (void);
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
+4
View File
@@ -29,6 +29,10 @@ extern "C" {
*/
#define MAX_QUIT_FUNCS 16
void I_GetConsoleEvents(void);
extern boolean consolevent;
extern boolean framebuffer;
/** \brief Graphic system had started up
*/
+10 -15
View File
@@ -568,13 +568,12 @@ void Command_Numnodes(void)
#ifdef HOLEPUNCH
/* not one of the reserved "local" addresses */
static boolean
is_external_address (UINT32 p)
static boolean is_external_address(UINT32 p)
{
UINT8 a = (p & 255);
UINT8 b = ((p >> 8) & 255);
if (p == (UINT32)~0)/* 255.255.255.255 */
if (p == (UINT32)~0) /* 255.255.255.255 */
return 0;
switch (a)
@@ -584,7 +583,7 @@ is_external_address (UINT32 p)
case 127:
return false;
case 172:
return (b & ~15) != 16;/* 16 - 31 */
return (b & ~15) != 16; /* 16 - 31 */
case 192:
return b != 168;
default:
@@ -763,6 +762,7 @@ static void SOCK_Send(void)
if (myfamily[i] == broadcastaddress[j].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
if (c == ERRSOCKET)
{
e = errno;
@@ -780,6 +780,7 @@ static void SOCK_Send(void)
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET)
{
e = errno;
@@ -792,6 +793,7 @@ static void SOCK_Send(void)
else
{
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET)
{
e = errno;
@@ -1060,7 +1062,6 @@ static boolean UDP_Socket(void)
#endif
const char *serv;
for (s = 0; s < mysocketses; s++)
mysockets[s] = ERRSOCKET;
for (s = 0; s < MAXNETNODES+1; s++)
@@ -1509,11 +1510,8 @@ static boolean SOCK_SetBanUsername(const char *username)
username = "Direct IP ban";
}
if (banned[numbans - 1].username)
{
Z_Free(banned[numbans - 1].username);
banned[numbans - 1].username = NULL;
}
Z_Free(banned[numbans - 1].username);
banned[numbans - 1].username = NULL;
banned[numbans - 1].username = Z_StrDup(username);
@@ -1527,11 +1525,8 @@ static boolean SOCK_SetBanReason(const char *reason)
reason = "No reason given";
}
if (banned[numbans - 1].reason)
{
Z_Free(banned[numbans - 1].reason);
banned[numbans - 1].reason = NULL;
}
Z_Free(banned[numbans - 1].reason);
banned[numbans - 1].reason = NULL;
banned[numbans - 1].reason = Z_StrDup(reason);
+87 -59
View File
@@ -1,4 +1,4 @@
// SONIC ROBO BLAST 2
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2020-2023 by James R.
//
@@ -9,12 +9,14 @@
/// \file i_threads.c
/// \brief Multithreading abstraction
#if defined (__unix__) || (!defined(__APPLE__) && defined (UNIXCOMMON))
#ifdef HAVE_THREADS
#if defined (__unix__) || defined(UNIXCOMMON)
#include <pthread.h>
#include "../i_threads.h"
#include "../doomdef.h"
#include "i_threads.h"
#include "doomdef.h"
#include "doomtype.h"
typedef struct thread_s thread_t;
@@ -22,7 +24,7 @@ struct thread_s
{
thread_t *next;
void *userdata;
I_thread_fn func;
I_ThreadFn func;
pthread_t thread;
};
@@ -41,12 +43,8 @@ static void *HandleThread(void *data)
return NULL;
}
void
I_spawn_thread (
const char * name,
I_thread_fn entry,
void * userdata
)
FUNCWARNRV
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
{
thread_t *thread;
(void)name;
@@ -66,17 +64,20 @@ I_spawn_thread (
if (thread == NULL)
{
thread = malloc(sizeof(thread_t));
if (thread == NULL)
return false;
thread->next = thread_list;
thread_list = thread;
}
thread->func = entry;
thread->userdata = userdata;
pthread_create(&thread->thread, NULL, HandleThread, thread);
int err = pthread_create(&thread->thread, NULL, HandleThread, thread);
pthread_mutex_unlock(&thread_lock);
return err == 0;
}
int I_thread_is_stopped(void)
int I_ThreadIsStopped(void)
{
thread_t *thread;
pthread_mutex_lock(&thread_lock);
@@ -94,11 +95,11 @@ int I_thread_is_stopped(void)
return true;
}
void I_start_threads(void)
void I_StartThreads(void)
{
}
void I_stop_threads(void)
void I_StopThreads(void)
{
thread_t *thread = thread_list;
while (thread != NULL)
@@ -109,7 +110,7 @@ void I_stop_threads(void)
}
}
void I_lock_mutex(I_mutex *anchor)
void I_LockMutex(I_Mutex *anchor)
{
pthread_mutex_lock(&thread_lock);
if (*anchor == NULL)
@@ -127,25 +128,25 @@ void I_lock_mutex(I_mutex *anchor)
pthread_mutex_lock(*anchor);
}
void I_unlock_mutex(I_mutex id)
void I_UnlockMutex(I_Mutex id)
{
pthread_mutex_unlock(id);
}
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
{
I_Assert(mutex_id != NULL);
I_Assert(mutexId != NULL);
pthread_mutex_lock(&thread_lock);
if (*cond_anchor == NULL)
if (*condAnchor == NULL)
{
*cond_anchor = malloc(sizeof(pthread_cond_t));
pthread_cond_init(*cond_anchor, NULL);
*condAnchor = malloc(sizeof(pthread_cond_t));
pthread_cond_init(*condAnchor, NULL);
}
pthread_mutex_unlock(&thread_lock);
pthread_cond_wait(*cond_anchor, mutex_id);
pthread_cond_wait(*condAnchor, mutexId);
}
void I_wake_one_cond(I_cond *anchor)
void I_WakeOneCond(I_Cond *anchor)
{
pthread_mutex_lock(&thread_lock);
if (*anchor == NULL)
@@ -157,7 +158,7 @@ void I_wake_one_cond(I_cond *anchor)
pthread_cond_signal(*anchor);
}
void I_wake_all_cond(I_cond *anchor)
void I_WakeAllCond(I_Cond *anchor)
{
pthread_mutex_lock(&thread_lock);
if (*anchor == NULL)
@@ -168,12 +169,17 @@ void I_wake_all_cond(I_cond *anchor)
pthread_mutex_unlock(&thread_lock);
pthread_cond_broadcast(*anchor);
}
thread_handle_t I_GetCurrentThread(void)
{
return pthread_self();
}
#elif defined (_WIN32)
#include <windows.h>
#include "../i_threads.h"
#include "../doomdef.h"
#include "../doomtype.h"
#include "i_threads.h"
#include "doomdef.h"
#include "doomtype.h"
typedef struct thread_s thread_t;
@@ -181,9 +187,9 @@ struct thread_s
{
thread_t *next;
void *userdata;
I_thread_fn func;
I_ThreadFn func;
HANDLE thread;
DWORD thread_id;
DWORD threadId;
};
// we use a linked list to avoid moving memory blocks when allocating new threads.
@@ -201,7 +207,8 @@ static DWORD __stdcall HandleThread(void *data)
return 0;
}
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
FUNCWARNRV
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
{
thread_t *thread;
(void)name;
@@ -219,17 +226,20 @@ void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
if (thread == NULL)
{
thread = malloc(sizeof(thread_t));
if (thread == NULL)
return false;
thread->next = thread_list;
thread_list = thread;
}
thread->func = entry;
thread->userdata = userdata;
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->thread_id);
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->threadId);
LeaveCriticalSection(&thread_lock);
return thread->thread != NULL;
}
int I_thread_is_stopped(void)
int I_ThreadIsStopped(void)
{
thread_t *thread;
EnterCriticalSection(&thread_lock);
@@ -247,12 +257,12 @@ int I_thread_is_stopped(void)
return true;
}
void I_start_threads(void)
void I_StartThreads(void)
{
InitializeCriticalSection(&thread_lock);
}
void I_stop_threads(void)
void I_StopThreads(void)
{
thread_t *thread = thread_list;
while (thread != NULL)
@@ -264,7 +274,7 @@ void I_stop_threads(void)
DeleteCriticalSection(&thread_lock);
}
void I_lock_mutex(I_mutex *anchor)
void I_LockMutex(I_Mutex *anchor)
{
EnterCriticalSection(&thread_lock);
if (*anchor == NULL)
@@ -276,25 +286,25 @@ void I_lock_mutex(I_mutex *anchor)
EnterCriticalSection(*anchor);
}
void I_unlock_mutex(I_mutex id)
void I_UnlockMutex(I_Mutex id)
{
LeaveCriticalSection(id);
}
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
{
I_Assert(mutex_id != NULL);
I_Assert(mutexId != NULL);
EnterCriticalSection(&thread_lock);
if (*cond_anchor == NULL)
if (*condAnchor == NULL)
{
*cond_anchor = malloc(sizeof(CONDITION_VARIABLE));
InitializeConditionVariable(*cond_anchor);
*condAnchor = malloc(sizeof(CONDITION_VARIABLE));
InitializeConditionVariable(*condAnchor);
}
LeaveCriticalSection(&thread_lock);
SleepConditionVariableCS(*cond_anchor, mutex_id, INFINITE);
SleepConditionVariableCS(*condAnchor, mutexId, INFINITE);
}
void I_wake_one_cond(I_cond *anchor)
void I_WakeOneCond(I_Cond *anchor)
{
EnterCriticalSection(&thread_lock);
if (*anchor == NULL)
@@ -306,7 +316,7 @@ void I_wake_one_cond(I_cond *anchor)
WakeConditionVariable(*anchor);
}
void I_wake_all_cond(I_cond *anchor)
void I_WakeAllCond(I_Cond *anchor)
{
EnterCriticalSection(&thread_lock);
if (*anchor == NULL)
@@ -317,48 +327,66 @@ void I_wake_all_cond(I_cond *anchor)
LeaveCriticalSection(&thread_lock);
WakeAllConditionVariable(*anchor);
}
void *I_GetCurrentThread(void)
{
return GetCurrentThread();
}
#else
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
#include "i_threads.h"
FUNCWARNRV
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
{
(void)name;
entry(userdata);
return true;
}
int I_thread_is_stopped(void)
int I_ThreadIsStopped(void)
{
return true;
}
void I_StartThreads(void)
{
}
void I_start_threads(void)
void I_StopThreads(void)
{
}
void I_stop_threads(void)
{
}
void I_lock_mutex(I_mutex *anchor)
void I_LockMutex(I_Mutex *anchor)
{
(void)anchor;
}
void I_unlock_mutex(I_mutex id)
void I_UnlockMutex(I_Mutex id)
{
(void)id;
}
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
{
(void)cond_anchor;
(void)mutex_id;
(void)condAnchor;
(void)mutexId;
}
void I_wake_one_cond(I_cond *anchor)
void I_WakeOneCond(I_Cond *anchor)
{
(void)anchor;
}
void I_wake_all_cond(I_cond *anchor)
void I_WakeAllCond(I_Cond *anchor)
{
(void)anchor;
}
void *I_GetCurrentThread(void)
{
return NULL;
}
#endif
#endif // HAVE_THREADS
+25 -13
View File
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by James R.
// Copyright (C) 2020-2023 by James R.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -14,34 +14,46 @@
#ifndef I_THREADS_H
#define I_THREADS_H
#include "doomtype.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*I_thread_fn)(void *userdata);
typedef void (*I_ThreadFn)(void *userdata);
typedef void * I_mutex;
typedef void * I_cond;
typedef void * I_Mutex;
typedef void * I_Cond;
void I_start_threads (void);
void I_stop_threads (void);
#ifdef __linux__
typedef long unsigned int thread_handle_t;
#else
typedef void *thread_handle_t;
#endif
void I_spawn_thread (const char *name, I_thread_fn, void *userdata);
void I_StartThreads (void);
void I_StopThreads (void);
FUNCWARNRV
int I_SpawnThread (const char *name, I_ThreadFn, void *userdata);
/* check in your thread whether to return early */
int I_thread_is_stopped (void);
int I_ThreadIsStopped (void);
void I_lock_mutex (I_mutex *);
void I_unlock_mutex (I_mutex);
void I_LockMutex (I_Mutex *);
void I_UnlockMutex (I_Mutex);
void I_hold_cond (I_cond *, I_mutex);
void I_HoldCond (I_Cond *, I_Mutex);
void I_wake_one_cond (I_cond *);
void I_wake_all_cond (I_cond *);
void I_WakeOneCond (I_Cond *);
void I_WakeAllCond (I_Cond *);
thread_handle_t I_GetCurrentThread(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif/*I_THREADS_H*/
#endif/*HAVE_THREADS*/
+1 -1
View File
@@ -21,7 +21,7 @@
#include "m_fixed.h"
#include "i_system.h"
timestate_t g_time;
timestate_t g_time = {};
static CV_PossibleValue_t timescale_cons_t[] = {{FRACUNIT/20, "MIN"}, {20*FRACUNIT, "MAX"}, {0, NULL}};
consvar_t cv_timescale = {"timescale", "1.0", CV_NETVAR|CV_CHEAT|CV_FLOAT, timescale_cons_t, NULL, FRACUNIT, NULL, NULL, 0, 0, NULL};
+9 -4
View File
@@ -95,7 +95,6 @@ INT32 VID_SetMode(INT32 modenum);
*/
const char *VID_GetModeName(INT32 modenum);
void VID_RefreshModeList(void);
void VID_PrepareModeList(void);
/** \brief can video system do fullscreen
@@ -122,13 +121,10 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale);
UINT32 I_GetRefreshRate(void);
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height);
boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void);
void I_HandleControllerHatRepeat(void);
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void);
@@ -137,6 +133,15 @@ boolean UseScreenFBO(void);
extern boolean downsample;
#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
} // extern "C"
#endif
+2
View File
@@ -19,6 +19,8 @@
#include "sounds.h"
#include "m_fixed.h"
#define MAXDOOMEDNUM 4095
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
// For great modding!!
+6 -6
View File
@@ -568,7 +568,7 @@ static patch_t *kp_racefinish[6];
static patch_t *kp_positionnum[NUMPOSNUMS][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_rankbumper;
@@ -1065,7 +1065,7 @@ static void K_initKartHUD(void)
}
if (timeinmap > 113 || forceshowhud)
hudtrans = cv_translucenthud.value;
hudtrans = (UINT8)cv_translucenthud.value;
else if (timeinmap > 105)
hudtrans = ((((INT32)timeinmap) - 105)*cv_translucenthud.value)/(113-105);
else
@@ -1122,9 +1122,9 @@ void K_KartPlayerHUDUpdate(player_t *player)
UINT8 K_GetHudColor(void)
{
if (cv_colorizedhud.value && cv_colorizedhudcolor.value)
return cv_colorizedhudcolor.value;
return (UINT8)cv_colorizedhudcolor.value;
return ((stplyr && gamestate == GS_LEVEL) ? stplyr->skincolor : cv_playercolor.value);
return ((stplyr && gamestate == GS_LEVEL) ? stplyr->skincolor : (UINT8)cv_playercolor.value);
}
boolean K_UseColorHud(void)
@@ -1526,7 +1526,7 @@ static void K_drawKartItem(void)
{
localcolor = K_GetHudColor();
switch((stplyr->kartstuff[k_itemroulette] % (14*3)) / 3)
switch ((stplyr->kartstuff[k_itemroulette] % (14*3)) / 3)
{
// Each case is handled in threes, to give three frames of in-game time to see the item on the roulette
case 0: // Sneaker
@@ -2195,7 +2195,7 @@ static boolean K_drawKartPositionFaces(void)
return true;
if (!LUA_HudEnabled(hud_minirankings))
return false; // Don't proceed but still return true for free play above if HUD is disabled.
return false; // Don't proceed but still return true for free play above if HUD is disabled.
for (j = 0; j < numplayersingame; j++)
{
+3
View File
@@ -41,6 +41,9 @@ extern consvar_t cv_battlespeedo;
extern consvar_t cv_multiitemicon;
extern consvar_t cv_huditemamount;
// for use in timeattack menu
extern patch_t *kp_facenum[MAXPLAYERS+1];
#define NUMSPEEDOSTUFF 8
extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
#define NUMDGAUGESTUFF 6
+67 -63
View File
@@ -47,6 +47,8 @@ consvar_t cv_airsparks = {"airdriftsparks", "Off", CV_SAVE, CV_OnOff, NULL, 0, N
consvar_t cv_playerblendeffects = {"playerblendeffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_reducevfx = {"reducevfx", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// funn-E streeetch
static CV_PossibleValue_t stretchfactor_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
consvar_t cv_gravstretch = {"gravstretch", "MIN", CV_SAVE|CV_FLOAT, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -482,7 +484,8 @@ UINT8 colortranslations[MAXTRANSLATIONS][16] = {
//
UINT8 K_RainbowColor(void)
{
return (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
const tic_t time = cv_reducevfx.value ? (leveltime >> 3) : leveltime;
return (UINT8)(1 + (time % (MAXSKINCOLORS-1)));
}
// Define for getting accurate color brightness readings according to how the human eye sees them.
@@ -764,6 +767,8 @@ void K_RegisterClientKartStuff(void)
CV_RegisterVar(&cv_playerblendeffects);
CV_RegisterVar(&cv_reducevfx);
CV_RegisterVar(&cv_saltyhop);
CV_RegisterVar(&cv_saltyhopsfx);
CV_RegisterVar(&cv_saltysquish);
@@ -3103,17 +3108,18 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
return NULL;
}
static UINT16 K_DriftSparkColor(player_t *player, INT32 charge)
static UINT8 K_DriftSparkColor(player_t *player, INT32 charge)
{
UINT16 color = SKINCOLOR_NONE;
UINT8 color = SKINCOLOR_NONE;
const INT32 sparkval = K_GetKartDriftSparkValue(player);
if (charge >= K_GetKartDriftSparkValue(player)*4)
if (charge >= sparkval*4)
{
color = K_RainbowColor();
}
else if (charge >= K_GetKartDriftSparkValue(player)*2)
else if (charge >= sparkval*2)
{
if (charge <= (K_GetKartDriftSparkValue(player)*2)+(24*3))
if (charge <= (sparkval*2)+(24*3))
color = SKINCOLOR_RASPBERRY; // transition
else
color = SKINCOLOR_KETCHUP;
@@ -3594,6 +3600,8 @@ void K_SpawnSparkleTrail(mobj_t *mo)
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
const boolean shouldblend = (mo->player && K_PlayerEffectsShouldBlend(mo->player));
for (i = 0; i < 3; i++)
{
fixed_t newx = mo->x + mo->momx + (P_RandomRange(-rad, rad)<<FRACBITS);
@@ -3611,7 +3619,7 @@ void K_SpawnSparkleTrail(mobj_t *mo)
sparkle->color = mo->color;
if (mo->player && K_PlayerEffectsShouldBlend(mo->player))
if (shouldblend)
sparkle->blendmode = AST_ADD;
}
@@ -5179,6 +5187,24 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
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.
static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
{
@@ -5189,7 +5215,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
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;
fixed_t volumedampen = FRACUNIT;
@@ -5225,7 +5251,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
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 (player->kartstuff[k_enginesnd] < targetsnd) { player->kartstuff[k_enginesnd]++; }
@@ -5302,17 +5328,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
return;
}
s = (player->kartspeed - 1) / 3;
w = (player->kartweight - 1) / 3;
#define LOCKSTAT(stat) \
if (stat < 0) { stat = 0; } \
if (stat > 2) { stat = 2; }
LOCKSTAT(s);
LOCKSTAT(w);
#undef LOCKSTAT
class = s + (3*w);
class = K_GetEngineClass(player);
S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class * numsnds), volume);
}
@@ -5731,7 +5747,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_UpdateInvincibilitySounds(player); // Also thanks, VAda!
// Plays the music during and after the starting countdown.
if (P_IsLocalPlayer(player))
if ((leveltime <= MUSICSTARTTIME) && P_IsLocalPlayer(player))
S_StartMapMusic();
}
@@ -5911,45 +5927,33 @@ static void K_KartDrift(player_t *player, boolean onground)
// Holding the Jump button will enable drifting.
// Drift Release (Moved here so you can't "chain" drifts)
if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] < dsone
&& onground)
if (onground && player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
{
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] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
&& onground)
{
if (player->kartstuff[k_driftboost] < 20)
player->kartstuff[k_driftboost] = 20;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
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] < 50)
player->kartstuff[k_driftboost] = 50;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
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;
if (player->kartstuff[k_driftcharge] < dsone)
{
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
{
if (player->kartstuff[k_driftboost] < 20)
player->kartstuff[k_driftboost] = 20;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] < dsthree)
{
if (player->kartstuff[k_driftboost] < 50)
player->kartstuff[k_driftboost] = 50;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] >= dsthree)
{
if (player->kartstuff[k_driftboost] < 125)
player->kartstuff[k_driftboost] = 125;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
}
// Drifting: left or right?
@@ -6027,8 +6031,8 @@ static void K_KartDrift(player_t *player, boolean onground)
// Sound whenever you get a different tier of sparks
if (driftblue
|| driftred
|| driftrainbow)
|| driftred
|| driftrainbow)
{
//S_StartSound(player->mo, sfx_s3ka2);
if (P_IsLocalPlayer(player)) // UGHGHGH...
@@ -6769,7 +6773,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{
if (splitscreen)
{
if (leveltime & 1)
if (!cv_reducevfx.value && leveltime & 1)
player->mo->flags2 |= MF2_DONTDRAW;
else
player->mo->flags2 &= ~MF2_DONTDRAW;
@@ -6795,7 +6799,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (P_IsDisplayPlayer(player)
|| (!P_IsDisplayPlayer(player) && (player->kartstuff[k_hyudorotimer] < (1*TICRATE/2) || player->kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2))))
{
if (leveltime & 1)
if (!cv_reducevfx.value && leveltime & 1)
player->mo->flags2 |= MF2_DONTDRAW;
else
player->mo->flags2 &= ~MF2_DONTDRAW;
+1 -2
View File
@@ -99,8 +99,7 @@ void K_EraseStats(void)
// The only field we want to remember
boolean vanilla = kartstats.vanilla;
if (kartstats.copy)
Z_Free(kartstats.copy);
Z_Free(kartstats.copy);
memset(&kartstats, 0, sizeof(kartstats_t));
+1
View File
@@ -1293,6 +1293,7 @@ static int lib_pPlayRinglossSound(lua_State *L)
player_t *player = NULL;
mobj_t *damager = NULL;
NOHUD
LUA_UsageWarning(L, "P_PlayRinglossSound: using this function from lua might cause desynchs, consider using S_StartSound(origin, sfx_khurt1 + P_RandomKey(2)) as workaround");
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
+65 -10
View File
@@ -149,7 +149,8 @@ enum cameraf {
camera_momx,
camera_momy,
camera_momz,
camera_pnum
camera_pnum,
camera_freecam,
};
@@ -169,6 +170,7 @@ static const char *const camera_opt[] = {
"momy",
"momz",
"pnum",
"freecam",
NULL};
enum hudpatch {
@@ -387,10 +389,43 @@ static int camera_get(lua_State *L)
case camera_pnum:
lua_pushinteger(L, camnum);
break;
case camera_freecam:
lua_pushboolean(L, cam->freecam);
break;
}
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
//
@@ -1252,22 +1287,32 @@ extern int lib_hudadd(lua_State *L);
static int lib_hudsetvotebackground(lua_State *L)
{
// Reset to default
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 (strlen(prefix) != 4)
if (!lua_isnoneornil(L, 2))
{
return luaL_argerror(L, 1, "prefix should 4 characters wide");
}
INT32 time_per_frame = luaL_checkinteger(L, 2);
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
if (time_per_frame <= 0)
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
if (gamestate == GS_VOTING)
@@ -1371,6 +1416,16 @@ int LUA_HudLib(lua_State *L)
lua_setfield(L, -2, "__index");
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);
luaL_register(L, "hud", lib_hud);
+3 -12
View File
@@ -136,18 +136,9 @@ void LUA_HUD_DestroyDrawList(huddrawlist_h list)
{
if (list == NULL) return;
if (list->items)
{
Z_Free(list->items);
}
if (list->olditems)
{
Z_Free(list->olditems);
}
if (list->strbuf)
{
Z_Free(list->strbuf);
}
Z_Free(list->items);
Z_Free(list->olditems);
Z_Free(list->strbuf);
Z_Free(list);
}
+1 -1
View File
@@ -25,7 +25,7 @@
#include "lua_hook.h" // cmd errors
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
state_t *astate;
state_t *astate = NULL;
boolean actionsoverridden[NUMACTIONS] = {false};
+1 -1
View File
@@ -475,7 +475,7 @@ int mobj_localskin_setter(lua_State *L)
}
else
{
mo->localskin = 0;
mo->localskin = NULL;
mo->skinlocal = false;
}
}
+38 -38
View File
@@ -45,20 +45,20 @@ int hook_defrosting = 0;
// List of internal libraries to load from SRB2
static lua_CFunction liblist[] = {
LUA_EnumLib, // global metatable for enums
LUA_SOCLib, // A_Action functions, freeslot
LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc.
LUA_MathLib, // fixed_t and angle_t math functions
LUA_HookLib, // hookAdd and hook-calling functions
LUA_ConsoleLib, // console command/variable functions and structs
LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[]
LUA_MobjLib, // mobj_t, mapthing_t
LUA_PlayerLib, // player_t
LUA_SkinLib, // skin_t, skins[]
LUA_ThinkerLib, // thinker_t
LUA_MapLib, // line_t, side_t, sector_t, subsector_t
LUA_BlockmapLib, // blockmap stuff
LUA_HudLib, // HUD stuff
LUA_EnumLib, // global metatable for enums
LUA_SOCLib, // A_Action functions, freeslot
LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc.
LUA_MathLib, // fixed_t and angle_t math functions
LUA_HookLib, // hookAdd and hook-calling functions
LUA_ConsoleLib, // console command/variable functions and structs
LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[]
LUA_MobjLib, // mobj_t, mapthing_t
LUA_PlayerLib, // player_t
LUA_SkinLib, // skin_t, skins[]
LUA_ThinkerLib, // thinker_t
LUA_MapLib, // line_t, side_t, sector_t, subsector_t
LUA_BlockmapLib, // blockmap stuff
LUA_HudLib, // HUD stuff
NULL
};
@@ -66,12 +66,8 @@ static lua_CFunction liblist[] = {
static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize)
{
(void)ud;
if (nsize == 0) {
if (osize != 0)
Z_Free(ptr);
return NULL;
} else
return Z_Realloc(ptr, nsize, PU_LUA, NULL);
(void)osize;
return Z_Realloc(ptr, nsize, PU_LUA, NULL);
}
// Panic function Lua calls when there's an unprotected error.
@@ -213,7 +209,8 @@ void LUA_ClearState(void)
lua_setfield(L, LUA_REGISTRYINDEX, LREG_VALID);
// open srb2 libraries
for(i = 0; liblist[i]; i++) {
for (i = 0; liblist[i]; i++)
{
lua_pushcfunction(L, liblist[i]);
lua_call(L, 0, 0);
}
@@ -1064,9 +1061,13 @@ static void ArchiveTables(UINT8 **p)
{
// Write key
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);
lua_pop(gL, 1);
continue;
}
else if (e == 3) // nil key due to invalid userdata. NOT an error.
{
@@ -1077,15 +1078,12 @@ static void ArchiveTables(UINT8 **p)
// Write value
e = ArchiveValue(p, TABLESINDEX, -1);
if (e == 1)
{
n++; // the table contained a new table we'll have to archive. :(
}
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));
}
lua_pop(gL, 1);
}
lua_pop(gL, 1);
WRITEUINT8(*p, ARCH_TEND);
@@ -1276,13 +1274,21 @@ static void UnArchiveTables(UINT8 **p, boolean network)
UINT8 ret;
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");
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);
if (ret == 1)
@@ -1291,21 +1297,15 @@ static void UnArchiveTables(UINT8 **p, boolean network)
lua_pop(gL, 1); // Pop key
break;
}
else if (ret == 2) // read value
n++;
else if (ret == 3)
{
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
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)
{
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_rawset(gL, -3);
}
lua_pop(gL, 1);
+3 -6
View File
@@ -695,16 +695,13 @@ INT32 GIF_close(void)
fclose(gif_out);
gif_out = NULL;
if (gifbwr_buf)
Z_Free(gifbwr_buf);
Z_Free(gifbwr_buf);
gifbwr_buf = gifbwr_cur = NULL;
if (gifframe_data)
Z_Free(gifframe_data);
Z_Free(gifframe_data);
gifframe_data = NULL;
if (giflzw_hashTable)
Z_Free(giflzw_hashTable);
Z_Free(giflzw_hashTable);
giflzw_hashTable = NULL;
Z_Free(scrbuf_screens);
+6 -6
View File
@@ -80,7 +80,7 @@ static UINT8 cheatf_warp(void)
if (success)
{
G_SaveGameData(true); //G_SetGameModified(false);
S_StartSound(0, sfx_kc42);
S_StartSound(NULL, sfx_kc42);
}
// Refresh secrets menu existing.
@@ -117,13 +117,13 @@ static UINT8 cheatf_devmode(void)
#endif
static cheatseq_t cheat_warp = {
0, cheatf_warp,
NULL, cheatf_warp,
//{ SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff }
{ SCRAMBLE('b'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), 0xff }
};
static cheatseq_t cheat_warp_joy = {
0, cheatf_warp,
NULL, cheatf_warp,
/*{ SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW),
SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_UPARROW),
SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW),
@@ -136,7 +136,7 @@ static cheatseq_t cheat_warp_joy = {
#ifdef DEVELOP
static cheatseq_t cheat_devmode = {
0, cheatf_devmode,
NULL, cheatf_devmode,
{ SCRAMBLE('d'), SCRAMBLE('e'), SCRAMBLE('v'), SCRAMBLE('m'), SCRAMBLE('o'), SCRAMBLE('d'), SCRAMBLE('e'), 0xff }
};
#endif
@@ -301,7 +301,7 @@ void Command_CheatNoTarget_f(void)
void Command_Scale_f(void)
{
const double scaled = atof(COM_Argv(1));
fixed_t scale = FLOAT_TO_FIXED(scaled);
fixed_t scale = DoubleToFixed(scaled);
REQUIRE_DEVMODE;
REQUIRE_INLEVEL;
@@ -908,7 +908,7 @@ void OP_ObjectplaceMovement(player_t *player)
ticcmd_t *cmd = &player->cmd;
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
player->mo->angle = (cmd->angleturn << TICCMD_REDUCE);
ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED))
+4 -7
View File
@@ -235,7 +235,7 @@ void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1
wnum = conditionSets[set - 1].numconditions;
num = ++conditionSets[set - 1].numconditions;
conditionSets[set - 1].condition = Z_Realloc(conditionSets[set - 1].condition, sizeof(condition_t)*num, PU_STATIC, 0);
conditionSets[set - 1].condition = Z_Realloc(conditionSets[set - 1].condition, sizeof(condition_t)*num, PU_STATIC, NULL);
cond = conditionSets[set - 1].condition;
@@ -248,12 +248,9 @@ void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1
void M_ClearConditionSet(UINT8 set)
{
if (conditionSets[set - 1].numconditions)
{
Z_Free(conditionSets[set - 1].condition);
conditionSets[set - 1].condition = NULL;
conditionSets[set - 1].numconditions = 0;
}
Z_Free(conditionSets[set - 1].condition);
conditionSets[set - 1].condition = NULL;
conditionSets[set - 1].numconditions = 0;
conditionSets[set - 1].achieved = false;
}
+4 -4
View File
@@ -12,14 +12,14 @@
#ifndef __M_EMOTES__
#define __M_EMOTES__
#ifdef __cplusplus
extern "C" {
#endif
#include "doomdef.h"
#include "m_fixed.h"
#include "command.h"
#ifdef __cplusplus
extern "C" {
#endif
extern consvar_t cv_emotes;
#define MAXEMOTENAME 32
-29
View File
@@ -265,35 +265,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
return INT32_MAX;
}
/** \brief The xs_CRoundToInt function
\param val double number
\return Round toward nearest, but ties round toward even
*/
#if defined(SRB2_BIG_ENDIAN)
#define _xs_iexp_ 0
#define _xs_iman_ 1
#else
#define _xs_iexp_ 1 //intel is little endian
#define _xs_iman_ 0
#endif //BigEndian_
typedef double real64;
typedef union _xs_doubleints
{
real64 val;
unsigned ival[2];
} _xs_doubleints;
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
{
_xs_doubleints uval;
uval.val = val + 6755399441055744.0;
return uval.ival[_xs_iman_];
}
typedef struct
{
fixed_t x;
+536 -370
View File
File diff suppressed because it is too large. Load diff
+6 -8
View File
@@ -215,7 +215,7 @@ void M_SetupNextMenu(menu_t *menudef);
void M_ClearMenus(boolean callexitmenufunc);
#ifdef HAVE_THREADS
extern I_mutex m_menu_mutex;
extern I_Mutex m_menu_mutex;
#endif
extern menu_t *currentMenu;
@@ -223,11 +223,6 @@ extern menu_t *currentMenu;
extern menu_t MainDef;
extern menu_t SP_LoadDef;
#define MAXCOLUMNMODES 12 //max modes displayed in one column
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
extern menu_t OP_VideoModeDef;
void M_VideoModeMenu(INT32 choice);
// Call upon joystick hotplug
void M_SetupJoystickMenu(INT32 choice);
extern menu_t OP_JoystickSetDef;
@@ -306,12 +301,15 @@ void SaturnHud_menu_Onchange(void);
void GameFocus_menu_Onchange (void);
void ShowLocalskinMenu_Onchange(void);
#ifdef HWRENDER
void M_UpdateOGLMenu(void);
#endif
void M_ResetDemoList(void);
void M_ReplayHut(INT32 choice);
void M_ReturnToTitleFromError(void);
void M_SetPlaybackMenuPointer(void);
void Nextmap_OnChange(void);
@@ -400,7 +398,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
NULL\
}
#define CONTROLMENUSTYLE(source, prev)\
#define CONTROLMENUSTYLE(source, prev, tooltip)\
{\
"M_CONTRO",\
sizeof (source)/sizeof (menuitem_t),\
@@ -411,7 +409,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
26, 40,\
0,\
NULL,\
NULL\
tooltip\
}
#define IMAGEDEF(source)\
+109 -91
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, "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, "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, "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, "Bird...", &OP_BirdDef, 152},
@@ -648,17 +648,6 @@ static menuitem_t OP_ControlsMenu[] =
{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, "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[] =
@@ -669,15 +658,6 @@ static const char* OP_ControlsTooltips[] =
"Setup player 4 controls.",
"Options for mouse control.",
"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[] =
@@ -685,6 +665,13 @@ static menuitem_t OP_AllControlsMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
{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_HEADER, NULL, "Gameplay Controls", 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 },
};
// 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) \
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \
{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, "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},
};
@@ -1153,13 +1151,6 @@ static menuitem_t OP_SoundAdvancedMenu[] =
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 35},
#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_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?",
#endif
"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
NULL,
"How many times is the same sound allowed to play at once?\nIf 0 theres no limit.",
@@ -1219,6 +1205,10 @@ static menuitem_t OP_FocusOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 100},
{IT_STRING|IT_CVAR, NULL, "Visible Mouse", &cv_mousevisible, 120},
{IT_STRING|IT_CVAR, NULL, "Gamepad LED Color While Unfocused ", &cv_gamepadledifunfocused, 140},
{IT_STRING|IT_CVAR, NULL, "Gamepad Rumble While Unfocused", &cv_rumbleifunfocused, 150},
};
static const char* OP_FocusOptionsTooltips[] =
@@ -1230,6 +1220,8 @@ static const char* OP_FocusOptionsTooltips[] =
"Set manual framerate cap while the game is unfocused.",
"Should the FOCUS LOST window appear\n while the game is unfocused?",
"Displays the mouse cursor while the game is in focus.",
"Should gamepad LED indicator change color when unfocused?",
"Should gamepad rumble apply when unfocused?",
};
static menuitem_t OP_DataOptionsMenu[] =
@@ -1337,13 +1329,14 @@ static menuitem_t OP_HUDOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95},
// 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[] =
@@ -1352,16 +1345,19 @@ static menuitem_t OP_CamOptionsMenu[] =
{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_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 4 Camera options...", &OP_Player4CamOptionsDef, 80},
{IT_STRING | IT_CVAR, NULL, "Flipcam Mode", &cv_flipcammode, 40},
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 60},
{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[] =
{
NULL,
"Player field of view.",
"Change flipcam mode.\nDisplayplayer - use currently viewed player option.\nLocal - use local flipcam toggle option.",
NULL,
NULL,
NULL,
@@ -1643,26 +1639,34 @@ static menuitem_t OP_AccessibilityMenu[] =
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "Saturation", &cv_globalsaturation, 25},
{IT_SUBMENU|IT_STRING, NULL, "Video Color Settings...", &OP_ColorOptionsDef, 30},
{IT_STRING|IT_CVAR, NULL, "Midnight Channel Flicker", &cv_lessflicker, 35},
{IT_STRING|IT_CVAR, NULL, "Reduce Effects", &cv_reducevfx, 35},
{IT_STRING|IT_CVAR, NULL, "Midnight Channel Flicker", &cv_lessflicker, 40}, // obsolete now? or still better be a seperate toggle?
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 40},
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 45},
#ifdef HWRENDER
{IT_STRING|IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 45},
{IT_STRING|IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 50},
#endif
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 50},
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 55},
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 55},
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 60},
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 65},
{IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 65},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 70},
{IT_HEADER, NULL, "Audio", NULL, 75},
{IT_HEADER, NULL, "Audio", NULL, 80},
{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, "Reverse L/R Channels", &stereoreverse, 90},
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 95},
{IT_HEADER, NULL, "Controls", NULL, 105},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 115},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 120},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 125},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 130},
};
static const char* OP_AccessibilityTooltips[] =
@@ -1672,10 +1676,11 @@ static const char* OP_AccessibilityTooltips[] =
"Gamma (brightness) of the game.",
"Saturation of the game.",
"Advanced color settings of the game.",
"Reduces or disables certain effects players might be sensitive to\nSuch as flashing, flickering, certain screen effects and more.",
"Disables the flicker effect on Midnight Channel.",
"Sets minimum sector brightness, useful for dark areas",
#ifdef HWRENDER
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
"Disabling Screen Textures will disable the Underwater and Heat screen effects.",
#endif
"Toggles the ripple effect on water surfaces",
"Fades other Players that are close to the camera in and out",
@@ -1684,6 +1689,11 @@ static const char* OP_AccessibilityTooltips[] =
NULL,
"Reverse left and right channels of audio.",
"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[] =
@@ -1860,15 +1870,16 @@ static menuitem_t OP_SaturnHudMenu[] =
{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 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, "Driftgauge...", &OP_DriftGaugeDef, 195},
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 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[] =
@@ -1895,6 +1906,7 @@ static const char* OP_SaturnHudTooltips[] =
"Erratically rotate player icons during spinouts.",
"Visualize the player facing angle.",
"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.",
"Show the Director Toggle prompt when spectating.",
"Nametag Options.",
@@ -1982,47 +1994,46 @@ static menuitem_t OP_HudOffsetMenu[] =
// absolutely crazy how many people put work into this at this point <3
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_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100},
{IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "Alug Indev", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Haya Nepdisk", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy xyzzy", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Chearii riomccloud", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe PAS", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "$HOME yama", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Achii scizor300", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Superjustinbros Lugent", NULL, 80},
{IT_HEADER, NULL, "", NULL, 124},
{IT_HEADER, NULL, "", NULL, 74},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 130},
{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, "The Moe Mansion and Birdhouse Team", NULL, 188},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 198},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Blankart", NULL, 150},
{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, NULL, "", NULL, 258}, // dummy text II
{IT_STRING+IT_SPACE, NULL, "", NULL, 228}, // dummy text I
{IT_STRING, NULL, "", NULL, 278}, // dummy text II
};
// sry we dont have space for this anymore :c
/*static const char* OP_CreditTooltips[] =
// 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[] =
{
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"
};*/
};
static menuitem_t OP_BirdMenu[] =
@@ -2192,6 +2203,9 @@ static menuitem_t OP_AdvancedBirdMenu[] =
{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 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[] =
@@ -2201,6 +2215,8 @@ static const char* OP_AdvancedBirdTooltips[] =
"Fade in music after Grow.",
"Fade out music before respawning.",
"Fade in music while respawning.",
"Threshold for syncing music.",
"Only sync special music.",
};
enum
@@ -2210,6 +2226,8 @@ enum
fadegrow,
respawnfadeout,
respawnfadein,
syncthreshold,
syncspecialonly,
};
menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS];
@@ -2483,7 +2501,7 @@ menu_t OP_MainDef =
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 40, 15, OP_ControlsTooltips);
//WTF
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_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);
@@ -2622,7 +2640,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_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_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30, OP_PlayerDistortTooltips);
+7 -6
View File
@@ -540,7 +540,7 @@ static boolean M_BackupConfig(const char *filename)
void M_SaveConfig(const char *filename)
{
FILE *f;
char *filepath;
CLEANUP(Z_Pfree) char *filepath = NULL;
// make sure not to write back the config until it's been correctly loaded
if (!loaded_config)
@@ -558,7 +558,7 @@ void M_SaveConfig(const char *filename)
// append srb2home to beginning of filename
// but check if srb2home isn't already there, first
if (!strstr(filename, srb2home))
filepath = va(pandf,srb2home, filename);
filepath = Z_StrDup(va(pandf, srb2home, filename));
else
filepath = Z_StrDup(filename);
@@ -1346,14 +1346,15 @@ void M_MinimapGenerate(void)
minigen = AM_MinimapGenerate(mul);
if (minigen == NULL || minigen->buf == NULL)
goto failure;
{
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
return;
}
M_CreateScreenShotPalette();
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
failure:
if (minigen->buf != NULL)
free(minigen->buf);
free(minigen->buf);
if (ret)
{
+9 -9
View File
@@ -110,12 +110,12 @@ perfstatrow_t rendertime_rows[] = {
{"ui ", "UI render: ", &ps_uitime, PS_TIME},
{"finupdt", "I_FinishUpdate:", &ps_swaptime, PS_TIME},
{0}
{}
};
perfstatrow_t gamelogicbrief_row[] = {
{"logic ", "Game logic: ", &ps_tictime, PS_TIME},
{0}
{}
};
perfstatrow_t commoncounter_rows[] = {
@@ -123,20 +123,20 @@ perfstatrow_t commoncounter_rows[] = {
{"sprites", "Sprites: ", &ps_numsprites, 0},
{"drwnode", "Drawnodes: ", &ps_numdrawnodes, 0},
{"plyobjs", "Polyobjects: ", &ps_numpolyobjects, 0},
{0}
{}
};
perfstatrow_t interpolation_rows[] = {
{"intpfrc", "Interp frac: ", &ps_interp_frac, 0},
{"intplag", "Interp lag: ", &ps_interp_lag, 0},
{0}
{}
};
#ifdef HWRENDER
perfstatrow_t batchcount_rows[] = {
{"polygon", "Polygons: ", &ps_hw_numpolys, 0},
{"vertex ", "Vertices: ", &ps_hw_numverts, 0},
{0}
{}
};
perfstatrow_t batchcalls_rows[] = {
@@ -145,7 +145,7 @@ perfstatrow_t batchcalls_rows[] = {
{"texture", "Textures: ", &ps_hw_numtextures, 0},
{"polyflg", "Polyflags: ", &ps_hw_numpolyflags, 0},
{"colors ", "Colors: ", &ps_hw_numcolors, 0},
{0}
{}
};
#endif
@@ -164,7 +164,7 @@ perfstatrow_t gamelogic_rows[] = {
{" lthinkf", " LUAh_ThinkFrame:", &ps_lua_thinkframe_time, PS_TIME|PS_LEVEL},
{" lpostthinkf", " LUAh_PostThinkFrame:", &ps_lua_postthinkframe_time, PS_TIME|PS_LEVEL},
{" other ", " Other: ", &ps_otherlogictime, PS_TIME|PS_LEVEL},
{0}
{}
};
perfstatrow_t thinkercount_rows[] = {
@@ -176,13 +176,13 @@ perfstatrow_t thinkercount_rows[] = {
{" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL},
{" other ", " Other: ", &ps_otherthcount, PS_LEVEL},
{" remove ", " Pending removal:", &ps_removecount, PS_LEVEL},
{0}
{}
};
perfstatrow_t misc_calls_rows[] = {
{"lmhook", "Lua mobj hooks: ", &ps_lua_mobjhooks, PS_LEVEL},
{"chkpos", "P_CheckPosition:", &ps_checkposition_calls, PS_LEVEL},
{0}
{}
};
// Sample collection status for averaging.
Loaded 100 of 154 files, more files were not shown because too many files have changed in this diff. Show more