Compare commits

...
1401 Commits
Author SHA1 Message Date
Alug a8df763823 fix bad copy paste 2025-09-26 17:20:41 +02:00
Alug 58af8f84b9 squash cherry all changes to here 2025-09-22 22:50:55 +02:00
Alug b0395ad539 Revert "get rid of the automatic "downsample" detection stufff"
This reverts commit b712cba62d.
2025-09-22 22:48:55 +02:00
Alug b712cba62d get rid of the automatic "downsample" detection stufff
massive declutter
2025-09-21 14:56:44 +02:00
Alug 16c0b48f4a add backwards compat support for ogl 2.1 fbo extensions
this should allow older gpus to use the feature aswell, not super clean but seems to work
TODO: refactor this whole crap, switch to seperate read and draw to use blitting and make this multisampling compatible so we can get rid of the messy "downsample" code and have this active by default
2025-09-21 05:12:47 +02:00
Alug fcadd03607 add back toggle for mouse cursor visability behaviour 2025-09-20 18:51:55 +02:00
Alug e1ad48ec16 always interpolate weather when using interpolation
same here, a fix, not a feature
2025-09-20 18:08:12 +02:00
Alug fbb77e8428 always account for mobjscale in precip
this is a fix not some feature honestly
2025-09-20 18:08:09 +02:00
Alug 72c05fae77 add gba RR check for software cyan cut 2025-09-20 17:57:47 +02:00
Alug 8867dc959e dedupe and cleanup nights hoops spawn
most of the actual spawn is split into P_SpawnNiGHTSHoop, which takes arguments to determine if to spawn just a hoop or its collision detectors
(if you wonder why this takes a mobj pointer to pointer is due to collision detector need the former hoops last mobj to link into)
- also actually fixes midgame join crash (hoop hnext was directly nulled instead of using p_settarget)
- added some extra safety checks
- reduced the amounts of r_pointinsubsector calls for things that used to go through this function
2025-09-20 16:36:19 +02:00
Alug e9fc57b97d move saltyhop stuff into seperate struct
no functional change, just as little cleaner lookin
+ reduce size by using stdbools boolean
2025-09-20 16:34:35 +02:00
Alug 7c490de93e delet metal sonic replay code
massively cluttered the demo code
hope this aint used for some super obscure thing
guess we´ll see
2025-09-20 16:34:17 +02:00
Alug 3c85295622 fix most implicit float > double conversions 2025-09-19 13:48:51 +02:00
Alug bdeb7e5e9d fix potential leak in protocol registering 2025-09-19 13:48:47 +02:00
Alug 2e766a7e16 fix potential NULL deref of string in lua chatprint lib functions 2025-09-19 13:48:44 +02:00
Alug 9bab3d5795 fix some potential leaks in M_DrawSplitText 2025-09-19 13:48:40 +02:00
Alug 1015800483 delet some double defined things 2025-09-19 13:48:38 +02:00
indev c4149e26e8 Oops there's 1 more 2025-09-19 02:10:44 +03:00
indev 602e4df5b9 Fix smol oversight :3 2025-09-19 02:06:05 +03:00
Alug 9be5780597 rename "ffloor" global to "visffloor"
prevent name conflicts with a bunch of local variables named "ffloor"
2025-09-18 21:08:41 +02:00
Alug 363f4c56f4 dedupe map replacement checks
the actual checks are in P_CheckMapReplacements
2025-09-18 18:20:26 +02:00
Alug 9ca21f1fb4 simplify startup map checks a little 2025-09-18 16:41:07 +02:00
Alug 826183ce2a skip checking for replaced maps on start if no extra wads are loaded
~~technically this also should be done for autoload~~
2025-09-18 16:41:03 +02:00
Alug ec41a7152c remove erronous errors
W_InitFileError from within W_InitMultipleFiles will handle this
2025-09-18 16:41:01 +02:00
Alug 4e394951bc allow freecam to work with first person 2025-09-18 12:16:27 +02:00
Alug 837f74f28a simplify startedInFreePlay check 2025-09-18 10:51:33 +02:00
Alug fb02389922 use P_SetupCamera for P_MoveCameraToSpawn
also modify P_SetupCamera to always just move the camera to the playerstarts
2025-09-18 10:51:33 +02:00
Alug f12f5b8bd1 delet P_Initsecnode
empty function now
2025-09-18 10:51:33 +02:00
Alug 20a3f4b6f3 only check cyan floor hack on flats that contain cyan
there was the remap loop that would already check this for us, so we can save a few calls to W_CheckNameForNum and memcmp
2025-09-18 10:51:33 +02:00
Alug f1ca991041 make static, cleanup and delet dead code hw_cache 2025-09-18 10:51:33 +02:00
Alug 83df870bb5 change version string 2025-09-17 23:44:02 +02:00
Alug 8e56998c9a Merge pull request #200 from Indev450/Saturn-Testing
merge testing into next branch
2025-09-17 22:42:47 +01:00
Alug 43e5f694bc Merge pull request #181 from chromaticpipe/dynamicdelay
GIF dynamic delay
2025-09-17 22:42:20 +01:00
Alug 9197a50c5b Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-09-17 23:41:41 +02:00
Alug 40fb4da2e8 Merge pull request #198 from Indev450/servericonpack
port Map icon packet from srb2classic
2025-09-17 22:40:57 +01:00
Alug f458fdbebe Merge pull request #195 from Indev450/texhash
Do not reload every texture when adding a wad
2025-09-17 22:40:53 +01:00
Alug 069f8bc009 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-09-17 23:37:42 +02:00
Alug a9f579d949 move replay replayhut list free and reset into M_ResetDemoList
use it to free demolists from within levelload when you switched maps out of a replay
2025-09-17 23:32:34 +02:00
Alug 7b0b2d8cd7 Merge pull request #197 from Indev450/fastfilesearch
Speedup Filesearch
2025-09-17 20:08:25 +01:00
James R 4dce42e458 R_GenerateBlendTables: allocate copy of palette for use in thread
The palette can be freed while this thread is still
running, which means the thread would end up reading from
freed memory.
2025-09-17 21:06:21 +02:00
James R f819471c06 Send R_GenerateBlendTables number crunch to parallel thread 2025-09-17 21:06:18 +02:00
Alug 45393cbb78 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-09-17 21:06:13 +02:00
indev bf6727b43a Simplify G_ D/S cpyTiccmd, since n is always a multiple of sizeof(ticcmd_t) 2025-09-17 21:38:55 +03:00
Alug 87134a42b4 fix signal handler stuff for worker threads
g_in_exiting_signal_handler needs to be set BEFORE it actually exits lol
2025-09-17 20:35:32 +02:00
Alug d27a849d79 decouple precipmobj_t from mobj_t
vissprite_t now keeps pointer to precipmobj directly instead of just a simple boolean check
this has multiple benefits
the mobj_t struct now can be reorderer and modified as pleased without having to worry about precipmobj struct layouts since all precipmobj -> mobj casts are eliminated
this allows to remove a massive amount of fields from precipmobj struct which never were used massively reducing the footprint of a precipmobj thing
kinda wish there was a neat way to template function headers to take different types for the same arguments in C to reduce code duplication, but this glady is atleast a rather small case
2025-09-17 17:42:16 +02:00
Alug 2aaa52c639 remove precip blendmode visability check
this WILL never trigger since we neither can access precipmobjs nor do their translucency values ever change
so save us a little bit of work
2025-09-17 17:41:31 +02:00
Alug 5348739a2c fix precip translucency in software renderer
precipmobjs always spawned with AST_COPY blendmode which failed the check, but they are supposed to be translucent when rain
restore the correct behaviour
2025-09-17 04:25:08 +02:00
Alug b21396bd34 ensure deterministic order for P_Random stuff passed as arguments
the evaluation order of arguments passed to functions is undefined in C/C++, so its up to the compiler in which order to evaluate these
P_Random functions modify the randomseed each time theyre called, which can lead to different outcomes (thus desynchs) on different platforms, compilers, compiler versions etc.
so match up with the most common which is last to first (seemingly the order gcc on nix and windows handle it)
2025-09-17 03:28:02 +02:00
Alug 19c97d3137 explicitly cast those 2025-09-17 02:48:44 +02:00
James R 421dca5615 Inflate only size out bytes
Saves time uncompressing an entire lump when only part of
it is needed.
2025-09-17 02:48:41 +02:00
Alug d5b64a4df3 move G_CopyTiccmd & G_MoveTiccmd back to g_game
accidentally misplaced those during g_demo split
2025-09-17 01:31:18 +02:00
Alug 098d1afb50 add P_FreeLevelState + extra stuff for D_ClearState
this just takes out the cleanup code from P_SetupLevel so it can be called from within D_ClearState and all the mapdata will be freed when going back to the main menu
Not super crazy and really necessary in kart, but why not tbh
this is mostly based on what RR does
2025-09-17 01:31:15 +02:00
Alug 9d122aa686 change type and name of var here 2025-09-16 14:47:32 +02:00
Gustaf Alhäll e465e83cb3 Remove maxsend limits 2025-09-16 14:47:29 +02:00
Alug 619a8e2f42 cleanup some unused stuff 2025-09-16 14:47:26 +02:00
Alug b3c0c6f2b4 preconvert our polyvertex coords to fixed point
yes this is unironically faster, by atleast 5-10fps in the wandering falls test case
2025-09-16 02:45:46 +02:00
Alug f0a1cd01c3 remove floatlenght from seg_t
this will get converted to fixedpoint anyways and is only used in ONE place to determine texture x offsets in gl
yes this does get readjusted in adjustsegs if our glsegs differ, but this should be so marginal so save us the work at mapload
i dare anyone to even see a difference if any
2025-09-16 02:45:41 +02:00
Alug 144740a270 declare pv1 and pv2 properly as polyvertex_t
this most likely was done due to issues with header includes
this saves an crapton of pointless casts and type conversions
2025-09-16 02:44:46 +02:00
Alug 0b478b7a91 get rid of "spawn_" sector_t fields
we now make copies of lines, sectors and vertices on mapload that have the spawn state, so those fields are redundant now
also fix copy paste that made ceiling flat angle check if its differs from the floor flat angle on netsave
saves a whopping 32bytes per sector_t entry!
2025-09-15 21:07:45 +02:00
Alug d23451b6e7 revert demo ghosttic hitlist resynch double free hack
now that we dont reload the map anymore during gamestate reload
2025-09-15 17:27:10 +02:00
Alug 20897deeee Merge branch 'servericonpack' into Saturn-Testing 2025-09-15 17:27:06 +02:00
Alug 677e381a2c dont send server icon if current map is supposed to be hidden
in line with kart not sending maptitle to ms in the same case
2025-09-15 16:16:43 +02:00
Alug 4b06a3eabf Merge branch 'fastfilesearch' into Saturn-Testing 2025-09-15 15:08:40 +02:00
Alug 36c1369041 fix filesearch oopsie
lulul
2025-09-15 15:08:22 +02:00
Alug d4b179d59e fix functionnames in polyobject interp warnings for netunarchival 2025-09-15 14:50:52 +02:00
Alug 81fbd75646 add sector checks to netsave plane interpolators
seems like this may be null in a few cases
2025-09-15 14:50:49 +02:00
Alug c7e37eac05 remove inline from SaveFireflickerThinker
doubt theres a single map in kart that uses those and even if it wont be so much that it needs to be inlined
2025-09-15 14:39:57 +02:00
Alug dd6403691f fix dedi build compile 2025-09-15 14:35:53 +02:00
Gustaf Alhäll e42b179fad Rearrange mobj_t fields to reduce holes 2025-09-15 14:07:31 +02:00
Gustaf Alhäll ebb0ebcab0 Reduce size of memblock_t structure 2025-09-15 14:07:28 +02:00
Gustaf Alhäll 347a5ed40a Do not store all states for recursion inside P_SetMobjState 2025-09-15 14:07:25 +02:00
Gustaf Alhäll dee91ed1ef Kill RESETDATA 2025-09-15 14:07:21 +02:00
Alug a80f702bb8 Merge branch 'Saturn-Next' into Saturn-Testing 2025-09-15 14:07:15 +02:00
Gustaf Alhäll 7d91d06ce0 Fix crash on OS X on resolutions that are not multiples of 32 2025-09-15 13:14:28 +02:00
Alug ab1f04ac31 handle native keyboard in a better way
not particulary great, but i dont feel like working this out much atm
2025-09-14 23:32:25 +02:00
Alug 0696ac7340 we dont support gamecube wii or playstation lel 2025-09-14 23:20:46 +02:00
Alug 137a917f58 delet mousegrabok 2025-09-14 23:20:43 +02:00
Alug 00cfdfef27 add P_GetLocalPlayerNumForNum and P_IsLocalPlayerNum and cleanup a bunch of splitscreen checks
- P_GetLocalPlayerNumForNum returns the playernumber for a given index
- P_IsLocalPlayerNum returns if a playernum is local to the maschine
- replaced most if else chains from checking splitscreen things with loops using P_GetLocalPlayerNumForNum and P_GetLocalPlayerForNum
2025-09-14 21:30:56 +02:00
Alug c1d5d153aa Merge branch 'fastfilesearch' into Saturn-Testing 2025-09-14 20:48:33 +02:00
Alug 1fb3b2110c bit of cleanup w_wad 2025-09-14 20:48:24 +02:00
Alug ef9472097d clean up faster filesearch
-use parts of RR´s implementation to get rid of the windows specific code and generally simplify this
- also use SRB2´s  symlink detection as its simpler and saves one lstat call per searched file
2025-09-14 20:47:57 +02:00
Alug ed75d89baf bit of random cleanup + cache strlen in some places 2025-09-14 18:23:24 +02:00
Alug fed4c934ad Merge branch 'Saturn-Next' into Saturn-Testing 2025-09-14 18:20:23 +02:00
Alug 63ea13ab3c Merge pull request #196 from Indev450/updatemd5
Update md5 lib
2025-09-13 13:57:05 +01:00
Alug 2c802799e8 Merge pull request #194 from Indev450/winzlib-ng
Replace zlib with zlib-ng on Windows
2025-09-13 13:56:57 +01:00
Alug fe30cbb4aa big cleanup levelloading code
- made levelfadecol a local variable
- renamed all the "Raw" functions
- moved axis mapthing spawn into the mapthing spawn function
- moved mapthing load to mapdata load, saves opening the THING virtual lump twice
- split out linedef init out of the loop it now gets done within linedef load code saving the hassle of iterating through all the lines twice
- removed a bunch of dead code and useless variables
- moved virtual resource free to after the mapdata has been loaded completely
- sidedef loop now increments pointer instead of reassinging it each iteration
- lastloadedmaplumpnum now gets checked for LUMPERROR instead of INT16_MAX since W_CheckNumForName returns LUMPERROR if lump was not found
2025-09-13 14:36:57 +02:00
Alug ca1d3e337a reset our gamepad colour in some cases
to account for mappalettes properly
2025-09-12 22:30:47 +02:00
indev 28f1ee6335 Attempt to fix some lua userdata being corrupted when allocated via PoolAllocator 2025-09-12 23:18:39 +03:00
Alug 91f377b382 remove remaining field initalizing thats being taken care of by calloc 2025-09-12 21:19:53 +02:00
Alug 6d6fa156f3 skip manually initializing some fields P_SetupLines
redundant due to earlier calloc
2025-09-12 18:29:07 +02:00
Alug 5383fee6af speedup P_LoadRawSectors a bit
the sector array already will be calloc´d, so we dont need to set all of this to 0
also use a premade initalizer for some things
2025-09-12 18:24:21 +02:00
Alug a2c7b68a60 cache player pointer for P_LevelInitStuff 2025-09-12 18:09:47 +02:00
Alug 7be0b38f47 fix taglist stuff on gamestate resend
got kinda lost here lulul
fixed diamond square elevator
2025-09-12 18:06:26 +02:00
Alug 4e05679b10 cache our player and sector pointers for net un/archiving 2025-09-12 17:19:36 +02:00
Alug 36d3c76a52 actually use our spawnside pointer 2025-09-12 17:08:28 +02:00
Alug eee263c2c2 skip checking for "srb2.wad" and "patch.dta"
during server addon checking
both have never existed in kart and are from super old srb2 versions
so save us some string comparisons
2025-09-12 16:25:37 +02:00
Alug c1cdb83e8d use hash to determine if polygon state has changed
we do not use it in the polygon comparitors as it apparently may lay them out in a really unperformant way
2025-09-12 16:25:34 +02:00
Alug 451ab81f0b combine this block 2025-09-12 16:22:06 +02:00
Alug d803c1b9cd smol change i forgor for testing branch 2025-09-12 16:00:56 +02:00
Alug 72b26c19ce Reload from spawnsectors/spawnlines/spawnsides (adjusted for kart)
from https://gitlab.com/kart-krew-dev/ring-racers/-/commit/4f77c9f228274afb9f0b5bf9b30e0eb22f9b385f
2025-09-12 16:00:12 +02:00
Alug f35d827bd4 copy initial map state on mapload for Netarchiving + cleanup
like this we dont have to reopen the mapdata 3 times each time we prepare a netsave
also allows us to directly compare sector and line properties
this should save a bit of time when someone joins or resynchs with gamestate system
this is based on some UDMF work from srb2
2025-09-12 16:00:08 +02:00
Sally Coolatta 358eeaa981 Don't reload level on gamestate resend
The level will only reload during a gamestate reload if the map is horribly mismatched somehow. Minor differences in level state are already handled by other parts of the reload, so doing this on *every* reload wastes lots of time.
2025-09-12 16:00:05 +02:00
Eidolon 55e88cf740 Put seclist nodes in LevelPool memory
Replaces the old freelist solution with the LevelPool, which
dramatically reduces the number of allocations needed for mobj and
precip sector assignment. In measurement, this cuts down the time taken
for spawning precipitation by 50%.
2025-09-12 16:00:02 +02:00
Eidolon be4125e4ca Add level pool allocator and use it for mobj, precip, thinkers
This should substantially reduce the number of malloc/free calls made to
create and destroy mobjs, especially during level load and net
save/load.

memory_resource standard header is not available on the OSX deployment
target we are using, so I had to write my own fixed size pool allocator.
2025-09-12 15:59:59 +02:00
Eidolon 920b00348e Make the mouse cursor sane 2025-09-12 15:59:56 +02:00
Alug 80aeae1692 implement "startup" stuff for W_InitFileError
so it can I_Error if a wad file fails to load on startup
2025-09-12 15:59:52 +02:00
toaster 0e52845f50 W_VerifyNMUSlumps: Rewind back to beginning of file handle for WAD 2025-09-12 15:59:47 +02:00
toaster ca5dd9e78f W_VerifyNMUSlumps: Clean up
- Bake W_VerifyFile in, since it was a stub never called anywhere else
- Make it operate off file handles, since the following locations quickly filesearch'd more than once in quick succession.
    - W_InitFile
    - Command_Addfile
- Remove spurious call from W_InitMultipleFiles for `-file` startup param
2025-09-12 15:59:44 +02:00
toaster 956fc099ad findfile aggressive optimisation: If srb2home and srb2path are the current working directory, don't search in them
srb2path will report "." while this optimisation is in play, but this can be disabled if necessary by modifying the small #if (1) in IdentifyVersion
2025-09-12 15:59:41 +02:00
Sally Coolatta 1da376e777 Create doomednum lookup for loading mobjthinkers
Cuts off 10% of the time it takes to load mobj thinkers.
2025-09-12 15:59:37 +02:00
Alug b0b4259af6 fix "missing initializer for member" warning 2025-09-12 15:59:34 +02:00
Alug 26343b4449 remove duped functions in r_fps
those didnt do anything different tbh
2025-09-12 15:59:31 +02:00
Alug a46926f5cc Set SDL_HINT_APP_NAME SDL hint 2025-09-12 15:59:28 +02:00
Eidolon 49518059d1 Use std::vector for r_fps storage
This isn't an optimization for the mobj pointer list, but it is an
optimization for level interpolators, which previously made N
allocations for N non-mobj thinkers. Now those allocations are amortized
according to std::vector's storage.

This could still be further cleaned up to be more C++-ey.
2025-09-12 15:59:24 +02:00
Alug e6ce425bbd ceepeepeefy r_fps 2025-09-12 15:59:21 +02:00
Alug 19b9ec0521 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-09-10 13:23:22 +01:00
Alug c98861be6e fix tracker module playback going nuts when changing audio buffer size
forgor CV_CALL :chaosleep:
2025-09-10 13:08:26 +02:00
Alug 29db810c54 delet remaining "highcolor" stuff 2025-09-09 18:17:04 +02:00
indev 14bf24ed27 Revert stopping music in D_StartTitle and G_EndGame 2025-09-09 18:08:58 +03:00
Alug ff5bb34204 parentheses hell 2025-09-08 19:33:55 +02:00
Alug 77a00b08a5 optimize gl vhseffect slightly
we dont need to remake our screen texture 3 times
also avoid combining float with interger maths esp in the loop
2025-09-08 19:29:01 +02:00
Alug 27caf1bc70 Merge branch 'servericonpack' into Saturn-Testing 2025-09-08 18:09:09 +02:00
Gustaf Alhäll 01b24e5417 Fix use-after-free when listing servers 2025-09-08 18:08:45 +02:00
Gustaf Alhäll 7a320c9c54 Refactor aatree_t to accept strings 2025-09-05 20:05:10 +02:00
Alug 3a65b687a8 some more micro optimizations p_mobj
dont revaluate P_GetSlopeZAt multiple times due to min/max
save a few abs calls by putting em in constants
remove pointless fixedmuls
2025-09-05 20:05:05 +02:00
Alug 0919ad015c Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-09-05 20:05:01 +02:00
indev 437f900c25 Clear dangling pointers in VoteScreen struct after mapload 2025-09-05 18:21:01 +03:00
indev cd7ce5698c Update vote background if hud.setVoteBackground was called on vote screen 2025-09-05 17:34:30 +03:00
indev 86eda4f358 Revert "wonky: cache and reuse our testpoint subsector for sloped mobj z checks"
This reverts commit 6f93299aaf.
2025-09-03 18:51:35 +03:00
indev d791d2ce55 Revert "make sure subsec gets initalised to smth"
This reverts commit 32d8120516.
2025-09-03 18:51:32 +03:00
Alug 1883a4884a (hopefully) fix replayhut calling waitingplayers drawer
due to server list setting netgame to true and never resetting it
also cleanup some mess here
lets hope this doesent break anything
2025-09-03 14:10:26 +02:00
Alug 403c34fe5c Merge branch 'servericonpack' into Saturn-Testing 2025-09-03 12:34:06 +02:00
Alug f86a99cd1b Merge branch 'Saturn-Next' into servericonpack 2025-09-03 12:33:56 +02:00
Alug 85cac497ea fixup building map title string for serverinfo
fixes numerous issues, like zonetitle not appearing on bots and serverinfo screen
and generally making this more sane by appending stuff if needed
also fixes "Zone" not displaying in serverinfo screen
2025-09-03 12:33:49 +02:00
Alug 92d6c2b7b0 make patch/pixel conversion account for padding data/no data
just set everything to transparent pixel 247 (0xf7)
so we neither write nor read garbage data and just can cut it out as transparent during pixel to patch conversion
2025-09-03 12:32:32 +02:00
Alug 46be62b256 Merge branch 'servericonpack' into Saturn-Testing 2025-09-02 23:04:03 +02:00
Alug f67f8e7dbf cache patch width
just to avoid some cache misses in a somewhat tight lööp
2025-09-02 22:20:37 +02:00
Alug 191fd4b68a Merge branch 'servericonpack' into Saturn-Testing 2025-09-02 22:03:59 +02:00
Alug c504c0f8f0 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-09-02 22:03:55 +02:00
indev 6adf39b460 Don't check for opengl in NOHW/DEDICATED builds 2025-09-02 23:01:07 +03:00
Alug e160427108 add smol comment 2025-09-02 21:38:10 +02:00
Alug 275d28c9c6 implement map icon request counter/limit
tries 5 times then gives up
this is just since vanilla clients do not send anything back to us so this would endlessly retry which is pointless
can be adjusted if needed
2025-09-02 21:27:32 +02:00
Alug 2a848e32e4 port map icon packet for serverinfo screen
based on https://codeberg.org/srb2classic/srb2classic/pulls/134

with adjustments
many thanks for the help @indev450 ! <3
2025-09-02 21:27:28 +02:00
Alug 039daa0145 inline P_PointOn stuff + fix declarations 2025-09-02 14:56:41 +02:00
Alug a425935bc4 Merge branch 'Saturn-Next' into Saturn-Testing 2025-09-02 14:56:36 +02:00
indev 6af09bd215 Add offset for small nametags in opengl without shearing enabled 2025-09-01 19:56:42 +03:00
Gustaf Alhäll 015d9208e3 Refactor software blitting logic 2025-09-01 18:24:53 +02:00
Alug f247796ffc small cleanup PT_ServerTics 2025-09-01 11:03:31 +02:00
Alug 29c72be994 Revert "Always accept tics received from the server"
This reverts commit 29006e9926.

Causes random desynchs
2025-09-01 10:58:28 +02:00
Alug 8d70016edc use a macro for mobjtimefrac
just looks a little tidier
2025-08-31 13:36:08 +02:00
Alug 6919b9fd91 skip distance checks if we dont use interpolation
will also indirectly skip calling R_GetTimeFrac
2025-08-31 13:36:05 +02:00
Alug c5d58f5de2 this went missing during merge 2025-08-31 13:36:02 +02:00
GenericHeroGuy 4855d29d31 Fix interpolation going missing for freecam 2025-08-31 13:35:57 +02:00
GenericHeroGuy 2d22c2b265 Rework rendertimefrac and gate it behind a function
Fixes intermission background shifting when toggling fullscreen (yup)
and fixes audio caption text losing interp when paused
2025-08-31 13:35:54 +02:00
Alug acf121cac6 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-31 13:35:51 +02:00
Alug 94d01d1ee9 check clientcfg packet length to skip potential garbage data
dont think this ever broke, but better safe than sorry
2025-08-30 14:43:04 +02:00
Alug e3c9ae6de5 replace strlcat and strlcpy with OpenBSD versions in "string.h"
those started throwing warnings on Windows, so just use the BSD ones, since those also match with what we got on nix
2025-08-28 15:51:57 +01:00
Alug dff8f549da precalculate linedef angles
so we dont have to recalc it runtime
the map is static and linedefs shouldnt be able to be moved so this should be fine
2025-08-28 16:25:59 +02:00
Alug b93a5c5305 replace those with P_GetLocalPlayerForNum 2025-08-28 16:25:35 +02:00
Alug 0c75d8aca3 P_CheckCameraPosition can be static 2025-08-28 16:25:18 +02:00
Alug 71c28ad00b Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-08-28 16:25:14 +02:00
indev 7e5acd72c1 Make replay search textbox fit on all resolutions 2025-08-28 15:37:03 +03:00
Gustaf Alhäll 29006e9926 Always accept tics received from the server 2025-08-28 10:10:29 +02:00
indev 10d4365376 Pass rgba or fadergba pointer into P_LoadSideColormapGL directly 2025-08-27 23:17:18 +03:00
Alug 611edea6e0 make paletterender lightlevel shifting less ambigous
that macro was from the older approach, but is uneeded now
this better shows whats going on here
2025-08-27 10:11:30 +02:00
Alug fcbf45521a smol optimizations by avoiding multiple reevaluations
due to clamping macros, those may get reevaluated multiple times
nothing crazy
2025-08-27 10:07:34 +02:00
Alug 32d8120516 make sure subsec gets initalised to smth 2025-08-27 09:01:35 +02:00
Alug fdba6a253a dont recheck paletterendering state multiple times during opengl lighting calc 2025-08-26 19:33:31 +02:00
indev 18bdbfdb07 Revert using quick dist functions in lua hud, since some lua scripts need it to be precise (lua driftgauge for example) 2025-08-26 20:17:40 +03:00
Alug 6f93299aaf wonky: cache and reuse our testpoint subsector for sloped mobj z checks
its suprisingly common for the test coords to not change between calling those functions, so we can potentially save us alot of R_PointInSubsector calls
Need to check for branch prediction slowdowns, but from some quick timedemoing, this speeds up things a bunch
2025-08-26 18:05:33 +02:00
Alug c47814c29a dont revaluate HighestOnLine twice for slope mobj z checks 2025-08-26 17:49:40 +02:00
Alug 0dd49869f5 Merge branch 'fastfilesearch' into Saturn-Testing 2025-08-26 12:05:23 +02:00
Alug 74c9c09fcd remove skipexclude variable
with the folderchange check this becomes erronous
2025-08-26 12:04:14 +02:00
Alug 6f891dd235 use GetFileAttributes for pathisdirectory on Windows
should slightly speedup gamestartup with autoloaded files
2025-08-26 10:39:02 +02:00
Alug 6e123b0732 fix filesearch portability 2025-08-26 10:38:58 +02:00
Alug 2c51c9f5f8 use GetFileAttributes for pathisdirectory on Windows
should slightly speedup gamestartup with autoloaded files
2025-08-26 08:36:00 +01:00
Alug 8a781b4fa2 fix filesearch portability 2025-08-26 08:34:57 +01:00
Alug e3a79ab099 fix windows compile 2025-08-26 08:24:51 +01:00
Alug 05364cc4dc fix "invert encore special"
R_NoEncore always checked for the wrong special "240"
we keep that behavior for compat, incase someone else figured it and used that
2025-08-26 09:44:00 +02:00
Alug 3c5d997eff simplyfied P_PointOn checks from prboom
should be functionally identical
2025-08-26 09:43:11 +02:00
Alug 696a9ea464 smol cleanup r_data 2025-08-26 09:43:05 +02:00
Alug c2d97397e8 test: use faster distance and sight functions for hud hooks 2025-08-26 09:42:58 +02:00
Alug 4f534c5ce3 remove d_main include from filesrch 2025-08-25 16:12:57 +02:00
Alug 15288ced57 this ceepeepee 2025-08-25 16:10:49 +02:00
Alug 30eca524d9 remove d_main include from filesrch 2025-08-25 16:10:46 +02:00
Alug 168a2c9684 just drop the connection instead of I_error if connection gets lost
partial port from srb2classic
2025-08-25 15:40:50 +02:00
Alug 0e05dca3d5 try to fix nodes being occupied if connection didnt recieve any acks
partial port from srb2classic
2025-08-25 15:40:50 +02:00
Alug 717f5e3c13 Merge branch 'fastfilesearch' into Saturn-Testing 2025-08-25 13:10:03 +02:00
Alug 2cad7f7210 dont recheck if we should skip the folder if folder did not change
saves a whole lotta string comparisons and speeds this up even further
2025-08-25 12:56:09 +02:00
Alug 34783cfe94 dont evaluate strtol multiple times 2025-08-25 03:39:37 +02:00
Alug 12149a4773 target x86-64-v2 instead of nocona for 64bit windows
slightly newer target, should still be compatible enough with anything from 2009 and onwards
may help with compiler optimizations
needs some testing
32bit builds remain unchanged as they are intended purely for compatibility
2025-08-24 23:02:13 +02:00
Alug 7d81990699 always set this to 0
dont need to check this beforehand
2025-08-24 23:02:09 +02:00
Alug 531de8bd1e make lua string to number conversion consistent between platforms
effectively clamps it to 32bit range
maybe fixes some issues between windows and other builds
2025-08-24 23:02:06 +02:00
Alug 232e6a4b5b use hash checks for W_CheckNumForName 2025-08-24 23:02:03 +02:00
Alug 65d3684d0b Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-24 23:01:53 +02:00
Alug 6017543666 dont try to make glpatch from nothing 2025-08-24 23:01:48 +02:00
Alug 7c7f924ef1 actually dont add any level interpolators on render_none 2025-08-21 18:33:11 +02:00
Alug ba40d45321 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-08-21 18:33:08 +02:00
indev 3af0009453 Fix off-by-one in M_FindFirstMap 2025-08-20 16:18:33 +03:00
Alug 7ac01390d0 dont add mobj and level interpolators on render_none
i dont think we need to interpolate anything on dedicated
this should improve performance a bit on maps with many mobjs/moving level stuff
2025-08-19 11:49:59 +02:00
Alug 6dee986a28 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-19 11:49:56 +02:00
Alug 145eecf8a4 move sprite reset stuff into R_ResetMobjInterpolationState
this also gets called at the start of the tic
and sets a bunch of rendering crap eitherways
so we can save another thinker loop and a bunch of checks with this
bit of perf gain, 3-4fps on that awful hadal trench timedemo
2025-08-19 11:49:29 +02:00
Alug 080719c251 move all of this stuff into the switch above it lel 2025-08-18 17:56:38 +02:00
Alug d58719d09b cleanup and splitup P_LoadSideColormaps 2025-08-18 17:56:35 +02:00
Alug 05d1eab441 remove bottommap,midmap and topmap stuff
was non functional anyways so get rid of it
2025-08-18 17:56:31 +02:00
Alug caffda3221 dont need to do this without viewmorph stuff 2025-08-18 17:56:08 +02:00
Alug 650a50278a move camera slidemove stuff behind ifndef NOCLIPCAM
dont think this is needed at all with camera noclip
2025-08-18 17:56:05 +02:00
Alug 1ef0909204 dont need to completely clamp those
we already check for the top coords right before
2025-08-18 17:55:55 +02:00
Alug 42878841e6 Fix FOF intersections in multitagging for the renderer.
backport from srb2
2025-08-18 17:55:52 +02:00
Monster Iestyn 34e4cf123d Fix FOF slopes briefly glitching on level load in software mode, by ensuring the FOFs' target sectors have hasslope set on creation 2025-08-18 17:55:48 +02:00
Alug 7ffb3ebdfe Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-18 17:55:45 +02:00
Alug 684a43a95c fix software extra 3d floors
lmao was a copy paste oopsie from ages ago
shoutout to phoenix´s new map making me find this
2025-08-18 16:49:36 +02:00
Alug 4fcb41f659 mark stuff for blitting loop as const and with register
gives another 5-7fps or so for me
2025-08-17 18:19:20 +02:00
Alug 2d1c876e0d Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-16 22:21:13 +02:00
Alug 8d1ef1721f port srb2classic´s sdl blitting stuff for software
all credits to hanicef
mostly from https://codeberg.org/srb2classic/srb2classic/commit/a1fa0b89dbf75ef8be17c9ca5c728cc9c1848582
and
https://codeberg.org/srb2classic/srb2classic/commit/a1cf54e66ad1cb66af99056bc940fc68dce24224

boosts my fps around 20-25 fps
2025-08-16 22:20:58 +02:00
Alug 02ffceb300 fix rotating polyobject interpolation 2025-08-16 22:20:55 +02:00
Alug 44fe156751 update comment for lightcontrast 2025-08-16 22:20:52 +02:00
Alug aca48d69cd style fixes 2025-08-16 22:20:48 +02:00
Alug 294ce055cd mark this with restrict 2025-08-16 22:20:33 +02:00
Alug 4117eb5b40 fix Paranoia compile 2025-08-16 22:20:30 +02:00
Alug a9068ee162 mark this with "noreturn"
clang kept yelling for some reason
2025-08-16 22:20:27 +02:00
indev 9549a204a5 Add tooltip for centered chat text 2025-08-15 22:57:09 +03:00
indev c276736002 Add option to center text in chat (chatcentertext) 2025-08-15 21:51:58 +03:00
Hanicef cfd960124e Do not access memory on misaligned addresses 2025-08-15 10:11:07 +02:00
Alug 77cd898bd2 TEST: compile with fwrapv
fixes clang desynchs with prng
maybe other stuff/platforms aswell
2025-08-15 10:02:59 +02:00
Alug e7c40dd914 fix -Wunused-value warnings
we dont do anything with this, so just skip both
2025-08-15 10:02:56 +02:00
Alug bcb1a1d5eb port RR´s c++ compatible byteptr macros
means we can also get rid of the mumble hack
2025-08-15 10:02:52 +02:00
Alug bf53db8d68 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-15 10:02:48 +02:00
Alug b5dfe74cfe add USECLANG compile flag to force building with clang 2025-08-15 08:01:58 +02:00
Alug 6c891f1146 supress align and unkown pragma warnings in clang 2025-08-15 08:01:56 +02:00
Alug 7d06f59da5 append those to LDFLAGS instead of libs
so they may be passed to other things
2025-08-15 08:01:47 +02:00
Alug 9dee0f0ea8 fix restrict being in wrong place in declaration R_DrawColumnPixel 2025-08-15 08:01:37 +02:00
Alug 9338b5b10f dont need to realloc this
didnt see when i added realloc everywhere this doesent need to keep old data
2025-08-14 16:19:17 +02:00
Gustaf Alhäll b7ecffedcd Fix pixel shift caused by negative pixel positioning in software 2025-08-13 22:44:25 +02:00
Alug 71ab8c0b7d workaround for lua menu conrols for spectators
TODO: refactor all of this into one cmdbuilder and get rid of the codedupe in p_user for cameracmd
2025-08-13 22:40:50 +02:00
Alug 8901c62201 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-13 22:40:46 +02:00
Alug 7deeb4486f port RR camera slope pitch stuff + make it toggable
"cam_pitch" this makes the camera pitch on upwards and downwards slopes a bit
2025-08-13 18:01:00 +02:00
Alug a559e36306 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-12 20:29:18 +02:00
Alug 602bd1a010 fix directional light stuff 2025-08-12 20:29:13 +02:00
Alug f57b8092fc dont need to reinit those gl vars 2025-08-12 20:29:10 +02:00
Alug 5777c638f1 hack for vanilla gba rr cyan floor in gl 2025-08-12 20:28:54 +02:00
Alug 60307da80e move dedi idle stuff into function + port smol cleanup from srb2 2025-08-12 20:28:51 +02:00
Gustaf Alhäll d6e97c328a Simplify NetXCmd client distribution 2025-08-12 20:28:48 +02:00
Alug e4f35e827d free minimap patch on mapload 2025-08-11 13:48:02 +02:00
Alug e7cab1a376 check if minimaphead exists
hopefully fixes a random crash there
2025-08-11 13:47:59 +02:00
Alug 6eb1114d17 reduce scope of some more netstuff 2025-08-11 13:47:54 +02:00
Alug e6a0b4f58b fix oopsie copy paste 2025-08-10 18:34:43 +02:00
Alug c8d9ff6575 use GetFileAttributes also for preparefilemenu
untested as of now
2025-08-10 18:34:40 +02:00
Alug 0d9d176415 use GetFileAttributes instead of stat for filesearch on windows
this is slightly faster and the recommended way of doing this
apparently stat on windows has to emulate some POSIX stuff for that which may slow it down
2025-08-10 18:34:35 +02:00
Alug e1413764f6 speedup addon search
by adding a blacklist of folders
logs, luafiles, replay etc shouldnt ever contain addons so those can be skipped entirely
this massively speeds up searching for addons on windows
also will make findfile try to search in the designated addon folders first so it doesent look in the home or kart folders before it
this is probably not the best way to do things
but idk what im even doing, im not a coder just some chao who likes to sleep all day
2025-08-10 18:34:11 +02:00
Alug ca04e084a2 link stdc++. pthread and gcclib statically on windows
fixes the game throwing super cryptic errors when you dont have the right dlls
2025-08-09 23:32:03 +01:00
Alug 56d03042ec link stdc++. pthread and gcclib statically on windows
fixes the game throwing super cryptic errors when you dont have the right dlls
2025-08-09 23:31:55 +01:00
Alug 0c8df833e9 test: use SDL_GetDesktopDisplayMode instead of SDL_GetCurrentDisplayMode
this seems to fix some smol freezes for some
need to test this a bit
2025-08-09 22:32:24 +01:00
Alug f275eb5f9a test: disable sdl textinput when not using native keyboard layout
this may fix issues on newer sdl2/-compat versions with dead keys on non us layouts
2025-08-09 22:32:20 +01:00
Alug 88081068e9 fix oopsie copy paste 2025-08-09 22:32:13 +01:00
Alug 9893584b4f use GetFileAttributes also for preparefilemenu
untested as of now
2025-08-09 22:28:45 +01:00
Alug 0b4fad3cca use GetFileAttributes instead of stat for filesearch on windows
this is slightly faster and the recommended way of doing this
apparently stat on windows has to emulate some POSIX stuff for that which may slow it down
2025-08-09 21:26:15 +02:00
Alug bbb4749815 speedup addon search
by adding a blacklist of folders
logs, luafiles, replay etc shouldnt ever contain addons so those can be skipped entirely
this massively speeds up searching for addons on windows
also will make findfile try to search in the designated addon folders first so it doesent look in the home or kart folders before it
this is probably not the best way to do things
but idk what im even doing, im not a coder just some chao who likes to sleep all day
2025-08-09 17:21:21 +02:00
Alug 4fc780298f remove I_BaseTiccmd
just complicates things, can just memset our ticcmnds instead
psure this was used ages ago for smth but its not needed here at all
2025-08-09 17:21:18 +02:00
Alug f24f3b5b23 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-09 17:21:15 +02:00
Alug ff6279a406 add P_GetLocalPlayerForNum
just to get rid of ternaries lel
2025-08-09 17:21:08 +02:00
Alug c36f64e97b use memcmp for legacy sky check
just gotta know if first three letters match it
2025-08-09 17:21:05 +02:00
Alug 2c4bee6e6a Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-08-09 00:50:50 +01:00
Alug 7b776f01bd change flow of K_drawKartStats a bit
nothing notable, just the non splitscreen path will return early now
2025-08-08 22:43:43 +02:00
Alug 43b7492300 disable pointless "Couldn't read mobj_t" warnings in replays
mobjs just cannot be unarchived in replays ever
so this will always spam those for something that WILL never work in kart
maybe if i decide to fix this for 32p or smth those become useful again
2025-08-08 22:29:29 +02:00
indev 1fe79fe236 Add -strict, -strict-soc and -strict-lua cli params
Both trigger I_Error if a warning occurs during addon load in a SOC or lua
script
2025-08-08 18:59:07 +03:00
Alug 222b63d2c3 move the windoze thing to windoze makefile 2025-08-08 17:53:25 +02:00
indev a7c41b458a Use NOLIBGME instead of NOGME 2025-08-08 18:33:24 +03:00
indev 3901c7c7da Revert "Fix makefiles checking for NOLIBGME instead of NOGME"
This reverts commit 932a08b2da.
2025-08-08 18:31:45 +03:00
indev 932a08b2da Fix makefiles checking for NOLIBGME instead of NOGME 2025-08-08 18:29:05 +03:00
indev 4c97a4f9e0 Fix potential buffer overflow in DEH_LoadDehackedFile 2025-08-08 17:53:46 +03:00
indev a1d16b4613 Update dedicated/i_sound.c I_StartSound and I_UpdateSoundParams 2025-08-08 17:43:40 +03:00
Alug 16e1e00c67 "reenable" midi support
well it was never really disabled, but like this we can atleast change its volume lel
menu entry is still disabled, i dont think theres a single map with midi music, so this would just clutter the menu
2025-08-08 00:55:06 +02:00
Alug b76fc9699a fixup midi menu stuff
i love M_DrawSkyRoom
2025-08-08 00:55:03 +02:00
indev cb3638e3ab Add SetupVote hook 2025-08-07 23:48:11 +03:00
Alug e85d91e682 save a few checks for st debug drawer
if we dont use it
2025-08-07 22:27:28 +02:00
Alug 2653b59af4 dont double free our vote patches
those may point to the same thing so uhhhh
PU_PATCH_LOWPRIORITY will ensure the memory will be freed on mapload
2025-08-07 22:26:27 +02:00
Alug caff071a1b fix spacing in Z_CheckHeap errors 2025-08-07 22:10:03 +02:00
JugadorXEI 86ccf40884 Fix displayplayers.iterate hang when multiple viewports view the same player 2025-08-07 20:51:31 +02:00
Alug 85dba64b84 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-07 20:51:28 +02:00
Alug 40165fd6db make leveltitlecard be affected by colour hud 2025-08-07 19:42:39 +02:00
Alug c701e1fe7e make inputdisplay colour match the rest of colourhud better 2025-08-07 19:38:03 +02:00
Alug 525e19566e smol refactor hwr precache
not faster or anything
real time consuming thing is he actual calls to getetxture and getflat
2025-08-07 19:38:00 +02:00
Alug 27e734bde0 make music toggle/volume handling less of a mess
based on work in srb2 from sphere
this gets rid of all the duplicated midi stuff
since we dont really have a whole midi soundtrack like srb2, S_GetMusicLumpNum will always prefer non midi music
2025-08-06 19:49:35 +02:00
Alug fa10eb5801 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing 2025-08-06 18:09:24 +01:00
Alug 2e44a50f7f Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-06 00:13:39 +02:00
Alug bd53786887 fix LoadElevatorThinker interp oopsie 2025-08-06 00:12:34 +02:00
Alug ad1b1eabe4 fix levelstuff not being interpolated on netgame join or resynch
i love polyobjects
2025-08-06 00:10:47 +02:00
Alug 2de9a2be68 fix a desynch due to wrong assumption 2025-08-05 18:33:02 +02:00
Alug e120907e0f make driftgauge stuff a bit more readable 2025-08-03 20:12:13 +02:00
Alug b0c217201e move flat cyan check into a function
and also limit it to software renderer only
we dont need this anywhere else, so can save a bit of work
2025-08-03 15:59:57 +02:00
Alug dac7026739 use R_GetFlat here
does the exact same thing
2025-08-03 15:59:23 +02:00
Alug 91a4646f19 dont PU_CACHE our planeflats 2025-08-03 15:51:52 +02:00
Alug 8963e17b83 check if __THROW is defined
Windows does not have it at all, so we gotta check this otherwise compile may fail
2025-08-03 14:40:09 +01:00
Alug 8ba52e2530 check if __THROW is defined
Windows does not have it at all, so we gotta check this otherwise compile may fail
2025-08-03 14:40:01 +01:00
Alug bf2184582a delet those 2025-08-03 16:30:56 +02:00
Alug 501a770fee Merge branch 'optional-freeslot-test' into Saturn-Testing 2025-08-03 16:30:25 +02:00
Alug 327f7085f6 idk whats up here with the win libs 2025-08-03 16:30:17 +02:00
Alug 8aef549cfc restore optional freeslot stuff 2025-08-03 16:24:35 +02:00
Alug 8dd268b83e fix conflicts 2025-08-03 16:23:00 +02:00
Alug 5fddc3156b Merge branch 'Saturn-Next' into optional-freeslot-test 2025-08-03 16:22:30 +02:00
Alug d6976ca64f inline most of lua lib stuff
a bit faster
2025-08-03 16:15:15 +02:00
Alug 809219d5e8 Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-03 16:08:20 +02:00
Alug 278dd12ced Merge branch 'Saturn-Next' into Saturn-Testing 2025-08-03 15:51:58 +02:00
Alug f3cfa969c9 TEST:raise size of sectors considered too smol for precip
theres been a bunch of very smoll sectors that still get precip spawned (see howling bogs, outside of the actual map)
this i just an abitrary value, so gotta see how thi s goes
2025-08-03 15:39:01 +02:00
Alug 7b64b22012 some tiny optimizations 2025-08-03 15:38:58 +02:00
Alug 267ccae3a9 Add driftpulse controller rumble
inspired by radioracers, this does a "weak" rumble pulse the moment the sparks pulse (this is slightly after reaching the new driftlevel)
may want a toggle for this
2025-08-03 15:38:55 +02:00
Alug 5f77dbb946 cleanup the wadpath mess 2025-08-03 15:38:51 +02:00
Alug 1a46d7d16c HACK reset demo.inreplayhut on levelload when not in replay playback
this is really hacky, but M_QuitReplayHut will be skipped if we change maps, connect to a server or basically anything in that manner from within a replay that we started from the replayhut
which can lead to crashes or the replayhut to become nonfunctional
note, like this demolist is not freed, but that shouldnt matter much since it will be freed anyways the moment you open the replayhut again
2025-08-03 15:27:55 +02:00
Alug c8a2278cb7 Testing again 2025-08-03 15:25:13 +02:00
Alug 75b269d4bb Merge branch 'updatemd5' into Saturn-Testing 2025-08-03 15:24:39 +02:00
Alug 35e499027d Merge branch 'texhash' into Saturn-Testing 2025-08-03 15:24:34 +02:00
Alug 356b2f279c Merge remote-tracking branch 'origin/winzlib-ng' into Saturn-Testing 2025-08-03 15:24:30 +02:00
Alug eba5965220 move rainbow color calc into K_Rainbowcolor 2025-08-03 14:42:49 +02:00
Alug feda0bae80 update md5 lib
no real changes, mostly just cleanup and some memory alignment fixes
2025-08-03 00:38:52 +02:00
Alug 44ecb677ad fix merge conflicts texturehashing 2025-08-03 00:37:28 +02:00
Alug 3e99f4d142 Do not reload every texture when adding a wad (squashed)
port of https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1725#c829d21709a4f5cd81d140271e883bc40dd00b1b
2025-08-03 00:35:46 +02:00
chromaticpipe d6b838f7cb GIF Dynamic Delay 2025-06-02 15:57:43 -05:00
indev 14400097dd Only do lookup for mobjtype and states for drift stars and water trails at map load 2024-07-29 01:04:46 +03:00
indev c44c0e10c1 Lets not compile lua code multiple time each frame x) 2024-07-27 03:28:13 +03:00
indev bbf49db184 Oops 2024-07-25 21:24:29 +03:00
indev 15787a97bb Make water trail not use hardcode freeslots too 2024-07-25 21:17:48 +03:00
indev b76ce23ed2 Make drift stars not use hardcode freeslots 2024-07-25 19:02:39 +03:00
Alug d6c5066bfd let autoload run later to mitigate server join issues
itll now run at a similar place to postautoload
this may hopefully prevent some issuess with freeslotting lua
however sadly this makes menu replacements not work at startup anymore
2024-07-25 16:42:33 +02:00
Alug 60783d7109 fix fail condition 2024-07-23 22:02:54 +02:00
Alug db525f15da make backup of kartconfig before writing to it 2024-07-23 21:48:38 +02:00
Alug f33daf6bee toggle palrendering and fbo off if screen textures are disabled 2024-07-23 20:31:34 +02:00
Alug d13928b394 add cam check here 2024-07-23 20:06:01 +02:00
Alug 5613a0d173 reset tilt when respawning 2024-07-23 20:02:20 +02:00
Alug aa38586f82 simplify this 2024-07-23 19:01:44 +02:00
Alug d2b1ceb641 forgor this 2024-07-23 18:56:51 +02:00
Alug 9dd7e9a25f fix up bird screen tilting
removes old lerp variables that did nothing
properly interpolated viewroll
made it proper adjust to mobjscale
doesent roll view when spectating
general cleanup
2024-07-23 18:54:27 +02:00
Alug 1648273ddd allowjoin now sets saturnjoin to its value use CV_StealthSet to prevent
its only for scripts pretty much so no need to toggle it seperately
2024-07-23 17:45:00 +02:00
Alug 3f90e4f12a add "allowsaturnjoin" cvar to let toggle allowjoin for saturn clients seperately 2024-07-23 17:07:59 +02:00
Alug 2b9d565f0c e 2024-07-23 00:59:15 +02:00
Alug 70af63cc94 add to menu 2024-07-23 00:55:48 +02:00
Alug 64b92881f9 changuer how this works
counter decrements - 1 double the cooldown time
2024-07-22 23:36:13 +02:00
Alug be5ea069ad add gamestateresendattempts
so you can specify how often the game tries to resend gamestate to player in given time
so they dont get stuck in a synch loop
this is gamestateresendattempts value in the time of resynchcooldown *2
2024-07-22 23:09:04 +02:00
Alug 71e9357114 add check here too 2024-07-22 22:20:42 +02:00
Alug e28f86ac32 add "gamestatecooldown" cvar
to be able to change the cooldown between gamestate resends
2024-07-22 22:20:38 +02:00
Alug f97fe4bd65 Test: Restore save_p after P_LoadLevel
P_LoadLevel calls some functions that save gamedata and
unset save_p.

this is kinda hacky but i perhaps will port the redone save buffer sometime
2024-07-22 19:51:56 +02:00
Alug 3d0ac03f06 optimize MT_TUBEWAYPOINT
Store waypoints at map load instead of iterating through the thinker list to find them

https://git.do.srb2.org/STJr/SRB2/-/merge_requests/938
2024-07-22 19:51:44 +02:00
Alug 094132b7d3 Make polyobjects agree with sector lighting/colormap like a FOF. 2024-07-22 19:03:14 +02:00
Alug 51b9c9ae5a prevent potential level load crash 2024-07-22 18:13:06 +02:00
Alug d31941ef13 don't check flippedness in HWR_RotateSpritePolyToAim if the mobj is actually a precipmobj! 2024-07-22 18:08:26 +02:00
Alug 48db826142 2 2024-07-22 12:58:28 +02:00
Alug 32b62d19ff add missing copyright stuff to k_director 2024-07-22 12:57:29 +02:00
Alug e4f2961129 lagless cam test 2024-07-21 23:28:29 +02:00
Alug eba09dfad2 Revert "Free mipmaps before freeing tags"
This reverts commit 2437c5a19a.
2024-07-21 23:25:32 +02:00
Alug d9b72fcae6 whitespace hell 2024-07-21 22:51:36 +02:00
Alug 6f17e7f735 revert this
doesent do anything but complicate stuff lol
2024-07-21 22:46:01 +02:00
Alug 047b82acc0 remove hw_light 2024-07-21 22:38:51 +02:00
Alug 5347039d75 cleanup hw_main 2024-07-21 22:23:21 +02:00
Alug edc8095577 cleanup r_things a little 2024-07-21 22:21:01 +02:00
Alug 06f69723c2 fix this oops 2024-07-21 20:22:10 +02:00
Alug 8218fd4f57 stop yelling clang 2024-07-21 20:07:39 +02:00
Alug 6ee22edac5 smol cleanup
also check for splitscreen and if not dont run a for loop lul
2024-07-21 20:07:23 +02:00
Alug 37215ef1f4 clean director up a little
toggling director now resets cooldown so it switches players immediately
also consolidated condition to be active
and ensure DirectorFollowAttack doesent always run when it doesent need to be
2024-07-21 19:35:17 +02:00
Alug a2eb2222b9 more reference fixes 2024-07-21 17:38:06 +02:00
Alug d63b4d9463 Revert "attempt at mitigating palette bug in ogl"
This reverts commit 3bd85c20bc.
2024-07-21 16:21:56 +02:00
Alug 3bd85c20bc attempt at mitigating palette bug in ogl 2024-07-21 16:10:23 +02:00
indev f70063c7d8 Add director hud indicator 2024-07-21 17:03:27 +03:00
Alug a2f7dd7408 fix cmake 2024-07-21 15:45:53 +02:00
indev 147014d43a Add bind for director toggle 2024-07-21 16:11:33 +03:00
Alug 9460d1e9a1 oops 2024-07-21 15:11:28 +02:00
Alug b3a9a6b59a add stuff for directordebugger i forgor 2024-07-21 15:11:01 +02:00
Alug 69f7d669c8 only update director if consoleplayers specs or in demo playback
dont need to update this ever if we dont even use it lol
2024-07-21 14:42:48 +02:00
Alug 74a68b1462 fix crash if everyone spectates 2024-07-21 14:42:17 +02:00
Alug 006ea90493 port director from RR 2024-07-21 14:20:54 +02:00
Alug aede063266 Merge remote-tracking branch 'origin/absolutehell' into lugstuff 2024-07-20 19:47:37 +02:00
Alug 5aaeff4c5d improve virtual resource management 2024-07-19 22:44:12 +02:00
Alug 5f80d6c18d fix hoop midjoin crash in the dumbest way possible
cant figure out why it crashes so thisll do lol
2024-07-19 22:42:50 +02:00
Alug 7c59c9e6ec fix ScreenCoords on 2 plyr splitscreen and shearing
+ remove non 16:10 hack since that issue was fixed elsewhere
2024-07-19 19:25:05 +02:00
Alug aae83b3235 disable hudoffsets in splitscreen 2024-07-19 18:52:53 +02:00
indev 520165128a Add option to play power items sfx for growmusic and supermusic 2024-07-19 18:17:23 +02:00
Alug 556ced63cf whoopss remove test stuff 2024-07-19 14:39:23 +02:00
Alug 063bf830ff make a packet to tell if a joined client is on saturn
initial stuff
works and seems to be vanilla compatible
needs its own function and other things to be useful
2024-07-19 14:38:38 +02:00
Alug 7fd3bd412c reenable gme music position setting 2024-07-19 12:13:20 +02:00
Alug 47b9508af2 lul 2024-07-19 01:22:36 +02:00
Alug 417c44aad0 lül 2024-07-19 01:20:18 +02:00
Alug 1fefa0a99a remove spriteclipshader crap 2024-07-18 15:23:27 +02:00
Alug 06db4d2b62 add audio buffer size into sound menu 2024-07-18 14:43:05 +02:00
Alug bf7fc12a8d revert this in teleport 2024-07-17 22:19:03 +02:00
Alug 395daf57fa Revert "clean up mapload code a little more"
This reverts commit 79a5d174a5.
2024-07-17 12:26:38 +02:00
indev 97219b7a84 Attempt to fix possible use-after-free for awayviewmobj 2024-07-17 11:56:22 +02:00
Alug 0d5d677eff Skip over empty entries when populating vres, saving memory 2024-07-17 11:56:19 +02:00
Alug 3bd6c99a3b vres_GetMap: Count resources in folders up until next 0-length lump
justs in case the order of stuff may be weird
fixes keepmapmusic crash on some maps
2024-07-17 11:56:17 +02:00
Alug 1d2d8d58db clean up mapload code a little more 2024-07-17 11:56:14 +02:00
indev 9909b002fe Fix linedef 415 executing random text if script lump doesn't have null terminator 2024-07-16 15:46:37 +02:00
Alug ccda1ef104 did not mean to add this lol 2024-07-16 10:43:47 +02:00
Alug 52a882bda2 remove this check 2024-07-15 21:58:07 +02:00
Alug 177c60e857 fix more warnings 2024-07-15 21:43:48 +02:00
Alug 0566b96738 fix some warnings in clang 2024-07-15 21:43:46 +02:00
Alug f72c179f56 fix A_ action protottypes 2024-07-15 21:43:44 +02:00
Alug 0da963c794 Revert "fix some clang warnings"
This reverts commit fea89de037.
2024-07-15 21:43:40 +02:00
Alug 7d885f7100 dont access delayremoved thinkers
uhhh
2024-07-15 14:34:33 +02:00
Alug c1c2f794e3 more mobj reference fixes + cleanup 2024-07-15 13:58:08 +02:00
Alug 8bb1c7a032 Revert "run this in actual fullscreen"
This reverts commit 4a2d6b2241.
2024-07-14 18:03:21 +02:00
Alug 804123afc1 ndef 2024-07-14 17:32:33 +02:00
Alug 8e4f278ce4 this does nothing lol 2024-07-14 17:15:31 +02:00
Alug 3193241b11 shut up 32bit gcc 2024-07-14 16:59:54 +02:00
indev edb44fa6a2 Refactor music name scrolling in music test 2024-07-14 16:59:46 +02:00
Alug 66e9ac3657 Free mipmaps before freeing tags
ŝhould hopefully fix some random Z_free crashes
2024-07-14 16:44:09 +02:00
Alug 87e0796bf4 inline M_Memcpy 2024-07-13 15:55:30 +02:00
Alug 6bc6db3665 also use IFCHANGED macro for levelinterpolators
just looks a bit neater
2024-07-13 15:12:43 +02:00
Alug 2a4aa51373 Revert "smol optimization to HWR_Addline"
This reverts commit e6359663b1.
2024-07-13 14:55:28 +02:00
Alug e15b052570 Revert "shut up gcc"
This reverts commit 17a5c6ed06.
2024-07-13 14:55:26 +02:00
Alug 629e249a12 Revert "dont do this with portals"
This reverts commit f949fa54af.
2024-07-13 14:55:21 +02:00
Alug 86a260bb89 fix NOHW compile 2024-07-13 14:54:55 +02:00
Alug 6ab2de2787 shut up windoze 2024-07-11 10:36:27 +02:00
Alug 8effdc1615 Clean up graphic menus
- Renamed Experimental Options to Advanced Options
- Fixed the tooltips not displaying
- Made it look good again
2024-07-10 19:26:40 +02:00
Alug 561fc2d01a only interpolate pitch and roll when using 3d models
sprites dont need this for now
2024-07-10 18:43:20 +02:00
Alug 3fd9cf573b dont think precip mobj angle ever changes 2024-07-10 18:42:42 +02:00
Alug d7c0bed4eb remove those 2 from experimental video menu
no reason to ever toggle them off
2024-07-10 18:35:04 +02:00
Alug afd1f595e1 remove cv_grfofcut
same story
2024-07-10 18:34:45 +02:00
Alug f47a43df2f remove cv_slopepegfix
same as the other ones
2024-07-10 18:34:13 +02:00
Alug 4385327101 remove cv_fofzfightfix
more bloat
2024-07-10 18:33:25 +02:00
Alug 4e73c05ef9 remove R_Pointtoangle toggle
its bloat, the difference is negigble at best
2024-07-10 18:32:57 +02:00
Alug c01ef035a5 remove cv_mobjssector
idk why it even checks for pointinsubsector
2024-07-10 18:31:46 +02:00
Alug b59c080943 fix IFCHANGED macro 2024-07-10 18:31:39 +02:00
Alug 814c65b290 dont do this with portals 2024-07-10 09:21:58 +02:00
Alug 9f1c1c3f18 dont need to check this in precip 2024-07-10 08:49:19 +02:00
Alug e0df7dfba5 shut up gcc 2024-07-10 07:12:58 +02:00
Alug 220db7212f inline some crap 2024-07-10 07:11:38 +02:00
Alug d59f45a26a smol optimization to HWR_Addline 2024-07-10 06:55:47 +02:00
Alug f88d92ecee change when dynamic slopes run depending on if you joined midgame 2024-07-10 06:21:48 +02:00
Alug c28188b6d8 smol cleanup 2024-07-10 05:50:01 +02:00
Alug 80419748db forgor this 2024-07-10 05:45:06 +02:00
Alug 874e6cd5af fix conflict 2024-07-10 05:26:27 +02:00
Alug cd500fc344 clean up P_SetupLevel a little more 2024-07-10 05:25:31 +02:00
Alug ae7afc5749 Map data lump interface
cleans up code alot and stuff

https://git.do.srb2.org/STJr/SRB2/-/merge_requests/535
2024-07-10 05:25:22 +02:00
indev b0fa94c781 Call ServerJoin hook when consoleplayer becomes available, since it is needed for configs (which what this hook is created for) 2024-07-10 05:23:53 +02:00
indev 9bf717fae9 Add info about ServerJoin into LUASTUFF.md (so i don't forget to do it later) 2024-07-10 05:23:47 +02:00
indev 859c1020e6 Add ServerJoin lua hook, which gets called when client joins a server (listen server hosts joining their server also count) 2024-07-10 05:23:22 +02:00
Alug 9108d64820 mitigate dynamic slope desynchs
Perform dynamic slope thinking before other thinkers.
2024-07-10 05:22:38 +02:00
Alug e9d3c1a421 Fix mobj reference management of player->mo
https://git.do.srb2.org/KartKrew/RingRacers/-/commit/d0719ef5ba86a1da32fed171d74eb76c7254f4f6
2024-07-10 05:21:45 +02:00
Alug f36e069f40 unhack this again 2024-07-09 09:06:11 +02:00
Alug 1f5c7b1d12 more changes to dither
use interger for distance scales
start z factor earlier
rename halfResolution to endResolution
2024-07-09 08:39:38 +02:00
Alug 94ecb9e634 ass 2024-07-08 20:49:05 +02:00
Alug b9db67bc08 more tweaks 2024-07-08 20:42:38 +02:00
Alug c152799295 oops that actually didnt fade out at all lol 2024-07-08 20:42:35 +02:00
Alug f91165857d scale and fade out dither pattern
makes the image a bit cleaner and easier to look at in palrender
2024-07-08 20:42:29 +02:00
Alug 29b93f02f1 crap 2024-07-08 20:42:02 +02:00
Alug f9a6452528 simplify this a little 2024-07-08 20:41:27 +02:00
Alug e7e51957e9 oops this should be min 2024-07-08 20:41:17 +02:00
Alug f8903e7ce7 clean up some net stuff 2024-07-08 20:41:10 +02:00
Alug d3548a4dfb Always use system-specific path seperator
https://git.srb2.org/KartKrew/RingRacers/-/commit/0f16c61d04f42b463db5c8987571fc986ae6ce9f
2024-07-08 20:40:51 +02:00
Alug eca72c6dc6 dont think kart even supports trivial maps
so no need to constantly check for this
2024-07-08 20:40:43 +02:00
NepDisk 6e378f4de6 Leave me alonmg kate 2024-07-03 13:04:45 +02:00
Alug 94ac52d792 Clamp lindex during vissprite light calculation
Mitigates against negative or very large xscale values causing lindex
to evaluate < 0, preventing a potential colormap indexing-related crash.
2024-07-03 13:04:11 +02:00
NepDisk 1f276a7eb6 Fix automap multiplayer crash
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2488
2024-07-03 13:03:12 +02:00
Alug a28a590078 prevent potential crash when trying to kill bananachain 2024-07-03 13:02:53 +02:00
Alug 91d052d25e shut up gcc 2024-07-03 13:02:32 +02:00
Alug 2f6ded132d Zzz... 2024-07-03 13:02:29 +02:00
Alug 51cdc1ce90 forgor 2024-07-03 13:02:26 +02:00
Alug 494fe0b1e7 revert software screen shit 2024-07-03 13:02:20 +02:00
Alug eac5310f5e some crap from asan 2024-07-03 13:02:16 +02:00
Alug 7f4a2f9943 fix some clang warnings 2024-07-03 13:02:11 +02:00
Alug 28a31301d4 forgor this crap 2024-07-03 13:01:49 +02:00
Alug 1c5e575718 remove all the ogl fix toggless 2024-07-03 13:01:44 +02:00
Alug 4a2d6b2241 run this in actual fullscreen
somehow makes xwayland happy
2024-07-03 13:01:11 +02:00
Alug 001baec444 scale dithering a little diff for a little smoother "fade" in pal render 2024-07-03 13:01:06 +02:00
Alug 1b35d4f03b stuff 2024-07-03 13:00:57 +02:00
Alug 75fc8cb766 change dither matrix to 4x4
a little grittier also smol cleanup
2024-07-03 13:00:43 +02:00
indev 28bef8c54f Use a fake 2d array in dither shader so it compiles with older glsl versions (1.20 at least) 2024-07-03 13:00:36 +02:00
indev 787973a3d5 If shader compilation failed, print info log 2024-07-03 13:00:31 +02:00
Alug f0e3ca7c1f add gr_lightdithering to shader
mhhm dithering
2024-07-03 13:00:26 +02:00
Alug 1b837a81ef improve teleport interpolation stuff 2024-07-03 13:00:07 +02:00
Alug b74dd85ef2 small optimization to batching 2024-07-03 13:00:01 +02:00
Alug fc9cc62b12 remove this crap
this doesent work on nix anyways
2024-07-03 12:59:54 +02:00
Alug e665edb652 no need for this 2024-07-03 12:59:30 +02:00
Alug e81cde8753 smoller opitmizations 2024-07-03 12:58:40 +02:00
Alug 4e995436c5 optimize ogl polyobjs slightly 2024-07-03 12:58:13 +02:00
Alug c57154a8e5 prevent crash in hw bsp 2024-07-03 12:58:07 +02:00
Alug 31fbba057a remove this again 2024-07-03 12:57:44 +02:00
Alug 46fa6e7ba4 change the shader z shit again 2024-07-03 12:57:17 +02:00
NepDisk bbb0379813 Allow Users to Connect to Servers While In-Game
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2401/
2024-07-03 12:57:09 +02:00
NepDisk 156b63440e Linux customshader compilation fix
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2418/
2024-07-03 12:56:41 +02:00
Alug 20e062b031 move HWR_LoadLevel to hw_main 2024-07-03 12:56:22 +02:00
Alug c98ebc9f35 Try fix glib preallocating too much space for sound freeslots
idk why git keeps removing credits
but thx indev <3
2024-07-03 12:55:57 +02:00
Alug c6001c7bf6 this should be called on mapload 2024-07-03 12:55:42 +02:00
Alug 2d0945264f oops 2 2024-06-20 21:16:47 +02:00
Alug 3d0981cf7b oops 2024-06-20 21:13:50 +02:00
Alug cce581fa51 these appear to be unused so comment them out
dont need 6 arrays being allocated with MAXSKINS for nothing lul
2024-06-20 16:22:13 +02:00
Alug 2446b804c7 forgor this 2024-06-20 03:00:48 +02:00
Alug 20cdb1c5ec limit localskins to 32
hope this doesent just die lol
2024-06-20 02:42:49 +02:00
Alug 212b184320 Do not access memory on misaligned addresses
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2438
2024-06-17 17:11:20 +02:00
Alug 37e98f342c Revert "fix some interpolation issues"
This reverts commit ccb1aecd01d376b0c0d73bbe4c898e89e35e25d0.
2024-06-17 12:51:42 +02:00
Alug 578f5b85dd Revert "more interp fixes"
This reverts commit 3a1a58bcfc.
2024-06-17 12:51:29 +02:00
Alug 99b1e3f969 Revert "attempt at speeding up sdl_render stuff"
This reverts commit f91d3ccf24.
2024-06-17 12:51:20 +02:00
Alug 8c9ef0e8f3 Merge branch 'lugstuff' of https://github.com/Indev450/SRB2Kart-Saturn into lugstuff 2024-06-16 22:41:45 +02:00
Alug f91d3ccf24 attempt at speeding up sdl_render stuff 2024-06-16 22:41:32 +02:00
Alug 691063983e Revert "Test: kill unused skin sounds freeslotting"
This reverts commit b9b97d0a56.
2024-06-16 21:05:40 +02:00
Alug b912047f68 35/2 != 17 = 17.5 ? 2024-06-16 16:17:24 +02:00
Alug f2ddbf1e68 a 2024-06-15 21:16:25 +02:00
Alug 5cd36e55ab Maybe hopefully fix ogl masterserver crash thing
port from durr
2024-06-14 04:01:30 +02:00
Alug 1cb590ebb8 this does not exist 2024-06-14 03:00:40 +02:00
Alug 280e937844 add missing HAVE_THREADS 2024-06-13 14:47:20 +02:00
Alug 5afb55547d opengles 2 seems to be fastest for me lul 2024-06-12 22:31:47 +02:00
Alug e3c91629db use sdl ogl render instead of software for software mode on nix
oops
2024-06-12 22:31:29 +02:00
Alug 1b0496b1e7 fix some clang warnings 2024-06-12 21:56:27 +02:00
Alug b7369b40cb fix oopsie on titled software wöter 2024-06-12 21:49:20 +02:00
Alug 6567313de6 add back le returns 2024-06-12 20:51:34 +02:00
Alug 5ecf3cc36c lower min audio buffersize to 256 2024-06-12 12:59:23 +02:00
Alug 71e3d89181 move that again 2024-06-11 19:47:51 +02:00
Alug a284ece8e4 e 2024-06-11 12:59:00 +02:00
Alug e73e75e740 dumbass hack 2024-06-11 12:58:25 +02:00
Alug 9bfd61fabc shut up compiler 2024-06-11 12:58:17 +02:00
Alug a2aeaa51e8 change this to int64 cause it fixes the intermission thing on high res
idk why that fixes it tbh but it does
2024-06-11 10:02:23 +02:00
Alug b558c3db98 more interp fixes 2024-06-11 01:35:22 +02:00
Alug 0f70bcbf28 basic frame skipping system 2024-06-11 01:16:35 +02:00
Alug f7c4600007 remove windows timing crap again
it actually made stuff a little wonky so revert that
2024-06-11 01:15:32 +02:00
Alug 8910f073e5 fix encore flipcam with ogl shearing 2024-06-09 22:02:46 +02:00
Alug ea18be1866 more lööp stuff 2024-06-09 18:49:41 +02:00
Alug 0bd687eb15 reset those here ig 2024-06-09 18:49:33 +02:00
Alug 25b74bf3dd e 2024-06-09 18:14:22 +02:00
Alug e4f9ca3f3c add mobj check here 2024-06-09 18:13:17 +02:00
Alug 38a3f403bd add check earlier in p_killmobj 2024-06-09 18:03:58 +02:00
Alug 51dd2030a0 maybe fix the sock_send crash on windoze
often happens with unstable net
2024-06-08 19:24:16 +02:00
Alug 7e31067e6a fix redifinition warning 2024-06-06 18:57:04 +02:00
Alug 9bf06ff30b disable upx on nix by default 2024-06-06 18:53:40 +02:00
Alug 85aa726bb7 fix masterserver ifdef 2024-06-06 18:47:06 +02:00
Alug 3a67ff3afa fix HAVE_CURL 2024-06-06 18:42:32 +02:00
Alug 0a022a4348 Revert "instant update after screen mode change"
This reverts commit 02bd819f7e.
2024-06-05 14:42:30 +02:00
Alug ad24beea5b more minor loop stuff 2024-06-05 14:42:23 +02:00
Alug 9026ae7a16 minor sprite opitmizations 2024-06-05 02:27:18 +02:00
Alug 2fee9b861f high dpi test 2024-06-05 01:40:57 +02:00
Alug b7e2bcf02e lol 2024-06-05 01:40:39 +02:00
Alug d548848b18 Reapply "use shader to prevent sprite floor clipping"
This reverts commit 5ec1ca46e5.
2024-06-05 01:28:09 +02:00
Alug 4c628ea74f Revert "zzz..."
This reverts commit e19db23bb5.
2024-06-05 01:28:06 +02:00
Alug d3ef97f637 test remove all the networking crap from rendering code 2024-06-04 17:11:30 +02:00
Alug 02bd819f7e instant update after screen mode change 2024-06-04 17:11:12 +02:00
Alug ea3b4ddeb0 smol optimization to skin loading 2024-06-04 17:10:24 +02:00
Alug ab3ea7475f think this should be casted to angle_t 2024-06-04 17:08:09 +02:00
Alug b9b97d0a56 Test: kill unused skin sounds freeslotting 2024-06-03 18:47:59 +02:00
Alug e19db23bb5 zzz... 2024-06-03 17:15:16 +02:00
Alug 5ec1ca46e5 Revert "use shader to prevent sprite floor clipping"
This reverts commit ee2ec01eb9.
2024-06-03 17:11:58 +02:00
Alug c2c918fdda Revert "fix le dispoffset"
This reverts commit f977af6a80.
2024-06-03 17:11:55 +02:00
Alug 4627989401 Make sfxinfo_t and state_t use field tables too 2024-06-03 17:02:27 +02:00
indev 9552e09471 Lua_optoption shouldn't change stack state at the end of call now 2024-06-03 17:02:14 +02:00
indev c8fb25066b Fix compilation for some gcc versions 2024-06-03 17:02:10 +02:00
Alug b1cb6d42f4 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-06-03 17:01:22 +02:00
Alug caf7e4a1cf stuffs 2024-06-01 17:03:27 +02:00
Alug 6a5c0223c4 forgor to remove that 2024-06-01 16:31:49 +02:00
Alug 9ff2d66079 fix papersprites in software (hopefully)
lul
2024-06-01 16:29:20 +02:00
Alug 2db2b9309d flexible array stuff for columnofs
hopefully this fixes some crashes or smth
2024-05-31 23:04:26 +02:00
Alug 7a38c15d59 cleanup some super old stuff that did nothing
lul
2024-05-31 22:43:49 +02:00
Alug cb7375f873 theres no value 3 oops
i shouldnt do stuff after waking up at 4 in the morning lol
2024-05-30 19:59:01 +02:00
Alug 41e52f9e88 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-05-30 19:10:03 +02:00
Alug ce7e30a752 smth smth encore magic numbers idk 2024-05-28 22:38:20 +02:00
Alug 3214811fcb casting stuff 2024-05-28 22:22:58 +02:00
Alug edda2a5399 that should be there lul 2024-05-28 22:22:48 +02:00
Alug 926bc8e72c split sprite draw loops
so crap doesent constantly check for papersprites on all sprites
2024-05-28 20:55:03 +02:00
Alug eadffb6be3 make r_fps if else hell a bit more bearable to look at
lol lmao
2024-05-28 20:28:27 +02:00
Alug cf04e8c23c scale precip size with mobjscale 2024-05-28 20:07:12 +02:00
Alug ec5840f840 scale sprite draw distance with mapobjscale 2024-05-28 20:02:54 +02:00
Alug 7dc4a7177d shut up gcc 2024-05-28 01:07:13 +02:00
Alug 3d91de8178 when not using screentextures draw kart bg on intermission screen 2024-05-28 00:52:40 +02:00
Alug 6ea1abfedc draw a black screen instead of "nothing" during wipes on disabled screentextures
should resolve the intense flashing that can occur
2024-05-28 00:52:09 +02:00
Alug 5251482dd7 Optimize field lookups in Lua metatables
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2024#cd5b5ee262bf5129c4d400ad60d006e1fa917c1f
2024-05-27 18:14:59 +02:00
Alug dd73787c8b Revert "optimize precip thinker"
This reverts commit bc382366a1.
2024-05-25 19:54:20 +02:00
Alug 340450a67e Revert "lol"
This reverts commit 0d40989f4c.
2024-05-25 19:54:13 +02:00
Alug 0d40989f4c lol 2024-05-25 19:00:07 +02:00
Alug c640096d9c Merge remote-tracking branch 'ghghghghghg/lua-hudinterpolate-redux' into lugstuff 2024-05-25 17:23:49 +02:00
indev 76081869e3 Store hooks in a table with integer keys instead of registry with string keys 2024-05-25 15:45:20 +02:00
Alug 9156c1b850 use ternary 2024-05-25 15:44:33 +02:00
Alug d78718d8f4 make only player dust be sparkle otherwise normal driftdust 2024-05-25 15:40:22 +02:00
Alug eef1e986a6 add proper check to sparkle lol 2024-05-25 15:28:41 +02:00
Alug 8fa99c34be Revert "ok kill this again ig"
This reverts commit 98c27fe8ef.
2024-05-25 15:07:07 +02:00
Alug a35fbdd1b5 move some cvars to be registerrerd latur in ogl 2024-05-25 14:50:24 +02:00
Alug 0efef78684 Turn of FBO downsampling when you turn off screen textures
fbo downsampling needs those and if theyre disabled youre essentially seeing nothing at all lol
2024-05-25 14:43:52 +02:00
Alug 62ce17cb4c super smol optimization to R_DrawRepeatMaskedColumn
only maths once not twice lul
2024-05-25 14:37:30 +02:00
Alug 6112be232a revert solidcol stuffs i did ages ago apparently lol 2024-05-25 12:57:41 +02:00
Alug c1a9c58eb5 Cull BSP behind a raised floor or lowered ceiling that covers the entire screen
https://git.do.srb2.org/KartKrew/RingRacers/-/commit/7b8a564f69688515319ccd425f2b88ffe8b7b120
2024-05-25 02:02:06 +02:00
Alug 0393588fe8 Only call the Lua API for overridden actions 2024-05-25 01:35:44 +02:00
Alug b7ff0325ea optimize sight checks 2024-05-25 00:08:14 +02:00
Alug c4d39eae25 declare outside of lööp also add const in r_ 2024-05-25 00:01:58 +02:00
Alug 0e88981425 Cache water trail mobjs from qtpie dev
cant really cherry pick so uuuh
2024-05-23 22:23:39 +02:00
Alug ed7fcae33b Merge remote-tracking branch 'ghghghghghg/lua-hudinterpolate-redux' into lugstuff 2024-05-23 20:29:22 +02:00
Alug 8b967fb3b7 change wöter visual thing 2024-05-23 20:16:37 +02:00
Alug 4d68a5dc2b change names to be less basic 2024-05-23 19:25:04 +02:00
Alug ecd6ef40ef allow gamepad dpad to hold scroll shit in menu aaa
absolute arsepain cant wait to see this breaking kek
2024-05-23 19:11:11 +02:00
Alug 0c9dc33ff0 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-05-21 21:15:21 +02:00
Alug 98c27fe8ef ok kill this again ig 2024-05-20 22:46:29 +02:00
Alug 3d490f52b2 a 2024-05-20 22:18:17 +02:00
Alug c78c17d953 funny driftsparkle 2024-05-20 22:18:15 +02:00
Alug ee5d667a24 changes to woter thing 2024-05-20 19:23:46 +02:00
Alug b9653b4ff8 unhack the animated votescreen a little
also make it pause when the game is paused like it was intended originally
2024-05-20 17:18:06 +02:00
Alug 78bcfa8cfa conflict moment 2024-05-20 13:40:47 +02:00
Alug 1f1130efda Merge remote-tracking branch 'origin/Saturn' into lugstuff 2024-05-20 13:39:00 +02:00
Alug 3d7b05d633 forgor this crap 2024-05-15 16:54:41 +02:00
Alug 343bbd8a1a support gcc14 ig 2024-05-13 20:48:32 +02:00
Alug f702df48f5 kept forger to declare this 2024-05-13 20:48:21 +02:00
Alug bc382366a1 optimize precip thinker 2024-05-06 01:18:57 +02:00
Alug c158144b7b Revert "refactor weather stuff"
This reverts commit dc95b2e8d7.
2024-05-06 00:33:38 +02:00
Alug d4337fbc56 Revert "optimize-precip-thinker"
This reverts commit e822d8e7d1.
2024-05-06 00:33:36 +02:00
Alug e822d8e7d1 optimize-precip-thinker 2024-05-06 00:32:57 +02:00
Alug dc95b2e8d7 refactor weather stuff
not netsafe
2024-05-06 00:05:16 +02:00
Alug d226ad38ff Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-05-05 22:02:07 +02:00
Alug 2a160c5247 goddamn synched sound effect aaa 2024-05-05 13:00:14 +02:00
Alug 641a9dc4e2 Revert "follower crap cause i want smol spb"
This reverts commit 1b963c9439.
2024-05-04 01:58:58 +01:00
Alug 7e71af8d25 durr water stuff uhhhhhhh
hope this wont break lmao
2024-04-29 10:12:33 +02:00
Alug 8e33d2e1b2 simplify SOFTLIGHT alot
also should make sure it gets applied everywhere lul
2024-04-29 09:12:44 +02:00
Alug 61118b348c Merge remote-tracking branch 'ghg/lua-hudinterpolate-redux' into lugstuff 2024-04-25 18:41:10 +02:00
Alug 84faff82a2 fix rare precip crash 2024-04-25 17:08:02 +02:00
Alug d6cf7cc06f funny wöter from durr 2024-04-25 16:12:53 +02:00
Alug 0688b94729 update libbacktrace windows lib 2024-04-24 21:26:50 +02:00
Alug 695f53194d inline those 2024-04-24 10:59:09 +02:00
Alug 1b963c9439 follower crap cause i want smol spb
will softcode crap sometime idk
2024-04-23 12:47:18 +02:00
Alug b50d6dd389 Merge remote-tracking branch 'origin/it-cv-bigfloat' into lugstuff 2024-04-22 05:26:51 +02:00
Alug 2afad9490e Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-22 05:26:36 +02:00
Alug 812a275add fix some visual issues with fofs 2024-04-22 05:24:49 +02:00
Alug 90ccf7699b a 2024-04-20 22:52:22 +02:00
Alug 31ed12d88a some stuff from ceepeepeecheck 2024-04-20 22:36:23 +02:00
Alug 5a4e44d064 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-20 12:34:03 +02:00
Alug 515c67fa3a disable palette rendering if screentextures aint enabled 2024-04-19 06:21:58 +02:00
Alug 81d60165a3 z 2024-04-19 05:08:47 +02:00
Alug cc0fac3546 more things
-Fix a division by zero in BCZ2 Metal Sonic's routine
-Fix a bug where adding the same mod multiple times counted towards the mod limit
and other thigns
2024-04-19 04:49:12 +02:00
Alug d71ad13fcf some smol fixes 2024-04-19 04:22:29 +02:00
Alug 0d13811305 Make FixedRem less laggy by just using the modulo operator. 2024-04-19 03:52:21 +02:00
Alug b69cc4e34a Revert "port thinkerlists + cache and reuse mobjs for the 420th time"
This reverts commit bd8a392882.
2024-04-19 03:38:59 +02:00
Alug caf8f383ad Revert "change a few things"
This reverts commit c5c61f7692.
2024-04-19 03:38:55 +02:00
Alug 7db160a8e2 Revert "i dont understand this crap so ill revert it"
This reverts commit 7e895f82b2.
2024-04-19 03:38:52 +02:00
Alug 202a3d1fb1 Revert "some cleanup"
This reverts commit 332135fc6f.
2024-04-19 03:38:49 +02:00
Alug 332135fc6f some cleanup 2024-04-18 23:10:35 +02:00
Alug 7e895f82b2 i dont understand this crap so ill revert it 2024-04-18 14:14:51 +02:00
Alug c5c61f7692 change a few things 2024-04-18 13:40:27 +02:00
Alug bd8a392882 port thinkerlists + cache and reuse mobjs for the 420th time
i am in pain
2024-04-18 12:07:57 +02:00
Alug 36183e6dc8 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-17 05:34:51 +02:00
Alug 5ae4af54da smth smth paranthesis 2024-04-12 21:55:45 +02:00
Alug 620bdd1419 Merge branch 'lugstuff' of https://github.com/Indev450/SRB2Kart-Saturn into lugstuff 2024-04-12 20:41:16 +02:00
Alug c18eacbb81 fix software crash
Zzz...
2024-04-12 20:41:10 +02:00
Alug bb8acc5f51 fkldjnasofjosdfoisfj 2024-04-11 19:48:42 +02:00
Alug d41f4810d7 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-11 18:39:58 +02:00
indev 387c4edb3b Fix potential negative array index in V_ThinStringWidth 2024-04-11 18:00:01 +02:00
Alug c3fd7c1a7a grrrr 2024-04-10 18:21:11 +02:00
Alug 94f1ec18de Revert "fix ifdefs"
This reverts commit 5e8e2f4b3a.
2024-04-10 18:19:24 +02:00
Alug e00f8f6cee Revert "Zzz..."
This reverts commit 79b0a9c833.
2024-04-10 18:19:21 +02:00
Alug 79b0a9c833 Zzz... 2024-04-10 18:15:42 +02:00
Alug 5e8e2f4b3a fix ifdefs 2024-04-10 17:59:41 +02:00
Alug f0158dd915 move this to first init too 2024-04-10 17:58:06 +02:00
Alug 10cf251b46 that wasnt the onchange im sleepy 2024-04-10 17:40:35 +02:00
Alug 72231e5658 forgor to remove those Zzz... 2024-04-10 17:32:06 +02:00
Alug c510ff3b1c should throw that into onchange oops 2024-04-10 17:29:08 +02:00
Alug 936e138fee throw stuff into own function, also check on game start 2024-04-10 17:24:03 +02:00
Alug 8325696b55 put those in 1st init 2024-04-10 07:05:38 +02:00
Alug d63f517ae5 simplify this crap 2024-04-10 07:02:03 +02:00
Alug e74df8db90 raise max fpscap 2024-04-10 06:47:45 +02:00
Alug 1a0bf67452 Merge remote-tracking branch 'origin/fborender' into lugstuff 2024-04-09 17:38:44 +02:00
Alug f0df9b399b Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-05 17:40:19 +02:00
Alug f9345308ff Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-05 01:45:11 +02:00
Alug 6ed7c75448 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-04 03:57:32 +02:00
Alug cb71167fb7 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-02 16:40:37 +02:00
Alug d4292987cc Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-02 16:14:35 +02:00
Alug 5da24a18dc Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-02 15:54:06 +02:00
Alug 1cf7b3e697 tf 2024-04-02 03:51:36 +02:00
Alug 3f3672497b Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-02 03:49:01 +02:00
Alug 7714304c7a Merge remote-tracking branch 'origin/Saturn' into lugstuff 2024-04-01 19:15:13 +02:00
Alug ff640639b2 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-04-01 03:52:55 +02:00
Alug 0965603c8f Merge remote-tracking branch 'origin/interpjitter' into lugstuff 2024-04-01 03:52:52 +02:00
Alug b8412cec96 Fix minor off-by-one error in faketic calculation 2024-03-31 23:22:26 +02:00
Alug 86b7e192b2 fix this for splitscreen and move to own function 2024-03-30 03:34:38 +01:00
Alug 32b9e6094b Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-28 15:07:00 +01:00
Alug 3ff7f3158b why tf is that here 2024-03-28 14:58:44 +01:00
Alug bd83ba8ca9 when the GLENCORE 2024-03-28 13:21:58 +01:00
Alug 785881c90e fixeur compile for qt 2024-03-28 12:23:07 +01:00
Alug 567ccf8a59 use this instead 2024-03-28 08:13:16 +01:00
Alug 11423a6d78 fix highresscale issue on startup in the worst way ever cause CV_NOINIT doesent work for whatever reason 2024-03-28 00:15:44 +01:00
Alug ab6b716e78 Read only header bytes when creating textures list 2024-03-27 21:31:45 +01:00
Alug 7b1be2e34f Ehh this thing is enough tbh 2024-03-27 20:32:14 +01:00
Alug 19d0d247b4 right v6 lul 2024-03-27 18:26:20 +01:00
Alug 1074a9e1d2 Prevent dropped ticcmds due to interp timing jutter
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2046
2024-03-27 18:17:27 +01:00
Alug 0648f384bb kill some stuff that did nothing 2024-03-27 18:13:39 +01:00
Alug 58d72204cc offline play menu pauses game so gib cool vhs effect 2024-03-27 15:51:47 +01:00
Alug 067b4c260f handle async vsync fail better
a
2024-03-27 14:44:02 +01:00
Alug 9e7e4d5fe7 testing smth
yes -1 is valid for this sometimes
2024-03-27 12:11:45 +01:00
Alug 7d9609be76 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-27 04:35:47 +01:00
Alug 7e510f8bc5 Merge remote-tracking branch 'origin/texload' into lugstuff 2024-03-26 20:42:39 +01:00
Alug a16e009370 make custom buttons bindable to joyaxis
triggers and such
2024-03-25 21:13:47 +01:00
Alug a021c497b6 forgor to remove this 2024-03-25 17:22:21 +01:00
Alug e77159cb58 remove this too 2024-03-24 20:18:31 +01:00
Alug 36ac353f1f Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-24 20:16:27 +01:00
Alug 58122bf023 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-24 18:30:21 +01:00
Alug c5da23bb02 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-24 16:56:14 +01:00
indev fd45391616 Fix drift sound keep playing when player go off ground 2024-03-24 15:12:02 +01:00
Alug 11dd80e4e7 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-24 15:11:53 +01:00
Alug 298f8ef842 Fix crash when passing a long string to v.drawString
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2403
2024-03-24 15:10:14 +01:00
Alug 4c45b9fb85 dfsafsdf 2024-03-23 19:13:14 +01:00
Alug 599cea3238 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-23 19:08:59 +01:00
Alug 0c5685e9eb dont need this anymore now 2024-03-23 18:07:58 +01:00
Alug 760b82fd63 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-23 18:07:08 +01:00
Alug 340034adf7 this can be just M_PI 2024-03-21 12:52:40 +01:00
Alug d978bfd0db Revert "Add common I_GetSysName function"
This reverts commit f3eedc03e6.
2024-03-21 12:40:44 +01:00
Alug de9f9722ac reapply hacky scaling thing 2024-03-21 12:38:50 +01:00
Alug 4dd9dc03fe ok git 2024-03-21 12:37:58 +01:00
Alug 47fc4aa39a Merge remote-tracking branch 'ghg/hud-uncap' into lugstuff 2024-03-21 12:36:29 +01:00
Alug 84ad608d70 Revert "software sdl windows scaling quality setting"
This reverts commit 7ee6de6b6a.
2024-03-21 12:35:00 +01:00
Alug d4dd0c9992 conflict fix 2024-03-21 12:33:43 +01:00
Alug ac93d027af Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-03-21 12:31:01 +01:00
Alug 190a95584c SFC32 for M_random funcs
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1780
2024-03-19 11:15:23 +01:00
Alug 9ad368e420 e 2024-03-17 23:32:09 +01:00
Alug a524215479 add the note so i dont forger if i wanna update this again 2024-03-17 22:43:05 +01:00
Alug 6104c36455 properly link libopenmpt
one dll instead of 4
2024-03-17 22:37:18 +01:00
Alug a04287c9f6 cute icon 2024-03-17 19:29:40 +01:00
indev 99876e3f73 Fix 'cast to non-matching type' warning 2024-03-17 14:57:02 +01:00
indev f16f498f27 Add include guard for qs22j.h 2024-03-17 14:56:37 +01:00
indev 4f9b5923bd Add snap to top flag for pause gfx 2024-03-15 12:54:06 +01:00
Alug 84476cd51f this didnt work 2024-03-15 11:32:33 +01:00
Alug bf9a6bde82 test this 2024-03-15 11:32:24 +01:00
Alug a6f8f57725 testing smth 2024-03-14 07:44:07 +01:00
Alug 02f4c334f0 mhhm ternaries 2024-03-13 22:06:45 +01:00
Alug 9884b294c6 i want to see more precip thx 2024-03-13 21:55:23 +01:00
Alug 49f22b5790 revert some stuff that broke some stuff 2024-03-13 19:25:14 +01:00
Alug 841270e824 fix ogl precip interpolation 2024-03-13 17:56:08 +01:00
Alug 630ce57303 this looks better lul 2024-03-13 13:18:30 +01:00
Alug 94aed4d1d1 clean up 2024-03-13 10:16:07 +01:00
Alug cdc0ec96a9 forgor menu stuff 2024-03-13 10:07:51 +01:00
Alug 751188bcd8 remove xs_CRoundToInt
while ye, less exact stuff doesent matter too much in the context of doom, it matters more in kart, due to polygon rendering and seg processing being extremely heavy and also generally more complex maps
2024-03-13 10:06:56 +01:00
Alug c0c44d46bc Ensure opaque midtextures always use PF_Masked 2024-03-13 08:48:04 +01:00
Alug 19d8749abf Revert "inline some things"
This reverts commit 0b47c310eccf55871a5bd466f44afa3215cc1322.
2024-03-13 08:35:47 +01:00
Alug c6f9fb2ac2 Revert "optimize "p_pointon" functions"
This reverts commit b9b963f999b902ab7f0f6fae4ec61264e713e15e.
2024-03-13 08:35:44 +01:00
Alug b1cfdfbc14 Revert "optimize fixedhypot"
This reverts commit ae68bd577558f45b81741396a899b7c311f753fc.
2024-03-13 08:35:41 +01:00
Alug 360df11aa6 Revert "LUT for bmapwidth imul instructions."
This reverts commit e45a7f911f0d156b7cc38675bec1a14a2080c367.
2024-03-13 08:35:30 +01:00
Alug d88cc3251f Revert "fix some oopsies"
This reverts commit 578770818ed96e366bbe9ed5ede720de07c0000a.
2024-03-13 08:35:27 +01:00
Alug cd7079da92 Revert "Zzz...."
This reverts commit e05197af882049e555c4116d1e6b4fd5ec4e879d.
2024-03-13 08:35:24 +01:00
Alug 77a0e8213b Revert "Zzz... 2"
This reverts commit bdd32702f9dc3ccbefb6444f1b76329b8ddbc9d7.
2024-03-13 08:35:20 +01:00
Alug 5efa778509 Revert "adjust the pointon funcs again"
This reverts commit b5861b2beeb04b6de1fcbd2088069374658f31ee.
2024-03-13 08:35:12 +01:00
Alug 02e6463fae Revert "P_PointOnDivlineSide stuff"
This reverts commit 1fa738d46448bd716547aa1812e38ec0de2221d1.
2024-03-13 08:35:09 +01:00
Alug b411787fe7 Revert "forgor"
This reverts commit 28950e6a15a3350da9a7441d81e3e043985a6c8d.
2024-03-13 08:34:59 +01:00
Alug 8fd91194a7 hm 2024-03-13 07:36:52 +01:00
Alug 4f85e1d603 revert that part 2024-03-13 07:34:12 +01:00
Alug fae0aeb442 Revert "Revert "forgor""
This reverts commit a1afcbc855.
2024-03-13 07:31:56 +01:00
Alug ec77824a96 Revert "Revert "dont inline those""
This reverts commit ae829375a0.
2024-03-13 07:31:53 +01:00
Alug 4127936eef optimize HWR_AddLine and HWR_ProcessSeg 2024-03-13 07:28:16 +01:00
Alug ae829375a0 Revert "dont inline those"
This reverts commit 2e34de8a125644dd7a0689af28b2076cf4c92e21.
2024-03-13 06:51:26 +01:00
Alug a1afcbc855 Revert "forgor"
This reverts commit e1e3aa899d.
2024-03-13 06:51:21 +01:00
Alug e1e3aa899d forgor 2024-03-13 06:07:59 +01:00
Alug 2644a3bf6e dont inline those 2024-03-13 06:03:19 +01:00
Alug 6b4e81e1ec P_PointOnDivlineSide stuff 2024-03-13 06:00:37 +01:00
Alug c705a0f35a adjust the pointon funcs again 2024-03-13 04:51:48 +01:00
indev b1b3102b31 If game crashes in level, add it to crash report 2024-03-12 18:51:00 +01:00
Alug 2d823d34f9 Fix buffer overrun in I_ClipboardPaste
https://git.do.srb2.org/STJr/SRB2/-/commit/9772bbeda172bc60482f137fc465e12070c76f22
2024-03-12 18:50:55 +01:00
Alug 1bb9fb2c67 cant override crap, thx msys 2024-03-12 18:27:55 +01:00
Alug b90e3ce9da i will add those in compiler flag instead 2024-03-12 18:19:12 +01:00
Alug e04a074a79 Revert "condensetics"
This reverts commit 87001f7e78.
2024-03-12 16:30:00 +01:00
Alug f98c3311af Zzz... 2 2024-03-12 16:21:42 +01:00
Alug 1a8c44af27 Zzz.... 2024-03-12 16:20:32 +01:00
Alug a57089c1a9 fix some oopsies 2024-03-12 16:16:40 +01:00
Alug 87001f7e78 condensetics 2024-03-12 16:06:12 +01:00
Alug 1fbb05c938 LUT for bmapwidth imul instructions. 2024-03-12 15:28:12 +01:00
Alug 3eef9d3b62 inline blockthing iterator aswell 2024-03-12 14:27:15 +01:00
Alug af2adf0134 remove some suff 2024-03-12 14:02:46 +01:00
Alug bbdfee8d33 optimize fixedhypot 2024-03-12 12:58:17 +01:00
Alug 2c4da83502 optimize "p_pointon" functions 2024-03-12 10:47:27 +01:00
Alug 75f2868971 inline some things 2024-03-12 02:13:35 +01:00
Alug 87d9ecc3c8 midi music bros 2024-03-11 23:52:26 +01:00
indev b637943bd9 Add snap to bottom flags for race countdown and level title too 2024-03-11 22:30:45 +01:00
Alug 0514475155 uuuuh 2024-03-11 22:30:37 +01:00
Alug 8cfb39e035 sort grid when opening skin menu instead of everytime a skin is added 2024-03-11 21:01:43 +01:00
Alug a9a7cb7be0 i 2024-03-11 12:58:22 +01:00
Alug f8649a24aa those can all be static 2024-03-11 11:54:32 +01:00
Alug ee5a860e07 more opitmizations stuff 2024-03-11 11:47:05 +01:00
Alug e6f03c1136 can do that directly 2024-03-11 11:22:08 +01:00
Alug 780162f516 optimize hwr_renderbpsnode
actually just make it behave like the software version lol
2024-03-11 11:00:14 +01:00
Alug a6d32d834b make 64 default again 2024-03-11 04:27:52 +01:00
Alug cef3c7f032 remove pseudoangle as its slower 2024-03-11 04:25:41 +01:00
Alug 07f8a532f9 attempt at unfucking renderview 2024-03-11 03:40:13 +01:00
Alug 352adf526a give this a better name lol 2024-03-11 02:22:40 +01:00
Alug df48f9caf9 actually move stuff back to hw_clip lmao 2024-03-11 02:15:34 +01:00
Alug f611053d4f replace server list sorting with qs22j 2024-03-10 20:28:27 +01:00
indev 39011cd93b Snap viewpoint text to bottom 2024-03-10 19:54:20 +01:00
Alug 562cb8cebd clean up stuff a little 2024-03-10 18:50:38 +01:00
Alug 89ae721421 i am in pain 2024-03-10 17:59:24 +01:00
Alug f65f4b32e2 Revert "remove pseudoangle"
This reverts commit c5d6ac63c5.
2024-03-10 15:19:36 +01:00
Alug 303fca6bcc smol adjustment 2024-03-10 04:39:55 +01:00
Alug 4aba159ee8 clean up this mess 2024-03-10 04:25:59 +01:00
Alug 5838e60bf6 fix overflow stuffs 2024-03-10 03:43:21 +01:00
Alug 527e436d57 Revert "stuffs"
This reverts commit 60ede73ff8.
2024-03-09 14:06:18 +01:00
Alug 60ede73ff8 stuffs 2024-03-09 13:43:06 +01:00
Alug 298d5e95fc unfuck thinker crap 2024-03-09 13:34:34 +01:00
Alug e9a68f0b7d forgor 2024-03-09 12:02:20 +01:00
Alug d613cf4d4c sUgGeSt PaReNtHeSeS ArOuNd '&&' 2024-03-09 12:01:18 +01:00
Alug 3487fae95d simplify this crap 2024-03-09 10:51:32 +01:00
Alug 9ee47a071b oops 2024-03-09 10:22:20 +01:00
Alug 3579fc3dea remove this 2024-03-09 10:11:06 +01:00
Alug 921bff19f1 add toggle for old fps counter behaviour
idk people hate the new one so brap
2024-03-09 07:58:14 +01:00
Alug d07420eaeb fix compile for everyone but me lmao 2024-03-09 07:40:38 +01:00
Alug 8028db77d8 implicit declaration of deez nuts 2024-03-09 07:12:56 +01:00
Alug e49a059783 fix dumbass compiler warnings + reformat it a bit 2024-03-09 07:12:18 +01:00
Alug 482b6e6844 use it for other stuff 2024-03-09 07:02:16 +01:00
Alug aa70635919 dont think this should write to relplays 2024-03-09 02:00:40 +01:00
Alug c331b0fa89 e 2024-03-09 01:59:27 +01:00
Alug fe55744de2 a 2024-03-09 00:57:40 +01:00
Alug 15e9d85a14 Revert "Revert "avx destruction idk""
This reverts commit f547020fc5.
2024-03-09 00:54:33 +01:00
Alug 51043b61a1 Revert "cache and reuse mobjs again"
This reverts commit 04455c9625.
2024-03-08 23:43:52 +01:00
Alug 6620d5fb26 faster qsort for rendering 2024-03-08 15:03:58 +01:00
Alug f547020fc5 Revert "avx destruction idk"
This reverts commit 4fdb2174f0.
2024-03-08 11:14:42 +01:00
Alug 89ea473c3b fix shit on party cruiser
well fixing the cullplane broke party cruiser, so im just gonna give it the same parameters as the software version i guess idk
2024-03-08 01:19:25 +01:00
Alug b60d9d0be7 readd this cause i dumb 2024-03-08 01:19:15 +01:00
Alug 4fdb2174f0 avx destruction idk 2024-03-08 00:15:43 +01:00
Alug 06a48584d6 expose this cause i want to use it in local scripts 2024-03-08 00:09:08 +01:00
Alug e9f9c1009d more mobj stuffs 2024-03-07 00:35:26 +01:00
Alug b66ceda525 Revert "attempt at exclusive fullscreen mode"
This reverts commit 19f1d8b847.
2024-03-06 09:27:09 +01:00
Alug 7c9c28f026 Revert "use desktop resolution for stuff"
This reverts commit a54384a579.
2024-03-06 09:27:06 +01:00
Alug 72f0552ef1 Revert "reset windowsize on normal fullscreen mode"
This reverts commit 85c7216eaa.
2024-03-06 09:26:59 +01:00
Alug 877a1f15a9 Revert "multidisplay stuff + only activate framebuffer for downsampling"
This reverts commit 5f58e7b343.
2024-03-06 09:26:46 +01:00
Alug efa2a68805 Revert "Zzz... moment"
This reverts commit 8cec2dab82.
2024-03-06 09:26:43 +01:00
Alug 023209bb76 Revert "only do things here when theres more than one display"
This reverts commit 9eb68bf052.
2024-03-06 09:26:38 +01:00
Alug da5dcde6ee Revert "wait uhhhh"
This reverts commit 875adb17b1.
2024-03-06 09:26:33 +01:00
Alug e92c5e1bf9 Revert "ugh this still takes the wrong display blergh"
This reverts commit 298b4d23e8.
2024-03-06 09:26:30 +01:00
Alug 2b7c4ae76c Revert "ill just uhhhhh use main display stuff for now idk"
This reverts commit a2d0ea9d11.
2024-03-06 09:26:24 +01:00
Alug ea26db2cbd Revert "change things a bit"
This reverts commit 9c42b77879.
2024-03-06 09:26:21 +01:00
Alug b9e3747f99 Revert "forgor"
This reverts commit 4d608b7f37.
2024-03-06 09:26:19 +01:00
Alug 4d608b7f37 forgor 2024-03-06 09:20:21 +01:00
Alug 9c42b77879 change things a bit 2024-03-06 09:19:17 +01:00
Alug a2d0ea9d11 ill just uhhhhh use main display stuff for now idk 2024-03-06 08:07:40 +01:00
Alug 298b4d23e8 ugh this still takes the wrong display blergh 2024-03-06 07:59:31 +01:00
Alug 875adb17b1 wait uhhhh 2024-03-06 07:42:46 +01:00
Alug 9eb68bf052 only do things here when theres more than one display 2024-03-06 07:39:36 +01:00
Alug 8cec2dab82 Zzz... moment 2024-03-06 07:36:28 +01:00
Alug 5f58e7b343 multidisplay stuff + only activate framebuffer for downsampling
idk i hope this shit works lmao
also moved some things in OglSdlSurface so it doesent intialize certain things everytime we change framebuffer shit
2024-03-06 07:26:53 +01:00
Alug 28bb88e9b4 Dynamically allocate space for a state's action field
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1478
2024-03-06 04:39:29 +01:00
Alug 04455c9625 cache and reuse mobjs again
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2200
2024-03-06 04:14:21 +01:00
Alug 9853150e57 Merge remote-tracking branch 'origin/maybemobjcrashfixes' into lugstuff 2024-03-06 00:26:24 +01:00
Alug 85c7216eaa reset windowsize on normal fullscreen mode 2024-03-05 02:15:06 +01:00
Alug a54384a579 use desktop resolution for stuff 2024-03-05 02:02:02 +01:00
Alug 19f1d8b847 attempt at exclusive fullscreen mode 2024-03-05 01:44:10 +01:00
indev 8270b64624 Make custom cvar menu bit wider 2024-03-04 23:52:45 +01:00
indev 81e3810c32 Don't add string cvars (a bit hacky solution) 2024-03-04 21:08:05 +01:00
Alug c266151071 change some numbers uuuuuh 2024-03-04 20:17:18 +01:00
Alug 27d55260e8 remove minmax sliders 2024-03-04 19:45:49 +01:00
Alug 233583657e oops 2024-03-04 19:04:51 +01:00
Alug 7bb1eed249 dont do stuff for anything thats not in normal us ascii or smth 2024-03-04 18:34:09 +01:00
Alug aa85fc3787 dont use it for control setup 2024-03-04 18:13:18 +01:00
Alug c9a88617b1 only use this for text inputs not gameplay 2024-03-04 17:46:45 +01:00
Alug 2f899fdfcc make it even simpler 2024-03-04 05:24:41 +01:00
Alug cdd2b6560e i will just use my compilers memcpy thx 2024-03-04 05:19:54 +01:00
Alug 60f29edbca turn it off completely when your gpu cant use it 2024-03-04 02:51:12 +01:00
Alug 60cffe1ed1 unhack framebuffer functions a little 2024-03-04 02:47:42 +01:00
Alug e77e7d1643 o 2024-03-04 01:13:23 +01:00
Alug 5dc22f502e dont need this 2024-03-04 00:45:14 +01:00
Alug 7a309c1175 when the ;; 2024-03-04 00:13:21 +01:00
Alug 9ce5baad9e fix ogl freelook breaking with shearing enabled
also removed uneeded stuff
2024-03-03 08:40:24 +01:00
Alug a4aa9a76f2 should only do that when rendering stuff 2024-03-03 07:57:46 +01:00
Alug befa25de5c add missing interpolators in mapload 2024-03-03 07:50:02 +01:00
Alug 83175d5c09 bruh
im going insane
2024-03-03 06:45:37 +01:00
Alug d8df8e8778 Revert "Revert "we have functions for that dont check for slopes everywhere""
This reverts commit 09957d0279.
2024-03-03 05:51:35 +01:00
Alug 09957d0279 Revert "we have functions for that dont check for slopes everywhere"
This reverts commit 46da9bf98b.
2024-03-03 05:34:01 +01:00
Alug 9e44985f56 Do not reload every texture when adding a wad
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1725?commit_id=37add34b9c729b21e624e22d64159073c9258e25
2024-03-03 05:18:37 +01:00
Alug b657a84699 Split R_LoadTextures 2024-03-03 04:53:15 +01:00
Alug 5ec7835556 Merge branch 'lugstuff' of https://github.com/Indev450/SRB2Kart-Saturn into lugstuff 2024-03-03 04:34:59 +01:00
Alug 03a864156d fix conflict 2024-03-03 04:34:53 +01:00
Alug c823bf3320 Revert "multithread exec command and some filesearch/add stuff"
This reverts commit 0d7025f714cbef34ca6e92e683561df411fa149a.
2024-03-03 04:32:13 +01:00
Alug 4f4d2f1f4c clean up r_segs 2024-03-03 03:13:46 +01:00
Alug 1bb389052d fix this 2024-03-02 23:36:48 +01:00
Alug 31fdc5bbc1 dont need to check if we dont use it 2024-03-02 22:56:26 +01:00
Alug db3833430d we have functions for that dont check for slopes everywhere
the functions already do it for us anyways
2024-03-02 22:33:34 +01:00
Alug 6d2212d259 move sprite mobj checks first 2024-03-02 21:56:39 +01:00
Alug 912c0e7fc4 check for those i guess 2024-03-02 18:36:34 +01:00
Alug 43d232819a forgor screenspace clipping 2024-03-02 18:25:13 +01:00
Alug 302eaf60b5 GetScreenCoord lua parity 2024-03-02 17:36:59 +01:00
Alug 84535faa90 remove more unused stuff 2024-03-02 15:57:25 +01:00
Alug 8c55d3c705 bruh 2024-03-02 13:23:50 +01:00
Alug ec11b9268f did not mean to commit this lul 2024-03-02 03:33:26 +01:00
Alug a45af4a80c i 2024-03-02 03:18:27 +01:00
Alug df627b6830 a 2024-03-02 03:11:06 +01:00
Alug dfbeaf30ad m 2024-03-02 03:10:47 +01:00
Alug a03f74b125 add this 2024-03-02 03:05:36 +01:00
Alug 1a01f1299c fix compiler complains
those were for coronas code which we dont even have
2024-03-02 02:43:53 +01:00
Alug 91f0cdbaca unhack palrendering screentex stuff 2024-03-02 02:15:28 +01:00
Alug e50bd4125d e 2024-03-02 02:07:54 +01:00
Alug ded2c8a7c8 a 2024-03-02 02:03:22 +01:00
Alug 88ce9fc0a6 more stuffs 2024-03-02 02:02:03 +01:00
Alug 3c713248b3 more shader stuff 2024-03-02 01:53:11 +01:00
Alug 75f3edcd92 shader stuffs 2024-03-02 01:50:35 +01:00
Alug 081a7779a6 make netvars red 2024-03-02 01:32:12 +01:00
Alug 6e995207a6 smh 2024-03-02 01:15:03 +01:00
Alug 3492b77aa0 we dont have IT_CV_FLOATSLIDER so dont even need to check for float 2024-03-02 01:14:36 +01:00
Alug e864901035 Options Menu for custom console variables
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2380#9cc73f4b99ff925448389969b0ade6ba3947fc31
2024-03-02 01:09:10 +01:00
Alug 7ee6de6b6a software sdl windows scaling quality setting 2024-03-01 23:12:23 +01:00
Alug 553b8ccf6b Revert "i am in pain"
This reverts commit e0e75eac33.
2024-03-01 15:26:57 +01:00
Alug bceef0b861 Fix nametag offsets with reverse gravity and flipcam 2024-03-01 15:24:04 +01:00
Alug 53cce6c6bb this does not exist 2024-03-01 02:31:55 +01:00
Alug b95047d09f fix vertical flip driftgauge
and make non flipcam behave like the sg lua version
2024-03-01 01:53:17 +01:00
Alug c6cb4375f5 fix shearing offset with flipcam in K_GetScreenCoords 2024-03-01 01:03:03 +01:00
Alug a07e2b8eda only check for stplayer flipcam
until i figure out a better way to check all of this crap
2024-02-29 23:08:24 +01:00
Alug 98e7002167 z 2024-02-29 16:22:07 +01:00
Alug 3428dde3c6 test 2024-02-29 05:37:21 +01:00
Alug 13d48f982b just make it like this 2024-02-29 00:27:37 +01:00
Alug b2e4dc27e4 give me a little more info on vanilla scoreboard but a bit ugly lul 2024-02-29 00:22:50 +01:00
Alug deddeab049 stimky ugly 2024-02-28 22:31:06 +01:00
Alug c3a6410822 Revert "dont need SEENAMES"
This reverts commit 01172bca77.
2024-02-28 22:06:02 +01:00
Alug c5915091aa kill have_blua 2024-02-28 21:53:59 +01:00
Alug 4401f0659e kill delfile 2024-02-28 18:58:04 +01:00
Alug a0c72d32e8 kill weighted recycling 2024-02-28 18:38:54 +01:00
Alug 1493045ec4 this doesent even exist anymore lmao 2024-02-28 18:33:12 +01:00
Alug 210efb2be7 kill eslope_typeshim 2024-02-28 18:26:54 +01:00
Alug a02fc1de63 kill GL_SHADERS 2024-02-28 18:19:11 +01:00
Alug 7755bfc861 Zzz... 2024-02-28 18:05:24 +01:00
Alug 01172bca77 dont need SEENAMES
esp when we get nametags its obsolete
2024-02-28 17:58:06 +01:00
Alug 143cbc8587 kill polyobjects ifdef 2024-02-28 17:55:47 +01:00
Alug b65f655a8a update libcurl to 7.69.0 2024-02-28 15:23:54 +01:00
Alug ed04c86369 u 2024-02-28 04:53:42 +01:00
Alug c0eaa17eb3 e 2024-02-28 04:51:13 +01:00
Alug 6383a55038 kill hw_trick 2024-02-28 04:47:55 +01:00
Alug 574df60d58 kill eslope 2024-02-28 04:40:03 +01:00
Alug 61ee575cd3 forgor this 2024-02-28 04:11:39 +01:00
Alug bdd963081e OpenGL: Fix linedef type 10 not culling FOFs 2024-02-28 03:50:43 +01:00
Alug 6b908d7a14 missed those 2024-02-27 22:16:52 +01:00
Alug 7d0d70c094 oopsie 2024-02-27 22:11:32 +01:00
Alug e75c5a9248 delete half of srb2 2024-02-27 21:49:31 +01:00
Alug b8ed5f4f1a dont need this anymore 2024-02-27 21:36:57 +01:00
GenericHeroGuy 660d7060e4 Don't return aggregates 2024-02-27 20:24:46 +01:00
Alug 79c5f57714 Merge remote-tracking branch 'origin/joinrefusemessage' into lugstuff 2024-02-27 20:03:47 +01:00
Alug 606d8fbe55 optimize gif palette creation 2024-02-27 20:01:56 +01:00
Alug edfa116a40 a 2024-02-27 18:38:28 +01:00
Alug 55ca0c712f add dynamic gif delay
fixes issues with low framerates, uncapped and stutters
2024-02-27 17:41:40 +01:00
Alug 16bef488ee no idea how that ever got there 2024-02-27 15:52:50 +01:00
Alug 82d784d9f8 Toggle for R_Pointtoangle Ex or 64
Ex may perform better on 32bit clients and some cpus so lets just make it toggable
2024-02-27 15:52:34 +01:00
indev 103fb2dfc1 Don't return NULL when creating MT_NULL mobj, since it is needed in some parts of game 2024-02-27 13:29:20 +01:00
Alug bba3e1810b add this 2024-02-27 05:14:05 +01:00
Alug af5333f63e fix P_PlayerInPain 2024-02-27 05:07:44 +01:00
Alug ea77a5fb53 Fix con_hudlines being off by one, Fix con_hudtime overflow 2024-02-27 05:07:11 +01:00
Alug a4aef0894b fix compile for qt 2024-02-26 23:48:47 +01:00
Alug bab7972518 Put HTTP downloading on a background thread
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2322
2024-02-26 23:37:54 +01:00
Alug 88853a7aee make the menus a little prettier 2024-02-26 22:01:11 +01:00
Alug d3339df853 toggle for showing nametags during spectating 2024-02-26 22:00:53 +01:00
Alug 385614b448 add toggle for showing nametags after you finished a race
off by default to match sg nametags
2024-02-26 21:19:59 +01:00
Alug c47ba80f5d death 2024-02-26 20:58:58 +01:00
Alug 6de0700f49 use V_LocalTransFlag for driftgauge 2024-02-26 20:58:50 +01:00
Alug d9fe52b1a1 use V_LocalTransFlag for nametags 2024-02-26 20:58:39 +01:00
Alug ccfc476ec0 replace SCR_FPSflags with V_LocalTransFlag
so we can actually display hud transparency stuff before the hud appears, since that doesent work with V_HUDTRANS
2024-02-26 20:58:18 +01:00
Alug f518b3c48b e 2024-02-26 20:04:12 +01:00
Alug 81d52db722 Revert "connect loadingscreen should clear menus"
This reverts commit 6b41cf676c.
2024-02-25 23:42:30 +01:00
Alug df9973da99 fix tagsdisplayed counter 2024-02-25 21:32:25 +01:00
Alug ca4c779c66 dont quit addon downloading with the mousewheel lmao 2024-02-25 19:47:52 +01:00
Alug 7897352175 connect loadingscreen should clear menus 2024-02-25 19:42:21 +01:00
Alug e0e75eac33 i am in pain 2024-02-25 19:06:32 +01:00
Alug 31d83dd26e disable driftgauge by default 2024-02-25 18:35:00 +01:00
Alug 698a0b811f disable nametag by default 2024-02-25 18:34:46 +01:00
Alug f69609b403 Merge branch 'lugstuff' of https://github.com/Indev450/SRB2Kart-Saturn into lugstuff 2024-02-25 18:21:12 +01:00
Alug 56259e3476 lua hud disable option for driftgauge 2024-02-25 18:21:03 +01:00
Alug f3dfa53f31 lua hud disable option for nametags 2024-02-25 18:21:03 +01:00
Alug e10d60c08e hud disable option for driftgauge 2024-02-25 18:20:32 +01:00
Alug ad4037351f hud disable option for nametags 2024-02-25 18:20:19 +01:00
NepDisk f9e1da8c9f Add coloring to large numbers 2024-02-25 17:34:12 +01:00
NepDisk 2f05137af7 Fix fillbar 2024-02-25 17:34:08 +01:00
Alug c305e31c2e fix first person splitscreen driftgauge stuff a 2024-02-25 12:21:57 +01:00
Alug a55fabe4f9 k... 2024-02-25 12:12:18 +01:00
Alug c58848b298 add splitscreen to screencoords and fix splitscreen for driftgauge 2024-02-25 12:10:23 +01:00
Alug ede644d3c4 use SleepEX on windows and set the min sleep duration to 16ms 2024-02-25 04:08:25 +01:00
Alug 4ff98e62a9 actually disable it for splitscreen for now
its botched and needs fixing
2024-02-24 20:32:15 +01:00
Alug e87fd2fff6 dont draw driftgauge when not using chasecam 2024-02-24 20:14:52 +01:00
indev 33e8b10579 Don't need for long there, fixed_t is big enough 2024-02-24 20:05:12 +01:00
Alug d11780f62d add -1 check for driftgauge too 2024-02-24 20:05:07 +01:00
Alug 7706aa0bf0 fix conflict 2024-02-24 16:56:28 +01:00
Alug cf96e10552 Revert "Refactor Batching code"
This reverts commit 8d737c96c9.
2024-02-24 16:49:04 +01:00
Alug 1d01e1e6cd Revert "Optimize polygon sorting on batch renderer"
This reverts commit 1687fb9120.
2024-02-24 16:48:14 +01:00
Alug a5c4759662 disable driftgauge in record attack
it actually gives you an advantage over using other clients
record attack should be fair and even
2024-02-24 15:58:47 +01:00
Alug e7ff1d693b fix K_GetScreenCoords y clipping 2024-02-24 15:38:32 +01:00
Alug 9b4354a057 rename all of those to not conflict with mods 2024-02-24 14:46:13 +01:00
Alug 51a46ba92c this aswell 2024-02-23 01:35:49 +01:00
Alug 31c4e0d59f forgor those aswell 2024-02-23 01:27:52 +01:00
Alug 6b246548c3 raise compile time significantly 2024-02-22 23:58:28 +01:00
Alug 57dda3843a use the current not old state
also add dont interp precip angle if it doesent change
2024-02-22 23:45:56 +01:00
Alug b04ac14751 remove redundant check 2024-02-22 23:45:53 +01:00
Alug 5ad8497db2 those too 2024-02-22 22:53:10 +01:00
Alug 672f07a5ee forgor those 2024-02-22 22:46:58 +01:00
Alug aceffafc4e fix ternary hell for palette rendering lightlevels 2024-02-22 21:42:28 +01:00
Alug 891b3183ed dont interpolate unchanging things + remove unused dynslope interp code 2024-02-22 19:55:45 +01:00
Alug 26dd066280 fix conflicts 2024-02-22 01:43:54 +01:00
Alug 157ebdb5fe Merge remote-tracking branch 'ghg/lua-hudstuff' into lugstuff 2024-02-22 01:39:34 +01:00
Alug 1a18839f82 remove R_PointToAngleEx
R_PointToAngle64 does its job better anyways
2024-02-20 21:10:04 +01:00
Alug e7f8e7628f I HATE MENUS I HATE MENUS 2024-02-20 18:42:37 +01:00
Alug 07190571a1 lol 2024-02-20 18:40:01 +01:00
Alug f04d922fca fix warning 2024-02-20 18:17:25 +01:00
Alug 7fa382d4e9 rename driftgauge cvar and fix nametag rendering bug 2024-02-20 18:12:17 +01:00
Alug 97766710c0 e 2024-02-20 17:37:29 +01:00
Alug 994ee060a7 a 2024-02-20 17:36:05 +01:00
NepDisk 589c27fdcf Driftgauge flipcam 2024-02-20 17:35:01 +01:00
NepDisk 37a018fda4 Give these tooltips 2024-02-20 17:34:58 +01:00
NepDisk f49381d1c5 Forgot this lol 2024-02-20 17:34:54 +01:00
Alug 573095bbad Driftgauge 2024-02-20 17:34:49 +01:00
Alug 0fdcc8e288 some fixes 2024-02-20 17:33:24 +01:00
Alug 03d7e26c3d oop 2024-02-20 13:18:23 +01:00
Alug 3a5cd835ad Fix tint equation shader 2024-02-20 13:17:46 +01:00
Alug 47a8f081e9 set currenttex to null if it gets an invalid texture id 2024-02-20 13:17:35 +01:00
Alug ad8d691c11 kill this 2024-02-20 13:16:50 +01:00
NepDisk 8186696e62 Nametag sightofline fix 2024-02-19 20:35:38 +01:00
Alug 183ec22923 Revert "Revert "Linked list for textures""
This reverts commit fe0dabb177.
2024-02-19 20:26:59 +01:00
Alug 5376995350 add max cap to nametagmaxplayers 2024-02-19 19:02:54 +01:00
Alug acb6e30fad dont apply this for players 2024-02-19 18:20:11 +01:00
Alug fe0dabb177 Revert "Linked list for textures"
This reverts commit 7eec58a834.
2024-02-19 12:15:12 +01:00
NepDisk 194ae46ce8 Remove unused functions that were originally added for nametags 2024-02-19 11:14:49 +01:00
NepDisk 2e9f1bfe90 Fix nametag weight offset for small and minimal 2024-02-19 11:14:46 +01:00
Alug a82adc4948 Fix nametag limit 2024-02-19 11:14:41 +01:00
Alug 6440c70a38 Zzz... 2024-02-19 01:57:42 +01:00
Alug 748eb07c9a forgor 2024-02-19 01:57:04 +01:00
Alug 5be2f591d2 ok so this needs to be done for the scaling stuff cool 2024-02-19 01:49:20 +01:00
Alug f2e4950e89 die 2024-02-19 01:26:01 +01:00
Alug 7444c5b826 remove hpmod stuffs since its not netsafe 2024-02-19 01:02:39 +01:00
Alug 5f6cca68cc Nametags Rewrites 2
contains netunsafe stuff but easy to remove
2024-02-19 00:44:07 +01:00
Alug 3d33e5351b bruh 2024-02-19 00:13:42 +01:00
Alug c6e245450d those are not server commands
idk why i threw them there in the first place but those are not needed at all (or even usefull for that matter) for dedicated servers
also moves some stuff to its group
2024-02-19 00:12:11 +01:00
Alug 36854a16b7 Revert "Clean up cvar stuff a little"
This reverts commit 6fe87ab05a.
2024-02-19 00:04:25 +01:00
Alug b4ee8229ee Revert "more stuff"
This reverts commit 150c695979.
2024-02-19 00:03:27 +01:00
Alug cf0a3841e8 Revert "those need to be here for some reason"
This reverts commit 2efaebcf89.
2024-02-19 00:03:16 +01:00
Alug 3ebd2257f8 ok i dont want to the new gamma system
it looks off honestly
2024-02-18 23:47:42 +01:00
Alug 844d1967cc i wanna try the new gamma stuff 2024-02-18 22:29:24 +01:00
Alug dac37f8938 revert those 2024-02-18 22:29:12 +01:00
Alug dd74bc7c2b fuckit make the scale even smoler 2024-02-18 22:29:05 +01:00
Alug 7eec58a834 Linked list for textures 2024-02-18 22:28:52 +01:00
Alug da81998c71 fix up colour cube/saturation/gamma
cleans up things, and fixes it not being applied to 3D models and colourmapped sectors when not in palette rendering mode
also adds a new way of handling gamma which can be used if wanted
2024-02-18 20:43:40 +01:00
Alug d1552e7b71 clean up patch drawers a little
esp for software
2024-02-18 19:45:17 +01:00
Alug c64e10083b Optimize R_StoreWallRange
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2336?commit_id=a04bef7d39f71cfda1fe85b2ca3a820f95612b06
2024-02-17 22:52:12 +01:00
Alug 43e2be58da Revert "add an error message here"
This reverts commit 44b8a8a0d8.
2024-02-17 17:31:14 +01:00
Alug 63b60d2546 those too 2024-02-17 16:11:32 +01:00
Alug 91ddc709eb forgor 2024-02-17 16:09:39 +01:00
Alug 1bcb67ffb9 remove bloat from windows libs + move dlls into dlls folder
+ remove msvc project files since they dont work anyways
2024-02-17 15:59:16 +01:00
Alug 976177c244 Revert "Revert "fix the dumbass compiler warning""
This reverts commit 69d47a5e53.
2024-02-17 11:13:07 +01:00
Alug a37c81a142 Revert "Revert "fix some issues with framebuffer""
This reverts commit 6457847633.
2024-02-17 11:13:04 +01:00
Alug 58de3a35a0 Revert "Revert "Implement framebuffer and renderbuffer objects""
This reverts commit b0f5f4338f.
2024-02-17 11:13:00 +01:00
Alug 44b8a8a0d8 add an error message here
dunno if we can prevent it from crashing, but atleast its a little more informative
2024-02-17 10:42:16 +01:00
Alug b0f5f4338f Revert "Implement framebuffer and renderbuffer objects"
This reverts commit d6d70e1525.
2024-02-17 09:57:38 +01:00
Alug 6457847633 Revert "fix some issues with framebuffer"
This reverts commit fcc810f703.
2024-02-17 09:57:25 +01:00
Alug 69d47a5e53 Revert "fix the dumbass compiler warning"
This reverts commit d0b7f6203c.
2024-02-17 09:57:12 +01:00
NepDisk 02177a7794 Nametags Rewrites 2024-02-17 09:11:27 +01:00
Alug 65c15126f1 larger console buffer for high res 2024-02-17 09:10:24 +01:00
Alug 76c78b8e63 remove all this crap 2024-02-16 15:30:18 +01:00
Alug f63342ff0f lol 2024-02-16 13:35:30 +01:00
Alug e3410cf34c move this 2024-02-16 13:35:25 +01:00
Alug 7a129047e7 i will play this in 8k yes 2024-02-16 09:36:51 +01:00
Alug 343716b7da make this save 2024-02-15 20:22:05 +01:00
Alug 1687fb9120 Optimize polygon sorting on batch renderer 2024-02-14 21:39:31 +01:00
Alug 3e89057c23 Fix dangling pointer in mapthing after removing mobj 2024-02-14 21:39:20 +01:00
Alug 774587efa6 fix inline warnings 2024-02-14 19:43:44 +01:00
Alug 2dc8bf321e do this again 2024-02-14 19:27:25 +01:00
Alug 992813d770 Revert "remove mobj realscales"
This reverts commit 9f45dabd9c.
2024-02-14 19:27:21 +01:00
Alug 46882dee93 Revert "move this, remove interp things, and add some comments"
This reverts commit 47c90f63a8.
2024-02-14 19:27:18 +01:00
Alug 8bbb7b540f Revert "forgor"
This reverts commit e4ec7484aa.
2024-02-14 19:27:14 +01:00
Alug f5f1ab036d Fix segfault when removing mobjs while iterating thinglist 2024-02-14 15:31:06 +01:00
Alug f15d556c05 fix segfaults when damaging mobj with no painstate and when removing source from ShouldDamage 2024-02-14 15:27:15 +01:00
Alug 570a664db8 Use po2 patches to fix mipmaps 2024-02-14 12:50:40 +01:00
Alug 52f69324d9 better savegame errors 2024-02-14 12:19:38 +01:00
Alug ea6016b1ba forgor 2024-02-14 12:00:25 +01:00
Alug 30fcffd63c move this, remove interp things, and add some comments 2024-02-14 11:44:14 +01:00
Alug 50446bbde4 remove mobj realscales
idk those just seem absolutely useless its literally just an alias for mobj scale
2024-02-14 11:42:51 +01:00
Alug b307033aab a? 2024-02-14 05:58:04 +01:00
Alug 3e5985833c Snap to software lightlevel values when using Paletter renderer
bye bye smooth fades, here i come 32 light levels
2024-02-13 16:35:10 +01:00
Alug 8421f02aab e 2024-02-13 12:44:34 +01:00
Alug b6daafec17 Realloc software lookups for current screen res instead of MAXVID define
so the thing just allocs what it needs, so it can perform as good as it can on any resolution
2024-02-13 12:44:05 +01:00
Alug fc058b669e better comment 2024-02-13 11:16:00 +01:00
Alug 99214b98b9 set this to 1440p
also made a new define for use in the png limits so that can stay at 4k. but having both maxvids allocate things for 4k is not a good thing for software renderer, not that anyone would ever want to run it at 4k anyways
2024-02-13 11:15:14 +01:00
Alug ab35a44ed9 more revert 2024-02-13 10:57:36 +01:00
Alug 125b82a5bb forgor 2024-02-13 10:53:38 +01:00
Alug f294ea157f more things 2024-02-13 10:50:11 +01:00
Alug 486ae052ef this stuff too 2024-02-13 10:42:03 +01:00
Alug 53b5442dad bruh 2024-02-13 10:40:42 +01:00
Alug 507c5f75bd revert a few things 2024-02-13 10:39:27 +01:00
Alug 0fb72c579e forgor 2024-02-13 06:16:38 +01:00
Alug c5d6ac63c5 remove pseudoangle 2024-02-13 06:12:32 +01:00
Alug a934c76263 revert this 2024-02-12 14:38:47 +01:00
Alug 0098c3bbc0 update SDL2 to v2.30.0 2024-02-12 14:29:49 +01:00
Alug f3eedc03e6 Add common I_GetSysName function
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2308
2024-02-12 14:23:09 +01:00
Alug 17c71a2528 Change from double to INT64 2024-02-12 14:19:25 +01:00
Alug d2ecbd7c6e Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-02-12 14:14:49 +01:00
Alug 2ce7dc0c37 update zlib to v1.3.1
update zlib to v1.3.1
2024-02-11 16:43:19 +01:00
Alug b648424c18 add stuff to menu 2024-02-11 15:21:20 +01:00
Alug 301754c857 forgor 2024-02-11 15:10:16 +01:00
Alug c9a3c4c9b8 only interpolate those if we use the stuff that uses them 2024-02-11 15:05:58 +01:00
Alug ce0c8b363a only interpolate pitch, roll, slopepitch and sloperoll when using sprite rotation 2024-02-11 14:51:44 +01:00
Alug 9d6c38004c toggable mobj subsector interpolation
honestly couldnt spot any difference at all
but R_PointinSubsector is quite expensive so making a toggle seems cool
2024-02-11 14:51:14 +01:00
Alug 19a58cc8c6 mobj interp optimization 2024-02-11 14:19:08 +01:00
Alug d855c39da2 a 2024-02-11 13:45:48 +01:00
Alug 03f4bfecc1 Dont need this
I_GetPrecise Precision already gets the high res windows time anyways
2024-02-11 13:42:12 +01:00
Alug c8d9e4c7b3 add thiis 2024-02-11 09:22:59 +01:00
Alug cb2b8f2e7c add it here too 2024-02-11 06:38:45 +01:00
Alug 0272dd4c24 oops 2024-02-11 06:29:28 +01:00
Alug 3b327937c2 use Windows High Precision Timer on Windows builds
lul may help with frametime and other stuff
2024-02-11 06:16:45 +01:00
Alug f8f2f17184 Merge remote-tracking branch 'origin/cvarcleanup' into lugstuff 2024-02-09 15:18:17 +01:00
Alug 2efaebcf89 those need to be here for some reason
game complains
2024-02-09 15:12:41 +01:00
Alug 150c695979 more stuff 2024-02-09 15:05:23 +01:00
Alug 6fe87ab05a Clean up cvar stuff a little 2024-02-09 14:42:55 +01:00
Alug f6613a5555 proper check for colourized speedometer patches 2024-02-09 12:35:48 +01:00
Alug 947d5c2739 add achiiro speedometer stuffs 2024-02-09 12:07:34 +01:00
Alug 1544706ff4 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-02-09 10:20:21 +01:00
Alug e121d1a8a1 proper POST request to curl 2024-02-09 10:19:35 +01:00
Alug badbdbf03f Clipping and portal stuff
idk this actually does not break ante station for some reason
2024-02-09 10:19:18 +01:00
Alug 3b5495b53a brap 2024-02-07 11:52:04 +01:00
Alug 545027ae64 use this stuff 2024-02-07 11:40:05 +01:00
Alug 91896433f8 fix menu updating + add default to switch 2024-02-07 11:01:53 +01:00
Alug a60074fc8a fix menu stuff 2024-02-07 10:49:04 +01:00
Alug eb82aa14bb option for small nametags 2024-02-07 10:35:16 +01:00
Alug cb4b640730 why add the same thing twice? 2024-02-07 09:42:16 +01:00
Alug 266d9a3c71 also turn this off 2024-02-07 09:37:01 +01:00
Alug 7a5a704a15 forgor to comment this out 2024-02-07 09:36:37 +01:00
Alug 29ed8de935 Nametags from Chaoskart
https://gitlab.com/Fafabis/kart-chaotic/-/commit/8b4a12e144fbff587ee70c30e7f461900d839650#025e5c90ea9aeb6187b4fe002e0fbb277ef4b33d_7024_7035
2024-02-07 09:35:14 +01:00
Alug 3418cab5de switchable native keyboard input
taken from chaoskart this is completely non invasive
2024-02-07 09:20:36 +01:00
Alug e2ce015d49 fix for opengl sprite shadow colour 2024-02-07 09:15:17 +01:00
indev 0d0ab3f414 If have libbacktrace, write crash reports from I_Error 2024-02-04 19:08:33 +01:00
Alug 22b5bcc7e1 split cache functions
seems to fix a few stutters
2024-02-04 09:21:45 +01:00
indev 34d5d73d7e Fix battle playing wrong ending music sometimes 2024-02-04 08:31:10 +01:00
Alug 7ae4441731 Add cvar gr_maxinterpdist, which allows to control max distance on which mobjs will be interpolated 2024-02-04 08:26:54 +01:00
Alug d0b7f6203c fix the dumbass compiler warning 2024-02-04 07:56:55 +01:00
Alug 3757f3ae57 smol cleanup 2024-02-04 07:46:25 +01:00
Alug 8f9366da5a Zzz... 2024-02-04 07:12:26 +01:00
Alug b8e55f87a9 little portal cleanup 2024-02-04 06:48:58 +01:00
Alug b469f70e02 experimental fast sprite sorting 2024-02-04 06:28:07 +01:00
Alug 6df69b24db Revert "DSDADoom shenanigans"
This reverts commit c7931ca69c.
2024-02-02 16:49:08 +01:00
Alug 0133a5eb23 Revert "do this"
This reverts commit 7f93bc305d.
2024-02-02 16:48:26 +01:00
Alug 86712c2c48 fix compiler warning 2024-02-02 02:59:08 +01:00
Alug 5195caa3c6 Remove Build2DMipmaps and GLU library stuff
gluBuild2DMipmaps is just broken anyways
and it was the only thing used from the GLU library aswell so can remove things in favor of better solutions
having a pc with opengl 1.4 should be a given by now
2024-02-01 22:26:06 +01:00
Alug 684ad38d4b add an I_Error for when opengl is started on unsupported hardware or driver 2024-02-01 19:57:23 +01:00
Alug c6d292a3d7 e 2024-02-01 04:47:55 +01:00
Alug 246414a735 move that where it belongs 2024-02-01 04:42:28 +01:00
Alug 429bcffaf8 dont need to extra check for this actually 2024-02-01 03:48:17 +01:00
Alug d92e7b138c fix sprite roll angles in software for sprites with one rotation frame
ofc only when the rotation stuff is set to rotate everything not just the player
also changes that the shadows only rotate on that setting unless someone wants it and wants really dumb checks for it
2024-02-01 03:46:15 +01:00
Alug cd51ad2a25 remove non working fisheye lens code
remnants of birdhouse, this was never finished nor does it work
2024-02-01 03:26:33 +01:00
Alug 8732825404 fix software shadow rotation in the worst way possible kek 2024-02-01 03:25:58 +01:00
Alug fc37cdcc95 use it for camang 2024-02-01 02:39:27 +01:00
Alug 2435ec9515 Revert "batch this stuff too for portals"
This reverts commit 2df4738af2.
2024-02-01 02:11:21 +01:00
Alug 623fab8ea8 Revert "clean this up a little"
This reverts commit 99c9d921e3ab3ee3fde3dcf141e20323e064902a.
2024-02-01 02:03:23 +01:00
Alug e063345c4b Revert "oops"
This reverts commit 59b6987bf2e9f00bfdf50b268f0ec61e735dfe0e.
2024-02-01 02:03:10 +01:00
Alug 27533a1dcd Revert "replace check"
This reverts commit 36eaaee202c4d1f7e86dd2b24dcfe5573ac2f280.
2024-02-01 02:03:00 +01:00
Alug d232e0e2c6 oops 2024-02-01 01:55:04 +01:00
Alug 0475489e24 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-31 16:58:09 +01:00
Alug 34b35db27f Interpolate polyobjects properly for the software renderer
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2284/
2024-01-31 03:28:00 +01:00
Alug b47bc12e48 change x scale a little 2024-01-30 21:43:44 +01:00
Alug 4d102dcf68 similar scale to old speedo 2024-01-29 23:08:19 +01:00
Alug a8c9663200 ok i can just do it like this lol
now its good finally
2024-01-29 22:23:04 +01:00
Alug 57660cc5af fix 1 pixel gap
i hate maths
2024-01-29 22:13:54 +01:00
Alug c459e918af prep some speedometer stuff 2024-01-29 22:01:16 +01:00
Alug 962abba1b2 Buffer API is OpenGL 1.5, so can be used in STATIC_OPENGL
https://git.do.srb2.org/STJr/SRB2/-/commit/623629b04ab72071e6ea4f0c4a3245e6cde72e2c
2024-01-29 18:19:01 +01:00
Alug 5297d18f92 ugh whyyyy 2024-01-29 18:08:18 +01:00
Alug 7853e48a6f update libopenmpt libs 2024-01-29 18:07:35 +01:00
Alug 303d87f69d update libgme 2024-01-29 15:59:48 +01:00
Alug 9dcdc9500d Revert "bruh wtf"
This reverts commit 493091cd66.
2024-01-29 14:43:12 +01:00
Alug 7723bafff6 replace check 2024-01-29 04:38:26 +01:00
Alug d74a89c6c1 oops 2024-01-29 04:11:21 +01:00
Alug cce443be0b clean this up a little 2024-01-29 04:08:14 +01:00
Alug 81fa3d27bf uuuuuuuhhh 2024-01-29 03:56:43 +01:00
Alug 493091cd66 bruh wtf 2024-01-28 22:07:49 +01:00
Alug c75f5ee961 use this for portal clipping too 2024-01-28 19:33:45 +01:00
Alug 083e0ca2e0 dont need this anymore 2024-01-28 19:19:16 +01:00
Alug 79bd89016c dont need it as an extra file 2024-01-28 19:16:04 +01:00
Alug eca7e38763 Zzz... 2024-01-28 19:15:14 +01:00
Alug b5cbfb970f forgor 2024-01-28 18:58:52 +01:00
Alug 74e1cafd9d this too 2024-01-28 18:57:19 +01:00
Alug ee7381b67d revert this 2024-01-28 18:56:10 +01:00
Alug 7f93bc305d do this 2024-01-26 02:44:37 +01:00
Alug c7931ca69c DSDADoom shenanigans
R_PointToPseudoAngle seems rather promising
2024-01-26 02:28:07 +01:00
Alug 90f06a3289 a little better solution still bad lmao 2024-01-26 00:04:42 +01:00
Alug 0e344a7e02 screw it ill just do this 2024-01-25 23:40:37 +01:00
Alug 3f91a4e908 i want a small hud 2024-01-25 23:04:21 +01:00
Alug fb443c58ab add "Reset All" button to hud offset menu 2024-01-25 23:02:01 +01:00
Alug b233514b58 more offset 2024-01-25 16:48:16 +01:00
Alug 11615171d1 Revert "Optimize polygon sorting on batch renderer"
This reverts commit ad86e7f34a.
2024-01-25 14:57:49 +01:00
Alug 2df4738af2 batch this stuff too for portals 2024-01-25 04:06:54 +01:00
Alug 9e62f5bd52 make the ripple thing toggable for now 2024-01-25 03:46:26 +01:00
Alug 80349ae8ee a 2024-01-25 03:24:32 +01:00
Alug 06d51f2648 only apply fog if it is water only
ugh
2024-01-25 02:59:30 +01:00
Alug fcc810f703 fix some issues with framebuffer 2024-01-25 00:35:31 +01:00
Alug d6d70e1525 Implement framebuffer and renderbuffer objects
wew https://git.do.srb2.org/Lactozilla/SRB2/-/commit/211c3720de8dda8e2a896b6887eb4bbbd991ebbf
2024-01-24 22:35:30 +01:00
Alug e5f79e061c rotating shadows
uuuuhhh
2024-01-24 18:13:50 +01:00
Alug ad3c0a1ffd attempt at fixing some issues
it fixed some things but broke the underwater ripple if the water is on a fof
2024-01-24 17:09:15 +01:00
Alug 2ef935198a more pronounced ripple
eeeh kinda close ig
2024-01-24 03:41:02 +01:00
Alug dc3b9c648a make this a little neater 2024-01-24 03:09:09 +01:00
Alug 2d610d40b6 add better check for colormap stuff
so it only gets applied where it should (i hope)
works on tiled byway tho
2024-01-24 03:00:31 +01:00
Alug d2c686f48b attempt at making ogl water ripple better
well all it does is ripple the floor below the water fof lmao no idea how i would implement this for the walls too
2024-01-24 02:43:27 +01:00
Alug 5cafec3262 uuuh oops dont do it for non transparent fofs 2024-01-24 00:26:36 +01:00
Alug 580c42d167 more offset ugh 2024-01-23 21:33:15 +01:00
Alug dcfec35e57 remove this since its not needed anymore 2024-01-23 21:24:18 +01:00
Alug 701bac6e11 alr add more offset
kinda dumb way but itll do for now until i figure out smth better
2024-01-23 21:21:03 +01:00
Alug 0c46d593d8 attempt at making colormapped translucent fofs more accurate 2024-01-23 18:55:19 +01:00
Alug b867de0667 Zzz... 2024-01-23 15:50:51 +01:00
Alug e207b75c7a Revert "add pMasterPalette"
This reverts commit dfb05b9d39.
2024-01-23 15:49:00 +01:00
Alug fc3df5bfe4 Revert "attempt at unmangling lighttables and colormaps"
This reverts commit 19702daecd.
2024-01-23 06:41:25 +01:00
Alug dfb05b9d39 add pMasterPalette 2024-01-23 05:33:04 +01:00
Alug 19702daecd attempt at unmangling lighttables and colormaps
ugh i hope this doesent break
2024-01-22 23:28:34 +01:00
Alug dde4b4df3b merge conflict moment 2024-01-22 21:32:38 +01:00
Alug c070930a8c Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-22 21:31:04 +01:00
Alug d36b5f7c59 add hw_shaders to cmakelist 2024-01-22 18:41:00 +01:00
Alug 0e517907ce change this 2024-01-22 18:32:13 +01:00
Alug 739e9716ab add toggle for custom shaders
it seems better like this, atleast thats how hannu set it up
2024-01-22 18:25:51 +01:00
Alug 0e5972d895 shaderstate should be set here 2024-01-22 18:15:53 +01:00
Alug 71975658ca split hw_shader files 2024-01-22 18:14:14 +01:00
Alug 6572e29a64 OpenGL shader code rearrangement and shader pre-preprocessor
https://git.do.srb2.org/STJr/SRB2/-/commit/de37df1be04e9d1dfb11083a9585eb6ac1761633?merge_request_iid=1516
wew
2024-01-22 16:57:47 +01:00
indev 41b21c2a0c Fix sound, music, and midi music toggles 2024-01-22 13:48:13 +01:00
Alug 2b19d2e6de Revert "revert this"
This reverts commit 5bce9d5abf.
2024-01-22 13:48:10 +01:00
Alug f99aa3459c e 2024-01-22 13:48:00 +01:00
Alug 5bce9d5abf revert this
this caused sound and music to alyways toggle themselves on after a restart + other issues
2024-01-22 02:55:40 +01:00
Alug abe102649e forgor 2024-01-22 02:52:33 +01:00
Alug 424fcdc63a change some memfree names 2024-01-22 02:46:59 +01:00
Alug a3fd451c74 3D model texture Z_tag 2024-01-22 02:43:55 +01:00
Alug 731fd113d2 more cleanup 2024-01-22 02:34:07 +01:00
Alug c9ca1bda5c Texture buffer for non RGBA to RGBA conversion 2024-01-22 02:09:55 +01:00
Alug 58ea822050 Remove 3Dfx and glide things
gr_rounddown toggle did nothing instead the game always resized textures, now it wont, seems like this makes stutters on mapload less
2024-01-22 01:03:48 +01:00
Alug 671484d6f9 fix merge conflict 2024-01-21 16:41:38 +01:00
Alug e6e74194bc Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-21 16:40:12 +01:00
Alug 04432c8368 simplify this uuh 2024-01-21 15:43:46 +01:00
Alug 6782876c0c i hate this so i just make it a boolean
confused the heck outta me so just do it like this lmao
2024-01-21 15:31:07 +01:00
Alug 4b09e92d7c grr 2024-01-20 17:24:11 +01:00
Alug 3266f64fb9 oops 2024-01-20 17:03:05 +01:00
Alug 2a9886e698 cleanup s_sound a little + fix onchanges 2024-01-20 17:01:48 +01:00
Alug 1319e3a811 make NO_MIDI=0 compile 2024-01-20 16:52:46 +01:00
Alug 6cbb40f874 make some things static + remove cdmusic leftovers 2024-01-20 15:43:42 +01:00
Alug 07fd6a3ad4 make sound precaching useful at all
so it also precaches addon sounds and all
thx indev for help <3
2024-01-20 15:39:25 +01:00
Alug 8891869013 fix issues with sound precaching
adds a check if sounds have been previously loaded already

also makes it useful at all by not freeing soundsfx data on each mapload when its enabled

also adds an onchange so toggling it either caches all sounds again or frees them
2024-01-20 13:58:11 +01:00
Alug 04fc735e12 Merge remote-tracking branch 'origin/morenewpalshader' into lugstuff 2024-01-19 19:37:07 +01:00
Alug 7b9860f1be Merge remote-tracking branch 'origin/morenewpalshader' into lugstuff 2024-01-19 19:25:24 +01:00
Alug 38f26a2bd8 simplify setpalette 2024-01-19 18:07:32 +01:00
Alug a9750f8cff Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-19 12:29:20 +01:00
Alug ad86e7f34a Optimize polygon sorting on batch renderer
again
2024-01-19 02:14:20 +01:00
Alug 496435ef3b dont check for precip in sprite sorting + smol cleanup 2024-01-19 02:14:04 +01:00
Alug 5275b31e7e smol stuffs 2024-01-19 00:39:07 +01:00
Alug e341991703 Add toggle for horizonlines 2024-01-18 20:53:59 +01:00
Alug fb65496507 use fudges from newer paletter shader 2024-01-18 16:49:10 +01:00
Alug abe52ba440 make thundershield follow player offset
this allows the to stay on the player when saltyhopping etc.
2024-01-18 15:21:20 +01:00
Alug ee5d097201 Prevent FOF alpha from wrapping around in OpenGL 2024-01-18 15:07:29 +01:00
Alug 0ea182d04f change this 2024-01-18 14:12:27 +01:00
Alug 8d737c96c9 Refactor Batching code
from Hannu Hanhi
https://git.do.srb2.org/STJr/SRB2/-/commit/707687beea50a2bfcc14638e923ac516195351b1?merge_request_iid=1774
2024-01-17 18:30:53 +01:00
Alug 5c93b90c2e Merge remote-tracking branch 'origin/batching-stuff' into lugstuff 2024-01-17 18:16:06 +01:00
Alug 41bee850da Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-17 14:59:21 +01:00
Alug 416c2a9e9d Merge remote-tracking branch 'origin/planestuff2' into lugstuff 2024-01-17 12:42:59 +01:00
Alug 8fa9fccc79 Revert "use malloc here"
This reverts commit 75d1076bbe.
2024-01-17 12:42:56 +01:00
Alug c5a4071a06 Revert "Move water ripple spanfunc out of r_plane + tilted water support"
This reverts commit 139d937c86.
2024-01-17 12:42:48 +01:00
Alug 930e48ad39 Revert "Plane optimization and cleanup"
This reverts commit db61bfb568.
2024-01-17 12:42:39 +01:00
Alug 868678f321 Revert "Revert "Revert "Fix vibing slope planes"""
This reverts commit 8530b6512c.
2024-01-17 12:42:34 +01:00
Alug 8530b6512c Revert "Revert "Fix vibing slope planes""
This reverts commit 2a5f487e5f.
2024-01-17 12:32:50 +01:00
Alug 2a5f487e5f Revert "Fix vibing slope planes"
This reverts commit 82562bc20d.
2024-01-17 12:31:28 +01:00
Alug 141f6c51dc Revert "optimize plane stuff even more"
This reverts commit 120def9676.
2024-01-17 12:31:24 +01:00
Alug 1fc9492b30 Revert "Use floating point trig in R_SetSlopePlane"
This reverts commit 3555783284.
2024-01-17 12:31:13 +01:00
Alug 65782d3d75 Revert "more changes"
This reverts commit cb6d657c03.
2024-01-17 12:31:08 +01:00
Alug b5cb6dfb9d Revert "forgoer"
This reverts commit f476befc4b.
2024-01-17 12:31:03 +01:00
Alug 6667e4b8bc Revert "forgor R_GetSlopeZAt"
This reverts commit 4a94939d4f.
2024-01-17 12:30:58 +01:00
Alug 5e2492a930 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-17 12:19:30 +01:00
Alug 4f07372e0f (hopefully) fix overflow in R_DrawRepeatMaskedColumn
well this fixes the game hanging in software renderer on Marsh´s Marble Zone
2024-01-17 12:11:32 +01:00
Alug 80a1a97083 Revert "Revert "Revert "Localskins on replays"""
This reverts commit 12059955e5.
2024-01-16 16:44:41 +01:00
Alug 204476c55d Revert "Hopefully fix the localskin replay issues 🙏"
This reverts commit 8fab258778.
2024-01-16 16:44:38 +01:00
hayaunderscore 8fab258778 Hopefully fix the localskin replay issues 🙏 2024-01-16 16:35:39 +01:00
Alug 12059955e5 Revert "Revert "Localskins on replays""
This reverts commit d3e5dfc346.
2024-01-16 16:35:33 +01:00
Alug 3ca1f957ba fix ogl shearing with flipcam 2024-01-16 16:22:30 +01:00
Alug b11362aec1 remove the extra screentex and apply palshader directly to finaltex
theres basically barely any difference, even in the fades theres very little, and it just cost so freaking much performance

however, ill keep the revamped screentex setup as this it allows us to keep the better fadescreen background for menus
2024-01-15 20:12:35 +01:00
Alug 75630df10e readd oldpal
for performance reasons its better
2024-01-15 19:36:37 +01:00
Alug 4d93abb7ac do this a little better 2024-01-15 17:44:07 +01:00
Alug 731943f980 ensure consistent shader state 2024-01-15 16:50:20 +01:00
Alug 265dc1f296 Light table support for HWR_FadeScreenMenuBack 2024-01-15 16:29:01 +01:00
Alug c449ffcc98 remove gr_oldpal for now 2024-01-15 16:23:19 +01:00
Alug 34500d32d0 paletterenderer screentex stuff again
this didnt really work like it shouldve
so ill keep it here for now
2024-01-15 16:17:17 +01:00
Alug d3e5dfc346 Revert "Localskins on replays"
This reverts commit e1f821e121.
2024-01-15 15:51:28 +01:00
Alug 8ed11107eb remove Shader_Load as Shader_SetUniforms literally did the same thing 2024-01-15 15:10:02 +01:00
Alug 2f51108783 fix lighttable batching for new batching and palshader code 2024-01-15 15:09:36 +01:00
Alug 2667a66419 Merge remote-tracking branch 'origin/batching-stuff' into lugstuff 2024-01-15 14:27:10 +01:00
Alug 0fd073f2f0 Merge remote-tracking branch 'origin/batching-stuff' into lugstuff 2024-01-15 14:18:10 +01:00
Alug 840cf4e00a Revert "Revert "Optimize HWR_RenderBatches polygon sorting""
This reverts commit a36e633555.
2024-01-15 14:15:26 +01:00
Alug d5d99f94b7 cap flashpals again
well it often resulted in flashpals that just made stuff so badly visable lmao
2024-01-15 11:38:09 +01:00
Alug dea19e4416 forgor R_GetSlopeZAt 2024-01-15 11:20:54 +01:00
Alug f7612d7398 forgoer 2024-01-15 11:17:19 +01:00
Alug e39182607e more changes 2024-01-15 11:16:16 +01:00
Alug 79f1febbce Use floating point trig in R_SetSlopePlane 2024-01-15 11:10:12 +01:00
Alug 120def9676 optimize plane stuff even more 2024-01-15 11:09:07 +01:00
Alug 82562bc20d Fix vibing slope planes 2024-01-15 10:44:43 +01:00
Alug 1c51361120 Plane optimization and cleanup
sned help

https://git.do.srb2.org/STJr/SRB2/-/commit/c07c80fd9e626f15b4d84d1766f8963e089d295a
2024-01-15 10:40:51 +01:00
Alug c07e79deb7 Move water ripple spanfunc out of r_plane + tilted water support
idk man
2024-01-15 10:18:13 +01:00
Alug 81cb1111b4 use malloc here 2024-01-15 09:36:35 +01:00
Alug 369307181e this can be static 2024-01-15 08:35:45 +01:00
Alug 7881e04e6b Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-15 08:26:13 +01:00
Alug 66a72eb1be Copy Interpolation to Shields and Overlays, Splitscreen Overlays
from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1992
2024-01-15 08:25:54 +01:00
Alug ad77f11859 Optimize polygon sorting on batch renderer
from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2253

again lul
2024-01-15 00:31:29 +01:00
Alug 96d177876f Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-14 23:50:14 +01:00
Alug dc7392f86b Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-14 22:57:24 +01:00
Alug 6f6252b6f8 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-14 22:50:11 +01:00
Alug 20b32df2c6 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-14 22:13:42 +01:00
Alug d413d02bf7 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-14 21:38:49 +01:00
Alug 426c0366cc Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-13 16:12:04 +01:00
Alug d3d3655580 Merge remote-tracking branch 'origin/crash-log-mention' into lugstuff 2024-01-13 12:05:55 +01:00
Alug d4a011ee6d Merge remote-tracking branch 'origin/addfilelocal-load-animdefs' into lugstuff 2024-01-12 13:37:17 +01:00
Alug b08118734e Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-12 13:37:14 +01:00
indev 41ee6de784 Make non-important files still load textures and animdefs 2024-01-12 15:35:24 +03:00
hayaunderscore 139d2e6be8 Localskins on replays 2024-01-12 12:26:21 +01:00
Alug a866461b0a Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-11 18:46:14 +01:00
Alug 6f61331d46 Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-11 18:46:12 +01:00
Alug 7731ca9fb2 Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-11 09:53:47 +01:00
Alug 3de0c4f5d8 Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-11 01:10:04 +01:00
Alug 2e602f8861 Revert "Revert "just show text instead of miscoloured boxes""
This reverts commit 7072a50060.
2024-01-11 00:50:36 +01:00
Alug 1a7d92a082 Revert "Revert "fix some things""
This reverts commit a65e586de5.
2024-01-11 00:50:26 +01:00
Alug 5aa2a0c821 Revert "Revert "Merge remote-tracking branch 'origin/gammastuff' into lugstuff""
This reverts commit a9d7ca3332.
2024-01-11 00:50:17 +01:00
Alug 4f2328b8dc Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-11 00:47:24 +01:00
Alug e929e524a3 Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-10 14:18:45 +01:00
Alug e6b9f18d3d Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-10 14:14:53 +01:00
Alug 7f197ef84e Merge remote-tracking branch 'origin/newpalshader' into lugstuff 2024-01-10 13:52:26 +01:00
Alug a9d7ca3332 Revert "Merge remote-tracking branch 'origin/gammastuff' into lugstuff"
This reverts commit 9aca8438a2, reversing
changes made to c2d37dfb61.
2024-01-10 13:51:51 +01:00
Alug a65e586de5 Revert "fix some things"
This reverts commit 69ffee271d.
2024-01-10 13:51:46 +01:00
Alug 7072a50060 Revert "just show text instead of miscoloured boxes"
This reverts commit fc1a367c2e.
2024-01-10 13:51:43 +01:00
Alug fc1a367c2e just show text instead of miscoloured boxes 2024-01-09 14:27:05 +01:00
Alug 3b376d85d4 fix some things 2024-01-09 14:19:36 +01:00
Alug 9aca8438a2 Merge remote-tracking branch 'origin/gammastuff' into lugstuff 2024-01-09 14:09:56 +01:00
Alug c2d37dfb61 use og values for pal 2024-01-09 13:38:24 +01:00
Alug 3c3bd0f0ea stuff 2024-01-09 13:25:59 +01:00
Alug 958db336b7 change this 2024-01-09 13:23:54 +01:00
Alug 342d570b3b Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-08 09:07:24 +01:00
Alug 67457c25df Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-08 08:54:08 +01:00
Alug a98d46f8a8 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-08 08:51:05 +01:00
Alug b2fca84b15 Zzz... 2024-01-07 08:25:49 +01:00
Alug 2e31169738 use fudge defines + remove wall and floor shader
both are now consilidated ( i have no idea how to spell that) into doom_colormap shader
2024-01-06 08:11:57 +01:00
Alug 4cda2c8093 use srb2´s sky shader
also its finally a defined shader now + move default fragment shader to the top
2024-01-06 08:07:11 +01:00
Alug 73b4e8a988 change this 2024-01-06 04:57:18 +01:00
Alug 82dbfb4379 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-06 01:15:05 +01:00
Alug 0e2ff2390a Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-05 21:56:11 +01:00
Alug 220d5db739 optimize camera mobj z stuff lol
idk wanna see if this does anything
2024-01-05 06:40:16 +01:00
Alug 212d475f50 fix menu fade screen background using wrong things in palshader 2024-01-05 01:23:05 +01:00
Alug b7fbd0433f little changes to palshader
use gl_texture 2 in postprocess like srb2s palshader does it
also disable depthtest for screentextures in palshader mode
2024-01-05 00:53:19 +01:00
Alug d28dd96aa0 revert this 2024-01-05 00:22:13 +01:00
Alug 0e46f91c51 change order of those 2024-01-05 00:21:51 +01:00
Alug d6dabacb05 wöter... 2024-01-04 23:31:55 +01:00
Alug 4363473955 hehe funky colours 2024-01-04 23:11:46 +01:00
Alug 7e5fd4e290 Merge remote-tracking branch 'origin/compilation-warnings-fix' into lugstuff 2024-01-03 20:02:35 +01:00
Alug c30a0cd4f1 Merge remote-tracking branch 'origin/compilation-warnings-fix' into lugstuff 2024-01-03 20:00:34 +01:00
Alug 98d56a38f5 Merge remote-tracking branch 'origin/compilation-warnings-fix' into lugstuff 2024-01-03 19:45:14 +01:00
Alug f26e95e7c9 Merge remote-tracking branch 'origin/compilation-warnings-fix' into lugstuff 2024-01-03 18:24:19 +01:00
Alug f39e1a9b70 wöter 2 2024-01-03 02:24:15 +01:00
Alug 1d5b531ba3 Revert "uuuh refactor batching a little + port Optimize polygon sorting"
This reverts commit d757e82e3f.
2024-01-02 22:21:25 +01:00
Alug a90bd08405 Revert " Avoid batching skybox and horizon lines"
This reverts commit b5fbaaa2b9ae91877c7c6ad3602956d677fa6e0c.
2024-01-02 22:21:21 +01:00
Alug 1cbb726cab Merge branch 'lugstuff' of https://github.com/Indev450/SRB2Kart-Saturn into lugstuff 2024-01-02 22:13:17 +01:00
Alug ce61d00dcf fix inline warnings 2024-01-02 22:13:13 +01:00
indev 2d92b798c6 Fix warnings related to boolean glib getters/setters 2024-01-03 00:10:28 +03:00
Alug cc62164a7c Revert "Revert "Merge remote-tracking branch 'origin/Saturn-Next-EnumLib' into lugstuff""
This reverts commit 142540e263.
2024-01-02 21:08:03 +01:00
Alug af510bce93 inline deez nuts 2024-01-02 21:07:02 +01:00
Alug 4ba60bedcd AAAAAaaa 2024-01-02 20:36:32 +01:00
Alug 583bf26129 wöter 2024-01-02 20:36:14 +01:00
Alug d8c3623141 Avoid batching skybox and horizon lines 2024-01-02 20:35:26 +01:00
Alug 2cd0875da6 lol 2024-01-02 06:19:31 +01:00
Alug 73d0848f7e (hopefully) fix horizonlines 2024-01-02 03:49:32 +01:00
Alug d757e82e3f uuuh refactor batching a little + port Optimize polygon sorting
uhhh https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2253
2024-01-02 01:02:42 +01:00
Alug 007238e7dd Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-02 00:09:27 +01:00
Alug 944e019020 let indev compile this branch uwu 2024-01-01 21:28:03 +01:00
Alug 634f8897b4 Revert "uuuh refactor batching a little + port Optimize polygon sorting"
This reverts commit 7651d31c50.
2024-01-01 21:19:14 +01:00
Alug 7651d31c50 uuuh refactor batching a little + port Optimize polygon sorting
uhhh https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2253
2024-01-01 20:44:19 +01:00
Alug 1702873ab1 Revert "attempt at making water shader ripple more accurate to software"
This reverts commit 8ab37040db.
2024-01-01 18:55:41 +01:00
Alug 44e7d5249c dont pack my memories 2024-01-01 18:30:06 +01:00
Alug 8ab37040db attempt at making water shader ripple more accurate to software 2024-01-01 18:29:04 +01:00
Alug ac203b0ccb Merge remote-tracking branch 'origin/compilation-warnings-fix' into lugstuff 2024-01-01 17:08:31 +01:00
Alug 557546c9c3 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2024-01-01 17:08:18 +01:00
Alug 52a94dbe78 try and make p-speedometer a little less painful to look at 2023-12-31 03:39:24 +01:00
Alug f4ffc19981 lil k_kart cleanup
uh
2023-12-31 03:12:35 +01:00
Alug ac3c117b03 uh 2023-12-31 00:12:11 +01:00
Alug 1ac008ab02 Merge remote-tracking branch 'origin/compilation-warnings-fix' into lugstuff 2023-12-31 00:07:39 +01:00
Alug 58ac86e3bf noone cares about c90 mixed declarations lmao 2023-12-30 21:51:23 +01:00
Alug 1daf06858b Revert "(maybe?) fix net issues on server join"
This reverts commit af40bdb11b.
2023-12-30 21:41:33 +01:00
Alug a4e8ce7f01 Fix most of compilation warnings 2023-12-30 15:55:07 +01:00
Alug ed6e16cdce uuh 2023-12-30 01:20:09 +01:00
Alug 57bb92a36c this didnt work out lmao 2023-12-30 00:55:24 +01:00
Alug 142540e263 Revert "Merge remote-tracking branch 'origin/Saturn-Next-EnumLib' into lugstuff"
This reverts commit 5dab606980, reversing
changes made to 661dfde6af.
2023-12-29 23:24:08 +01:00
Alug 5a17430747 Revert "Merge remote-tracking branch 'origin/moreopengl' into lugstuff"
This reverts commit a6015e4647, reversing
changes made to fcbe95447a.
2023-12-29 22:49:51 +01:00
Alug 23c84a9e96 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-29 22:49:27 +01:00
Alug 6bb9dcc216 revert that part it stuttered race conditions or somethjing lmao 2023-12-29 15:36:12 +01:00
Alug 1901e4dbdc fuckit idk lmoa 2023-12-29 14:23:29 +01:00
Alug 1657f769da Revert "dont need that"
This reverts commit f274ed3fd8.
2023-12-29 13:11:43 +01:00
Alug c82eb489fe give me all that shit yes 2023-12-29 01:47:27 +01:00
Alug 9f05befd70 i have no idea what im doing lmao 2023-12-29 01:36:33 +01:00
Alug f274ed3fd8 dont need that 2023-12-29 01:35:50 +01:00
Alug f6e027abcb Merge remote-tracking branch 'origin/gl-noencore-effect-fix' into lugstuff 2023-12-27 15:30:13 +01:00
Alug a92114a854 Merge remote-tracking branch 'origin/gl-noencore-effect-fix' into lugstuff 2023-12-27 15:04:36 +01:00
Alug ffb84705d3 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-27 14:40:50 +01:00
Alug 2f8366b6f9 -flto breaks crashlogs it seems lol 2023-12-24 20:28:57 +01:00
Alug a6f062c126 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-24 19:41:15 +01:00
Alug 41c24f3bc9 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-24 19:13:15 +01:00
Alug af40bdb11b (maybe?) fix net issues on server join
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2238?commit_id=d79d22de63c5b84e3e0f4d737af81f74321dd80d

needs alot of testing
2023-12-24 00:15:47 +01:00
Alug 00a69e6aed Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-23 17:24:07 +01:00
Alug 04b2d784ce Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-22 20:28:28 +01:00
Alug a5de51b039 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-21 13:54:33 +01:00
Alug 4a80e9f20f Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-20 23:06:24 +01:00
Alug 8676769a8f Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-20 17:53:09 +01:00
Alug 2f8c7a81ca Revert "Merge remote-tracking branch 'origin/thinkercache' into lugstuff"
This reverts commit 760fe392a8, reversing
changes made to 5dab606980.
2023-12-20 08:35:16 +01:00
Alug ac11af6048 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-20 06:09:25 +01:00
Alug 7c558802a4 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-20 05:16:05 +01:00
Alug 5a516aa1ad dont need that 2023-12-19 21:52:21 +01:00
Alug 4d1b6ed974 Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff 2023-12-19 20:20:57 +01:00
Alug e8e6bb0499 Revert "test stuff"
This reverts commit 085efaa605.
2023-12-19 19:41:55 +01:00
Alug 58f94666d1 timeout sticker uses wrong patch 2023-12-19 18:58:10 +01:00
Alug 085efaa605 test stuff
very crude, console scream at me if those are botched
most likely not the issue but whatever
2023-12-19 18:57:47 +01:00
Alug 6028e392f0 dont prep shaders if theyre uneeded 2023-12-19 17:34:15 +01:00
Alug fa67dd74a0 huehue 2023-12-19 16:28:51 +01:00
Alug cb734b50c3 bru 2023-12-19 16:24:33 +01:00
Alug 087e58b88b bugger off discord rpc 2023-12-19 16:21:35 +01:00
Alug 78b9d67aaa im not on pentium 4 2023-12-19 16:17:15 +01:00
Alug a6015e4647 Merge remote-tracking branch 'origin/moreopengl' into lugstuff 2023-12-19 16:14:18 +01:00
Alug fcbe95447a Merge remote-tracking branch 'origin/multithreadshit' into lugstuff 2023-12-19 16:13:44 +01:00
Alug 760fe392a8 Merge remote-tracking branch 'origin/thinkercache' into lugstuff 2023-12-19 16:11:54 +01:00
Alug 5dab606980 Merge remote-tracking branch 'origin/Saturn-Next-EnumLib' into lugstuff 2023-12-19 16:11:36 +01:00
indev c265575dfd Fix config 2023-11-16 22:14:18 +03:00
alufolie91 4a1f526ac6 multithread exec command and some filesearch/add stuff
hey it actually improves some things alot
esp the loading addons stage when joining a server
2023-11-16 19:14:48 +01:00
Alug 497b633661 Revert "why did i remove this back then??"
This reverts commit 91ed5c4871.
2023-11-15 09:59:24 +01:00
alufolie91 c7f54a98e0 Merge remote-tracking branch 'origin/Saturn-Next' into moreopengl 2023-11-14 21:16:47 +01:00
alufolie91 7da8c20409 remove that stuff 2023-11-14 21:16:04 +01:00
Alug 116328c7bf attempt at linked list for textures
also changes to caching handling a bit
seems to have helped with stuck colors a bit
2023-11-08 02:50:17 +01:00
Alug bd68fef4a2 Zzzzz... 2023-11-08 00:38:48 +01:00
alufolie91 7759d56ad3 Fix uninitialized reads in PreparePolygon
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1392
2023-11-08 00:17:42 +01:00
Alug 9c7020a369 GRRRRRR not GLLLLLLLL 2023-11-07 18:23:31 +01:00
alufolie91 f8c1903316 change how mipmap caching works
also a bit of texture conversion
idk
2023-11-07 18:19:40 +01:00
alufolie91 652423ad14 Cache and reuse removed mobjs when spawning mobjs
from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2200
2023-11-06 12:27:23 +01:00
155 changed files with 7301 additions and 6531 deletions

No files matched your search

+1
View File
@@ -4,6 +4,7 @@
*.plg
*.suo
*.vcproj.*.*.user
*.kate-swp
Win32_LIB_ASM_Debug
Win32_LIB_ASM_Release
*.bsc
+12
View File
@@ -192,6 +192,18 @@ from `0` to `#musicdefs-1`, or string indices (which is equal to calling `S_Find
Hook is called whenever `S_ShowMusicCredit` (either from game or mod) is called. Takes musicdef as only argument, returning true
will overwrite vanilla behavior (not show music credit), can be used to implement custom music credit pop-ups.
## addHook("SetupVote", function(result, gt, secondgt, prevmap))
Hook is called whenever server sets up options for vote screen. `result` is table where lua can store options to,
(for example, `result[1] = 1` will force green hills as first option), gt is current gametype, secondgt is
alternative gametype picked for 3rd entry (for example, gt can be `GT_RACE`, and secondgt can be `GT_MATCH`)
prevmap is the previous map that was played (small note - in game code, it is offset by -1, but for lua its offset back,
so if previous gamemap was 1, prevmap would also be 1. Which means you can safely do mapheaderinfo[prevmap] to get info on previous map)
Limitations: currently, game can only change gametype for 3rd option in map (meaning for example, if current gametype is race, and you
put battle map in first option, when it gets picked that map will be still run in race gametype). That means, game will only handle maps with
different gametype if it is put in 3rd vote option.
# Other changes
## P_PlayRinglossSound(source, damager)
+18
View File
@@ -30,6 +30,24 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
0-Clause BSD License
applies to:
- qs22k
Copyright (c) 2022, Raymond Gardner
--------------------------------------------------------------------------------
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--------------------------------------------------------------------------------
curl License
applies to:
+20 -7
View File
@@ -49,7 +49,7 @@
# Already enabled by default for 32-bit
# Windows.
# NOCURL=1 - Disable libcurl--HTTP capability.
# NOGME=1 - Disable game music emu, retro VGM support.
# NOLIBGME=1 - Disable game music emu, retro VGM support.
# NOOPENMPT=1 - Disable module (tracker) music support.
# NOMIXER=1 - Disable SDL Mixer (audio playback).
# NOTHREADS=1 - Disable multithreading.
@@ -131,9 +131,19 @@ endif
include Makefile.d/util.mk
ifdef PREFIX
ifdef USECLANG
CC:=$(PREFIX)-clang
CXX:=$(PREFIX)-clang++
else
CC:=$(PREFIX)-gcc
CXX:=$(PREFIX)-g++
endif
endif
ifdef USECLANG
CC=clang
CXX=clang++
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
@@ -161,7 +171,7 @@ sources:=
makedir:=../make
# -DCOMPVERSION: flag to use comptime.h
opts:=-DCOMPVERSION -g
opts:=-DCOMPVERSION -g -fwrapv
libs:=
# This is a list of variables names, of which if defined,
@@ -236,7 +246,7 @@ endif
# build with profiling information
ifdef PROFILEMODE
opts+=-pg
libs+=-pg
LDFLAGS+=-pg
endif
ifdef DEBUGMODE
@@ -248,10 +258,10 @@ ifdef USELTO
# compile with LTO
ifdef MINGW
opts+=-flto=auto -g
libs+=-flto=auto -g
LDFLAGS+=-flto=auto -g
else
opts+=-flto=auto
libs+=-flto=auto
LDFLAGS+=-flto=auto
endif
endif
endif
@@ -265,8 +275,10 @@ else
opts+=-fsanitize=address
libs+=-fsanitize=address
endif
opts+=-fsanitize=address
libs+=-fsanitize=address
endif
ifeq ($(CC),clang)
LDFLAGS+= -fuse-ld=lld
endif
# debug_opts also get passed to windres
@@ -281,6 +293,7 @@ cxxopts:=$(opts) $(CXXFLAGS)
opts+=$(CWFLAGS) # warning flags that shouldnt be passed to c++ compiler
libs+=$(LDFLAGS) -lstdc++ -lpthread
asflags:=$(ASFLAGS) -x assembler-with-cpp
cc=$(CC)
+1 -1
View File
@@ -14,6 +14,6 @@ sources+=dedicated/i_threads.c
endif
NOOPENMPT=1
NOGME=1
NOLIBGME=1
NOHW=1
NOUPNP=1
-7
View File
@@ -73,13 +73,6 @@ libs+=-lbacktrace
opts+=-DHAVE_LIBBACKTRACE
endif
#windoze hack
ifdef MINGW
ifndef NODISCORDRPC
HAVE_DISCORDRPC=1
endif
endif
ifdef HAVE_DISCORDRPC
$(eval $(call Propogate_flags,DISCORDRPC))
libs+=-ldiscord-rpc
+5 -1
View File
@@ -144,9 +144,13 @@ ifdef GCC81
WFLAGS+=-Wno-error=multistatement-macros
endif
ifeq ($(CC),clang)
WFLAGS+= -Wno-unknown-pragmas -Wno-cast-align
endif
ifdef NONX86
ifdef X86_64 # yeah that SEEMS contradictory
opts+=-march=nocona
opts+=-march=x86-64-v2
endif
else
ifndef GCC29
+5
View File
@@ -15,6 +15,7 @@ endif
sources+=win32/Srb2win.rc
opts+=-DSTDC_HEADERS
libs+=-Wl,-Bstatic -lstdc++ -lpthread -lgcc -Wl,-Bdynamic
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
ifndef DEDICATED
@@ -42,6 +43,10 @@ libs+=-Wl,--large-address-aware
NOLIBBACKTRACE=1
endif
ifndef NODISCORDRPC
HAVE_DISCORDRPC=1
endif
ifndef MINGW64
32=32
x86=x86
+3 -3
View File
@@ -46,11 +46,11 @@ tables.c
v_video.c
w_wad.c
y_inter.c
z_zone.c
z_zone.cpp
r_bsp.c
r_data.c
r_draw.c
r_fps.c
r_fps.cpp
r_main.cpp
r_patch.c
r_patchrotation.c
@@ -67,7 +67,7 @@ p_floor.c
p_inter.c
p_lights.c
p_map.c
p_maputl.c
p_maputl.cpp
p_mobj.c
p_polyobj.c
p_saveg.c
+1 -11
View File
@@ -89,7 +89,7 @@ precise_t I_GetPreciseTime(void)
return 0;
}
UINT64 I_GetPrecisePrecision(void)
UINT64 I_GetPrecisePrecision(void)
{
return 1000000;
}
@@ -98,16 +98,6 @@ void I_GetEvent(void){}
void I_OsPolling(void){}
ticcmd_t *I_BaseTiccmd(void)
{
return NULL;
}
ticcmd_t *I_BaseTiccmd2(void)
{
return NULL;
}
void I_Quit(void)
{
LOGD("SRB2Kart quitting!");
-4
View File
@@ -10,12 +10,8 @@
rendermode_t rendermode = render_soft;
boolean highcolor = false;
boolean allow_fullscreen = false;
consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
void I_StartupGraphics(void){}
+13 -2
View File
@@ -18,6 +18,14 @@
#define INT32 int32_t
#endif
#ifndef __cplusplus
#ifndef min // Double-Check with WATTCP-32's cdefs.h
#define min(x, y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef max // Double-Check with WATTCP-32's cdefs.h
#define max(x, y) (((x) > (y)) ? (x) : (y))
#endif
#endif
/*
** ==================================================================
@@ -534,8 +542,11 @@
#endif
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR 12 /* 10 digits, sign, and \0 */
#define lua_str2number(s,p) strtol((s), (p), 10)
#define lua_str2number(s,p) ({ \
long nmr = strtol((s), (p), 10); \
nmr = max(INT32_MIN, min((nmr), INT32_MAX)); \
nmr; \
})
/*
@@ The luai_num* macros define the primitive operations over numbers.
+47 -70
View File
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2024 by Sonic Team Junior.
// Copyright (C) 1999-2025 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -14,72 +14,47 @@
#ifndef __BYTEPTR_H__
#define __BYTEPTR_H__
#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__)
#define DEALIGNED
#endif
#include "endian.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SRB2_BIG_ENDIAN
//
// Little-endian machines
//
#ifdef DEALIGNED
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = (void *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITESINT8(p,b) do { SINT8 *p_tmp = (void *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEINT16(p,b) do { INT16 *p_tmp = (void *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEINT16_2(p,b) do { INT16 *p_tmp = ( INT16 *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) // dumb hack for mumble
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = (void *)p; const UINT16 tv = ( UINT16)(b); memcpy(p, &tv, sizeof( UINT16)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEINT32(p,b) do { INT32 *p_tmp = (void *)p; const INT32 tv = ( INT32)(b); memcpy(p, &tv, sizeof( INT32)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEUINT32(p,b) do { UINT32 *p_tmp = (void *)p; const UINT32 tv = ( UINT32)(b); memcpy(p, &tv, sizeof( UINT32)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITECHAR(p,b) do { char *p_tmp = (void *)p; const char tv = ( char)(b); memcpy(p, &tv, sizeof( char)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEFIXED(p,b) do { fixed_t *p_tmp = (void *)p; const fixed_t tv = (fixed_t)(b); memcpy(p, &tv, sizeof(fixed_t)); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEANGLE(p,b) do { angle_t *p_tmp = (void *)p; const angle_t tv = (angle_t)(b); memcpy(p, &tv, sizeof(angle_t)); p_tmp++; p = (void *)p_tmp; } while (0)
#else
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; *p_tmp = ( UINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; *p_tmp = ( SINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; *p_tmp = ( INT16)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEINT16_2(p,b) do { INT16 *p_tmp = ( INT16 *)p; *p_tmp = ( INT16)(b); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) // dumb hack for mumble
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; *p_tmp = ( UINT16)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; *p_tmp = ( INT32)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEUINT32(p,b) do { UINT32 *p_tmp = ( UINT32 *)p; *p_tmp = ( UINT32)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITECHAR(p,b) do { char *p_tmp = ( char *)p; *p_tmp = ( char)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEFIXED(p,b) do { fixed_t *p_tmp = (fixed_t *)p; *p_tmp = (fixed_t)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#define WRITEANGLE(p,b) do { angle_t *p_tmp = (angle_t *)p; *p_tmp = (angle_t)(b); p_tmp++; p = (void *)p_tmp; } while (0)
#endif
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; const UINT16 tv = ( UINT16)(b); memcpy(p, &tv, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; const INT32 tv = ( INT32)(b); memcpy(p, &tv, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEUINT32(p,b) do { UINT32 *p_tmp = ( UINT32 *)p; const UINT32 tv = ( UINT32)(b); memcpy(p, &tv, sizeof( UINT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITECHAR(p,b) do { char *p_tmp = ( char *)p; const char tv = ( char)(b); memcpy(p, &tv, sizeof( char)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEFIXED(p,b) do { fixed_t *p_tmp = (fixed_t *)p; const fixed_t tv = (fixed_t)(b); memcpy(p, &tv, sizeof(fixed_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEANGLE(p,b) do { angle_t *p_tmp = (angle_t *)p; const angle_t tv = (angle_t)(b); memcpy(p, &tv, sizeof(angle_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#ifdef __GNUC__
#ifdef DEALIGNED
#define READUINT8(p) ({ UINT8 *p_tmp = (void *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; b; })
#define READSINT8(p) ({ SINT8 *p_tmp = (void *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; p = (void *)p_tmp; b; })
#define READINT16(p) ({ INT16 *p_tmp = (void *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; p = (void *)p_tmp; b; })
#define READUINT16(p) ({ UINT16 *p_tmp = (void *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; p = (void *)p_tmp; b; })
#define READINT32(p) ({ INT32 *p_tmp = (void *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; p = (void *)p_tmp; b; })
#define READUINT32(p) ({ UINT32 *p_tmp = (void *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; p = (void *)p_tmp; b; })
#define READCHAR(p) ({ char *p_tmp = (void *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; p = (void *)p_tmp; b; })
#define READFIXED(p) ({ fixed_t *p_tmp = (void *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; p = (void *)p_tmp; b; })
#define READANGLE(p) ({ angle_t *p_tmp = (void *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; p = (void *)p_tmp; b; })
// what is this?
#if defined (__GNUC__)
#define READUINT8(p) ({ UINT8 *p_tmp = (UINT8 *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READSINT8(p) ({ SINT8 *p_tmp = (SINT8 *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READINT16(p) ({ INT16 *p_tmp = (INT16 *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READUINT16(p) ({ UINT16 *p_tmp = (UINT16 *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READINT32(p) ({ INT32 *p_tmp = (INT32 *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READUINT32(p) ({ UINT32 *p_tmp = (UINT32 *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READCHAR(p) ({ char *p_tmp = (char *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#else
#define READUINT8(p) ({ UINT8 *p_tmp = ( UINT8 *)p; UINT8 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READSINT8(p) ({ SINT8 *p_tmp = ( SINT8 *)p; SINT8 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READINT16(p) ({ INT16 *p_tmp = ( INT16 *)p; INT16 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READUINT16(p) ({ UINT16 *p_tmp = ( UINT16 *)p; UINT16 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READINT32(p) ({ INT32 *p_tmp = ( INT32 *)p; INT32 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READUINT32(p) ({ UINT32 *p_tmp = ( UINT32 *)p; UINT32 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#endif
#else
#define READUINT8(p) *(( UINT8 *)p)++
#define READSINT8(p) *(( SINT8 *)p)++
#define READINT16(p) *(( INT16 *)p)++
#define READUINT16(p) *(( UINT16 *)p)++
#define READINT32(p) *(( INT32 *)p)++
#define READUINT32(p) *(( UINT32 *)p)++
#define READCHAR(p) *(( char *)p)++
#define READFIXED(p) *((fixed_t *)p)++
#define READANGLE(p) *((angle_t *)p)++
#define READUINT8(p) ((UINT8*)(*(void**)(&(p)) = (void*)&((UINT8*)(p))[1]))[-1]
#define READSINT8(p) ((SINT8*)(*(void**)(&(p)) = (void*)&((SINT8*)(p))[1]))[-1]
#define READINT16(p) ((INT16*)(*(void**)(&(p)) = (void*)&((INT16*)(p))[1]))[-1]
#define READUINT16(p) ((UINT16*)(*(void**)(&(p)) = (void*)&((UINT16*)(p))[1]))[-1]
#define READINT32(p) ((INT32*)(*(void**)(&(p)) = (void*)&((INT32*)(p))[1]))[-1]
#define READUINT32(p) ((UINT32*)(*(void**)(&(p)) = (void*)&((UINT32*)(p))[1]))[-1]
#define READCHAR(p) ((char*)(*(void**)(&(p)) = (void*)&((char*)(p))[1]))[-1]
#define READFIXED(p) ((fixed_t*)(*(void**)(&(p)) = (void*)&((fixed_t*)(p))[1]))[-1]
#define READANGLE(p) ((angle_t*)(*(void**)(&(p)) = (void*)&((angle_t*)(p))[1]))[-1]
#endif
#else //SRB2_BIG_ENDIAN
@@ -142,19 +117,17 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
return (ucp[3] << 24) | (ucp[2] << 16) | (ucp[1] << 8) | ucp[0];
}
#define READUINT8(p) ({ UINT8 *p_tmp = ( UINT8 *)p; UINT8 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READSINT8(p) ({ SINT8 *p_tmp = ( SINT8 *)p; SINT8 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READINT16(p) ({ INT16 *p_tmp = ( INT16 *)p; INT16 b = readshort(p); p_tmp++; p = (void *)p_tmp; b; })
#define READUINT16(p) ({ UINT16 *p_tmp = ( UINT16 *)p; UINT16 b = readushort(p); p_tmp++; p = (void *)p_tmp; b; })
#define READINT32(p) ({ INT32 *p_tmp = ( INT32 *)p; INT32 b = readlong(p); p_tmp++; p = (void *)p_tmp; b; })
#define READUINT32(p) ({ UINT32 *p_tmp = ( UINT32 *)p; UINT32 b = readulong(p); p_tmp++; p = (void *)p_tmp; b; })
#define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = readlong(p); p_tmp++; p = (void *)p_tmp; b; })
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = readulong(p); p_tmp++; p = (void *)p_tmp; b; })
#define READUINT8(p) ((UINT8*)(p = (void*)&((UINT8*)p)[1]))[-1]
#define READSINT8(p) ((SINT8*)(p = (void*)&((SINT8*)p)[1]))[-1]
#define READINT16(p) readshort(&((INT16*)(p = (void*)&((INT16*)p)[1]))[-1])
#define READUINT16(p) readushort(&((UINT16*)(p = (void*)&((UINT16*)p)[1]))[-1])
#define READINT32(p) readlong(&((INT32*)(p = (void*)&((INT32*)p)[1]))[-1])
#define READUINT32(p) readulong(&((UINT32*)(p = (void*)&((UINT32*)p)[1]))
#define READCHAR(p) ((char*)(p = (void*)&((char*)p)[1]))[-1]
#define READFIXED(p) readlong(&((fixed_t*)(p = (void*)&((fixed_t*)p)[1]))[-1])
#define READANGLE(p) readulong(&((angle_t*)(p = (void*)&((angle_t*)p)[1]))[-1])
#endif //SRB2_BIG_ENDIAN
#undef DEALIGNED
#define WRITESTRINGN(p, s, n) do { \
size_t tmp_i; \
\
@@ -231,4 +204,8 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
p += n; \
} while (0)
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __BYTEPTR_H__
+2 -2
View File
@@ -838,7 +838,7 @@ static void COM_Help_f(void)
{
{
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
{
{
if (floatmode)
{
float fu = FIXED_TO_FLOAT(cvar->PossibleValue[0].value);
@@ -1044,7 +1044,7 @@ static void COM_Add_f(void)
if (( cvar->flags & CV_FLOAT ))
{
float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2));
float n = FIXED_TO_FLOAT(cvar->value) + (float)atof(COM_Argv(2));
CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n)));
}
else
+1 -1
View File
@@ -836,7 +836,7 @@ boolean CON_Responder(event_t *ev)
// check for console toggle key
if (ev->type != ev_console)
{
if (modeattacking || metalrecording)
if (modeattacking)
return false;
if (ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder
+5
View File
@@ -10,6 +10,9 @@
/// \file console.h
/// \brief Console drawing and input
#ifndef __CONSOLE__
#define __CONSOLE__
#include "d_event.h"
#include "command.h"
#include "i_threads.h"
@@ -62,3 +65,5 @@ void CON_ToggleOff(void);
boolean CON_Ready(void);
void CON_LogMessage(const char *msg);
#endif
+89 -1
View File
@@ -10,10 +10,14 @@
#include "memory.h"
#include <array>
#include <new>
#include <cstdint>
#include "../cxxutil.hpp"
#include "../z_zone.h"
#include "../lua_script.h"
using namespace srb2;
namespace
{
@@ -58,6 +62,90 @@ void LinearMemory::reset() noexcept
} // namespace
PoolAllocator::~PoolAllocator()
{
release();
}
constexpr static size_t nearest_multiple(size_t v, size_t divisor)
{
return (v + (divisor - 1)) & ~(divisor - 1);
}
PoolAllocator::ChunkFooter* PoolAllocator::allocate_chunk()
{
uint8_t* chunk = (uint8_t*)Z_Malloc(nearest_multiple(blocks_ * block_size_, alignof(ChunkFooter)) + sizeof(ChunkFooter), tag_, nullptr);
ChunkFooter* footer = (ChunkFooter*)(chunk + (blocks_ * block_size_));
footer->next = nullptr;
footer->start = (void*)chunk;
for (size_t i = 0; i < blocks_; i++)
{
FreeBlock* cur = (FreeBlock*)(chunk + (i * block_size_));
FreeBlock* next = (FreeBlock*)(chunk + ((i + 1) * block_size_));
cur->next = next;
}
((FreeBlock*)(chunk + ((blocks_ - 1) * block_size_)))->next = nullptr;
return footer;
}
void* PoolAllocator::allocate()
{
if (first_chunk_ == nullptr)
{
SRB2_ASSERT(head_ == nullptr);
// No chunks allocated yet
first_chunk_ = allocate_chunk();
head_ = (FreeBlock*)first_chunk_->start;
}
if (head_->next == nullptr)
{
// Current chunk will be full; allocate another at the end of the list
ChunkFooter* last_chunk = first_chunk_;
while (last_chunk->next != nullptr)
{
last_chunk = last_chunk->next;
}
ChunkFooter* new_chunk = allocate_chunk();
last_chunk->next = new_chunk;
head_->next = (FreeBlock*)new_chunk->start;
}
FreeBlock* ret = head_;
head_ = head_->next;
return ret;
}
void PoolAllocator::deallocate(void* p)
{
// Required in case this block is reused
LUA_InvalidateUserdata(p);
FreeBlock* block = reinterpret_cast<FreeBlock*>(p);
block->next = head_;
head_ = block;
}
void PoolAllocator::release()
{
ChunkFooter* next = nullptr;
for (ChunkFooter* i = first_chunk_; i != nullptr; i = next)
{
uint8_t *chunk = (uint8_t*)i->start;
for (size_t j = 0; j < blocks_; j++)
{
// Invalidate all blocks that possibly weren't passed to deallocate
LUA_InvalidateUserdata(chunk + (j * block_size_));
}
next = i->next;
Z_Free(i->start);
}
first_chunk_ = nullptr;
head_ = nullptr;
}
static LinearMemory g_frame_memory {4 * 1024 * 1024};
void* Z_Frame_Alloc(size_t size)
+52
View File
@@ -14,6 +14,58 @@
#include <stddef.h>
#ifdef __cplusplus
#include <cstdint>
namespace srb2
{
/// Pool allocator; manages bulk allocations of same-size block. If the pool is full,
/// allocations will fail by returning nullptr.
class PoolAllocator final
{
struct FreeBlock
{
FreeBlock* next;
};
struct ChunkFooter
{
ChunkFooter* next;
void* start;
};
ChunkFooter* first_chunk_;
FreeBlock* head_;
size_t block_size_;
size_t blocks_;
int32_t tag_;
ChunkFooter* allocate_chunk();
public:
constexpr PoolAllocator(size_t block_size, size_t blocks, int32_t tag)
: first_chunk_(nullptr)
, head_(nullptr)
, block_size_(block_size)
, blocks_(blocks)
, tag_(tag)
{}
PoolAllocator(const PoolAllocator&) = delete;
PoolAllocator(PoolAllocator&&) noexcept = default;
~PoolAllocator();
PoolAllocator& operator=(const PoolAllocator&) = delete;
PoolAllocator& operator=(PoolAllocator&&) noexcept = default;
void* allocate();
void deallocate(void* p);
constexpr size_t block_size() const noexcept { return block_size_; };
void release();
};
} // namespace srb2
extern "C" {
#endif // __cpluspplus
+1 -1
View File
@@ -61,7 +61,7 @@ struct SourceLocation {
class IErrorAssertHandler {
public:
static void handle(const SourceLocation& source_location, const char* expression) {
[[ noreturn ]] static void handle(const SourceLocation& source_location, const char* expression) {
I_Error("Assertion failed at %s:%u: %s != true",
source_location.file_name,
source_location.line_number,
+413 -188
View File
@@ -16,6 +16,8 @@
#include <unistd.h> //for unlink
#endif
#include <zlib.h>
#include "i_time.h"
#include "i_net.h"
#include "i_system.h"
@@ -87,6 +89,17 @@ boolean serverrunning = false;
INT32 serverplayer = 0;
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
#define MAP_ICON_REQUEST_FREQUENCY 8
static UINT8 map_icon_index; // amount of fragments we have retrieved
static UINT8 map_icon_needed; // amount of fragments we need to get the full data set
static INT32 map_icon_read; // amount of bytes we have read
static UINT32 map_icon_missing; // bitmask of fragments we haven't received yet
static tic_t map_icon_last_request; // last time we sent an icon request, to avoid flood
static int map_icon_request_count; // current count of icon requests sent
static UINT8 *map_icon_data;
static patch_t *map_icon;
plrinfo playerinfo[MAXPLAYERS];
SINT8 joinnode = 0; // used for CL_VIEWSERVER
@@ -198,17 +211,10 @@ tic_t firstconnectattempttime = 0;
// Must be a power of two
#define TEXTCMD_HASH_SIZE 4
typedef struct textcmdplayer_s
{
INT32 playernum;
UINT8 cmd[MAXTEXTCMD];
struct textcmdplayer_s *next;
} textcmdplayer_t;
typedef struct textcmdtic_s
{
tic_t tic;
textcmdplayer_t *playercmds[TEXTCMD_HASH_SIZE];
UINT8 *playercmds[MAXPLAYERS];
struct textcmdtic_s *next;
} textcmdtic_t;
@@ -259,27 +265,21 @@ static inline boolean UseVanillaSynch(INT32 node)
static inline void *G_DcpyTiccmd(void* dest, const ticcmd_t* src, const size_t n)
{
const size_t d = n / sizeof(ticcmd_t);
const size_t r = n % sizeof(ticcmd_t);
UINT8 *ret = dest;
if (r)
M_Memcpy(dest, src, n);
else if (d)
G_MoveTiccmd(dest, src, d);
if (n)
G_MoveTiccmd(dest, src, n/sizeof(ticcmd_t));
return ret+n;
}
static inline void *G_ScpyTiccmd(ticcmd_t* dest, void* src, const size_t n)
{
const size_t d = n / sizeof(ticcmd_t);
const size_t r = n % sizeof(ticcmd_t);
UINT8 *ret = src;
if (r)
M_Memcpy(dest, src, n);
else if (d)
G_MoveTiccmd(dest, src, d);
if (n)
G_MoveTiccmd(dest, src, n/sizeof(ticcmd_t));
return ret+n;
}
@@ -400,22 +400,13 @@ static void D_FreeTextcmd(tic_t tic)
if (textcmdtic)
{
INT32 i;
// Remove this tic from the list.
*tctprev = textcmdtic->next;
// Free all players.
for (i = 0; i < TEXTCMD_HASH_SIZE; i++)
for (INT32 i = 0; i < MAXPLAYERS; i++)
{
textcmdplayer_t *textcmdplayer = textcmdtic->playercmds[i];
while (textcmdplayer)
{
textcmdplayer_t *tcpnext = textcmdplayer->next;
Z_Free(textcmdplayer);
textcmdplayer = tcpnext;
}
Z_Free(textcmdtic->playercmds[i]);
}
// Free this tic's own memory.
@@ -432,10 +423,8 @@ static UINT8* D_GetExistingTextcmd(tic_t tic, INT32 playernum)
// Do we have an entry for the tic? If so, look for player.
if (textcmdtic)
{
textcmdplayer_t *textcmdplayer = textcmdtic->playercmds[playernum & (TEXTCMD_HASH_SIZE - 1)];
while (textcmdplayer && textcmdplayer->playernum != playernum) textcmdplayer = textcmdplayer->next;
if (textcmdplayer) return textcmdplayer->cmd;
UINT8 *cmd = textcmdtic->playercmds[playernum];
if (cmd) return cmd;
}
return NULL;
@@ -446,7 +435,6 @@ static UINT8* D_GetTextcmd(tic_t tic, INT32 playernum)
{
textcmdtic_t *textcmdtic = textcmds[tic & (TEXTCMD_HASH_SIZE - 1)];
textcmdtic_t **tctprev = &textcmds[tic & (TEXTCMD_HASH_SIZE - 1)];
textcmdplayer_t *textcmdplayer, **tcpprev;
// Look for the tic.
while (textcmdtic && textcmdtic->tic != tic)
@@ -462,24 +450,11 @@ static UINT8* D_GetTextcmd(tic_t tic, INT32 playernum)
textcmdtic->tic = tic;
}
tcpprev = &textcmdtic->playercmds[playernum & (TEXTCMD_HASH_SIZE - 1)];
textcmdplayer = *tcpprev;
// Look for the player.
while (textcmdplayer && textcmdplayer->playernum != playernum)
{
tcpprev = &textcmdplayer->next;
textcmdplayer = textcmdplayer->next;
}
// If we don't have an entry for the player, make it.
if (!textcmdplayer)
{
textcmdplayer = *tcpprev = Z_Calloc(sizeof (textcmdplayer_t), PU_STATIC, NULL);
textcmdplayer->playernum = playernum;
}
if (!textcmdtic->playercmds[playernum])
textcmdtic->playercmds[playernum] = Z_Calloc(MAXTEXTCMD, PU_STATIC, NULL);
return textcmdplayer->cmd;
return textcmdtic->playercmds[playernum];
}
static void ExtraDataTicker(void)
@@ -1211,6 +1186,10 @@ static inline void CL_DrawConnectionStatus(void)
if (!menuactive) // menu already draws its own fade
V_DrawFadeScreen(0xFF00, 16); // force default
// reset the counter for mapicon
if (cl_mode != CL_VIEWSERVER)
map_icon_request_count = 0;
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES && cl_mode != CL_VIEWSERVER
#ifdef HAVE_CURL
&& cl_mode != CL_DOWNLOADHTTPFILES
@@ -1337,11 +1316,48 @@ static inline void CL_DrawConnectionStatus(void)
V_DrawThinString(12 + 80, 18, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.servername));
const char *map = va("%sP", serverlist[joinnode].info.mapname);
patch_t *current_map = W_LumpExists(map) ? W_CachePatchName(map, PU_CACHE) : W_CachePatchName("BLANKLVL", PU_CACHE);
V_DrawSmallScaledPatch(10, 18, 0, current_map);
if (map_icon == NULL)
{
const char *map = va("%sP", serverlist[joinnode].info.mapname);
patch_t *current_map = W_LumpExists(map) ? W_CachePatchName(map, PU_CACHE) : NULL;
// check first if we may have the map icon loaded already
if (current_map != NULL)
V_DrawSmallScaledPatch(10, 18, 0, current_map);
else if (map_icon_data != NULL && map_icon_request_count <= 5)
{
if (I_GetTime() - map_icon_last_request > MAP_ICON_REQUEST_FREQUENCY)
{
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
netbuffer->packettype = PT_NEEDMAPICON;
// failed to retrieve map icon, request it again
HSendPacket(servernode, false, 0, 0);
map_icon_last_request = I_GetTime();
map_icon_request_count++;
}
V_DrawFill(10, 18, MAP_ICON_WIDTH / 2, MAP_ICON_HEIGHT / 2, 31);
char dots[4] = "...";
if ((I_GetTime() & 0xf) < 4)
dots[0] = '\0';
else if ((I_GetTime() & 0xf) < 8)
dots[1] = '\0';
else if ((I_GetTime() & 0xf) < 12)
dots[2] = '\0';
V_DrawString(10 + MAP_ICON_WIDTH / 4 - V_StringWidth("...", 0) / 2, 18 + MAP_ICON_HEIGHT / 4 - 3, 0, dots);
}
else
V_DrawSmallScaledPatch(10, 18, 0, W_CachePatchName("BLANKLVL", PU_CACHE));
}
else
V_DrawSmallScaledPatch(10, 18, 0, map_icon);
if (serverlist[joinnode].info.iszone)
V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s Zone", serverlist[joinnode].info.maptitle));
else
V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.maptitle));
V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.maptitle));
V_DrawThinString(12 + 80, 48, V_ALLOWLOWERCASE, va("%s", Gametype_Names[serverlist[joinnode].info.gametype]));
if (fileneedednum > 0)
@@ -1535,12 +1551,12 @@ static boolean CL_SendJoin(void)
netbuffer->u.clientcfg.version = VERSION;
netbuffer->u.clientcfg.subversion = SUBVERSION;
strncpy(netbuffer->u.clientcfg.application, SRB2APPLICATION,
sizeof netbuffer->u.clientcfg.application);
sizeof(netbuffer->u.clientcfg.application));
#ifdef SATURNJOIN
netbuffer->u.clientcfg.issaturn = ISSATURN;
#endif
return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak));
return HSendPacket(servernode, false, 0, sizeof(clientconfig_pak));
}
static void SV_SendServerInfo(INT32 node, tic_t servertime)
@@ -1581,59 +1597,38 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
CopyCaretColors(netbuffer->u.serverinfo.servername, cv_servername.string,
MAXSERVERNAME);
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), 7);
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), sizeof(netbuffer->u.serverinfo.mapname)-1);
M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16);
M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, sizeof(netbuffer->u.serverinfo.mapmd5));
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) && !(mapheaderinfo[prevmap]->zonttl[0]))
netbuffer->u.serverinfo.iszone = 1;
else
netbuffer->u.serverinfo.iszone = 0;
netbuffer->u.serverinfo.iszone = 0;
memset(netbuffer->u.serverinfo.maptitle, 0, 33);
memset(netbuffer->u.serverinfo.maptitle, 0, sizeof(netbuffer->u.serverinfo.maptitle));
memset(netbuffer->u.serverinfo.httpsource, 0, MAX_MIRROR_LENGTH);
if (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && mapheaderinfo[gamemap-1]->lvlttl[0])
{
//strncpy(netbuffer->u.serverinfo.maptitle, (char *)mapheaderinfo[gamemap-1]->lvlttl, 33);
// set up the levelstring
if (netbuffer->u.serverinfo.iszone || (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
strncpy(netbuffer->u.serverinfo.maptitle, mapheaderinfo[gamemap-1]->lvlttl, sizeof(netbuffer->u.serverinfo.maptitle)-1);
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
{
if (mapheaderinfo[gamemap-1]->actnum[0])
snprintf(netbuffer->u.serverinfo.maptitle,
33,
"%s %s",
mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum);
if (mapheaderinfo[gamemap-1]->zonttl[0])
{
strncat(netbuffer->u.serverinfo.maptitle, " ", sizeof(netbuffer->u.serverinfo.maptitle)-1);
strncat(netbuffer->u.serverinfo.maptitle, mapheaderinfo[gamemap-1]->zonttl,
sizeof(netbuffer->u.serverinfo.maptitle)-1);
}
else
snprintf(netbuffer->u.serverinfo.maptitle,
33,
"%s",
mapheaderinfo[gamemap-1]->lvlttl);
{
netbuffer->u.serverinfo.iszone = 1; // ms and clients will append this themselves
}
}
else
if (mapheaderinfo[gamemap-1]->actnum[0])
{
if (mapheaderinfo[gamemap-1]->actnum[0])
{
if (snprintf(netbuffer->u.serverinfo.maptitle,
33,
"%s %s %s",
mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum) < 0)
{
// If there's an encoding error, send UNKNOWN, we accept that the above may be truncated
strncpy(netbuffer->u.serverinfo.maptitle, "Unknown", 33);
}
}
else
{
if (snprintf(netbuffer->u.serverinfo.maptitle,
33,
"%s %s",
mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl) < 0)
{
// If there's an encoding error, send UNKNOWN, we accept that the above may be truncated
strncpy(netbuffer->u.serverinfo.maptitle, "Unknown", 33);
}
}
strncat(netbuffer->u.serverinfo.maptitle, " ", sizeof(netbuffer->u.serverinfo.maptitle)-1);
strncat(netbuffer->u.serverinfo.maptitle, mapheaderinfo[gamemap-1]->actnum,
sizeof(netbuffer->u.serverinfo.maptitle)-1);
}
}
else
@@ -1722,6 +1717,83 @@ static void SV_SendPlayerInfo(INT32 node)
HSendPacket(node, false, 0, sizeof(plrinfo) * MSCOMPAT_MAXPLAYERS);
}
static void SV_SendMapIcon(INT32 node)
{
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
const char *map = va("%sP", G_BuildMapName(gamemap));
if (!W_LumpExists(map) || (mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU))
{
// send an empty icon to tell the client there is no map icon
netbuffer->packettype = PT_MAPICON;
UINT8 *icondata = netbuffer->u.mapicondata;
WRITEUINT8(icondata, 0x80);
HSendPacket(node, false, 0, 1);
return;
}
patch_t *current_map = W_CachePatchName(map, PU_CACHE);
if (current_map->width != MAP_ICON_WIDTH || current_map->height != MAP_ICON_HEIGHT)
{
// we only support 160x100 for now
netbuffer->packettype = PT_MAPICON;
UINT8 *icondata = netbuffer->u.mapicondata;
WRITEUINT8(icondata, 0x80);
HSendPacket(node, false, 0, 1);
return;
}
UINT8 *data = Z_Malloc(2 * current_map->width * current_map->height, PU_STATIC, NULL);
UINT8 *pixeldata = data + current_map->width * current_map->height;
R_PatchToPixels(current_map, pixeldata);
z_stream stream;
stream.zalloc = NULL;
stream.zfree = NULL;
stream.opaque = NULL;
if (deflateInit(&stream, Z_DEFAULT_COMPRESSION) != Z_OK)
{
CONS_Alert(CONS_WARNING, "Cannot compress map icon, not enough memory\n");
Z_Free(data);
return;
}
stream.next_in = pixeldata;
stream.avail_in = current_map->width * current_map->height;
stream.next_out = data;
stream.avail_out = current_map->width * current_map->height;
if (deflate(&stream, Z_FINISH) != Z_STREAM_END)
{
CONS_Alert(CONS_WARNING, "Cannot compress map icon, error occured during compression\n");
deflateEnd(&stream);
Z_Free(data);
return;
}
size_t count = stream.total_out;
deflateEnd(&stream);
size_t index = 0;
for (size_t i = 0; i < count; i += MAXPACKETLENGTH-BASEPACKETSIZE-1)
{
size_t size = min(MAXPACKETLENGTH-BASEPACKETSIZE-1, count-i);
UINT8 *icondata = netbuffer->u.mapicondata;
netbuffer->packettype = PT_MAPICON;
if (count-i <= MAXPACKETLENGTH-BASEPACKETSIZE-1)
WRITEUINT8(icondata, 0x80 | index);
else
WRITEUINT8(icondata, index);
index++;
WRITEMEM(icondata, &data[i], size);
HSendPacket(node, false, 0, size + 1);
}
Z_Free(data);
}
/** Sends a PT_SERVERCFG packet
*
* \param node The destination
@@ -2704,9 +2776,26 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
if (cl_mode == CL_VIEWSERVER)
{
if (key == KEY_ENTER || key == KEY_JOY1)
{
cl_mode = CL_CHECKFILES;
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
}
else if (key == KEY_ESCAPE || key == KEY_JOY1+1)
{
cl_mode = CL_ABORTED;
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
map_icon_request_count = 0;
}
}
// Only ESC and non-keyboard keys abort connection
@@ -2822,6 +2911,17 @@ static void CL_ConnectToServer(void)
serverlist[i].info.version, serverlist[i].info.subversion);
}
SL_ClearServerList(servernode);
if (map_icon_data != NULL)
Z_Free(map_icon_data);
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon_data = Z_Malloc(MAP_ICON_WIDTH * MAP_ICON_HEIGHT, PU_CACHE, NULL);
map_icon_index = 0;
map_icon_needed = 0xff;
map_icon_read = 0;
map_icon_missing = 0xffffffff;
map_icon_last_request = I_GetTime();
#endif
do
@@ -3351,10 +3451,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
void CL_Reset(void)
{
if (metalrecording)
G_StopMetalRecording();
if (metalplayback)
G_StopMetalDemo();
if (demo.recording)
G_CheckDemoStatus();
@@ -4111,8 +4207,8 @@ consvar_t cv_resynchcooldown = {"gamestatecooldown", "5", CV_SAVE, resynchcooldo
consvar_t cv_blamecfail = {"blamecfail", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
// max file size to send to a player (in kilobytes)
static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {51200, "MAX"}, {0, NULL}};
consvar_t cv_maxsend = {"maxsend", "MAX", CV_SAVE, maxsend_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t maxsend_cons_t[] = {{-1, "MIN"}, {999999999, "MAX"}, {0, NULL}};
consvar_t cv_maxsend = {"maxsend", "204800", CV_SAVE, maxsend_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_noticedownload = {"noticedownload", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// Speed of file downloading (in packets per tic)
@@ -4428,6 +4524,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
displayplayers[i] = newplayernum;
DEBFILE("spawning me\n");
}
D_SendPlayerConfig();
addedtogame = true;
}
@@ -4599,8 +4696,6 @@ boolean SV_SpawnServer(void)
{
if (demo.playback)
G_StopDemo(); // reset engine parameter
if (metalplayback)
G_StopMetalDemo();
if (!serverrunning)
{
@@ -4706,6 +4801,10 @@ static void HandleConnect(SINT8 node)
if (playernode[i] != UINT8_MAX) // We use this to count players because it is affected by SV_AddWaitingPlayers when more than one client joins on the same tic, unlike playeringame and D_NumPlayers. UINT8_MAX denotes no node for that player
connectedplayers++;
#ifdef SATURNJOIN
const boolean issaturn = (((doomcom->datalength) == sizeof(clientconfig_pak)) && netbuffer->u.clientcfg.issaturn == ISSATURN); // Check the packet lenght to skip potential garbo data!
#endif
if (bannednode && bannednode[node].banid != SIZE_MAX)
{
const char *reason = NULL;
@@ -4759,7 +4858,7 @@ static void HandleConnect(SINT8 node)
SV_SendRefuse(node, va(M_GetText("Different SRB2Kart versions cannot\nplay a netgame!\n(server version %d.%d)"), VERSION, SUBVERSION));
}
#ifdef SATURNJOIN
else if ((!cv_allownewplayer.value && node && netbuffer->u.clientcfg.issaturn != ISSATURN) || (!cv_allownewsaturnplayer.value && node && netbuffer->u.clientcfg.issaturn == ISSATURN))
else if (((!cv_allownewplayer.value && !issaturn) || (!cv_allownewsaturnplayer.value && issaturn)) && node)
#else
else if (!cv_allownewplayer.value && node)
#endif
@@ -4787,16 +4886,15 @@ static void HandleConnect(SINT8 node)
#ifndef NONET
boolean newnode = false;
#endif
// client authorised to join
nodewaiting[node] = (UINT8)(netbuffer->u.clientcfg.localplayers - playerpernode[node]);
if (!nodeingame[node])
{
gamestate_t backupstate = gamestate;
#ifndef NONET
newnode = true;
#endif
SV_AddNode(node);
/// \note Wait what???
@@ -4818,12 +4916,14 @@ static void HandleConnect(SINT8 node)
/// \todo fix this !!!
return; // restart the while
}
SV_SendServerInfo(node, 0); // Dunno if 0 time is good idea
//if (gamestate != GS_LEVEL) // GS_INTERMISSION, etc?
// SV_SendPlayerConfigs(node); // send bare minimum player info
G_SetGamestate(backupstate);
DEBFILE("new node joined\n");
}
#ifdef JOININGAME
if (nodewaiting[node])
{
@@ -4832,6 +4932,7 @@ static void HandleConnect(SINT8 node)
SV_SendSaveGame(node, false); // send a complete game state
DEBFILE("send savegame\n");
}
SV_AddWaitingPlayers();
}
#else
@@ -4871,17 +4972,6 @@ static void HandleTimeout(SINT8 node)
M_StartMessage(M_GetText("Server Timeout\n\nPress Esc\n"), NULL, MM_NOTHING);
}
// Helper function for packets that should only be sent by the server
// If it is NOT from the server, bail out and close the connection!
static boolean ServerOnly(SINT8 node)
{
if (node == servernode)
return false;
Net_CloseConnection(node);
return true;
}
#ifndef NONET
/** Called when a PT_SERVERINFO packet is received
*
@@ -4921,6 +5011,115 @@ static void HandlePlayerInfo(void)
playerinfo[i] = netbuffer->u.playerinfo[i];
}
// Helper function for packets that should only be sent by the server
// If it is NOT from the server, bail out and close the connection!
static boolean ServerOnly(SINT8 node)
{
if (node == servernode)
return false;
Net_CloseConnection(node);
return true;
}
static void PT_MapIcon(void)
{
if (map_icon_data == NULL)
return;
if (ServerOnly(doomcom->remotenode))
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
UINT8 *icondata = netbuffer->u.mapicondata;
map_icon_last_request = I_GetTime();
map_icon_request_count = 0;
UINT8 index = READUINT8(icondata);
if (index & 0x80)
map_icon_needed = (index & 0x7f) + 1;
index &= 0x7f;
// check if we already got this fragment
if (map_icon_missing & ((UINT32)1 << index))
{
map_icon_missing &= ~((UINT32)1 << index);
INT32 offset = index * (MAXPACKETLENGTH-BASEPACKETSIZE-1);
if (offset + doomcom->datalength-1 > MAP_ICON_WIDTH * MAP_ICON_HEIGHT)
{
CONS_Alert(CONS_WARNING, "Excess amount of data for map icon (expected %d, got %d)\n", MAP_ICON_WIDTH * MAP_ICON_HEIGHT, offset + doomcom->datalength-1);
Z_Free(map_icon_data);
map_icon_data = NULL;
return;
}
READMEM(icondata, &map_icon_data[offset], doomcom->datalength-1);
map_icon_read += doomcom->datalength-1;
map_icon_index++;
}
if (map_icon_index >= map_icon_needed)
{
if (map_icon_read == 0)
{
// map has no icon
Z_Free(map_icon_data);
map_icon_data = NULL;
return;
}
UINT8 *data = Z_Malloc(MAP_ICON_WIDTH * MAP_ICON_HEIGHT, PU_STATIC, NULL);
z_stream stream;
stream.zalloc = NULL;
stream.zfree = NULL;
stream.opaque = NULL;
stream.next_in = map_icon_data;
stream.avail_in = map_icon_read;
if (inflateInit(&stream) != Z_OK)
{
CONS_Alert(CONS_WARNING, "Cannot decompress map icon, not enough memory\n");
Z_Free(data);
Z_Free(map_icon_data);
map_icon_data = NULL;
return;
}
stream.next_out = data;
stream.avail_out = MAP_ICON_WIDTH * MAP_ICON_HEIGHT;
if (inflate(&stream, Z_FINISH) != Z_STREAM_END)
{
CONS_Alert(CONS_WARNING, "Failed to decompress map icon, map icon is invalid or corrupted\n");
deflateEnd(&stream);
Z_Free(data);
Z_Free(map_icon_data);
map_icon_data = NULL;
return;
}
inflateEnd(&stream);
Z_Free(map_icon_data);
map_icon_data = NULL;
if (stream.total_out > MAP_ICON_WIDTH * MAP_ICON_HEIGHT)
{
CONS_Alert(CONS_WARNING, "Excess amount of data for map icon (expected %d, got %ld)\n", MAP_ICON_WIDTH * MAP_ICON_HEIGHT, stream.total_out);
Z_Free(data);
return;
}
else if (stream.total_out < MAP_ICON_WIDTH * MAP_ICON_HEIGHT)
{
CONS_Alert(CONS_WARNING, "Insufficient amount of data for map icon (expected %d, got %ld)\n", MAP_ICON_WIDTH * MAP_ICON_HEIGHT, stream.total_out);
Z_Free(data);
return;
}
//map_icon = Patch_CreateFromData(MAP_ICON_WIDTH, MAP_ICON_HEIGHT, data);
map_icon = (patch_t *)R_PixelsToPatch(data, MAP_ICON_WIDTH, MAP_ICON_HEIGHT, 0, 0, NULL);
Z_Free(data);
}
}
static void PT_TellFilesNeeded(SINT8 node)
{
if (server && serverrunning)
@@ -4969,11 +5168,18 @@ static void PT_AskInfo(SINT8 node)
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
SV_SendServerInfo(node, (tic_t)LONG(netbuffer->u.askinfo.time));
SV_SendPlayerInfo(node); // Send extra info
//SV_SendMapIcon(node); // idk i dont think we need this here
}
Net_CloseConnection(node);
}
static void PT_NeedMapIcon(SINT8 node)
{
SV_SendMapIcon(node);
Net_CloseConnection(node);
}
// Negative response of client join request
static void PT_ServerRefuse(SINT8 node)
{
@@ -5234,6 +5440,12 @@ static void HandlePacketFromAwayNode(SINT8 node)
case PT_PLAYERINFO:
HandlePlayerInfo();
break;
case PT_MAPICON:
PT_MapIcon();
break;
case PT_NEEDMAPICON:
PT_NeedMapIcon(node);
break;
case PT_SERVERTICS:
// Do not remove my own server (we have just get a out of order packet)
if (node == servernode)
@@ -5522,10 +5734,10 @@ static void PT_TextCmd(INT32 netconsole, SINT8 node)
// ignore if the textcmd size var is actually larger than it should be
// BASEPACKETSIZE + 1 (for size) + textcmd[0] should == datalength
if (netbuffer->u.textcmd[0] > (size_t)doomcom->datalength-BASEPACKETSIZE-1)
if (netbuffer->u.textcmd[0] > (size_t)doomcom->datalength-1)
{
DEBFILE(va("GetPacket: Bad Textcmd packet size! (expected %d, actual %s, node %u, player %d)\n",
netbuffer->u.textcmd[0], sizeu1((size_t)doomcom->datalength-BASEPACKETSIZE-1),
netbuffer->u.textcmd[0], sizeu1((size_t)doomcom->datalength-1),
node, netconsole));
Net_UnAcknowledgePacket(node);
return;
@@ -5566,7 +5778,6 @@ static void PT_TextCmd(INT32 netconsole, SINT8 node)
static void PT_ClientQuit(INT32 netconsole, SINT8 node)
{
if (client)
return;
@@ -5620,29 +5831,28 @@ static void PT_Resynched(SINT8 node)
static void PT_ServerTics(SINT8 node)
{
tic_t realend, realstart;
UINT8 *pak, *txtpak = NULL, numtxtpak;
// Only accept PT_SERVERTICS from the server.
if (!FromServer(node, "PT_SERVERTICS"))
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
servertics_pak *packet = &netbuffer->u.serverpak;
realstart = ExpandTics(netbuffer->u.serverpak.starttic, maketic);
realend = realstart + netbuffer->u.serverpak.numtics;
if (!txtpak)
txtpak = (UINT8 *)&netbuffer->u.serverpak.cmds[netbuffer->u.serverpak.numslots
* netbuffer->u.serverpak.numtics];
realstart = ExpandTics(packet->starttic, maketic);
realend = realstart + packet->numtics;
if (realend > gametic + CLIENTBACKUPTICS)
realend = gametic + CLIENTBACKUPTICS;
cl_packetmissed = realstart > neededtic;
UINT8 *pak = (UINT8 *)&packet->cmds;
UINT8 *txtpak = (UINT8 *)&packet->cmds[packet->numslots * packet->numtics];
if (realstart <= neededtic && realend > neededtic)
{
tic_t i, j;
pak = (UINT8 *)&netbuffer->u.serverpak.cmds;
pak = (UINT8 *)&packet->cmds;
for (i = realstart; i < realend; i++)
{
@@ -5651,10 +5861,10 @@ static void PT_ServerTics(SINT8 node)
// copy the tics
pak = G_ScpyTiccmd(netcmds[i%BACKUPTICS], pak,
netbuffer->u.serverpak.numslots*sizeof (ticcmd_t));
packet->numslots*sizeof (ticcmd_t));
// copy the textcmds
numtxtpak = *txtpak++;
UINT8 numtxtpak = *txtpak++;
for (j = 0; j < numtxtpak; j++)
{
@@ -5678,11 +5888,6 @@ static void PT_ServerTics(SINT8 node)
else
{
DEBFILE(va("frame not in bound: %u (bounds are from %u to %u)\n", neededtic, realstart, realend));
/*if (realend < neededtic - 2 * TICRATE || neededtic + 2 * TICRATE < realstart)
* I_Error("Received an out of order PT_SERVERTICS packet!\n"
* "Got tics %d-%d, needed tic %d\n\n"
* "Please report this crash on the Master Board,\n"
* "IRC or Discord so it can be fixed.\n", (INT32)realstart, (INT32)realend, (INT32)neededtic);*/
}
}
@@ -6802,6 +7007,69 @@ void NetKeepAlive(void)
// If a tree falls in the forest but nobody is around to hear it, does it make a tic?
#define DEDICATEDIDLETIME (10*TICRATE)
#ifdef DEDICATEDIDLETIME
static void DedicatedIdleUpdate(INT32 *realtics)
{
INT32 i;
static tic_t dedicatedidle = 0;
if (!server || !dedicated || gamestate != GS_LEVEL)
return;
boolean empty = true;
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i])
{
empty = false;
break;
}
if (empty)
{
if (leveltime == 2)
{
// On next tick...
dedicatedidle = DEDICATEDIDLETIME - 1;
}
else if (dedicatedidle >= DEDICATEDIDLETIME)
{
if (D_GetExistingTextcmd(gametic, 0) || D_GetExistingTextcmd(gametic + 1, 0))
{
CONS_Printf("DEDICATED: Awakening from idle (Netxcmd detected...)\n");
dedicatedidle = 0;
}
else
{
(*realtics) = 0;
}
}
else
{
dedicatedidle += (*realtics);
if (dedicatedidle >= DEDICATEDIDLETIME)
{
const char *idlereason = "at round start";
if (leveltime > 3)
idlereason = va("for %d seconds", dedicatedidle / TICRATE);
CONS_Printf("DEDICATED: No players %s, idling...\n", idlereason);
(*realtics) = 0;
dedicatedidle = DEDICATEDIDLETIME;
}
}
}
else
{
if (dedicatedidle >= DEDICATEDIDLETIME)
{
CONS_Printf("DEDICATED: Awakening from idle (Player detected...)\n");
}
dedicatedidle = 0;
}
}
#endif
void NetUpdate(void)
{
static tic_t resptime = 0;
@@ -6815,54 +7083,6 @@ void NetUpdate(void)
if (realtics <= 0) // nothing new to update
return;
#ifdef DEDICATEDIDLETIME
if (server && dedicated && gamestate == GS_LEVEL)
{
static tic_t dedicatedidle = 0;
for (i = 1; i < MAXNETNODES; ++i)
if (nodeingame[i])
{
if (dedicatedidle == DEDICATEDIDLETIME)
{
CONS_Printf("DEDICATED: Awakening from idle (Node %d detected...)\n", i);
dedicatedidle = 0;
}
break;
}
if (i == MAXNETNODES)
{
if (leveltime == 2)
{
// On next tick...
dedicatedidle = DEDICATEDIDLETIME-1;
}
else if (dedicatedidle == DEDICATEDIDLETIME)
{
if (D_GetExistingTextcmd(gametic, 0) || D_GetExistingTextcmd(gametic+1, 0))
{
CONS_Printf("DEDICATED: Awakening from idle (Netxcmd detected...)\n");
dedicatedidle = 0;
}
else
{
realtics = 0;
}
}
else if (++dedicatedidle == DEDICATEDIDLETIME)
{
const char *idlereason = "at round start";
if (leveltime > 3)
idlereason = va("for %d seconds", dedicatedidle/TICRATE);
CONS_Printf("DEDICATED: No nodes %s, idling...\n", idlereason);
realtics = 0;
}
}
}
#endif
if (realtics > 5)
{
if (server)
@@ -6871,6 +7091,10 @@ void NetUpdate(void)
realtics = 5;
}
#ifdef DEDICATEDIDLETIME
DedicatedIdleUpdate(&realtics);
#endif
gametime = nowtime;
UpdatePingTable();
@@ -6982,6 +7206,7 @@ void NetUpdate(void)
#endif
CON_Ticker();
}
SV_FileSendTicker();
}
+3 -1
View File
@@ -120,6 +120,8 @@ typedef enum
PT_ISSATURN, // Saturn specific identifier packet
#endif
PT_MAPICON, // Send map image icon (gamespy).
PT_NEEDMAPICON, // Request missed map icon (gamespy).
NUMPACKETTYPE
} packettype_t;
@@ -513,6 +515,7 @@ typedef struct
INT32 filesneedednum; // 4 bytes
filesneededconfig_pak filesneededcfg; // ??? bytes
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
UINT8 mapicondata[0];
} u; // This is needed to pack diff packet types data together
} ATTRPACK doomdata_t;
@@ -564,7 +567,6 @@ typedef enum
KR_TIMEOUT, //Connection Timeout
KR_BAN, //Banned by server
KR_LEAVE, //Quit the game
} kickreason_t;
/* the max number of name changes in some time period */
+269 -325
View File
@@ -96,20 +96,17 @@
// platform independant focus loss
UINT8 window_notinfocus = false;
//
// DEMO LOOP
//
//static INT32 demosequence;
static char *startupwadfiles[MAX_WADFILES];
static char *startupiwadfiles[MAX_WADFILES];
static char *startuppwads[MAX_WADFILES];
// autoloading
char *autoloadwadfiles[MAX_WADFILES];
char *autoloadwadfilespost[MAX_WADFILES];
static char *autoloadwadfiles[MAX_WADFILES];
static char *autoloadwadfilespost[MAX_WADFILES];
boolean autoloading;
boolean autoloaded;
boolean postautoloaded = false;
boolean wasautoloaded = false;
//
boolean devparm = false; // started game with -devparm
@@ -121,11 +118,8 @@ INT32 postimgparam[MAXSPLITSCREENPLAYERS];
// These variables are only true if
// whether the respective sound system is disabled
// or they're init'ed, but the player just toggled them
#ifndef NO_MIDI
boolean midi_disabled = false;
#endif
boolean sound_disabled = false;
boolean digital_disabled = false;
boolean music_disabled = false;
#ifdef DEBUGFILE
INT32 debugload = 0;
@@ -153,8 +147,6 @@ boolean dedicated = false;
boolean loaded_config = false; // true once config.cfg loaded AND executed
static void D_CleanFile(char **filearray);
//
// D_PostEvent
// Called by the I/O functions when input is detected
@@ -223,11 +215,12 @@ static void D_GamePadMenuScrollTicker(void)
}
#undef SCROLLDELAY
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0};
static void D_DeviceLEDTick(void)
{
UINT8 i;
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0};
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0};
if (numcontrollers == 0)
{
@@ -249,6 +242,11 @@ static void D_DeviceLEDTick(void)
}
}
void D_ResetDeviceLED(void)
{
memset(curcolor, 0, sizeof(curcolor));
}
//
// D_ProcessEvents
// Send all the events of the given timestamp down the responder chain
@@ -329,7 +327,7 @@ static void D_Renderview(void)
if (automapactive)
return;
R_ApplyLevelInterpolators(rendertimefrac);
R_ApplyLevelInterpolators(R_GetTimeFrac(RTF_LEVEL));
if (rendermode == render_soft)
{
@@ -451,7 +449,7 @@ static boolean D_Display(void)
if (rendermode == render_soft && !splitscreen)
{
R_InterpolateViewRollAngle(rendertimefrac_unpaused);
R_InterpolateViewRollAngle(R_GetTimeFrac(RTF_CAMERA));
R_CheckViewMorph();
}
@@ -811,7 +809,7 @@ void D_SRB2Loop(void)
debugload--;
#endif
interp = (R_UsingFrameInterpolation() && !dedicated);
interp = !dedicated && R_UsingFrameInterpolation();
doDisplay = false;
renderisnewtic = (realtics > 0 || singletics);
@@ -870,33 +868,16 @@ void D_SRB2Loop(void)
// I looked at the possibility of putting in a float drawer for
// perfstats and it's very complicated, so we'll just do this instead...
ps_interp_frac.value.p = (precise_t)((FIXED_TO_FLOAT(g_time.timefrac)) * 1000.0f);
ps_interp_lag.value.p = (precise_t)((deltasecs) * 1000.0f);
ps_interp_lag.value.p = (precise_t)((deltasecs) * 1000.0);
const boolean lagging = ((deltatics >= 1.0) || hu_stopped);
if (!(paused || P_AutoPause()) && !lagging)
{
rendertimefrac = g_time.timefrac;
}
else
{
rendertimefrac = FRACUNIT;
}
if (!lagging)
{
rendertimefrac_unpaused = g_time.timefrac;
}
else
{
rendertimefrac_unpaused = FRACUNIT;
}
R_SetTimeFrac(lagging ? FRACUNIT : g_time.timefrac);
}
else
{
renderdeltatics = realtics * FRACUNIT;
rendertimefrac = FRACUNIT;
rendertimefrac_unpaused = FRACUNIT;
R_SetTimeFrac(FRACUNIT);
}
if (interp || doDisplay)
@@ -936,7 +917,6 @@ void D_SRB2Loop(void)
Discord_RunCallbacks();
}
#endif
// Fully completed frame made.
finishprecise = I_GetPreciseTime();
@@ -974,6 +954,7 @@ void D_SRB2Loop(void)
I_SleepDuration(capbudget - elapsed);
}
}
// Capture the time once more to get the real delta time.
finishprecise = I_GetPreciseTime();
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
@@ -986,39 +967,17 @@ void D_SRB2Loop(void)
// =========================================================================
//
// D_StartTitle
// D_ClearState
//
void D_StartTitle(void)
void D_ClearState(void)
{
INT32 i;
if (netgame)
{
if (gametype == GT_RACE) // SRB2kart
{
G_SetGamestate(GS_WAITINGPLAYERS); // hack to prevent a command repeat
if (server)
{
char mapname[6];
strlcpy(mapname, G_BuildMapName(spstage_start), sizeof (mapname));
strlwr(mapname);
mapname[5] = '\0';
COM_BufAddText(va("map %s\n", mapname));
}
}
return;
}
M_ClearMenus(true);
// okay, stop now
// (otherwise the game still thinks we're playing!)
SV_StopServer();
SV_ResetServer();
serverlistultimatecount = 0;
for (i = 0; i < MAXPLAYERS; i++)
CL_ClearPlayer(i);
@@ -1034,8 +993,11 @@ void D_StartTitle(void)
// reset modeattacking
modeattacking = ATTACKING_NONE;
// empty maptol so mario/etc sounds don't play in sound test when they shouldn't
// empty some other semi-important state
maptol = 0;
nextmapoverride = 0;
skipstats = 0;
gamemap = 1;
gameaction = ga_nothing;
memset(displayplayers, 0, sizeof(displayplayers));
@@ -1044,9 +1006,38 @@ void D_StartTitle(void)
gametype = GT_RACE; // SRB2kart
paused = false;
// clear cmd building stuff
memset(gamekeydown, 0, sizeof(gamekeydown));
memset(joyxmove, 0, sizeof(joyxmove));
memset(joyymove, 0, sizeof(joyymove));
mousex = mousey = 0;
// Reset the palette
if (rendermode != render_none)
V_SetPaletteLump("PLAYPAL");
G_ResetAllDeviceRumbles();
S_StopSounds();
S_ResetKeepAndSpecialMus(); // just in case
P_FreeLevelState();
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
}
//
// D_StartTitle
//
void D_StartTitle(void)
{
demo.title = false;
D_ClearState();
netgame = false; // title menu shouldnt be a netgame lmao
M_ClearMenus(true);
F_StartTitleScreen();
D_ResetDeviceLED();
}
//
@@ -1070,31 +1061,39 @@ static void D_AddFile(const char *file, char **filearray)
filearray[pnumwadfiles] = newfile;
}
static void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
{
free(filearray[pnumwadfiles]);
filearray[pnumwadfiles] = NULL;
}
}
// Taken from TSoURDt3rd
// https://github.com/StarManiaKG/The-Story-of-Uncapped-Revengence-Discord-the-3rd/blob/main/src/STAR/star_functions.c
static INT32 D_DetectFileType(const char* filename)
{
if (pathisdirectory(filename) == 1)
return 1;
else
{
if (!stricmp(&filename[strlen(filename) - 4], ".wad"))
return 2;
else if (!stricmp(&filename[strlen(filename) - 4], ".pk3"))
return 3;
else if (!stricmp(&filename[strlen(filename) - 5], ".kart"))
return 4;
else if (!stricmp(&filename[strlen(filename) - 4], ".lua"))
return 5;
else if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
return 6;
const size_t len = strlen(filename);
else if (!stricmp(&filename[strlen(filename) - 4], ".cfg"))
return 7;
else if (!stricmp(&filename[strlen(filename) - 4], ".txt"))
return 8;
}
if (!stricmp(&filename[len - 4], ".wad"))
return 2;
else if (!stricmp(&filename[len - 4], ".pk3"))
return 3;
else if (!stricmp(&filename[len - 5], ".kart"))
return 4;
else if (!stricmp(&filename[len - 4], ".lua"))
return 5;
else if (!stricmp(&filename[len - 4], ".soc"))
return 6;
else if (!stricmp(&filename[len - 4], ".cfg"))
return 7;
else if (!stricmp(&filename[len - 4], ".txt"))
return 8;
return 0;
}
@@ -1233,16 +1232,6 @@ void D_AddPostloadFiles(void)
postautoloaded = true;
}
static void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
{
free(filearray[pnumwadfiles]);
filearray[pnumwadfiles] = NULL;
}
}
// ==========================================================================
// Identify the SRB2 version, and IWAD file to use.
// ==========================================================================
@@ -1253,18 +1242,176 @@ static boolean AddIWAD(void)
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupwadfiles);
D_AddFile(path, startupiwadfiles);
return true;
}
return false;
}
// extra graphic patches for saturn specific thingies
// Optional saturn extra files
boolean found_extra_kart = false;
boolean found_extra2_kart = false;
boolean found_extra3_kart = false;
static void IdentifyVersion(void)
{
const char *srb2waddir = NULL;
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
// change to the directory where 'srb2.srb' is found
srb2waddir = I_LocateWad();
#endif
char tempsrb2path[256] = ".";
getcwd(tempsrb2path, 256);
// get the current directory (possible problem on NT with "." as current dir)
if (!srb2waddir)
{
if (tempsrb2path[0])
srb2waddir = tempsrb2path;
else
{
srb2waddir = ".";
}
}
#if (1) // reduce the amount of findfile by only using full cwd in this func
if (strcmp(tempsrb2path, srb2waddir))
#endif
{
strlcpy(srb2path, srb2waddir, sizeof (srb2path));
}
// Load the IWAD
if (!AddIWAD())
{
I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir);
}
// will be overwritten in case of -cdrom or unix/win home
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2waddir);
configfile[sizeof configfile - 1] = '\0';
// if you change the ordering of this or add/remove a file, be sure to update the md5
// checking in D_SRB2Main
#ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
#endif
D_AddFile(va(pandf, srb2waddir, "gfx.kart"), startupiwadfiles);
D_AddFile(va(pandf, srb2waddir, "textures.kart"), startupiwadfiles);
D_AddFile(va(pandf, srb2waddir, "chars.kart"), startupiwadfiles);
D_AddFile(va(pandf, srb2waddir, "maps.kart"), startupiwadfiles);
#ifdef USE_PATCH_KART
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupiwadfiles);
#endif
const char *path = NULL;
path = va(pandf, srb2waddir, "extra.kart");
// completely optional
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles);
found_extra_kart = true;
}
path = va(pandf, srb2waddir, "extra2.kart");
// completely optional 2: Back with a vengence
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles);
found_extra2_kart = true;
}
path = va(pandf, srb2waddir, "extra3.kart");
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles);
found_extra3_kart = true;
}
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#define MUSICTEST(str) \
musicpath = va(pandf,srb2waddir,str);\
handle = W_OpenWadFile(&musicpath, false); \
if (handle) \
{\
int ms = W_VerifyNMUSlumps(musicpath, handle, false); \
fclose(handle); \
if (ms == 0) \
I_Error("File " str " has been modified with non-music/sound lumps"); \
if (ms == 1) \
D_AddFile(musicpath, startupiwadfiles); \
}
{
const char *musicpath;
FILE *handle;
MUSICTEST("sounds.kart")
MUSICTEST("music.kart")
}
#undef MUSICTEST
#endif
}
//
// search for maps
//
static void D_CheckMaps(boolean checkreplaced)
{
INT32 i;
char *name;
UINT16 wadnum;
lumpinfo_t *lumpinfo;
for (wadnum = 0; wadnum < mainwads; wadnum++)
{
lumpinfo = wadfiles[wadnum]->lumpinfo;
for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++)
{
name = lumpinfo->name;
P_CheckMapReplacements(name, checkreplaced);
}
}
}
//
// Center the title string, then add the date and time of compilation.
//
static inline void D_MakeTitleString(char *s)
{
char temp[82];
char *t;
const char *u;
INT32 i;
const size_t len = (80-strlen(s))/2;
for (i = 0, t = temp; i < 82; i++)
*t++=' ';
for (t = temp + len, u = s; *u != '\0' ;)
*t++ = *u++;
u = compdate;
for (t = temp + 1, i = 11; i-- ;)
*t++ = *u++;
u = comptime;
for (t = temp + 71, i = 8; i-- ;)
*t++ = *u++;
temp[80] = '\0';
strcpy(s, temp);
}
// extra graphic patches for saturn specific thingies
boolean xtra_speedo = false; // extra speedometer check
boolean xtra_speedo_clr = false; // extra speedometer colour check
boolean xtra_speedo3 = false; // 80x 11 extra speedometer check
@@ -1289,118 +1436,6 @@ boolean minidoticon = false; // Dot graphic for minimap player angle displ
boolean minilighticon = false; // mkwii-style minimap headlight
//
static void IdentifyVersion(void)
{
const char *srb2waddir = NULL;
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
// change to the directory where 'srb2.srb' is found
srb2waddir = I_LocateWad();
#endif
// get the current directory (possible problem on NT with "." as current dir)
if (srb2waddir)
{
strlcpy(srb2path, srb2waddir, sizeof(srb2path));
}
else
{
if (getcwd(srb2path, sizeof(srb2path)))
srb2waddir = srb2path;
else
{
srb2waddir = srb2path;
}
}
// Load the IWAD
if (!AddIWAD())
{
I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir);
}
// will be overwritten in case of -cdrom or unix/win home
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2waddir);
configfile[sizeof configfile - 1] = '\0';
// if you change the ordering of this or add/remove a file, be sure to update the md5
// checking in D_SRB2Main
#ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
#endif
D_AddFile(va(pandf,srb2waddir,"gfx.kart"), startupwadfiles);
D_AddFile(va(pandf,srb2waddir,"textures.kart"), startupwadfiles);
D_AddFile(va(pandf,srb2waddir,"chars.kart"), startupwadfiles);
D_AddFile(va(pandf,srb2waddir,"maps.kart"), startupwadfiles);
#ifdef USE_PATCH_KART
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupwadfiles);
#endif
// completely optional
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra.kart")))
{
D_AddFile(va(pandf,srb2waddir,"extra.kart"), startupwadfiles);
found_extra_kart = true;
}
// completely optional 2: Back with a vengence
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra2.kart")))
{
D_AddFile(va(pandf,srb2waddir,"extra2.kart"), startupwadfiles);
found_extra2_kart = true;
}
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra3.kart")))
{
D_AddFile(va(pandf,srb2waddir,"extra3.kart"), startupwadfiles);
found_extra3_kart = true;
}
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#define MUSICTEST(str) \
{\
const char *musicpath = va(pandf,srb2waddir,str);\
int ms = W_VerifyNMUSlumps(musicpath); \
if (ms == 1) \
D_AddFile(musicpath, startupwadfiles); \
else if (ms == 0) \
I_Error("File "str" has been modified with non-music/sound lumps"); \
}
MUSICTEST("sounds.kart")
MUSICTEST("music.kart")
#undef MUSICTEST
#endif
}
//
// Center the title string, then add the date and time of compilation.
//
static inline void D_MakeTitleString(char *s)
{
char temp[82];
char *t;
const char *u;
INT32 i;
for (i = 0, t = temp; i < 82; i++)
*t++=' ';
for (t = temp + (80-strlen(s))/2, u = s; *u != '\0' ;)
*t++ = *u++;
u = compdate;
for (t = temp + 1, i = 11; i-- ;)
*t++ = *u++;
u = comptime;
for (t = temp + 71, i = 8; i-- ;)
*t++ = *u++;
temp[80] = '\0';
strcpy(s, temp);
}
static void D_CheckSaturnExtraFiles(void)
{
// Possible value that changes depending on whether required files for speedometer are found or not
@@ -1502,12 +1537,14 @@ static void D_CheckSaturnExtraFiles(void)
PUSHCONS(inputdisplay_cons_temp, last_inputdisplay_i, 3, "StickGFX");
}
// minimap dot
if (W_LumpExists("MMAPDOT"))
{
minidoticon = true;
PUSHCONS(minimapdot_cons_temp, last_minimapdot_i, 1, "Dot");
}
// minimap headlight
if (W_LumpExists("MMAPHDLT"))
{
minilighticon = true;
@@ -1597,12 +1634,9 @@ static void D_CheckSaturnExtraFiles(void)
//
void D_SRB2Main(void)
{
INT32 p, i;
INT32 p;
char srb2[82]; // srb2 title banner
char title[82];
lumpinfo_t *lumpinfo;
UINT16 wadnum;
char *name;
INT32 pstartmap = 1;
boolean autostart = false;
@@ -1660,9 +1694,7 @@ void D_SRB2Main(void)
#if defined (__OS2__) && !defined (HAVE_SDL)
// set PM window title
snprintf(pmData->title, sizeof (pmData->title),
"SRB2Kart" VERSIONSTRING ": %s",
title);
snprintf(pmData->title, sizeof (pmData->title), "SRB2Kart" VERSIONSTRING ": %s", title);
pmData->title[sizeof (pmData->title) - 1] = '\0';
#endif
@@ -1788,9 +1820,6 @@ void D_SRB2Main(void)
I_InitializeTime();
setlocale(LC_TIME, "");
// Make backups of some SOCcable tables.
P_BackupTables();
// Setup default unlockable conditions
M_SetupDefaultConditionSets();
@@ -1800,14 +1829,9 @@ void D_SRB2Main(void)
// load wad, including the main wad file
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
if (!W_InitMultipleFiles(startupwadfiles, false))
#ifdef _DEBUG
CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
#else
I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
#endif
D_CleanFile(startupwadfiles);
W_InitMultipleFiles(startupiwadfiles, false);
D_CleanFile(startupiwadfiles);
mainwads = 0;
#ifndef DEVELOP
@@ -1844,66 +1868,18 @@ void D_SRB2Main(void)
// conversion sometimes needs the palette
V_ReloadPalette();
//
// search for maps
//
for (wadnum = 0; wadnum < mainwads; wadnum++)
D_CheckMaps(false);
W_InitMultipleFiles(startuppwads, true);
// Only search for pwad maps if we actually have a pwad added
if (startuppwads[0] != NULL)
{
lumpinfo = wadfiles[wadnum]->lumpinfo;
for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++)
{
name = lumpinfo->name;
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
{
INT16 num;
if (name[5] != '\0')
continue;
num = (INT16)M_MapNumber(name[3], name[4]);
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
if (num <= NUMMAPS && mapheaderinfo[num - 1])
{
mapheaderinfo[num - 1]->menuflags |= LF2_EXISTSHACK;
}
}
}
D_CheckMaps(true);
}
if (!W_InitMultipleFiles(startuppwads, true))
CONS_Error("A PWAD file was not found or not valid.\nCheck the log to see which ones.\n");
D_CleanFile(startuppwads);
//
// search for maps... again.
//
for (wadnum = mainwads+1; wadnum < numwadfiles; wadnum++)
{
lumpinfo = wadfiles[wadnum]->lumpinfo;
for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++)
{
name = lumpinfo->name;
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
{
INT16 num;
if (name[5] != '\0')
continue;
num = (INT16)M_MapNumber(name[3], name[4]);
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
if (num <= NUMMAPS && mapheaderinfo[num - 1])
{
if (mapheaderinfo[num - 1]->menuflags & LF2_EXISTSHACK)
G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
mapheaderinfo[num - 1]->menuflags |= LF2_EXISTSHACK;
}
CONS_Printf("%s\n", name);
}
}
}
cht_Init();
//---------------------------------------------------- READY SCREEN
@@ -1923,8 +1899,12 @@ void D_SRB2Main(void)
// setup loading screen
SCR_Startup();
// Do this in background; lots of number crunching
R_InitTranslucencyTables();
// we need the font of the console
CONS_Printf("HU_Init(): Setting up heads up display.\n");
HU_Init();
COM_Init();
@@ -1986,48 +1966,20 @@ void D_SRB2Main(void)
R_Init();
// setting up sound
if (dedicated)
if (dedicated || M_CheckParm("-noaudio")) // combines -nosound and -nomusic
{
sound_disabled = true;
digital_disabled = true;
#ifndef NO_MIDI
midi_disabled = true;
#endif
}
if (M_CheckParm("-noaudio")) // combines -nosound and -nomusic
{
sound_disabled = true;
digital_disabled = true;
#ifndef NO_MIDI
midi_disabled = true;
#endif
music_disabled = true;
}
else
{
if (M_CheckParm("-nosound"))
sound_disabled = true;
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
{
digital_disabled = true;
#ifndef NO_MIDI
midi_disabled = true;
#endif
}
else
{
#ifndef NO_MIDI
if (M_CheckParm("-nomidimusic"))
midi_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
#endif
if (M_CheckParm("-nodigmusic"))
digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
}
if (M_CheckParm("-nomusic"))
music_disabled = true;
}
if (!( sound_disabled && digital_disabled
#ifndef NO_MIDI
&& midi_disabled
#endif
))
if (!(sound_disabled && music_disabled))
{
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
I_StartupSound();
@@ -2066,12 +2018,7 @@ void D_SRB2Main(void)
// check for a driver that wants intermission stats
// start the apropriate game based on parms
if (M_CheckParm("-metal"))
{
G_RecordMetal();
autostart = true;
}
else if (M_CheckParm("-record") && M_IsNextParm())
if (M_CheckParm("-record") && M_IsNextParm())
{
G_RecordDemo(M_GetNextParm());
autostart = true;
@@ -2152,12 +2099,6 @@ void D_SRB2Main(void)
}
#endif
/*if (M_CheckParm("-ultimatemode"))
{
autostart = true;
ultimatemode = true;
}*/
if (autostart || netgame)
{
gameaction = ga_nothing;
@@ -2302,6 +2243,9 @@ const char *D_Home(void)
}
#endif// !__CYGWIN__
#endif// _WIN32
if (usehome) return userhome;
else return NULL;
if (usehome)
return userhome;
else
return NULL;
}
+3 -4
View File
@@ -64,12 +64,8 @@ extern boolean minilighticon; // mkwii-style minimap headlight
extern boolean autoloading;
extern boolean autoloaded;
extern boolean postautoloaded;
void D_AddPostloadFiles(void);
extern char *autoloadwadfilespost[MAX_WADFILES];
extern char *autoloadwadfiles[MAX_WADFILES];
// the infinite loop of D_SRB2Loop() called from win_main for windows version
void D_SRB2Loop(void) FUNCNORETURN;
@@ -87,9 +83,12 @@ void D_ProcessEvents(void);
const char *D_Home(void);
void D_ResetDeviceLED(void);
//
// BASE LEVEL
//
void D_ClearState(void);
void D_StartTitle(void);
#ifdef __cplusplus
+24 -12
View File
@@ -219,14 +219,14 @@ static boolean GetFreeAcknum(UINT8 *freeack)
node_t *node = &nodes[doomcom->remotenode];
INT32 i, numfreeslot = 0;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
if (cmpack((UINT8)((node->remotefirstack + MAXACKTOSEND) % 256), node->nextacknum) < 0)
{
DEBFILE(va("too fast %d %d\n",node->remotefirstack,node->nextacknum));
return false;
}
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
for (i = 0; i < MAXACKPACKETS; i++)
{
if (!ackpak[i].acknum)
@@ -262,7 +262,10 @@ static boolean GetFreeAcknum(UINT8 *freeack)
CONS_Debug(DBG_NETPLAY, "No more free ackpacket\n");
#endif
if (netbuffer->packettype < PT_CANFAIL)
I_Error("Connection lost\n");
{
CONS_Alert(CONS_WARNING, "Connection from %s is not acknowledging packets, killing connection\n", I_GetNodeAddress(doomcom->remotenode));
Net_CloseConnection(doomcom->remotenode | FORCECLOSE);
}
return false;
}
@@ -461,6 +464,7 @@ void Net_ConnectionTimeout(INT32 node)
// Don't timeout several times
if (nodes[node].flags & NF_TIMEOUT)
return;
nodes[node].flags |= NF_TIMEOUT;
// Send a very special packet to self (hack the reboundstore queue)
@@ -487,11 +491,11 @@ void Net_AckTicker(void)
for (i = 0; i < MAXACKPACKETS; i++)
{
const INT32 nodei = ackpak[i].destinationnode;
node_t *node = &nodes[nodei];
if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime())
{
const INT32 nodei = ackpak[i].destinationnode;
node_t *node = &nodes[nodei];
if (ackpak[i].resentnum > 10 && (node->flags & NF_CLOSE))
{
DEBFILE(va("ack %d sent 10 times so connection is supposed lost: node %d\n",
@@ -540,13 +544,14 @@ void Net_UnAcknowledgePacket(INT32 node)
#ifdef NONET
(void)node;
#else
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
DEBFILE(va("UnAcknowledge node %d\n", node));
if (!node)
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
if (nodes[node].acktosend[hm1] == netbuffer->ack)
{
nodes[node].acktosend[hm1] = 0;
@@ -683,7 +688,6 @@ void Net_CloseConnection(INT32 node)
(void)node;
#else
INT32 i;
boolean forceclose = (node & FORCECLOSE) != 0;
if (node == -1)
{
@@ -691,6 +695,8 @@ void Net_CloseConnection(INT32 node)
return; // nope, just ignore it
}
boolean forceclose = (node & FORCECLOSE) != 0;
node &= ~FORCECLOSE;
if (!node)
@@ -710,6 +716,12 @@ void Net_CloseConnection(INT32 node)
Net_SendAcks(node);
Net_SendAcks(node);
}
else
{
// if the connection hasn't acknowledged anything, it's possible for it to permanently occupy the node.
// to prevent this, drop the connection.
forceclose = true;
}
// check if we are waiting for an ack from this node
for (i = 0; i < MAXACKPACKETS; i++)
@@ -1201,6 +1213,7 @@ boolean HGetPacket(void)
GotAcks();
continue;
}
doomcom->datalength -= BASEPACKETSIZE;
break;
}
#endif // ifndef NONET
@@ -1258,13 +1271,12 @@ SINT8 I_NetMakeNode(const char *hostname)
void D_SetDoomcom(void)
{
if (doomcom) return;
if (doomcom)
return;
doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
doomcom->id = DOOMCOM_ID;
doomcom->numslots = doomcom->numnodes = 1;
doomcom->gametype = 0;
doomcom->consoleplayer = 0;
doomcom->extratics = 0;
}
//
+45 -29
View File
@@ -277,7 +277,8 @@ consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0,
INT32 cv_debug;
static void UseMouse_OnChange(void);
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, UseMouse_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL, usemouse_cons_t, UseMouse_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mousevisible = {"mousevisible", "Off", CV_SAVE|CV_CALL, CV_OnOff, UseMouse_OnChange, 0, NULL, NULL, 0, 0, NULL};
static void UseMouse_OnChange(void)
{
@@ -858,6 +859,7 @@ void D_RegisterClientCommands(void)
// GIF variables
CV_RegisterVar(&cv_gif_optimize);
CV_RegisterVar(&cv_gif_downscale);
CV_RegisterVar(&cv_gif_dynamicdelay);
#ifdef WALLSPLATS
CV_RegisterVar(&cv_splats);
@@ -937,6 +939,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_consolechat);
CV_RegisterVar(&cv_chatnotifications);
CV_RegisterVar(&cv_chatbacktint);
CV_RegisterVar(&cv_chatcentertext);
CV_RegisterVar(&cv_songcredits);
CV_RegisterVar(&cv_showfreeplay);
CV_RegisterVar(&cv_skinselectspin);
@@ -1002,6 +1005,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_invertmouse);
CV_RegisterVar(&cv_mousesens);
CV_RegisterVar(&cv_mouseysens);
CV_RegisterVar(&cv_mousevisible);
// s_sound.c
CV_RegisterVar(&cv_soundvolume);
@@ -1528,12 +1532,7 @@ static void SendNameAndColor(void)
if (players[consoleplayer].mo)
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
if (metalrecording)
{ // Metal Sonic is Sonic, obviously.
SetPlayerSkinByNum(consoleplayer, 0);
CV_StealthSet(&cv_skin, skins[0].name);
}
else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1)
if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1)
{
cv_skin.value = foundskin;
SetPlayerSkin(consoleplayer, cv_skin.string);
@@ -2323,8 +2322,6 @@ static void Command_Playdemo_f(void)
// disconnect from server here?
if (demo.playback)
G_StopDemo();
if (metalplayback)
G_StopMetalDemo();
// open the demo file
strcpy(name, COM_Argv(1));
@@ -2371,8 +2368,6 @@ static void Command_Timedemo_f(void)
// disconnect from server here?
if (demo.playback)
G_StopDemo();
if (metalplayback)
G_StopMetalDemo();
// open the demo file
strcpy (name, COM_Argv(1));
@@ -2505,6 +2500,14 @@ void D_SetupVote(void)
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
INT16 votebuffer[4] = {-1,-1,-1,0};
INT16 luamaps[4] = {0, 0, 0, 0};
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
// Correct secondgt if needed
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
if (cv_kartencore.value && gt == GT_RACE)
WRITEUINT8(p, (gt|0x80));
@@ -2513,10 +2516,13 @@ void D_SetupVote(void)
WRITEUINT8(p, secondgt);
secondgt &= ~0x80;
for (i = 0; i < 4; i++)
{
UINT16 m;
if (i == 2) // sometimes a different gametype
if (luamaps[i])
m = luamaps[i]-1;
else if (i == 2) // sometimes a different gametype
m = G_RandMap(G_TOLFlag(secondgt), prevmap, false, 0, true, votebuffer);
else if (i >= 3) // unknown-random and force-unknown MAP HELL
m = G_RandMap(G_TOLFlag(gt), prevmap, false, (i-2), (i < 4), votebuffer);
@@ -2918,8 +2924,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
if (demo.timing)
G_DoneLevelLoad();
if (metalrecording)
G_BeginMetal();
if (demo.recording) // Okay, level loaded, character spawned and skinned,
G_BeginRecording(); // I AM NOW READY TO RECORD.
demo.deferstart = true;
@@ -4392,7 +4396,9 @@ static void Command_Addfile(void)
char buf[256];
char *buf_p = buf;
INT32 i;
int musiconly; // W_VerifyNMUSlumps isn't boolean
int musiconly = -1; // W_VerifyNMUSlumps isn't boolean
FILE *fhandle = NULL;
if (COM_Argc() != 2)
{
@@ -4407,9 +4413,18 @@ static void Command_Addfile(void)
if (!isprint(fn[i]) || fn[i] == ';')
return;
musiconly = W_VerifyNMUSlumps(fn);
if (fhandle)
{
fclose(fhandle);
fhandle = NULL;
}
if (!musiconly)
if ((fhandle = W_OpenWadFile(&fn, true)) != NULL)
{
musiconly = W_VerifyNMUSlumps(fn, fhandle, false);
}
if (musiconly == -1)
{
// ... But only so long as they contain nothing more then music and sprites.
if (netgame && !(server || IsPlayerAdmin(consoleplayer)))
@@ -4433,36 +4448,31 @@ static void Command_Addfile(void)
break;
++p;
WRITESTRINGN(buf_p,p,240);
// calculate and check md5
{
UINT8 md5sum[16];
#ifdef NOMD5
memset(md5sum,0,16);
#else
FILE *fhandle;
if ((fhandle = W_OpenWadFile(&fn, true)) != NULL)
{
tic_t t = I_GetTime();
CONS_Debug(DBG_SETUP, "Making MD5 for %s\n",fn);
md5_stream(fhandle, md5sum);
CONS_Debug(DBG_SETUP, "MD5 calc for %s took %f second\n", fn, (float)(I_GetTime() - t)/TICRATE);
fclose(fhandle);
}
else // file not found
return;
for (i = 0; i < numwadfiles; i++)
{
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
{
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
return;
}
if (memcmp(wadfiles[i]->md5sum, md5sum, 16))
continue;
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
goto addfile_finally;
}
#endif
// Finally okay to write this important data
WRITESTRINGN(buf_p,p,240);
WRITEMEM(buf_p, md5sum, 16);
}
@@ -4470,6 +4480,10 @@ static void Command_Addfile(void)
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
else
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
addfile_finally:
if (fhandle)
fclose(fhandle);
}
/** Adds something at runtime.
@@ -5593,7 +5607,9 @@ void Command_ExitGame_f(void)
closefilemenu(true);
if (!modeattacking)
{
D_StartTitle();
}
}
void Command_Retry_f(void)
+1
View File
@@ -50,6 +50,7 @@ extern consvar_t cv_splitplayers;
extern consvar_t cv_seenames, cv_allowseenames;
#endif
extern consvar_t cv_usemouse;
extern consvar_t cv_mousevisible;
//WTF
extern consvar_t cv_mouseturn;
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
+68 -32
View File
@@ -163,7 +163,8 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
nameonly(strcpy(wadfilename, wadfiles[i]->filename));
// Look below at the WRITE macros to understand what these numbers mean.
if (p + 1 + 4 + min(strlen(wadfilename) + 1, MAX_WADPATH) + 16 > p_start + MAXFILENEEDED)
const size_t len = strlen(wadfilename) + 1;
if (p + 1 + 4 + min(len, MAX_WADPATH) + 16 > p_start + MAXFILENEEDED)
{
// Too many files to send all at once
if (netbuffer->packettype == PT_MOREFILESNEEDED)
@@ -178,7 +179,7 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
// Store in the upper four bits
if (!cv_downloading.value)
filestatus += (2 << 4); // Won't send
else if ((wadfiles[i]->filesize <= (UINT32)cv_maxsend.value * 1024))
else if (cv_maxsend.value == -1 || wadfiles[i]->filesize <= (UINT32)cv_maxsend.value * 1024)
filestatus += (1 << 4); // Will send if requested
// else
// filestatus += (0 << 4); -- Won't send, too big
@@ -212,6 +213,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
fileneedednum = firstfile + fileneedednum_parm;
p = (UINT8 *)fileneededstr;
for (i = firstfile; i < fileneedednum; i++)
{
fileneeded[i].status = FS_NOTCHECKED; // We haven't even started looking for the file yet
@@ -648,7 +650,8 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
{
filetx_t **q; // A pointer to the "next" field of the last file in the list
filetx_t *p; // The new file request
INT32 i;
UINT16 wadnum;
char wadfilename[MAX_WADPATH];
if (cv_noticedownload.value)
@@ -674,20 +677,21 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
nameonly(p->id.filename);
// Look for the requested file through all loaded files
for (i = 0; wadfiles[i]; i++)
for (wadnum = 0; wadfiles[wadnum]; wadnum++)
{
strlcpy(wadfilename, wadfiles[i]->filename, MAX_WADPATH);
strlcpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH);
nameonly(wadfilename);
if (!stricmp(wadfilename, p->id.filename))
{
// Copy file name with full path
strlcpy(p->id.filename, wadfiles[i]->filename, MAX_WADPATH);
strlcpy(p->id.filename, wadfiles[wadnum]->filename, MAX_WADPATH);
break;
}
}
// Handle non-loaded file requests
if (!wadfiles[i])
if (!wadfiles[wadnum])
{
DEBFILE(va("%s not found in wadfiles\n", filename));
// This formerly checked if (!findfile(p->id.filename, NULL, true))
@@ -702,7 +706,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
}
// Handle huge file requests (i.e. bigger than cv_maxsend.value KB)
if (wadfiles[i]->filesize > (UINT32)cv_maxsend.value * 1024)
if (cv_maxsend.value != -1 && wadfiles[wadnum]->filesize > (UINT32)cv_maxsend.value * 1024)
{
// Too big
// Don't inform client (client sucks, man)
@@ -773,6 +777,7 @@ static void SV_EndFileSend(INT32 node)
case SF_FILE: // It's a file, close it and free its filename
if (cv_noticedownload.value)
CONS_Printf("Ending file transfer (id %d) for node %d\n", p->fileid, node);
if (transferFiles[p->fileid].file)
{
if (transferFiles[p->fileid].count > 0)
@@ -786,6 +791,7 @@ static void SV_EndFileSend(INT32 node)
transferFiles[p->fileid].file = NULL;
}
}
free(p->id.filename);
break;
case SF_Z_RAM: // It's a memory block allocated with Z_Alloc or the likes, use Z_Free
@@ -821,11 +827,12 @@ void SV_FileSendTicker(void)
size_t size;
filetx_t *f;
INT32 packetsent, ram, i, j;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
if (!filestosend) // No file to send
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
packetsent = cv_downloadspeed.value;
netbuffer->packettype = PT_FILEFRAGMENT;
@@ -957,8 +964,8 @@ void Got_Filetxpak(void)
static INT32 filetime = 0;
if (!(strcmp(filename, "srb2.srb")
&& strcmp(filename, "srb2.wad")
&& strcmp(filename, "patch.dta")
//&& strcmp(filename, "srb2.wad")
//&& strcmp(filename, "patch.dta")
//&& strcmp(filename, "music.dta")
&& strcmp(filename, "gfx.kart")
&& strcmp(filename, "textures.kart")
@@ -1001,6 +1008,7 @@ void Got_Filetxpak(void)
pos &= ~0x80000000;
file->totalsize = pos + size;
}
// We can receive packet in the wrong order, anyway all os support gaped file
fseek(file->file, pos, SEEK_SET);
if (fwrite(netbuffer->u.filetxpak.data,size,1,file->file) != 1)
@@ -1173,28 +1181,56 @@ 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)
// first, check SRB2's "home" directory
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
// next, check SRB2's "path" directory
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
// skip for startup, our mainwads wont be in there
if (loaded_config)
{
// next, check any custom directory if specified
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
{
// first, check any custom directory if specified
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
}
// next, check "DOWNLOAD" directory
homecheck = filesearch(filename, "DOWNLOAD", wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
// next, check "addons" directory
homecheck = filesearch(filename, "addons", wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
}
// next, check SRB2's "home" directory (if non-'.')
if (strcmp(srb2home, "."))
{
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
}
// next, check SRB2's "path" directory (also if non-'.')
if (strcmp(srb2path, "."))
{
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
+2 -4
View File
@@ -383,10 +383,6 @@ typedef struct player_s
fixed_t viewz;
// Base height above floor for viewz.
fixed_t viewheight;
// Bob/squat speed.
//fixed_t deltaviewheight;
// bounded/scaled total momentum.
//fixed_t bob;
angle_t viewrollangle;
angle_t tilt;
@@ -568,6 +564,8 @@ typedef struct player_s
squishdance_t squishdance;
fixed_t fovadd; // adjust FOV for hw rendering
SINT8 driftlevel; // just for controller rumble for now
} player_t;
#endif
+6 -5
View File
@@ -60,7 +60,7 @@ static boolean RegisterProtocols(const char *path)
HKEY hKey = OpenKey(HKEY_CURRENT_USER,"Software\\Classes\\srb2kart");
SetStringValue(hKey, "URL Protocol", "");
RegCloseKey(hKey);
hKey = OpenKey(HKEY_CURRENT_USER,"Software\\Classes\\srb2kart\\shell\\open\\command");
hKey = OpenKey(HKEY_CURRENT_USER,"Software\\Classes\\srb2kart\\shell\\open\\command");
SetStringValue(hKey, "", va("\"%s\" \"%%1\"", path));
RegCloseKey(hKey);
#elif defined (__unix__) || defined (UNIXCOMMON)
@@ -76,12 +76,12 @@ static boolean RegisterProtocols(const char *path)
if (system("which update-desktop-database > /dev/null 2>&1"))
{
// command not found, probably doesn't have freedesktop, so let's ignore
// command not found, probably doesn't have freedesktop, so let's ignore
CONS_Alert(CONS_ERROR, "Unable to register protocols. Your system doesn't seem to have freedesktop.\n");
return false;
}
if (stat(applicationsfolder, &sb) == -1)
if (stat(applicationsfolder, &sb) == -1)
{
// location doesn't exist, so let's actually create it
newfolder = true;
@@ -119,12 +119,13 @@ static boolean RegisterProtocols(const char *path)
if (!alreadyexists)
fprintf(mimefile, "x-scheme-handler/srb2kart=srb2kart-handler.desktop;\n");
if (newfolder)
{
if (system(va("update-desktop-database %s/.local/share/applications/", homedir)) == -1)
{
CONS_Alert(CONS_ERROR, "Unable to register protocols. Could not run call to run update-desktop-database sucessfully.\n");
fclose(mimefile);
return false;
}
}
@@ -206,7 +207,7 @@ void D_SetupProtocol(void)
fp = fopen(protocolfile, "a+");
result = fgets(buffer, PATH_MAX, fp);
if (result)
if (result)
{
if (strcmp(buffer, "no") == 0)
{
+12 -1
View File
@@ -30,6 +30,15 @@
//
typedef void (*actionf_p1)(void *);
typedef enum
{
/// The allocation is standard e.g. Z_Malloc
TAT_MALLOC,
/// The allocation is in the pool allocator (e.g. Z_LevelPoolCalloc)
TAT_LEVELPOOL
} thinker_alloc_type_e;
// Historically, "think_t" is yet another function pointer to a routine
// to handle an actor.
typedef actionf_p1 think_t;
@@ -44,7 +53,9 @@ typedef struct thinker_s
// killough 11/98: count of how many other objects reference
// this one using pointers. Used for garbage collection.
INT32 references;
boolean cachable;
INT32 alloctype;
size_t size;
#ifdef PARANOIA
INT32 debug_mobjtype;
tic_t debug_time;
+2 -5
View File
@@ -69,13 +69,11 @@ void I_ShutdownSound(void){}
\return sfx handle
*/
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, INT32 channel)
{
(void)id;
(void)vol;
(void)sep;
(void)pitch;
(void)priority;
(void)channel;
return 0;
}
@@ -116,12 +114,11 @@ boolean I_SoundIsPlaying(INT32 handle)
\return void
*/
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep)
{
(void)handle;
(void)vol;
(void)sep;
(void)pitch;
}
/** \brief The I_SetSfxVolume function
+1 -42
View File
@@ -1223,43 +1223,6 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
#undef WINMUMBLE
#endif // NOMUMBLE
/** \brief empty ticcmd for player 1
*/
static ticcmd_t emptycmd;
ticcmd_t *I_BaseTiccmd(void)
{
return &emptycmd;
}
/** \brief empty ticcmd for player 2
*/
static ticcmd_t emptycmd2;
ticcmd_t *I_BaseTiccmd2(void)
{
return &emptycmd2;
}
/** \brief empty ticcmd for player 3
*/
static ticcmd_t emptycmd3;
ticcmd_t *I_BaseTiccmd3(void)
{
return &emptycmd3;
}
/** \brief empty ticcmd for player 4
*/
static ticcmd_t emptycmd4;
ticcmd_t *I_BaseTiccmd4(void)
{
return &emptycmd4;
}
//
// I_GetTime
// returns time in 1/TICRATE second tics
@@ -1476,8 +1439,6 @@ void I_Quit(void)
if (demo.recording)
G_CheckDemoStatus();
if (metalrecording)
G_StopMetalRecording();
D_QuitNetGame();
I_ShutdownMusic();
@@ -1583,8 +1544,6 @@ void I_Error(const char *error, ...)
// Shutdown. Here might be other errors.
if (demo.recording)
G_CheckDemoStatus();
if (metalrecording)
G_StopMetalRecording();
D_QuitNetGame();
I_ShutdownMusic();
@@ -1899,7 +1858,7 @@ static const char *searchWad(const char *searchDir)
filestatus_t fstemp;
strcpy(tempsw, WADKEYWORD1);
fstemp = filesearch(tempsw,searchDir,NULL,true,20);
fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
if (fstemp == FS_FOUND)
{
pathonly(tempsw);
+5 -5
View File
@@ -29,16 +29,12 @@
rendermode_t rendermode = render_none;
boolean highcolor = false;
// synchronize page flipping with screen refresh
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t keyboardlayout_cons_t[] = {{1,"Default US"}, {2, "Native"}, {3, "AZERTY"}, {0, NULL}};
consvar_t cv_keyboardlayout = {"keyboardlayout", "Default US", CV_SAVE, keyboardlayout_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_alwaysgrabmouse = {"alwaysgrabmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
INT32 numcontrollers = 0;
UINT8 graphics_started = 0; // Is used in console.c and screen.c
@@ -148,12 +144,16 @@ UINT32 I_GetRefreshRate(void)
return 0;
}
void I_SetTextInput(void)
{
}
boolean I_UseNativeKeyboard(void)
{
return false;
}
void I_SetBorderlessWindow(void)
void I_SetBorderlessWindow(void)
{
}
+11 -2
View File
@@ -178,6 +178,9 @@ FUNCPRINTF static void deh_warning(const char *first, ...)
else
CONS_Alert(CONS_WARNING, "Line %u: %s\n", dbg_line, buf);
if (dbg_line != -1 && (M_CheckParm("-strict") || M_CheckParm("-strict-soc")))
I_Error("deh_warning: %s", buf);
deh_num_warning++;
Z_Free(buf);
@@ -2628,7 +2631,7 @@ static void readmaincfg(MYFILE *f)
}
else if (fastcmp(word, "RESETDATA"))
{
P_ResetData(value);
CONS_Alert(CONS_WARNING, M_GetText("RESETDATA is obsolete and no longer has any effect.\n"));
}
else if (fastcmp(word, "CUSTOMVERSION"))
{
@@ -2855,7 +2858,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f))
{
char origpos[128];
char origpos[256];
INT32 size = 0;
char *traverse;
@@ -2871,6 +2874,12 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
size++;
}
if (size > (int)sizeof(origpos))
{
deh_warning("Line is too long");
size = sizeof(origpos)-1;
}
strncpy(origpos, s, size);
origpos[size] = '\0';
+4 -10
View File
@@ -115,8 +115,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v8.3"
#define VERSIONSTRINGW L"Saturn v8.3"
#define VERSIONSTRING "Saturn v9"
#define VERSIONSTRINGW L"Saturn v9"
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
@@ -626,13 +626,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Most modifications should probably enable this.
//#define SAVEGAME_OTHERVERSIONS
/// Allow the use of the SOC RESETINFO command.
/// \note Builds that are tight on memory should disable this.
/// This stops the game from storing backups of the states, sprites, and mobjinfo tables.
/// Though this info is compressed under normal circumstances, it's still a lot of extra
/// memory that never gets touched.
#define ALLOW_RESETDATA
#ifndef NONET
/// Display a connection screen on join attempts.
#define CLIENT_LOADINGSCREEN
@@ -650,7 +643,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define NOCLIPCAM
/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define
#define NO_MIDI
// yall didnt properly disable it so it always worked lol (:
//#define NO_MIDI
/// Sprite rotation
#define ROTSPRITE
+1 -8
View File
@@ -71,7 +71,6 @@ extern boolean majormods;
extern UINT16 mainwads;
extern boolean savemoddata; // This mod saves time/emblem data.
extern boolean imcontinuing; // Temporary flag while continuing
extern boolean metalrecording;
#define ATTACKING_NONE 0
#define ATTACKING_RECORD 1
@@ -102,13 +101,8 @@ extern boolean forceresetplayers, deferencoremode;
// Internal parameters for sound rendering.
// ========================================
#ifdef NO_MIDI
#define midi_disabled true
#else
extern boolean midi_disabled;
#endif
extern boolean sound_disabled;
extern boolean digital_disabled;
extern boolean music_disabled;
// =========================
// Status flags for refresh.
@@ -574,7 +568,6 @@ extern consvar_t cv_forceskin; // force clients to use the server's skin
extern consvar_t cv_downloading; // allow clients to downloading WADs.
extern consvar_t cv_nettimeout; // SRB2Kart: Advanced server options menu
extern consvar_t cv_jointimeout;
extern consvar_t cv_maxping;
extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
extern INT32 serverplayer;
extern INT32 adminplayers[MAXPLAYERS];
+2 -2
View File
@@ -148,8 +148,8 @@ int strlwr(char *n); // from dosstr.c
#include <stddef.h> // for size_t
#ifndef SRB2_HAVE_STRLCPY
size_t strlcat(char *dst, const char *src, size_t siz);
size_t strlcpy(char *dst, const char *src, size_t siz);
size_t strlcat(char *dst, const char *src, size_t dsize);
size_t strlcpy(char *dst, const char *src, size_t dsize);
#endif
// Macro for use with char foo[FOOSIZE+1] type buffers.
+8 -6
View File
@@ -34,6 +34,8 @@
#include "y_inter.h"
#include "m_cond.h"
#include "r_fps.h" // R_GetTimeFrac
// Stage of animation:
// 0 = text, 1 = art screen
static INT32 finalecount;
@@ -170,8 +172,8 @@ static void F_SkyScroll(INT32 scrollspeed)
w = (vid.width / vid.dupx)<<FRACBITS;
// The scroll offset MUST be clamped before shifting by FRACBITS, or else it'll overflow in about 3 minutes
animtimer = ((((finalecount * scrollspeed) % (pat->width*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
anim2 = (pat2->width<<FRACBITS) - ((((finalecount * scrollspeed) % (pat2->width*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
animtimer = ((((finalecount * scrollspeed) % (pat->width*16))<<FRACBITS) + (R_GetTimeFrac(RTF_MENU) * scrollspeed))/16;
anim2 = (pat2->width<<FRACBITS) - ((((finalecount * scrollspeed) % (pat2->width*16))<<FRACBITS) + (R_GetTimeFrac(RTF_MENU) * scrollspeed))/16;
// SRB2Kart: F_DrawPatchCol is over-engineered; recoded to be less shitty and error-prone
if (rendermode != render_none)
@@ -948,7 +950,7 @@ void F_GameEndTicker(void)
if (timetonext > 0)
timetonext--;
else
D_StartTitle();
G_EndGame();
}
// ==============
@@ -1003,7 +1005,7 @@ void F_TitleScreenDrawer(void)
if (finalecount >= 20)
V_DrawSmallScaledPatch(84, 87, 0, ttkart);
else if (finalecount >= 10)
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetMenuUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetTimeFrac(RTF_MENU)), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
}
else if (finalecount < 52)
{
@@ -1019,8 +1021,8 @@ void F_TitleScreenDrawer(void)
F_SkyScroll(titlescrollspeed);
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetMenuUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetMenuUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetTimeFrac(RTF_MENU), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetTimeFrac(RTF_MENU), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
if (transval)
V_DrawFadeScreen(120, 10 - transval);
+154 -63
View File
@@ -341,6 +341,7 @@ char *refreshdirname = NULL;
// direrror is set if there was an error.
INT32 pathisdirectory(const char *path)
{
#ifndef _WIN32
struct stat fsstat;
if (stat(path, &fsstat) < 0)
@@ -348,39 +349,67 @@ INT32 pathisdirectory(const char *path)
return -1;
}
else if (S_ISDIR(fsstat.st_mode))
{
return 1;
}
#else
DWORD fileattr = GetFileAttributes(path);
if (fileattr == INVALID_FILE_ATTRIBUTES)
{
return -1;
}
else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
{
return 1;
}
#endif
return 0;
}
// skip those folders, they will not have any addons
static const char *exclude_paths[] = {
"logs",
"luafiles",
"replay",
"mdls",
"gifs",
"screenshots",
NULL
};
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth)
{
filestatus_t retval = FS_NOTFOUND;
DIR **dirhandle;
struct dirent *dent;
#ifndef _WIN32
struct stat fsstat;
#endif
int found = 0;
char *searchname = strdup(filename);
char *searchname;
int depthleft = maxsearchdepth;
char searchpath[1024];
size_t *searchpathindex;
dirhandle = (DIR**) malloc(maxsearchdepth * sizeof(DIR*));
searchpathindex = (size_t *) malloc(maxsearchdepth * sizeof(size_t));
dirhandle = (DIR**)malloc(maxsearchdepth * sizeof(DIR*));
searchpathindex = (size_t *)malloc(maxsearchdepth * sizeof(size_t));
strcpy(searchpath,startpath);
strcpy(searchpath, startpath);
searchpathindex[--depthleft] = strlen(searchpath) + 1;
dirhandle[depthleft] = opendir(searchpath);
if (dirhandle[depthleft] == NULL)
{
free(searchname);
free(dirhandle);
free(searchpathindex);
return FS_NOTFOUND;
}
searchname = strdup(filename);
if (searchpath[searchpathindex[depthleft]-2] != PATHSEP[0])
{
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
@@ -412,62 +441,88 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
// okay, now we actually want searchpath to incorporate d_name
strcpy(&searchpath[searchpathindex[depthleft]], dent->d_name);
#if defined(__linux__) || defined(__FreeBSD__)
if (dent->d_type == DT_UNKNOWN && lstat(searchpath, &fsstat) == 0)
{
if (S_ISDIR(fsstat.st_mode))
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
if (dent->d_type == DT_UNKNOWN || dent->d_type == DT_LNK)
if (stat(searchpath, &fsstat) == 0 && S_ISDIR(fsstat.st_mode))
dent->d_type = DT_DIR;
else if (S_ISLNK(fsstat.st_mode))
dent->d_type = DT_LNK;
}
// Symlinks aren't always directory symlinks. Dunno if this would resolve recursive
// symlinks, but i think stat already does that
if (dent->d_type == DT_LNK && stat(searchpath,&fsstat) == 0 && !S_ISDIR(fsstat.st_mode))
{
dent->d_type = DT_UNKNOWN;
}
// Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups.
// FIXME: should we also follow symlinks?
if ((dent->d_type == DT_DIR && depthleft) || (dent->d_type == DT_LNK && depthleft))
if (dent->d_type == DT_DIR)
#elif defined (_WIN32)
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
DWORD fileattr = GetFileAttributes(searchpath);
if (fileattr == INVALID_FILE_ATTRIBUTES)
continue; // was the file (re)moved? can't stat it
if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
#else
if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
; // was the file (re)moved? can't stat it
else if (S_ISDIR(fsstat.st_mode) && depthleft)
continue; // was the file (re)moved? can't stat it
if (S_ISDIR(fsstat.st_mode))
#endif
{
searchpathindex[--depthleft] = strlen(searchpath) + 1;
dirhandle[depthleft] = opendir(searchpath);
// I am a folder!
if (!dirhandle[depthleft])
if (!depthleft)
continue; // No additional folder delving permitted...
const char **path = exclude_paths;
if (depthleft == maxsearchdepth-1)
{
// can't open it... maybe no read-permissions
// go back to previous dir
depthleft++;
// When we're at the root of the search, we exclude certain folders.
boolean skipfolder = false;
for (; *path != NULL; path++)
{
if (strcasecmp(*path, dent->d_name) == 0)
{
skipfolder = true;
break;
}
}
if (skipfolder)
{
continue;
}
}
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
searchpath[searchpathindex[depthleft]] = 0;
if (strcasecmp(".git", dent->d_name) // sanity if you're weird like me
&& (dirhandle[depthleft-1] = opendir(searchpath)) != NULL)
{
// Got read permissions!
searchpathindex[--depthleft] = strlen(searchpath) + 1;
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
searchpath[searchpathindex[depthleft]] = 0;
}
continue;
}
else if (!strcasecmp(searchname, dent->d_name))
// I am a file!
if (strcasecmp(searchname, dent->d_name))
continue; // Not what we're looking for!
switch (checkfilemd5(searchpath, wantedmd5sum))
{
switch (checkfilemd5(searchpath, wantedmd5sum))
{
case FS_FOUND:
if (completepath)
strcpy(filename, searchpath);
else
strcpy(filename, dent->d_name);
retval = FS_FOUND;
found = 1;
break;
case FS_MD5SUMBAD:
retval = FS_MD5SUMBAD;
break;
default: // prevent some compiler warnings
break;
}
case FS_FOUND:
if (completepath)
strcpy(filename, searchpath);
else
strcpy(filename, dent->d_name);
retval = FS_FOUND;
found = 1;
break;
case FS_MD5SUMBAD:
retval = FS_MD5SUMBAD;
break;
default: // prevent some compiler warnings
break;
}
}
@@ -644,7 +699,9 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
{
DIR *dirhandle;
struct dirent *dent;
#ifndef _WIN32
struct stat fsstat;
#endif
size_t pos = 0, folderpos = 0, numfolders = 0;
char *tempname = NULL;
@@ -680,30 +737,44 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
if (!dent)
break;
else if (dent->d_name[0]=='.' &&
(dent->d_name[1]=='\0' ||
(dent->d_name[1]=='.' &&
dent->d_name[2]=='\0')))
(dent->d_name[1]=='\0' ||
(dent->d_name[1]=='.' &&
dent->d_name[2]=='\0')))
continue; // we don't want to scan uptree
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
#ifndef _WIN32
if (stat(menupath, &fsstat) < 0)
#else
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
DWORD fileattr = GetFileAttributes(menupath);
if (fileattr == INVALID_FILE_ATTRIBUTES)
#endif
; // was the file (re)moved? can't stat it
else // is a file or directory
{
#ifndef _WIN32
if (!S_ISDIR(fsstat.st_mode)) // file
#else
if (!(fileattr & FILE_ATTRIBUTE_DIRECTORY))
#endif
{
size_t len = strlen(dent->d_name)+1;
if (replayhut)
{
if (strcasecmp(".lmp", dent->d_name+len-5)) continue; // Not a replay
if (strcasecmp(".lmp", dent->d_name+len-5))
continue; // Not a replay
}
else if (!cv_addons_showall.value)
{
UINT8 ext;
for (ext = 0; ext < NUM_EXT_TABLE; ext++)
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) break; // extension comparison
if (ext == NUM_EXT_TABLE) continue; // not an addfile-able (or exec-able) file
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
break; // extension comparison
if (ext == NUM_EXT_TABLE)
continue; // not an addfile-able (or exec-able) file
}
}
else // directory
@@ -748,14 +819,20 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
if (!dent)
break;
else if (dent->d_name[0]=='.' &&
(dent->d_name[1]=='\0' ||
(dent->d_name[1]=='.' &&
dent->d_name[2]=='\0')))
(dent->d_name[1]=='\0' ||
(dent->d_name[1]=='.' &&
dent->d_name[2]=='\0')))
continue; // we don't want to scan uptree
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
#ifndef _WIN32
if (stat(menupath, &fsstat) < 0)
#else
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
DWORD fileattr = GetFileAttributes(menupath);
if (fileattr == INVALID_FILE_ATTRIBUTES)
#endif
; // was the file (re)moved? can't stat it
else // is a file or directory
{
@@ -764,20 +841,31 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
UINT8 ext = EXT_FOLDER;
UINT8 folder;
#ifndef _WIN32
if (!S_ISDIR(fsstat.st_mode)) // file
#else
if (!(fileattr & FILE_ATTRIBUTE_DIRECTORY))
#endif
{
if (!((numfolders+pos) < sizecoredirmenu)) continue; // crash prevention
if (!((numfolders+pos) < sizecoredirmenu))
continue; // crash prevention
if (replayhut)
{
if (strcasecmp(".lmp", dent->d_name+len-5)) continue; // Not a replay
if (strcasecmp(".lmp", dent->d_name+len-5))
continue; // Not a replay
ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this...
}
else
{
for (; ext < NUM_EXT_TABLE; ext++)
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) break; // extension comparison
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value) continue; // not an addfile-able (or exec-able) file
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
break; // extension comparison
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value)
continue; // not an addfile-able (or exec-able) file
ext += EXT_START; // moving to be appropriate position
if (ext >= EXT_LOADSTART)
@@ -794,6 +882,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
if (strcmp(dent->d_name, filenamebuf[i]))
continue;
if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
continue;
@@ -820,9 +909,11 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
if (!(temp = Z_Malloc((len+DIR_STRING+folder) * sizeof (char), PU_STATIC, NULL)))
I_Error("preparefilemenu(): could not create file entry.");
temp[DIR_TYPE] = ext;
temp[DIR_LEN] = (UINT8)(len);
strlcpy(temp+DIR_STRING, dent->d_name, len);
if (folder)
{
strcpy(temp+len, PATHSEP);
+1 -2
View File
@@ -30,8 +30,7 @@ extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_sh
*/
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
boolean completepath, int maxsearchdepth);
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth);
#define menudepth 20
+24 -442
View File
@@ -82,12 +82,6 @@ static boolean demosynced = true; // console warning message
struct demovars_s demo;
boolean metalrecording; // recording as metal sonic
mobj_t *metalplayback;
static UINT8 *metalbuffer = NULL;
static UINT8 *metal_p;
static UINT16 metalversion;
consvar_t cv_resyncdemo = {"resyncdemo", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// extra data stuff (events registered this frame while recording)
@@ -196,46 +190,10 @@ static ticcmd_t oldcmd[MAXPLAYERS];
#define EZT_SPRITE 0x40 // Changed sprite set completely out of PLAY (NiGHTS, SOCs, whatever)
#define EZT_KART 0x80 // SRB2Kart: Changed current held item/quantity and bumpers for battle
static mobj_t oldmetal, oldghost[MAXPLAYERS];
static mobj_t oldghost[MAXPLAYERS];
static void G_ResetDemoPlayback(char *pdemoname);
void G_SaveMetal(UINT8 **buffer)
{
I_Assert(buffer != NULL && *buffer != NULL);
WRITEUINT32(*buffer, metal_p - metalbuffer);
}
void G_LoadMetal(UINT8 **buffer)
{
I_Assert(buffer != NULL && *buffer != NULL);
G_DoPlayMetal();
metal_p = metalbuffer + READUINT32(*buffer);
}
ticcmd_t *G_CopyTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
{
return M_Memcpy(dest, src, n*sizeof(*src));
}
ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
{
size_t i;
for (i = 0; i < n; i++)
{
dest[i].forwardmove = src[i].forwardmove;
dest[i].sidemove = src[i].sidemove;
dest[i].angleturn = SHORT(src[i].angleturn);
dest[i].aiming = (INT16)SHORT(src[i].aiming);
dest[i].buttons = (UINT16)SHORT(src[i].buttons);
dest[i].driftturn = (INT16)SHORT(src[i].driftturn);
dest[i].latency = (INT16)SHORT(src[i].latency);
}
return dest;
}
// Finds a skin with the closest stats if the expected skin doesn't exist.
static INT32 GetSkinNumClosestToStats(UINT8 kartspeed, UINT8 kartweight)
{
@@ -700,13 +658,6 @@ void G_WriteAllGhostTics(void)
if (multiplayer && ((counter % cv_netdemosyncquality.value) != 0)) // Only write 1 in this many ghost datas per tic to cut down on multiplayer replay size.
continue;
if (((ghostext[i].flags && (ghostext[i].flags & EZT_HIT)) || ghostext[i].hits)
&& !ghostext[i].hitlist) // hitlist might be freed during resynch, beware PU_LEVEL!
{
ghostext[i].hits = 0;
continue;
}
CHECKSPACE(1);
WRITEUINT8(demobuf.p, i);
@@ -914,7 +865,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
P_SetTarget(ghostext[playernum].hitlist+i, NULL);
}
Z_Free(ghostext[playernum].hitlist);
ghostext[playernum].hits = 0;
ghostext[playernum].hitlist = NULL;
}
if (ghostext[playernum].flags & EZT_SPRITE)
@@ -1295,15 +1248,15 @@ void G_GhostTicker(void)
{
switch (ziptic & EZT_THOKMASK)
{
case EZT_THOK:
type = (UINT32)mobjinfo[MT_PLAYER].painchance;
break;
case EZT_SPIN:
type = (UINT32)mobjinfo[MT_PLAYER].damage;
break;
case EZT_REV:
type = (UINT32)mobjinfo[MT_PLAYER].raisestate;
break;
case EZT_THOK:
type = (UINT32)mobjinfo[MT_PLAYER].painchance;
break;
case EZT_SPIN:
type = (UINT32)mobjinfo[MT_PLAYER].damage;
break;
case EZT_REV:
type = (UINT32)mobjinfo[MT_PLAYER].raisestate;
break;
}
}
if (type != -1)
@@ -1601,216 +1554,6 @@ void G_ConfirmRewind(tic_t rewindtime)
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
void G_ReadMetalTic(mobj_t *metal)
{
UINT8 ziptic;
UINT16 speed;
UINT8 statetype;
if (!metal_p)
return;
ziptic = READUINT8(metal_p);
// Read changes from the tic
if (ziptic & GZT_XYZ)
{
oldmetal.x = READFIXED(metal_p);
oldmetal.y = READFIXED(metal_p);
oldmetal.z = READFIXED(metal_p);
P_MoveOrigin(metal, oldmetal.x, oldmetal.y, oldmetal.z);
oldmetal.x = metal->x;
oldmetal.y = metal->y;
oldmetal.z = metal->z;
}
else
{
if (ziptic & GZT_MOMXY)
{
oldmetal.momx = READINT16(metal_p)<<8;
oldmetal.momy = READINT16(metal_p)<<8;
}
if (ziptic & GZT_MOMZ)
oldmetal.momz = READINT16(metal_p)<<8;
oldmetal.x += oldmetal.momx;
oldmetal.y += oldmetal.momy;
oldmetal.z += oldmetal.momz;
}
if (ziptic & GZT_ANGLE)
oldmetal.angle = READUINT8(metal_p)<<24;
if (ziptic & GZT_SPRITE)
metal_p++; // Currently unused. (Metal Sonic figures out what he's doing his own damn self.)
// Set movement, position, and angle
// oldmetal contains where you're supposed to be.
metal->momx = oldmetal.momx;
metal->momy = oldmetal.momy;
metal->momz = oldmetal.momz;
P_UnsetThingPosition(metal);
metal->x = oldmetal.x;
metal->y = oldmetal.y;
metal->z = oldmetal.z;
P_SetThingPosition(metal);
metal->angle = oldmetal.angle;
if (ziptic & GZT_EXTRA)
{ // But wait, there's more!
ziptic = READUINT8(metal_p);
if (ziptic & EZT_FLIP)
metal->eflags ^= MFE_VERTICALFLIP;
if (ziptic & EZT_SCALE)
{
metal->destscale = READFIXED(metal_p);
if (metal->destscale != metal->scale)
P_SetScale(metal, metal->destscale);
}
}
// Calculates player's speed based on distance-of-a-line formula
speed = FixedDiv(P_AproxDistance(oldmetal.momx, oldmetal.momy), metal->scale)>>FRACBITS;
// Use speed to decide an appropriate state
if (speed > 20) // default skin runspeed
statetype = 2;
else if (speed > 1) // stopspeed
statetype = 1;
else
statetype = 0;
// Set state
if (statetype != metal->threshold)
{
switch (statetype)
{
case 2: // run
P_SetMobjState(metal,metal->info->meleestate);
break;
case 1: // walk
P_SetMobjState(metal,metal->info->seestate);
break;
default: // stand
P_SetMobjState(metal,metal->info->spawnstate);
break;
}
metal->threshold = statetype;
}
// TODO: Modify state durations based on movement speed, similar to players?
if (*metal_p == DEMOMARKER)
{
// end of demo data stream
G_StopMetalDemo();
return;
}
}
void G_WriteMetalTic(mobj_t *metal)
{
UINT8 ziptic = 0;
UINT8 *ziptic_p;
if (!demobuf.p) // demobuf.p will be NULL until the race start linedef executor is triggered!
return;
ziptic_p = demobuf.p++; // the ziptic, written at the end of this function
#define MAXMOM (0xFFFF<<8)
// GZT_XYZ is only useful if you've moved 256 FRACUNITS or more in a single tic.
if (abs(metal->x-oldmetal.x) > MAXMOM
|| abs(metal->y-oldmetal.y) > MAXMOM
|| abs(metal->z-oldmetal.z) > MAXMOM)
{
oldmetal.x = metal->x;
oldmetal.y = metal->y;
oldmetal.z = metal->z;
WRITEFIXED(demobuf.p,oldmetal.x);
WRITEFIXED(demobuf.p,oldmetal.y);
WRITEFIXED(demobuf.p,oldmetal.z);
ziptic |= GZT_XYZ;
}
else
{
// For moving normally:
// Store one full byte of movement, plus one byte of fractional movement.
INT16 momx = (INT16)((metal->x-oldmetal.x)>>8);
INT16 momy = (INT16)((metal->y-oldmetal.y)>>8);
if (momx != oldmetal.momx
|| momy != oldmetal.momy)
{
oldmetal.momx = momx;
oldmetal.momy = momy;
WRITEINT16(demobuf.p,momx);
WRITEINT16(demobuf.p,momy);
ziptic |= GZT_MOMXY;
}
momx = (INT16)((metal->z-oldmetal.z)>>8);
if (momx != oldmetal.momz)
{
oldmetal.momz = momx;
WRITEINT16(demobuf.p,momx);
ziptic |= GZT_MOMZ;
}
// This SHOULD set oldmetal.x/y/z to match metal->x/y/z
// but it keeps the fractional loss of one byte,
// so it will hopefully be made up for in future tics.
oldmetal.x += oldmetal.momx<<8;
oldmetal.y += oldmetal.momy<<8;
oldmetal.z += oldmetal.momz<<8;
}
#undef MAXMOM
// Only store the 8 most relevant bits of angle
// because exact values aren't too easy to discern to begin with when only 8 angles have different sprites
// and it does not affect movement at all anyway.
if (metal->angle>>24 != oldmetal.angle)
{
oldmetal.angle = metal->angle>>24;
WRITEUINT8(demobuf.p,oldmetal.angle);
ziptic |= GZT_ANGLE;
}
// Metal Sonic does not need our state changes.
// ... currently.
{
UINT8 *exttic_p = NULL;
UINT8 exttic = 0;
if ((metal->eflags & MFE_VERTICALFLIP) != (oldmetal.eflags & MFE_VERTICALFLIP))
{
if (!exttic_p)
exttic_p = demobuf.p++;
exttic |= EZT_FLIP;
oldmetal.eflags ^= MFE_VERTICALFLIP;
}
if (metal->scale != oldmetal.scale)
{
if (!exttic_p)
exttic_p = demobuf.p++;
exttic |= EZT_SCALE;
WRITEFIXED(demobuf.p,metal->scale);
oldmetal.scale = metal->scale;
}
if (exttic_p)
{
*exttic_p = exttic;
ziptic |= GZT_EXTRA;
}
}
*ziptic_p = ziptic;
// attention here for the ticcmd size!
// latest demos with mouse aiming byte in ticcmd
if (demobuf.p >= demoend - 32)
{
G_StopMetalRecording(); // no more space
return;
}
}
//
// G_RecordDemo
//
@@ -1841,23 +1584,6 @@ void G_RecordDemo(const char *name)
}
}
void G_RecordMetal(void)
{
INT32 maxsize;
maxsize = cv_maxdemosize.value*1024*1024;
if (demobuf.buffer)
Z_Free(demobuf.buffer);
demobuf.p = NULL;
metalrecording = false;
demobuf.buffer = Z_Malloc(maxsize + 100*1024, PU_STATIC, NULL);
demoend = demobuf.buffer + maxsize;
if (demobuf.buffer)
metalrecording = true;
else
CONS_Alert(CONS_ERROR, "Failed to allocate demo buffer\n");
}
void G_BeginRecording(void)
{
UINT8 i, p;
@@ -2042,46 +1768,6 @@ void G_BeginRecording(void)
}
}
void G_BeginMetal(void)
{
mobj_t *mo = players[consoleplayer].mo;
if (demobuf.buffer == NULL)
{
CONS_Alert(CONS_ERROR, "No metal demo buffer allocated\n");
metalrecording = false;
return;
}
if (demobuf.p)
{
Z_Free(demobuf.buffer);
demobuf.buffer = NULL;
metalrecording = false;
return;
}
demobuf.p = demobuf.buffer;
// Write header.
M_Memcpy(demobuf.p, DEMOHEADER, 12); demobuf.p += 12;
WRITEUINT8(demobuf.p,VERSION);
WRITEUINT8(demobuf.p,SUBVERSION);
WRITEUINT16(demobuf.p,DEMOVERSION);
// demo checksum
demobuf.p += 16;
M_Memcpy(demobuf.p, "METL", 4); demobuf.p += 4;
// Set up our memory.
memset(&oldmetal,0,sizeof(oldmetal));
oldmetal.x = mo->x;
oldmetal.y = mo->y;
oldmetal.z = mo->z;
oldmetal.angle = mo->angle;
}
void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT32 val)
{
char temp[17];
@@ -2729,9 +2415,9 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
}
info_p += 12; // DEMOHEADER
info_p++; // VERSION
info_p++; // SUBVERSION
READUINT8(info_p);
READUINT8(info_p);
pdemoversion = READUINT16(info_p);
memset(pdemo->date, 0, sizeof(pdemo->date));
@@ -3683,74 +3369,6 @@ void G_TimeDemo(const char *name)
G_DeferedPlayDemo(name);
}
void G_DoPlayMetal(void)
{
lumpnum_t l;
mobj_t *mo = NULL;
thinker_t *th;
// it's an internal demo
if ((l = W_CheckNumForName(va("%sMS",G_BuildMapName(gamemap)))) == LUMPERROR)
{
CONS_Alert(CONS_WARNING, M_GetText("No bot recording for this map.\n"));
return;
}
else
metalbuffer = metal_p = W_CacheLumpNum(l, PU_STATIC);
// find metal sonic
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function != (actionf_p1)P_MobjThinker)
continue;
mo = (mobj_t *)th;
if (mo->type == MT_METALSONIC_RACE)
break;
}
if (!mo)
{
CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n"));
Z_Free(metalbuffer);
return;
}
// read demo header
metal_p += 12; // DEMOHEADER
metal_p++; // VERSION
metal_p++; // SUBVERSION
metalversion = READUINT16(metal_p);
switch(metalversion)
{
case DEMOVERSION: // latest always supported
break;
#ifdef DEMO_COMPAT_100
case 0x0001:
I_Error("You need to implement demo compat here, doofus! %s:%d", __FILE__, __LINE__);
#endif
// too old, cannot support.
default:
CONS_Alert(CONS_WARNING, M_GetText("Failed to load bot recording for this map, format version incompatible.\n"));
Z_Free(metalbuffer);
return;
}
metal_p += 16; // demo checksum
if (memcmp(metal_p, "METL", 4))
{
CONS_Alert(CONS_WARNING, M_GetText("Failed to load bot recording for this map, wasn't recorded in Metal format.\n"));
Z_Free(metalbuffer);
return;
} metal_p += 4; // "METL"
// read initial tic
memset(&oldmetal,0,sizeof(oldmetal));
oldmetal.x = mo->x;
oldmetal.y = mo->y;
oldmetal.z = mo->z;
oldmetal.angle = mo->angle;
metalplayback = mo;
}
void G_DoneLevelLoad(void)
{
CONS_Printf(M_GetText("Loaded level in %f sec\n"), (double)(I_GetTime() - demostarttime) / TICRATE);
@@ -3768,42 +3386,6 @@ void G_DoneLevelLoad(void)
===================
*/
// Stops metal sonic's demo. Separate from other functions because metal + replays can coexist
void G_StopMetalDemo(void)
{
// Metal Sonic finishing doesn't end the game, dammit.
Z_Free(metalbuffer);
metalbuffer = NULL;
metalplayback = NULL;
metal_p = NULL;
}
// Stops metal sonic recording.
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void)
{
boolean saved = false;
if (demobuf.p && demobuf.buffer != NULL)
{
UINT8 *p = demobuf.buffer+16; // checksum position
#ifdef NOMD5
UINT8 i;
WRITEUINT8(demobuf.p, DEMOMARKER); // add the demo end marker
for (i = 0; i < 16; i++, p++)
*p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
#else
WRITEUINT8(demobuf.p, DEMOMARKER); // add the demo end marker
md5_buffer((char *)p+16, demobuf.p - (p+16), (void *)p); // make a checksum of everything after the checksum in the file.
#endif
saved = FIL_WriteFile(va("%sMS.LMP", G_BuildMapName(gamemap)), demobuf.buffer, demobuf.p - demobuf.buffer); // finally output the file.
}
Z_Free(demobuf.buffer);
demobuf.buffer = NULL;
metalrecording = false;
if (saved)
I_Error("Saved to %sMS.LMP", G_BuildMapName(gamemap));
I_Error("Failed to save demo!");
}
// reset engine variable set for the demos
// called from stopdemo command, map command, and g_checkdemoStatus.
void G_StopDemo(void)
@@ -3869,8 +3451,8 @@ static void G_StopTimingDemo(void)
D_StartTitle();
}
boolean G_CheckDemoStatus(void)
// Clean up all ghosts
void G_FreeGhosts(void)
{
while (ghosts)
{
@@ -3879,8 +3461,12 @@ boolean G_CheckDemoStatus(void)
ghosts = next;
}
ghosts = NULL;
}
// DO NOT end metal sonic demos here
boolean G_CheckDemoStatus(void)
{
G_FreeGhosts();
if (demo.timing)
{
@@ -3927,18 +3513,15 @@ boolean G_CheckDemoStatus(void)
void G_ResetDemoRecording(void)
{
if (demobuf.buffer)
Z_Free(demobuf.buffer);
Z_Free(demobuf.buffer);
demobuf.buffer = NULL;
demo.recording = false;
}
static void G_ResetDemoPlayback(char *pdemoname)
{
if (pdemoname)
Z_Free(pdemoname);
if (demobuf.buffer)
Z_Free(demobuf.buffer);
Z_Free(pdemoname);
Z_Free(demobuf.buffer);
demobuf.buffer = NULL;
demo.playback = false;
if (demo.title)
@@ -4027,7 +3610,6 @@ void G_SaveDemo(void)
md5_buffer((char *)p+16, (demobuf.buffer + length) - (p+16), p);
#endif
if (FIL_WriteFile(va(pandf, srb2home, demoname), demobuf.buffer, demobuf.p - demobuf.buffer)) // finally output the file.
demo.savemode = DSM_SAVED;
+1 -12
View File
@@ -87,13 +87,9 @@ typedef struct menudemo_s {
} standings[MAXPLAYERS];
} menudemo_t;
extern mobj_t *metalplayback;
// Only called by startup code.
void G_RecordDemo(const char *name);
void G_RecordMetal(void);
void G_BeginRecording(void);
void G_BeginMetal(void);
// Only called by shutdown code.
void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT32 val);
@@ -147,11 +143,6 @@ void G_StoreRewindInfo(void);
void G_PreviewRewind(tic_t previewtime);
void G_ConfirmRewind(tic_t rewindtime);
void G_ReadMetalTic(mobj_t *metal);
void G_WriteMetalTic(mobj_t *metal);
void G_SaveMetal(UINT8 **buffer);
void G_LoadMetal(UINT8 **buffer);
// Your naming conventions are stupid and useless.
// There is no conflict here.
typedef struct demoghost {
@@ -174,11 +165,9 @@ void G_ResetDemoRecording(void);
void G_DoPlayDemo(char *defdemoname);
void G_TimeDemo(const char *name);
void G_AddGhost(char *defdemoname);
void G_FreeGhosts(void);
void G_UpdateStaffGhostName(lumpnum_t l);
void G_DoPlayMetal(void);
void G_DoneLevelLoad(void);
void G_StopMetalDemo(void);
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void);
void G_StopDemo(void);
boolean G_CheckDemoStatus(void);
void G_SaveDemo(void);
+170 -84
View File
@@ -310,6 +310,8 @@ consvar_t cv_chatbacktint = {"chatbacktint", "On", CV_SAVE, CV_OnOff, NULL, 0, N
static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}};
consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_chatcentertext = {"chatcentertext", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// Pause game upon window losing focus
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -628,7 +630,6 @@ const char *G_BuildMapName(INT32 map)
map = G_RandMap(G_TOLFlag(cv_newgametype.value), map, false, 0, false, NULL)+1;
}
if (map < 100 && map >= 0) // ...but why use signed integer in first place? idk but this prevents warning (and potential buffer overflow lol)
sprintf(&mapname[3], "%.2d", map);
else
@@ -806,6 +807,60 @@ 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
static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
{
INT32 axis = 0;
boolean turnleft, turnright;
const UINT8 forplayer = (ssplayer-1);
const boolean analogjoystickmove = cv_usejoystick[forplayer].value && !Joystick[forplayer].bGamepadStyle;
const boolean gamepadjoystickmove = cv_usejoystick[forplayer].value && Joystick[forplayer].bGamepadStyle;
turnright = InputDown(gc_turnright, ssplayer);
turnleft = InputDown(gc_turnleft, ssplayer);
axis = JoyAxis(AXISTURN, ssplayer);
if (encoremode)
{
turnright ^= turnleft; // swap these using three XORs
turnleft ^= turnright;
turnright ^= turnleft;
axis = -axis;
}
if (gamepadjoystickmove && axis != 0)
{
turnright = turnright || (axis > 0);
turnleft = turnleft || (axis < 0);
}
cmd->driftturn = 0;
// let movement keys cancel each other out
if (turnright && !(turnleft))
{
cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[1]));
}
else if (turnleft && !(turnright))
{
cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[1]));
}
if (analogjoystickmove && axis != 0)
{
// JOYAXISRANGE should be 1023 (divide by 1024)
cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10)));
}
if (cv_mouseturn.value)
{
//THIS WORKS WTF????????
cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8)));
}
}
//
// G_BuildLocalTiccmd
// extremely basic cut down ticcmd builder
@@ -839,6 +894,16 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
CHECKINPUT(gc_accelerate, AXISMOVE, BT_ACCELERATE);
CHECKINPUT(gc_brake, AXISBRAKE, BT_BRAKE);
// for lua menus during spec
axis = JoyAxis(AXISAIM, ssplayer);
if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0))
cmd->buttons |= BT_FORWARD;
if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_BACKWARD;
G_HandleLocalDriftturn(cmd, ssplayer);
//
#undef CHECKINPUT
moveinput = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer)
@@ -883,7 +948,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
return;
const UINT8 forplayer = (ssplayer-1);
player_t *player = ((ssplayer == 1) ? &players[consoleplayer] : &players[displayplayers[forplayer]]);
player_t *player = P_GetLocalPlayerForNum(forplayer);
camera_t *thiscam = &camera[forplayer];
const boolean freecam = camera[forplayer].freecam;
@@ -896,22 +961,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
th = turnheld[forplayer];
rd = resetdown[forplayer];
switch (ssplayer)
{
case 2:
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1);
break;
case 3:
G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1);
break;
case 4:
G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1);
break;
case 1:
default:
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
break;
}
memset(cmd, 0, sizeof(ticcmd_t));
// why build a ticcmd if we're paused?
// Or, for that matter, if we're being reborn.
@@ -1162,6 +1212,27 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
}
}
ticcmd_t *G_CopyTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
{
return M_Memcpy(dest, src, n*sizeof(*src));
}
ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
{
size_t i;
for (i = 0; i < n; i++)
{
dest[i].forwardmove = src[i].forwardmove;
dest[i].sidemove = src[i].sidemove;
dest[i].angleturn = SHORT(src[i].angleturn);
dest[i].aiming = (INT16)SHORT(src[i].aiming);
dest[i].buttons = (UINT16)SHORT(src[i].buttons);
dest[i].driftturn = (INT16)SHORT(src[i].driftturn);
dest[i].latency = (INT16)SHORT(src[i].latency);
}
return dest;
}
//
// G_DoLoadLevel
//
@@ -1195,7 +1266,7 @@ static void G_DoLoadLevel(boolean resetplayer)
}
// Setup the level.
if (!P_SetupLevel(false,false))
if (!P_SetupLevel(false, false))
{
// fail so reset game stuff
Command_ExitGame_f();
@@ -1793,11 +1864,11 @@ void G_Ticker(boolean run)
{
for (i = 0; i < MAXPLAYERS; i++) // read/write demo and check turbo cheat
{
cmd = &players[i].cmd;
if (!playeringame[i])
continue;
cmd = &players[i].cmd;
//@TODO all this throwdir stuff shouldn't be here! But it stays for now to maintain 1.0.4 compat...
// Remove for 1.1!
@@ -2355,23 +2426,23 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
{
if (nummapthings)
{
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_ERROR, "No player spawns found, spawning at the first mapthing!\n");
}
spawnpoint = &mapthings[0];
}
else
{
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n"));
//P_MovePlayerToSpawn handles this fine if the spawnpoint is NULL.
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_ERROR, "No player spawns found, spawning at the origin!\n");
//P_MovePlayerToSpawn handles this fine if the spawnpoint is NULL.
}
}
}
P_MovePlayerToSpawn(playernum, spawnpoint);
LUA_HookPlayer(&players[playernum], HOOK(PlayerSpawn)); // Lua hook for player spawning :)
@@ -2383,11 +2454,11 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
if (!numredctfstarts && !numbluectfstarts) //why even bother, eh?
{
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No CTF starts in this map!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "No CTF starts in this map!\n");
}
return NULL;
}
@@ -2395,11 +2466,11 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
{
if (!numredctfstarts)
{
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Red Team starts in this map!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "No Red Team starts in this map!\n");
}
return NULL;
}
@@ -2410,22 +2481,22 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
return redctfstarts[i];
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Red Team starts!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "Could not spawn at any Red Team starts!\n");
}
return NULL;
}
else if (!players[playernum].ctfteam || players[playernum].ctfteam == 2) //blue
{
if (!numbluectfstarts)
{
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Blue Team starts in this map!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "No Blue Team starts in this map!\n");
}
return NULL;
}
@@ -2435,11 +2506,12 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
if (G_CheckSpot(playernum, bluectfstarts[i]))
return bluectfstarts[i];
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Blue Team starts!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "Could not spawn at any Blue Team starts!\n");
}
return NULL;
}
//should never be reached but it gets stuff to shut up
@@ -2458,19 +2530,20 @@ mapthing_t *G_FindMatchStart(INT32 playernum)
if (G_CheckSpot(playernum, deathmatchstarts[i]))
return deathmatchstarts[i];
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "Could not spawn at any Deathmatch starts!\n");
}
return NULL;
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "No Deathmatch starts in this map!\n");
}
return NULL;
}
@@ -2534,19 +2607,19 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
// Just spawn there.
//return playerstarts[0];
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "Could not spawn at any Race starts!\n");
}
return NULL;
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n"));
if (P_IsLocalPlayerNum(playernum))
{
CONS_Alert(CONS_WARNING, "No Race starts in this map!\n");
}
return NULL;
}
@@ -2980,11 +3053,6 @@ static void G_DoCompleted(void)
gameaction = ga_nothing;
if (metalplayback)
G_StopMetalDemo();
if (metalrecording)
G_StopMetalRecording();
K_StatRound();
for (i = 0; i < MAXPLAYERS; i++)
@@ -3311,8 +3379,26 @@ void G_EndGame(void)
}
}
// 1100 or competitive multiplayer, so go back to title screen.
D_StartTitle();
if (netgame)
{
G_SetGamestate(GS_WAITINGPLAYERS); // hack to prevent a command repeat
if (server)
{
char mapname[6];
strlcpy(mapname, G_BuildMapName(spstage_start), sizeof (mapname));
strlwr(mapname);
mapname[5] = '\0';
COM_BufAddText(va("map %s\n", mapname));
}
return;
}
// Time to return to the menu.
Command_ExitGame_f();
}
//
+1 -1
View File
@@ -49,7 +49,7 @@ extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard di
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_compactscoreboard*/;
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/;
extern consvar_t cv_songcredits;
extern consvar_t cv_showfreeplay;
extern consvar_t cv_growmusic, cv_supermusic;
+73 -38
View File
@@ -99,7 +99,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
polygonArrayAllocSize *= 2;
polygonArray = realloc(polygonArray, polygonArrayAllocSize * sizeof(PolygonArrayEntry));
// also need to redo the index array, dont need to copy it though
polygonArraySorted = realloc(polygonArraySorted, polygonArrayAllocSize * sizeof(PolygonArrayEntry*));
free(polygonArraySorted);
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
}
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
@@ -118,8 +119,38 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
polygonArray[polygonArraySize].texture = current_texture;
polygonArray[polygonArraySize].shader = (shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target;
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
// default to maximum value so skybox ánd horizon lines come first
polygonArray[polygonArraySize].hash = INT32_MIN+polygonArraySize;
polygonArraySize++;
if (!(PolyFlags & PF_NoTexture) && !horizonSpecial)
{
// use FNV-1a to hash polygons for later sorting.
INT32 hash = 0x811c9dc5;
#define DIGEST(h, x) h ^= (x); h *= 0x01000193
if (current_texture)
{
DIGEST(hash, current_texture->downloaded);
}
DIGEST(hash, PolyFlags);
DIGEST(hash, pSurf->PolyColor.rgba);
if (cv_glshaders.value && gl_shadersavailable)
{
DIGEST(hash, shader_target);
DIGEST(hash, pSurf->TintColor.rgba);
DIGEST(hash, pSurf->FadeColor.rgba);
DIGEST(hash, pSurf->LightInfo.light_level);
DIGEST(hash, pSurf->LightInfo.fade_start);
DIGEST(hash, pSurf->LightInfo.fade_end);
DIGEST(hash, pSurf->LightInfo.directional);
}
#undef DIGEST
// remove the sign bit to ensure that skybox and horizon line comes first.
polygonArray[polygonArraySize-1].hash = (hash & INT32_MAX);
}
memcpy(&unsortedVertexArray[unsortedVertexArraySize], pOutVerts, iNumPts * sizeof(FOutVector));
unsortedVertexArraySize += iNumPts;
}
@@ -345,52 +376,56 @@ void HWR_RenderBatches(void)
{
// check if a state change is required, set the change bools and next vars
const PolygonArrayEntry *nextEntry = polygonArraySorted[polygonReadPos];
nextShader = nextEntry->shader;
nextTexture = nextEntry->texture;
nextPolyFlags = nextEntry->polyFlags;
nextSurfaceInfo = nextEntry->surf;
if (nextPolyFlags & PF_NoTexture)
nextTexture = 0;
if (currentShader != nextShader && HWR_UseShader())
if (entry->hash != nextEntry->hash)
{
changeState = true;
changeShader = true;
}
nextShader = nextEntry->shader;
nextTexture = nextEntry->texture;
nextPolyFlags = nextEntry->polyFlags;
nextSurfaceInfo = nextEntry->surf;
if (currentTexture != nextTexture)
{
changeState = true;
changeTexture = true;
}
if (nextPolyFlags & PF_NoTexture)
nextTexture = 0;
if (currentPolyFlags != nextPolyFlags)
{
changeState = true;
changePolyFlags = true;
}
if (HWR_UseShader())
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
currentSurfaceInfo.LightInfo.directional != nextSurfaceInfo.LightInfo.directional)
if (currentShader != nextShader && HWR_UseShader())
{
changeState = true;
changeSurfaceInfo = true;
changeShader = true;
}
}
else
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba)
if (currentTexture != nextTexture)
{
changeState = true;
changeSurfaceInfo = true;
changeTexture = true;
}
if (currentPolyFlags != nextPolyFlags)
{
changeState = true;
changePolyFlags = true;
}
if (HWR_UseShader())
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
currentSurfaceInfo.LightInfo.directional != nextSurfaceInfo.LightInfo.directional)
{
changeState = true;
changeSurfaceInfo = true;
}
}
else
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba)
{
changeState = true;
changeSurfaceInfo = true;
}
}
}
}
+1
View File
@@ -31,6 +31,7 @@ typedef struct
int shader;
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
boolean horizonSpecial;
INT32 hash;
} PolygonArrayEntry;
void HWR_StartBatching(void);
+15 -23
View File
@@ -36,7 +36,11 @@ extrasubsector_t *extrasubsectors = NULL;
// newsubsectors are subsectors without segs, added for the plane polygons
#define NEWSUBSECTORS 50
static size_t totsubsectors;
#ifdef PARANOIA
size_t addsubsector;
#else
static size_t addsubsector;
#endif
typedef struct
{
@@ -70,7 +74,7 @@ static INT32 totalsubsecpolys = 0;
static poly_t *HWR_AllocPoly(INT32 numpts)
{
poly_t *p;
size_t size = sizeof (poly_t) + sizeof (polyvertex_t) * numpts;
size_t size = sizeof(poly_t) + sizeof(polyvertex_t) * numpts;
p = Z_Malloc(size, PU_HWRPLANE, NULL);
p->numpts = numpts;
return p;
@@ -79,7 +83,7 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
static polyvertex_t *HWR_AllocVertex(void)
{
polyvertex_t *p;
size_t size = sizeof (polyvertex_t);
size_t size = sizeof(polyvertex_t);
p = Z_Malloc(size, PU_HWRPLANE, NULL);
return p;
}
@@ -175,9 +179,9 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
INT32 ps = -1, pe = -1;
INT32 nptfront, nptback;
polyvertex_t vs = {0,0,0};
polyvertex_t ve = {0,0,0};
polyvertex_t lastpv = {0,0,0};
polyvertex_t vs = {};
polyvertex_t ve = {};
polyvertex_t lastpv = {};
float fracs = 0.0f, frace = 0.0f; //used to tell which poly is on
// the front side of the bsp partition line
INT32 psonline = 0, peonline = 0;
@@ -349,8 +353,8 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
INT32 i, j;
polyvertex_t *pv;
INT32 nump = 0, ps, pe;
polyvertex_t vs = {0, 0, 0}, ve = {0, 0, 0},
p1 = {0, 0, 0}, p2 = {0, 0, 0};
polyvertex_t vs = {}, ve = {},
p1 = {}, p2 = {};
float fracs = 0.0f;
fdivline_t cutseg; // x, y, dx, dy as start of node_t struct
poly_t *temppoly;
@@ -937,22 +941,10 @@ static void AdjustSegs(void)
lseg->pv2 = pv;
}
// recompute length
{
float x,y;
const polyvertex_t *pv1 = (polyvertex_t *)lseg->pv1;
const polyvertex_t *pv2 = (polyvertex_t *)lseg->pv2;
x = pv2->x - pv1->x + 0.5f;
y = pv2->y - pv1->y + 0.5f;
lseg->flength = hypotf(x, y);
// BP: debug see this kind of segs
//if (nearv2 > NEARDIST*NEARDIST || nearv1 > NEARDIST*NEARDIST)
// lseg->length = 1;
}
lseg->pv1->x2 = FloatToFixed(lseg->pv1->x);
lseg->pv1->y2 = FloatToFixed(lseg->pv1->y);
lseg->pv2->x2 = FloatToFixed(lseg->pv2->x);
lseg->pv2->y2 = FloatToFixed(lseg->pv2->y);
}
}
}
+104 -121
View File
@@ -38,6 +38,8 @@ INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
RGBA_t mapPalette[256] = {0}; // the palette for the currently loaded level or menu etc.
static void HWR_FreeTextureColormaps(patch_t *patch);
static INT32 format2bpp(GLTextureFormat_t format)
{
switch (format)
@@ -320,15 +322,13 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
INT32 i, idx;
boolean skyspecial = false; // poor hack for Legacy large skies..
RGBA_t *palette;
texture = textures[texnum];
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
gltex->mipmap.format = textureformat;
// hack the Legacy skies..
if (UNLIKELY(strncmp(texture->name, "SKY", 3) == 0 &&
if (UNLIKELY(memcmp(texture->name, "SKY", 3) == 0 &&
(texture->name[4] == 0 || texture->name[5] == 0)))
{
skyspecial = true;
@@ -358,7 +358,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
INT32 j;
RGBA_t col;
palette = HWR_GetTexturePalette();
const RGBA_t *palette = HWR_GetTexturePalette();
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
@@ -440,7 +440,7 @@ void HWR_MakePatch(const patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipma
static size_t gl_numtextures = 0; // Texture count
static GLMapTexture_t *gl_textures; // For all textures
void HWR_FreeTextureData(patch_t *patch)
static void HWR_FreeTextureData(patch_t *patch)
{
GLPatch_t *glPatch;
@@ -451,8 +451,8 @@ void HWR_FreeTextureData(patch_t *patch)
if (vid.glstate == VID_GL_LIBRARY_LOADED)
GL_DeleteTexture(glPatch->mipmap);
if (glPatch->mipmap->data)
Z_Free(glPatch->mipmap->data);
Z_Free(glPatch->mipmap->data);
}
void HWR_FreeTexture(patch_t *patch)
@@ -479,7 +479,7 @@ void HWR_FreeTexture(patch_t *patch)
}
// Called by HWR_FreePatchCache.
void HWR_FreeTextureColormaps(patch_t *patch)
static void HWR_FreeTextureColormaps(patch_t *patch)
{
GLPatch_t *pat;
@@ -512,10 +512,8 @@ void HWR_FreeTextureColormaps(patch_t *patch)
pat->mipmap->nextcolormap = next->nextcolormap;
// Free image data from memory.
if (next->data)
Z_Free(next->data);
if (next->colormap)
Z_Free(next->colormap);
Z_Free(next->data);
Z_Free(next->colormap);
next->data = NULL;
next->colormap = NULL;
GL_DeleteTexture(next);
@@ -559,10 +557,10 @@ void HWR_ClearAllTextures(void)
HWR_FreePatchCache(true);
}
void HWR_FreeColormapCache(void)
/*static void HWR_FreeColormapCache(void)
{
HWR_FreePatchCache(false);
}
}*/
void HWR_InitMapTextures(void)
{
@@ -572,8 +570,7 @@ void HWR_InitMapTextures(void)
static void FreeMapTexture(GLMapTexture_t *tex)
{
GL_DeleteTexture(&tex->mipmap);
if (tex->mipmap.data)
Z_Free(tex->mipmap.data);
Z_Free(tex->mipmap.data);
tex->mipmap.data = NULL;
}
@@ -600,7 +597,6 @@ void HWR_FreeMapTextures(void)
static void HWR_PrecacheLevelFlats(void)
{
levelflat_t levelflat;
lumpnum_t lump;
size_t i, j;
INT32 k;
@@ -614,28 +610,22 @@ static void HWR_PrecacheLevelFlats(void)
{
sector_t *sec = &sectors[i];
// sector checked already?
if (sec->validcount == validcount)
continue;
sec->validcount = validcount;
// gotta check sector floor and ceiling
for (j = 0; j < 2; j++)
{
const boolean ceiling = (j == 0);
INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
levelflat = levelflats[pic];
const levelflat_t *levelflat = &levelflats[pic];
lump = levelflat.lumpnum;
lump = levelflat->lumpnum;
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
if (levelflat.speed) // it is an animated flat
if (levelflat->speed) // it is an animated flat
{
for (k = 1; k < levelflat.numpics; k++)
for (k = 1; k < levelflat->numpics; k++)
{
lump = levelflat.baselumpnum + k;
lump = levelflat->baselumpnum + k;
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
}
}
@@ -649,18 +639,18 @@ static void HWR_PrecacheLevelFlats(void)
// just load every flat in the level
for (i = 0; i < numlevelflats; i++)
{
levelflat = levelflats[i];
lump = levelflat.lumpnum;
const levelflat_t *levelflat = &levelflats[i];
lump = levelflat->lumpnum;
HWR_GetFlat(lump, false);
if (levelflat.speed) // it is an animated flat
if (!levelflat->speed) // is it an animated flat ?
continue;
for (k = 1; k < levelflat->numpics; k++)
{
for (k = 1; k < levelflat.numpics; k++)
{
lump = levelflat.baselumpnum + k;
HWR_GetFlat(lump, false);
}
lump = levelflat->baselumpnum + k;
HWR_GetFlat(lump, false);
}
}
}
@@ -670,52 +660,55 @@ static void HWR_PrecacheLevelTextures(void)
{
char *texturepresent;
anim_t *anim;
size_t i, j;
size_t i, j, f;
INT32 h;
texturepresent = calloc(numtextures, sizeof (*texturepresent));
if (texturepresent == NULL) I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel");
if (texturepresent == NULL)
I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel");
// Sky texture is always present.
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
// while the sky texture is stored like a wall texture, with a skynum dependent name.
texturepresent[skytexture] = 1;
HWR_GetTexture(skytexture, false);
for (i = 0; i < numlines; i++)
{
line_t *line = &lines[i];
const line_t *line = &lines[i];
#ifdef GLENCORE
const int noencoremap = ((line->flags & ML_TFERLINE) ? 2 : 1);
const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1);
#else
const int noencoremap = 1;
#endif
// line checked already?
if (line->validcount == validcount)
continue;
line->validcount = validcount;
// two sides
for (j = 0; j < 2; j++)
{
side_t *side = &sides[line->sidenum[j]];
// Single-side linedef
// check if single-sided linedef
if (line->sidenum[j] == 0xffff)
continue;
if (side->toptexture >= 0 && side->toptexture < numtextures)
const side_t *side = &sides[line->sidenum[j]];
const INT32 sidetex[] = {side->toptexture, side->midtexture, side->bottomtexture};
// gotta check from top to bottom uwu
for (f = 0; f < 3; f++)
{
texturepresent[side->toptexture] = 1|noencoremap;
}
if (side->midtexture >= 0 && side->midtexture < numtextures)
{
texturepresent[side->midtexture] = 1|noencoremap;
}
if (side->bottomtexture >= 0 && side->bottomtexture < numtextures)
{
texturepresent[side->bottomtexture] = 1|noencoremap;
const INT32 texnum = sidetex[f];
if (texnum < 0 || texnum >= numtextures || texturepresent[texnum])
continue;
texturepresent[texnum] = 1|noencoremap;
HWR_GetTexture(texnum, false);
#ifdef GLENCORE
if (noencoremap & 2)
HWR_GetTexture(texnum, true);
#endif
}
}
}
// check for animated textures
for (anim = anims; anim < lastanim; anim++)
{
if (!anim->istexture)
@@ -726,47 +719,21 @@ static void HWR_PrecacheLevelTextures(void)
if (!texpresent)
continue;
if (texpresent & 1)
for (h = 1; h < anim->numpics; h++)
{
for (h = 1; h < anim->numpics; h++)
if (texpresent & 1)
{
HWR_GetTexture(anim->basepic+h, false);
}
}
#ifdef GLENCORE
if (texpresent & 2)
{
for (h = 1; h < anim->numpics; h++)
if (texpresent & 2)
{
HWR_GetTexture(anim->basepic+h, true);
}
}
#endif
}
}
// Sky texture is always present.
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
// while the sky texture is stored like a wall texture, with a skynum dependent name.
texturepresent[skytexture] = 1;
for (i = 0; i < (unsigned)numtextures; i++)
{
const char texpresent = texturepresent[i];
if (!texpresent)
continue;
if (texpresent & 1)
{
HWR_GetTexture(i, false);
}
#ifdef GLENCORE
if (texpresent & 2)
{
HWR_GetTexture(i, true);
}
#endif
}
free(texturepresent);
}
@@ -775,21 +742,19 @@ static void HWR_PrecacheLevelSprites(void)
patch_t *spritepatch;
char *spritepresent;
size_t i, j, k;
lumpnum_t lump;
thinker_t *th;
mobj_t *mo;
spriteframe_t *sf;
spritepresent = calloc(numsprites, sizeof (*spritepresent));
if (spritepresent == NULL) I_Error("%s: Out of memory looking up sprites", "HWR_PrecacheLevel");
if (spritepresent == NULL)
I_Error("%s: Out of memory looking up sprites", "HWR_PrecacheLevel");
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function != (actionf_p1)P_MobjThinker)
continue;
mo = (mobj_t *)th;
const mobj_t *mo = (mobj_t *)th;
// ogl is weird
// for some reason it does not want to preload sprites with colormaps
@@ -807,10 +772,10 @@ static void HWR_PrecacheLevelSprites(void)
for (j = 0; j < sprites[i].numframes; j++)
{
sf = &sprites[i].spriteframes[j];
const spriteframe_t *sf = &sprites[i].spriteframes[j];
#define cacheang(a) {\
lump = sf->lumppat[a];\
const lumpnum_t lump = sf->lumppat[a];\
spritepatch = (patch_t *)W_CachePatchNum(lump, PU_SPRITE);\
if (spritepatch != NULL)\
HWR_GetPatch(spritepatch);\
@@ -892,12 +857,14 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
#endif
// Generate texture if missing from the cache
if (!gltex->mipmap.data && !gltex->mipmap.downloaded)
HWR_GenerateTexture(tex, gltex, noencore);
// If hardware does not have the texture, then call GL_SetTexture to upload it
if (!gltex->mipmap.downloaded)
{
if (!gltex->mipmap.data)
HWR_GenerateTexture(tex, gltex, noencore);
// If hardware does not have the texture, then call GL_SetTexture to upload it
GL_SetTexture(&gltex->mipmap);
}
HWR_SetCurrentTexture(&gltex->mipmap);
// The system-memory data can be purged now.
@@ -913,6 +880,7 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
size_t steppy;
#endif
size_t size, pflatsize;
boolean haschromakey = false;
// setup the texture info
glMipmap->format = GL_TEXFMT_P_8;
@@ -945,8 +913,7 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
break;
}
glMipmap->width = (UINT16)pflatsize;
glMipmap->height = (UINT16)pflatsize;
glMipmap->width = glMipmap->height = (UINT16)pflatsize;
// the flat raw data needn't be converted with palettized textures
W_ReadLump(flatlumpnum, Z_Malloc(size, PU_HWRCACHE, &glMipmap->data));
@@ -956,11 +923,25 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
for (steppy = 0; steppy < size; steppy++)
{
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
{
haschromakey = true;
continue;
}
flat[steppy] = glMipmap->colormap->source[flat[steppy]];
}
#endif
if (haschromakey)
{
const char *flatname = W_CheckNameForNum(flatlumpnum);
// hack for gba rainbow roads cyan floors
if (UNLIKELY(memcmp(flatname, "GBA_RRF5", 8) == 0 && flatname[8] == 0))
{
glMipmap->flags &= ~TF_CHROMAKEYED;
}
}
}
// Download a Doom 'flat' to the hardware cache and make it ready for use
@@ -987,12 +968,14 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
M_Memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
}
if (!glMipmap->downloaded && !glMipmap->data)
HWR_CacheFlat(glMipmap, flatlumpnum);
// If hardware does not have the texture, then call GL_SetTexture to upload it
if (!glMipmap->downloaded)
{
if (!glMipmap->data)
HWR_CacheFlat(glMipmap, flatlumpnum);
// If hardware does not have the texture, then call GL_SetTexture to upload it
GL_SetTexture(glMipmap);
}
HWR_SetCurrentTexture(glMipmap);
// The system-memory data can be purged now.
@@ -1006,12 +989,14 @@ static void HWR_LoadPatchMipmap(patch_t *patch, GLMipmap_t *glMipmap)
{
GLPatch_t *glPatch = patch->hardware;
if (!glMipmap->downloaded && !glMipmap->data)
HWR_MakePatch(patch, glPatch, glMipmap, true);
// If hardware does not have the texture, then call GL_SetTexture to upload it
if (!glMipmap->downloaded)
{
if (!glMipmap->data)
HWR_MakePatch(patch, glPatch, glMipmap, true);
// If hardware does not have the texture, then call GL_SetTexture to upload it
GL_SetTexture(glMipmap);
}
HWR_SetCurrentTexture(glMipmap);
// The system-memory data can be purged now.
@@ -1070,11 +1055,11 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
// search for the mipmap
// skip the first (no colormap translated)
for (glMipmap = glPatch->mipmap; LIKELY(glMipmap->nextcolormap);)
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap;)
{
glMipmap = glMipmap->nextcolormap;
if (UNLIKELY(glMipmap->colormap && glMipmap->colormap->source == colormap))
if (glMipmap->colormap && glMipmap->colormap->source == colormap)
{
if (memcmp(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8)))
{
@@ -1143,11 +1128,10 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
UINT8 *flat;
UINT8 *dest, *src, texel;
RGBA_t col;
RGBA_t *palette = HWR_GetTexturePalette();
const RGBA_t *palette = HWR_GetTexturePalette();
// Place the flats data into flat
W_ReadLump(fademasklumpnum, Z_Malloc(W_LumpLength(fademasklumpnum),
PU_HWRCACHE, &flat));
W_ReadLump(fademasklumpnum, Z_Malloc(W_LumpLength(fademasklumpnum), PU_HWRCACHE, &flat));
stepy = ((INT32)fmheight<<FRACBITS)/pblockheight;
stepx = ((INT32)fmwidth<<FRACBITS)/pblockwidth;
@@ -1370,7 +1354,7 @@ void HWR_SetMapPalette(void)
// Creates a hardware lighttable from the supplied lighttable.
// Returns the id of the hw lighttable, usable in FSurfaceInfo.
UINT32 HWR_CreateLightTable(UINT8 *lighttable)
static UINT32 HWR_CreateLightTable(UINT8 *lighttable)
{
UINT32 i, id;
RGBA_t *palette = HWR_GetTexturePalette();
@@ -1418,8 +1402,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
// call become invalid and must not be used.
void HWR_ClearLightTables(void)
{
if (vid.glstate == VID_GL_LIBRARY_LOADED)
GL_ClearLightTables();
GL_ClearLightTables();
}
#endif //HWRENDER
+2 -2
View File
@@ -331,8 +331,8 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
// ok, this is a gross hack that barely works...
// but at least it doesn't overestimate too much...
clipfov = atan(1 / projMatrix[0]) * 360.0f / M_PIl;
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
clipfov = atan(1 / (GLdouble)projMatrix[0]) * 360.0 / M_PIl;
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);
+3 -4
View File
@@ -19,7 +19,7 @@
#ifndef _HWR_DEFS_
#define _HWR_DEFS_
#include "../doomtype.h"
#include "../r_defs.h"
#include "../m_fixed.h"
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
@@ -95,9 +95,8 @@ typedef struct
// a vertex of a Doom 'plane' polygon
typedef struct
{
float x;
float y;
float z;
float x, y, z;
fixed_t x2, y2, z2;
} polyvertex_t;
#ifdef _MSC_VER
+1 -1
View File
@@ -496,7 +496,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
{
FOutVector v[4];
double dflatsize;
float dflatsize;
INT32 flatflag;
const size_t len = W_LumpLength(flatlumpnum);
+4 -6
View File
@@ -40,9 +40,9 @@ typedef struct gl_vissprite_s
boolean flip;
UINT8 translucency; //alpha level 0-255
mobj_t *mobj;
boolean precip; // Tails 08-25-2002
precipmobj_t *precip; // Tails 08-25-2002
boolean vflip;
//Hurdler: 25/04/2000: now support colormap in hardware mode
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gl_vissprite_t;
@@ -53,7 +53,9 @@ void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32
// hw_bsp.c
// --------
extern extrasubsector_t *extrasubsectors;
#ifdef PARANOIA
extern size_t addsubsector;
#endif
void HWR_FreeExtraSubsectors(void);
@@ -82,15 +84,11 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
// ^ some flats must NOT be remapped to encore, since we remap them as we cache them for ease, adding a toggle here seems wise.
void HWR_FreeTexture(patch_t *patch);
void HWR_FreeTextureData(patch_t *patch);
void HWR_FreeTextureColormaps(patch_t *patch);
void HWR_ClearAllTextures(void);
void HWR_FreeColormapCache(void);
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
void HWR_SetPalette(RGBA_t *palette);
void HWR_SetMapPalette(void);
UINT32 HWR_CreateLightTable(UINT8 *lighttable);
UINT32 HWR_GetLightTableID(extracolormap_t *colormap);
void HWR_ClearLightTables(void);
+107 -116
View File
@@ -66,7 +66,6 @@
// ==========================================================================
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define SOFTLIGHT(llevel) HWR_ShouldUsePaletteRendering() ? ((llevel) >> LIGHTSEGSHIFT) << LIGHTSEGSHIFT : (llevel)
// false if shaders have not been initialized yet, or if shaders are not available
boolean gl_shadersavailable = false;
@@ -378,7 +377,7 @@ void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32
fixed_t extralight = R_GetSpriteDirectionalLighting(R_PointToAngle(spr->mobj->x, spr->mobj->y));
// Less change in contrast in dark sectors
extralight = FixedMul(extralight, CLAMP(*lightlevel, 0, 255) * FRACUNIT / 255);
extralight = FixedMul(extralight, std::min(std::max(0, *lightlevel), 255) * FRACUNIT / 255);
// simple OGL approximation
fixed_t tr = R_QuickCamDist(spr->mobj->x, spr->mobj->y) << FRACBITS;
@@ -413,8 +412,12 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
tint_color.rgba = (colormap != NULL) ? (UINT32)colormap->rgba : GL_DEFAULTMIX;
fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : GL_DEFAULTFOG;
// Shift the lightlevel for Palette rendering mode to replicate software´s limited 32 lightlevels
if (HWR_ShouldUsePaletteRendering())
light_level = (light_level >> LIGHTSEGSHIFT) << LIGHTSEGSHIFT;
// Clamp the light level, since it can sometimes go out of the 0-255 range from animations
light_level = CLAMP(SOFTLIGHT(light_level), cv_secbright.value, 255);
light_level = CLAMP(light_level, cv_secbright.value, 255);
// Crappy backup coloring if you can't do shaders
if (!HWR_UseShader())
@@ -459,6 +462,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
V_CubeApply(&tint_color.s.red, &tint_color.s.green, &tint_color.s.blue);
V_CubeApply(&fade_color.s.red, &fade_color.s.green, &fade_color.s.blue);
}
Surface->PolyColor.rgba = poly_color.rgba;
Surface->TintColor.rgba = tint_color.rgba;
Surface->FadeColor.rgba = fade_color.rgba;
@@ -548,9 +552,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
INT32 i;
float height; // constant y for all points on the convex flat polygon
float flatxref, flatyref = 0.0f;
float fflatsize = 64.0f;
INT32 flatflag = 63;
static float flatxref = 0.0f, flatyref = 0.0f;
static float fflatsize = 64.0f;
static INT32 flatflag = 63;
size_t len;
float tempxsow, tempytow;
@@ -677,8 +681,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
tempxsow = flatxref;
tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle));
flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
flatxref = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));
flatyref = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));
}
#define SETUP3DVERT(vert, vx, vy) {\
@@ -691,8 +695,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
{\
tempxsow = vert->s;\
tempytow = vert->t;\
vert->s = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));\
vert->t = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));\
vert->s = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));\
vert->t = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));\
}\
\
vert->x = (vx);\
@@ -763,8 +767,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
if (line->pv1)
{
x1 = ((polyvertex_t *)line->pv1)->x;
y1 = ((polyvertex_t *)line->pv1)->y;
x1 = line->pv1->x;
y1 = line->pv1->y;
}
else
{
@@ -773,8 +777,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
if (line->pv2)
{
xd = ((polyvertex_t *)line->pv2)->x - x1;
yd = ((polyvertex_t *)line->pv2)->y - y1;
xd = line->pv2->x - x1;
yd = line->pv2->y - y1;
}
else
{
@@ -844,11 +848,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
M_ClearBox(segbbox);
M_AddToBox(segbbox,
FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x),
FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y));
FloatToFixed(gl_curline->pv1->x),
FloatToFixed(gl_curline->pv1->y));
M_AddToBox(segbbox,
FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x),
FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y));
FloatToFixed(gl_curline->pv2->x),
FloatToFixed(gl_curline->pv2->y));
splat = (wallsplat_t *)gl_curline->linedef->splats;
for (; splat; splat = splat->next)
@@ -1013,10 +1017,10 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
float diff;
fixed_t v1x = FloatToFixed(wallVerts[0].x);
fixed_t v1y = FloatToFixed(wallVerts[0].z);
fixed_t v2x = FloatToFixed(wallVerts[1].x);
fixed_t v2y = FloatToFixed(wallVerts[1].z);
const fixed_t v1x = FloatToFixed(wallVerts[0].x);
const fixed_t v1y = FloatToFixed(wallVerts[0].z);
const fixed_t v2x = FloatToFixed(wallVerts[1].x);
const fixed_t v2y = FloatToFixed(wallVerts[1].z);
const UINT8 alpha = Surf->PolyColor.s.alpha;
FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, gl_curline, NULL);
@@ -1123,8 +1127,8 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
// Found a break
// The heights are clamped to ensure the polygon doesn't cross itself.
bot = CLAMP(bheight, realbot, top);
endbot = CLAMP(endbheight, endrealbot, endtop);
bot = std::max(bheight, realbot);
endbot = std::max(endbheight, endrealbot);
Surf->PolyColor.s.alpha = alpha;
@@ -1222,6 +1226,7 @@ static void HWR_DrawSkyWallList(void)
HWR_SetCurrentTexture(NULL);
GL_UnSetShader();
for (i = 0; i < skyWallVertexArraySize; i++)
{
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture|PF_Skydecal);
@@ -1344,10 +1349,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (LIKELY(gl_curline->pv1))
{
vs.x = ((polyvertex_t *)gl_curline->pv1)->x;
vs.y = ((polyvertex_t *)gl_curline->pv1)->y;
v1x = FloatToFixed(vs.x);
v1y = FloatToFixed(vs.y);
vs.x = gl_curline->pv1->x;
vs.y = gl_curline->pv1->y;
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
@@ -1359,10 +1364,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (LIKELY(gl_curline->pv2))
{
ve.x = ((polyvertex_t *)gl_curline->pv2)->x;
ve.y = ((polyvertex_t *)gl_curline->pv2)->y;
v2x = FloatToFixed(ve.x);
v2y = FloatToFixed(ve.y);
ve.x = gl_curline->pv2->x;
ve.y = gl_curline->pv2->y;
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
@@ -1394,7 +1399,7 @@ 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 + (gl_curline->flength*FRACUNIT));
const float cliphigh = (float)(texturehpeg + gl_curline->length);
FUINT lightnum = gl_frontsector->lightlevel;
extracolormap_t *colormap = gl_frontsector->extra_colormap;
@@ -1904,6 +1909,19 @@ 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))
@@ -2055,6 +2073,17 @@ 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))
@@ -2199,8 +2228,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
if (LIKELY(gl_curline->pv1))
{
v1x = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x);
v1y = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y);
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
@@ -2210,8 +2239,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
if (LIKELY(gl_curline->pv2))
{
v2x = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x);
v2y = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y);
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
@@ -2427,8 +2456,8 @@ static void HWR_AddLine(seg_t *line)
if (LIKELY(gl_curline->pv1))
{
v1x = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->x);
v1y = FloatToFixed(((polyvertex_t *)gl_curline->pv1)->y);
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
@@ -2438,8 +2467,8 @@ static void HWR_AddLine(seg_t *line)
if (LIKELY(gl_curline->pv2))
{
v2x = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->x);
v2y = FloatToFixed(((polyvertex_t *)gl_curline->pv2)->y);
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
@@ -2556,7 +2585,9 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord)
else // node
mindist = 0;
}
if (mindist > current_bsp_culling_distance) return false;
if (mindist > current_bsp_culling_distance)
return false;
}
angle1 = R_PointToAngle64(px1, py1);
@@ -2894,7 +2925,7 @@ static void HWR_Subsector(size_t num)
extracolormap_t *ceilingcolormap;
ffloor_t *rover;
#ifdef PARANOIA //no risk while developing, enough debugging nights!
#ifdef PARANOIA // no risk while developing, enough debugging nights!
if (num >= addsubsector)
I_Error("HWR_Subsector: ss %s with numss = %s, addss = %s\n",
sizeu1(num), sizeu2(numsubsectors), sizeu3(addsubsector));
@@ -3540,27 +3571,13 @@ static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts
float basey, lowy;
// do interpolation
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist(spr->mobj))
if (precip)
{
if (precip)
{
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
}
else
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
R_InterpolatePrecipMobjState(spr->precip, R_GetPrecipMobjTimeFrac(spr->precip), &interp);
}
else
{
if (precip)
{
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
}
else
{
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
}
R_InterpolateMobjState(spr->mobj, R_GetMobjTimeFrac(spr->mobj), &interp);
}
if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip
@@ -3814,8 +3831,8 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
// Found a break
// The heights are clamped to ensure the polygon doesn't cross itself.
bot = CLAMP(bheight, realbot, top);
endbot = CLAMP(endbheight, endrealbot, endtop);
bot = std::max(bheight, realbot);
endbot = std::max(endbheight, endrealbot);
wallVerts[3].t = towtop + ((realtop - top) * towmult);
wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult);
@@ -4056,7 +4073,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
INT32 shader = SHADER_NONE;
const mobj_t *sprmo = spr->mobj;
const precipmobj_t *sprmo = spr->precip;
if (UNLIKELY(!sprmo || !sprmo->subsector))
return;
@@ -4104,7 +4121,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
{
INT32 light;
light = R_GetPlaneLight(sector, sprmo->z + sprmo->height, false); // Always use the light at the top instead of whatever I was doing before
light = R_GetPlaneLight(sector, sprmo->z, false); // Always use the light at the top instead of whatever I was doing before
if (!(sprmo->frame & FF_FULLBRIGHT))
lightlevel = static_cast<INT32>(*sector->lightlist[light].lightlevel);
@@ -4166,8 +4183,8 @@ static int CompareVisSprites(const void *p1, const void *p2)
// "boolean to int"
// check for precip first, because then sprX->mobj is actually a precipmobj_t and does not have flags2 or tracer
const int transparency1 = (!spr1->precip && (spr1->mobj->flags2 & MF2_SHADOW)) || (spr1->mobj->frame & FF_TRANSMASK);
const int transparency2 = (!spr2->precip && (spr2->mobj->flags2 & MF2_SHADOW)) || (spr2->mobj->frame & FF_TRANSMASK);
const int transparency1 = (spr1->precip ? (spr1->precip->frame & FF_TRANSMASK) : ((spr1->mobj->flags2 & MF2_SHADOW)) || (spr1->mobj->frame & FF_TRANSMASK));
const int transparency2 = (spr2->precip ? (spr2->precip->frame & FF_TRANSMASK) : ((spr2->mobj->flags2 & MF2_SHADOW)) || (spr2->mobj->frame & FF_TRANSMASK));
idiff = transparency1 - transparency2;
if (idiff != 0) return idiff;
@@ -4606,7 +4623,7 @@ static void HWR_AddPrecipitationSprites(void)
return;
}
drawdist = ((fixed_t)(cv_drawdist_precip.value) * (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT));
drawdist = ((fixed_t)(cv_drawdist_precip.value) * mapobjectscale);
// No to infinite precipitation draw distance.
if (cv_drawdist_precip.value == 0)
@@ -4683,14 +4700,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
// uncapped/interpolation
interpmobjstate_t interp = {};
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist(thing))
{
R_InterpolateMobjState(thing, rendertimefrac, &interp);
}
else
{
R_InterpolateMobjState(thing, FRACUNIT, &interp);
}
R_InterpolateMobjState(thing, R_GetMobjTimeFrac(thing), &interp);
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
return;
@@ -5006,7 +5016,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
vis->vflip = vflip;
vis->precip = false;
vis->precip = NULL;
}
// Precipitation projector for hardware mode
@@ -5038,21 +5048,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
interpmobjstate_t interp = {};
// do interpolation
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist((mobj_t*)thing))
{
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
}
else
{
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
}
// Visibility check by the blend mode.
if (thing->frame & FF_TRANSMASK)
{
if (!R_BlendLevelVisible(thing->blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT))
return;
}
R_InterpolatePrecipMobjState(thing, R_GetPrecipMobjTimeFrac(thing), &interp);
// transform the origin point
tr_x = FixedToFloat(interp.x);
@@ -5130,7 +5126,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
vis->flip = flip;
vis->mobj = (mobj_t *)thing;
vis->mobj = NULL;
vis->colormap = NULL;
@@ -5143,7 +5139,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->gzt = FixedToFloat(interp.z) + (FixedToFloat(spritecachedinfo[lumpoff].topoffset) * this_scale);
vis->gz = vis->gzt - (FixedToFloat(spritecachedinfo[lumpoff].height) * this_scale);
vis->precip = true;
vis->precip = thing;
}
@@ -5304,19 +5300,14 @@ static void HWR_DrawSkyBackground(void)
{
FTransform dometransform;
if (drewsky)
return;
if (HWR_IsWireframeMode())
if (drewsky || HWR_IsWireframeMode())
return;
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
memcpy(&dometransform, &atransform, sizeof(FTransform));
dometransform.x = 0.0;
dometransform.y = 0.0;
dometransform.z = 0.0;
dometransform.x = dometransform.y = dometransform.z = 0.0;
//04/01/2000: Hurdler: added for T&L
// It should replace all other gl_viewxxx when finished
@@ -5333,6 +5324,7 @@ static void HWR_DrawSkyBackground(void)
if (HWR_UseShader())
GL_SetShader(HWR_GetShaderFromTarget(SHADER_SKY));
GL_SetTransform(&dometransform);
GL_RenderSkyDome(&gl_sky);
}
@@ -5350,7 +5342,6 @@ static inline void HWR_ClearView(void)
GL_ClearBuffer(false, true, true, NULL);
}
// -----------------+
// HWR_SetViewSize : set projection and scaling values
// -----------------+
@@ -5581,7 +5572,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
drewsky = false;
HWR_DrawSkyBackground();
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
GL_ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
GL_ClearBuffer(false, false, true, NULL);// clear skywall markings from the stencil buffer
HWR_SetTransform(fpov);// restore transform
}
}
@@ -5700,13 +5691,7 @@ void HWR_RenderPlayerView(void)
// Clear the color buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs.
if (viewssnum == 0) // Only do it if it's the first screen being rendered
{
FRGBAFloat ClearColor;
ClearColor.red = 0.0f;
ClearColor.green = 0.0f;
ClearColor.blue = 0.0f;
ClearColor.alpha = 1.0f;
static FRGBAFloat ClearColor = {0.0f, 0.0f, 0.0f, 1.0f};
GL_ClearBuffer(true, false, false, &ClearColor);
}
@@ -5715,13 +5700,19 @@ void HWR_RenderPlayerView(void)
if (cv_ripplewater.value)
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
if (cv_glmdls.value)
{
if (maplighting.directional)
{
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
}
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
}
}
if (viewssnum > 3)
@@ -6045,7 +6036,7 @@ static void HWR_DoPostProcessor(player_t *player)
{
// 10 by 10 grid. 2 coordinates (xy)
float v[SCREENVERTS][SCREENVERTS][2];
float disStart = (leveltime-1) + FixedToFloat(rendertimefrac);
float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
UINT8 x, y;
INT32 WAVELENGTH;
+4 -11
View File
@@ -1176,6 +1176,8 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
// Look at HWR_ProjectSprite for more
{
md2_t *md2s;
int skinnum;
patch_t *gpatch, *blendgpatch;
GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL;
INT32 durs = spr->mobj->state->tics;
@@ -1188,16 +1190,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
spriteinfo_t *sprinfo;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused && R_CheckInterpDist(spr->mobj))
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
else
{
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
}
md2_t *md2s;
int skinnum;
R_InterpolateMobjState(spr->mobj, R_GetMobjTimeFrac(spr->mobj), &interp);
// Apparently people don't like jump frames like that, so back it goes
//if (tics > durs)
@@ -1375,7 +1368,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
#ifdef USE_MODEL_NEXTFRAME
// Interpolate the model interpolation. (lol)
tics -= FixedToFloat(rendertimefrac);
tics -= FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
if (cv_glmdls.value == 1 && tics <= durs)
{
+1 -1
View File
@@ -35,7 +35,7 @@ static struct {
// Sprite shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
// Model shader
// Model shader + diffuse lighting from above
{GLSL_MODEL_LIGHTING_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
// Water shader
+410 -150
View File
@@ -27,6 +27,8 @@
#if defined (HWRENDER) && !defined (NOROPENGL)
#include "../../r_fps.h" // For R_GetTimeFrac, used for the leveltime shader uniform
#include "r_opengl.h"
#include "r_vbo.h"
@@ -126,12 +128,27 @@ GLfloat projMatrix[16];
static GLint viewport[4];
#ifdef USE_FBO_OGL
GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
boolean supportFBO = false;
enum
{
FBO_NONE,
FBO_ARB,
FBO_EXT,
FBO_EXT_STENCIL // supports stencil attachment
};
int supportFBO = FBO_NONE;
static boolean fboinit = false;
static void GL_Framebuffer_DeleteAttachments(void);
static int FBO_FRAMEBUFFER = GL_FRAMEBUFFER;
static int FBO_COLOR_ATTACHMENT = GL_COLOR_ATTACHMENT0;
static int FBO_DEPTH_ATTACHMENT = GL_DEPTH_STENCIL_ATTACHMENT;
static int FBO_DEPTH_STENCIL = GL_DEPTH24_STENCIL8;
static int FBO_RENDERBUFFER = GL_RENDERBUFFER;
static int FBO_COMPLETE = GL_FRAMEBUFFER_COMPLETE;
#endif
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing
@@ -225,8 +242,9 @@ static void GL_MSG_Warning(const char *format, ...)
CONS_Alert(CONS_WARNING, "%s", str);
#endif
#ifdef DEBUG_TO_FILE
if (!gllogstream)
if (!gllogstream)
gllogstream = fopen("ogllog.txt", "w");
fwrite(str, strlen(str), 1, gllogstream);
#endif
}
@@ -325,6 +343,10 @@ static void GL_MSG_Error(const char *format, ...)
#define pglCopyTexImage2D glCopyTexImage2D
#define pglCopyTexSubImage2D glCopyTexSubImage2D
#ifdef GLDEBUGMESSAGE
#define pglDebugMessageCallback glDebugMessageCallback
#endif
#else //!STATIC_OPENGL
/* 1.0 functions */
@@ -446,7 +468,7 @@ typedef void (APIENTRY * PFNglCopyTexSubImage2D) (GLenum target, GLint level, GL
static PFNglCopyTexSubImage2D pglCopyTexSubImage2D;
#ifdef USE_FBO_OGL
/* 3.0 functions for framebuffers and renderbuffers */
/* core functions for framebuffers and renderbuffers */
typedef void (APIENTRY * PFNglGenFramebuffers) (GLsizei n, GLuint *ids);
static PFNglGenFramebuffers pglGenFramebuffers;
typedef void (APIENTRY * PFNglBindFramebuffer) (GLenum target, GLuint framebuffer);
@@ -465,10 +487,58 @@ typedef void (APIENTRY * PFNglDeleteRenderbuffers) (GLsizei n, GLuint *renderbuf
static PFNglDeleteRenderbuffers pglDeleteRenderbuffers;
typedef void (APIENTRY * PFNglRenderbufferStorage) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
static PFNglRenderbufferStorage pglRenderbufferStorage;
typedef void (APIENTRY * PFNglRenderbufferStorageMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
static PFNglRenderbufferStorageMultisample pglRenderbufferStorageMultisample;
typedef void (APIENTRY * PFNglBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
static PFNglBlitFramebuffer pglBlitFramebuffer;
typedef void (APIENTRY * PFNglTexImage2DMultisample) ( GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLboolean fixedsamplelocations);
static PFNglTexImage2DMultisample pglTexImage2DMultisample;
typedef void (APIENTRY * PFNglDrawBuffer) ( GLenum buf);
static PFNglDrawBuffer pglDrawBuffer;
typedef void (APIENTRY * PFNglReadBuffer) ( GLenum mode);
static PFNglReadBuffer pglReadBuffer;
typedef void (APIENTRY * PFNglFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLenum renderbuffer);
static PFNglFramebufferRenderbuffer pglFramebufferRenderbuffer;
/* 2.1 extension functions for framebuffers and renderbuffers */
typedef void (APIENTRY * PFNglGenFramebuffersEXT) (GLsizei n, GLuint *ids);
static PFNglGenFramebuffersEXT pglGenFramebuffersEXT;
typedef void (APIENTRY * PFNglBindFramebufferEXT) (GLenum target, GLuint framebuffer);
static PFNglBindFramebufferEXT pglBindFramebufferEXT;
typedef void (APIENTRY * PFNglDeleteFramebuffersEXT) (GLsizei n, GLuint *ids);
static PFNglDeleteFramebuffersEXT pglDeleteFramebuffersEXT;
typedef void (APIENTRY * PFNglFramebufferTexture2DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
static PFNglFramebufferTexture2DEXT pglFramebufferTexture2DEXT;
typedef GLenum (APIENTRY * PFNglCheckFramebufferStatusEXT) (GLenum target);
static PFNglCheckFramebufferStatusEXT pglCheckFramebufferStatusEXT;
typedef void (APIENTRY * PFNglGenRenderbuffersEXT) (GLsizei n, GLuint *renderbuffers);
static PFNglGenRenderbuffersEXT pglGenRenderbuffersEXT;
typedef void (APIENTRY * PFNglBindRenderbufferEXT) (GLenum target, GLuint renderbuffer);
static PFNglBindRenderbufferEXT pglBindRenderbufferEXT;
typedef void (APIENTRY * PFNglDeleteRenderbuffersEXT) (GLsizei n, GLuint *renderbuffers);
static PFNglDeleteRenderbuffersEXT pglDeleteRenderbuffersEXT;
typedef void (APIENTRY * PFNglRenderbufferStorageEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
static PFNglRenderbufferStorageEXT pglRenderbufferStorageEXT;
typedef void (APIENTRY * PFNglFramebufferRenderbufferEXT) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLenum renderbuffer);
static PFNglFramebufferRenderbufferEXT pglFramebufferRenderbufferEXT;
#endif // USE_FBO_OGL
typedef GLenum (APIENTRY * PFNglGetError) ( void);
static PFNglGetError pglGetError;
#endif //!STATIC_OPENGL
/* 1.2 functions for 3D textures */
@@ -503,6 +573,11 @@ static PFNglColorPointer pglColorPointer;
typedef void (APIENTRY * PFNglBlendEquation) (GLenum mode);
static PFNglBlendEquation pglBlendEquation;
#ifdef GLDEBUGMESSAGE
typedef void (APIENTRY * PFNglDebugMessageCallback) (void (APIENTRY *DEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam), const void *userParam);
static PFNglDebugMessageCallback pglDebugMessageCallback;
#endif
/* 1.2 Parms */
/* GL_CLAMP_TO_EDGE_EXT */
#ifndef GL_CLAMP_TO_EDGE
@@ -729,16 +804,35 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
#ifdef USE_FBO_OGL
static boolean GLFramebuffer_CheckExt(void)
static int GLFramebuffer_CheckExt(void)
{
//this stuff needs atleast OGL 3.0
if (majorGL < 3)
return false;
// in opengl 3.0 and up fbos are standart and always supported
if (majorGL >= 3)
return FBO_ARB;
// check if all needed gl extensions are available
return (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions)
&& GL_isExtAvailable("GL_ARB_framebuffer_object", gl_extensions)
&& GL_isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
// gl versions from 2.1 may still support framebuffer objects
// maybe, just maybe, we support the standart extensions
if (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions)
&& GL_isExtAvailable("GL_ARB_framebuffer_object", gl_extensions)
&& GL_isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions))
return FBO_ARB;
// nope, try the older 2.1 extensions
if (GL_isExtAvailable("GL_EXT_framebuffer_no_attachments", gl_extensions)
&& GL_isExtAvailable("GL_EXT_framebuffer_object", gl_extensions)
&& GL_isExtAvailable("GL_EXT_framebuffer_sRGB", gl_extensions))
{
// perhaps we may even support a stencil attachment
if (GL_isExtAvailable("GL_EXT_packed_depth_stencil", gl_extensions))
return FBO_EXT_STENCIL;
// no stencil support, sad
return FBO_EXT;
}
// no fbo support for you :c
return FBO_NONE;
}
#endif
@@ -795,28 +889,105 @@ void SetupGLFunc4(void)
GetGLfunc(glUniform3fv);
GetGLfunc(glGetUniformLocation);
#ifdef USE_FBO_OGL
if (GLFramebuffer_CheckExt())
{
GetGLfunc(glGenFramebuffers);
GetGLfunc(glBindFramebuffer);
GetGLfunc(glDeleteFramebuffers);
GetGLfunc(glFramebufferTexture2D);
GetGLfunc(glCheckFramebufferStatus);
GetGLfunc(glGenRenderbuffers);
GetGLfunc(glBindRenderbuffer);
GetGLfunc(glDeleteRenderbuffers);
GetGLfunc(glRenderbufferStorage);
GetGLfunc(glFramebufferRenderbuffer);
#ifdef GLDEBUGMESSAGE
GetGLfunc(glDebugMessageCallback);
#endif
// check if ALL functions are availible
if (pglGenFramebuffers && pglBindFramebuffer &&
pglDeleteFramebuffers && pglFramebufferTexture2D &&
pglCheckFramebufferStatus && pglGenRenderbuffers &&
pglBindRenderbuffer && pglDeleteRenderbuffers &&
pglRenderbufferStorage && pglFramebufferRenderbuffer)
supportFBO = true;
#ifdef USE_FBO_OGL
const int fbocheck = GLFramebuffer_CheckExt();
if (fbocheck != FBO_NONE)
{
if (fbocheck == FBO_ARB)
{
GetGLfunc(glGenFramebuffers);
GetGLfunc(glBindFramebuffer);
GetGLfunc(glDeleteFramebuffers);
GetGLfunc(glFramebufferTexture2D);
GetGLfunc(glCheckFramebufferStatus);
GetGLfunc(glGenRenderbuffers);
GetGLfunc(glBindRenderbuffer);
GetGLfunc(glDeleteRenderbuffers);
GetGLfunc(glRenderbufferStorage);
GetGLfunc(glRenderbufferStorageMultisample);
GetGLfunc(glBlitFramebuffer);
GetGLfunc(glFramebufferRenderbuffer);
GetGLfunc(glTexImage2DMultisample);
GetGLfunc(glDrawBuffer);
GetGLfunc(glReadBuffer);
// check if ALL functions are availible
// what a mouthful
if (pglGenFramebuffers && pglBindFramebuffer &&
pglDeleteFramebuffers && pglFramebufferTexture2D &&
pglCheckFramebufferStatus && pglGenRenderbuffers &&
pglBindRenderbuffer && pglDeleteRenderbuffers &&
pglRenderbufferStorage && pglFramebufferRenderbuffer)
supportFBO = fbocheck;
}
else if (fbocheck == FBO_EXT || fbocheck == FBO_EXT_STENCIL) // uh oh only support for EXT prefix fbos...
{
GetGLfunc(glGenFramebuffersEXT);
GetGLfunc(glBindFramebufferEXT);
GetGLfunc(glDeleteFramebuffersEXT);
GetGLfunc(glFramebufferTexture2DEXT);
GetGLfunc(glCheckFramebufferStatusEXT);
GetGLfunc(glGenRenderbuffersEXT);
GetGLfunc(glBindRenderbufferEXT);
GetGLfunc(glDeleteRenderbuffersEXT);
GetGLfunc(glRenderbufferStorageEXT);
GetGLfunc(glFramebufferRenderbufferEXT);
// check if ALL functions are availible
// what a mouthful
if (pglGenFramebuffersEXT && pglBindFramebufferEXT &&
pglDeleteFramebuffersEXT && pglFramebufferTexture2DEXT &&
pglCheckFramebufferStatusEXT && pglGenRenderbuffersEXT &&
pglBindRenderbufferEXT && pglDeleteRenderbuffersEXT &&
pglRenderbufferStorageEXT && pglFramebufferRenderbufferEXT)
{
// remapping galore huehue
// do this so we dont have to dupe half our code
pglGenFramebuffers = pglGenFramebuffersEXT;
pglBindFramebuffer = pglBindFramebufferEXT;
pglDeleteFramebuffers = pglDeleteFramebuffersEXT;
pglFramebufferTexture2D = pglFramebufferTexture2DEXT;
pglCheckFramebufferStatus = pglCheckFramebufferStatusEXT;
pglGenRenderbuffers = pglGenRenderbuffersEXT;
pglBindRenderbuffer = pglBindRenderbufferEXT;
pglDeleteRenderbuffers = pglDeleteRenderbuffersEXT;
pglRenderbufferStorage = pglRenderbufferStorageEXT;
pglFramebufferRenderbuffer = pglFramebufferRenderbufferEXT;
// the enums "technically" should map the same
// but better be safe than sorry
FBO_FRAMEBUFFER = GL_FRAMEBUFFER_EXT;
FBO_COLOR_ATTACHMENT = GL_COLOR_ATTACHMENT0_EXT;
FBO_DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT_EXT;
FBO_DEPTH_STENCIL = (supportFBO == FBO_EXT_STENCIL) ? GL_DEPTH_STENCIL_EXT : GL_DEPTH_COMPONENT;
FBO_RENDERBUFFER = GL_RENDERBUFFER_EXT;
FBO_COMPLETE = GL_FRAMEBUFFER_COMPLETE_EXT;
supportFBO = fbocheck;
}
}
}
/*switch (supportFBO)
{
case FBO_ARB:
GL_DBG_Printf("\nFBO: ARB extensions found\n");
break;
case FBO_EXT:
GL_DBG_Printf("\nFBO: EXT extensions found, no stencil\n");
break;
case FBO_EXT_STENCIL:
GL_DBG_Printf("\nFBO: EXT extensions with packed depth-stencil\n");
break;
case FBO_NONE:
GL_DBG_Printf("\nFBO: No framebuffer object support\n");
break;
}*/
#endif
#undef GetGLfunc
}
@@ -889,7 +1060,7 @@ void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value)
switch (info)
{
case HWD_SHADERINFO_LEVELTIME:
shader_leveltime = (((float)(value-1)) + FIXED_TO_FLOAT(rendertimefrac)) / TICRATE;
shader_leveltime = (((float)(value-1)) + FIXED_TO_FLOAT(R_GetTimeFrac(RTF_LEVEL))) / TICRATE;
break;
case HWD_SHADERINFO_LIGHT_X:
shader_light_x = FixedToFloat(value);
@@ -1060,6 +1231,53 @@ void GL_SetModelView(GLint w, GLint h)
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
}
#ifdef GLDEBUGMESSAGE
static void APIENTRY DebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam)
{
const char *debugsource, *debugtype;
switch (source)
{
#define S(s) case GL_DEBUG_SOURCE_##s: debugsource = #s; break
S(API);
S(WINDOW_SYSTEM);
S(SHADER_COMPILER);
S(THIRD_PARTY);
S(APPLICATION);
S(OTHER);
#undef S
default:
debugsource = "unknown";
break;
}
switch (type)
{
#define S(s) case GL_DEBUG_TYPE_##s: debugtype = #s; break
S(ERROR);
S(DEPRECATED_BEHAVIOR);
S(UNDEFINED_BEHAVIOR);
S(PORTABILITY);
S(PERFORMANCE);
S(MARKER);
S(PUSH_GROUP);
S(POP_GROUP);
S(OTHER);
#undef S
default:
debugtype = "unknown";
break;
}
alerttype_t level = severity == GL_DEBUG_SEVERITY_HIGH ? CONS_ERROR
: severity == GL_DEBUG_SEVERITY_MEDIUM ? CONS_WARNING
: CONS_NOTICE;
//CONS_Alert(level, "OpenGL (%s) (%s): %s\n", debugsource, debugtype, message);
printf("OpenGL (%s) (%s): %s\n", debugsource, debugtype, message);
}
#endif
// -----------------+
// SetStates : Set permanent states
// -----------------+
@@ -1096,6 +1314,14 @@ void GL_SetStates(void)
pglLoadIdentity();
pglScalef(1.0f, 1.0f, -1.0f);
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
pglEnable(GL_MULTISAMPLE);
#ifdef GLDEBUGMESSAGE
pglEnable(GL_DEBUG_OUTPUT);
pglEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
pglDebugMessageCallback(&DebugMessage, NULL);
#endif
}
// -----------------+
@@ -1134,48 +1360,80 @@ void GL_DeleteTexture(GLMipmap_t *pTexInfo)
pTexInfo->downloaded = 0;
}
#ifdef USE_FBO_OGL
static void GL_Framebuffer_GenerateAttachments(void)
enum
{
if (!supportFBO || !UseScreenFBO())
FBO_RESOLV,
FBO_MSAA,
};
enum
{
RBO_COLOR,
RBO_DEPTH,
};
typedef struct
{
GLuint fbobject;
GLuint rbo[2];
} glfbo_t;
static glfbo_t FBO[2] = {};
static bool fboInit = false;
static void GL_Framebuffer_Generate(void)
{
if (!supportFBO || fboInit)
return;
// Bind the framebuffer
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
if (!FBO[FBO_MSAA].fbobject)
pglGenFramebuffers(1, &FBO[FBO_MSAA].fbobject);
// Generate the framebuffer texture
if (!FramebufferTexture)
pglBindFramebuffer(GL_FRAMEBUFFER, FBO[FBO_MSAA].fbobject);
if (!FBO[FBO_MSAA].rbo[RBO_COLOR])
{
pglGenTextures(1, &FramebufferTexture);
pglBindTexture(GL_TEXTURE_2D, FramebufferTexture);
pglTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, screen_width, screen_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
pglBindTexture(GL_TEXTURE_2D, 0);
// Attach the framebuffer texture to the framebuffer
pglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, FramebufferTexture, 0);
pglGenRenderbuffers(1, &FBO[FBO_MSAA].rbo[RBO_COLOR]);
pglBindRenderbuffer(GL_RENDERBUFFER, FBO[FBO_MSAA].rbo[RBO_COLOR]);
pglRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, screen_width, screen_height);
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, FBO[FBO_MSAA].rbo[RBO_COLOR]);
}
// Generate the renderbuffer
if (!RenderbufferObject)
if (!FBO[FBO_MSAA].rbo[RBO_DEPTH])
{
pglGenRenderbuffers(1, &RenderbufferObject);
pglGenRenderbuffers(1, &FBO[FBO_MSAA].rbo[RBO_DEPTH]);
pglBindRenderbuffer(GL_RENDERBUFFER, FBO[FBO_MSAA].rbo[RBO_DEPTH]);
pglRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH24_STENCIL8, screen_width, screen_height);
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, FBO[FBO_MSAA].rbo[RBO_DEPTH]);
}
pglBindRenderbuffer(GL_RENDERBUFFER, RenderbufferObject);
if (!FBO[FBO_RESOLV].fbobject)
pglGenFramebuffers(1, &FBO[FBO_RESOLV].fbobject);
pglBindFramebuffer(GL_FRAMEBUFFER, FBO[FBO_RESOLV].fbobject);
if (!FBO[FBO_RESOLV].rbo[RBO_COLOR])
{
pglGenRenderbuffers(1, &FBO[FBO_RESOLV].rbo[RBO_COLOR]);
pglBindRenderbuffer(GL_RENDERBUFFER, FBO[FBO_RESOLV].rbo[RBO_COLOR]);
pglRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, screen_width, screen_height);
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, FBO[FBO_RESOLV].rbo[RBO_COLOR]);
}
if (!FBO[FBO_RESOLV].rbo[RBO_DEPTH])
{
pglGenRenderbuffers(1, &FBO[FBO_RESOLV].rbo[RBO_DEPTH]);
pglBindRenderbuffer(GL_RENDERBUFFER, FBO[FBO_RESOLV].rbo[RBO_DEPTH]);
pglRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, screen_width, screen_height);
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, RenderbufferObject);
// Clear the renderbuffer
GL_ClearBuffer(true, true, true, NULL);
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, FBO[FBO_RESOLV].rbo[RBO_DEPTH]);
}
// Unbind the framebuffer
// unbind
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
fboinit = true;
fboInit = true;
}
static void GL_Framebuffer_DeleteAttachments(void)
@@ -1183,47 +1441,51 @@ static void GL_Framebuffer_DeleteAttachments(void)
if (!supportFBO || !fboinit)
return;
if (!FramebufferObject && !RenderbufferObject && !FramebufferTexture)
return;
if (FBO[FBO_MSAA].rbo[RBO_COLOR])
{
pglDeleteRenderbuffers(1, &FBO[FBO_MSAA].rbo[RBO_COLOR]);
FBO[FBO_MSAA].rbo[RBO_COLOR] = 0;
}
// Unbind the framebuffer
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
if (FBO[FBO_MSAA].rbo[RBO_DEPTH])
{
pglDeleteRenderbuffers(1, &FBO[FBO_MSAA].rbo[RBO_DEPTH]);
FBO[FBO_MSAA].rbo[RBO_DEPTH] = 0;
}
if (FramebufferTexture)
pglDeleteTextures(1, &FramebufferTexture);
if (FBO[FBO_RESOLV].rbo[RBO_COLOR])
{
pglDeleteRenderbuffers(1, &FBO[FBO_RESOLV].rbo[RBO_COLOR]);
FBO[FBO_RESOLV].rbo[RBO_COLOR] = 0;
}
if (RenderbufferObject)
pglDeleteRenderbuffers(1, &RenderbufferObject);
if (FBO[FBO_RESOLV].rbo[RBO_DEPTH])
{
pglDeleteRenderbuffers(1, &FBO[FBO_RESOLV].rbo[RBO_DEPTH]);
FBO[FBO_RESOLV].rbo[RBO_DEPTH] = 0;
}
FramebufferTexture = 0;
RenderbufferObject = 0;
fboinit = false;
}
static void GL_Framebuffer_Generate(void)
{
if (!supportFBO || !UseScreenFBO())
return;
// Generate the framebuffer
if (!FramebufferObject)
pglGenFramebuffers(1, &FramebufferObject);
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
GL_Framebuffer_GenerateAttachments();
fboInit = false;
}
static void GL_Framebuffer_Delete(void)
{
if (!supportFBO || !fboinit)
if (!supportFBO)
return;
if (FramebufferObject)
pglDeleteFramebuffers(1, &FramebufferObject);
GL_Framebuffer_DeleteAttachments();
FramebufferObject = 0;
if (FBO[FBO_MSAA].fbobject)
{
pglDeleteFramebuffers(1, &FBO[FBO_MSAA].fbobject);
FBO[FBO_MSAA].fbobject = 0;
}
if (FBO[FBO_RESOLV].fbobject)
{
pglDeleteFramebuffers(1, &FBO[FBO_RESOLV].fbobject);
FBO[FBO_RESOLV].fbobject = 0;
}
}
void GL_Framebuffer_Unbind(void)
@@ -1231,41 +1493,36 @@ void GL_Framebuffer_Unbind(void)
if (!supportFBO || !fboinit)
return;
if (!FramebufferObject && !RenderbufferObject)
return;
pglBindFramebuffer(GL_READ_FRAMEBUFFER, FBO[FBO_MSAA].fbobject);
pglBindFramebuffer(GL_DRAW_FRAMEBUFFER, FBO[FBO_RESOLV].fbobject);
pglBlitFramebuffer(0, 0, screen_width, screen_height,
0, 0, screen_width, screen_height,
GL_COLOR_BUFFER_BIT,
GL_NEAREST);
// back to default framebuffer
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
}
void GL_Framebuffer_Enable(void)
{
if (!supportFBO || !UseScreenFBO())
if (!supportFBO)
return;
if (FramebufferObject == 0)
GL_Framebuffer_Generate();
else if (!FramebufferTexture || !RenderbufferObject)
GL_Framebuffer_GenerateAttachments();
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
pglBindRenderbuffer(GL_RENDERBUFFER, RenderbufferObject);
GL_Framebuffer_Generate();
pglBindFramebuffer(GL_FRAMEBUFFER, FBO[FBO_MSAA].fbobject);
}
void GL_Framebuffer_Disable(void)
{
if (!supportFBO || !fboinit)
return;
if (!FramebufferObject && !RenderbufferObject)
if (!supportFBO)
return;
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
GL_Framebuffer_Delete();
}
#endif
// -----------------+
// Flush : flush OpenGL textures
@@ -2112,7 +2369,7 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
UNIFORM_1(shader->uniforms[gluniform_lighting], (GLfloat)Surface->LightInfo.light_level, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_fade_start], (GLfloat)Surface->LightInfo.fade_start, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_fade_end], (GLfloat)Surface->LightInfo.fade_end, pglUniform1f);
directional = Surface->LightInfo.directional;
directional = cv_glmdls.value && Surface->LightInfo.directional;
}
else
{
@@ -2841,7 +3098,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
scaley = vscale;
scalez = hscale;
if (duration > 0.0 && tics >= 0.0) // don't interpolate if instantaneous or infinite in length
if (duration > 0.0f && tics >= 0.0f) // don't interpolate if instantaneous or infinite in length
{
float newtime = (duration - tics); // + 1;
@@ -3142,8 +3399,8 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
return;
// X/Y stretch fix for all resolutions(!)
xfix = (float)(screen_texsizew)/((float)((screen_width)/(float)(SCREENVERTS-1)));
yfix = (float)(screen_texsizeh)/((float)((screen_height)/(float)(SCREENVERTS-1)));
xfix = (float)screen_texsizew/((float)(screen_width/(float)(SCREENVERTS-1)));
yfix = (float)screen_texsizeh/((float)(screen_height/(float)(SCREENVERTS-1)));
pglDisable(GL_DEPTH_TEST);
pglDisable(GL_BLEND);
@@ -3230,12 +3487,9 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
if (gl_enable_screen_textures != 2)
return;
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
xfix = 1/((float)screen_texsizew/(float)screen_width);
yfix = 1/((float)screen_texsizeh/(float)screen_height);
// const float screenVerts[12]
// float fix[8];
fix[0] = 0.0f;
fix[1] = 0.0f;
fix[2] = 0.0f;
@@ -3289,12 +3543,9 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd)
if (!gl_enable_screen_textures)
return;
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
xfix = 1/((float)screen_texsizew/(float)screen_width);
yfix = 1/((float)screen_texsizeh/(float)screen_height);
// const float screenVerts[12]
// float fix[8];
fix[0] = 0.0f;
fix[1] = 0.0f;
fix[2] = 0.0f;
@@ -3348,7 +3599,6 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd)
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
{
int tex = HWD_SCREENTEXTURE_VHS;
float xfix, yfix;
float fix[8];
GLubyte color[4] = {255, 255, 255, 255};
@@ -3365,25 +3615,30 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
if (gl_enable_screen_textures != 2)
return;
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
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;
// Slight fuzziness
GL_MakeScreenTexture(tex);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
for (i = 0; i < 1; i += 2.f/vid.height)
const float stride = 2.f/scrwh;
for (i = 0; i < 1; i += stride)
{
fix[2] = (float)(rand() % 128) / -22000 * xfix;
fix[2] = (float)(rand() % 128) / -22000.f * xfix;
fix[0] = fix[2];
fix[6] = fix[0] + xfix;
fix[4] = fix[2] + xfix;
fix[1] = fix[7] = i*yfix;
fix[3] = fix[5] = (i+0.015)*yfix;
fix[3] = fix[5] = (i+0.015f)*yfix;
screenVerts[1] = screenVerts[10] = 2*i - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03;
screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03f;
pglColor4ubv(color);
@@ -3393,8 +3648,8 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
}
// Upward bar
GL_MakeScreenTexture(tex);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
//GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
//pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
color[0] = color[1] = color[2] = 190;
color[3] = 250;
@@ -3402,14 +3657,14 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
fix[0] = 0.0f;
fix[6] = xfix;
fix[2] = (float)updistort / screen_width * xfix;
fix[2] = (float)updistort / scrwf * xfix;
fix[4] = fix[2] + fix[6];
screenVerts[1] = screenVerts[10] = 2.0f*upbary/screen_height - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/screen_height;
screenVerts[1] = screenVerts[10] = 2.0f*upbary/scrwh - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/scrwh;
fix[1] = fix[7] = (float)upbary/screen_height * yfix;
fix[3] = fix[5] = fix[1] + (float)barsize/2/screen_height * yfix;
fix[1] = fix[7] = (float)upbary/scrwh * yfix;
fix[3] = fix[5] = fix[1] + (float)barsize/2/scrwh * yfix;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
@@ -3422,19 +3677,19 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
// Downward bar
GL_MakeScreenTexture(tex);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
//GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
//pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
fix[0] = 0.0f;
fix[6] = xfix;
fix[2] = (float)downdistort / screen_width * -xfix;
fix[2] = (float)downdistort / scrwf * -xfix;
fix[4] = fix[2] + fix[6];
screenVerts[1] = screenVerts[10] = 2.0f*downbary/screen_height - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/screen_height;
screenVerts[1] = screenVerts[10] = 2.0f*downbary/scrwh - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/scrwh;
fix[1] = fix[7] = (float)downbary/screen_height * yfix;
fix[3] = fix[5] = fix[1] + (float)barsize/2/screen_height * yfix;
fix[1] = fix[7] = (float)downbary/scrwh * yfix;
fix[3] = fix[5] = fix[1] + (float)barsize/2/scrwh * yfix;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
@@ -3450,11 +3705,13 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
// Create a texture from the screen.
void GL_MakeScreenTexture(int tex)
{
boolean firstTime = (screenTextures[tex] == 0);
boolean firstTime;
if (!gl_enable_screen_textures)
return;
firstTime = (screenTextures[tex] == 0);
// Create screen texture
if (firstTime)
pglGenTextures(1, &screenTextures[tex]);
@@ -3488,8 +3745,8 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
if (gl_enable_screen_textures != 2)
return;
xfix = 1/((float)(screen_texsizew)/((float)((screen_width))));
yfix = 1/((float)(screen_texsizeh)/((float)((screen_height))));
xfix = 1/((float)screen_texsizew/(float)screen_width);
yfix = 1/((float)screen_texsizeh/(float)screen_height);
origaspect = (float)screen_width / screen_height;
newaspect = (float)width / height;
@@ -3539,7 +3796,7 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
if (useshader)
pglUseProgram(gl_shaders[SHADER_PALETTE_POSTPROCESS].program); // palette postprocess shader
pglUseProgram(gl_shaders[SHADER_PALETTE_POSTPROCESS].program); // Final postprocess step of palette rendering, after everything else has been drawn.
pglColor4ubv(white);
@@ -3557,6 +3814,7 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
void GL_SetPaletteLookup(UINT8 *lut)
{
GLenum internalFormat;
if (gl_version[0] == '1' || gl_version[0] == '2')
{
// if the OpenGL version is below 3.0, then the GL_R8 format may not be available.
@@ -3584,6 +3842,7 @@ void GL_SetPaletteLookup(UINT8 *lut)
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable)
{
LTListItem *item = malloc(sizeof(LTListItem));
if (!LightTablesTail)
{
LightTablesHead = LightTablesTail = item;
@@ -3593,6 +3852,7 @@ UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable)
LightTablesTail->next = item;
LightTablesTail = item;
}
item->next = NULL;
pglGenTextures(1, &item->id);
pglBindTexture(GL_TEXTURE_2D, item->id);
+1 -2
View File
@@ -111,9 +111,8 @@ void GL_Framebuffer_Unbind(void);
void GL_Framebuffer_Enable(void);
void GL_Framebuffer_Disable(void);
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
extern boolean supportFBO;
extern int supportFBO;
#endif
// ==========================================================================
+4 -20
View File
@@ -943,7 +943,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
// before we do anything, let's verify the guy isn't spamming, get this easier on us.
//if (stop_spamming[playernum] != 0 && cv_chatspamprotection.value && !(flags & HU_CSAY))
if (stop_spamming[playernum] != 0 && consoleplayer != playernum && cv_chatspamprotection.value && !(flags & HU_CSAY))
{
CONS_Debug(DBG_NETPLAY,"Received SAY cmd too quickly from Player %d (%s), assuming as spam and blocking message.\n", playernum+1, player_names[playernum]);
@@ -1039,6 +1038,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
tempchar = (char *)Z_Calloc(strlen(cstart) + strlen(adminchar) + 1, PU_STATIC, NULL);
else if (IsPlayerAdmin(playernum))
tempchar = (char *)Z_Calloc(strlen(cstart) + strlen(remotechar) + 1, PU_STATIC, NULL);
if (tempchar)
{
if (playernum == serverplayer)
@@ -1073,17 +1073,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
}
else // To everyone or sayteam, it doesn't change anything.
fmt2 = "%s<%s%s%s>\x80 %s%s";
/*else // To your team
{
if (players[playernum].ctfteam == 1) // red
prefix = "\x85[TEAM]";
else if (players[playernum].ctfteam == 2) // blue
prefix = "\x84[TEAM]";
else
prefix = "\x83"; // makes sure this doesn't implode if you sayteam on non-team gamemodes
fmt2 = "%s<%s%s>\x80%s %s%s";
}*/
HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, textcolor, msg), cv_chatnotifications.value); // add to chat
@@ -1658,7 +1647,7 @@ static void HU_drawMiniChat(void)
if (cv_chatbacktint.value) // on request of wolfy
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
V_DrawChatCharacter(x + dx + 2, y+dy+cv_chatcentertext.value, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
}
dx += charwidth;
@@ -1847,12 +1836,6 @@ static void HU_DrawChat(void)
if (teamtalk)
{
talk = ttalk;
#if 0
if (players[consoleplayer].ctfteam == 1)
t = 0x500; // Red
else if (players[consoleplayer].ctfteam == 2)
t = 0x400; // Blue
#endif
}
if (CHAT_MUTE)
@@ -2049,6 +2032,7 @@ static void HU_DrawChat(void)
V_DrawSmallString(chatx + boxw + 4, p_dispy - (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x82%d\x80 - %s", i, player_names[i]));
count++;
}
if (count == 0) // no results.
{
V_DrawFillConsoleMap(chatx + boxw + 2, p_dispy - (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud.
@@ -2304,7 +2288,7 @@ static void HU_DrawSongCreditsBox(void)
INT32 t = cursongcredit.anim;
INT32 bgt;
fixed_t interpoffset = FixedMul(BOXCREDITHEIGHT*dup*FRACUNIT/(TICRATE/2), R_GetHudUncap());
fixed_t interpoffset = FixedMul(BOXCREDITHEIGHT*dup*FRACUNIT/(TICRATE/2), R_GetTimeFrac(RTF_MENU));
if (t > BOXCREDITSLIDEIN)
{
-21
View File
@@ -91,27 +91,6 @@ void I_GetEvent(void);
*/
void I_OsPolling(void);
// Either returns a null ticcmd,
// or calls a loadable driver to build it.
// This ticcmd will then be modified by the gameloop
// for normal input.
/** \brief Input for the first player
*/
ticcmd_t *I_BaseTiccmd(void);
/** \brief Input for the second player
*/
ticcmd_t *I_BaseTiccmd2(void);
/** \brief Input for the third player
*/
ticcmd_t *I_BaseTiccmd3(void);
/** \brief Input for the fourth player
*/
ticcmd_t *I_BaseTiccmd4(void);
/** \brief Called by M_Responder when quit is selected, return exit code 0
*/
void I_Quit(void) FUNCNORETURN;
+2 -2
View File
@@ -60,7 +60,7 @@ void I_UpdateTime(fixed_t timescale)
tic_t realtics;
// get real tics
ticratescaled = (double)TICRATE * FixedToFloat(timescale);
ticratescaled = (double)TICRATE * FixedToDouble(timescale);
enterprecise = I_GetPreciseTime();
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();
@@ -79,6 +79,6 @@ void I_UpdateTime(fixed_t timescale)
{
double fractional, integral;
fractional = modf(tictimer * ticratescaled, &integral);
g_time.timefrac = FloatToFixed(fractional);
g_time.timefrac = DoubleToFixed(fractional);
}
}
+2 -5
View File
@@ -24,6 +24,8 @@ extern "C" {
#pragma interface
#endif
void I_SetTextInput(void);
typedef enum
{
/// Software
@@ -40,11 +42,6 @@ typedef enum
*/
extern rendermode_t rendermode;
/** \brief use highcolor modes if true
*/
extern boolean highcolor;
/** \brief setup video mode
*/
void I_StartupGraphics(void);
-70
View File
@@ -20176,73 +20176,3 @@ void P_PatchInfoTables(void)
for (i = MT_FIRSTFREESLOT; i <= MT_LASTFREESLOT; i++)
mobjinfo[i].doomednum = -1;
}
#ifdef ALLOW_RESETDATA
static char *sprnamesbackup;
static state_t *statesbackup;
static mobjinfo_t *mobjinfobackup;
static size_t sprnamesbackupsize, statesbackupsize, mobjinfobackupsize;
#endif
void P_BackupTables(void)
{
#ifdef ALLOW_RESETDATA
// Allocate buffers in size equal to that of the uncompressed data to begin with
sprnamesbackup = Z_Malloc(sizeof(sprnames), PU_STATIC, NULL);
statesbackup = Z_Malloc(sizeof(states), PU_STATIC, NULL);
mobjinfobackup = Z_Malloc(sizeof(mobjinfo), PU_STATIC, NULL);
// Sprite names
sprnamesbackupsize = lzf_compress(sprnames, sizeof(sprnames), sprnamesbackup, sizeof(sprnames));
if (sprnamesbackupsize > 0)
sprnamesbackup = Z_Realloc(sprnamesbackup, sprnamesbackupsize, PU_STATIC, NULL);
else
M_Memcpy(sprnamesbackup, sprnames, sizeof(sprnames));
// States
statesbackupsize = lzf_compress(states, sizeof(states), statesbackup, sizeof(states));
if (statesbackupsize > 0)
statesbackup = Z_Realloc(statesbackup, statesbackupsize, PU_STATIC, NULL);
else
M_Memcpy(statesbackup, states, sizeof(states));
// Mobj info
mobjinfobackupsize = lzf_compress(mobjinfo, sizeof(mobjinfo), mobjinfobackup, sizeof(mobjinfo));
if (mobjinfobackupsize > 0)
mobjinfobackup = Z_Realloc(mobjinfobackup, mobjinfobackupsize, PU_STATIC, NULL);
else
M_Memcpy(mobjinfobackup, mobjinfo, sizeof(mobjinfo));
#endif
}
void P_ResetData(INT32 flags)
{
#ifndef ALLOW_RESETDATA
(void)flags;
CONS_Alert(CONS_NOTICE, M_GetText("P_ResetData(): not supported in this build.\n"));
#else
if (flags & 1)
{
if (sprnamesbackupsize > 0)
lzf_decompress(sprnamesbackup, sprnamesbackupsize, sprnames, sizeof(sprnames));
else
M_Memcpy(sprnames, sprnamesbackup, sizeof(sprnamesbackup));
}
if (flags & 2)
{
if (statesbackupsize > 0)
lzf_decompress(statesbackup, statesbackupsize, states, sizeof(states));
else
M_Memcpy(states, statesbackup, sizeof(statesbackup));
}
if (flags & 4)
{
if (mobjinfobackupsize > 0)
lzf_decompress(mobjinfobackup, mobjinfobackupsize, mobjinfo, sizeof(mobjinfo));
else
M_Memcpy(mobjinfo, mobjinfobackup, sizeof(mobjinfobackup));
}
#endif
}
-4
View File
@@ -5147,8 +5147,4 @@ extern mobjinfo_t mobjinfo[NUMMOBJTYPES];
void P_PatchInfoTables(void);
void P_BackupTables(void);
void P_ResetData(INT32 flags);
#endif
+155 -95
View File
@@ -1073,7 +1073,7 @@ static void K_initKartHUD(void)
// K_GetScreenCoords needs the right view* variables
R_SetViewContext(stplyrnum);
R_InterpolateView(rendertimefrac_unpaused, !cv_uncappedhud.value);
R_InterpolateView(R_GetTimeFrac(RTF_CAMERA), !cv_uncappedhud.value);
}
UINT8 K_GetHudColor(void)
@@ -1089,6 +1089,11 @@ boolean K_UseColorHud(void)
return (cv_colorizedhud.value && clr_hud);
}
// Since all our extra Saturn things are in optional files
// we gotta do a bunch of extra checks to determine
// if the according Assets are actually loaded
// see D_CheckSaturnExtraFiles in d_main.c
enum
{
SPEEDO_VANILLA,
@@ -1138,6 +1143,33 @@ static boolean K_UseColorSpeedo(int speedostyle)
}
}
enum
{
GAUGE_DEFAULT = 1,
GAUGE_SMALL,
GAUGE_BIGNUM,
GAUGE_NUMONLY,
GAUGE_EXTRA,
};
static SINT8 K_GetDriftgaugeStyle(void)
{
if (driftgaugegfx)
{
if (cv_driftgaugestyle.value == 1)
return GAUGE_DEFAULT;
else if (cv_driftgaugestyle.value == 2)
return GAUGE_SMALL;
else if (cv_driftgaugestyle.value == 3)
return GAUGE_BIGNUM;
else if (cv_driftgaugestyle.value == 5 && xtra_speedo3)
return GAUGE_EXTRA;
}
// Fallback
return GAUGE_NUMONLY; // (cv_driftgaugestyle.value == 4)
}
static boolean K_IsHighResolution(void)
{
return (vid.width >= 640 && vid.height >= 400);
@@ -1148,7 +1180,7 @@ boolean K_UseHighResPortraits(void)
return (cv_highresportrait.value && K_IsHighResolution());
}
// returns the players faceprefix
// returns the players faceprefix patch
// accounts for localskins
patch_t *K_GetFacePrefix(player_t *player, INT32 skinnum)
{
@@ -1313,40 +1345,76 @@ static void K_drawKartStats(void)
spdxoffset = 0;
spdoffset = 0;
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
if (!LUA_HudEnabled(hud_statdisplay))
return;
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
//Internal offset for speedometer
const UINT8 speedostyle = K_GetSpeedometerStyle();
if (cv_kartspeedometer.value && (!splitscreen))
{
if ((speedostyle == SPEEDO_EXTRA) || (speedostyle == SPEEDO_ACHII) || (speedostyle == SPEEDO_EXTRA3))
spdoffset = -10;
else if (speedostyle == SPEEDO_DIAL)
switch (speedostyle)
{
spdxoffset = 11;
spdoffset = 14;
case SPEEDO_EXTRA:
case SPEEDO_ACHII:
case SPEEDO_EXTRA3:
spdoffset = -10;
break;
case SPEEDO_DIAL:
spdxoffset = 11;
spdoffset = 14;
break;
default:
spdoffset = -14;
break;
}
else
spdoffset = -14;
}
else
spdoffset = 0;
if ((speedostyle != SPEEDO_DIAL) || (splitscreen))
spdoffset += (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0);
if (G_BattleGametype() && ((speedostyle != SPEEDO_DIAL) || splitscreen))
spdoffset += ((stplyr->kartstuff[k_bumper] ? -5 : -8));
// Customizations c:
if (!splitscreen)
{
skin_t *fakeskin;
INT32 flags2;
x += 18 + cv_stat_xoffset.value + spdxoffset;
y += cv_stat_yoffset.value + spdoffset;
flags |= V_HUDTRANS;
flags2 = flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor);
fakeskin = K_GetPlayerSkin(stplyr);
// Skin name
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
{
V_DrawSmallString(x+20, y+12, flags2, fakeskin->realname);
}
else
{
V_DrawThinString(x+20, y+7, flags2, fakeskin->realname);
}
// Icon and stats
if (K_UseHighResPortraits())
V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
else
V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE));
V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE));
return;
}
else if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c:
if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c:
{
x -= 10;
y -= 40;
@@ -1384,35 +1452,8 @@ static void K_drawKartStats(void)
flags |= V_HUDTRANS;
if (!splitscreen)
{
skin_t *fakeskin;
fakeskin = K_GetPlayerSkin(stplyr);
// Skin name
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
{
V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor), fakeskin->realname);
}
else
{
V_DrawThinString(x+20, y+7, flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor), fakeskin->realname);
}
// Icon and stats
if (K_UseHighResPortraits())
V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
else
V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE));
V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE));
}
else
{
// In splitscreen, just draw a string with stats
V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight));
}
// In splitscreen, just draw a string with stats
V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight));
}
static void K_drawKartItem(void)
@@ -1699,7 +1740,7 @@ static void K_drawKartItem(void)
switch (stplyr->kartstuff[k_itemblinkmode])
{
case 2:
localcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
localcolor = K_RainbowColor();
break;
case 1:
localcolor = SKINCOLOR_RED;
@@ -1730,7 +1771,7 @@ static void K_drawKartItem(void)
if (cv_fancyroulette.value && stplyr->kartstuff[k_itemroulette] && !stplyr->deadtimer)
{
fixed_t frac = R_GetHudUncap();
fixed_t frac = R_GetTimeFrac(RTF_LEVEL);
UINT8 fancystep = (offset ? 6 : 10);
fixed_t fancyoffset = (stplyr->kartstuff[k_itemroulette] % 3)-1;
@@ -2454,8 +2495,9 @@ static void K_DrawDialSpeedometer(fixed_t speed,
const UINT8 infoidx = (infoactive) ? 1 : 0;
patch_t* dialpatch;
const fixed_t spd = FixedDiv(speed, divisor);
const angle_t speedangle =
FixedAngle(((min(135 * FRACUNIT, FixedDiv(speed, divisor)) - (45 * FRACUNIT))));
FixedAngle(((min(135 * FRACUNIT, spd) - (45 * FRACUNIT))));
rot = R_GetRollAngle(speedangle);
@@ -2788,7 +2830,7 @@ static void K_drawKartBumpersOrKarma(void)
}
}
#define lerp(from, to) cv_uncappedhud.value ? from + FixedMul(rendertimefrac, to - from) : to
#define lerp(from, to) cv_uncappedhud.value ? from + FixedMul(R_GetTimeFrac(RTF_LEVEL), to - from) : to
// converts mobj coordinates into screen coordinates
// NOTE: use with V_NOSCALESTART!
@@ -3038,6 +3080,12 @@ static void K_drawNameTags(void)
else
flipped = players[i].mo->eflags & MFE_VERTICALFLIP;
#ifdef HWRENDER
// Needs extra offset. Not perfect but this will do for now
if (rendermode == render_opengl && !cv_glshearing.value && cv_smallnametags.value)
namey -= dup*6;
#endif
if (cv_smallnametags.value || !nametaggfx)
{
if (flipped)
@@ -3149,7 +3197,7 @@ static void K_drawDriftGauge(void)
fixed_t basex, basey;
const int dup = vid.dupx;
int i;
UINT8 *cmap;
UINT8 *colormap = NULL;
static const UINT8 driftcolors[3][4] = {
{0, 0, 10, 16}, // no drift
@@ -3195,23 +3243,21 @@ skipcrap:
const INT32 driftcharge = min(driftval*4, stplyr->kartstuff[k_driftcharge]);
const INT32 driftlevel = min(driftcharge / driftval, 2);
const INT32 drifttrans = ((cv_driftgaugetrans.value) ? V_LocalTransFlag() : 0);
const SINT8 gaugestyle = K_GetDriftgaugeStyle();
basex = pos.x>>FRACBITS;
basey = pos.y>>FRACBITS;
switch (cv_driftgaugestyle.value)
switch (gaugestyle)
{
case 1:
case 2:
case 3:
case 5:
case GAUGE_DEFAULT:
case GAUGE_SMALL:
case GAUGE_EXTRA:
case GAUGE_BIGNUM:
{
if (!driftgaugegfx)
break;
patch_t *driftpatch = NULL;
const boolean usescaledpatch = (cv_driftgaugestyle.value == 5 && xtra_speedo3);
if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3 || usescaledpatch)
if (gaugestyle == GAUGE_DEFAULT || gaugestyle == GAUGE_BIGNUM || gaugestyle == GAUGE_EXTRA)
{
barx = basex - dup*23;
BAR_WIDTH = dup*47;
@@ -3224,40 +3270,44 @@ skipcrap:
bary = basey - dup*2;
if (usescaledpatch) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
if (gaugestyle == GAUGE_EXTRA) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
{
if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // Colourized hud
if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // We reuse the extra speedometer patch hence this check
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallstickerclr3, colormap, 0);
colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
driftpatch = skp_smallstickerclr3;
}
else
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallsticker3, NULL, 0);
driftpatch = skp_smallsticker3;
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap, 0);
}
else
{
if (K_UseColorHud()) // Colourized hud
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmallcolor : driftgaugecolor, colormap);
colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
driftpatch = (gaugestyle == GAUGE_SMALL ? driftgaugesmallcolor : driftgaugecolor);
}
else
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmall : driftgauge, NULL);
driftpatch = (gaugestyle == GAUGE_SMALL ? driftgaugesmall : driftgauge);
V_DrawMappedPatch(gaugestyle == GAUGE_SMALL ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap);
}
if (driftcharge >= driftval*4) // rainbow sparks
{
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
for (i = 0; i < 4; i++)
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 18 - 1)] + i*2) | V_NOSCALESTART|drifttrans);
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 17)] + i*2) | V_NOSCALESTART|drifttrans);
}
else // none/blue/red
{
const INT32 limit = (driftval * (driftcharge >= driftval*2 ? 2 : 1));
const INT32 width = ((driftcharge - (driftcharge >= driftval ? limit : 0)) * BAR_WIDTH) / limit;
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE);
for (i = 0; i < 4; i++)
{
@@ -3269,20 +3319,20 @@ skipcrap:
}
// right, also draw a cool number
if (cv_driftgaugestyle.value == 3)
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
if (gaugestyle == GAUGE_BIGNUM)
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
else
V_DrawPingNum(cv_driftgaugestyle.value == 2 ? basex + (dup*22) : basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, cmap);
V_DrawPingNum((gaugestyle == GAUGE_SMALL ? basex + (dup*22) : basex + (dup*32)), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, colormap);
}
break;
case 4:
case GAUGE_NUMONLY:
{
if (driftcharge >= driftval*4)
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
else
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE);
V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
}
break;
default:
@@ -3343,6 +3393,7 @@ static void K_drawKartWanted(void)
{
basex = WANT_X;
basey = WANT_Y;
if (splitscreen == 2)
{
basey += 16; // slight adjust for 3P
@@ -3457,7 +3508,7 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos;
fixed_t scale = FRACUNIT;
patch_t *AutomapPic;
patch_t *AutomapPic = NULL;
INT16 w, h;
AutomapPic = minimapinfo.minimap_pic;
@@ -3514,7 +3565,6 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
INT32 amxpos, amypos, wntdamxpos, wntdamypos;
fixed_t scale = FRACUNIT;
patch_t *minimaphead = NULL;
boolean minihead = K_useSmallMinimapHead(mo->player);
#ifdef ROTSPRITE
angle_t rollangle = 0;
@@ -3524,6 +3574,9 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
skin = K_GetMobjSkin(mo);
minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)];
if (minimaphead == NULL)
return;
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y);
@@ -3538,6 +3591,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags|V_SkinColorToHighlightcolor(mo->color), player_names[player - players]);
}
const boolean minihead = K_useSmallMinimapHead(mo->player);
// thx wanted reticle for having weird offsets very cool
wntdamxpos = minihead ? amxpos + (1<<FRACBITS) : amxpos - (4<<FRACBITS);
@@ -3707,7 +3761,7 @@ static void K_drawKartMinimap(void)
splitflags |= V_HUDTRANS;
const SINT8 icondotradius = ((cv_minihead.value == 1) && !cv_showminimapnames.value) ? 8 : 10;
patch_t* minipatch;
patch_t* minipatch = NULL;
INT32 rot;
INT32 blending;
@@ -3755,7 +3809,7 @@ static void K_drawKartMinimap(void)
else if (cv_showminimapangle.value == MINIANGLE_LIGHT)
{
rot = R_GetRollAngle(ang);
minipatch = W_CachePatchNameRotated("MMAPHDLT", rot, PU_PATCH);
minipatch = (patch_t *)W_CachePatchNameRotated("MMAPHDLT", rot, PU_PATCH);
blending = B_ADD;
xoff = yoff = 0;
@@ -3829,7 +3883,7 @@ static void K_drawKartFinish(void)
x = ((vid.width<<FRACBITS)/vid.dupx);
xval = (kp_racefinish[pnum]->width<<FRACBITS);
x = (FixedMul(((TICRATE - stplyr->kartstuff[k_cardanimation])<<FRACBITS) - R_GetHudUncap(), xval > x ? xval : x))/TICRATE;
x = (FixedMul(((TICRATE - stplyr->kartstuff[k_cardanimation])<<FRACBITS) - R_GetTimeFrac(RTF_LEVEL), xval > x ? xval : x))/TICRATE;
if (splitscreen && stplyrnum == 1)
x = -x;
@@ -3848,7 +3902,8 @@ static void K_drawBattleFullscreen(void)
// fill in the fractional bits
if (cardanim && cardanim != 164*FRACUNIT)
{
INT32 frac = R_GetHudUncap() * ((164 - stplyr->kartstuff[k_cardanimation])/8 + 1);
INT32 frac = R_GetTimeFrac(RTF_LEVEL) * ((164 - stplyr->kartstuff[k_cardanimation])/8 + 1);
if (stplyr->exiting)
cardanim += frac;
else
@@ -3952,7 +4007,6 @@ static void K_drawBattleFullscreen(void)
else
V_DrawFixedPatch(x<<FRACBITS, ty<<FRACBITS, scale, 0, kp_timeoutsticker, NULL);
V_DrawKartString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE));
}
}
@@ -4092,17 +4146,23 @@ static void K_drawKartFirstPerson(void)
x -= xoffs;
else
x += xoffs;
if (!splitscreen)
y += yoffs;
}
const INT32 driftcharge = stplyr->kartstuff[k_driftcharge];
// drift sparks!
if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsthree))
colmap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE);
else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dstwo))
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE);
else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsone))
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE);
if ((leveltime & 1) && driftcharge)
{
if (driftcharge >= dsthree)
colmap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
else if (driftcharge >= dstwo)
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE);
else if (driftcharge >= dsone)
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE);
}
else
#endif
// invincibility/grow/shrink!
@@ -4131,7 +4191,7 @@ static void K_drawInput(void)
const UINT8 hudcolor = K_GetHudColor();
const INT32 accent1 = splitflags|colortranslations[hudcolor][5];
const INT32 accent2 = splitflags|colortranslations[hudcolor][9];
const INT32 accent2 = splitflags|colortranslations[hudcolor][7];
const UINT8 *hudcolormap = R_GetTranslationColormap(0, hudcolor, GTC_CACHE);
const ticcmd_t *cmd = &stplyr->cmd;
@@ -4139,7 +4199,7 @@ static void K_drawInput(void)
if (timeinmap < 113)
{
INT32 count = ((INT32)(timeinmap) - 105);
INT32 frac = count > 0 && count < 6 ? R_GetHudUncap() << (FRACBITS - count - 11) : 0;
INT32 frac = count > 0 && count < 6 ? R_GetTimeFrac(RTF_LEVEL) << (FRACBITS - count - 11) : 0;
offs = 64*FRACUNIT;
while (count-- > 0)
@@ -4329,8 +4389,8 @@ static void K_drawLapStartAnim(void)
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
INT32 vflags = V_SNAPTOTOP|V_HUDTRANS;
fixed_t slideout = max(0, 32*(((progress - 76)*FRACUNIT) + R_GetHudUncap()));
fixed_t slidein = max(0, 32*(((stplyr->kartstuff[k_lapanimation] - 76)*FRACUNIT) - R_GetHudUncap()));
fixed_t slideout = max(0, 32*(((progress - 76)*FRACUNIT) + R_GetTimeFrac(RTF_LEVEL)));
fixed_t slidein = max(0, 32*(((stplyr->kartstuff[k_lapanimation] - 76)*FRACUNIT) - R_GetTimeFrac(RTF_LEVEL)));
// First, draw the emblem and hand
INT32 emblemx = (BASEVIDWIDTH << (FRACBITS - 1)) + slidein;
@@ -4341,7 +4401,7 @@ static void K_drawLapStartAnim(void)
INT32 hand = stplyr->kartstuff[k_laphand];
if (hand >= 1 && hand <= 3)
{
y += 4*FRACUNIT - abs((int)(leveltime % 8)*FRACUNIT + R_GetHudUncap() - 4*FRACUNIT);
y += 4*FRACUNIT - abs((int)(leveltime % 8)*FRACUNIT + R_GetTimeFrac(RTF_LEVEL) - 4*FRACUNIT);
V_DrawFixedPatch(emblemx, y, FRACUNIT, vflags, kp_lapanim_hand[hand - 1], NULL);
}
@@ -4667,7 +4727,7 @@ void K_drawKartHUD(void)
if (timeinmap < 113)
{
INT32 count = ((INT32)(timeinmap) - 104);
INT32 frac = count > 0 ? R_GetHudUncap() << max(0, FRACBITS - count - 9) : 0;
INT32 frac = count > 0 ? R_GetTimeFrac(RTF_LEVEL) << max(0, FRACBITS - count - 9) : 0;
offs = 256*FRACUNIT;
while (count-- > 0)
+114 -65
View File
@@ -91,16 +91,10 @@ static void saltyhop_onchange(void)
{
player_t *player = &players[i];
if (!player || !playeringame[i] || P_MobjWasRemoved(player->mo))
if (!player || P_MobjWasRemoved(player->mo))
continue;
player->mo->salty_jump = false;
player->mo->salty_zoffset = 0;
player->mo->salty_momz = 0;
player->mo->salty_ready = false;
player->mo->salty_tapping = false;
player->mo->init_salty = false;
memset(&player->mo->salty, 0, sizeof(player->mo->salty));
}
}
@@ -484,6 +478,15 @@ UINT8 colortranslations[MAXTRANSLATIONS][16] = {
{120, 120, 96, 96, 97, 98, 98, 99, 81, 81, 69, 71, 73, 75, 77, 79}, // SKINCOLOR_CSUPER5
};
//
// Gives you a color to use for rainbow effects (like invincibility).
// Return: Skincolor value.
//
UINT8 K_RainbowColor(void)
{
return (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
}
// Define for getting accurate color brightness readings according to how the human eye sees them.
// https://en.wikipedia.org/wiki/Relative_luminance
// 0.2126 to red
@@ -645,36 +648,46 @@ UINT8 K_GetKartColorByName(const char *name)
return 0;
}
//
// returns the players skinnumber
// accounts for localskins
//
INT32 K_GetSkinNum(player_t *player)
{
return player->localskin ? (player->localskin - 1) : player->skin;
}
//
// returns the mobj skinnumber
// accounts for localskins
//
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local)
{
return skin - K_GetSkinArray(local);
}
//
// returns the players skinnumber
// accounts for localskins
//
skin_t *K_GetMobjSkin(const mobj_t *mobj)
{
return mobj->localskin ? mobj->localskin : mobj->skin;
}
//
// returns the skin array to use
// accounts for localskins
//
skin_t *K_GetSkinArray(boolean local)
{
return local ? localskins : skins;
}
//
// returns the players skin
// accounts for localskins
//
skin_t *K_GetPlayerSkin(player_t *player)
{
return &K_GetSkinArray(player->skinlocal)[K_GetSkinNum(player)];
@@ -2901,6 +2914,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
mobj_t *dust;
mobj_t *truc;
INT32 speed, speed2;
fixed_t rand_x, rand_y, rand_z;
INT32 i, radius, height;
mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING);
@@ -2923,9 +2937,11 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
dust->scalespeed = source->scale/12;
P_InstaThrust(dust, dust->angle, FixedMul(20*FRACUNIT, source->scale));
truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT,
source->y + P_RandomRange(-radius, radius)*FRACUNIT,
source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMEXPLODE);
rand_z = source->z + P_RandomRange(0, height)*FRACUNIT;
rand_y = source->y + P_RandomRange(-radius, radius)*FRACUNIT;
rand_x = source->x + P_RandomRange(-radius, radius)*FRACUNIT;
truc = P_SpawnMobj(rand_x, rand_y, rand_z, MT_BOOMEXPLODE);
K_MatchGenericExtraFlags(truc, source);
P_SetScale(truc, source->scale);
truc->destscale = source->scale*6;
@@ -2942,9 +2958,11 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
for (i = 0; i < 16; i++)
{
dust = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT,
source->y + P_RandomRange(-radius, radius)*FRACUNIT,
source->z + P_RandomRange(0, height)*FRACUNIT, MT_SMOKE);
rand_z = source->z + P_RandomRange(0, height)*FRACUNIT;
rand_y = source->y + P_RandomRange(-radius, radius)*FRACUNIT;
rand_x = source->x + P_RandomRange(-radius, radius)*FRACUNIT;
dust = P_SpawnMobj(rand_x, rand_y, rand_z, MT_SMOKE);
P_SetMobjState(dust, S_OPAQUESMOKE1);
P_SetScale(dust, source->scale);
dust->destscale = source->scale*10;
@@ -2952,9 +2970,11 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
dust->tics = 30;
dust->momz = P_RandomRange(FixedMul(3*FRACUNIT, source->scale)>>FRACBITS, FixedMul(7*FRACUNIT, source->scale)>>FRACBITS)*FRACUNIT;
truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT,
source->y + P_RandomRange(-radius, radius)*FRACUNIT,
source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMPARTICLE);
rand_z = source->z + P_RandomRange(0, height)*FRACUNIT;
rand_y = source->y + P_RandomRange(-radius, radius)*FRACUNIT;
rand_x = source->x + P_RandomRange(-radius, radius)*FRACUNIT;
truc = P_SpawnMobj(rand_x, rand_y, rand_z, MT_BOOMPARTICLE);
K_MatchGenericExtraFlags(truc, source);
P_SetScale(truc, source->scale);
truc->destscale = source->scale*5;
@@ -3084,7 +3104,7 @@ static UINT16 K_DriftSparkColor(player_t *player, INT32 charge)
if (charge >= K_GetKartDriftSparkValue(player)*4)
{
color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
color = K_RainbowColor();
}
else if (charge >= K_GetKartDriftSparkValue(player)*2)
{
@@ -3313,70 +3333,70 @@ static void K_QuiteSaltyHop(player_t *player)
return;
// what the fuck is this haya
//fixed_t mos = FRACUNIT; // doesnt work correctly if it isnt :/
mobj_t *pmo = player->mo;
salty_t *psalt = &pmo->salty;
const boolean onground = P_IsObjectOnGround(pmo);
// ready?
if (!player->kartstuff[k_jmp])
{
pmo->salty_ready = true;
pmo->salty_tapping = false;
psalt->ready = true;
psalt->tapping = false;
}
else if (pmo->salty_ready)
else if (psalt->ready)
{
pmo->salty_ready = false;
pmo->salty_tapping = true;
psalt->ready = false;
psalt->tapping = true;
}
else
{
pmo->salty_tapping = false;
psalt->tapping = false;
}
// GO!
if (!pmo->init_salty)
if (!psalt->init)
{
pmo->salty_jump = false;
pmo->salty_zoffset = 0;
pmo->salty_momz = 0;
pmo->init_salty = true;
psalt->jump = false;
psalt->zoffset = 0;
psalt->momz = 0;
psalt->init = true;
}
else if (pmo->salty_jump)
else if (psalt->jump)
{
if (pmo->eflags & MFE_JUSTHITFLOOR)
{
pmo->salty_zoffset = 0;
psalt->zoffset = 0;
}
else if (onground)
{
pmo->salty_zoffset += pmo->salty_momz;
pmo->salty_momz -= (FRACUNIT*3/2);
psalt->zoffset += psalt->momz;
psalt->momz -= (FRACUNIT*3/2);
}
else
{
pmo->salty_zoffset *= (49/50)*FRACUNIT;
pmo->salty_momz = 0;
psalt->zoffset *= (49/50)*FRACUNIT;
psalt->momz = 0;
}
if (pmo->salty_zoffset <= 0)
if (psalt->zoffset <= 0)
{
if (cv_saltyhopsfx.value && !(pmo->eflags & MFE_JUSTHITFLOOR) && onground)
S_StartSound(pmo, sfx_s268);
pmo->salty_jump = false;
pmo->salty_zoffset = 0;
pmo->salty_momz = 0;
psalt->jump = false;
psalt->zoffset = 0;
psalt->momz = 0;
// shlamma damma
if (cv_saltysquish.value)
pmo->stretchslam += 8*FRACUNIT;
}
else if (cv_saltysquish.value && pmo->salty_zoffset >= 0)
else if (cv_saltysquish.value && psalt->zoffset >= 0)
{
// goofy ahh hack
pmo->spriteyscale += (FRACUNIT/8);
pmo->spritexscale -= (FRACUNIT/8);
}
pmo->spriteyoffset = FixedMul(pmo->salty_zoffset, cv_saltyheight.value);
pmo->spriteyoffset = FixedMul(psalt->zoffset, cv_saltyheight.value);
if (cv_saltyhopsfx.value)
{
@@ -3386,11 +3406,11 @@ static void K_QuiteSaltyHop(player_t *player)
S_StopSoundByID(pmo, sfx_drift);
}
}
else if (pmo->salty_tapping && onground && !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_squishedtimer])
else if (psalt->tapping && onground && !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_squishedtimer])
{
pmo->salty_jump = true;
pmo->salty_zoffset = 0;
pmo->salty_momz = 6*FRACUNIT;
psalt->jump = true;
psalt->zoffset = 0;
psalt->momz = 6*FRACUNIT;
if (cv_saltyhopsfx.value)
S_StartSound(pmo, sfx_s25a);
}
@@ -3417,7 +3437,7 @@ boolean K_ShouldSlopeRoll(mobj_t *mobj)
return false;
// seeing a character rotate mid-hop looks really janky
if (!cv_saltyroll.value && mobj->player && mobj->player->mo->salty_jump)
if (!cv_saltyroll.value && mobj->player && mobj->player->mo->salty.jump)
return false;
return K_CheckSlopeRollDist(mobj);
@@ -3611,9 +3631,13 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent)
else
aoff += ANGLE_45;
dust = P_SpawnMobj(mo->x + FixedMul(24*mo->scale, FINECOSINE(aoff>>ANGLETOFINESHIFT)) + (P_RandomRange(-8,8) << FRACBITS),
mo->y + FixedMul(24*mo->scale, FINESINE(aoff>>ANGLETOFINESHIFT)) + (P_RandomRange(-8,8) << FRACBITS),
mo->z, MT_WIPEOUTTRAIL);
fixed_t rand_x;
fixed_t rand_y;
rand_y = mo->y + FixedMul(24*mo->scale, FINESINE(aoff>>ANGLETOFINESHIFT)) + (P_RandomRange(-8,8) << FRACBITS);
rand_x = mo->x + FixedMul(24*mo->scale, FINECOSINE(aoff>>ANGLETOFINESHIFT)) + (P_RandomRange(-8,8) << FRACBITS);
dust = P_SpawnMobj(rand_x, rand_y, mo->z, MT_WIPEOUTTRAIL);
P_SetTarget(&dust->target, mo);
dust->angle = R_PointToAngle2(0,0,mo->momx,mo->momy);
@@ -4859,7 +4883,9 @@ static void K_MoveHeldObjects(player_t *player)
mobj_t *cur = player->mo->hnext;
mobj_t *targ = player->mo;
if (P_IsObjectOnGround(player->mo) && player->speed > 0)
const boolean ponground = P_IsObjectOnGround(player->mo);
if (ponground && player->speed > 0)
player->kartstuff[k_bananadrag]++;
while (!P_MobjWasRemoved(cur))
@@ -4916,13 +4942,18 @@ static void K_MoveHeldObjects(player_t *player)
targz -= 8*(2*FRACUNIT)/7;
}*/
if (cv_bananajitter.value && P_IsObjectOnGround(player->mo) && player->speed > 0 && player->kartstuff[k_bananadrag] > TICRATE
&& M_RandomChance(min(FRACUNIT/2, FixedDiv(player->speed, K_GetKartSpeed(player, false))/2)))
if (cv_bananajitter.value && ponground
&& player->speed > 0 && player->kartstuff[k_bananadrag] > TICRATE)
{
if (leveltime & 1)
cur->spriteyoffset += 8*(2*FRACUNIT)/7;
else
cur->spriteyoffset -= 8*(2*FRACUNIT)/7;
const fixed_t halfpspeed = FixedDiv(player->speed, K_GetKartSpeed(player, false))/2;
if (M_RandomChance(min(FRACUNIT/2, halfpspeed)))
{
if (leveltime & 1)
cur->spriteyoffset += 8*(2*FRACUNIT)/7;
else
cur->spriteyoffset -= 8*(2*FRACUNIT)/7;
}
}
if (speed > dist)
@@ -5371,7 +5402,7 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
else if (player->kartstuff[k_driftboost] <= 50)
speedcolor = SKINCOLOR_RASPBERRY;
else if (player->kartstuff[k_driftboost] <= 125)
speedcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
speedcolor = K_RainbowColor();
if (cv_coloredspeedlines.value == 2)
speedcolor = (leveltime & 1) ? playercolor : speedcolor;
@@ -5400,10 +5431,15 @@ FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player, bool
{
randomFunc randomfunc = synched ? P_RandomRange : M_RandomRange;
mobj_t *fast = P_SpawnMobj(player->mo->x + (randomfunc(-36,36) * player->mo->scale),
player->mo->y + (randomfunc(-36,36) * player->mo->scale),
player->mo->z + (player->mo->height/2) + (randomfunc(-20,20) * player->mo->scale),
MT_FASTLINE);
fixed_t rand_x;
fixed_t rand_y;
fixed_t rand_z;
rand_z = player->mo->z + (player->mo->height/2) + (randomfunc(-20,20) * player->mo->scale);
rand_y = player->mo->y + (randomfunc(-36,36) * player->mo->scale);
rand_x = player->mo->x + (randomfunc(-36,36) * player->mo->scale);
mobj_t *fast = P_SpawnMobj(rand_x, rand_y, rand_z, MT_FASTLINE);
fast->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
fast->momx = 3*player->mo->momx/4;
@@ -6010,14 +6046,27 @@ static void K_KartDrift(player_t *player, boolean onground)
if (player->speed > minspeed*2)
player->kartstuff[k_getsparks] = 1;
const boolean driftblue = (player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone);
const boolean driftred = (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo);
const boolean driftrainbow = (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree);
// Sound whenever you get a different tier of sparks
if ((player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone)
|| (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo)
|| (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree))
if (driftblue
|| driftred
|| driftrainbow)
{
//S_StartSound(player->mo, sfx_s3ka2);
if (P_IsLocalPlayer(player)) // UGHGHGH...
{
S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh...
}
if (driftrainbow)
player->driftlevel = 3;
else if (driftred)
player->driftlevel = 2;
else if (driftblue)
player->driftlevel = 1;
player->driftsparkGrowTimer = DRIFTSPARKGROWTICS;
}
+1
View File
@@ -19,6 +19,7 @@ extern "C" {
extern UINT8 colortranslations[MAXTRANSLATIONS][16];
extern const char *KartColor_Names[MAXSKINCOLORS];
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
UINT8 K_RainbowColor(void);
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
UINT8 K_GetKartColorByName(const char *name);
+20 -24
View File
@@ -99,11 +99,12 @@ static int lib_chatprint(lua_State *L)
{
const char *str = luaL_checkstring(L, 1); // retrieve string
boolean sound = lua_optboolean(L, 2); // retrieve sound boolean
int len = strlen(str);
if (str == NULL) // error if we don't have a string!
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprint"));
int len = strlen(str);
if (len > 255) // string is too long!!!
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
@@ -117,7 +118,6 @@ static int lib_chatprintf(lua_State *L)
int n = lua_gettop(L); /* number of arguments */
const char *str = luaL_checkstring(L, 2); // retrieve string
boolean sound = lua_optboolean(L, 3); // sound?
int len = strlen(str);
player_t *plr;
if (n < 2)
@@ -126,12 +126,15 @@ static int lib_chatprintf(lua_State *L)
plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
if (!plr)
return LUA_ErrInvalid(L, "player_t");
if (plr != &players[consoleplayer])
return 0;
if (str == NULL) // error if we don't have a string!
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprintf"));
int len = strlen(str);
if (len > 255) // string is too long!!!
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
@@ -236,7 +239,7 @@ static int lib_pRandomChance(lua_State *L)
// P_MAPUTIL
///////////////
static int lib_pAproxDistance(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_pAproxDistance(lua_State *L)
{
fixed_t dx = luaL_checkfixed(L, 1);
fixed_t dy = luaL_checkfixed(L, 2);
@@ -1110,19 +1113,10 @@ static int lib_pCheckSight(lua_State *L)
//HUDSAFE?
if (!t1 || !t2)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_CheckSight(t1, t2));
return 1;
}
// DONT USE THIS FOR ANYTHING GAMEPLAY, THIS WILL DESYNCH!
static int lib_pCheckSightFast(lua_State *L)
{
mobj_t *t1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *t2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
//HUDSAFE?
if (!t1 || !t2)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_CheckSightFast(t1, t2));
if (hud_running)
lua_pushboolean(L, P_CheckSightFast(t1, t2));
else
lua_pushboolean(L, P_CheckSight(t1, t2));
return 1;
}
@@ -1643,7 +1637,7 @@ static int lib_evCrumbleChain(lua_State *L)
// P_SLOPES
////////////
static int lib_pGetZAt(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_pGetZAt(lua_State *L)
{
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
fixed_t x = luaL_checkfixed(L, 2);
@@ -1659,7 +1653,7 @@ static int lib_pGetZAt(lua_State *L)
// R_DEFS
////////////
static int lib_rPointToAngle(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_rPointToAngle(lua_State *L)
{
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
@@ -1668,7 +1662,7 @@ static int lib_rPointToAngle(lua_State *L)
return 1;
}
static int lib_rPointToAngle2(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_rPointToAngle2(lua_State *L)
{
fixed_t px2 = luaL_checkfixed(L, 1);
fixed_t py2 = luaL_checkfixed(L, 2);
@@ -1679,7 +1673,7 @@ static int lib_rPointToAngle2(lua_State *L)
return 1;
}
static int lib_rPointToDist(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_rPointToDist(lua_State *L)
{
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
@@ -1688,7 +1682,7 @@ static int lib_rPointToDist(lua_State *L)
return 1;
}
static int lib_rPointToDist2(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_rPointToDist2(lua_State *L)
{
fixed_t px2 = luaL_checkfixed(L, 1);
fixed_t py2 = luaL_checkfixed(L, 2);
@@ -1699,12 +1693,15 @@ static int lib_rPointToDist2(lua_State *L)
return 1;
}
static int lib_rPointInSubsector(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_rPointInSubsector(lua_State *L)
{
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
//HUDSAFE
LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR);
if (hud_running)
LUA_PushUserdata(L, R_PointInSubsectorFast(x, y), META_SUBSECTOR);
else
LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR);
return 1;
}
@@ -3180,7 +3177,6 @@ static luaL_Reg lib[] = {
{"P_SlideMove",lib_pSlideMove},
{"P_BounceMove",lib_pBounceMove},
{"P_CheckSight", lib_pCheckSight},
{"P_CheckSightFast", lib_pCheckSightFast},
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
{"P_RadiusAttack",lib_pRadiusAttack},
{"P_FloorzAtPos",lib_pFloorzAtPos},
+1
View File
@@ -136,6 +136,7 @@ void COM_Lua_f(void)
lua_pop(gL, 1); // pop command info table
return; // can't execute splitscreen command without player 2!
}
playernum = displayplayers[1];
}
+6
View File
@@ -66,6 +66,7 @@
X (IntermissionThinker),/* Y_Ticker */\
X (VoteThinker),/*SRB2KART*/\
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
X (SetupVote),/*SRB2KART - Saturn*/
#define STRING_HOOK_LIST(X) \
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
@@ -140,3 +141,8 @@ int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); /
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
// SRB2KART - Saturn: Allows changing vote level picks
// (note: function format in lua doesn't include maxresults, so its function(result, gametype, secondgametype, prevmap)
// to get maxresults use #result)
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt);
+41 -1
View File
@@ -393,7 +393,7 @@ FUNCINLINE static ATTRINLINE boolean prepare_string_hook
return false;
}
static boolean prepare_hud_hook
FUNCINLINE static ATTRINLINE boolean prepare_hud_hook
(
Hook_State * hook,
int hook_type
@@ -1138,3 +1138,43 @@ boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *sourc
{
return kartdamage_hook(player, inflictor, source, HOOK(PlayerExplode), res_true);
}
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt)
{
Hook_State hook;
if (prepare_hook(&hook, 0, HOOK(SetupVote)))
{
// { 0, 0, 0, 0, }
lua_newtable(gL);
for (int i = 1; i <= maxresults; ++i)
{
lua_pushinteger(gL, 0);
lua_rawseti(gL, -2, i);
}
// call_hooks does lua_settop(gL, 0) so we need to store our table somewhere
lua_pushvalue(gL, -1);
lua_setfield(gL, LUA_REGISTRYINDEX, "SetupVoteResults");
lua_pushinteger(gL, gt);
lua_pushinteger(gL, secondgt);
lua_pushinteger(gL, prevmap+1); // prevmap is gamemap-1 so we offset it back
call_hooks(&hook, 0, res_none);
lua_getfield(gL, LUA_REGISTRYINDEX, "SetupVoteResults");
for (int i = 1; i <= maxresults; ++i)
{
lua_rawgeti(gL, -1, i);
result[i-1] = lua_tointeger(gL, -1);
lua_pop(gL, 1);
if (result[i-1] && (result[i-1] < 0 || !mapheaderinfo[result[i-1]-1]))
{
CONS_Alert(CONS_WARNING, "Unknown map #%d for vote\n", result[i-1]);
result[i-1] = 0;
}
}
lua_pop(gL, 1);
}
}
+21 -17
View File
@@ -239,7 +239,7 @@ static int lib_getHudInfo(lua_State *L)
return 1;
}
static int lib_hudinfolen(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_hudinfolen(lua_State *L)
{
lua_pushinteger(L, NUMHUDITEMS);
return 1;
@@ -281,14 +281,14 @@ static int hudinfo_set(lua_State *L)
return 0;
}
static int hudinfo_num(lua_State *L)
FUNCINLINE static ATTRINLINE int hudinfo_num(lua_State *L)
{
hudinfo_t *info = *((hudinfo_t **)luaL_checkudata(L, 1, META_HUDINFO));
lua_pushinteger(L, info-hudinfo);
return 1;
}
static int colormap_get(lua_State *L)
FUNCINLINE static ATTRINLINE int colormap_get(lua_State *L)
{
return luaL_error(L, "colormap is not a struct.");
}
@@ -327,7 +327,7 @@ static int patch_get(lua_State *L)
return 1;
}
static int patch_set(lua_State *L)
FUNCINLINE static ATTRINLINE int patch_set(lua_State *L)
{
return luaL_error(L, LUA_QL("patch_t") " struct cannot be edited by Lua.");
}
@@ -395,14 +395,14 @@ static int camera_get(lua_State *L)
// lib_draw
//
static int libd_patchExists(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_patchExists(lua_State *L)
{
HUDONLY
lua_pushboolean(L, W_LumpExists(luaL_checkstring(L, 1)));
return 1;
}
static int libd_cachePatch(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_cachePatch(lua_State *L)
{
HUDONLY
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH);
@@ -1066,14 +1066,14 @@ static int libd_getColorHudPatch(lua_State *L)
return 2;
}
static int libd_getHudColor(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_getHudColor(lua_State *L)
{
HUDONLY
lua_pushinteger(L, K_GetHudColor());
return 1;
}
static int libd_useColorHud(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_useColorHud(lua_State *L)
{
HUDONLY
lua_pushboolean(L, K_UseColorHud());
@@ -1081,21 +1081,21 @@ static int libd_useColorHud(lua_State *L)
}
static int libd_width(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_width(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.width); // push screen width
return 1;
}
static int libd_height(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_height(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.height); // push screen height
return 1;
}
static int libd_dupx(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_dupx(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.dupx); // push integral scale (patch scale)
@@ -1103,7 +1103,7 @@ static int libd_dupx(lua_State *L)
return 2;
}
static int libd_dupy(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_dupy(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.dupy); // push integral scale (patch scale)
@@ -1111,7 +1111,7 @@ static int libd_dupy(lua_State *L)
return 2;
}
static int libd_renderer(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_renderer(lua_State *L)
{
HUDONLY
switch (rendermode) {
@@ -1124,7 +1124,7 @@ static int libd_renderer(lua_State *L)
// 30/10/18 Lat': Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int
// Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn
static int libd_getlocaltransflag(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_getlocaltransflag(lua_State *L)
{
HUDONLY
lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V
@@ -1229,7 +1229,7 @@ static int lib_draw_ref;
//
// enable vanilla HUD element
static int lib_hudenable(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_hudenable(lua_State *L)
{
enum hud option = luaL_checkoption(L, 1, NULL, hud_disable_options);
hud_enabled[option/8] |= 1<<(option%8);
@@ -1237,7 +1237,7 @@ static int lib_hudenable(lua_State *L)
}
// disable vanilla HUD element
static int lib_huddisable(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_huddisable(lua_State *L)
{
enum hud option = luaL_checkoption(L, 1, NULL, hud_disable_options);
hud_enabled[option/8] &= ~(1<<(option%8));
@@ -1245,7 +1245,7 @@ static int lib_huddisable(lua_State *L)
}
// 30/10/18: Lat': How come this wasn't here before?
static int lib_hudenabled(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_hudenabled(lua_State *L)
{
enum hud option = luaL_checkoption(L, 1, NULL, hud_disable_options);
if (hud_enabled[option/8] & (1<<(option%8)))
@@ -1278,6 +1278,10 @@ static int lib_hudsetvotebackground(lua_State *L)
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
// Update background if we're already on vote screen
if (gamestate == GS_VOTING)
Y_VoteScreenCheck();
return 0;
}
+1 -1
View File
@@ -576,7 +576,7 @@ void LUA_HUD_DrawList(huddrawlist_h list)
{
size_t i;
size_t j = 0;
fixed_t frac = R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT;
fixed_t frac = R_GetTimeFrac(RTF_INTER);
fixed_t lerpx = 0, lerpy = 0;
drawitem_t *latchitem = NULL;
drawitem_t *oldlatchitem = NULL;
+9 -9
View File
@@ -62,7 +62,7 @@ static int lib_getSprname(lua_State *L)
}
/// \todo Maybe make it tally up the used_spr from dehacked?
static int lib_sprnamelen(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_sprnamelen(lua_State *L)
{
lua_pushinteger(L, NUMSPRITES);
return 1;
@@ -122,7 +122,7 @@ static void A_Lua(mobj_t *actor)
}
// Arbitrary states[] table index -> state_t *
static int lib_getState(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_getState(lua_State *L)
{
UINT32 i;
lua_remove(L, 1);
@@ -214,7 +214,7 @@ static int lib_setState(lua_State *L)
}
// #states -> NUMSTATES
static int lib_statelen(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_statelen(lua_State *L)
{
lua_pushinteger(L, NUMSTATES);
return 1;
@@ -482,7 +482,7 @@ static int state_num(lua_State *L)
///////////////
// Arbitrary mobjinfo[] table index -> mobjinfo_t *
static int lib_getMobjInfo(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_getMobjInfo(lua_State *L)
{
UINT32 i;
lua_remove(L, 1);
@@ -593,7 +593,7 @@ static int lib_setMobjInfo(lua_State *L)
}
// #mobjinfo -> NUMMOBJTYPES
static int lib_mobjinfolen(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_mobjinfolen(lua_State *L)
{
lua_pushinteger(L, NUMMOBJTYPES);
return 1;
@@ -869,7 +869,7 @@ static int mobjinfo_set(lua_State *L)
}
// mobjinfo_t * -> MT_*
static int mobjinfo_num(lua_State *L)
FUNCINLINE static ATTRINLINE int mobjinfo_num(lua_State *L)
{
mobjinfo_t *info = *((mobjinfo_t **)luaL_checkudata(L, 1, META_MOBJINFO));
@@ -885,7 +885,7 @@ static int mobjinfo_num(lua_State *L)
//////////////
// Arbitrary S_sfx[] table index -> sfxinfo_t *
static int lib_getSfxInfo(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_getSfxInfo(lua_State *L)
{
UINT32 i;
lua_remove(L, 1);
@@ -988,7 +988,7 @@ static int lib_setSfxInfo(lua_State *L)
return 0;
}
static int lib_sfxlen(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_sfxlen(lua_State *L)
{
lua_pushinteger(L, NUMSFX);
return 1;
@@ -1062,7 +1062,7 @@ static int sfxinfo_set(lua_State *L)
return 0;
}
static int sfxinfo_num(lua_State *L)
FUNCINLINE static ATTRINLINE int sfxinfo_num(lua_State *L)
{
sfxinfo_t *sfx = *((sfxinfo_t **)luaL_checkudata(L, 1, META_SFXINFO));
+11 -11
View File
@@ -559,7 +559,7 @@ static int sector_set(lua_State *L)
return 0;
}
static int sector_num(lua_State *L)
FUNCINLINE static ATTRINLINE int sector_num(lua_State *L)
{
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
lua_pushinteger(L, sector-sectors);
@@ -598,7 +598,7 @@ static int subsector_get(lua_State *L)
return 0;
}
static int subsector_num(lua_State *L)
FUNCINLINE static ATTRINLINE int subsector_num(lua_State *L)
{
subsector_t *subsector = *((subsector_t **)luaL_checkudata(L, 1, META_SUBSECTOR));
lua_pushinteger(L, subsector-subsectors);
@@ -698,7 +698,7 @@ static int line_get(lua_State *L)
return 0;
}
static int line_num(lua_State *L)
FUNCINLINE static ATTRINLINE int line_num(lua_State *L)
{
line_t *line = *((line_t **)luaL_checkudata(L, 1, META_LINE));
lua_pushinteger(L, line-lines);
@@ -827,7 +827,7 @@ static int side_set(lua_State *L)
return 0;
}
static int side_num(lua_State *L)
FUNCINLINE static ATTRINLINE int side_num(lua_State *L)
{
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
lua_pushinteger(L, side-sides);
@@ -866,7 +866,7 @@ static int vertex_get(lua_State *L)
return 0;
}
static int vertex_num(lua_State *L)
FUNCINLINE static ATTRINLINE int vertex_num(lua_State *L)
{
vertex_t *vertex = *((vertex_t **)luaL_checkudata(L, 1, META_VERTEX));
lua_pushinteger(L, vertex-vertexes);
@@ -913,7 +913,7 @@ static int lib_getSector(lua_State *L)
return 0;
}
static int lib_numsectors(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_numsectors(lua_State *L)
{
lua_pushinteger(L, numsectors);
return 1;
@@ -959,7 +959,7 @@ static int lib_getSubsector(lua_State *L)
return 0;
}
static int lib_numsubsectors(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_numsubsectors(lua_State *L)
{
lua_pushinteger(L, numsubsectors);
return 1;
@@ -1005,7 +1005,7 @@ static int lib_getLine(lua_State *L)
return 0;
}
static int lib_numlines(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_numlines(lua_State *L)
{
lua_pushinteger(L, numlines);
return 1;
@@ -1051,7 +1051,7 @@ static int lib_getSide(lua_State *L)
return 0;
}
static int lib_numsides(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_numsides(lua_State *L)
{
lua_pushinteger(L, numsides);
return 1;
@@ -1097,7 +1097,7 @@ static int lib_getVertex(lua_State *L)
return 0;
}
static int lib_numvertexes(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_numvertexes(lua_State *L)
{
lua_pushinteger(L, numvertexes);
return 1;
@@ -1467,7 +1467,7 @@ static int lib_getMapheaderinfo(lua_State *L)
return 0;
}
static int lib_nummapheaders(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_nummapheaders(lua_State *L)
{
lua_pushinteger(L, NUMMAPS);
return 1;
+20 -20
View File
@@ -23,14 +23,14 @@
// General math
//////////////////
static int lib_abs(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_abs(lua_State *L)
{
int a = (int)luaL_checkinteger(L, 1);
lua_pushinteger(L, abs(a));
return 1;
}
static int lib_min(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_min(lua_State *L)
{
int a = luaL_checkinteger(L, 1);
int b = luaL_checkinteger(L, 2);
@@ -38,7 +38,7 @@ static int lib_min(lua_State *L)
return 1;
}
static int lib_max(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_max(lua_State *L)
{
int a = luaL_checkinteger(L, 1);
int b = luaL_checkinteger(L, 2);
@@ -49,31 +49,31 @@ static int lib_max(lua_State *L)
// Angle math
////////////////
static int lib_fixedangle(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedangle(lua_State *L)
{
lua_pushangle(L, FixedAngle(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_anglefixed(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_anglefixed(lua_State *L)
{
lua_pushfixed(L, AngleFixed(luaL_checkangle(L, 1)));
return 1;
}
static int lib_invangle(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_invangle(lua_State *L)
{
lua_pushangle(L, InvAngle(luaL_checkangle(L, 1)));
return 1;
}
static int lib_finesine(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_finesine(lua_State *L)
{
lua_pushfixed(L, FINESINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
return 1;
}
static int lib_finecosine(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_finecosine(lua_State *L)
{
lua_pushfixed(L, FINECOSINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
return 1;
@@ -101,19 +101,19 @@ static int lib_finetangent(lua_State *L)
// Fixed math
////////////////
static int lib_fixedmul(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedmul(lua_State *L)
{
lua_pushfixed(L, FixedMul(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1;
}
static int lib_fixedint(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedint(lua_State *L)
{
lua_pushinteger(L, FixedInt(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixeddiv(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixeddiv(lua_State *L)
{
fixed_t i = luaL_checkfixed(L, 1);
fixed_t j = luaL_checkfixed(L, 2);
@@ -123,13 +123,13 @@ static int lib_fixeddiv(lua_State *L)
return 1;
}
static int lib_fixedrem(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedrem(lua_State *L)
{
lua_pushfixed(L, FixedRem(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1;
}
static int lib_fixedsqrt(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedsqrt(lua_State *L)
{
fixed_t i = luaL_checkfixed(L, 1);
if (i < 0)
@@ -138,31 +138,31 @@ static int lib_fixedsqrt(lua_State *L)
return 1;
}
static int lib_fixedhypot(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedhypot(lua_State *L)
{
lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1;
}
static int lib_fixedfloor(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedfloor(lua_State *L)
{
lua_pushfixed(L, FixedFloor(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixedtrunc(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedtrunc(lua_State *L)
{
lua_pushfixed(L, FixedTrunc(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixedceil(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedceil(lua_State *L)
{
lua_pushfixed(L, FixedCeil(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixedround(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_fixedround(lua_State *L)
{
lua_pushfixed(L, FixedRound(luaL_checkfixed(L, 1)));
return 1;
@@ -172,13 +172,13 @@ static int lib_fixedround(lua_State *L)
// (aka extra little funcs that don't quite fit in baselib)
//////////////////////////////////////////////////////////////////
static int lib_getsecspecial(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_getsecspecial(lua_State *L)
{
lua_pushinteger(L, GETSECSPECIAL(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)));
return 1;
}
static int lib_all7emeralds(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_all7emeralds(lua_State *L)
{
lua_pushboolean(L, ALL7EMERALDS(luaL_checkinteger(L, 1)));
return 1;
+10 -9
View File
@@ -251,14 +251,15 @@ int mobj_angle_setter(lua_State *L)
mobj_t *mo = GETMO();
mo->angle = luaL_checkangle(L, 2);
if (mo->player == &players[consoleplayer])
localangle[0] = mo->angle;
else if (mo->player == &players[displayplayers[1]])
localangle[1] = mo->angle;
else if (mo->player == &players[displayplayers[2]])
localangle[2] = mo->angle;
else if (mo->player == &players[displayplayers[3]])
localangle[3] = mo->angle;
for (UINT8 i = 0; i <= splitscreen; i++)
{
if (mo->player == P_GetLocalPlayerForNum(i))
{
localangle[i] = mo->angle;
break;
}
}
return 0;
}
@@ -979,7 +980,7 @@ static int lib_getMapthing(lua_State *L)
return 0;
}
static int lib_nummapthings(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_nummapthings(lua_State *L)
{
lua_pushinteger(L, nummapthings);
return 1;
+29 -47
View File
@@ -267,14 +267,14 @@ int player_aiming_setter(lua_State *L)
player_t *plr = GETPLAYER();
plr->aiming = luaL_checkangle(L, 2);
if (plr == &players[consoleplayer])
localaiming[0] = plr->aiming;
else if (plr == &players[displayplayers[1]])
localaiming[1] = plr->aiming;
else if (plr == &players[displayplayers[2]])
localaiming[2] = plr->aiming;
else if (plr == &players[displayplayers[3]])
localaiming[3] = plr->aiming;
for (UINT8 i = 0; i <= splitscreen; i++)
{
if (plr == P_GetLocalPlayerForNum(i))
{
localaiming[i] = plr->aiming;
break;
}
}
return 0;
}
@@ -438,7 +438,7 @@ static int lib_getPlayer(lua_State *L)
}
// #players -> MAXPLAYERS
static int lib_lenPlayer(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_lenPlayer(lua_State *L)
{
lua_pushinteger(L, MAXPLAYERS);
return 1;
@@ -448,47 +448,29 @@ static int lib_lenPlayer(lua_State *L)
static int lib_iterateDisplayplayers(lua_State *L)
{
INT32 i = -1;
INT32 temp = -1;
INT32 iter = 0;
INT32 i = lua_tonumber(L, lua_upvalueindex(1));
if (lua_gettop(L) < 2)
{
//return luaL_error(L, "Don't call displayplayers.iterate() directly, use it as 'for player in displayplayers.iterate do <block> end'.");
lua_pushcfunction(L, lib_iterateDisplayplayers);
lua_pushcclosure(L, lib_iterateDisplayplayers, 1);
return 1;
}
lua_settop(L, 2);
lua_remove(L, 1); // state is unused.
if (!lua_isnil(L, 1))
if (i <= splitscreen)
{
temp = (INT32)(*((player_t **)luaL_checkudata(L, 1, META_PLAYER)) - players); // get the player # of the last iterated player.
// @FIXME:
// I didn't quite find a better way for this; Here, we go back to which player in displayplayers we last iterated to resume the for loop below for this new function call
// I don't understand enough about how the Lua stacks work to get this to work in possibly a single line.
// So anyone feel free to correct this!
for (; iter < MAXSPLITSCREENPLAYERS; iter++)
{
if (displayplayers[iter] == temp)
{
i = iter;
break;
}
}
}
for (i++; i < MAXSPLITSCREENPLAYERS; i++)
{
if (i > splitscreen || !playeringame[displayplayers[i]])
return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers.
if (!players[displayplayers[i]].mo)
continue;
if (!playeringame[displayplayers[i]])
return 0;
// Return player and splitscreen index.
LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER);
lua_pushinteger(L, i); // push this to recall what number we were on for the next function call. I suppose this also means you can retrieve the splitscreen player number with 'for p, n in displayplayers.iterate'!
lua_pushnumber(L, i);
// Update splitscreen index value for next iteration.
lua_pushnumber(L, i + 1);
lua_pushvalue(L, -1);
lua_replace(L, lua_upvalueindex(1));
lua_pop(L, 1);
return 2;
}
return 0;
@@ -516,14 +498,14 @@ static int lib_getDisplayplayers(lua_State *L)
field = luaL_checkstring(L, 2);
if (fastcmp(field,"iterate"))
{
lua_pushcfunction(L, lib_iterateDisplayplayers);
lua_pushcclosure(L, lib_iterateDisplayplayers, 1);
return 1;
}
return 0;
}
// #displayplayers -> MAXSPLITSCREENPLAYERS
static int lib_lenDisplayplayers(lua_State *L)
FUNCINLINE static ATTRINLINE int lib_lenDisplayplayers(lua_State *L)
{
lua_pushinteger(L, MAXSPLITSCREENPLAYERS);
return 1;
@@ -631,7 +613,7 @@ static int player_set(lua_State *L)
#undef NOSET
static int player_num(lua_State *L)
FUNCINLINE static ATTRINLINE int player_num(lua_State *L)
{
player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
if (!plr)
@@ -668,7 +650,7 @@ static int power_set(lua_State *L)
}
// #powers -> NUMPOWERS
static int power_len(lua_State *L)
FUNCINLINE static ATTRINLINE int power_len(lua_State *L)
{
lua_pushinteger(L, NUMPOWERS);
return 1;
@@ -702,7 +684,7 @@ static int kartstuff_set(lua_State *L)
}
// #kartstuff -> NUMKARTSTUFF
static int kartstuff_len(lua_State *L)
FUNCINLINE static ATTRINLINE int kartstuff_len(lua_State *L)
{
lua_pushinteger(L, NUMKARTSTUFF);
return 1;
+74 -18
View File
@@ -24,6 +24,7 @@
#include "p_slopes.h" // for P_SlopeById
#include "s_sound.h"
#include "m_menu.h"
#include "m_argv.h"
#ifdef LUA_ALLOW_BYTECODE
#include "d_netfil.h" // for LUA_DumpFile
#endif
@@ -252,7 +253,11 @@ static inline void LUA_LoadFile(MYFILE *f, char *name)
lua_pushcfunction(gL, LUA_GetErrorMessage);
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, lua_gettop(gL) - 1)) {
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
if (M_CheckParm("-strict") || M_CheckParm("-strict-lua"))
I_Error("Lua error: %s", lua_tostring(gL, -1));
else
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
lua_pop(gL,1);
}
lua_gc(gL, LUA_GCCOLLECT, 0);
@@ -366,7 +371,18 @@ void LUA_DumpFile(const char *filename)
}
#endif
fixed_t LUA_EvalMath(const char *word)
static void createMathLibState(void)
{
mL = lua_newstate(LUA_Alloc, NULL);
lua_atpanic(mL, LUA_Panic);
// open only enum lib
lua_pushcfunction(mL, LUA_EnumLib);
lua_pushboolean(mL, true);
lua_call(mL, 1, 0);
}
fixed_t LUA_EvalMathEx(const char *word, const char **error)
{
char buf[1024], *b;
const char *p;
@@ -375,15 +391,7 @@ fixed_t LUA_EvalMath(const char *word)
// make a new state so SOC can't interefere with scripts
// allocate state
if (mL == NULL)
{
mL = lua_newstate(LUA_Alloc, NULL);
lua_atpanic(mL, LUA_Panic);
// open only enum lib
lua_pushcfunction(mL, LUA_EnumLib);
lua_pushboolean(mL, true);
lua_call(mL, 1, 0);
}
createMathLibState();
// change ^ into ^^ for Lua.
strcpy(buf, "return ");
@@ -394,6 +402,9 @@ fixed_t LUA_EvalMath(const char *word)
if (*p == '^')
*b++ = '^';
}
// length of word is zero!?
if (p == word)
return 0;
*b = '\0';
// eval string.
@@ -409,7 +420,7 @@ fixed_t LUA_EvalMath(const char *word)
p += 3; // "1: "
}
CONS_Alert(CONS_WARNING, "%s\n", p);
if (error) *error = p;
}
else
res = lua_tointeger(mL, -1);
@@ -417,6 +428,51 @@ fixed_t LUA_EvalMath(const char *word)
return res;
}
fixed_t LUA_EvalMath(const char *word)
{
const char *error = NULL;
fixed_t res = LUA_EvalMathEx(word, &error);
if (error)
CONS_Alert(CONS_WARNING, "%s\n", error);
return res;
}
// A hack to prevent lua from crashing game if constant doesn't exist
static int lua_get_constant(lua_State *L)
{
lua_pushvalue(mL, LUA_GLOBALSINDEX);
lua_pushvalue(L, 1);
lua_gettable(L, -2);
return 1;
}
fixed_t LUA_GetConstant(const char *word)
{
if (mL == NULL)
createMathLibState();
fixed_t res = 0;
lua_pushcfunction(mL, lua_get_constant);
lua_pushstring(mL, word);
if (lua_pcall(mL, 1, 1, 0) == 0)
{
if (lua_isnumber(mL, -1))
res = lua_tointeger(mL, -1);
}
else
{
// Pop error message
lua_pop(mL, 1);
}
return res;
}
void LUA_InvalidateMathlibCache(const char *name)
{
// No state => no cache => nothing to invalidate :3
@@ -1023,8 +1079,8 @@ static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX, boolean network)
case ARCH_MOBJ:
if (network == false) // for replays :chaosleep:
{
*p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game.
return 3; // Don't set the field
*p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game.
return 3; // Don't set the field
}
LUA_PushUserdata(gL, P_FindNewPosition(READUINT32(*p)), META_MOBJ);
@@ -1099,9 +1155,9 @@ static void UnArchiveExtVars(UINT8 **p, void *pointer, boolean network)
CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field);
break;
}
else if (ret == 3) // This will return 3 if we shouldn't set this field.
else if (ret == 3) // This will return 3 if we shouldn't set this field.
{
CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field);
//CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field);
continue;
}
@@ -1155,7 +1211,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
ret = UnArchiveValue(p, TABLESINDEX, network);
if (ret == 3)
{
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
lua_pushnil(gL);
}
else if (ret == 1) // read key
@@ -1170,7 +1226,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
}
else if (ret == 3)
{
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
lua_pushnil(gL);
}
else if (ret == 2) // read value
+10
View File
@@ -13,6 +13,10 @@
#ifndef LUA_SCRIPT_H
#define LUA_SCRIPT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "m_fixed.h"
#include "doomtype.h"
#include "d_player.h"
@@ -48,7 +52,9 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump);
#ifdef LUA_ALLOW_BYTECODE
void LUA_DumpFile(const char *filename);
#endif
fixed_t LUA_EvalMathEx(const char *word, const char **error);
fixed_t LUA_EvalMath(const char *word);
fixed_t LUA_GetConstant(const char *word);
// Need better name for this ;-;
void LUA_InvalidateMathlibCache(const char *name);
@@ -104,4 +110,8 @@ void COM_Lua_f(void);
}\
}
#ifdef __cplusplus
} // extern "C"
#endif
#endif/*LUA_SCRIPT_H*/
+87
View File
@@ -13,6 +13,7 @@
#include "m_aatree.h"
#include "z_zone.h"
#include "m_misc.h"
// A partial implementation of AA trees,
// according to the algorithms given on Wikipedia.
@@ -27,6 +28,13 @@ typedef struct aatree_node_s
struct aatree_node_s *left, *right;
} aatree_node_t;
typedef struct aatree_entry_s
{
struct aatree_entry_s *next;
char *key;
void *value;
} aatree_entry_t;
struct aatree_s
{
aatree_node_t *root;
@@ -143,9 +151,77 @@ static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32
void M_AATreeSet(aatree_t *aatree, INT32 key, void* value)
{
I_Assert((aatree->flags & AATREE_STRING) == 0);
aatree->root = M_AATreeSet_Node(aatree->root, aatree->flags, key, value);
}
static aatree_node_t *M_AATreeSetString_Node(aatree_node_t *node, UINT32 flags, INT32 hash, const char *key, void* value)
{
if (!node)
{
// Nothing here, so just add where we are
aatree_entry_t *entry = Z_Malloc(sizeof(aatree_entry_t), PU_STATIC, NULL);
entry->next = NULL;
entry->key = Z_StrDup(key);
if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &entry->value);
else entry->value = value;
node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
node->key = hash;
node->value = entry;
node->left = node->right = NULL;
node->depth = 1;
}
else
{
if (hash < node->key)
node->left = M_AATreeSetString_Node(node->left, flags, hash, key, value);
else if (hash > node->key)
node->right = M_AATreeSetString_Node(node->right, flags, hash, key, value);
else
{
aatree_entry_t *entry = node->value;
if (entry != NULL && strcmp(entry->key, key) != 0)
entry = entry->next;
if (entry != NULL)
{
if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &entry->value);
else entry->value = value;
}
else
{
entry = Z_Malloc(sizeof(aatree_entry_t), PU_STATIC, NULL);
entry->next = node->value;
entry->key = Z_StrDup(key);
if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &entry->value);
else entry->value = value;
node->value = entry;
}
}
node = M_AATreeRebalance(node);
if (node->left == NULL && node->right == NULL)
node->depth = 1;
else if (node->left == NULL)
node->depth = node->right->depth + 1;
else if (node->right == NULL)
node->depth = node->left->depth + 1;
else if (node->left->depth > node->right->depth)
node->depth = node->left->depth + 1;
else
node->depth = node->right->depth + 1;
}
return node;
}
void M_AATreeSetString(aatree_t *aatree, const char *key, void *value)
{
I_Assert((aatree->flags & AATREE_STRING) == AATREE_STRING);
UINT32 hash = FNV1a_HashString(key);
aatree->root = M_AATreeSetString_Node(aatree->root, aatree->flags, hash, key, value);
}
// Caveat: we don't distinguish between nodes that don't exists
// and nodes with value == NULL.
static void *M_AATreeGet_Node(aatree_node_t *node, INT32 key)
@@ -165,9 +241,20 @@ static void *M_AATreeGet_Node(aatree_node_t *node, INT32 key)
void *M_AATreeGet(aatree_t *aatree, INT32 key)
{
I_Assert((aatree->flags & AATREE_STRING) == 0);
return M_AATreeGet_Node(aatree->root, key);
}
void *M_AATreeGetString(aatree_t *aatree, const char *key)
{
I_Assert((aatree->flags & AATREE_STRING) == AATREE_STRING);
UINT32 hash = FNV1a_HashString(key);
aatree_entry_t *entry = M_AATreeGet_Node(aatree->root, hash);
while (entry != NULL && strcmp(entry->key, key) != 0)
entry = entry->next;
return entry != NULL ? entry->value : NULL;
}
static void M_AATreeIterate_Node(aatree_node_t *node, aatree_iter_t callback)
{
if (node->left) M_AATreeIterate_Node(node->left, callback);
+3
View File
@@ -18,6 +18,7 @@
// Flags for AA trees.
#define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields
#define AATREE_STRING 2 // Use strings for keys rather than ints
typedef struct aatree_s aatree_t;
typedef void (*aatree_iter_t)(INT32 key, void *value);
@@ -25,7 +26,9 @@ typedef void (*aatree_iter_t)(INT32 key, void *value);
aatree_t *M_AATreeAlloc(UINT32 flags);
void M_AATreeFree(aatree_t *aatree);
void M_AATreeSet(aatree_t *aatree, INT32 key, void* value);
void M_AATreeSetString(aatree_t *aatree, const char *key, void *value);
void *M_AATreeGet(aatree_t *aatree, INT32 key);
void *M_AATreeGetString(aatree_t *aatree, const char *key);
void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback);
#endif
+46 -3
View File
@@ -18,6 +18,7 @@
#include "z_zone.h"
#include "v_video.h"
#include "i_video.h"
#include "i_system.h" // I_GetPreciseTime
#ifdef HWRENDER
#include "hardware/hw_main.h"
@@ -26,16 +27,26 @@
// GIFs are always little-endian
#include "byteptr.h"
CV_PossibleValue_t gif_dynamicdelay_cons_t[] = {
{0, "Off"},
{1, "On"},
{2, "Accurate, experimental"},
{0, NULL}};
consvar_t cv_gif_optimize = {"gif_optimize", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_gif_dynamicdelay = {"gif_dynamicdelay", "On", CV_SAVE, gif_dynamicdelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#ifdef HAVE_ANIGIF
static boolean gif_optimize = false; // So nobody can do something dumb
static boolean gif_downscale = false; // like changing cvars mid output
static UINT8 gif_dynamicdelay = (UINT8)0; // and messing something up
static RGBA_t *gif_palette = NULL;
static FILE *gif_out = NULL;
static INT32 gif_frames = 0;
static precise_t gif_prevframetime = 0;
static UINT32 gif_delayus = 0; // "us" is microseconds
static UINT8 gif_writeover = 0;
@@ -550,11 +561,39 @@ static void GIF_framewrite(void)
// screen regions are handled in GIF_lzw
{
int d1 = (int)((100.0f/NEWTICRATE)*(gif_frames+1));
int d2 = (int)((100.0f/NEWTICRATE)*(gif_frames));
UINT16 delay = d1-d2;
UINT16 delay = 0;
INT32 startline;
if (gif_dynamicdelay ==(UINT8) 2)
{
// golden's attempt at creating a "dynamic delay"
UINT16 mingifdelay = 10; // minimum gif delay in milliseconds (keep at 10 because gifs can't get more precise).
gif_delayus += (I_GetPreciseTime() - gif_prevframetime) / (I_GetPrecisePrecision() / 1000000); // increase delay by how much time was spent between last measurement
if (gif_delayus/1000 >= mingifdelay) // delay is big enough to be able to effect gif frame delay?
{
int frames = (gif_delayus/1000) / mingifdelay; // get amount of frames to delay.
delay = frames; // set the delay to delay that amount of frames.
gif_delayus -= frames*(mingifdelay*1000); // remove frames by the amount of milliseconds they take. don't reset to 0, the microseconds help consistency.
}
}
else if (gif_dynamicdelay ==(UINT8) 1)
{
float delayf = ceil(100.0f/NEWTICRATE);
delay = (UINT16)((I_GetPreciseTime() - gif_prevframetime)) / (I_GetPrecisePrecision() / 1000000) /10/1000;
if (delay < (UINT16)(delayf))
delay = (UINT16)(delayf);
}
else
{
// the original code
int d1 = (int)((100.0f/NEWTICRATE)*(gif_frames+1));
int d2 = (int)((100.0f/NEWTICRATE)*(gif_frames));
delay = d1-d2;
}
WRITEMEM(p, gifframe_gchead, 4);
WRITEUINT16(p, delay);
@@ -619,6 +658,7 @@ static void GIF_framewrite(void)
}
fwrite(gifframe_data, 1, (p - gifframe_data), gif_out);
++gif_frames;
gif_prevframetime = I_GetPreciseTime();
}
@@ -639,12 +679,15 @@ INT32 GIF_open(const char *filename)
gif_optimize = (!!cv_gif_optimize.value);
gif_downscale = (!!cv_gif_downscale.value);
gif_dynamicdelay = (UINT8)cv_gif_dynamicdelay.value;
// no master palettes in SRB2Kart land
gif_palette = pLocalPalette;
GIF_headwrite();
gif_frames = 0;
gif_prevframetime = I_GetPreciseTime();
gif_delayus = 0;
return 1;
}
+1 -1
View File
@@ -27,6 +27,6 @@ void GIF_frame(void);
INT32 GIF_close(void);
#endif
extern consvar_t cv_gif_optimize, cv_gif_downscale;
extern consvar_t cv_gif_optimize, cv_gif_dynamicdelay, cv_gif_downscale;
#endif
+8 -7
View File
@@ -830,18 +830,18 @@ void OP_NightsObjectplace(player_t *player)
mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
mt->angle = (INT16)(mt->angle+(INT16)((FixedInt(FixedDiv(temp*FRACUNIT, 360*(FRACUNIT/256))))<<8));
P_SpawnHoopsAndRings(mt);
P_SpawnHoops(mt);
}
// This places a ring!
if (cmd->buttons & BT_BACKWARD)
/*if (cmd->buttons & BT_BACKWARD)
{
player->pflags |= PF_ATTACKDOWN;
if (!OP_HeightOkay(player, false))
return;
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_RING].doomednum, false);
P_SpawnHoopsAndRings(mt);
//P_SpawnHoopsAndRings(mt);
}
// This places a wing item!
@@ -852,8 +852,8 @@ void OP_NightsObjectplace(player_t *player)
return;
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSWING].doomednum, false);
P_SpawnHoopsAndRings(mt);
}
//P_SpawnHoopsAndRings(mt);
}*/
// This places a custom object as defined in the console cv_mapthingnum.
if (cmd->buttons & BT_BRAKE)
@@ -891,7 +891,7 @@ void OP_NightsObjectplace(player_t *player)
|| mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops
|| mt->type == 1800) // Mario Coin
{
P_SpawnHoopsAndRings(mt);
P_SpawnHoops(mt);
}
else
P_SpawnMapThing(mt);
@@ -1022,7 +1022,8 @@ void OP_ObjectplaceMovement(player_t *player)
|| mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops
|| mt->type == 1800) // Mario Coin
{
P_SpawnHoopsAndRings(mt);
// NiGHTS hoops only
P_SpawnHoops(mt);
}
else
P_SpawnMapThing(mt);
+2 -2
View File
@@ -23,7 +23,7 @@
#include "m_fixed.h"
#include "tables.h" // ANGLETOFINESHIFT
fixed_t FixedSqrt(fixed_t x)
FUNCMATH fixed_t FixedSqrt(fixed_t x)
{
#ifdef HAVE_SQRT
const float fx = FIXED_TO_FLOAT(x);
@@ -61,7 +61,7 @@ fixed_t FixedSqrt(fixed_t x)
#endif
}
fixed_t FixedHypot(fixed_t x, fixed_t y)
FUNCMATH fixed_t FixedHypot(fixed_t x, fixed_t y)
{
// Moved the code from R_PointToDist2 to here,
// since R_PointToDist2 did the same thing,
+61 -44
View File
@@ -683,6 +683,12 @@ static void M_ResetCvars(void)
}
}
// This is not a particular elegant solution, but it seems to make do for our purposes
static boolean M_CheckTextInput(void)
{
return (menuactive && currentMenu && (itemOn < currentMenu->numitems) && (((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING) || (currentMenu->menuitems[itemOn].status == IT_MSGHANDLER && currentMenu->menuitems[itemOn].alphaKey != MM_EVENTHANDLER) || ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER)));
}
// If current menu item is IT_CV_STRING, setup menuinput
static void M_CheckStringItem(void)
{
@@ -1030,7 +1036,6 @@ boolean M_Responder(event_t *ev)
// Handle menuitems which need a specific key handling
if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER)
{
menu_text_input = true;
ch = M_ShiftChar(ch);
routine(ch);
return true;
@@ -1070,7 +1075,6 @@ boolean M_Responder(event_t *ev)
{
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING)
{
menu_text_input = true;
if (M_ChangeStringCvar(ch))
return true;
else
@@ -1725,6 +1729,10 @@ void M_Ticker(void)
interpTimerHackAllow = true;
menu_text_input = M_CheckTextInput();
I_SetTextInput();
//added : 30-01-98 : test mode for five seconds
if (vidm_testingmode > 0)
{
@@ -2135,7 +2143,8 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
char** clines = NULL;
INT16 num_lines = 0;
if (icopy == NULL) return;
if (icopy == NULL)
return;
char* tok = strtok(icopy, "\n");
@@ -2143,17 +2152,26 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
{
char* line = strdup(tok);
if (line == NULL) return;
if (line == NULL)
{
goto cleanup;
}
clines = realloc(clines, (num_lines + 1) * sizeof(char*));
char **tmp = realloc(clines, (num_lines + 1) * sizeof(char *));
if (tmp == NULL)
{
free(line);
goto cleanup;
}
clines = tmp;
clines[num_lines] = line;
num_lines++;
tok = strtok(NULL, "\n");
}
free(icopy);
INT16 yoffset;
yoffset = (((5*10 - num_lines*10)));
@@ -2172,11 +2190,17 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
V_DrawCenteredThinString(x, y + yoffset, option, clines[i]);
V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]);
yoffset += 10;
// Remember to free the memory for each line when you're done with it.
free(clines[i]);
}
free(clines);
cleanup:
if (clines)
{
// Remember to free the memory for each line when you're done with it.
for (int i = 0; i < num_lines; i++)
free(clines[i]);
free(clines);
}
free(icopy);
}
static void M_DoToolTips(menu_t* menu)
@@ -3716,6 +3740,7 @@ static void M_HandleAddons(INT32 choice)
default:
break;
}
if (exitmenu)
{
closefilemenu(true);
@@ -3752,7 +3777,7 @@ I_mutex replayquerymutex;
#endif/*HAVE_THREADS*/
#define MAXREPLAYQUERY 40
#define MAXREPLAYQUERY 37
static char replayqueryinput_buffer[MAXREPLAYQUERY+1]; // The input typed
static textinput_t replayqueryinput;
@@ -3915,13 +3940,12 @@ static void PrepReplayList(boolean reset)
replayquerycheck = replayqueryfound = 0;
if (demolist)
Z_Free(demolist);
Z_Free(demolist);
demolist = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
// If directory didn't change, keep demolist_all
if (!reset) return;
if (!reset)
return;
Lock_search_state();
@@ -4454,7 +4478,7 @@ static void M_DrawReplayHut(void)
DrawReplayHutReplayInfo();
}
x -= 40;
x = 4;
// Draw search query
M_DrawTextBoxFlags(x, 200 - 22, MAXREPLAYQUERY, 1, V_SNAPTOBOTTOM);
@@ -4577,17 +4601,23 @@ static void M_DrawReplayStartMenu(void)
V_DrawSmallString(4, BASEVIDHEIGHT-14, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, warning);
}
void M_ResetDemoList(void)
{
Z_Free(demolist_all);
demolist_all = NULL;
Z_Free(demolist);
demolist = NULL;
demo.inreplayhut = false;
}
static boolean M_QuitReplayHut(void)
{
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
menuactive = false;
D_StartTitle();
if (demolist)
Z_Free(demolist);
demolist = NULL;
demo.inreplayhut = false;
M_ResetDemoList();
return true;
}
@@ -5271,24 +5301,13 @@ static void M_DrawSkyRoom(void)
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
currentMenu->y+currentMenu->menuitems[2].alphaKey,
(digital_disabled ? warningflags : highlightflags),
(digital_disabled ? "OFF" : "ON"));
#ifndef NO_MIDI
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
currentMenu->y+currentMenu->menuitems[5].alphaKey,
(midi_disabled ? warningflags : highlightflags),
(midi_disabled ? "OFF" : "ON"));
#endif
(music_disabled ? warningflags : highlightflags),
(music_disabled ? "OFF" : "ON"));
if (itemOn == 0)
lengthstring = 8*(sound_disabled ? 3 : 2);
else if (itemOn == 2)
lengthstring = 8*(digital_disabled ? 3 : 2);
#ifndef NO_MIDI
else if (itemOn == 5)
lengthstring = 8*(midi_disabled ? 3 : 2);
#endif
lengthstring = 8*(music_disabled ? 3 : 2);
}
for (i = 0; i < currentMenu->numitems; ++i)
@@ -6743,7 +6762,7 @@ static void M_DrawConnectMenu(void)
{
const float ease = serverlistslidex / 2.f;
const INT32 offx = serverlistslidex > 0 ? BASEVIDWIDTH : -(BASEVIDWIDTH);
const INT32 x = (FLOAT_TO_FIXED(serverlistslidex) + ease * rendertimefrac) / FRACUNIT;
const INT32 x = (FLOAT_TO_FIXED(serverlistslidex) + ease * R_GetTimeFrac(RTF_MENU)) / FRACUNIT;
M_DrawServerLines(currentMenu->x + x - offx, oldserverlistpage);
M_DrawServerLines(currentMenu->x + x, serverlistpage);
@@ -7002,7 +7021,7 @@ void M_PopupMasterServerConnectError(void)
{
if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0)
{
M_StartMessage(M_GetText("There was a problem connecting to\ncustom Master Server\n\nYou've changed the Server Browser address.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\n"), connect_error_continue == STARTSERVER_MENU ? M_PreStartServerMenuChoice : M_PreConnectMenuChoice,MM_EVENTHANDLER);
M_StartMessage(M_GetText("There was a problem connecting to\ncustom Master Server\n\nYou've changed the Server Browser address.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\n"), connect_error_continue == STARTSERVER_MENU ? M_PreStartServerMenuChoice : M_PreConnectMenuChoice, MM_EVENTHANDLER);
}
else
{
@@ -7057,7 +7076,7 @@ static INT32 M_FindFirstMap(INT32 gtype)
{
INT32 i;
if (mapheaderinfo[gamemap] && (mapheaderinfo[gamemap]->typeoflevel & gtype))
if (mapheaderinfo[gamemap-1] && (mapheaderinfo[gamemap-1]->typeoflevel & gtype))
return gamemap;
for (i = 0; i < NUMMAPS; i++)
@@ -7092,8 +7111,6 @@ static void M_StartServer(INT32 choice)
if (demo.playback)
G_StopDemo();
if (metalrecording)
G_StopMetalDemo();
if (!cv_nextmap.value)
CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, 0, false, NULL)+1);
@@ -9174,7 +9191,6 @@ static void M_DrawControl(void)
char tmp[50];
INT32 x, y, i, max, cursory = 0, iter;
INT32 keys[2];
menu_text_input = false; //never use native layout for control setup
x = currentMenu->x;
y = currentMenu->y;
@@ -9274,12 +9290,10 @@ static void M_ChangecontrolResponse(event_t *ev)
INT32 control;
INT32 found;
INT32 ch = ev->data1;
menu_text_input = false; //never use native layout for control setup
// ESCAPE cancels; dummy out PAUSE
if (ch != KEY_ESCAPE && ch != KEY_PAUSE)
{
switch (ev->type)
{
// ignore mouse/joy movements, just get buttons
@@ -9309,6 +9323,7 @@ static void M_ChangecontrolResponse(event_t *ev)
found = 0;
else if (setupcontrols[control][1] ==ch)
found = 1;
if (found >= 0)
{
// replace mouse and joy clicks by double clicks
@@ -9336,9 +9351,11 @@ static void M_ChangecontrolResponse(event_t *ev)
found = 0;
setupcontrols[control][1] = KEY_NULL; //replace key 1,clear key2
}
(void)G_CheckDoubleUsage(ch, true);
setupcontrols[control][found] = ch;
}
S_StartSound(NULL, sfx_s221);
}
else if (ch == KEY_PAUSE)
+1
View File
@@ -319,6 +319,7 @@ void GameFocus_menu_Onchange (void);
void M_UpdateOGLMenu(void);
#endif
void M_ResetDemoList(void);
void M_ReplayHut(INT32 choice);
void M_SetPlaybackMenuPointer(void);
+50 -55
View File
@@ -933,30 +933,28 @@ static menuitem_t OP_ExpOptionsMenu[] =
{
{IT_HEADER, NULL, "Advanced Video Options", NULL, 0},
{IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_maxinterpdist, 10},
{IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 15},
{IT_STRING | IT_CVAR, NULL, "Scale Weather with Mobjscale", &cv_mobjscaleprecip, 25},
{IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 30},
{IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 20},
{IT_STRING | IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 40},
{IT_STRING | IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 30},
//{IT_STRING | IT_CVAR, NULL, "Randomized Directional Light", &cv_randomdirlight, 55}, // should this ever come back
//{IT_STRING | IT_CVAR, NULL, "Randomized Directional Light", &cv_randomdirlight, 45}, // should this ever come back
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 50},
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 40},
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 60},
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 50},
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 70},
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 60},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 80},
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 70},
#ifdef USE_FBO_OGL
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 85},
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 95},
{IT_DISABLED, NULL, "", NULL, 105}, // dummy text
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 75},
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 85},
{IT_DISABLED, NULL, "", NULL, 95}, // dummy text
#else
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 90},
{IT_DISABLED, NULL, "", NULL, 100}, // dummy text
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 80},
{IT_DISABLED, NULL, "", NULL, 90}, // dummy text
#endif
#endif
};
@@ -965,8 +963,6 @@ static const char* OP_ExpTooltips[] =
{
NULL,
"How far Mobj interpolation should take effect.",
"Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.",
"Should weather be scaled with Mapobjectscale?.",
"When weather is on this will cut the object amount used in half.",
"Sets minimum sector brightness, useful for dark areas",
//"Should the directional lightning be randomized each map?\nTakes effect on next map load.",
@@ -986,8 +982,6 @@ enum
{
op_exp_header,
op_exp_interpdist,
op_exp_precipinter,
op_exp_precipmoscale,
op_exp_lessprecip,
op_exp_secbright,
//op_exp_dirlight,
@@ -1070,29 +1064,26 @@ enum
static menuitem_t OP_SoundOptionsMenu[] =
{
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "SFX", &cv_gamesounds, 10},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
NULL, "SFX Volume", &cv_soundvolume, 18},
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "SFX Volume", &cv_soundvolume, 18},
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "Music", &cv_gamedigimusic, 30},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
NULL, "Music Volume", &cv_digmusicvolume, 38},
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "Music Volume", &cv_digmusicvolume, 38},
#ifndef NO_MIDI
{IT_STRING|IT_CVAR, NULL, "MIDI", &cv_gamemidimusic, 50},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
NULL, "MIDI Volume", &cv_midimusicvolume, 58},
//#ifndef NO_MIDI
#if 0
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "MIDI Volume", &cv_midimusicvolume, 46},
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 50},
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 60},
{IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 65},
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 75},
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 85},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
{IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 75},
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 95},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 105},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 105},
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 115},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 115},
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 125},
{IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 125}
{IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 135}
#else
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 60},
@@ -1114,8 +1105,8 @@ static const char* OP_SoundTooltips[] =
"Volume of Sound effects.",
"Turn Music on or off.",
"Volume of Music.",
#ifndef NO_MIDI
"Turn Midi Music on or off.",
//#ifndef NO_MIDI
#if 0
"Volume of Midi Music.",
#endif
"Reverse left and right channels of audio.",
@@ -1190,7 +1181,7 @@ static menuitem_t OP_FocusOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 100},
{IT_STRING|IT_CVAR, NULL, "Always Grab Mouse While Focused", &cv_alwaysgrabmouse, 120},
{IT_STRING|IT_CVAR, NULL, "Visible Mouse", &cv_mousevisible, 120},
};
static const char* OP_FocusOptionsTooltips[] =
@@ -1201,7 +1192,7 @@ static const char* OP_FocusOptionsTooltips[] =
"Should the game pause while the game is unfocused?",
"Set manual framerate cap while the game is unfocused.",
"Should the FOCUS LOST window appear\n while the game is unfocused?",
"Should the mouse cursor be grabbed and hidden\n while the game is in focus?",
"Displays the mouse cursor while the game is in focus.",
};
static menuitem_t OP_DataOptionsMenu[] =
@@ -1349,14 +1340,15 @@ static const char* OP_CamOptionsTooltips[] =
};
#define OP_CAMMENU(pnum) \
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[pnum], 30}, \
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[pnum], 50}, \
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[pnum], 60}, \
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[pnum], 70}, \
{IT_STRING | IT_CVAR, NULL, "Camera Lookback Momentum", &cv_lookbackmom[pnum], 90}, \
{IT_STRING | IT_CVAR, NULL, "Camera Vertical Look", &cv_verticallook[pnum], 100}, \
{IT_STRING | IT_CVAR, NULL, "Freecam Speed", &cv_freecam_speed[pnum], 120}, \
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[pnum], 135}, \
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[pnum], 30}, \
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[pnum], 50}, \
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[pnum], 60}, \
{IT_STRING | IT_CVAR, NULL, "Camera Slope Pitch", &cv_cam_pitch[pnum], 70}, \
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[pnum], 80}, \
{IT_STRING | IT_CVAR, NULL, "Camera Lookback Momentum", &cv_cam_lookbackmom[pnum], 100}, \
{IT_STRING | IT_CVAR, NULL, "Camera Vertical Look", &cv_verticallook[pnum], 110}, \
{IT_STRING | IT_CVAR, NULL, "Freecam Speed", &cv_freecam_speed[pnum], 130}, \
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[pnum], 145}, \
static menuitem_t OP_Player1CamOptionsMenu[] =
{
@@ -1388,6 +1380,7 @@ static const char* OP_PlayerCamOptionsTooltips[] =
"Should the Camera flip on gravity flipped sections?.",
"Camera distance relative to the Player.",
"Height of the Camera",
"Pitch Camera on Upwards or Downhill Slopes",
"Speed of the Camera",
"Should looking back inherit the Players Momentum?\nEither inherit Player Momentum or double of it\nmay make looking back while boosting or going in high speed less jarring",
"Allows looking up/down by holding\naim forward/backward while standing still.",
@@ -1405,18 +1398,19 @@ static menuitem_t OP_ChatOptionsMenu[] =
NULL, "Chat Box Width", &cv_chatwidth, 20},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Chat Box Height", &cv_chatheight, 30},
{IT_STRING | IT_CVAR, NULL, "Center Text in Chat", &cv_chatcentertext, 40},
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 45},
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 55},
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 65},
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 75},
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 55},
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 65},
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 75},
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 85},
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 95}, // shows ping above the framerate if we want to.
{IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 105},
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 115},
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 125},
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 105}, // shows ping above the framerate if we want to.
{IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 115},
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 125},
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 135},
{IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 135},
{IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 145},
};
static const char* OP_ChatOptionsTooltips[] =
@@ -1424,6 +1418,7 @@ static const char* OP_ChatOptionsTooltips[] =
"Chat mode used for in-game chat.",
"Width of chat box.",
"Height of chat box.",
"Center text in the chat message pop ups.",
"Chatbox background.",
"Fadeout time for new chat message.",
"Spam protection for in-game chat.",
+1 -1
View File
@@ -96,7 +96,7 @@ ATTRINLINE static fixed_t FUNCINLINE __internal_prng__(void)
randomseed ^= randomseed >> 13;
randomseed ^= randomseed >> 11;
randomseed ^= randomseed << 21;
return ( (randomseed*36548569) >> 4) & (FRACUNIT-1);
return ((randomseed*36548569) >> 4) & (FRACUNIT-1);
}
/** Provides a random fixed point number. Distribution is uniform.
+273 -256
View File
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1995-1996 by the Free Software Foundation, Inc.
// Copyright (C) 1995-2025 by the Free Software Foundation, Inc.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -33,7 +33,7 @@
#include "endian.h"
#if defined (SRB2_BIG_ENDIAN)
#define SWAP(n) \
#define SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#else
#define SWAP(n) (n)
@@ -46,27 +46,31 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /*, 0, 0, ... */ };
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
md5_uint32 A;
md5_uint32 B;
md5_uint32 C;
md5_uint32 D;
md5_uint32 A;
md5_uint32 B;
md5_uint32 C;
md5_uint32 D;
md5_uint32 total[2];
md5_uint32 buflen;
char buffer[128];
md5_uint32 total[2];
md5_uint32 buflen;
union
{
char buffer[128];
md5_uint32 buffer32[32];
};
};
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
static void md5_init_ctx (struct md5_ctx *ctx)
static void md5_init_ctx(struct md5_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
ctx->C = 0x98badcfe;
ctx->D = 0x10325476;
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
ctx->C = 0x98badcfe;
ctx->D = 0x10325476;
ctx->total[0] = ctx->total[1] = 0;
ctx->buflen = 0;
ctx->total[0] = ctx->total[1] = 0;
ctx->buflen = 0;
}
/* Put result from CTX in first 16 bytes following RESBUF. The result
@@ -74,14 +78,14 @@ static void md5_init_ctx (struct md5_ctx *ctx)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
static void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
((md5_uint32 *) resbuf)[0] = SWAP(ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP(ctx->B);
((md5_uint32 *) resbuf)[2] = SWAP(ctx->C);
((md5_uint32 *) resbuf)[3] = SWAP(ctx->D);
return resbuf;
return resbuf;
}
/* These are the four functions used in the four steps of the MD5 algorithm
@@ -96,200 +100,215 @@ static void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 64 == 0. */
static void md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;
size_t nwords = len / sizeof (md5_uint32);
const md5_uint32 *endp = words + nwords;
md5_uint32 A = ctx->A;
md5_uint32 B = ctx->B;
md5_uint32 C = ctx->C;
md5_uint32 D = ctx->D;
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;
size_t nwords = len / sizeof (md5_uint32);
const md5_uint32 *endp = words + nwords;
md5_uint32 A = ctx->A;
md5_uint32 B = ctx->B;
md5_uint32 C = ctx->C;
md5_uint32 D = ctx->D;
md5_uint32 lolen = len;
/* First increment the byte count. RFC 1321 specifies the possible
length of the file up to 2^64 bits. Here we only compute the
number of bytes. Do a double word increment. */
ctx->total[0] = (md5_uint32)(len+ctx->total[0]);
if (ctx->total[0] < len)
++ctx->total[1];
/* First increment the byte count. RFC 1321 specifies the possible
length of the file up to 2^64 bits. Here we only compute the
number of bytes. Do a double word increment. */
ctx->total[0] += lolen;
ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
/* Process all bytes in the buffer with 64 bytes in each round of
the loop. */
while (words < endp)
{
md5_uint32 *cwp = correct_words;
md5_uint32 A_save = A;
md5_uint32 B_save = B;
md5_uint32 C_save = C;
md5_uint32 D_save = D;
/* Process all bytes in the buffer with 64 bytes in each round of
the loop. */
while (words < endp)
{
md5_uint32 *cwp = correct_words;
md5_uint32 A_save = A;
md5_uint32 B_save = B;
md5_uint32 C_save = C;
md5_uint32 D_save = D;
/* First round: using the given function, the context and a constant
the next context is computed. Because the algorithms processing
unit is a 32-bit word and it is determined to work on words in
little endian byte order we perhaps have to change the byte order
before the computation. To reduce the work for the next steps
we store the swapped words in the array CORRECT_WORDS. */
/* First round: using the given function, the context and a constant
the next context is computed. Because the algorithms processing
unit is a 32-bit word and it is determined to work on words in
little endian byte order we perhaps have to change the byte order
before the computation. To reduce the work for the next steps
we store the swapped words in the array CORRECT_WORDS. */
#define OP(a, b, c, d, s, T) \
do \
{ \
a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
++words; \
CYCLIC (a, s); \
a += b; \
} \
while (0)
#define OP(a, b, c, d, s, T) \
do \
{ \
a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
++words; \
CYCLIC (a, s); \
a += b; \
} \
while (0)
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
/* Before we start, one word to the strange constants.
They are defined in RFC 1321 as
/* Before we start, one word to the strange constants.
They are defined in RFC 1321 as
T[i] = (int) (4294967296.0 * fabs (sin (i))), i = 1..64
*/
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
*/
/* Round 1. */
OP (A, B, C, D, 7, 0xd76aa478);
OP (D, A, B, C, 12, 0xe8c7b756);
OP (C, D, A, B, 17, 0x242070db);
OP (B, C, D, A, 22, 0xc1bdceee);
OP (A, B, C, D, 7, 0xf57c0faf);
OP (D, A, B, C, 12, 0x4787c62a);
OP (C, D, A, B, 17, 0xa8304613);
OP (B, C, D, A, 22, 0xfd469501);
OP (A, B, C, D, 7, 0x698098d8);
OP (D, A, B, C, 12, 0x8b44f7af);
OP (C, D, A, B, 17, 0xffff5bb1);
OP (B, C, D, A, 22, 0x895cd7be);
OP (A, B, C, D, 7, 0x6b901122);
OP (D, A, B, C, 12, 0xfd987193);
OP (C, D, A, B, 17, 0xa679438e);
OP (B, C, D, A, 22, 0x49b40821);
/* Round 1. */
OP (A, B, C, D, 7, 0xd76aa478);
OP (D, A, B, C, 12, 0xe8c7b756);
OP (C, D, A, B, 17, 0x242070db);
OP (B, C, D, A, 22, 0xc1bdceee);
OP (A, B, C, D, 7, 0xf57c0faf);
OP (D, A, B, C, 12, 0x4787c62a);
OP (C, D, A, B, 17, 0xa8304613);
OP (B, C, D, A, 22, 0xfd469501);
OP (A, B, C, D, 7, 0x698098d8);
OP (D, A, B, C, 12, 0x8b44f7af);
OP (C, D, A, B, 17, 0xffff5bb1);
OP (B, C, D, A, 22, 0x895cd7be);
OP (A, B, C, D, 7, 0x6b901122);
OP (D, A, B, C, 12, 0xfd987193);
OP (C, D, A, B, 17, 0xa679438e);
OP (B, C, D, A, 22, 0x49b40821);
/* For the second to fourth round we have the possibly swapped words
in CORRECT_WORDS. Redefine the macro to take an additional first
argument specifying the function to use. */
/* For the second to fourth round we have the possibly swapped words
in CORRECT_WORDS. Redefine the macro to take an additional first
argument specifying the function to use. */
#undef OP
#define OP(f, a, b, c, d, k, s, T) \
do \
{ \
a += f (b, c, d) + correct_words[k] + T; \
CYCLIC (a, s); \
a += b; \
} \
while (0)
#define OP(f, a, b, c, d, k, s, T) \
do \
{ \
a += f (b, c, d) + correct_words[k] + T; \
CYCLIC (a, s); \
a += b; \
} \
while (0)
/* Round 2. */
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
OP (FG, D, A, B, C, 10, 9, 0x02441453);
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
/* Round 2. */
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
OP (FG, D, A, B, C, 10, 9, 0x02441453);
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
/* Round 3. */
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
/* Round 3. */
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
/* Round 4. */
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
/* Round 4. */
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
/* Add the starting values of the context. */
A += A_save;
B += B_save;
C += C_save;
D += D_save;
}
/* Add the starting values of the context. */
A += A_save;
B += B_save;
C += C_save;
D += D_save;
}
/* Put checksum in context given as argument. */
ctx->A = A;
ctx->B = B;
ctx->C = C;
ctx->D = D;
/* Put checksum in context given as argument. */
ctx->A = A;
ctx->B = B;
ctx->C = C;
ctx->D = D;
}
static void md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
static void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
if (ctx->buflen != 0)
{
size_t left_over = ctx->buflen;
size_t add = 128 - left_over > len ? len : 128 - left_over;
memcpy (&ctx->buffer[left_over], buffer, add);
ctx->buflen = (md5_uint32)(add+ctx->buflen);
if (left_over + add > 64)
/* When we already have some bits in our internal buffer concatenate
* both inputs first. */
if (ctx->buflen != 0)
{
md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
/* The regions in the following copy operation cannot overlap. */
memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
(left_over + add) & 63);
ctx->buflen = (md5_uint32)((left_over + add) & 63);
size_t left_over = ctx->buflen;
size_t add = 128 - left_over > len ? len : 128 - left_over;
memcpy (&ctx->buffer[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 64)
{
md5_process_block(ctx->buffer, ctx->buflen & ~63, ctx);
ctx->buflen &= 63;
/* The regions in the following copy operation cannot overlap. */
memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
ctx->buflen);
}
buffer = (const char *) buffer + add;
len -= add;
}
buffer = (const char *) buffer + add;
len -= add;
}
/* Process available complete blocks. */
if (len >= 64)
{
while (len > 64)
{
md5_process_block(memcpy(ctx->buffer, buffer, 64), 64, ctx);
buffer = (const char *) buffer + 64;
len -= 64;
}
}
/* Process available complete blocks. */
if (len > 64)
{
md5_process_block (buffer, len & ~63, ctx);
buffer = (const char *) buffer + (len & ~63);
len &= 63;
}
/* Move remaining bytes in internal buffer. */
if (len > 0)
{
size_t left_over = ctx->buflen;
/* Move remaining bytes in internal buffer. */
if (len > 0)
{
memcpy (ctx->buffer, buffer, len);
ctx->buflen = (md5_uint32)len;
}
memcpy(&ctx->buffer[left_over], buffer, len);
left_over += len;
if (left_over >= 64)
{
md5_process_block (ctx->buffer, 64, ctx);
left_over -= 64;
memcpy(ctx->buffer, &ctx->buffer[64], left_over);
}
ctx->buflen = left_over;
}
}
@@ -298,100 +317,98 @@ static void md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *c
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
static void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
static void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
{
/* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen;
size_t pad;
md5_uint32 *buffer = NULL;
/* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen;
size_t pad;
/* Now count remaining bytes. */
ctx->total[0] += bytes;
if (ctx->total[0] < bytes)
++ctx->total[1];
/* Now count remaining bytes. */
ctx->total[0] += bytes;
if (ctx->total[0] < bytes)
++ctx->total[1];
pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
memcpy (&ctx->buffer[bytes], fillbuf, pad);
pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
memcpy(&ctx->buffer[bytes], fillbuf, pad);
/* Put the 64-bit file length in *bits* at the end of the buffer. */
buffer = (void *)&ctx->buffer[bytes + pad];
*buffer = SWAP (ctx->total[0] << 3);
buffer = (void *)&ctx->buffer[bytes + pad + 4];
*buffer = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
/* Put the 64-bit file length in *bits* at the end of the buffer. */
ctx->buffer32[(bytes + pad) / 4] = SWAP (ctx->total[0] << 3);
ctx->buffer32[(bytes + pad + 4) / 4] = SWAP ((ctx->total[1] << 3)
| (ctx->total[0] >> 29));
/* Process last bytes. */
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
/* Process last bytes. */
md5_process_block(ctx->buffer, bytes + pad + 8, ctx);
return md5_read_ctx (ctx, resbuf);
return md5_read_ctx(ctx, resbuf);
}
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int md5_stream (FILE *stream, void *resblock)
int md5_stream(FILE *stream, void *resblock)
{
/* Important: BLOCKSIZE must be a multiple of 64. */
/* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096
struct md5_ctx ctx;
char buffer[BLOCKSIZE + 72];
size_t sum = 0;
struct md5_ctx ctx;
char buffer[BLOCKSIZE + 72];
size_t sum = 0;
/* Initialize the computation context. */
md5_init_ctx (&ctx);
/* Initialize the computation context. */
md5_init_ctx(&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
do
/* Iterate over full file contents. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
sum += n;
/* Read block. Take care for partial reads. */
do
{
n = fread(buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
}
while (sum < BLOCKSIZE && n != 0);
if (n == 0 && ferror(stream))
return 1;
/* If end of file is reached, end the loop. */
if (n == 0)
break;
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 64 == 0
*/
md5_process_block(buffer, BLOCKSIZE, &ctx);
}
while (sum < BLOCKSIZE && n != 0);
if (n == 0 && ferror (stream))
return 1;
/* If end of file is reached, end the loop. */
if (n == 0)
break;
/* Add the last bytes if necessary. */
if (sum > 0)
md5_process_bytes(buffer, sum, &ctx);
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 64 == 0
*/
md5_process_block (buffer, BLOCKSIZE, &ctx);
}
/* Add the last bytes if necessary. */
if (sum > 0)
md5_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
md5_finish_ctx (&ctx, resblock);
return 0;
/* Construct result in desired memory. */
md5_finish_ctx(&ctx, resblock);
return 0;
}
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
void *md5_buffer (const char *buffer, size_t len, void *resblock)
void *md5_buffer(const char *buffer, size_t len, void *resblock)
{
struct md5_ctx ctx;
struct md5_ctx ctx;
/* Initialize the computation context. */
md5_init_ctx (&ctx);
/* Initialize the computation context. */
md5_init_ctx(&ctx);
/* Process whole buffer but last len % 64 bytes. */
md5_process_bytes (buffer, len, &ctx);
/* Process whole buffer but last len % 64 bytes. */
md5_process_bytes (buffer, len, &ctx);
/* Put result in desired memory area. */
return md5_finish_ctx (&ctx, resblock);
/* Put result in desired memory area. */
return md5_finish_ctx(&ctx, resblock);
}
+24 -100
View File
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1995-1996 by the Free Software Foundation, Inc.
// Copyright (C) 1995-2025 by the Free Software Foundation, Inc.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -24,108 +24,32 @@
#define MD5_LEN 16
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
doing that would require that the configure script compile and *run*
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
doing that would require that the configure script compile and *run*
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
#ifdef _LIBC
# include <sys/types.h>
typedef u_int32_t md5_uint32;
#include <stdint.h>
typedef uint32_t md5_uint32;
typedef uintptr_t md5_uintptr;
#if defined (__THROW)
#define THROWFUNC __THROW
#else
# if defined __STDC__ && __STDC__
# define UINT_MAX_32_BITS 4294967295U
# else
# define UINT_MAX_32_BITS 0xFFFFFFFF
# endif
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
This should be valid for all systems GNU cares about because
that doesn't include 16-bit systems, and only modern systems
(that certainly have <limits.h>) have 64+-bit integral types. */
# ifndef UINT_MAX
# define UINT_MAX UINT_MAX_32_BITS
# endif
# if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int md5_uint32;
# else
# if USHRT_MAX == UINT_MAX_32_BITS
typedef unsigned short md5_uint32;
# else
# if ULONG_MAX == UINT_MAX_32_BITS
typedef unsigned long md5_uint32;
# else
/* The following line is intended to evoke an error.
Using #error is not portable enough. */
"Cannot determine unsigned 32-bit data type."
# endif
# endif
# endif
#define THROWFUNC
#endif
#undef __P
#if defined (__STDC__) && __STDC__
#define __P(x) x
#else
#define __P(x) ()
#endif
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int md5_stream(FILE *stream, void *resblock) THROWFUNC;
/*
* The following three functions are build up the low level used in
* the functions `md5_stream' and `md5_buffer'.
*/
#if 0
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
extern void md5_init_ctx __P ((struct md5_ctx *ctx));
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *md5_buffer(const char *buffer, size_t len, void *resblock) THROWFUNC;
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
extern void md5_process_block __P ((const void *buffer, size_t len,
struct md5_ctx *ctx));
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is NOT required that LEN is a multiple of 64. */
extern void md5_process_bytes __P ((const void *buffer, size_t len,
struct md5_ctx *ctx));
/* Process the remaining bytes in the buffer and put result from CTX
in first 16 bytes following RESBUF. The result is always in little
endian byte order, so that a byte-wise output yields to the wanted
ASCII representation of the message digest.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
/* Put result from CTX in first 16 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
#endif
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int md5_stream __P ((FILE *stream, void *resblock));
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
#endif
#endif /* md5.h */
+9 -2
View File
@@ -11,6 +11,7 @@
/// \file p_ceilng.c
/// \brief Ceiling aninmation (lowering, crushing, raising)
#include "d_think.h"
#include "doomdef.h"
#include "p_local.h"
#include "r_fps.h"
@@ -396,6 +397,7 @@ void T_CrushCeiling(ceiling_t *ceiling)
INT32 EV_DoCeiling(line_t *line, ceiling_e type)
{
INT32 rtn = 0, firstone = 1;
INT32 secnum = -1;
sector_t *sec;
ceiling_t *ceiling;
@@ -409,7 +411,9 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
// new door thinker
rtn = 1;
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
ceiling = Z_LevelPoolCalloc(sizeof(*ceiling));
ceiling->thinker.alloctype = TAT_LEVELPOOL;
ceiling->thinker.size = sizeof(*ceiling);
P_AddThinker(&ceiling->thinker);
sec->ceilingdata = ceiling;
ceiling->thinker.function = (actionf_p1)T_MoveCeiling;
@@ -619,6 +623,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
INT32 EV_DoCrush(line_t *line, ceiling_e type)
{
INT32 rtn = 0;
INT32 secnum = -1;
sector_t *sec;
ceiling_t *ceiling;
@@ -632,7 +637,9 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
// new door thinker
rtn = 1;
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
ceiling = Z_LevelPoolCalloc(sizeof(*ceiling));
ceiling->thinker.alloctype = TAT_LEVELPOOL;
ceiling->thinker.size = sizeof(*ceiling);
P_AddThinker(&ceiling->thinker);
sec->ceilingdata = ceiling;
ceiling->thinker.function = (actionf_p1)T_CrushCeiling;
+54 -16
View File
@@ -8035,8 +8035,15 @@ void A_JawzExplode(void *thing)
{
INT32 speed, speed2;
truc = P_SpawnMobj(actor->x + P_RandomRange(-8, 8)*FRACUNIT, actor->y + P_RandomRange(-8, 8)*FRACUNIT,
actor->z + P_RandomRange(0, 8)*FRACUNIT, MT_BOOMPARTICLE);
fixed_t rand_x;
fixed_t rand_y;
fixed_t rand_z;
rand_z = actor->z + P_RandomRange(0, 8)*FRACUNIT;
rand_y = actor->y + P_RandomRange(-8, 8)*FRACUNIT;
rand_x = actor->x + P_RandomRange(-8, 8)*FRACUNIT;
truc = P_SpawnMobj(rand_x, rand_y, rand_z, MT_BOOMPARTICLE);
truc->scale = actor->scale*2;
speed = FixedMul(7*FRACUNIT, actor->scale)>>FRACBITS;
@@ -8205,10 +8212,16 @@ void A_SPBChase(void *thing)
: (16*R_PointToDist2(0, 0, actor->tracer->momx, actor->tracer->momy))/15) // Going faster than the target
&& xyspeed > K_GetKartSpeed(actor->tracer->player, false)/4) // Don't display speedup lines at pitifully low speeds
{
mobj_t *fast = P_SpawnMobj(actor->x + (P_RandomRange(-24,24) * actor->scale),
actor->y + (P_RandomRange(-24,24) * actor->scale),
actor->z + (actor->height/2) + (P_RandomRange(-24,24) * actor->scale),
MT_FASTLINE);
fixed_t rand_x;
fixed_t rand_y;
fixed_t rand_z;
rand_z = actor->z + (actor->height/2) + (P_RandomRange(-24,24) * actor->scale);
rand_y = actor->y + (P_RandomRange(-24,24) * actor->scale);
rand_x = actor->x + (P_RandomRange(-24,24) * actor->scale);
mobj_t *fast = P_SpawnMobj(rand_x, rand_y, rand_z, MT_FASTLINE);
fast->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy);
//fast->momx = (3*actor->momx)/4;
//fast->momy = (3*actor->momy)/4;
@@ -8416,8 +8429,15 @@ void A_FZBoomSmoke(void *thing)
for (i = 0; i < 8+(4*var1); i++)
{
mobj_t *smoke = P_SpawnMobj(actor->x + (P_RandomRange(-rad, rad)*actor->scale), actor->y + (P_RandomRange(-rad, rad)*actor->scale),
actor->z + (P_RandomRange(0, 72)*actor->scale), MT_THOK);
fixed_t rand_x;
fixed_t rand_y;
fixed_t rand_z;
rand_z = actor->z + (P_RandomRange(0, 72)*actor->scale);
rand_y = actor->y + (P_RandomRange(-rad, rad)*actor->scale);
rand_x = actor->x + (P_RandomRange(-rad, rad)*actor->scale);
mobj_t *smoke = P_SpawnMobj(rand_x, rand_y, rand_z, MT_THOK);
P_SetMobjState(smoke, S_FZEROSMOKE1);
smoke->tics += P_RandomRange(-3, 4);
@@ -8593,7 +8613,15 @@ void A_MementosTPParticles(void *thing)
for (; i < 4; i++)
{
particle = P_SpawnMobj(actor->x + (P_RandomRange(-256, 256)<<FRACBITS), actor->y + (P_RandomRange(-256, 256)<<FRACBITS), actor->z + (P_RandomRange(48, 256)<<FRACBITS), MT_MEMENTOSPARTICLE);
fixed_t rand_x;
fixed_t rand_y;
fixed_t rand_z;
rand_z = actor->z + (P_RandomRange(48, 256)<<FRACBITS);
rand_y = actor->y + (P_RandomRange(-256, 256)<<FRACBITS);
rand_x = actor->x + (P_RandomRange(-256, 256)<<FRACBITS);
particle = P_SpawnMobj(rand_x, rand_y, rand_z, MT_MEMENTOSPARTICLE);
particle->frame = 0;
particle->color = ((i%2) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
particle->destscale = 1;
@@ -8656,9 +8684,15 @@ void A_ReaperThinker(void *thing)
if (actor->scale < 2<<FRACBITS) // we haven't finished growing YET.
{
// Spawn particles as we grow out of the floor, ゴ ゴ ゴ ゴ
for (; i<16; i++)
for (; i < 16; i++)
{
particle = P_SpawnMobj(actor->x + (P_RandomRange(-60, 60)<<FRACBITS), actor->y + (P_RandomRange(-60, 60)<<FRACBITS), actor->z, MT_THOK);
fixed_t rand_x;
fixed_t rand_y;
rand_y = actor->y + (P_RandomRange(-60, 60)<<FRACBITS);
rand_x = actor->x + (P_RandomRange(-60, 60)<<FRACBITS);
particle = P_SpawnMobj(rand_x, rand_y, actor->z, MT_THOK);
particle->momz = 20<<FRACBITS;
particle->color = ((i%2 !=0) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
particle->frame = 0;
@@ -8813,11 +8847,15 @@ void A_FlameParticle(void *thing)
if (LUA_CallAction(A_FLAMEPARTICLE, actor))
return;
par = P_SpawnMobj(
actor->x + (P_RandomRange(-rad, rad)<<FRACBITS),
actor->y + (P_RandomRange(-rad, rad)<<FRACBITS),
actor->z + (P_RandomRange(hei/2, hei)<<FRACBITS),
actor->info->painchance);
fixed_t rand_x;
fixed_t rand_y;
fixed_t rand_z;
rand_z = actor->z + (P_RandomRange(hei/2, hei)<<FRACBITS);
rand_y = actor->y + (P_RandomRange(-rad, rad)<<FRACBITS);
rand_x = actor->x + (P_RandomRange(-rad, rad)<<FRACBITS);
par = P_SpawnMobj(rand_x, rand_y, rand_z, actor->info->painchance);
par->momz = actor->scale<<1;
}
+18 -7
View File
@@ -2538,7 +2538,9 @@ INT32 EV_DoFloor(line_t *line, floor_e floortype)
// new floor thinker
rtn = 1;
dofloor = Z_Calloc(sizeof (*dofloor), PU_LEVSPEC, NULL);
dofloor = Z_LevelPoolCalloc(sizeof(*dofloor));
dofloor->thinker.alloctype = TAT_LEVELPOOL;
dofloor->thinker.size = sizeof(*dofloor);
P_AddThinker(&dofloor->thinker);
// make sure another floor thinker won't get started over this one
@@ -2762,7 +2764,9 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
// create and initialize new elevator thinker
rtn = 1;
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
elevator = Z_LevelPoolCalloc(sizeof(*elevator));
elevator->thinker.alloctype = TAT_LEVELPOOL;
elevator->thinker.size = sizeof(*elevator);
P_AddThinker(&elevator->thinker);
sec->floordata = elevator;
sec->ceilingdata = elevator;
@@ -2951,7 +2955,9 @@ INT32 EV_BounceSector(sector_t *sec, fixed_t momz, line_t *sourceline)
if (sec->ceilingdata) // One at a time, ma'am.
return 0;
bouncer = Z_Calloc(sizeof (*bouncer), PU_LEVSPEC, NULL);
bouncer = Z_LevelPoolCalloc(sizeof(*bouncer));
bouncer->thinker.alloctype = TAT_LEVELPOOL;
bouncer->thinker.size = sizeof(*bouncer);
P_AddThinker(&bouncer->thinker);
sec->ceilingdata = bouncer;
bouncer->thinker.function = (actionf_p1)T_BounceCheese;
@@ -2989,7 +2995,9 @@ INT32 EV_DoContinuousFall(sector_t *sec, sector_t *backsector, fixed_t spd, bool
backsector = sec;
// create and initialize new thinker
faller = Z_Calloc(sizeof (*faller), PU_LEVSPEC, NULL);
faller = Z_LevelPoolCalloc(sizeof(*faller));
faller->thinker.alloctype = TAT_LEVELPOOL;
faller->thinker.size = sizeof(*faller);
P_AddThinker(&faller->thinker);
faller->thinker.function = (actionf_p1)T_ContinuousFalling;
@@ -3042,7 +3050,9 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
return 0;
// create and initialize new elevator thinker
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
elevator = Z_LevelPoolCalloc(sizeof(*elevator));
elevator->thinker.alloctype = TAT_LEVELPOOL;
elevator->thinker.size = sizeof(*elevator);
P_AddThinker(&elevator->thinker);
elevator->thinker.function = (actionf_p1)T_StartCrumble;
@@ -3118,8 +3128,9 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob
{
const boolean itsamonitor = (thing->flags & MF_MONITOR) == MF_MONITOR;
// create and initialize new elevator thinker
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
block = Z_LevelPoolCalloc(sizeof(*block));
block->thinker.alloctype = TAT_LEVELPOOL;
block->thinker.size = sizeof(*block);
P_AddThinker(&block->thinker);
sec->floordata = block;
sec->ceilingdata = block;
+39 -49
View File
@@ -558,7 +558,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{
special->momx = toucher->momx;
special->momy = toucher->momy;
special->momz = flip * max(P_AproxDistance(toucher->momx, toucher->momy) / 4, FixedMul(special->info->speed, special->scale));
const fixed_t dist = P_AproxDistance(toucher->momx, toucher->momy) / 4;
const fixed_t scale = FixedMul(special->info->speed, special->scale);
special->momz = flip * max(dist, scale);
if (flip * toucher->momz > 0)
special->momz += toucher->momz / 8;
if ((statenum_t)(special->state-states) != special->info->seestate)
@@ -800,10 +802,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (!P_PlayerTouchingSectorSpecial(player, 4, 2 + flagteam))
{
CONS_Printf(M_GetText("%s returned the %c%s%c to base.\n"), plname, flagcolor, flagtext, 0x80);
// The fuse code plays this sound effect
//if (players[consoleplayer].ctfteam == player->ctfteam)
// S_StartSound(NULL, sfx_hoop1);
}
}
}
@@ -871,14 +869,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->angle = special->angle;
if (player == &players[consoleplayer])
localangle[0] = toucher->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = toucher->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = toucher->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = toucher->angle;
for (UINT8 i = 0; i <= splitscreen; i++)
{
if (player == P_GetLocalPlayerForNum(i))
{
localangle[i] = toucher->angle;
break;
}
}
P_ResetPlayer(player);
@@ -892,16 +890,19 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
break;
case MT_HOOPCOLLIDE:
// This produces a kind of 'domino effect' with the hoop's pieces.
for (; !P_MobjWasRemoved(special->hprev); special = special->hprev); // Move to the first sprite in the hoop
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
i = 0;
for (; !P_MobjWasRemoved(special->hnext) && special->type == MT_HOOP; special = special->hnext)
for (; special->hnext != NULL && special->type == MT_HOOP; special = special->hnext)
{
special->fuse = 11;
special->movedir = i;
special->extravalue1 = special->target->extravalue1;
special->extravalue2 = special->target->extravalue2;
special->target->threshold = 4242;
if (!P_MobjWasRemoved(special->target))
{
special->fuse = 11;
special->movedir = i;
special->extravalue1 = special->target->extravalue1;
special->extravalue2 = special->target->extravalue2;
special->target->threshold = 4242;
}
i++;
}
// Make the collision detectors disappear.
@@ -1577,9 +1578,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
// Let EVERYONE know what happened to a player! 01-29-2002 Tails
if (target->player && !target->player->spectator)
{
if (metalrecording) // Ack! Metal Sonic shouldn't die! Cut the tape, end recording!
G_StopMetalRecording();
target->flags2 &= ~MF2_DONTDRAW;
}
@@ -1624,25 +1622,20 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
S_FadeOutStopMusic(cv_respawnfademusicout.value);
}
if (target->player == &players[consoleplayer])
for (UINT8 i = 0; i <= splitscreen; i++)
{
// don't die in auto map,
// switch view prior to dying
if (automapactive)
AM_Stop();
if (target->player == P_GetLocalPlayerForNum(i))
{
// don't die in auto map,
// switch view prior to dying
if (i == 0 && automapactive)
AM_Stop();
//added : 22-02-98: recenter view for next life...
localaiming[0] = 0;
// added : 22-02-98: recenter view for next life...
localaiming[i] = 0;
break;
}
}
if (target->player == &players[displayplayers[1]])
{
// added : 22-02-98: recenter view for next life...
localaiming[1] = 0;
}
if (target->player == &players[displayplayers[2]])
localaiming[2] = 0;
if (target->player == &players[displayplayers[3]])
localaiming[3] = 0;
if (G_BattleGametype())
K_CheckBumpers();
@@ -2261,18 +2254,15 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
// Everything above here can't be forced.
if (!metalrecording)
{
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage);
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage);
if (P_MobjWasRemoved(target))
return (shouldForce == 1); // mobj was removed
if (P_MobjWasRemoved(target))
return (shouldForce == 1); // mobj was removed
if (shouldForce == 1)
force = true;
else if (shouldForce == 2)
return false;
}
if (shouldForce == 1)
force = true;
else if (shouldForce == 2)
return false;
if (!force)
{
+15 -5
View File
@@ -74,7 +74,9 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxse
fireflicker_t *flick;
P_RemoveLighting(maxsector); // out with the old, in with the new
flick = Z_Calloc(sizeof (*flick), PU_LEVSPEC, NULL);
flick = Z_LevelPoolCalloc(sizeof(*flick));
flick->thinker.alloctype = TAT_LEVELPOOL;
flick->thinker.size = sizeof(*flick);
P_AddThinker(&flick->thinker);
@@ -153,7 +155,9 @@ void P_SpawnLightningFlash(sector_t *sector)
sector->lightingdata = NULL;
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
flash = Z_LevelPoolCalloc(sizeof(*flash));
flash->thinker.alloctype = TAT_LEVELPOOL;
flash->thinker.size = sizeof(*flash);
P_AddThinker(&flash->thinker);
@@ -212,7 +216,9 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector,
strobe_t *flash;
P_RemoveLighting(maxsector); // out with the old, in with the new
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
flash = Z_LevelPoolCalloc(sizeof(*flash));
flash->thinker.alloctype = TAT_LEVELPOOL;
flash->thinker.size = sizeof(*flash);
P_AddThinker(&flash->thinker);
@@ -287,7 +293,9 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector,
glow_t *g;
P_RemoveLighting(maxsector); // out with the old, in with the new
g = Z_Calloc(sizeof (*g), PU_LEVSPEC, NULL);
g = Z_LevelPoolCalloc(sizeof(*g));
g->thinker.alloctype = TAT_LEVELPOOL;
g->thinker.size = sizeof(*g);
P_AddThinker(&g->thinker);
@@ -346,7 +354,9 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed)
sector = &sectors[i];
P_RemoveLighting(sector); // remove the old lighting effect first
ll = Z_Calloc(sizeof (*ll), PU_LEVSPEC, NULL);
ll = Z_LevelPoolCalloc(sizeof(*ll));
ll->thinker.alloctype = TAT_LEVELPOOL;
ll->thinker.size = sizeof(*ll);
ll->thinker.function = (actionf_p1)T_LightFade;
sector->lightingdata = ll; // set it to the lightlevel_t
+24 -8
View File
@@ -14,6 +14,10 @@
#ifndef __P_LOCAL__
#define __P_LOCAL__
#ifdef __cplusplus
extern "C" {
#endif
#include "command.h"
#include "d_player.h"
#include "d_think.h"
@@ -67,7 +71,6 @@
// both the head and tail of the thinker list
extern thinker_t thinkercap;
extern thinker_t precipcap;
extern mobj_t *mobjcache;
void P_InitThinkers(void);
void P_AddThinker(thinker_t *thinker);
@@ -128,6 +131,9 @@ typedef struct camera_s
// SRB2Kart: camera pans while drifting
fixed_t pan;
// SRB2Kart: camera pitches on slopes
angle_t pitch;
// postproccess effects
UINT8 postimg;
} camera_t;
@@ -144,9 +150,11 @@ enum
extern camera_t camera[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_dist[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_height[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_pitch[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_lookbackmom[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_timeover[MAXSPLITSCREENPLAYERS];
@@ -160,8 +168,6 @@ extern consvar_t cv_actionmovie;
extern consvar_t cv_screenquake;
extern consvar_t cv_lookbackmom[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS];
extern fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS];
@@ -169,18 +175,25 @@ extern fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS];
fixed_t P_GetPlayerHeight(player_t *player);
fixed_t P_GetPlayerSpinHeight(player_t *player);
void P_AddPlayerScore(player_t *player, UINT32 amount);
void P_SetupCamera(camera_t *cam);
void P_ResetCamera(player_t *player, camera_t *thiscam);
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
#ifndef NOCLIPCAM
void P_SlideCameraMove(camera_t *thiscam);
//void P_DemoCameraMovement(camera_t *cam, UINT8 num);
#endif
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
void P_ResetLocalCamAiming(player_t *player);
void P_ToggleDemoCamera(UINT8 viewnum);
void P_CalcChasePostImg(player_t *player, camera_t *thiscam);
boolean P_PlayerInPain(player_t *player);
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
void P_ResetPlayer(player_t *player);
player_t *P_GetLocalPlayerForNum(UINT8 pnum);
INT32 P_GetLocalPlayerNumForNum(UINT8 pnum);
boolean P_IsLocalPlayer(const player_t *player);
boolean P_IsLocalPlayerNum(UINT8 pnum);
boolean P_IsDisplayPlayer(const player_t *player);
boolean P_SpectatorJoinGame(player_t *player);
@@ -252,10 +265,11 @@ void P_PlayVictorySound(mobj_t *source);
extern mapthing_t *itemrespawnque[ITEMQUESIZE];
extern tic_t itemrespawntime[ITEMQUESIZE];
extern size_t iquehead, iquetail;
extern consvar_t cv_gravity/*, cv_viewheight*/;
extern consvar_t cv_gravity;
void P_RespawnSpecials(void);
mobj_t *P_AllocateMobj(void);
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
mobj_t *P_SpawnShadowMobj(mobj_t * caster);
@@ -379,7 +393,6 @@ void P_SetThingPosition(mobj_t *thing);
void P_SetUnderlayPosition(mobj_t *thing);
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
boolean P_Move(mobj_t *actor, fixed_t speed);
boolean P_SetOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
@@ -399,7 +412,6 @@ boolean P_CheckSector(sector_t *sector, boolean crunch);
void P_DelSeclist(msecnode_t *node);
void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y);
void P_Initsecnode(void);
void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist);
@@ -479,4 +491,8 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move);
void P_ExplodeMissile(mobj_t *mo);
void P_CheckGravity(mobj_t *mo, boolean affect);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __P_LOCAL__
+24 -33
View File
@@ -225,8 +225,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
{
for (UINT8 j = 0; j <= splitscreen; ++j)
{
INT32 id = (j == 0 ? consoleplayer : displayplayers[j]);
if (object->player == &players[id])
if (object->player == P_GetLocalPlayerForNum(j))
{
localangle[j] = spring->angle;
break;
@@ -1982,7 +1981,7 @@ void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fix
//
// P_CheckCameraPosition
//
boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
{
INT32 xl, xh, yl, yh, bx, by;
sector_t *newsec;
@@ -2396,13 +2395,15 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (thing->player)
{
const INT32 special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
// If using type Section1:13, double the maxstep.
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13)
|| special == 13)
maxstep <<= 1;
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12)
|| special == 12)
maxstep = 0;
}
@@ -2614,11 +2615,12 @@ static boolean P_ThingHeightClip(mobj_t *thing)
{
boolean floormoved;
fixed_t oldfloorz = thing->floorz;
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
if (thing->flags & MF_NOCLIPHEIGHT)
return true;
const boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
P_CheckPosition(thing, thing->x, thing->y);
if (P_MobjWasRemoved(thing))
@@ -2686,6 +2688,7 @@ static fixed_t tmxmove, tmymove;
//
// P_HitCameraSlideLine
//
#ifndef NOCLIPCAM
static void P_HitCameraSlideLine(line_t *ld, camera_t *thiscam)
{
INT32 side;
@@ -2705,7 +2708,7 @@ static void P_HitCameraSlideLine(line_t *ld, camera_t *thiscam)
}
side = P_PointOnLineSide(thiscam->x, thiscam->y, ld);
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
lineangle = ld->angle;
if (side == 1)
lineangle += ANGLE_180;
@@ -2725,6 +2728,7 @@ static void P_HitCameraSlideLine(line_t *ld, camera_t *thiscam)
tmxmove = FixedMul(newlen, FINECOSINE(lineangle));
tmymove = FixedMul(newlen, FINESINE(lineangle));
}
#endif
//
// P_HitSlideLine
@@ -2751,7 +2755,7 @@ static void P_HitSlideLine(line_t *ld)
side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
lineangle = ld->angle;
if (side == 1)
lineangle += ANGLE_180;
@@ -2784,7 +2788,7 @@ static void P_PlayerHitBounceLine(line_t *ld)
fixed_t movelen;
side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy)-ANGLE_90;
lineangle = ld->angle-ANGLE_90;
if (side == 1)
lineangle += ANGLE_180;
@@ -2822,7 +2826,7 @@ static void P_HitBounceLine(line_t *ld)
return;
}
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
lineangle = ld->angle;
if (lineangle >= ANGLE_180)
lineangle -= ANGLE_180;
@@ -2844,6 +2848,7 @@ static void P_HitBounceLine(line_t *ld)
//
// PTR_SlideCameraTraverse
//
#ifndef NOCLIPCAM
static boolean PTR_SlideCameraTraverse(intercept_t *in)
{
line_t *li;
@@ -2890,6 +2895,7 @@ isblocking:
return false; // stop
}
#endif
//
// PTR_SlideTraverse
@@ -2960,6 +2966,7 @@ isblocking:
//
// Tries to slide the camera along a wall.
//
#ifndef NOCLIPCAM
void P_SlideCameraMove(camera_t *thiscam)
{
fixed_t leadx, leady, trailx, traily, newx, newy;
@@ -3053,6 +3060,7 @@ stairstep:
if (!retval)
goto retry;
}
#endif
//
// P_SlideMove
@@ -3815,36 +3823,19 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
Lots of new Boom functions that work faster and add functionality.
*/
static msecnode_t *headsecnode = NULL;
void P_Initsecnode(void)
{
headsecnode = NULL;
}
// P_GetSecnode() retrieves a node from the freelist. The calling routine
// should make sure it sets all fields properly.
static msecnode_t *P_GetSecnode(void)
{
msecnode_t *node;
if (headsecnode)
{
node = headsecnode;
headsecnode = headsecnode->m_thinglist_next;
}
else
node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL);
return node;
return Z_LevelPoolCalloc(sizeof(msecnode_t));
}
// P_PutSecnode() returns a node to the freelist.
static inline void P_PutSecnode(msecnode_t *node)
{
node->m_thinglist_next = headsecnode;
headsecnode = node;
Z_LevelPoolFree(node, sizeof(msecnode_t));
}
// P_AddSecnode() searches the current list to see if this sector is
@@ -3949,9 +3940,9 @@ void P_DelSeclist(msecnode_t *node)
static inline boolean PIT_GetSectors(line_t *ld)
{
if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT] ||
tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] ||
tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] ||
if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT] ||
tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] ||
tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] ||
tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
return true;
@@ -4071,7 +4062,7 @@ void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y)
* Must clear tmthing at tic end, as it might contain a pointer to a removed thinker, or the level might have ended/been ended and we clear the objects it was pointing too. Hopefully we don't need to carry this between tics for sync. */
void P_MapStart(void)
{
if (tmthing)
if (UNLIKELY(tmthing))
I_Error("P_MapStart: tmthing set!");
}
+14 -54
View File
@@ -130,35 +130,12 @@ void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, verte
return;
}
//
// P_PointOnLineSide
// Returns 0 or 1
//
INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line)
{
fixed_t dx, dy, left, right;
if (!line->dx)
return x <= line->v1->x ? line->dy > 0 : line->dy < 0;
if (!line->dy)
return y <= line->v1->y ? line->dx < 0 : line->dx > 0;
dx = (x - line->v1->x);
dy = (y - line->v1->y);
left = FixedMul(line->dy>>FRACBITS, dx);
right = FixedMul(dy, line->dx>>FRACBITS);
return right < left ? 0 : 1;
}
//
// P_BoxOnLineSide
// Considers the line to be infinite
// Returns side 0 or 1, -1 if box crosses the line.
//
INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld)
PUREFUNC INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld)
{
INT32 p1, p2;
@@ -208,30 +185,15 @@ INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld)
// P_PointOnDivlineSide
// Returns 0 or 1.
//
static INT32 P_PointOnDivlineSide(fixed_t x, fixed_t y, divline_t *line)
FUNCINLINE static ATTRINLINE PUREFUNC INT32 P_PointOnDivlineSide(fixed_t x, fixed_t y, divline_t *line)
{
fixed_t dx, dy, left, right;
if (!line->dx)
return x <= line->x ? line->dy > 0 : line->dy < 0;
if (!line->dy)
return y <= line->y ? line->dx < 0 : line->dx > 0;
dx = (x - line->x);
dy = (y - line->y);
// try to quickly decide by looking at sign bits
if ((line->dy ^ line->dx ^ dx ^ dy) & 0x80000000)
return ((line->dy ^ dx) & 0x80000000) ? 1 : 0;
left = FixedMul(line->dy>>8, dx>>8);
right = FixedMul(dy>>8, line->dx>>8);
return right < left ? 0 : 1;
return
!line->dx ? x <= line->x ? line->dy > 0 : line->dy < 0 :
!line->dy ? y <= line->y ? line->dx < 0 : line->dx > 0 :
(line->dy^line->dx^(x -= line->x)^(y -= line->y)) < 0 ? (line->dy^x) < 0 :
FixedMul(y>>8, line->dx>>8) >= FixedMul(line->dy>>8, x>>8);
}
//
// P_MakeDivline
//
@@ -248,7 +210,7 @@ void P_MakeDivline(line_t *li, divline_t *dl)
// Returns the fractional intercept point along the first divline.
// This is only called by the addthings and addlines traversers.
//
fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
PUREFUNC fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
{
fixed_t frac, num, den;
@@ -768,7 +730,8 @@ void P_UnsetPrecipThingPosition(precipmobj_t *thing)
bnext->bprev = bprev;
}
static void P_LinkToBlockMap(mobj_t *thing, mobj_t **bmap)
template<typename T>
static void P_LinkToBlockMap(T *thing, T **bmap)
{
const INT32 blockx = (unsigned)(thing->x - bmaporgx) >> MAPBLOCKSHIFT;
const INT32 blocky = (unsigned)(thing->y - bmaporgy) >> MAPBLOCKSHIFT;
@@ -780,8 +743,8 @@ static void P_LinkToBlockMap(mobj_t *thing, mobj_t **bmap)
// pointer-to-pointer prev pointers --
// allows head nodes to be treated like everything else
mobj_t **link = &bmap[(blocky * bmapwidth) + blockx];
mobj_t *bnext = *link;
T **link = &bmap[(blocky * bmapwidth) + blockx];
T *bnext = *link;
thing->bnext = bnext;
@@ -909,10 +872,7 @@ void P_SetUnderlayPosition(mobj_t *thing)
void P_SetPrecipitationThingPosition(precipmobj_t *thing)
{
thing->subsector = R_PointInSubsectorFast(thing->x, thing->y);
// NOTE: this works because bnext/bprev are at the same
// offsets in precipmobj_t and mobj_t
P_LinkToBlockMap((mobj_t*)thing, (mobj_t**)precipblocklinks);
P_LinkToBlockMap(thing, precipblocklinks);
}
//
@@ -1041,7 +1001,7 @@ static void P_CheckIntercepts(void)
else
max_intercepts *= 2;
intercepts = Z_Realloc(intercepts, sizeof (*intercepts) * max_intercepts, PU_STATIC, NULL);
intercepts = static_cast<intercept_t*>(Z_Realloc(intercepts, sizeof (*intercepts) * max_intercepts, PU_STATIC, NULL));
intercept_p = intercepts + count;
}
+24 -3
View File
@@ -13,6 +13,10 @@
#ifndef __P_MAPUTL__
#define __P_MAPUTL__
#ifdef __cplusplus
extern "C" {
#endif
#include "doomtype.h"
#include "r_defs.h"
#include "m_fixed.h"
@@ -41,14 +45,26 @@ typedef boolean (*traverser_t)(intercept_t *in);
boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
INT32 pflags, traverser_t ptrav);
//
// P_PointOnLineSide
// Returns 0 or 1
//
FUNCINLINE static ATTRINLINE PUREFUNC INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line)
{
return
!line->dx ? x <= line->v1->x ? line->dy > 0 : line->dy < 0 :
!line->dy ? y <= line->v1->y ? line->dx < 0 : line->dx > 0 :
FixedMul(y-line->v1->y, line->dx>>FRACBITS) >=
FixedMul(line->dy>>FRACBITS, x-line->v1->x);
}
#define P_AproxDistance(dx, dy) FixedHypot(dx, dy)
void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result);
void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result);
INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line);
void P_MakeDivline(line_t *li, divline_t *dl);
void P_CameraLineOpening(line_t *plinedef);
fixed_t P_InterceptVector(divline_t *v2, divline_t *v1);
INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld);
PUREFUNC fixed_t P_InterceptVector(divline_t *v2, divline_t *v1);
PUREFUNC INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld);
void P_UnsetPrecipThingPosition(precipmobj_t *thing);
void P_SetPrecipitationThingPosition(precipmobj_t *thing);
void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
@@ -74,4 +90,9 @@ extern fixed_t tmbbox[4]; // p_map.c
// bbox defined by the radius
//boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,
// boolean (*func)(line_t *));
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __P_MAPUTL__
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff. Show more