Compare commits

..
Author SHA1 Message Date
Alug 7d1eb398cf goddamit 2025-03-16 12:24:47 +01:00
Alug 97df54a760 oops 2025-03-16 12:24:08 +01:00
Alug 2edada8ce3 slight cleanup HWR_ObjectLightLevelPost 2025-03-16 12:18:20 +01:00
Alug 17e85df813 changes from testing branch 2025-03-16 11:55:10 +01:00
Alug a3b5c4dff8 Merge branch 'Saturn-Next' into directionallight 2025-03-16 11:52:38 +01:00
Alug 8c8fe976d7 dumb hack for input display in replays
since we cant get playerinput, just use throwdir to get some appoximation
maybe todo: idk maybe squeeze smth into replays?
2025-03-16 11:09:02 +01:00
Alug 8c43857bd3 add extra check to save a little bit of time 2025-03-16 11:08:55 +01:00
indev 380c8f65c8 aatree is used both with HWRENDER and ROTSPRITE, so just don't guard its include 2025-03-16 11:08:39 +01:00
Alug 5ec0af62d9 safe 2x "va" lel
V_GetSkincolorChar is unused now lel
2025-03-16 11:08:36 +01:00
Alug 3762b18159 just use splitflags 2025-03-16 11:08:31 +01:00
Alug b6de9e03d7 doesent need be an array 2025-03-16 11:08:27 +01:00
Alug 486f386f35 New input display option for stick display
thy neppy! https://codeberg.org/NepDisk/blankart/commit/52601bdfc2a6dd8916c3c401d70128d2ca11a1ff#diff-baf740b84aa99188fc2e5c1cb93e59fa2e319ff3

+ hellish abomination code cause kart
2025-03-16 11:08:23 +01:00
Alug 848d84147f Merge branch 'minispin' into Saturn-Next 2025-03-16 11:06:41 +01:00
Alug a980784771 replace magic number 2025-03-16 11:06:06 +01:00
Alug 0f675661a6 bruh 2025-03-16 11:05:28 +01:00
Alug 30deff7697 fix conflicts for minimap spinouts + some refactoring 2025-03-16 11:05:23 +01:00
Anonimus 21c267b319 Refactor to prevent desynchs 2025-03-16 11:05:19 +01:00
Anonimus cce363c8c8 Add a cvar for minimap icon spinouts 2025-03-16 11:05:15 +01:00
Alug c081349f9b make freecam speed per splitscreenplayer + add to menu 2025-03-12 07:01:19 +01:00
Alug 88b78a5bf7 delet cam rotspeed cvar
lmao forgor this did nothing
2025-03-12 07:01:15 +01:00
indev cf9e7ff37b Add toggle for look up/down, also don't trigger it during countdown or when player is respawning 2025-03-11 14:59:24 +01:00
Alug 8775e5abc1 fix compile without ROTSPRITE 2025-03-10 17:53:17 +01:00
Alug fe6b5a83f8 consolidate those 2025-03-10 17:29:20 +01:00
Alug 288bcbd419 bruh 2025-03-10 14:06:18 +01:00
Alug 4465b05bc8 p_sight stuff idk 2025-03-10 14:04:27 +01:00
indev 537aa30cfe Don't reset demo recording if player is still entering replay name in intermission 2025-03-10 13:16:44 +01:00
Alug e16ef100b8 try make this slightly more readable 2025-03-10 13:10:07 +01:00
indev a277d70ce2 Don't force specific characters in M_HandleConnectIP 2025-03-10 13:06:03 +01:00
Alug 6932a52463 change speelines blending condition
uuuhh, so, if you have sneakerboost they always will apply additive blending
otherwise if you go really fast (faster than sneakerboost)
2025-03-10 13:05:55 +01:00
Alug a686b29a7a only apply additive blend to speedlines when any kind of boost is happening
to emphasize that ure boosting or smth
2025-03-10 13:05:19 +01:00
Alug c133f0d751 add additive blending to fast speedlines 2025-03-10 13:05:09 +01:00
Alug 5ff125a429 spawn speedlines with non synched rng if ur in eggbox status
and well only if you have colourisation enabled
2025-03-10 13:05:01 +01:00
Alug b8cab84d2a super smol optimization 2025-03-10 13:04:11 +01:00
Alug d2975d2dcb toggle for keeping driftsparks while in air 2025-03-10 13:02:23 +01:00
indev e802ecf0b5 Add SHORT here for consistency with other code 2025-03-10 13:01:35 +01:00
indev 71378285b2 Check for missing patch earlier in W_CachePatchNameRotated 2025-03-10 13:01:32 +01:00
Alug ffe9a89552 remove erronous cv_sloperoll checks
this cvar is meant to be only the toggle for the player slope rotation, however, spriterotation should still be usable in any case with this disabled. the global toggle "cv_spriteroll" has been removed
2025-03-10 13:01:25 +01:00
indev ac9926eb17 spriteroll doesn't exist now :p 2025-03-10 13:01:19 +01:00
Anonimus 0b57389dcd HUD patch rotation 2025-03-10 13:01:16 +01:00
Alug e2b42b1647 delet memcpy doing nothing 2025-03-10 13:00:33 +01:00
Alug ad39ade286 split screentexture width and height
most displays are widescreen, so their width and height differ quite significantly, this may make the overall screentexture alot smaller
2025-03-10 12:59:25 +01:00
Alug 0ed21a171d remove stray bool in demovars struct 2025-03-10 12:58:18 +01:00
Alug ad65e3e968 allocate some extra buffer for demobuffer
incase this might overflow that we dont write to unvalid memory
thx indev <3
2025-03-10 12:56:51 +01:00
Alug d55d7e0efc smol replay fixes from rr 2025-03-10 12:54:39 +01:00
Alug ec7fa833d5 only ever touch this if player has a mobj
angleturn is broken in kart
2025-03-10 12:53:44 +01:00
Alug 2e6c1d9df4 revert this behaviour
be more like vanilla
2025-03-10 12:51:50 +01:00
Alug 7d55c46979 make P_InitCamera slightly prettier 2025-03-10 12:50:10 +01:00
Alug af2b22e91f cleanup P_SetupLevel
removed bunch of pointless vars, moved some things into functions
changed some stuff to be boolean
2025-03-10 12:50:03 +01:00
Alug e983174559 another check for realpatch lel 2025-03-10 12:47:46 +01:00
Alug 3bde3b04ae try just passing the sector + add 50 trillion extra checks
idk anymore but this is literally now how vanilla kart behaved
2025-03-05 11:23:40 +01:00
Alug 9e070a6516 tiny cleanup SCR_DisplayTicRate 2025-03-05 11:22:51 +01:00
Alug 8d9c6ec65f localping color was lost 2025-03-05 11:21:22 +01:00
Alug ec263086d8 use lööps for those to look a little better lel 2025-03-05 11:18:32 +01:00
Alug 06ccb4f7b0 dont reset cam using f12 when only one player is ingame 2025-03-05 11:18:23 +01:00
Alug 95daa7eacc just set this directly
no need for all of this
2025-03-05 11:18:05 +01:00
Alug d18afa1781 dont run this if cam tilt disabled 2025-03-05 11:16:56 +01:00
Alug 883c382a1d slightly refactor chasecam stuff again 2025-03-05 11:16:23 +01:00
Alug c82eb25628 where did this come from 2025-03-05 11:14:45 +01:00
Alug 8c0294898e fix issues with models
- Sloperotation was weird, it now uses what we calculate in K_RollMobjsBySlopes
- in general uses srb2s newer system
- alot of cleanup of pointless variables
- sprinfo pivots should now work
- removed roillmodel since it was smth weird and broke rollangle
2025-03-05 11:14:06 +01:00
Alug d09c8bb8fd ss->touching_preciplist deez 2025-03-05 11:13:43 +01:00
Alug d397a07d96 dont recalc if precip sector didnt move
forgor i can just check this
2025-03-05 11:13:40 +01:00
Alug 96f842fd96 only need to recalc this once a tic
precip thinker thinks slightly more often, but we really dont need that tbh
2025-03-05 11:13:34 +01:00
Alug 105b3f37eb only recalc floorz for visible precip mobjs
before it apparently recalced it a crapton for the crapton not visible precipmobjs, which even on vanilla maps led to noticable jitter
2025-03-05 11:13:26 +01:00
Alug 24387b50bd missed this for keepmusic 2025-03-05 11:12:22 +01:00
Alug 0c4661c2a7 remove this 2025-03-05 11:11:27 +01:00
Alug 178c942dc6 pass slope to K_RollMobjBySlopes
removing some code dupe in the process and allows some more flexability
2025-03-05 11:09:19 +01:00
Alug 47d41e2c2a refactor M_DrawSlider
apparently fixes weird framerate issues with gamma slider
also shows the values on sliders
2025-03-05 11:09:01 +01:00
Alug 4d7c223565 Have replay recording of "hits" use the reference count system
https://git.srb2.org/KartKrew/RingRacers/-/commit/fa8bffabfc51ea1d7be86d833190bb7dcf494fca
2025-03-05 11:08:18 +01:00
Alug e3af2b0d58 better prints if a replay desynchs 2025-03-05 11:08:06 +01:00
Alug f4ed9b43cd refactor keepmusic again
- puts all music stuff into a struct "music_t"
- should hopefully fix numerous issues with keepmusic and skipintromusic
- keepmusic can now "recover" from a few cases, like restarting the map from intermission
2025-03-05 11:06:57 +01:00
Alug 55cd0fa08f ensure proper cast 2025-03-05 10:59:34 +01:00
Alug 8cce4f3ccf whitespace lul 2025-03-05 10:59:18 +01:00
Alug 1e21f6a378 only do mouse stuff if we wanna do mouse stuff 2025-03-05 10:59:03 +01:00
Alug a0af6f2461 remove unused stuff i_video 2025-03-05 10:57:55 +01:00
Alug 390e3db25d tiny cleanup keyboard stuff 2025-03-05 10:55:16 +01:00
Alug 3d9bb65e62 Merge pull request #157 from Indev450/gentlemens
Offline ping System
2025-03-05 10:53:10 +01:00
Alug 4f88a97739 inline a few hooklib functions 2025-03-05 10:52:34 +01:00
Alug de977167ca pointless inline 2025-03-05 10:52:15 +01:00
Alug 84028f52d8 few instances of int float conversions i forgor 2025-03-05 10:50:35 +01:00
Alug f693ca8333 optimize ogl drawer functions
by avoiding excessive interger to float conversions
2025-03-05 10:50:28 +01:00
Alug 64dd17d75d ensure proper casting 2025-03-05 10:48:25 +01:00
Alug b3ce832753 check for shader cvar ealier 2025-03-05 10:47:59 +01:00
Alug b9c89b381b nullcheck for realpatch 2025-03-05 10:47:12 +01:00
Alug c8a0a2bdae dont need to pass the viewnumber around 2025-03-05 10:46:30 +01:00
Alug 84d3d0d891 smol cleanup portal code again 2025-03-05 10:44:56 +01:00
Alug fe42f1bd3e change syntax
will stay uppercase to not conflict with some crap Zzz...
2025-03-05 10:41:09 +01:00
Alug b5803e8787 move this after the early returns
save some time when drifting
2025-03-05 10:40:10 +01:00
Alug 9f7aca5fe3 lmao 2025-03-05 10:39:57 +01:00
Alug ac8e25865e turn driftsparkGrowTimer into a player field
less hacky and avoids 3 loops lol
2025-03-05 10:39:52 +01:00
Alug 02b411f7ee kill redundant laptime code
just use the newer one
2025-03-05 10:39:41 +01:00
Alug 9dee892244 more kart hud cleanup
also removes erronous nametag toggles
2025-03-05 10:38:18 +01:00
Alug e5d832a642 slight cleanup kart hud 2025-03-05 10:38:14 +01:00
Alug b069c2cb3e tiny d_main cleanup 2025-03-05 10:37:10 +01:00
Alug 7235f9864e delete nonfunctional second mouse stuff 2025-03-05 10:34:18 +01:00
Alug e4e1f0c645 revert all the server ticking stuff 2025-03-05 10:33:49 +01:00
Alug 54747c6b53 Prevent dropped ticcmds due to interp timing jutter
kinda figured out what this does, and makes clients on uncapped listen servers alot less prone to drop gametics
2025-03-05 10:32:37 +01:00
Alug 9ed242cde2 where did this go? lel 2025-03-05 10:27:09 +01:00
Alug 9bcfe63e3e Merge branch 'Saturn-Next' into gentlemens 2025-03-05 10:25:46 +01:00
Alug b38460473d Merge pull request #153 from Indev450/freecamstuffs
Replace spec cam with Freecam + "democam" (now freecam) refactor
2025-03-05 10:24:46 +01:00
Alug fd77beabe1 Merge remote-tracking branch 'origin/Saturn' into Saturn-Next 2025-03-05 10:24:22 +01:00
Alug 5dfab42fcf Merge pull request #158 from Chearii/blendmodes
Blending modes (and a few refactors)
2025-03-05 10:12:55 +01:00
Alug 72d94b77ac fix blendmode oopsie 2025-03-04 19:46:05 -05:00
Chearii 54d73206ca Fix `hw_draw` gaffe 2025-03-04 19:42:59 -05:00
Alug 8f342110c9 color ping numbers for color hud 2025-02-27 19:40:32 +01:00
indev 1af9903439 Fix compilation with old sdl 2025-02-18 12:29:47 +03:00
Alug b4269cba3e properly init numcontrollers 2025-02-17 21:34:09 +01:00
Alug 70a985e274 dont check number of controllers every frame 2025-02-17 21:34:06 +01:00
Alug f15f24914d initialize this 2025-02-17 21:24:28 +01:00
Alug 75d69dc90d skip a bunch of stuff in dedi/render_none 2025-02-17 20:54:56 +01:00
Alug 7322d553ba Revert "Merge pull request #151 from Indev450/fixdupeacks"
This reverts commit 1fabc14ac9, reversing
changes made to d9492eee28.
2025-02-17 18:05:30 +01:00
indev 9efd24e376 camara 2025-02-16 17:49:43 +03:00
Alug 1eae8c6ea3 use correct type in P_InitMinimapInfo 2025-02-12 12:01:05 +01:00
Alug 14881e968a simplify local ping display 2025-02-12 12:00:54 +01:00
Alug 5f0b2b0604 fix some level userdata not being invalidated
maybe fixed the random issues we had with the server?
2025-02-10 20:53:43 +01:00
Alug 73ea95ae61 just pass the controller directly
simplifies this alot
2025-02-08 15:44:20 +01:00
indev affa366f7d Merge pull request #159 from chromaticpipe/proxy-makefile
Add a proxy Makefile at the top level
2025-02-07 02:30:48 +03:00
chromaticpipe 7d62b330d0 Add proxy makefile at top level 2025-02-06 16:15:16 -06:00
Alug b398dacf29 update controller led when connecting a controller 2025-02-06 14:43:35 +01:00
Alug a6a53f6b9c dont pass bogus values to I_GamepadRumble and I_SetGamepadIndicatorColor
- fixes rumble and led stuff not working after hotplugging
- also fixes sdl2-compat breaking
- i hate karts controller code
2025-02-06 03:01:51 +01:00
Chearii ccc1c07930 Fix white pixel bug due to oversight
many thanks to indev for catching this!
2025-02-04 16:34:17 -05:00
Chearii d39e9447f3 Add line and FOF blending, fix model and shadow blending
also a bit of cleanup in r_things but it's too minor to headline
2025-02-03 04:46:27 -05:00
Chearii cd44e2d80c Prelim: Linedef alpha variable
realistically this was just because I'm Lazy
this makes figuring out linedef blending less of a brain twister
2025-02-02 21:14:48 -05:00
Chearii 36a1662afb Add blending modes 2025-02-02 20:37:19 -05:00
Alug 88d5ca0b8a should revert this completely 2025-02-02 00:19:38 +01:00
Alug ce00aef8b1 partly revert this
some of those "mightve" been changed at the point of the check
2025-01-30 13:25:12 +01:00
Alug c7a24199c7 make those const 2025-01-30 13:22:03 +01:00
Alug 6e81cdcb01 kill even more unused patches
+ nonexistant crosshair stuff
2025-01-30 10:42:01 +01:00
Alug 2a05f630b3 dont cache all those unused hud graphics 2025-01-30 10:41:55 +01:00
Alug bf9b738a0f use SRB2.2s general folder structure
- seperate addons folder (download folder remains in home directory unlike RR)
- seperate gif and screenshot folders
2025-01-30 10:41:48 +01:00
Alug 50fced2867 use SRB2.2´s logging system
- creates a new logfile each start instead of overwriting it everytime
2025-01-30 10:41:40 +01:00
Alug 6276243cc4 just keep a copy of musicchange before the lua hook
keep music can check for what was it stuff changed last to
2025-01-30 10:32:47 +01:00
Alug 22c48f19ba grow an invinc music also broke stuff
cant put it into the music exception list, otherwise it will always disable keepmusic when either one was used even once
2025-01-30 10:32:42 +01:00
Alug 9872640e77 the music system is truly amazing 2025-01-30 10:32:36 +01:00
Alug 80f7ddfb31 i hate conditions 2025-01-30 10:32:30 +01:00
Alug 5215fa4747 smol optimization comparePolygon
return slightly earlier for skywalls and horizonlines
2025-01-30 10:32:13 +01:00
Alug 7016b77ee8 also rotate eggboxes in air 2025-01-30 10:31:58 +01:00
Alug 5edb0d0e3d fall through deez 2025-01-30 10:31:46 +01:00
Alug a2c1fa5e23 delet if else hell 2025-01-30 10:31:41 +01:00
Alug 520f92e892 handle vote bg fallbacks more gracefully
if someone doesent provide a widescreen patch it now falls back to the replaced non widescreen one and vice versa instead of just falling back to what vanilla provides
2025-01-30 10:31:36 +01:00
Alug 305d408e02 forgor about the banan spin 2025-01-30 10:31:14 +01:00
Alug 8ccb747dcd j moment 2025-01-30 10:30:51 +01:00
Alug a1d5a2e1f9 simplify camtoggledelay and spectatedelay
just make em an array and use lööp
2025-01-30 10:30:34 +01:00
Alug 2f56487290 assign player later 2025-01-30 10:30:23 +01:00
Alug 2ebf66b99c kill P_TeleportMove
P_MoveOrigin literally just calls that so replace it with that
2025-01-30 10:30:19 +01:00
Alug bab120235d draw non widescreen anim vote bg before falling back to vanilla bg
how it was before, the game just fallback to the vanila widescreen patch if there was no animated widescreen bg provided, just fall back to the non widescreen anim patch instead if it exists
2025-01-30 10:27:56 +01:00
Alug 36404fd93d inline bunch of one line HWR things 2025-01-30 10:27:36 +01:00
Alug 3b90038b62 inline G_TicsTo stuff
theyre smol and get called often
2025-01-30 10:27:25 +01:00
Alug 40660f2379 "makes integer from pointer without a cast" deez nuts 2025-01-30 10:27:19 +01:00
Alug 7ab7193592 remove noshowhelp from bunch of debug cvars
doesent make too much sense those are hidden tbh
2025-01-30 10:27:13 +01:00
Alug 1fabc14ac9 Merge pull request #151 from Indev450/fixdupeacks
Try to fix issues with clients locking up due to never receiving acks back in case of dropped packets
2025-01-30 10:26:33 +01:00
Alug d9492eee28 Merge pull request #152 from Indev450/delaynetxcommand
Delay netxcmds when buffer is full instead of dropping them
2025-01-30 10:26:14 +01:00
Alug 0dd4f3b3d3 make old ping bar be blue on d1 aswell as purple with mindelay 2025-01-27 09:19:38 +01:00
Alug 49cefa92e2 dont banan drag rumble when not driving lel 2025-01-25 09:33:14 +01:00
Alug 2b13af2367 setup maplight stuff earlier
otherwise it doesent init early enough
2025-01-25 08:41:22 +01:00
Alug 97a5c15c36 just use D_NumPlayers 2025-01-24 20:44:50 +01:00
Alug b1fa124032 add funny banan throw rotate thing
like rr
2025-01-24 19:25:53 +01:00
Alug a15de64160 think we should copy this 2025-01-24 19:25:50 +01:00
Alug af3a23ce66 make trailing items also be able to rotate on slopes
mostly stuff from RR thx!
2025-01-24 19:25:46 +01:00
Alug b55c654a81 oop 2025-01-24 06:43:54 +01:00
Alug b97841b6fd proper add server gentlemans
this should be a netvar, but we cant really do that, thought not a huge deal
however id wish to send some kinda message to all players but idk
2025-01-24 06:40:05 +01:00
Alug ac64428abb dont mess up realpingtable
when serverplayer has mindelay active
this was supposed to show mindelay for serverplayers but that doesent work :chaosleep: so just do not mess with it
2025-01-23 21:55:48 +01:00
Alug 1857ce5113 conflict fix 2 2025-01-23 21:29:08 +01:00
Alug f4f3f6e29c slight cleanup HU_drawPlayerPing 2025-01-23 21:27:42 +01:00
Alug 9354a0ab88 conflict fix 2025-01-23 21:27:07 +01:00
Alug 6ef9c0b305 colourise pingnumber when gentlemens is active 2025-01-23 18:11:00 +01:00
Alug 6b951d2773 division by zero moment 2025-01-23 18:10:57 +01:00
Alug 064e9d58af add gentlemens delay to ping display
+ display ping even offline if you have mindelay active
2025-01-23 18:10:53 +01:00
Alug 1d5092cf22 smol cleanup 2025-01-23 18:10:21 +01:00
Alug 861d35e8d3 port clientsided gentlemens delay
cant do the serverside stuff due to netvars
2025-01-23 18:10:18 +01:00
Alug 6d94ff8d1f fix freecam not resetting online
idk local player handling is fucking awful in kart
2025-01-22 19:42:14 +01:00
Alug bfabdb7b6a bruh 2025-01-22 17:24:11 +01:00
Alug 7f9edddbcc remove redundand FTransform field 2025-01-22 16:58:30 +01:00
Alug 883cd3f516 more smol ogl sprite drawer optimizations 2025-01-22 15:46:44 +01:00
Alug a3e2d3ec71 also fix potential use-after-free in HWR_AddPrecipitationSprites
no clue why ogl didnt do it since its effectively the same code as software
2025-01-22 15:46:38 +01:00
Alug 7213f0dd5d split HWR_DrawSprites
saves on ALOT of conditional branching in a lööp when models are disabled
2025-01-22 15:45:25 +01:00
Alug 3bbdd1ea72 e better play it safe 2025-01-20 22:26:26 +01:00
Alug 2b09e74dcf kill aiming stuff in BuildTiccmd 2025-01-20 22:26:23 +01:00
Alug 5dc76d07ec Hold up/down for 2 seconds while not moving to pan the camera vertically
from RR
2025-01-20 19:33:56 +01:00
Alug ebfafd7b6e a 2025-01-20 19:21:44 +01:00
Alug 24ca9fdafa oops didnt init this 2025-01-20 19:21:42 +01:00
Alug 8cdb920f54 dont turn 90 degrees when switching to freecam 2025-01-20 19:00:22 +01:00
Alug cccf6449f9 fix freecam vertical look for the 500th thousand time
truly amazing code
2025-01-20 18:04:20 +01:00
Alug 9bd2da04e2 put this thing onto its original place 2025-01-20 15:28:51 +01:00
Alug 56563507b6 null check target in P_DamageMobj
apparently this may be null
2025-01-19 18:21:13 +01:00
Alug fa98b06dba :chaosleep: 2025-01-19 18:10:25 +01:00
Alug a763d85122 make function for driftsparkcolour
reduce some code dupe
2025-01-19 17:45:28 +01:00
Alug db8b1ca0a3 replace common damage magic numbers with named macros
that stuff always confused me before lol
2025-01-19 17:38:32 +01:00
Alug 5106c391bb readd check for banan
this time without mobjwasremoved
just check if banan exists
2025-01-19 17:38:22 +01:00
Alug 0c2e285d2e remove some code dupe in R_AddLine 2025-01-19 17:35:00 +01:00
Alug f7df80f763 ; moment 2025-01-19 17:34:56 +01:00
Alug 676265a92a fix "lessprecip"
logic error lul
2025-01-19 17:34:52 +01:00
Alug f9ee18584e use MT_NULL instead of number 2025-01-19 17:34:42 +01:00
Alug 3d394bb621 refactor weather switching
from srb2
makes this more sane and makes PRECIP_STORM_NORAIN not spawn a crapton of invisible mobjs
2025-01-19 17:34:33 +01:00
Alug 913c0f4ae7 idk why we check this 2025-01-19 17:34:19 +01:00
Alug 04bf086a9e forgor to check for that flag 2025-01-19 17:34:12 +01:00
Alug 2a25328ce0 change tooltips slightly 2025-01-19 17:33:56 +01:00
Alug af7393832a add stuff to menu 2025-01-19 17:33:50 +01:00
Alug 516bea6e8a add toggle for item amount number display 2025-01-19 17:33:30 +01:00
Alug 82bd65eebd don use multiicon patches in 3/4p splitscreen
since it uses the smoler patches
also removes redundant assignments
2025-01-19 17:33:20 +01:00
Alug 44b6c53452 change banana default patch to match lua roulette hud behaviour 2025-01-19 17:33:02 +01:00
Alug 28b294f48a add support for multiitem patches (thx neppy!)
needs new patches, unsure if we just gonna add em to the extra file or make a new one
so it ambigous for now
2025-01-19 17:32:21 +01:00
Alug 56ed32d094 merge conflict moment 2025-01-19 17:31:55 +01:00
Alug 60d81037fd "Fix console text bleeding "
read https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1434
2025-01-19 17:31:27 +01:00
Alug 8abe40cc81 cap console animation if uncappedhud is disabled
since thats "how vanilla done it" before
2025-01-19 17:31:20 +01:00
Alug cd9df8065d use R_GetHudUncap 2025-01-19 17:31:13 +01:00
Alug b6d50da809 add fancyroulette toggle 2025-01-19 17:31:08 +01:00
Alug 383cc71bb3 reorder saturn hud menu a little
also remove uncapped hud from it, since why would you ever wanna turn it off?
2025-01-19 17:30:49 +01:00
Alug d75c16bab5 add the fancy hudtrans flags 2025-01-19 17:30:08 +01:00
Alug 8efdbe40e4 dont fancy during respawn 2025-01-19 17:30:00 +01:00
indev ada779a97d Fancy :D 2025-01-19 17:29:56 +01:00
Alug 37d28464ea change how spritescales and offsets work
- now theres realoffsets aswell
- allows better control of changing things per lua and still do funky stuff in hardcode without conflicts
- spritescales and offsets now get reset centralised before any thinkers run
2025-01-19 17:29:41 +01:00
Alug 816ad7c2fc add banan jitter toggle to menu 2025-01-19 17:29:29 +01:00
Alug c4d1f9c6a2 add toggle for bananjitter 2025-01-19 17:29:24 +01:00
Alug 33e1cfc2ba le funny banan drag jumpy 2025-01-19 17:29:07 +01:00
Alug bce9990826 only rumble banan when on ground 2025-01-19 17:27:51 +01:00
Alug 923e0500df fix typo lel 2025-01-19 17:27:31 +01:00
Alug 017646e704 forgor about software again 2025-01-19 17:26:35 +01:00
Alug 4900177e8c TEST: skip prepping 3d floors for fofs without planes
or if they were already checked
2025-01-19 17:25:35 +01:00
Alug ed97d28254 split HWR_RenderBSPNode
to reduce function call overhead
its only microscopicly faster lel
2025-01-19 17:25:26 +01:00
Alug 15185e0450 simplify keepmusic
honestly no clue why i made stuff check on every music change
2025-01-19 17:23:52 +01:00
Alug a29f8d5f38 dont keep music if there is no music 2025-01-19 17:23:45 +01:00
Alug 8dc2d22996 Clear acktosend when initializing node
since it was never reset, values might been taken over from former node
2025-01-19 17:22:59 +01:00
indev 4d355f99c0 Add spb music to list of exceptions for keepmusic 2025-01-19 17:22:52 +01:00
indev aa0bf396e7 Fix spectator control text overlapping when showdirectorhud is off 2025-01-19 17:22:38 +01:00
Alug 1db9bcd6c9 oops 2025-01-15 12:59:49 +01:00
Alug 6f7a52a6a6 make freecam strafe be affected by freecamspeed cvar 2025-01-15 12:59:47 +01:00
Alug cd3e664e6a oops fix menu stuff 2025-01-13 16:01:19 +01:00
indev e7d3e03169 Clear menus when running 'map' command 2025-01-13 15:53:51 +01:00
Alug 4e4871fe93 remove "errorshitspam"
hooklib refactor indirectly fixed the root issue, so this is not needed anymore
2025-01-13 15:52:12 +01:00
Alug 51067f2802 Merge branch 'Saturn-Next' into freecamstuffs 2025-01-13 08:39:38 +01:00
Alug 62a65c5c1d save a whopping 2ms from gamestart to race start on texture updating 2025-01-13 08:38:20 +01:00
Alug b9e23113c8 slightly cleanup gravstretch stuff 2025-01-13 08:34:52 +01:00
Alug 50f1a61182 fix having saltyhop disabled forcing player spriteyoffset to be forced 0
just clear out everything on toggle
2025-01-13 08:34:44 +01:00
Alug ed9adfae68 add toggle to colour sneakertrail flames (thx neppy!) 2025-01-13 08:34:34 +01:00
Alug cb4ef15c77 another attempt at fixing skipintro mus playing titlescreen music 2025-01-13 08:30:42 +01:00
Alug e4e18f0a62 check for 0 to avoid division by 0 2025-01-13 08:29:33 +01:00
Alug ab8cbcb450 reinit minimap stuff when a wad is added while ingame 2025-01-13 08:29:11 +01:00
Alug 4103fac605 slight cleanup r_draw8 2025-01-13 08:29:06 +01:00
Alug 0a58797f78 clamp to length-1 2025-01-13 08:29:02 +01:00
Alug 5db7f5f2e7 fix column drawers clamping stuff 2025-01-13 08:28:58 +01:00
Alug 47a3de8fe1 let "fovchange" work in software 2025-01-13 08:28:46 +01:00
Alug 2b725560cc add banandrag rumble lol 2025-01-13 08:28:36 +01:00
Alug 9f9cb833f0 add slight fadeout to spinout rumble 2025-01-13 08:28:22 +01:00
Alug f88290d34e kill unarchivevaluedemo
just pass if we load from replay or not and do stuff accordingly
2025-01-13 08:24:56 +01:00
Alug 157ff2df4f make gamestate download show total gamestate size 2025-01-13 08:24:38 +01:00
Alug a9117573fb add colourized speedlines
smth i had laying around in lugstuff
2025-01-13 08:23:02 +01:00
Alug cea28c591f slight cleanup minimap head stuff 2025-01-13 08:22:39 +01:00
Alug b963146faa split ra wheel and position number hud offsets
kinda ass due to the preset offset, but will just not apply if either was changed from its original position
2025-01-13 08:22:06 +01:00
Alug 181c948e86 toggle for camera turnaround on timeover 2025-01-13 08:21:58 +01:00
Alug d3b8e11783 one line this 2025-01-13 08:21:31 +01:00
Alug b3b19eff49 this doesent work out
breaks some textures not appearing on some maps
2025-01-13 08:04:10 +01:00
Alug 67aa31439b dont rumble in freecam state 2025-01-12 17:25:57 +01:00
Alug ff895f3251 fix frame flag clash 2025-01-11 19:54:28 +01:00
Alug 130c1aba67 put random direction light toggle into advanced video options
also make it a scoll menu
2025-01-11 18:10:24 +01:00
Alug a07c2f4c32 reinit random maplight on mapchange when toggled
the condition may otherwise not change the light if you restart the same map
2025-01-11 08:52:49 +01:00
Alug 96b7a4efe6 add FF_ABSOLUTELIGHTLEVEL
mobj_t.lightlevel is absolute instead of relative when set
2025-01-11 08:33:02 +01:00
Alug 124b2ff431 add encore variants of maplight 2025-01-11 08:32:59 +01:00
Alug c1ec72e606 oops 2025-01-11 08:28:57 +01:00
Alug ef1faf9f68 those somehow got lost 2025-01-11 08:26:12 +01:00
Alug 02595b9ea6 forgor this 2025-01-11 07:50:25 +01:00
Alug c1514635b0 if disabled and no soc overrides light behave like vanilla
always apply wall and slope contrast pls
2025-01-11 07:50:22 +01:00
Alug e5e7205c95 change how randomized light works
so it doesent kill actual soc set randomlight if you toggle it
2025-01-11 07:26:44 +01:00
Alug f8d1bf0811 Merge branch 'Saturn-Next' into directionallight 2025-01-11 07:26:37 +01:00
Alug a1f185b0f0 Merge pull request #148 from Indev450/checkposopti
Dont always call R_PointInSubsector if thing has not moved in P_CheckPosition
2025-01-11 01:37:07 +01:00
Alug 8981ae3117 Merge pull request #156 from Indev450/precipthinklist
Add a seperate thinkerlist for precipmobjs only
2025-01-11 01:36:23 +01:00
Alug 2a948ca4c2 move this 2025-01-10 22:46:52 +01:00
Alug d9f0c55fee "Invinciblity" 2025-01-10 22:31:46 +01:00
Alug 50d2bf5d8d seperate game turn axis from cam turn axis
both are bound to the same value by default, so vanilla controls remain intact
theres no other good way to have gamepad controls for this sadly
2025-01-10 22:28:34 +01:00
Alug d39fd5bb5c strafe controls for speccam/freecam
TODO: seperate cam turning axis from gameplay turn axis for gamepads
2025-01-10 22:28:31 +01:00
Alug 1a9865ebc4 this should also use unpaused rendertimefrac 2025-01-09 17:27:25 +01:00
Alug a11227b15a fix postimg data types mismatch
also remove the "postimgflag_t" typedef since its useless
and use smoler type for everything we dont need much space lol
2025-01-08 18:34:24 +01:00
indev 38b52b826a huh 2025-01-08 12:00:41 +03:00
Alug 51e367a61d move saturn hud cvars to k_kart and fix driftgauge extra showing
if there is no patch for it
its kinda dumb, since technically would allow to not load all of em
but im lazy and dont wanna change possiblevalues around
2025-01-08 04:10:05 +01:00
Alug 165803c95c toggle for smol positionnum and posnum animation 2025-01-08 04:10:02 +01:00
Alug d01ed38895 fix "connect" command not saving to last server 2025-01-08 03:23:37 +01:00
Alug cdfef0f884 oops forgor those 2025-01-08 01:50:26 +01:00
Alug ddc8e4a29e clean up gamepad led stuff 2025-01-08 01:47:05 +01:00
Alug f74cd97c4b clean up this mess a little 2025-01-08 01:33:55 +01:00
Alug bb91d8e1e3 dont rumble in freecam + player fix 2025-01-08 01:33:49 +01:00
Alug ee8fd22f36 oops fix software lel 2025-01-08 01:33:46 +01:00
Alug c0d4599a35 TEST: revert sleep stuff for now
dedi may sometimes get stuck here somehow
2025-01-07 23:48:41 +01:00
Alug 5c5a5e200e fix fbo crap once again 2025-01-07 20:18:39 +01:00
Alug 864d747e3b check if subsector has sector before assigning 2025-01-07 19:49:54 +01:00
Alug d41b6c185a fix freecam aim getting stuck and other issues
- gamepads now aim like they used to and at same speed as keyboard
- aim reset has been changed so it resets automatically, but also can be manually reset with centerview
- aiming is locked during cam reset
2025-01-07 18:47:26 +01:00
Alug 03e45f4590 check for cam subsector
since we can move it around and i added this to freecam mode, subsector may be null for reason so better be safe than sorry
2025-01-07 16:31:04 +01:00
indev ce31ceda65 If available, add map title into crash log 2025-01-07 14:52:58 +03:00
Alug c8737bd43f make this more complicated due to a "-" 2025-01-06 22:50:24 +01:00
Alug eff6b31ee8 change director toggling handling
- now not changable over console anymore, bind only!
- it doesent save anymore so its always disabled at game start
- moving while in spec state will disable director when active so stand still
- disable it in splitscreen completely
- only adjust view when toggling it on
2025-01-06 22:41:20 +01:00
Alug 03259aeca0 let postimg stuff also apply to freecam 2025-01-06 22:41:18 +01:00
Alug dbb5c1482b add a little extra safety here ig
this crashed on levelload once so idk maybe player was null ig
2025-01-06 20:36:31 +01:00
Alug afa66d0418 double the slack for slep 2025-01-06 20:36:25 +01:00
Alug 7177b396e0 any of those may be NULL in MakePatch
no idea but this crap keeps crashing in some other place every single time i add a check somewhere else
2025-01-05 23:02:36 +01:00
Alug e796f7e81f thats not timedemo lel 2025-01-05 21:25:01 +01:00
Alug 890779713a turn off any active menus when using demo play commands 2025-01-05 21:24:03 +01:00
Alug c4c995a9a3 disable pause vhs effect when in freecam mode 2025-01-05 20:37:49 +01:00
Alug 718fe7e8ae slight slep optimization
https://git.do.srb2.org/STJr/SRB2/-/commit/1da55066d43ed6a0cb666999c20316bef463024b?merge_request_iid=2583
2025-01-05 20:14:54 +01:00
Alug 1d8be20962 disable director while in replay freecam 2025-01-05 19:02:01 +01:00
Alug a90c51ec0f no u may be used uninitialised 2025-01-05 18:54:08 +01:00
Alug 077076532f slight cleanup buildticcmd 2025-01-05 18:54:05 +01:00
Alug 7ca2051f84 Adjust slack based on precision
https://git.do.srb2.org/STJr/SRB2/-/commit/d20552c49d9fd6a2075ebd7d46b0b133c69f1dbe?merge_request_iid=2583
2025-01-05 18:53:32 +01:00
Alug 8ff5cc7cbb --------- 2025-01-05 15:11:25 +01:00
Alug 92649a393d dont cast "infinity" to int lel 2025-01-05 01:11:57 +01:00
Alug 98db1a5757 Further improve sleep accuracy on UNIX systems
hanichad https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2583
2025-01-05 01:11:54 +01:00
Alug e53c6bb4da reduce ternary hell a little lel 2025-01-04 21:54:53 +01:00
Alug 5c8b318a93 make float and sink use accel and brake again but also keep rebindable controls
keeps intended behaviour since we now dont need to worry about player controls anymore
but keeps the rebindable buttons incase someone wants to do a crazy control setup for some reason
2025-01-04 21:04:04 +01:00
Alug 029907a87a Merge branch 'Saturn-Next' into freecamstuffs 2025-01-04 19:46:42 +01:00
Alug 2f4a113685 more hAx: dont move player during freecam state besides hop and honk
useful if you wanna take pics and dont feel like driving away
2025-01-04 19:38:08 +01:00
Alug f512a08051 dont do this while not in replay
this is kinda awkward tbh, but its useful for replay stuff
2025-01-04 19:38:05 +01:00
Alug 338bcf0d2d forgor about lookback ig 2025-01-04 02:30:01 +01:00
Alug 8cb7396f33 check for consoleplayer since displayplayer is who youre watching 2025-01-04 02:29:57 +01:00
Alug b69bb85003 remove redundant stuff
can just set this all the time, its only used when menu is active anyways so it doesent matter if we set it
2025-01-04 02:29:23 +01:00
Alug f9b1071539 simplify this 2025-01-03 19:44:10 +01:00
Alug 7d47834e55 oops smol error 2025-01-03 19:44:03 +01:00
Alug 2e1120dc50 move postimg flags to camera struct
- also dont let water and heat be applied on top of each other since it does not look good (water postimg takes priority over heat)
- also save a little time in opengl splitscreen since it does not support heat or wöter effects
2025-01-03 19:43:59 +01:00
Alug 64a2fe1410 clean shit up even more + fix cam aiming reset
dont really care about which input anyways.
2025-01-03 19:43:45 +01:00
Alug caa09cbcfb try and clean up this mess
+ fix cam angle being wrong when you switch to freecam from viewing someone
2025-01-03 19:43:36 +01:00
Alug ba4329e623 add another local ticcmd builder so it can guess if we "moved" and put us into freecam state and shit 2025-01-03 19:43:32 +01:00
Alug 575e46c3db let playercmd lua hook run during "spectator" input crap lmao 2025-01-03 19:43:19 +01:00
Alug 45237c9298 fix unitialised use of controller stuff 2025-01-03 19:43:10 +01:00
Alug 7de32c74e6 move spectator hack after pause/desynch code
this should take priority over everything
2025-01-03 19:43:04 +01:00
Alug 01b942e1fc giga shizo spec synch "fix"
ok so, for whatever dumb reason, spectatormovement will desynch at random, even on localhost.
with this we just literally fucking ignore almost every button input locally and just wont move our spectator player at all.
but since we are indeed still runiing specatotr movement code, and this is localcmd shit, the server just thinks we dont want to move and thus is "synchsave".
sadly this does not fix desynchs from vanilla players
the only code we keep is for button inputs that do certain actions like "item" so we can still join from spec with it and other crap
2025-01-03 19:42:58 +01:00
Alug 3388d35fe0 fix encore mirroring not applyingg to freecam/democam 2025-01-03 16:41:01 +01:00
Alug 2f014bb505 apparently this is slower for everything but rendering 2025-01-03 15:56:46 +01:00
Alug f9f7090b63 save subsector checks for dedi 2025-01-03 15:56:04 +01:00
Alug 0bc95e4b5e speed up camera position checks 2025-01-03 15:55:52 +01:00
Alug c5b70ccc4a do NOT repeatedly call M_Responder!!
"thread safety" or smth
also put stuff into two seperate functions, since i started hating nesting
2025-01-03 15:55:07 +01:00
Alug 8b94aded16 smol fix 2025-01-03 15:54:52 +01:00
Alug e105d8f51e apparently this is slower for everything but rendering 2025-01-03 15:54:44 +01:00
Alug 30dc0abc25 move camera noclip stuff into its own function
its not used in kart anyways and moving it makes crap more readable
2025-01-02 17:09:34 +01:00
Alug a7a6e9edfc move camera noclip stuff into its own function
its not used in kart anyways and moving it makes crap more readable
2025-01-02 17:09:13 +01:00
Alug 854cb7ee49 this doesent work for us 2025-01-02 05:21:40 +01:00
Alug f7ca8fb943 add speccam playerflag
the other thing was weird and dumb lol
2025-01-02 04:54:25 +01:00
Alug 54fda32591 logic error lmao oops 2025-01-01 21:53:01 +01:00
Alug 5d44b44558 use FRACUNIT in rumbleticker + some changes
- brakedrift will now add to any rumble thats currently going on
- both hyu and invul now rumble less heavy on offroad
2025-01-01 21:34:14 +01:00
indev e321d759c0 Thats not defined or used anywhere, bad automerge maybe? 2025-01-01 20:01:54 +03:00
indev bb3a65f8ff Repurpose ST_DrawTextInput into M_DrawTextInputScroll, and move its definition into m_textinput.c. M_DrawTextInput is now a macro using M_DrawTextInputScroll 2025-01-01 19:59:25 +03:00
Alug 8da59dc288 slightly cleanup rumble and led ticker 2025-01-01 17:37:00 +01:00
Alug 8f0c5fb508 always close any menus when using "connect" command 2025-01-01 17:19:32 +01:00
Alug 5e1d43b5af those will never be changed ever 2025-01-01 17:19:29 +01:00
Alug 487018f146 hack: only let freecam for spec move when youre actually able to move as spec
cause kart weird, and we cant remove the spec movement due to synch reasons
and letting the cam move instantly instead of waiting, may put you in a weird cam position
2025-01-01 05:37:52 +01:00
Alug 3ade8b09c5 move early return even earlier
so theres no need to constantly init scale and drawdist
2025-01-01 05:30:31 +01:00
Alug 3180221a42 dont iterate through precip blockmap if there is no precip 2025-01-01 05:30:22 +01:00
Alug 9c37a8472e move early return even earlier
so theres no need to constantly init scale and drawdist
2025-01-01 05:11:31 +01:00
Alug 136d9143e7 we dont really need to check for precipthinkers in the precip thinkerlist
also makes precip handling in P_NetUnArchiveThinkers a little safer
2025-01-01 05:11:28 +01:00
Alug 4aad4887fd dont iterate through precip blockmap if there is no precip 2025-01-01 05:11:25 +01:00
Alug ffc7832ec7 attempt to optimize column drawers a little 2024-12-31 02:52:30 +01:00
Alug 3910e66905 dont try to chase after your spec mobj lel 2024-12-30 23:11:00 +01:00
Alug 6fcfb9cf36 readd this check lel 2024-12-30 22:21:38 +01:00
Alug 83d2ade699 seperate thinkerlist for precip
i sure hope i handled everything right lmao
2024-12-30 18:00:18 +01:00
Alug fef98e478d add extra driftgauge option before i forger about it again 2024-12-30 17:55:50 +01:00
Alug f7ba260717 just skip missing/broken fields in musiccredit handling
like vanilla kek
still will throw warnings but atleast will show stuff if theres anything left in the musicdef
2024-12-30 17:53:06 +01:00
Alug 82f9f2f73f delet all the hardware sound crap
psure it doesent even properly work at this point
2024-12-30 17:51:57 +01:00
Alug 182500c2d2 fix potential Fix segfault when aborting HTTP download 2024-12-30 17:34:45 +01:00
Alug aca48d45b3 fix potential crash with perfstats
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2576
2024-12-30 17:34:40 +01:00
Alug b2823c81e4 fix jitter when toggling freecam off 2024-12-30 11:34:40 +01:00
Alug 761df3f2cf hide director control stuff for others than player 1 2024-12-30 11:30:53 +01:00
Alug 6f3443232e Merge branch 'Saturn-Next' into freecamstuffs 2024-12-30 11:30:46 +01:00
Alug 588dac343e dont disable this.... if its disabled kek 2024-12-30 11:24:23 +01:00
Alug aa222b6861 slight cleanup director 2024-12-30 11:10:41 +01:00
Alug 6d01ec4c55 dont need this anymore 2024-12-29 19:46:44 +01:00
Alug f72c64d7d1 fix some potential issues with viewinterp
now unpaused disabled interp on netlag
also fixes screencoord stuff not being interpolated during pause
2024-12-29 19:46:41 +01:00
Alug 92a3e974b0 fix driftgauge showing with freecam while ingame 2024-12-29 19:46:35 +01:00
Alug 7d6cce5881 readd cam cmd stuff
cause it may break the cam in replays or smth a
2024-12-29 19:46:33 +01:00
Alug b3323b7c2d change error msg 2024-12-29 17:45:28 +01:00
Alug 70e64d9471 reset demo recording in those places 2024-12-29 17:43:21 +01:00
Alug cbc3f8e917 add warning for non allocated demobuffer 2024-12-29 17:39:02 +01:00
Alug 55dfdc723f fix demo playback 2024-12-29 17:24:45 +01:00
Alug 27d6447a83 fix wrong cam default controls 2024-12-29 16:51:18 +01:00
Alug 26480882c8 remove the remainder or demo.freecam 2024-12-29 16:43:34 +01:00
Alug b23020435f replace all this crap with either stplyrnum or R_GetViewNumber 2024-12-29 16:43:09 +01:00
Alug 267e2be69b fix offbyone issue 2024-12-29 16:42:33 +01:00
Alug 2112be8ef7 Merge branch 'Saturn-Next' into freecamstuffs 2024-12-29 16:16:49 +01:00
Alug e5ee978eb2 Merge branch 'Saturn-Next' into delaynetxcommand 2024-12-29 16:16:33 +01:00
Alug 55fd31894b Merge branch 'Saturn-Next' into checkposopti 2024-12-29 16:15:23 +01:00
Alug 189d9adef5 Merge branch 'Saturn-Next' into fixdupeacks 2024-12-29 16:15:00 +01:00
Alug 44288a5865 Merge branch 'unglobsavep' into Saturn-Next 2024-12-29 16:04:21 +01:00
Alug 66f89fb4ad oops 2024-12-29 16:03:56 +01:00
Alug eceb671ea8 add missing include 2024-12-29 16:02:05 +01:00
Alug a15615a229 add missing include 2024-12-29 16:01:35 +01:00
Alug 8e10bcc739 add a bunch of extra checks into demo stuff
buffer may be NULL in some cases
should fix dedis crashing when replay recording is disabled
2024-12-29 15:59:10 +01:00
Alug 22e65cd5e7 fixup conflicts 2024-12-29 15:58:43 +01:00
Alug 72383520cb Merge branch 'Saturn-Next' into unglobsavep 2024-12-29 15:51:25 +01:00
Alug 38ef55b869 add a mipmap check here ig 2024-12-29 15:41:28 +01:00
Alug ca09a5dd46 dont need to do this twice 2024-12-29 06:41:11 +01:00
Alug 11546cd906 fix centerview 2024-12-29 06:41:07 +01:00
Alug 4110130ca7 block freecam toggling when player is in spec 2024-12-29 06:41:04 +01:00
Alug 6b9900ad4e clean up cam stuff for good 2024-12-29 06:41:00 +01:00
Alug 3d39f50388 make function to return button names
to use with new rebindable cam controls
2024-12-29 06:03:10 +01:00
Alug f355b2269c toggle off freecam when f12ing 2024-12-29 05:42:31 +01:00
indev da9c19bba4 Update replayfreecam lua global to use camera.freecam for currently viewed player 2024-12-28 18:48:58 +03:00
Alug 3156851554 fix cam interp during pause again 2024-12-28 04:01:21 +01:00
Alug a19cb5f2bc fix speccam again 2024-12-28 04:01:18 +01:00
Alug 2639f94dff fix freecam not being steerable when not in spec
ugh this is godawful
its literally almost a complete copy of
2024-12-28 03:44:32 +01:00
Alug 2c769f8043 changable freecam speed 2024-12-28 01:46:20 +01:00
Alug 332f7db32f make freecam work in splitscreen
banish cameracmd shit
2024-12-28 01:46:17 +01:00
Alug 3381f6af3a set default controls for float and sink ig 2024-12-28 01:46:12 +01:00
Alug 45d33b951c add alternative cam float and sink buttons 2024-12-28 01:46:09 +01:00
Alug 1922b32799 add bindable freecam toggle 2024-12-28 01:46:06 +01:00
Alug 6bb72c363f fix freecam not being interpolated when ingame 2024-12-28 01:46:03 +01:00
Alug 378382f3ad use demo freecam for spec
its more versataile and lets you pass through walls and floors just like in replays
2024-12-28 01:45:59 +01:00
Alug 7e09493cf2 whoops this never did anything lol 2024-12-26 16:01:49 +01:00
Alug 126fce9119 1px 2024-12-26 01:08:12 +01:00
Alug 0b5879ffb3 fix compile 2024-12-26 01:00:52 +01:00
Alug 0bd2c6220d drifgauge gfx using the extra 3 speedometer sticker
arsepain
+ smol cleanup colorhud
2024-12-26 01:00:27 +01:00
Alug a434ce2080 super smol optimizations 2024-12-26 00:57:19 +01:00
Alug c8193380e7 make some cam stuff behave exactly like vanilla again
no clue if this changes anything at all, but cam stuff be causing so many issues id rather just have it behave like it used to
2024-12-23 17:45:59 +01:00
Alug e38580c9c2 dont remember removing this in s_sound 2024-12-23 17:45:54 +01:00
Alug c46ff7daff use P_MobjWasRemoved for HWR_DrawSprite 2024-12-22 21:19:08 +01:00
Alug d2ca916043 settable mobj lightlevel from lua 2024-12-22 20:58:23 +01:00
Alug 09e901b31b readd mobj lightlevel field so i dont have to edit frameflags 2024-12-22 20:58:20 +01:00
Alug 4418653edb Merge pull request #147 from Indev450/refactorogl
Refactor OpenGL library handling
2024-12-22 19:22:12 +01:00
Alug 1d9bcaa786 Merge branch 'Saturn-Next' into refactorogl 2024-12-22 19:21:27 +01:00
Alug 8bd943eb71 Merge remote-tracking branch 'origin/Saturn-Next' into directionallight 2024-12-22 18:57:38 +01:00
Alug b24c59ce55 fix compile 2024-12-22 18:38:57 +01:00
Alug 0290c738e1 fix compile 2024-12-22 18:38:39 +01:00
Alug 0acb8e6a63 fix compile 2024-12-22 18:38:31 +01:00
Alug 27bfd0078c fix compile 2024-12-22 18:38:17 +01:00
Alug a98ab3d823 Merge branch 'Saturn-Next' into checkposopti 2024-12-22 18:25:10 +01:00
Alug bbf4de4f5e Revert "add P_CheckPositionShadow just for shadow mobjs"
This reverts commit 7edce19c9c.
2024-12-22 18:25:03 +01:00
Alug f20297b5dd Merge branch 'Saturn-Next' into delaynetxcommand 2024-12-22 18:24:17 +01:00
Alug b4521643b2 Merge branch 'Saturn-Next' into fixdupeacks 2024-12-22 18:24:08 +01:00
Alug 67a75730d0 Revert "massive cleanup unused code"
This reverts commit e35612a6f6.
2024-12-22 18:23:38 +01:00
Alug d12369f6f4 add some () 2024-12-22 01:47:14 +01:00
Alug 4a7ce87ac2 do the same for R_ProjectPrecipitationSprite 2024-12-22 01:44:33 +01:00
Alug d8b36ef0da dont put potential null mobj into interpolation stuff 2024-12-22 01:42:51 +01:00
Alug 1341ec80bf dont dereference potential null mobjs in software projectsprite 2024-12-22 01:40:52 +01:00
Alug 9882291828 compiler pls shut up 2024-12-22 01:32:05 +01:00
Alug aa4fa1e42e use P_MobjWasRemoved and null check for thing subsector in projectsprite 2024-12-22 01:32:01 +01:00
Alug 8a641d3e37 fix fade to menu again oops 2024-12-20 18:23:27 +01:00
Alug 317f5f8d48 fix no fbo compile 2024-12-20 18:23:25 +01:00
Alug 92c0ddd068 always reset those just in case 2024-12-20 11:35:30 +01:00
Alug 4f037896db oops this is lugstuff only lel 2024-12-20 11:27:49 +01:00
Alug 494a87feea idk just set to false here too 2024-12-20 11:19:18 +01:00
Alug 4a3af6bc8a whoops 2024-12-20 03:17:20 +01:00
Alug 0c7851bd26 try to clean up downsampling and resolution checking stuff
- global function that updates variables with current display resolution
-smol boolean function that quickly checks if the game res matches the desktop res
- i_downsample has been simplyfied a bit
2024-12-20 03:13:17 +01:00
Alug 5b46ae2eb9 better nvidia xwayland workaround handling
what in the world was i thinking????
2024-12-20 03:12:57 +01:00
Alug 2034eedbe4 add another early return 2024-12-20 01:21:09 +01:00
Alug fde4f64b83 simplify this crap and make compiler happy 2024-12-20 00:59:46 +01:00
Alug 404927c53c no 2024-12-20 00:59:22 +01:00
Alug e0796b0cf1 just query this once 2024-12-20 00:59:18 +01:00
Alug 8df8749a9c return false here 2024-12-20 00:58:41 +01:00
Alug 1c2fb14f45 makes no sense without screen tex 2024-12-20 00:58:35 +01:00
Alug 82f70ff75e fix compile due to missing am_map.h include 2024-12-19 22:42:22 +01:00
Alug 46b2d5fbcd fix compile without USE_FBO_OGL 2024-12-19 22:40:28 +01:00
Alug 23b2e35dbd use slightly diff maths for skydomevertex calc
from DSDA-Doom
maybe fixes some issues with certain skydomes?
2024-12-19 20:56:25 +01:00
Alug a576ddf0e4 oops 2024-12-19 20:43:05 +01:00
Alug df63b3ece0 add "listmapthings" and "listunusedsprites" commands
the former also shows duplicated mapthings
2024-12-19 20:34:10 +01:00
Alug 3174d8fb1c Fix segfault when sending excessively large netcmds
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2568/diffs?commit_id=457b761d9301b1904c414a8e8ba908f74b9ab959
2024-12-18 19:40:36 +01:00
Alug bed0e65548 potential fix for clients locking up due to never receiving acks back
apparently, if the client doesent receive an ack back which may happen due to duplicate packets/bad net conditions, it may spam resend the packet until its netxcmd buffer is full and locks up
2024-12-16 22:01:32 +01:00
Alug 1357978596 init textcmdbuf to NULL
just in case
2024-12-16 21:58:51 +01:00
Alug c5765c20bc delay NetXCmd´s instead of dropping them when the buffer is full
credits and many thanks to Hanicef!
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2568
2024-12-16 21:58:48 +01:00
Alug 52cd614613 prevent potential crash if viewmobj was removed 2024-12-16 16:38:03 +01:00
Alug db04046cb3 smol fix for gamma stuff
-dont apply gamma adjust when gamma is on default value
-fix saturation not being applied on console on OpenGL without paletterendering
2024-12-16 15:48:33 +01:00
Alug 5ec48f72e0 fix changing gamma absolutely trashing performance
not quite sure why it made stuff die so much but uhhh
instead i just check in the cube initialistion function instead and only let it build when needed to not change how the game looks with raised gamma values
2024-12-15 22:14:57 +01:00
Alug 909307f5ce only check if polyobjcst are on the map 2024-12-14 22:50:11 +01:00
Alug 7c7582f09b forgor about cameracheckposition 2024-12-14 22:50:07 +01:00
Alug 6f6dff4897 only check for polyobjects in the blockmap if there even are polyobjects
this saves the trouble of iterating through the blockmap every single time P_CheckPosition is called if there are no polyobjects present on the map
2024-12-14 22:50:04 +01:00
Alug 8611e70ba3 smol calc optimization P_Checkposition 2024-12-14 22:50:00 +01:00
Alug 7edce19c9c add P_CheckPositionShadow just for shadow mobjs
its basically just R_GetShadowZ from the render based shadows from srb2 lmao
hope this is synchsafe
2024-12-14 22:49:57 +01:00
Alug de52b1663d Merge branch 'Saturn-Next' into checkposopti 2024-12-14 22:49:50 +01:00
Alug 7a1c6bd9e4 slight cleanup K_GetScreenCoords and related functions
mostly just reducing scope and adding const clarifyier
also use mobjwasremoved checks everywhere instead of just simple null checks for some safety
2024-12-14 21:20:03 +01:00
Alug d8fe3920b1 fix papersprite lightlevels again kek + remove shit that does nothing 2024-12-14 17:14:20 +01:00
Alug 75af036fcf seems like you CANNOT apply dispoffset to papersprites
well then
2024-12-14 16:53:34 +01:00
Alug accc9890df fix inverted papersprite roll
oopsie
2024-12-14 16:53:31 +01:00
Alug a920556feb fix papersprite directional light
uhhh idk??
also passes papersprite bool directly instead of rechecking every frame for it
2024-12-14 16:53:23 +01:00
Alug 351cb4a1ac Merge branch 'Saturn-Next' into directionallight 2024-12-14 16:53:20 +01:00
indev cb97973b1c Merge pull request #150 from utkumaden/Saturn
Fixed gr_glinfo crash when there are way too many extensions present.
2024-12-12 19:21:15 +03:00
themixedupstuff 331f09cdd9 Fixed gr_glinfo crash when there are way too many extensions present. 2024-12-12 19:17:04 +03:00
indev 939084d57b Avoid overflowing CONS_Printf's buffer by using vsnprintf 2024-12-12 18:47:35 +03:00
indev 1cbfc71fc6 Revert "Change gl_extension to use glGetStringi instead of glGetString"
This reverts commit 7b550200f0.

Not supported on opengl version before 3.0 unfortunately
2024-12-12 18:03:16 +03:00
indev 7b550200f0 Change gl_extension to use glGetStringi instead of glGetString 2024-12-12 17:52:36 +03:00
indev 665a11fa2b Merge branch 'Saturn-Next' into refactorogl 2024-12-12 14:38:59 +03:00
indev 1a49b161cc Merge pull request #146 from utkumaden/Saturn
Add gr_glinfo.
2024-12-12 14:34:32 +03:00
Alug 99e4870a52 check for the flag first 2024-12-12 02:31:44 +01:00
Alug 13ad27bc90 remove some precip code dupe 2024-12-12 00:30:54 +01:00
Alug 7ae361cb7c better cv_lessprecip handling
idk what i was thinking lmao
2024-12-12 00:11:50 +01:00
Alug 0e1bfbb0b5 clean up hw_cache stuff + fix accidental wrong cast 2024-12-11 23:24:00 +01:00
Alug 3dec352245 smol cleanup GL_SetBlend
use early return since i likeit more
2024-12-11 22:14:20 +01:00
Alug 8e273a1f19 GL_UpdateTexture can be static 2024-12-11 22:14:17 +01:00
Alug 1ab20814e9 simplify GL_SetPalette
can just copy the whole struct
2024-12-11 14:39:38 +01:00
Alug 37649a0d3c more cleanup GL_UpdateTexture
also some optimizations
2024-12-11 14:23:51 +01:00
Alug f3d1bf1106 clean up GL_UpdateTexture
use switches and reduce code dupe
2024-12-11 14:23:48 +01:00
Alug 93311c628e Merge branch 'Saturn-Next' into refactorogl 2024-12-11 14:23:42 +01:00
Alug f8dfc954a0 test "or" 2024-12-11 03:11:33 +01:00
Alug dbe5f8a4ba clamp splitsprite heights aswell 2024-12-11 01:26:04 +01:00
Alug a05c38b1fe those should better be clamped oops 2024-12-11 01:25:55 +01:00
Alug 91b6143f15 clean up this stuff; make splitwall behave more like vanilla
changes some splitwall issues slightly but gives bit better performance in some cases
2024-12-11 01:25:52 +01:00
Alug 0eaedd4b5e "extra safety" 2024-12-11 01:25:42 +01:00
Alug 727a31fdb5 one line those 2024-12-10 21:18:20 +01:00
Alug 3b64263dc6 Unconditionally interpolate view
even if it may NOT change
but i get the feeling it may cause some issues
2024-12-10 21:18:17 +01:00
Alug 83b6a63f13 dont pass fwrapv to compiler flags
this technically changes behavior of some things, even if it MAY fix some undefined behaviour
2024-12-10 21:18:14 +01:00
Alug f6f6600118 interp.subsector is unused
so dont need to assign it nor call pointinsubsector for nothing
2024-12-09 23:20:07 +01:00
themixedupstuff 04c0bf2f17 Fix compiler warning on implicit GLuint* to GLint* conversion. 2024-12-09 17:30:04 +03:00
Alug 4da9c5ac07 "P_CheckSightFast" for lua
should be faster than normal P_CheckSight
only to be used for things like nametags etc so nothing gameplaywise as it will desynch
2024-12-09 10:53:11 +01:00
Alug 97cae4de59 smol things 2024-12-09 10:53:08 +01:00
Alug 9d1bef9ab9 i love menus 2024-12-09 10:19:32 +01:00
Alug 74088c1d26 use loop instead of memcpy for setpalette
idk last time this died with models for some reason kek
2024-12-08 15:43:46 +01:00
Alug b03e74c366 rename to "hw_gl" 2024-12-08 15:39:52 +01:00
Alug cd9ee7d139 smol cleanup 2024-12-08 15:31:41 +01:00
Alug 3080f2953d optimized checksight for nametags and camera
idk should this be exposed to lua too?
2024-12-08 15:26:40 +01:00
Alug f7c7dae3a5 smol cleanup p_sight 2024-12-08 15:14:04 +01:00
Alug 3f16f42adf forgor 2024-12-08 05:03:36 +01:00
Alug feeb2d0f1a use early return
no need to check for all this crap if we can use it anyways
2024-12-08 04:39:12 +01:00
Alug 4c680808c1 dont always call R_PointInSubsector if thing has not moved
R_PointInSubsector is quite expensive
needs alot of testing
2024-12-08 04:22:03 +01:00
Alug 13a5909c3f oop 2024-12-08 04:13:16 +01:00
Alug 40be4d25a5 menu oopsie 2024-12-08 04:07:05 +01:00
Alug d84f887be8 clear maplight on toggling
so you only have to wait until nextmap for effect to do smth instead of game restart
2024-12-08 04:07:03 +01:00
Alug 7b2e763d07 inline those two
smol speedup
2024-12-08 03:34:19 +01:00
Alug bc29d77aff menu entry 2024-12-08 03:31:53 +01:00
Alug 8db2e646db oop 2024-12-08 03:28:44 +01:00
Alug 3b2e207b6b make random directionallight toggable 2024-12-08 03:27:45 +01:00
Alug f061d66a16 conflict fix 2024-12-08 03:24:58 +01:00
Alug 8c295e8d5f port rr´s directional light 2024-12-08 03:22:34 +01:00
Alug c1b771fdc8 fix make files 2024-12-08 03:16:13 +01:00
Alug e5b12ece35 change this 2024-12-08 03:15:14 +01:00
Alug 43c99f8851 delet this 2024-12-08 03:13:50 +01:00
Alug 7304988071 fix conflitc 2024-12-08 03:12:48 +01:00
Alug d0b0a7490a Merge branch 'Saturn-Next' into refactorogl 2024-12-08 03:06:26 +01:00
Alug de4bcec782 make those less chaotic 2024-12-08 01:34:16 +01:00
Alug 0e843c2a96 stuff 2024-12-08 01:33:53 +01:00
Alug 9abd34baa3 proper macros 2024-12-08 01:33:44 +01:00
Alug 4fca31049f no need to set all that stuff manually 2024-12-07 12:52:09 +01:00
Alug 13f6b62dc0 port updated skydome code from srb2
seems to actually fix some visual issues on certain maps with it
2024-12-07 12:38:53 +01:00
Alug 3a5b282b9b try less maths for projectionmatrix
from dsdadoom again lul
2024-12-07 12:33:13 +01:00
themixedupstuff d763456655 Add gr_glinfo. 2024-12-05 22:38:47 +03:00
themixedupstuff b23fa084f1 Add GL_VENDOR string to the list of global GL variables. 2024-12-05 21:54:31 +03:00
Alug 216acf083a bruh 2024-12-05 14:30:19 +01:00
Alug 686a9f7237 use long M_PI to fix some render issues 2024-12-05 14:30:16 +01:00
Alug 5a206822c5 little extra safety 2024-12-05 08:10:13 +01:00
Alug 9805b03533 reduce the scope of those
only this function needs those
2024-12-05 08:08:00 +01:00
Alug d519f9cf06 try fix keepmusic occasionally not working
idk but sometimes DoReborn broke it?
also this ensures keepmusic and skipintromus flags always get reset
2024-12-05 07:58:20 +01:00
Alug 6265d0e38e why does this need a variable?
it just gets assigned kartstuff[k_aizdriftstrat] anyways?
2024-12-04 14:23:06 +01:00
Alug 55d9d64910 clean up this mess 2024-12-04 14:23:03 +01:00
Alug e2a651e553 make those const 2024-12-04 14:23:00 +01:00
Alug e4343f0935 only ever call pointtoangle for sprites that really need it 2024-12-04 01:39:17 +01:00
Alug 68090a55e1 change this a little 2024-12-03 21:50:45 +01:00
Alug 00bdd684ed 1463 lmao change this to be readable
also raise to 40 secs
2024-12-03 20:52:02 +01:00
Alug f4e498e559 this may be used unitialised lul 2024-12-03 20:40:05 +01:00
Alug 39c33b1f59 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Next 2024-12-03 20:39:54 +01:00
Alug 55acbb208e try to make demo data handling a bit safer
- Use Z_Malloc to allocate demobuffer
- Use Z_Free to free demobuffer
- Make functions for freeing and resseting demobuffer
- Always reset demobuffer when not saving
2024-12-03 20:39:46 +01:00
indev 208f96535e Add MENUCAPS to some menu options 2024-12-03 22:06:35 +03:00
Alug 64bda53a78 Merge pull request #144 from Indev450/mobjcache2
Cache and reuse removed mobjs when spawning mobjs - Take 2
2024-12-02 21:31:25 +01:00
Alug e016777331 Merge pull request #145 from Indev450/hooklibrefactor
Lua Hooklib refactor
2024-12-02 21:31:16 +01:00
Alug 508cab4a0d Merge pull request #142 from Indev450/fastpoinonside
Add R_PointOnSideFast and R_PointInSubsectorFast and use it to optimize some non synch critical things
2024-12-02 21:13:07 +01:00
Alug b779be3574 Merge branch 'Saturn-Next' into hooklibrefactor 2024-12-02 21:12:16 +01:00
Alug fddcebc2d2 Merge branch 'fastpoinonside' into mobjcache2 2024-12-02 21:11:18 +01:00
Alug 91c5dc3c19 Merge branch 'Saturn-Next' into fastpoinonside 2024-12-02 21:11:10 +01:00
Alug 9401eb1591 oops revert this just in case 2024-12-02 21:09:58 +01:00
Alug 521bb88cda gah 2024-12-02 20:58:01 +01:00
Alug c1765258b2 quickncasehash 2024-12-02 20:57:08 +01:00
Alug 6afcb06e08 forgor
- refactored musicdef handling
- other things
2024-12-02 20:56:21 +01:00
Alug 1ae5bb9d27 lugstuff merge
- Completely refactor player camera handling
- Refactor ALOT of gamepad code
- Refactor local cmds
- Refactor automap and add minimap generator ("minigen" command)
- Remove a bunch of unused netcode
- Remove ALOT of unused gametype code
- Remove alot of unused bot code
- Optimize some sectorspecial code slightly
- Remove a bunch of nights mode related stuff that was unused
- Bunch of smaller optimizations and code improvements
2024-12-02 20:49:53 +01:00
Alug 252cd5cde5 better fix for netgame join hoop crash
this actually works and makes em animate
apparently somehow on netjoin some hprev entries get mangled but are not null?
no clue why that happens since hoops arent even netsynched only their "spawnpoint" is
2024-12-01 22:14:24 +01:00
Alug 12558740a4 better fix for G_FixCamera
completely forgor in kart and srb2.1 cmd.angleturn needs to be bitshifted to accomidate localangle
using it again is better, since player mobj angle is not always suitable for localangle and may slightly mismatch where a player is steering
2024-12-01 10:29:06 +01:00
Alug e1fbe8d657 seems like player not always have mobjs
titledemo moment
2024-12-01 10:18:18 +01:00
Alug b29a3ecfba this only ever applies to ogl
no need in software lol
2024-11-30 23:39:18 +01:00
Alug bd3a5ac284 give those better names 2024-11-30 23:23:05 +01:00
Alug 7de8b2d881 save one R_PointToAngle call
very smol optimisation lul
2024-11-30 22:31:45 +01:00
Alug 3139dff6ba missed this 2024-11-30 22:04:56 +01:00
Alug c4211045f2 oops this gets directly called in one instance
also why do we keep checking for null mobj when P_MobjWasRemoved checks that anyways?
2024-11-30 21:59:56 +01:00
Alug 6633dfe1e2 smol cleanup 2024-11-30 21:54:55 +01:00
Alug 9e2a48cae1 whoops 2024-11-30 21:54:52 +01:00
Alug 43f8a0213a sloperoll already has "off" setting, delet spriteroll cvar since redundant 2024-11-30 21:54:48 +01:00
Alug 975978ca9c this is null anyways if disabled 2024-11-30 21:54:45 +01:00
Alug dad630f3eb delet this 2024-11-30 20:29:08 +01:00
Alug 11f8b974df forgor sliptide roll 2024-11-30 20:28:26 +01:00
Alug 00773a0c10 okay? shut up compiler 2024-11-30 20:09:12 +01:00
Alug 6f6066906e optimize sprite rotation / sprite drawing a bit
- make software and ogl use same variable names
- let papersprites also roll in ogl not just software
- throw pitchnroll calc into a function to reduce code dupe
- save some calcs when having sliptide roll disabled
- fix software not calculating camang when just player roll is enabled (did that ever work right before? oops)
- determine early if the sprite is supposed to rotate, and only if it really does, run the rotation stuff
2024-11-30 20:05:15 +01:00
Alug 7730b69ef4 delete A_RollAngle things
they cant be used, since theyre not synchsafe
and nothing uses those anyways
2024-11-30 20:05:13 +01:00
Alug e3084cc28e allow demo play commands while watching a demo again 2024-11-29 23:25:58 +01:00
Alug b784fc58d0 loading not sending
just to clarify
2024-11-29 22:25:13 +01:00
Alug 8baa972bb2 this is also redundant 2024-11-29 13:15:59 +01:00
Alug 3b2251017c use continue instead of huge if block 2024-11-29 12:14:28 +01:00
Alug f0e7dace72 Merge branch 'Saturn-Next' into mobjcache2 2024-11-29 11:34:03 +01:00
Alug 4a837d3339 Fix buffer overrun with players with no associated node
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/810/diffs?commit_id=af9164f336a65634f6908e677b47773d88f583af
2024-11-29 10:41:00 +01:00
Alug a2aa43e7fc dont think we need to reset anything here
kick cmd gets send out which should clear stuff in theory
2024-11-29 10:40:09 +01:00
Alug 3c0899263f those are redundant 2024-11-29 10:14:47 +01:00
Alug 91bb601ecb why? 2024-11-29 10:14:43 +01:00
Alug 1bd0c5d9bf those dont need to be inlined tbh 2024-11-29 09:37:13 +01:00
Alug 8b76426825 remove dupes 2024-11-29 09:37:10 +01:00
Alug 85464921ba eh this looks better 2024-11-29 09:37:07 +01:00
indev 9b6034853f Simplify consistency check a bit 2024-11-28 22:24:51 +03:00
indev 0ab732c9b2 Only check nodes that are in game in SV_ResendingSavegameToAnyone 2024-11-28 22:03:29 +03:00
Alug 8662648ef5 init polyobject thinker->references to 0
otherwise they wont get removed alot of the time
2024-11-27 23:00:32 +01:00
Alug 51808b8ced init polyobject thinker->references to 0
otherwise they wont get removed alot of the time
2024-11-27 23:00:16 +01:00
indev 2a7e442544 Use textinput_t for addon search 2024-11-28 00:54:26 +03:00
Alug dbdd5b8b6e only apply palrender postprocess shader once 2024-11-27 22:34:48 +01:00
Alug b8483376c4 dont draw final screen texture twice if you use native res
no need to
saves some performance
2024-11-27 22:29:49 +01:00
Alug 70105ccefc make own screentex for vhs effect
idk if its really needed tbh, but also doesent hurt
2024-11-27 17:12:25 +01:00
Alug 3a9082a694 memset screentex to 0 in FlushScreenTextures 2024-11-27 17:10:56 +01:00
Alug 82c18be717 why do replay play commands only have netgame check???????
bad things will happen if theyre played ingame regardless of netgame or not
2024-11-27 00:36:29 +01:00
Alug 0d39c2a0f6 we dont even need to check this
this doesent do anything with papersprites so dont even call it kek
2024-11-26 22:30:38 +01:00
Alug 4240af23cf Merge remote-tracking branch 'origin/cleanspriteclip' into Saturn-Next 2024-11-26 22:25:00 +01:00
Alug 80697046d5 clean up spriteclip fix + fix papersprites being affected by it
its now its own function HWR_ApplyDispoffset
papersprites are now also unaffected by it, which caused some minor visual issues before (ex zfighting signposts)
also just check for papersprite once and put it into a bool so we dont have to recheck sprite frames and flags 10 times
2024-11-26 20:31:20 +01:00
Alug 765dd72b38 Merge branch 'Saturn-Next' into fastpoinonside 2024-11-26 19:31:59 +01:00
Alug 403b60240f check for titlescreen music 2024-11-26 19:25:59 +01:00
Alug f973e6cd72 init polyobj thinker cachable bool
otherwise shit will die lol
2024-11-26 19:18:38 +01:00
Alug 5aff1acea8 mobjcache with explicit "true" check
just in case smth throws a garbo value and is not actually a mobj thinker
2024-11-26 19:18:34 +01:00
Alug 9e07ca0007 make hud hooks clean up after themselves 2024-11-22 16:04:16 +01:00
Alug df97bef4b5 Refactor HUD hooks too 2024-11-22 00:40:05 +01:00
indev b402738428 Fix mobj hooks called for mobj type 0 being interpreted as regular hooks 2024-11-22 01:31:02 +03:00
Alug 2de9a6bb94 forgor to remove those 2024-11-21 22:08:50 +01:00
Alug fb0c88cf55 Fix -Warray-bounds warning in lua_hooklib.c 2024-11-21 20:34:09 +01:00
Alug 1f6096e3ff fix pre and post thinkframe perfstats pages 2024-11-21 20:34:06 +01:00
Alug a4e6b5d177 Fix HurtMsg inflictor mobj type discriminator
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1903
2024-11-21 20:34:03 +01:00
Alug 4477f5ab93 Fix MusicChange hook crashing when called 2024-11-21 20:34:01 +01:00
Alug 11992d2e08 MORE MACROS 2024-11-21 20:33:58 +01:00
Alug 802979b81d Refactor hook ref allocation 2024-11-21 20:33:55 +01:00
Alug 06d0f5b95b Automatically count hook values 2024-11-21 20:33:52 +01:00
Alug da06c84aa4 we dont have key event hooks 2024-11-21 20:33:49 +01:00
Alug ecae607b59 this is unused for now 2024-11-21 20:33:46 +01:00
Alug f26717954e change those to fit rest of style 2024-11-21 20:33:44 +01:00
Alug a4080980ec make intermissionthinker use LUA_HookVoid
comment out hookbool since unused
2024-11-21 20:33:41 +01:00
indev 3db21bf778 Fix warning regarding MusicChange hook 2024-11-21 20:33:38 +01:00
indev 66518ced75 Add Should- and Player- Spin/Explode/Squish, and ServerJoin hooks into new hook system 2024-11-21 20:33:36 +01:00
Alug 5598526f52 delet serverjoin stuff i forgor and add old should spin stuff 2024-11-21 20:33:32 +01:00
Alug 14ec6e0674 serverjoin hook 2024-11-21 20:33:29 +01:00
Alug 549112822a port srb2 hooklib refactor (WIP)
lol lmao
2024-11-21 20:33:06 +01:00
indev e1cb858d9a Players that get 'NO CONTEST' can save replays too now 2024-11-21 22:02:25 +03:00
Alug 1659c2e753 try to make shadows not so offset on slopes with rotation enabled
lmaos
2024-11-21 02:11:51 +01:00
Alug e2222f66a9 those should be SHORT i think? 2024-11-21 02:11:48 +01:00
Alug 8a15b5e640 last attempt at fixing those things 2024-11-20 23:44:35 +01:00
Alug f499b11113 add R_PointInSubsectorFast for non critical gameplay stuff like sounds and camera
and some parts of rendering
2024-11-20 21:27:29 +01:00
Alug bec632800d use it for R_IsPointInSubsector
this is fine since R_IsPointInSubsector is only used for precip spawn unless you disable noclipcam lol
2024-11-20 21:26:18 +01:00
Alug a14c2f59b8 rename to R_PointOnSideFast 2024-11-20 21:25:18 +01:00
Alug e66d215dd3 Fix integer overflows on very large numbers 2024-11-20 21:24:16 +01:00
Alug 809ae20558 use highly optmized (but slightly inaccurate) version of R_PointOnSide for rendering 2024-11-20 21:24:04 +01:00
Alug 7b26ecb5f5 fixed float to integer conversion problems
from dsda doom
should hopefully make this behave the same everywhere
2024-11-19 22:10:08 +01:00
Alug 0c2ccc56cd inline _GetZAt stuff
those are very small but frequently used, so cant hurt
2024-11-17 21:42:20 +01:00
Alug 525681b5a5 Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Next 2024-11-17 21:41:33 +01:00
Alug c9a3dfcac9 reset pingtable in SV_ResetServer
and use some memsets cause they look cooler
also use ClearAdminPlayers simply to make this consistent with the other stuff that resets adminplayers
2024-11-17 21:41:25 +01:00
Alug a05aab1c7b Merge pull request #141 from Indev450/interpfixes
Some interpolation related fixes
2024-11-17 21:25:42 +01:00
Alug 7dfc638305 make replay/time attack menu support lowercase if toggled, also levelselect addon names too 2024-11-17 14:41:49 +01:00
Alug 3585969285 why is that declared here?? 2024-11-17 13:30:37 +01:00
Alug 3361ebe3c5 make menucaps stuff global macro and also apply to downloader text 2024-11-17 13:03:32 +01:00
Alug ebfd7f3e4e try make this look less like crap lol 2024-11-17 13:03:18 +01:00
Alug e2c8a773be prevent some palrender startup crashes
thx srb2 apparently this can be null during init so add some extra safety
2024-11-12 16:23:08 +01:00
Alug 6816c6dd19 add some paranthesis here 2024-11-12 15:44:29 +01:00
Alug b9e26a7e2f Merge branch 'Saturn-Next' into interpfixes 2024-11-12 15:44:16 +01:00
indev 38abb4c9e4 That didn't work in spectator camera, oops 2024-11-10 03:26:15 +03:00
indev fc469d6433 Fix spectating other players setting wrong angle when returning back to local player 2024-11-10 03:18:01 +03:00
Alug 52f1d727c0 Merge branch 'Saturn-Next' into interpfixes 2024-11-09 16:11:08 +01:00
indev 80a29dc5a1 Fix r_portal.c and r_portal.h missing from src/CMakeLists.txt 2024-11-08 11:52:03 +03:00
indev f4703be2ca Fix r_portal.c and r_portal.h missing from src/CMakeLists.txt 2024-11-08 11:47:58 +03:00
Alug 7c78cf067c forgor ifdef here 2024-11-03 15:35:03 +01:00
Alug 54cbfbe699 forgor ifdef here 2024-11-03 15:33:26 +01:00
Alug 05f454157f Merge pull request #138 from Indev450/Saturn-Next
Saturn v7.2
2024-11-03 16:24:00 +01:00
Alug c451f0f1a6 windoze 2024-11-03 14:23:26 +01:00
Alug 35b85bec36 bleh pls 2024-11-03 14:18:59 +01:00
Alug b0c64be31d try to simplify this alteast a little
shit is awful
2024-11-03 03:40:55 +01:00
Alug d09a28e3da missed this 2024-11-03 03:13:15 +01:00
Alug 550c66b25b add some more checks for this 2024-11-03 02:59:23 +01:00
Alug dfec9e24f3 add just a little more extra safety for fbo 2024-11-03 02:44:42 +01:00
indev 2350889445 Fix normal skin being unable to load if localskins limit is reached (thx Alug for pointing out <3) 2024-11-03 00:26:18 +03:00
indev 990854e176 Fix localskins being unable to load if normal skin limit is reached 2024-11-03 00:16:15 +03:00
Alug 8c727b979c initialise this to null aswell
just in case
2024-11-02 14:19:53 +01:00
Alug 60de48ad65 add accurate fps counter crap to menu + rename it to force it back on
since shit more or less was broken in saturn before and always showed the more accurate one, force it again since stuff caused confusion
2024-11-02 12:57:17 +01:00
Alug 2fd1abce5c v7.2 2024-11-02 01:20:02 +01:00
Alug 691a61de72 oops 2024-11-02 01:12:56 +01:00
Alug 3a153c3abe Merge pull request #137 from Indev450/refactorogl
Cleanup and slightly refactor ogl files
2024-11-02 00:57:49 +01:00
Alug d22645e56a use a "-" here for consistancy 2024-11-02 00:50:28 +01:00
Alug 08fe3beef1 respect cv_showdirectorhud 2024-11-02 00:49:35 +01:00
Alug 2c54c92e14 spec cam disables director, but you can toggle it from speccam
uhhhhhhh
2024-11-02 00:49:32 +01:00
Alug c127cd9016 fix wanted reticle offsets
Zzz...
2024-11-01 20:29:33 +01:00
Alug 9cb790ac23 oops broke encore 2024-11-01 20:01:50 +01:00
Alug c2c7381bc1 use precalced minimap stuff for v.drawOnMinimap 2024-11-01 19:55:23 +01:00
Alug 1e4eeb2bcf fix some issues with cv_minihead and minimap icon drawing 2024-11-01 19:55:20 +01:00
Alug b1f99f8d2f fix minimap not being initialised
causes issues when you switch to maps that dont have a minimap
2024-11-01 18:39:36 +01:00
Alug f752da7d03 formatting stuff lul 2024-10-31 12:02:48 +01:00
Alug 7ddcf6d0d4 Merge branch 'Saturn-Next' into refactorogl 2024-10-31 11:59:33 +01:00
indev b21776183e Add shift+insert shortcut for pasting text 2024-10-30 22:14:17 +03:00
indev 9c0dcac5c6 Fix mapmusname global in lua being renamed to (*mapmusname) 2024-10-30 19:21:07 +01:00
indev 1b75d8b8e2 Fix mapmusname global in lua being renamed to (*mapmusname) 2024-10-30 20:35:17 +03:00
Alug 145e305494 Merge branch 'Saturn-Next' into refactorogl 2024-10-30 16:04:06 +01:00
Alug 8f4d185ea6 Revert "use highly optmized (but slightly inaccurate) version of R_PointOnSide for rendering"
This reverts commit 9314a24cb2.
2024-10-30 16:03:35 +01:00
Alug 4b5ff6be5d Merge branch 'Saturn-Next' into refactorogl 2024-10-30 15:34:43 +01:00
Alug d27ef85b9e remove some unused stuff in portal struct 2024-10-30 13:52:06 +01:00
Alug 1ac210c2fc improve ogl portal clipping 2024-10-30 13:05:30 +01:00
Alug 878b7f4b43 fix portal culling 2024-10-28 20:25:03 +01:00
Alug 7cbac66935 throw this into an inline func 2024-10-28 20:25:01 +01:00
Alug 7e09223e6e gu 2024-10-28 16:36:04 +01:00
Alug b4e1be5bee dont always call HWR_Startup again 2024-10-28 16:35:44 +01:00
Alug d3e5e236ac those do nothing 2024-10-28 16:34:40 +01:00
Alug 238ce98c44 dont always call HWR_Startup again 2024-10-28 07:21:13 +01:00
Alug 2824e5d850 no need to update this witouth water ripples 2024-10-28 06:49:09 +01:00
Alug cd154d5748 grey out some stuffs in the ogl and advanced video menus 2024-10-28 06:40:23 +01:00
Alug c0a8153a10 sort those a bit 2024-10-28 06:40:19 +01:00
Alug 3433fc7651 those should be disabled 2024-10-28 06:40:17 +01:00
Alug 22d1ee8f60 move CV_PossibleValue_t to their own section like other files 2024-10-28 06:40:14 +01:00
Alug 5155958ade add "gl" to secbright and lightdither cvars
theyre only used in ogl so follow the naming convention
2024-10-28 05:40:59 +01:00
Alug 5fdd486bab reorder all of this to be in same order lol 2024-10-28 05:40:56 +01:00
Alug 4672037bcd check if those are already off before trying to turn them off lol 2024-10-28 05:40:54 +01:00
Alug 2281b82b5a replace last remaining "gr" 2024-10-28 04:28:25 +01:00
Alug 3fe096c7d4 gr -> gl
this has been annoying me since ages lol
2024-10-28 04:23:15 +01:00
Alug dd3ca0e161 change cvar register order for ogl stuff 2024-10-28 03:39:05 +01:00
Alug d8da78f900 more cleanup 2024-10-28 03:38:52 +01:00
Alug 9325e7be8f make a bunch of hwr stuff static and cleanup 2024-10-28 03:38:48 +01:00
Alug f3f94bf80e fr*nch 2024-10-28 03:38:36 +01:00
Alug 506dc2455a fr*nch 2024-10-26 23:24:01 +02:00
Alug 94d6ee15b5 this should be portalcullsector lol 2024-10-26 19:44:32 +02:00
Alug 2d918d32a1 reduce the scope of this since not needed 2024-10-26 19:44:28 +02:00
Alug dd516b573b rename this to avoid confusion 2024-10-26 19:31:14 +02:00
Alug de9698efc8 just use the same as software lol
i never saw any differernce except in performance for this
also viewsin and viewcos get calced in r_fps so no need to do here again
2024-10-26 19:29:53 +02:00
Alug 14b026f04b slight cleanup ogl portals again 2024-10-26 19:29:51 +02:00
Alug 9dd45440c0 rename and slight cleanup 2024-10-26 19:29:46 +02:00
Alug c59e8387ca smth smth shadows a global declaration 2024-10-26 19:29:35 +02:00
Alug 772ad9f04f throw ogl portals into their own files 2024-10-26 19:29:32 +02:00
Alug 6053c2c619 readd mobj null check here 2024-10-26 16:40:08 +02:00
Alug a515b133c5 inline this since its super smol 2024-10-26 16:40:04 +02:00
Alug 240dae9a1a move chasecam postimg stuff into own function + add comments for what stuff does lol
shit got me really confused
2024-10-26 16:12:43 +02:00
Alug b8a703233a forgor to remove this 2024-10-26 00:51:58 +02:00
Alug bf44c95d00 clean up portals 2024-10-26 00:51:55 +02:00
Alug c3dd1755dc port srb2 software portal refactor 2024-10-26 00:51:44 +02:00
indev b6e766ee44 Fix A_Lua not removing error handler from lua stack 2024-10-25 23:15:52 +03:00
Alug 5437040b78 move the return ealier in V_DoPostProcessor 2024-10-25 20:21:10 +02:00
Alug c786569981 Merge branch 'refactorpostimg' into Saturn-Next 2024-10-25 20:12:56 +02:00
Alug 7064b14539 Merge branch 'autoloadagain' into Saturn-Next 2024-10-25 20:12:53 +02:00
Alug f275ae98f5 this is needed for postimg stuff in first person
lol
also adds break in splitscreen lööp
2024-10-25 20:12:14 +02:00
Alug ef07d89e29 Revert "update lzf compression to 1.6"
This reverts commit 48e71afec1.
2024-10-25 19:50:16 +02:00
Alug b9bbd45e15 Revert "shut up mingw"
This reverts commit 75637e361c.
2024-10-25 19:50:10 +02:00
Alug 2bda27b80d Revert "those should be size_t"
This reverts commit b357c09171.
2024-10-25 19:49:26 +02:00
Alug 6ebf90cc50 Merge branch 'Saturn-Next' into autoloadagain 2024-10-25 03:28:43 +02:00
Alug ea00bebb04 Merge branch 'Saturn-Next' into refactorpostimg 2024-10-25 03:28:20 +02:00
Alug b862d835a5 save one calc lol 2024-10-25 03:27:51 +02:00
Alug d6602747ae oops forgor lol 2024-10-25 03:26:22 +02:00
Alug 9f79429d03 slight cleanup + make static + smol optimize ogl sprite drawers 2024-10-25 03:26:19 +02:00
Alug 5ff0c09868 just check for noencore bool in hwr_processseg instead of checked line flags everytime 2024-10-23 21:33:31 +02:00
Alug ad1c3e63a4 why not reuse those? 2024-10-23 21:33:28 +02:00
Alug 24dd6ba675 cleanup HWR_ProcessSeg
stuff was quite the mess
2024-10-23 21:33:21 +02:00
Alug 85f036a45b dont always calc this twice 2024-10-23 21:33:14 +02:00
Alug 6f8342b9a8 remove cv_splitwallfix
tbh i dont think anyone even knows about this, never heard any complains, never had any issues, neither visually or performancewise.
its just clutter at this point
2024-10-23 21:33:04 +02:00
Alug c5c6f6b820 this does nothing 2024-10-23 21:30:21 +02:00
Alug 3d472c34a1 no need to check stuff in already postload marked addons 2024-10-23 15:48:44 +02:00
Alug 63ca366bd8 dont play rain sounds when weather is disabled 2024-10-23 13:00:36 +02:00
Alug e9e888ab7f remove debug print 2024-10-23 02:41:28 +02:00
indev 5ea55b3e3a Add W_CheckFileContains for W_CheckPostLoadList 2024-10-23 02:41:25 +02:00
Alug 8b1797927a attempt to check for things in file for postload detection 2024-10-23 02:41:23 +02:00
Alug 05a98964fb split auto and postload, let autoload run on gamestart again
prep for smth
2024-10-23 02:41:20 +02:00
Alug 8cbf798de8 redo rain sound overflow fix
https://git.do.srb2.org/KartKrew/RingRacers/-/commit/3eac1fed0f44a8285a9f6b82a12e86997bbb0d34
2024-10-23 02:37:32 +02:00
Alug 9314a24cb2 use highly optmized (but slightly inaccurate) version of R_PointOnSide for rendering 2024-10-23 02:37:08 +02:00
Alug 19b1683e61 make those not look terrible thx 2024-10-22 01:18:13 +02:00
Alug d029107e75 refactor postimg stuff so it can be combined with each other better
thx much indev! <3
everything now works with encore!
software now also supports screen effects in splitscreen!
2024-10-22 01:17:57 +02:00
Alug bc97e0b703 actually remove "renderflags" lol 2024-10-21 22:53:44 +02:00
Alug f47c663f79 remove renderflags
those literally did nothing
2024-10-21 22:47:32 +02:00
Alug 6f9d41eadb fix R_ThingVisible
those are "eflags" in kart smh
2024-10-21 22:46:59 +02:00
Alug 1b512edc56 add proper null check here too 2024-10-21 21:28:08 +02:00
Alug 884a6da2bd dont use cv_sloperolldist in splitscreen + save some assignments and one fixedhypot call
also use tabs lul
2024-10-21 21:07:32 +02:00
Alug 7a3d958fc1 tab pls 2024-10-21 18:43:08 +02:00
Alug 7223581539 Clarify we're calculating a cross product 2024-10-21 18:10:29 +02:00
Alug 664bd2de3f dont draw fadescreen when minimap iss active 2024-10-21 17:47:44 +02:00
indev 63568e3861 Fix off-by-one error for using '?' as map name 2024-10-21 18:43:37 +03:00
indev f149d058a1 Fix off-by-one error in lib_setSfxInfo 2024-10-21 18:06:35 +03:00
Alug 970251ced3 also check here ig? 2024-10-21 17:01:27 +02:00
Alug dba7a7dc3c prevent map command crash from maps with invalid or non existing mapinfo 2024-10-21 15:37:44 +02:00
Alug 393c0be407 Revert "attempt to optimize some p_maputl stuff"
This reverts commit 81d415c5ba.
2024-10-21 14:19:35 +02:00
Alug 5e9ea2429b replace those two P_MobjWasRemoved with simple null check insteead
since those may actually segfault if null anyways
2024-10-21 06:23:14 +02:00
Alug 81a14995da trailing space hell 2024-10-21 06:14:24 +02:00
Alug 4267ac9a8d remove more P_MobjWasRemoved checks
same as before, those may be not synchsafe
2024-10-21 06:04:47 +02:00
Alug bcf72cc0e8 revert some P_MobjWasRemoved checks i forgor about
those may NOT be vanilla netsafe
2024-10-21 06:04:17 +02:00
Alug 54d9a98090 rotsprite stuff also should be SHORT 2024-10-20 19:11:54 +02:00
Alug 86ea7dde40 Merge branch 'Saturn-Next' into unglobsavep 2024-10-20 16:27:26 +02:00
Alug 81d415c5ba attempt to optimize some p_maputl stuff 2024-10-20 16:25:12 +02:00
Alug de1b801bda try to take some registers for span drawers too 2024-10-20 16:24:02 +02:00
Alug 2c665fef6f remove this again 2024-10-20 15:21:42 +02:00
Alug c6fbf405bf optimize R_PointOnSegSide
its only used for 2 rendering functions, so being potentially inaccurate is not that dangerous and the speedup in some instances might be worth the tradeoff
2024-10-20 15:16:37 +02:00
Alug 7076c35521 HWR_RenderPlane can be static 2024-10-20 14:57:28 +02:00
Alug 86ed1b709e fix some rendering issues and crashes in software renderer
- Increase MINZ from 4 fracunits to 16
- R_StoreWallRange: do not render textures with holes
- fix off-by-one error in R_ProjectSprite
- Avoid rendering unused left/right edges of screen while rolling
- Clamp patch column post drawing bounds
- Vissprites: set dc.texheight
- Add null check for column in R_DrawMaskedColumn
2024-10-20 14:57:22 +02:00
Alug 0be25bd362 Merge branch 'Saturn-Next' into Saturn 2024-10-20 14:56:56 +02:00
Alug d30c96e8cb fix a maybe-uninitialized warning 2024-10-20 00:22:06 +02:00
Alug 0af52ba3ae dont need to always check this 16 times if we already know theres more than one player ingame 2024-10-19 21:15:11 +02:00
Alug fbe97556de change versionstring
also remove the fbo one, its honestly not necessary anymore
2024-10-18 20:36:16 +02:00
Alug 7a6f43bece dont show encore toggle text in record attack menu
dont think you can even record attack in encore hmm
2024-10-18 20:34:22 +02:00
Alug afca521fe5 dont run director if theres only one player ingame
idk if this is good lol
2024-10-18 19:53:44 +02:00
Alug d3e2875c94 those can be registered in lööp 2024-10-16 13:14:31 +02:00
Alug 1daac9a124 revert all the cam things for now here
Dont wanna deal with this shit for 7.1 anymore
2024-10-14 22:15:27 +02:00
Alug 38f3e48aed only do this in software renderer
doesent work even with pal rendering in ogl
2024-10-13 23:07:37 +02:00
indev 4cf4d49f48 Fix error handler staying on lua stack after lua commands being called 2024-10-13 15:37:39 +03:00
indev a19c4dc5e5 Fix game crashing when using P_DoPlayerExit on player without mobj 2024-10-13 15:37:39 +03:00
Alug d37505ff06 this should be SHORT 2024-10-13 02:59:10 +02:00
Alug 7f6ce1f299 this uhhh actually makes things crash lol 2024-10-13 02:47:57 +02:00
Alug 262a84aac6 fix ogl shearing
no clue wtf kart was doing here lmao
2024-10-13 02:42:37 +02:00
Alug 3f12ebb2bd only interp cam during pause for replay freecam to not jitter during pause 2024-10-13 01:11:59 +02:00
Alug b58fcf331c ignore keepmusic when called from P_RestoreMusic
most of the sound handling just calls this and this may just stop the music entirely on some occasions so just ignore keepmusic for that
2024-10-13 00:40:51 +02:00
Alug fe51278295 Merge branch 'newmusicstuff' into Saturn-Next 2024-10-13 00:04:59 +02:00
Alug c3fb84981e Merge branch 'pakcheck' into Saturn-Next 2024-10-13 00:02:32 +02:00
Alug 919aad4f30 Merge branch 'vres-skip-map-marker' into Saturn-Next 2024-10-12 23:57:27 +02:00
Alug 818e6046b7 Merge branch 'Saturn-Next' into vres-skip-map-marker 2024-10-12 23:30:03 +02:00
Alug f01d2a0ba6 print saturnpak print into debfile instead of console 2024-10-12 23:29:11 +02:00
Alug 8df0a2d059 Merge branch 'Saturn-Next' into pakcheck 2024-10-12 23:28:05 +02:00
Alug d7ed91af1d Refactor TTY input handling
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2451#b2f76b3273f1780347c35ec752bcde560c5f73a5
2024-10-12 23:26:14 +02:00
Alug 081dcc021b fix tty converting everything to lowercase 2024-10-12 23:21:11 +02:00
Alug 70ebd0d475 Merge remote-tracking branch 'origin/unified-text-input' into Saturn-Next 2024-10-12 23:19:38 +02:00
Alug 02bbb38606 Fix insane TTY input latency
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2360
2024-10-12 23:16:42 +02:00
indev d00014ea59 If corrupted save received, leave netgame 2024-10-12 22:10:58 +02:00
indev 210d6ac8ac Add few checks to prevent game crashing if netgame archive becomes corrupted 2024-10-12 22:10:48 +02:00
indev 55248e7fcf Attempt to fix a lua panic when unarchiveing extvars (print error to console instead. Not sure if it would be safe for game to read from save afterwards though) 2024-10-12 22:09:51 +02:00
indev cb94235ac1 If corrupted save received, leave netgame 2024-10-12 22:09:20 +02:00
Alug d0c50c49a7 Add few checks to prevent game crashing if netgame archive becomes corrupted
https://github.com/alufolie91/saturn-32p/commit/1e47728ea8c60a1f04130170ddfab9b02e1a7e4c#diff-0c6396d5a9ad45f461741cd44ffb2c0d3cf0eb2ec7b0500053005196fe53f1a6R1517
2024-10-12 22:09:18 +02:00
Alug 7f1217b2ab Attempt to fix a lua panic when unarchiveing extvars (print error to console instead. Not sure if it would be safe for game to read from save afterwards though)
https://github.com/alufolie91/saturn-32p/commit/a770ecdbd4afd56a9d8325eae47f0c69f71661ee#diff-0c6396d5a9ad45f461741cd44ffb2c0d3cf0eb2ec7b0500053005196fe53f1a6R1462
2024-10-12 22:09:15 +02:00
Alug 3b01393a71 Merge branch 'Saturn-Next' into unglobsavep 2024-10-12 22:08:49 +02:00
Alug 23b36b5074 oops 2024-10-12 21:29:49 +02:00
Alug 2e7f0721b9 make s_sound a little prettier 2024-10-12 21:24:43 +02:00
Alug 4927e55c7e fix some warnings when compiling with older sdl version 2024-10-12 21:24:04 +02:00
Alug c51d33fa6e save 1 G_BuildMapTitle call kek 2024-10-12 20:19:53 +02:00
Alug 8630d8cd47 clean bird music stuff again
we dont need to return everywhere but instead stuff can be mostly just set to 0
this also somewhat ensures stuff works after toggling without having to restart the game or map
2024-10-12 19:55:02 +02:00
Alug 659243baa1 always assign stutter_threshold 2024-10-12 19:44:21 +02:00
Alug b6a84c1646 readd music_resync_powerups_only 2024-10-12 19:40:12 +02:00
Alug c33afa4a3b shut up mingw 2024-10-11 19:09:49 +02:00
Alug 1428c3c2bf fix spec cam bug + more cleanup 2024-10-11 21:00:13 +02:00
Alug aa0cbfda74 Revert "rendertimefrac_unpaused should be fracunit on netlag"
This reverts commit 6722b43244.
2024-10-09 15:33:19 +02:00
Alug 9d13ff3c9f proper inline P_MobjWasRemoved 2024-10-07 23:01:52 +02:00
Alug e47c13b7ac proper inline M_Memcpy 2024-10-07 23:01:45 +02:00
Alug 3f5b96bd45 this shouldnt be here lol 2024-10-07 13:15:08 +02:00
Alug 63c1372c34 keep debug print for now 2024-10-07 12:57:55 +02:00
Alug 8b915f9ac1 make this less ugly 2024-10-07 12:53:31 +02:00
Alug f3a18a0655 false 2024-10-07 12:48:36 +02:00
Alug e8351d44b6 add crap to menu 2024-10-07 12:45:03 +02:00
Alug 297af069cb doubt anyone wants this
also psure this will cause some weird issues somewhere idk
2024-10-07 12:41:59 +02:00
Alug baa5d6630d Merge branch 'Saturn-Next' into newmusicstuff 2024-10-07 12:39:41 +02:00
Alug 0c30730ef6 Merge branch 'Saturn-Next' into pakcheck 2024-10-06 18:52:24 +02:00
Alug ef763487a5 this doesent make much sense tbh 2024-10-06 18:51:43 +02:00
Alug 03f5ac87fa Merge branch 'Saturn-Next' into interpfixes 2024-10-06 18:51:20 +02:00
Alug c82148fafc prevent this from become super large somehow lol
just like cap it at 19 it works just fine
2024-10-06 18:50:32 +02:00
Alug d1346dee53 shouldnt that be a bool? 2024-10-06 18:31:54 +02:00
Alug 6722b43244 rendertimefrac_unpaused should be fracunit on netlag
makes this a little more sane tbh
2024-10-06 18:31:51 +02:00
Alug b2cac97106 fix this 2024-10-06 14:53:25 +02:00
Alug cfdbf1f4ad hopefully fix awayview cam interp crap 2024-10-06 14:53:10 +02:00
Alug 48a00ba911 this needs to be set twice
Zzz...
2024-10-06 14:52:54 +02:00
Alug 4b1102357a only do this in replays
otherwise shit will jitter during netlag
2024-10-06 14:46:11 +02:00
Alug e3b0204b2c fix main menu interpolation
apparently in main menu, opening the menu pauses the game so rendertimefrac was FRACUNIT and didnt interpolate
2024-10-06 14:46:06 +02:00
Alug a2799ddcca Interpolate view, even when paused
https://github.com/KartKrewDev/RingRacers/commit/3320faec8cebecb124882d38c7ec0ad37b79340a#diff-607b68058edc6124b3061267d902aabeddb6ba338c6483df0af8b1a7cf796a01R43
2024-10-06 14:46:03 +02:00
Alug 76198f61de add missing break 2024-10-06 14:45:50 +02:00
Alug c3ce75055a only do this in replays
otherwise shit will jitter during netlag
2024-10-06 14:30:28 +02:00
Alug 90d64c4e15 fix main menu interpolation
apparently in main menu, opening the menu pauses the game so rendertimefrac was FRACUNIT and didnt interpolate
2024-10-06 13:47:20 +02:00
Alug 595648a2b3 Interpolate view, even when paused
https://github.com/KartKrewDev/RingRacers/commit/3320faec8cebecb124882d38c7ec0ad37b79340a#diff-607b68058edc6124b3061267d902aabeddb6ba338c6483df0af8b1a7cf796a01R43
2024-10-06 13:47:17 +02:00
Alug 8e799ddd74 fix a interp bug where the jitter on tally increase would be for only one rendered frame, not one full tic. 2024-10-06 13:47:14 +02:00
Alug a754e9c08a HACK: reset interp values in case 412 teleporter without using P_Setorigin
since that function does some wonky stuff and idk if that would be synch safe
2024-10-06 13:47:11 +02:00
Alug 112c9398e7 add missing break 2024-10-06 13:47:08 +02:00
Alug ccd691548e more R_ResetViewInterpolation stuff 2024-10-06 13:47:05 +02:00
Alug afd7b85005 R_ResetViewInterpolation: wait an extra tic if R_UpdateViewInterpolation has not run yet, do not add extra time for subsequent calls 2024-10-06 13:47:02 +02:00
Alug f9e1cdb940 P_Ticker: update view interpolation at the start of a tic 2024-10-06 13:46:43 +02:00
Alug 63fe657c7d Do not set hu_stopped on interpolated frame 2024-10-06 13:46:31 +02:00
Alug ff2006ad74 smol fix 2024-10-06 12:40:01 +02:00
Alug 55c9c7297f throw this into own function too 2024-10-06 12:39:56 +02:00
Alug 4b083ee72e make function for quakes, scale with mobjscale 2024-10-06 12:39:54 +02:00
Alug 6574ec2fb9 attempt to cleanup R_SetupFrame 2024-10-06 12:39:48 +02:00
Alug f54bb349b5 add G_FixCamera 2024-10-06 12:39:44 +02:00
Alug 6f1252e27d set timeinmap for demo rewind
idk maybe this helps with that feature desynching all the time lol
2024-10-06 12:39:26 +02:00
Alug 7d65b5369f add some brackets lul 2024-10-06 12:34:51 +02:00
Alug 4877c81728 comment this out for now so v7 clients dont use vanilla resynch system
keep sending PT_WILLRESENDGAMESTATE packets to everyone for now
saturnpak will still mark the right clients so they will use the right consistency check without having to desynch first
2024-10-06 12:32:57 +02:00
Alug 5cb207edfa add debfile prints whenever gamestate counter changes 2024-10-06 12:14:32 +02:00
Alug fc39a0dedf make the debug print a little better 2024-10-06 12:12:59 +02:00
Alug 0b3e7240a8 use saturn packet to determine if client can receive gamestate
before the server always assumed every client cant receive the gamestate using the vanilla consistency check for everyone.
aswell as before the first resynch it tried to send the gamestate resend packets to everyone
2024-10-06 12:07:17 +02:00
Alug f32c346534 this needs gamestate check
sometimes the title music kept playing
2024-10-05 06:56:31 +02:00
Alug 3165004d0e add comment to try and explain this crap 2024-10-03 18:15:19 +02:00
Alug ec3b1cf130 make this more readable 2024-10-03 17:55:08 +02:00
Alug a0437713bf smol dupe 2024-10-02 14:40:03 +02:00
Alug 96f7ff550c prevent this from overflowing
ye well idk anymore.
2024-10-02 14:22:48 +02:00
Alug 837216d78e we dont need any of this in ogl 2024-10-02 14:22:39 +02:00
Alug dfb6006f9c fix up old fps counter 2024-10-02 12:14:40 +02:00
indev fb0765a5f3 Fix selection in replay save prompt 2024-10-01 20:55:27 +03:00
indev 2e8769496f Use textinput_t for replay save prompt too 2024-10-01 20:39:04 +03:00
Alug bdb39fcd8d dont leak pls 2024-10-01 17:57:45 +02:00
Alug 31516c7987 fix G_BuildMapTitle leaks 2024-10-01 17:56:15 +02:00
Alug b985ce06a2 lol 2024-10-01 16:03:56 +02:00
Alug 12d6546062 dumb special case for wandering balls Zzz... 2024-10-01 16:03:00 +02:00
indev fb71da3627 Remove debug print 2024-10-01 16:50:44 +03:00
indev a90ffff320 Fix (hopefully) all other menu types that use IT_CV_STRING 2024-10-01 16:49:59 +03:00
Alug 9abf2bca75 fix some stuff 2024-10-01 15:46:22 +02:00
indev 3db6770dfd Fix IT_CV_STRING crashing game in M_DrawGenericMenu 2024-10-01 16:24:14 +03:00
Alug 3a951576ee use stricmp for this 2024-10-01 15:22:29 +02:00
Alug 6b0d67ac36 more 2024-10-01 15:22:25 +02:00
Alug d06b8ac398 cleanup + comments 2024-10-01 15:22:22 +02:00
Alug 67435ebf9e work around encore music again
S_InitMapMusic would play before the level actually started thus playing a smol bit of non encore music in encore
2024-10-01 15:22:19 +02:00
Alug 2ee29630fb fix encore music again lol 2024-10-01 15:22:16 +02:00
Alug 7fa21e9aea work around custom vote theme music + rename a bunch of stuff
please help me
2024-10-01 15:22:08 +02:00
Alug b4b206f575 encoremusic... 2024-10-01 15:22:04 +02:00
Alug f363663b3e fix up everything and make stuff work
i hope lmao
2024-10-01 15:22:01 +02:00
Alug 42d957e21b change how keepmusic works
compare map and encore instead of the music itself
2024-10-01 15:21:57 +02:00
Alug 07f9756bc8 forgor about encore music 2024-10-01 15:21:54 +02:00
Alug e958e43b49 update comments a little 2024-10-01 15:21:51 +02:00
Alug 0d150e4b08 add some basics of what i wanna have for music stuff
- basic keepmusic implementation (currently checks for if the song changes instead of the map, idk if i keep this, since this allows certain maps to change the music on start, ex abstract avenue or wandering balls)
- Toggle to ignore any kind of music change during the level (includes intermission music, depends on how custom intermission music works)
-toggle to start map music instantly on levelload and skip the intro fanfare (also skips any linedef executed sound so some map intros dont interfere with this)
2024-10-01 15:21:47 +02:00
Alug 0deff73a46 make a function for the music level start stuff 2024-10-01 15:21:43 +02:00
Alug b24caf397a add "map ?" shortcut for random map 2024-10-01 14:49:46 +02:00
Alug f051e33a0c cv_showdirectorhud didnt save Zzz... 2024-09-30 23:00:39 +02:00
indev ff2b28ac73 Use m_textinput for chat too 2024-09-30 12:13:25 +03:00
indev e2367d26d1 Use same keyboardlayout code as in chat for textinput, also add a null terminator after ctrl-v just in case string is not always zeroed out already 2024-09-30 12:08:21 +03:00
indev e1a65add5d Put all text input logic into separate file and use it for all text input fields 2024-09-30 10:35:27 +03:00
Alug 913426bfdb let SOC also use PRECIP_BLANK/ weather = 4
no idea why it couldnt doesent make any sense
2024-09-29 22:28:35 +02:00
Alug d7b0726e42 no need to even traverse part of the blockmap when PRECIP_STORM_NORAIN and PRECIP_BLANK 2024-09-29 22:28:31 +02:00
Alug cadb67e6c9 move this stuff
so dont need check for renderisnewtic multiple  times and dont need to check for menu and dpad stuff every single frame
2024-09-29 15:15:53 +02:00
Alug 564838a439 only draw lua hud stuff when patch exists 2024-09-29 15:15:49 +02:00
Alug 4554bcc565 reset rumble on some conditions 2024-09-28 03:29:12 +02:00
Alug fd48335688 Replace portalline boolean with g_portal pointer to current portal Beta 2024-09-28 03:29:09 +02:00
Alug 222f56d1b2 smol director stuffs 2024-09-28 01:03:44 +02:00
Alug b71870f57b this needs no dedi check actually 2024-09-28 01:03:41 +02:00
Alug 01c9632025 set those in P_SpawnGhostMobj too 2024-09-28 01:03:39 +02:00
Alug 1533e13d68 let player pointer be const in P_IsLocalPlayer and P_IsDisplayPlayer 2024-09-28 01:03:34 +02:00
Alug 89965ad718 forgor remove this 2024-09-28 01:03:31 +02:00
Alug eb74f3525a consolidate this 2024-09-28 01:03:29 +02:00
Alug 536f88dee0 this does nothing 2024-09-28 01:03:26 +02:00
Alug 2622ba286e z 2024-09-28 01:03:18 +02:00
Alug a1d490cb49 R_DrawMaskedColumn: do not draw zero length column 2024-09-28 01:03:15 +02:00
Alug b357c09171 those should be size_t 2024-09-28 01:03:11 +02:00
Alug 48e71afec1 update lzf compression to 1.6 2024-09-28 01:03:08 +02:00
Alug 1c6fce9339 fix encore minimap 2024-09-27 15:05:38 +02:00
Alug 96551d3b75 use qs22j here again
it is really faster
thought it wasnt in this case
2024-09-27 15:05:34 +02:00
Alug 7a832df4d3 cleanup + reformatting 2024-09-27 15:05:31 +02:00
Alug c3b6121968 forgor this 2024-09-27 15:04:15 +02:00
Alug b3b2b65c5f reformat this 2024-09-27 15:04:12 +02:00
Alug 7a3ccec38d ; 2024-09-26 18:18:42 +02:00
Alug d8da0a11a2 gamestate resend counter was never proper reset for nodes
means it would carry over to the next person occupieing that node and made them have less chances to get the gamestate resent
2024-09-25 19:31:25 +02:00
Alug d5c3332635 those can be static 2024-09-24 22:23:29 +02:00
Alug 0137f2254d add toggle for water ripples Zzz... 2024-09-24 22:18:27 +02:00
Alug 63f649724e Merge branch 'Saturn-Next' into unglobsavep 2024-09-24 17:05:42 +02:00
Alug da769ce524 only allow director toggling with button when you spec someone 2024-09-24 16:57:25 +02:00
Alug 2e99636bb0 make director text disappear after 13 seconds, and in replays after 4 2024-09-24 15:25:56 +02:00
indev ff7f68f5b4 Expose demo.freecam as replayfreecam 2024-09-24 16:05:22 +03:00
Alug 14eec0c902 dont show director text when in replay freecam 2024-09-24 15:03:31 +02:00
Alug b064c534d8 hide viewpoint text when in replay freecam 2024-09-24 15:03:28 +02:00
Alug e7c0f322ee dont show driftgauge when in replay freecam 2024-09-24 15:03:14 +02:00
Alug 725754c427 dont run director when you use spectator freecam 2024-09-24 15:03:07 +02:00
Alug 9a6c0a0280 check vres data before freeing it 2024-09-23 23:13:08 +02:00
Alug 26d8c05ce7 forgor some casting 2024-09-23 23:13:05 +02:00
indev 91a9f20af7 Skip map marker in vres_GetMap 2024-09-24 00:08:48 +03:00
indev 90745d91aa Add showdownloadprompt cvar, so addon download prompt can be disabled 2024-09-23 23:39:25 +03:00
Alug 0dbae34998 completely forgor to revert this lol 2024-09-23 15:53:05 +02:00
Alug eec93b8013 Revert "beta hud driftgauge"
This reverts commit 26e8c2ca2b.
2024-09-23 01:35:14 +02:00
Alug cfe3f01b32 Revert "extra check"
This reverts commit 0bb1efcd50.
2024-09-23 01:35:11 +02:00
Alug df10262ebb Revert "beta hud driftgauge"
This reverts commit 26e8c2ca2b.
2024-09-23 01:34:47 +02:00
Alug a87ac3e35e Revert "extra check"
This reverts commit 0bb1efcd50.
2024-09-23 01:34:41 +02:00
Alug b71d9d2e68 Merge branch 'Saturn-Next' into unglobsavep 2024-09-23 01:04:04 +02:00
Alug 43452e1af4 dont actually call Nullprecipthinker 2024-09-23 01:03:59 +02:00
Alug a4706e0785 read precip row in perfstats 2 2024-09-23 01:03:24 +02:00
Alug c921ab463c dont count precip towards thinkers in perfstats 2024-09-23 01:03:20 +02:00
Alug 892816dadf fix precip performance issuess on certain maps 2024-09-23 01:03:17 +02:00
Alug cc44a5785d lets not archive players as mobjs 2024-09-22 23:08:33 +02:00
Alug 172d2bf545 Merge branch 'Saturn-Next' into unglobsavep 2024-09-22 22:20:19 +02:00
Alug e7e1fd711e dont check consistency/attempt to resend the gamestate while a client is currently getting the save resend
perhaps that makes mass synchs less bad
2024-09-22 22:16:21 +02:00
Alug 7493b3d2ab Revert "clean up leveload a bit"
This reverts commit c14af4a136.
2024-09-22 22:10:57 +02:00
Alug ba5459eeb6 Revert "clean up leveload a bit"
This reverts commit c14af4a136.
2024-09-22 17:52:26 +02:00
Alug 31370741f2 Merge branch 'Saturn-Next' into unglobsavep 2024-09-22 17:01:27 +02:00
Alug 0bd9c696df try to prevent unknown packet type spam when client attempt to connect while levelloading 2024-09-22 16:53:31 +02:00
Alug c14af4a136 clean up leveload a bit 2024-09-22 16:53:25 +02:00
Alug 8dfa841a7b Load palette before map data 2024-09-22 16:52:07 +02:00
Alug a6de843c75 cleanup r_draw8 2024-09-22 16:52:04 +02:00
Alug 0bb1efcd50 extra check 2024-09-22 04:14:31 +02:00
Alug 26e8c2ca2b beta hud driftgauge
eh needs some stuff for menu still
also should replace driftgauge gfx sometime
2024-09-22 04:13:53 +02:00
Alug 12ffca7374 precalc automap and minimap stuff on mapload instead of every frame 2024-09-22 04:13:02 +02:00
Alug e187f73044 Merge branch 'Saturn-Next' into unglobsavep 2024-09-21 17:41:58 +02:00
Alug 6ecf65d83a Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Next 2024-09-21 16:03:17 +02:00
Alug 231c173545 move this so speccing resets your laptime 2024-09-21 16:03:13 +02:00
Alug f12b7fd772 move this 2024-09-19 12:41:40 +02:00
Alug 14ea041c72 always reset cam subsector regardless of splitscreen 2024-09-18 12:11:14 +02:00
Alug 6fb804292c Prevent integer div by 0 in curl progress callback 2024-09-18 01:07:43 +02:00
Alug f77f7361a9 this also does nothing 2024-09-18 01:06:54 +02:00
Alug d6d19d5dab smol cleanup 2024-09-18 01:02:42 +02:00
Alug 8074bfacb6 this does nothing 2024-09-18 00:58:37 +02:00
Alug f5f7b99479 Fix crash if a packet fails to reach the client
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2480 but keeps the returns;
2024-09-17 21:02:05 +02:00
Alug f0a8c27829 Fix crash when trying to send to an unreachable client
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2232
2024-09-17 20:58:23 +02:00
Alug 30024f2341 this is the correct value 2024-09-17 19:47:30 +02:00
Alug ff0dcafeea make ticcmds on gamestateresend
resynch will still stop making em
should hopefully fix some weird issues where you might end up somewhere weird if the resend takes a little longer
2024-09-17 16:47:34 +02:00
Alug 8580451bce properly reset all splitscreen cameras on resynch
also fix some casting
2024-09-17 16:47:31 +02:00
Alug d867868854 Revert "dont run playerjoin hook on resynch"
This reverts commit 5f7bf4164d.
2024-09-17 16:43:25 +02:00
indev b1644d4817 Ignore case here 2024-09-17 17:23:16 +03:00
indev a9a3a04379 Add proper skin search in skin command 2024-09-17 17:16:35 +03:00
Alug 3aa55ee9c3 dont need this 2024-09-16 18:12:52 +02:00
Alug 8cfc8a5492 "player" 2024-09-16 17:52:58 +02:00
Alug 3f1c8db362 some stuff i forgor 2024-09-16 17:33:31 +02:00
Alug 0d999d7a70 Revert "Contain end & size into savebuffer_t"
This reverts commit 1a810bc923.
2024-09-16 17:17:19 +02:00
Alug 8bc081d937 Use Zone memory functions for sending compressed saves 2024-09-16 13:47:46 +02:00
Alug 42eb8d1af5 Only save demo if demobuf.p is ready 2024-09-16 13:47:43 +02:00
Alug 1a810bc923 Contain end & size into savebuffer_t 2024-09-16 13:47:40 +02:00
Alug 065572ef64 more fixup 2024-09-16 12:56:19 +02:00
Alug e88702e10c fix demo checkspace 2024-09-16 12:56:16 +02:00
Alug ee2d934525 rest smol fixes 2024-09-16 12:42:39 +02:00
Alug 2a3a33226e fixup demo savebuf 2024-09-16 12:42:36 +02:00
Alug 539315710c clean up 2024-09-16 12:42:33 +02:00
Alug 191a6ca76f unglobalize savebuffer
needs some cleanup
2024-09-16 12:42:29 +02:00
Alug 7ac9f0cbef dont rerun mapload hook on resynch 2024-09-16 00:54:29 +02:00
Alug 5f7bf4164d dont run playerjoin hook on resynch 2024-09-16 00:54:26 +02:00
Alug 43690c9b2c fix sound bug lol 2024-09-16 00:08:21 +02:00
Alug 02c14bfa5c Merge branch 'Saturn' into Saturn-Next 2024-09-16 00:08:11 +02:00
Alug 0544811c7d Merge pull request #135 from Indev450/Saturn-Next
Saturn v7
2024-09-15 13:02:42 +02:00
Alug e079bac283 make advanced server menu scroll menu
grrrrr green res
2024-09-15 12:03:20 +02:00
Alug 862f1fce2c ... 2024-09-15 12:03:16 +02:00
Alug 5aeb78f2a5 Merge pull request #134 from Indev450/absolutehell
Huge Netcode/Resynchcode changes
2024-09-15 11:45:35 +02:00
Alug cb42bc581b squish options menu a little
im honestly too lazy too move shit around just before release lmao
2024-09-15 11:43:44 +02:00
Alug 5fc9410b59 Merge branch 'Saturn-Next' into absolutehell 2024-09-14 22:23:51 +02:00
Alug 84d3ee7170 maths..... 2024-09-14 22:23:11 +02:00
Alug accef8f1e1 version change 2024-09-14 21:10:55 +02:00
Alug 4a8edff694 Merge remote-tracking branch 'origin/Saturn-Next' into absolutehell 2024-09-14 21:01:08 +02:00
Alug aac3b8d025 forgor this one 2024-09-14 19:45:23 +02:00
Alug 4034658e44 some cleanup 2024-09-14 19:44:01 +02:00
Alug 7d4898dd8b remove code dupe in r_segs 2024-09-14 18:43:13 +02:00
indev 71fe6ec9da should be != here 2024-09-14 19:04:51 +03:00
indev 075097c219 Don't default to sonic if skin was changed to unknown skin, use current skin instead 2024-09-14 16:40:17 +03:00
Alug f70ec60ae4 use continues in hooklib loops too
idk if this is any faster, but it makes smth i wanna port over potentally easier
2024-09-14 12:35:29 +02:00
Alug aeafd46f24 smol m_menu cleanup 2024-09-13 14:17:13 +02:00
Alug 5f57044118 replace tooltip crap with a macro + fix adv video options tooltips 2024-09-13 14:02:15 +02:00
Alug 65006c11d3 move credits a tiny bit 2024-09-13 13:37:10 +02:00
Alug 76bc184f6c whoops wrong tooltip 2024-09-13 13:35:18 +02:00
Alug dd39a444f2 add smol comment 2024-09-13 13:30:30 +02:00
Alug 1a16012a5c this used to be const 2024-09-13 13:22:51 +02:00
Alug c49aae8d49 no need to save saturnjoin value + smol cleanup 2024-09-13 13:21:25 +02:00
Alug d5dc52d3d3 super smol optimization R_ThingWithinDist
no need to run fixedhypot on every sprite when you dont use draw distance limit
2024-09-13 12:44:38 +02:00
Alug 4f1f1ede97 smol menu visual cleanup 2024-09-13 12:33:49 +02:00
Alug c98b896fc8 add old line whatever in intermission add beta intermission visual to menu 2024-09-13 12:33:02 +02:00
Alug 3714735c2a small cleanup intermission drawer 2024-09-13 12:32:59 +02:00
Alug 025cc093db Merge remote-tracking branch 'origin/Saturn-Next' into absolutehell 2024-09-13 10:48:34 +02:00
Alug 924d79c20d only need to check all this when in splitscreen
retains vanilla behaviour
2024-09-13 00:23:07 +02:00
Alug 0926f68776 clean up sprite stuff 2024-09-13 00:16:35 +02:00
Alug 26f3806b3c fix wöter shader interpolation
accidentally reverted that when redoing palette rendering
2024-09-12 22:43:14 +02:00
Alug d628320c8d forgor this 2024-09-12 01:05:07 +02:00
Alug 41fc4c7cfd delete DEH_WriteUndoline
it literally does nothing lol
2024-09-12 01:05:05 +02:00
Alug 1c8ca2b110 apparently this always runs
i am in pain
2024-09-11 21:10:41 +02:00
Alug 241d107485 let item button toggle encore in mapselect screen
guh
2024-09-11 21:10:38 +02:00
Alug 8d0601c2ad add missing masterserver ifdef 2024-09-11 21:10:35 +02:00
Alug 31118254a0 this can be int16 2024-09-10 19:56:52 +02:00
Alug 85a1636776 Revert "smol optimization to HWR_AddLine"
This reverts commit 77c9badeca.
2024-09-10 10:58:15 +02:00
Alug 3b227932e9 Revert "smol optimization R_AddLine"
This reverts commit 677cdc77e4.
2024-09-10 10:58:12 +02:00
Alug ff591bce04 Revert "Zzz..."
This reverts commit c3a03d89c4.
2024-09-10 10:58:09 +02:00
Alug c3a03d89c4 Zzz... 2024-09-10 10:31:25 +02:00
indev dd405532af Snap title demo logo to bottom right corner 2024-09-09 23:56:53 +03:00
Alug 677cdc77e4 smol optimization R_AddLine 2024-09-09 22:57:21 +02:00
Alug f9463d8efa smol cleanup 2024-09-09 22:57:18 +02:00
Alug 77c9badeca smol optimization to HWR_AddLine 2024-09-09 22:57:15 +02:00
Alug 926287eb97 remove redundant check 2024-09-09 22:57:12 +02:00
Alug 7a91b19962 only change lightlevel/colormap behaviour in palette rendering 2024-09-09 21:51:09 +02:00
Alug c148ff5a05 fix off by one in sprite lightlevels 2024-09-09 21:51:06 +02:00
Alug ef7e658f9d Merge branch 'Saturn-Next' into absolutehell 2024-09-09 18:51:37 +02:00
Alug 0e9b9d15ea revert this ig 2024-09-09 18:51:23 +02:00
Alug dd2d437a21 Merge branch 'Saturn-Next' into absolutehell 2024-09-09 16:05:16 +02:00
Alug b9779d4dba add toggle for director prompt
cause ik some ppl will complain lol
2024-09-09 16:05:08 +02:00
Alug 1d40d8c4ef make this less complicated lol 2024-09-09 15:58:45 +02:00
Alug 847b1f5cb7 fade director hud after 4 secs after toggling it 2024-09-09 15:58:43 +02:00
Alug 9448a98573 disable director on title screen and record attack demos 2024-09-09 09:25:06 +02:00
Alug 14bce36b95 make it static actually 2024-09-08 23:36:57 +02:00
Alug ba4c54004a turn off director by default when playing replays and restore the setting when done
you can  still toggle it in replays no issues
but you mostly want to watch yourself or a certain person during replays, so having to manually toggle it off always is weird
2024-09-08 23:34:35 +02:00
Alug 9fdfc09229 dont trigger rumble in offroad when under hyu effect 2024-09-08 23:09:17 +02:00
Alug b19bc7d77e slight portal cleanup 2024-09-08 16:53:52 +02:00
Alug 58815ae9c4 fix potential rendering issues on large maps 2024-09-08 16:45:50 +02:00
Alug 0b12c9b5a8 smol cleanup 2024-09-08 16:45:48 +02:00
Alug 863abe86ca oops 2024-09-07 20:09:49 +02:00
Alug f54d2fb0fe clean up and improve ogl portals 2024-09-07 20:09:45 +02:00
Alug 8824ba3824 this is literally broken and noone knows about it anyways lol 2024-09-07 17:52:24 +02:00
Alug 8a8db796be Show a console error if the gamestate contains too many tables 2024-09-07 17:30:08 +02:00
Alug 4f532b766f this needs to be shifted 2024-09-07 17:04:06 +02:00
Alug e175a4e00b guh 2024-09-07 16:57:41 +02:00
Alug 473e843142 this should use angleturn
uhhh
2024-09-07 16:46:29 +02:00
Alug ef8e71cb11 set camera angle to player angle in CL_ReloadReceivedSavegame
hope i did this right lol
should hopefully fix more jarring visual stuffs
2024-09-07 16:28:17 +02:00
Alug ea985151dd dont rerun levelload executors when gamestate resent 2024-09-07 16:27:35 +02:00
Alug 62fae0ad8b dont print "Map is now" everytime you resynch from gamestate resend 2024-09-07 16:27:32 +02:00
Alug f9210ee3bc smol fixes for gamestate resend in P_SetupLevel
- dont reset cameras during gamestate resynch
- dont reinit director during gamesate resynch
- dont reset view interpolators aswell
- dont reset localaiming aswell

should make resynching less jarring visually hopefully
2024-09-07 15:35:41 +02:00
indev d5101dd0b2 Document changes to lua P_PlayRinglossSound and K_PlayHitEmSound functions 2024-09-07 11:47:09 +03:00
Alug 2a7940bfd1 Merge branch 'Saturn-Next' into absolutehell 2024-09-06 22:37:53 +02:00
Alug 047d38daab Merge branch 'noZ_unlock' into Saturn-Next 2024-09-06 22:37:39 +02:00
Alug 2d61f5c861 add compiler flags NOSATURNSYNCH, NOSATURNJOIN and NOSATURNPAK
not building with SATURNSYNCH also will disable SATURNJOIN since it makes not much sense to have that when synch stuff is unused
2024-09-06 21:41:53 +02:00
Alug 750f305c46 % 2024-09-06 21:06:06 +02:00
Alug 51b79e58d3 smol cleanup + add comments 2024-09-06 21:05:33 +02:00
Alug 915b4e9d15 set netgame save stuff to false for replays
to retain max vanilla compat for replays
dont want those breaking between clients
2024-09-06 21:05:30 +02:00
Alug c9c0c06763 reserve saturn packet even if unused
to not cause any weird isssues if either one is undefined and stuff like that
2024-09-06 20:36:27 +02:00
Alug 406037dabe menu offset stuff for if not using SATURNSYNCH 2024-09-06 20:06:57 +02:00
Alug d9affe2331 oops again 2024-09-06 19:59:45 +02:00
Alug 6df675523f hide gamestate resynch stuff behind SATURNSYNCH ifdef 2024-09-06 19:55:34 +02:00
Alug 65e66e8ace oops 2024-09-06 19:55:32 +02:00
Alug 5efb0c7136 put saturn specific join allow stuff behind SATURNJOIN define
so it can be seperate from SATURNPAK
2024-09-06 19:25:02 +02:00
Alug 1793340474 Merge branch 'Saturn-Next' into absolutehell 2024-09-06 19:13:31 +02:00
Alug d10db6d1d2 make this completely toggable actually 2024-09-06 18:51:06 +02:00
Alug 9eefbcea72 only save demo in map command if you atleast spend 35 seconds in one map 2024-09-05 18:34:50 +02:00
Alug d56b70a8e7 toggle for saving replays on changing to same map 2024-09-05 10:52:45 +02:00
Alug 54ebb9dfec test also save replay on mapchange command 2024-09-05 10:52:42 +02:00
Alug 43b6597ec0 this should also check for screentex cvar value 2
dont run certain postprocessor effects when you dont have screentextures enabled
2024-09-04 23:45:08 +02:00
Alug b7d887d610 add a little bit of safety to R_SetupFrame 2024-09-04 23:31:54 +02:00
Alug ff9b35ab45 remove IFCHANGED macro, check directly in R_Lerp funcs + inline those
basically does the same thing lol just looks better
2024-09-04 18:49:16 +02:00
Alug 20b5175180 scale precip momz with mobjscale when cv_mobjscaleprecip enabled 2024-09-04 18:48:13 +02:00
Alug 596c8e2ecc also scale precip sprite with mobjscale when cv_mobjscaleprecip enabled 2024-09-04 18:48:08 +02:00
Alug 94218a6549 only call HWR_RenderPlayerView in ogl explictly 2024-09-04 18:48:05 +02:00
Alug 2d36f798e7 Merge branch 'Saturn-Next' into absolutehell 2024-09-04 15:26:42 +02:00
Alug 853004dad9 smol cleanup for led stuff again 2024-09-04 15:26:31 +02:00
Alug 0cc86430ca smol cleanup hw_shaders 2024-09-04 15:26:28 +02:00
Alug 8760886f57 smol cleanup p_map 2024-09-04 15:26:24 +02:00
Alug 821669d03d Revert "optimize z position checking for mobjs without collision and camera"
This reverts commit c11d925580.
2024-09-04 15:23:28 +02:00
Alug 17f8996afc revert pretty much all mobj changes for now
might reapply them some other time, but since we need to maintain vanilla compat as much as possible gonna revert crap
kinda sick of desynching stuffs and honestly most the mobj stuff rarely ever crashes
2024-09-04 15:23:14 +02:00
Alug 7ef4eedd06 Revert "optimize pointon functions"
This reverts commit 94ddd01427.

may be readded in v7.1 
since this is pretty sensitive code and i dont want to desynch or crap so this def needs more testing
2024-09-04 15:04:54 +02:00
indev df6a31767e Make server send serverinfo packet so client can know server name even when connecting just by ip 2024-09-02 21:47:02 +03:00
Alug 882a3b7824 revert this 2024-09-02 17:58:35 +02:00
Alug 94ddd01427 optimize pointon functions 2024-09-02 17:46:41 +02:00
Alug e614decae0 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-09-02 17:45:57 +02:00
Alug e0f46ea80d oop 2024-09-02 17:44:55 +02:00
Alug 3391018606 some stuffs from lugstuff
mostly just cleanup and smoler optimizations
2024-09-02 17:40:05 +02:00
Alug 61fd11f7cd those are unused 2024-09-02 14:23:24 +02:00
Alug 4a469aebdc dont draw precip in skyboxes in opengl like software does 2024-09-02 14:23:22 +02:00
Alug 341815c0ed this can be static 2024-09-02 14:23:19 +02:00
Alug 5830270bda optimize polyobject spawn
should speed up level loading with maps with polyobjects
thx geezeedoom
2024-09-02 14:23:16 +02:00
Alug 8a1ff58dff free texture patchlumps proper in R_LoadTextures
drastically reduces ram usage
2024-09-01 20:43:40 +02:00
Alug 0523d98a1c Test: remove Z_Unlock and proper free some stuff 2024-09-01 20:41:42 +02:00
Alug 983af4e7a1 Merge branch 'Saturn-Next' into absolutehell 2024-08-31 20:19:42 +02:00
Alug f8bec7296c no idea why i put those here 2024-08-31 20:19:12 +02:00
Alug 2be4bd3d6a update camera when paused and changing cam dist or height 2024-08-31 20:15:41 +02:00
Alug 7d74296604 throw menu bg conditions into own function since it s terrible 2024-08-31 19:53:09 +02:00
Alug 0504a355d2 add camera options menu 2024-08-31 19:52:35 +02:00
Alug 036df817f1 give camera lookback a toggle + extra option 2024-08-31 18:46:01 +02:00
Alug ba331caff6 when looking back camera momentum should inherit the mom of the player
makes using shoes or any boost stuff less jarring when looking back
2024-08-31 18:45:58 +02:00
Alug e2ac9708cb super tiny cleanup m_menu again 2024-08-31 18:45:55 +02:00
Alug 783ce7bada give camera lookback a toggle + extra option 2024-08-31 18:45:47 +02:00
Alug 594931e07e when looking back camera momentum should inherit the mom of the player
makes using shoes or any boost stuff less jarring when looking back
2024-08-31 18:45:43 +02:00
Alug 3e245d49d8 super tiny cleanup m_menu again 2024-08-31 18:45:36 +02:00
Alug 76ed4aae12 forgor speedo doesent draw in splitscreen + change offsets 2024-08-31 18:11:06 +02:00
Alug 565f36d4b7 forgor speedo doesent draw in splitscreen + change offsets 2024-08-31 18:10:59 +02:00
Alug 75a94b050d Merge branch 'Saturn-Next' into absolutehell 2024-08-31 18:01:34 +02:00
Alug 91fac0880d add battlespeedometer to saturn hud menu + apply offset to bumper gfx when enabled 2024-08-31 18:01:22 +02:00
Alug 42fa29f78b make timer flash at 99´59´99 again 2024-08-31 17:39:30 +02:00
Alug 28d8e84d6b this can be static and inlined 2024-08-31 16:53:33 +02:00
Alug c11d925580 optimize z position checking for mobjs without collision and camera
idk how much this does tbh
only for stuff without collision since it may desynch otherwise

based on
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2214

and

https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2250
2024-08-28 02:35:42 +02:00
Alug d7c1b12dbd changes to saturn menu
-Add new Saturn Hud options menu to declutter normal saturn options
- If in any of the hud options the game will force display the kart hud and disable the fade background
- i hate m_menu
2024-08-27 18:26:18 +02:00
Alug e2c3d5b20d respawn precip when toggling any of its settings 2024-08-27 16:41:19 +02:00
Alug 8581d87e41 toggle to scale weather with mobjscale
toggle since it may tank performance on certain maps for some + may make visability worse
2024-08-27 16:27:28 +02:00
Alug fe853d4bee fix compileur warnings
idk if this is right lol
2024-08-27 06:07:38 +02:00
Alug b8038130b8 fix conflict 2024-08-27 05:51:35 +02:00
Alug 31c5d8d67c fix precip switching 2024-08-27 05:44:31 +02:00
Alug a2f4430378 stuff 2024-08-27 05:44:27 +02:00
Alug a8e4f6e2ea Reapply "lol"
This reverts commit 340450a67e.
2024-08-27 05:44:20 +02:00
Alug aac89f270b Reapply "optimize precip thinker"
This reverts commit dd73787c8b.
2024-08-27 05:44:13 +02:00
Alug 9022e02ccd fix potential crash in P_TryCameraMove for dedi servers 2024-08-23 15:31:58 +02:00
Alug 5ddd2e4fbc cleanup P_DoSuperTransformation
its still exposed to lua for whatever reason
so cant really remove crap kek
2024-08-23 15:31:55 +02:00
Alug 3b500add73 cleanup birdmusic crap again
music_resync_powerups_only literally didnt do shit lol
removed some other unused crap
changed some conditions to better check for stuff
etc idk
i just rather remove this whole thing at this point but oh well
2024-08-23 15:31:52 +02:00
Alug 4a6635f8a8 Revert "smol interp fixes"
This reverts commit 77a2976d05.
2024-08-22 14:54:43 +02:00
Alug af6393af50 forgor 2024-08-21 15:38:46 +02:00
Alug 6a14543e9e cleanup FBO on shutdown + make some stuff static 2024-08-20 23:26:43 +02:00
Alug 3d827570e6 more changes to FBO stuff
now it wont ever do anything when disabled
also properly deletes the FBO when disabling it
2024-08-20 23:18:35 +02:00
Alug 9f8eb07442 revert this in y_inter 2024-08-20 21:33:41 +02:00
Alug 31c64b63de make this more robust ig 2024-08-20 03:57:49 +02:00
Alug cf5c0ca5f7 forgor return 2024-08-19 21:54:22 +02:00
Alug f0d91a9708 do not constantly query ogl extensions 2024-08-19 21:48:56 +02:00
Alug 0f94a26dc6 dumbass workaround for issues on xwayland with nvidia
this will run automatically when it detects an nvidia gpu even with gr_framebuffer disabled lol

we have safeguards everywhere so shouldnt be an issue
2024-08-19 19:37:02 +02:00
Alug cded0af061 change some stuff for saturn 2024-08-19 17:51:35 +02:00
NepDisk fffa7e44c5 Appimage compile pt2 2024-08-19 17:51:31 +02:00
NepDisk a38aee7fe3 Appimage compile pt1 2024-08-19 17:51:29 +02:00
Alug 4d03fa06e1 raise maxpng res 2024-08-19 17:51:26 +02:00
Alug dcd470b2e1 Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2024-08-19 14:58:08 +02:00
Alug 2259ef3f71 Update LUASTUFF
idk i suck at explaining lmao
but atleast those should be mentioned
2024-08-19 14:58:01 +02:00
indev af18e2b7d1 Don't execute exitgame command on dedicated servers 2024-08-19 14:14:59 +03:00
indev 9e8d79f246 Fix compilation when SDL_VERSION_ATLEAST(2,0,18) is false (if its false then 'else' statement would not be valid) 2024-08-19 14:14:17 +03:00
Alug 5b480be6dc smol cleanup for downsample stuff 2024-08-19 12:16:32 +02:00
Alug 54d897fc33 smol i_video cleanup 2024-08-19 12:15:47 +02:00
Alug cfebe422d3 Fix typo 2024-08-19 12:00:27 +02:00
NepDisk fcc5c13274 Fix Compile without with out of date SDL 2024-08-19 11:59:48 +02:00
Alug 707448193b Fix some tooltips so they don't go offscreen
grr git not crediting neppy for some reason
2024-08-19 11:59:45 +02:00
NepDisk 84a1f86037 Allow the control binds menu to use lower case 2024-08-19 11:59:42 +02:00
NepDisk b2129011c2 Fix gamepad menus for green reses via scrolling 2024-08-19 11:59:38 +02:00
Alug 9d359ef8c5 use qsort instead of qs22j for vissprite sorting
seems to be actually faster in this case
2024-08-19 11:59:35 +02:00
Alug 87a2b74a88 this should not be in HWRENDER ifdef 2024-08-19 11:59:33 +02:00
Alug d5388e8dad fix NOHW compile 2024-08-19 11:59:29 +02:00
Alug fe7677c5c8 Revert "Do not access memory on misaligned addresses"
This reverts commit 112716dae5.
2024-08-19 11:59:25 +02:00
Alug f36ac0bb4b this should not be in HWRENDER ifdef 2024-08-17 20:03:35 +02:00
Alug d24bcc9fd7 fix NOHW compile 2024-08-17 20:01:46 +02:00
Alug daf8151a32 Revert "Do not access memory on misaligned addresses"
This reverts commit 112716dae5.
2024-08-17 19:56:14 +02:00
Alug b432491d34 throw saturnpacket and join stuff behind "SATURNPAK" ifdef, disable it for now 2024-08-17 19:54:56 +02:00
Alug 1313b4c112 Merge branch 'Saturn-Next' into absolutehell 2024-08-17 19:43:42 +02:00
Alug 164d7399d2 smol fix to slope light 2024-08-17 16:31:09 +02:00
Alug 87176cfd0b better slope light 2024-08-17 16:09:43 +02:00
Alug bab96b73e0 smol changes 2024-08-17 16:09:40 +02:00
Alug f10db3900a Use a const for the contrast 2024-08-17 16:09:37 +02:00
Alug 7d4b1d0852 Update light offset on polyobjects when they rotate 2024-08-17 16:09:34 +02:00
Alug 6ab99218f2 precalc fakecontrast on mapload 2024-08-17 16:09:31 +02:00
indev 1959edf357 Always allow typing replay search query, similar to addon search 2024-08-16 01:58:33 +03:00
indev 6fc2681b34 Add 'Hit Em Delay' option in menu 2024-08-16 01:51:29 +03:00
indev 02dcf85c46 Prioritize display players when assigning delayed 'hit em' 2024-08-16 01:51:29 +03:00
indev 89f0521cce Oops forgot to change that
Dunno if this function ever gets called for non-player objects but just in case
2024-08-16 01:51:28 +03:00
indev 35029e826f Add delayed hit em sound (like in DRRR), togglable via 'karthitemdialog' cvar 2024-08-16 01:51:28 +03:00
Alug f6c170b53c add onchange func for led + fix rumble onchange 2024-08-16 00:34:16 +02:00
Alug 7991a5ce5e Merge branch 'Saturn-Next' into absolutehell 2024-08-16 00:09:46 +02:00
Alug 3973851dd2 add toggles for gamepad led stuff 2024-08-16 00:09:08 +02:00
Alug f6361e29bd reset rumble when player is exiting 2024-08-16 00:08:52 +02:00
Alug 9f8db631f0 reset rumble when player is exiting 2024-08-15 23:46:02 +02:00
Alug ada1de7ad6 dont change connect behaviour regardless of client + smol cleanup and fixes
should hopefully fix any remaining issues
2024-08-15 23:44:48 +02:00
Alug ac55d473e7 smol cleanup 2024-08-15 17:34:58 +02:00
Alug 2100f11af7 remove duplicates in ResetNode 2024-08-15 17:34:55 +02:00
Alug ea1b5cd1a9 Merge branch 'Saturn-Next' into absolutehell 2024-08-15 17:34:50 +02:00
Alug e100fff230 check for changed state before everything else 2024-08-15 16:38:19 +02:00
Alug 5393ac526a move this in hw_main 2024-08-15 16:38:12 +02:00
Alug 808f7baf53 move this in coindition 2024-08-15 16:38:08 +02:00
Alug 35f54822be smol cleanup HWR_RenderPlane 2024-08-15 16:38:05 +02:00
indev 94714fe571 Fix increasing number of viewpoints in replays by more than 1 (like pressing '3' with only one viewpoint) crashing game 2024-08-14 16:08:39 +03:00
Alug 5bdf8698bd completely disable director in splitscreen
will eventually get to splitscreen support lul
2024-08-14 14:45:42 +02:00
Alug 2398e60e89 fix director lol 2024-08-14 14:10:40 +02:00
Alug b4e563bfd6 Merge remote-tracking branch 'origin/Saturn-Next' into absolutehell 2024-08-11 11:22:21 +02:00
indev a56ce09923 Fix LUA_EvalMath warnings being broken sometimes 2024-08-11 12:01:10 +03:00
Alug 68c7a6bd93 Merge branch 'Saturn-Next' into absolutehell 2024-08-09 19:48:28 +02:00
indev b4612d6bd4 Fix smol memory leak in replay search thread oops 2024-08-09 19:45:16 +03:00
indev c2cfc96d87 Load replay titles in separate thread 2024-08-09 16:05:48 +03:00
indev 8db99291ac Visual improvements for replay search 2024-08-08 22:40:22 +03:00
indev c9aa764444 Add alternative button ('/') to open replay search 2024-08-08 22:09:30 +03:00
indev ee4869993d Oops shouldn't z_free that 2024-08-08 22:03:00 +03:00
indev 0758cf39c2 Greatly improve replay search perfomance by only reading replay name, and not entire file. Increase default search rate up to 1000 2024-08-08 22:01:19 +03:00
indev bb0c777cac Fix M_HutCheckReplays still being called in menu (hopefully) 2024-08-08 21:31:09 +03:00
indev 0bd2c49dae Search replays using title instead of filename 2024-08-08 18:43:03 +03:00
indev d25c6fa0b2 Test replay search 2024-08-08 16:51:39 +03:00
Alug 8f2d36aab0 smol cleanup 2024-08-05 12:40:06 +02:00
indev 6c764a8487 Fix chat not saving in console
Not sure why it was working before but broke now, maybe making va use snprintf instead of sprintf broke that
2024-08-04 16:57:24 +03:00
Alug dd6056a07a check if theres even controllers in rumble ticker 2024-08-04 14:53:24 +02:00
Alug a83d364ba7 update led status in main loop
makes this whole ordeal alot less hacky tbh
player color always gets updated if it changes
still allows for directly setting led color elsewhere by using G_SetPlayerGamepadIndicatorColor directly
hoping crap doesent cost any perf but honestly shouldnt
2024-08-04 14:53:21 +02:00
Alug 9c4b2b0abf no need for this 2024-08-04 14:53:18 +02:00
Alug 4235801ae4 proper pass fwrapv to gcc 2024-08-04 14:53:16 +02:00
Alug 6791f2e883 forgor 2024-08-04 12:50:39 +02:00
Alug caeec35c66 fix warning in director 2024-08-04 12:50:02 +02:00
Alug 7b95df150a support gcc 14.2.1 + fix some stuff 2024-08-04 12:49:59 +02:00
Alug 852651cefe better statdisplay offsets in splitscreen
lots of trial and error.....
2024-08-03 23:50:03 +02:00
Alug 22b9915ad7 smol fix to viewroll interp 2024-08-03 22:50:46 +02:00
Alug 0f994a0676 expose viewroll to lua 2024-08-03 22:50:42 +02:00
indev 5d68fd690b Add ctrl-w (delete word), ctrl-left (move to word beginning) and ctrl-right (move to word end) shortcuts for console 2024-08-03 23:19:54 +03:00
Alug c55bc6db4d Merge branch 'Saturn-Next' into absolutehell 2024-08-03 21:46:13 +02:00
Alug a77d8b4762 fix spriteshadows 2024-08-03 21:44:28 +02:00
Alug 23596d2516 add controller rumble to menu 2024-08-03 21:26:08 +02:00
indev 352b958da1 Fix few remaining uses of this_scale and ty
Not too sure if this is correct tho
2024-08-03 22:06:18 +03:00
Alug e9f2ef1422 Merge branch 'Saturn-Next' into absolutehell 2024-08-03 20:48:37 +02:00
Alug 7baa711744 this somehow was not reverted 2024-08-03 20:48:31 +02:00
indev 65e274a65f Smol safeguard for R_PointToDist2 2024-08-03 21:27:25 +03:00
Alug a874691bce Merge branch 'Saturn-Next' into absolutehell 2024-08-03 18:02:42 +02:00
Alug d60d101e75 dont set localangle or smth 2024-08-03 18:02:36 +02:00
Alug 8d9a648dce misplaced this 2024-08-03 18:02:21 +02:00
Alug 2332cc76ee Merge branch 'Saturn-Next' into absolutehell 2024-08-03 17:44:05 +02:00
Alug 5c3a2bf5be make inline macros for pointtodist 2024-08-03 17:43:57 +02:00
Alug 5e2b50c49e add very light rumble to brakedrift 2024-08-03 17:43:53 +02:00
Alug 3a56bf2bb5 fix up ogl sprite drawers, fix floor clip fix remove ty and reduntand hires stuff 2024-08-03 17:43:47 +02:00
Alug 3f4afb604a check if displayplayer skincolor is availible before returning it 2024-08-03 17:43:25 +02:00
Alug 77a2976d05 smol interp fixes 2024-08-03 17:43:17 +02:00
Alug 0eda508cf6 revert some lightlevel stuff in hw_main 2024-08-03 17:43:13 +02:00
Alug 4301e0f750 make this more explicit 2024-08-03 17:43:09 +02:00
Alug c5eb81c26a remove redundant check 2024-08-03 17:43:05 +02:00
Alug 47d3cf3e62 change rumble ticker loop a bit 2024-08-03 17:42:59 +02:00
Alug 41dc34efe8 set default duration to 84 2024-08-03 17:42:53 +02:00
Alug 4acbca4c8f do not constantly reset rumble
so it can work from lua
2024-08-03 17:42:47 +02:00
Alug 11329d5794 throw rumble ticker into right place 2024-08-03 17:42:44 +02:00
Alug b0880607d4 fix cassting, make one tic duration default, but can still pass ms to it 2024-08-03 17:42:39 +02:00
Alug 2afa18bbdd add duration field to G_PlayerDeviceRumble
duration is in ms
2024-08-03 17:42:35 +02:00
Alug acad230daa expose rumble and led to lua 2024-08-03 17:42:31 +02:00
Alug 49fcf3e486 rename to G_SetPlayerGamepadIndicatorColor 2024-08-03 17:42:26 +02:00
Alug acb0144742 splitscreen support for rumble 2024-08-03 17:42:21 +02:00
Alug 6efc8fdad3 add splitscreen support to gamepad led
also add more proper device check
2024-08-03 17:42:18 +02:00
Alug c75e6ba63c add basic rumble support for gamepads 2024-08-03 17:42:14 +02:00
Alug 7bd1808c88 change gamepad rgb color when switching viewpoints 2024-08-03 17:42:04 +02:00
Alug fe8e00895a simplify reduntand condition 2024-08-03 17:42:00 +02:00
Alug 9dc5e3d338 ressting to defaultcolor should also set led color 2024-08-03 17:41:29 +02:00
Alug 694c1ad808 change color light when you cycle between colors in player setup 2024-08-03 17:41:18 +02:00
Alug 754b028623 give rgb custom color support, change rgb light color earlier in Color_OnChange
so it always unconditionally changes the color
also
2024-08-03 17:41:14 +02:00
Alug 4423fb300f set controller rgb to playercolor
eh only for 1st player now no splitscreen support
idk if everything here is even correct
2024-08-03 17:41:06 +02:00
Alug 5c7d9327e3 SDL: only react to window focus changes if state actually changes 2024-08-03 17:40:41 +02:00
Alug cd72bce3cb dont reload palette until config was loaded 2024-08-03 17:40:34 +02:00
Alug 64ef0465d5 calloc soundchannels insteal of mallocing 2024-08-03 17:40:28 +02:00
Alug fe6ad4f762 Do not run ST_Ticker if dedicated 2024-08-03 17:39:54 +02:00
Alug 4b69b39d39 HMS_fetch_rules: Return NULL if the curl connection failed, instead of producing garbled rules 2024-08-03 17:39:44 +02:00
Alug a6fc237c88 try to prevent potential infinite SIGARBT hang in signal handler 2024-08-03 17:39:40 +02:00
Alug 2448a0b735 Cache pk3 central directory and Refactor ResFindSignature to work in chunks
https://github.com/KartKrewDev/RingRacers/commit/8ca2dc77e75b1ba8c511380257f0bbaf6d21c27b
https://github.com/KartKrewDev/RingRacers/commit/dedd0047bd8f9f73aba4defc19c429af7c987983
2024-08-03 17:39:36 +02:00
Alug 685220140a fix potential crash on nix while quitting 2024-08-03 17:39:32 +02:00
Alug 99779629d0 dont always reset texture depth in ogl 2024-08-03 17:39:27 +02:00
Alug 9fceabed8f Ensure Z_Malloc provides same alignment as libc 2024-08-03 17:39:22 +02:00
Alug e11363db3a Fix sound falloff calculation overflow 2024-08-03 17:39:17 +02:00
Alug 023cade51d smol fix to frameskipping 2024-08-03 17:39:12 +02:00
Alug d675b98330 Revert "Fix mobj reference management of player->mo"
This reverts commit c5ec61baa5.
2024-08-03 17:38:15 +02:00
Alug b3f16e935d Revert "more mobj reference fixes + cleanup"
This reverts commit bd8ff77fe0.
2024-08-03 17:37:46 +02:00
Alug 5b9e179017 Revert "dont access delayremoved thinkers"
This reverts commit df9ad5a31f.
2024-08-03 17:37:12 +02:00
Alug 6f53263107 Revert "Clean up mobj and thinker removal"
This reverts commit 048ccf52b0.
2024-08-03 17:37:06 +02:00
Alug fd797436fa Revert "fix declaration"
This reverts commit 8f195530b5.
2024-08-03 17:36:53 +02:00
Alug 96ee117657 Revert "more reference fixes"
This reverts commit 94bd1cb37b.
2024-08-03 17:36:31 +02:00
Alug 8b60fb6b6c revert this 2024-08-03 17:36:07 +02:00
Alug 67542d3cf1 i didnt knew k_positiondelay exists 2024-07-29 20:16:21 +02:00
Alug 41e97ffa79 another smol fix to director 2024-07-29 16:40:43 +02:00
Alug ffcff99a79 lower breakawaydist in director 2024-07-29 15:42:20 +02:00
Alug 48bcaacada fix K_DrawDirectorDebugger 2024-07-29 15:42:17 +02:00
Alug 01b060b0fe cleanup k_director 2024-07-29 15:42:15 +02:00
Alug 51ce092a6a lower pinchdist in director
since we cant get an accurate value for distance to finish line, this should do it perhaps
2024-07-29 15:42:12 +02:00
Alug d09e02721b e 2024-07-27 15:56:56 +02:00
Alug 88b81aa28b e 2024-07-27 15:56:51 +02:00
Alug 84c4f4f428 Merge branch 'Saturn-Next' into absolutehell 2024-07-27 15:49:46 +02:00
Alug ab5bc92a95 Revert "raise MAXVISSPRITES for 64-bit again"
This reverts commit d5258786e5.
2024-07-27 15:49:39 +02:00
Alug b44dd3edf0 Merge branch 'Saturn-Next' into absolutehell 2024-07-27 15:04:09 +02:00
Alug 80498a78ea lagless cam toggle 2024-07-27 15:03:59 +02:00
Alug 40663eb2b5 lagless cam test 2024-07-27 15:03:55 +02:00
Alug dca2827154 this is not a server cvar lol 2024-07-27 15:03:43 +02:00
Alug eec069b4e8 Merge branch 'rrdirectorport' into Saturn-Next 2024-07-27 14:42:26 +02:00
Alug 26eedc3341 small change to director for battle 2024-07-27 14:39:08 +02:00
Alug b19cefee3c Merge branch 'Saturn-Next' into rrdirectorport 2024-07-27 14:39:04 +02:00
Alug fb54b969d1 toggle for laptimes 2024-07-27 14:38:58 +02:00
Alug 034724b03e Show last lap time on HUD
god this is kinda ass lol
doesent work when you join midgame so disabled for there
2024-07-27 14:38:53 +02:00
Alug b80762eaf5 rename draw dist settings 2024-07-27 14:38:45 +02:00
Alug d5258786e5 raise MAXVISSPRITES for 64-bit again 2024-07-27 14:38:42 +02:00
Alug 9bfe2d3138 add more sprite draw dist settings for 64bit clients 2024-07-27 14:38:38 +02:00
Alug ae3b3f750d when no autoload config is found skip everything in D_AddAutoloadFiles
stuff doesent need to run if theres nothing to autoload so things can be skipped
2024-07-26 15:03:17 +02:00
Alug f83090e299 when no autoload config is found skip everything in D_AddAutoloadFiles
stuff doesent need to run if theres nothing to autoload so things can be skipped
2024-07-26 15:03:12 +02:00
Alug 3e4f497cbc Merge branch 'Saturn-Next' into absolutehell 2024-07-26 14:29:26 +02:00
Alug ce2398fdb7 add some extra safety to orbit and bananachain funcs 2024-07-26 14:29:14 +02:00
indev f545cce6fe Add check for if lua state exist in UnArchiveExtVars, since server can have local luas that may add player/mobj fields into savegame 2024-07-26 14:29:10 +02:00
Alug f614725fcb some cleanup 2024-07-26 14:29:03 +02:00
Alug 59e4f9ce4a 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-26 14:29:00 +02:00
Alug dff6b15263 fix fail condition 2024-07-26 14:28:57 +02:00
Alug 977ee8ccfc make backup of kartconfig before writing to it 2024-07-26 14:28:54 +02:00
Alug 161815e6fb Merge branch 'Saturn-Next' into absolutehell 2024-07-24 15:02:42 +02:00
Alug 8dda864909 toggle palrendering and fbo off if screen textures are disabled 2024-07-23 20:32:18 +02:00
Alug f6f9542d6e add cam check here 2024-07-23 20:32:16 +02:00
Alug 6655c0d881 reset tilt when respawning 2024-07-23 20:32:13 +02:00
Alug 98c8176d59 simplify this 2024-07-23 20:32:10 +02:00
Alug 2e7f64458d forgor this 2024-07-23 20:32:07 +02:00
Alug d6a9cdc452 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 20:32:05 +02:00
Alug 17dbe77cd3 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:27 +02:00
Alug 4b71d9a48d add "allowsaturnjoin" cvar to let toggle allowjoin for saturn clients seperately 2024-07-23 17:45:25 +02:00
Alug 1f41cb9a3f e 2024-07-23 00:59:20 +02:00
Alug c6351c6c53 add to menu 2024-07-23 00:55:55 +02:00
Alug 283218f2d6 changuer how this works
counter decrements - 1 double the cooldown time
2024-07-23 00:47:39 +02:00
Alug 4de22e9d66 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-23 00:47:34 +02:00
Alug b4a737d910 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-23 00:47:13 +02:00
Alug 0f2c17324a Merge branch 'Saturn-Next' into absolutehell 2024-07-23 00:47:03 +02:00
Alug 6a1b10eaf9 Make polyobjects agree with sector lighting/colormap like a FOF. 2024-07-23 00:46:58 +02:00
Alug 824211c2f6 prevent potential level load crash 2024-07-23 00:46:54 +02:00
Alug 02d115f119 don't check flippedness in HWR_RotateSpritePolyToAim if the mobj is actually a precipmobj! 2024-07-23 00:46:52 +02:00
Alug b44617413b gitignore deez 2024-07-22 12:59:07 +02:00
Alug c447f25e0a add missing copyright stuff to k_director 2024-07-22 12:57:11 +02:00
Alug 34ce92d9fa Merge branch 'Saturn-Next' into absolutehell 2024-07-21 23:29:11 +02:00
Alug 7ad5dc61ac Revert "Free mipmaps before freeing tags"
This reverts commit 2437c5a19a.
2024-07-21 23:25:10 +02:00
Alug 7072332ab7 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 22:50:04 +02:00
indev 60e933eb00 Add director hud indicator 2024-07-21 22:49:59 +02:00
Alug 43e3d07acb fix cmake 2024-07-21 22:49:54 +02:00
indev 228252ee6f Add bind for director toggle 2024-07-21 22:49:51 +02:00
Alug 56a919eb60 oops 2024-07-21 22:49:47 +02:00
Alug bfcb906b12 add stuff for directordebugger i forgor 2024-07-21 22:49:41 +02:00
Alug b94776063f 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 22:49:38 +02:00
Alug 3f412373bc fix crash if everyone spectates 2024-07-21 22:49:35 +02:00
Alug e7d1858052 port director from RR 2024-07-21 22:49:31 +02:00
Alug bd106308fc revert this
doesent do anything but complicate stuff lol
2024-07-21 22:46:07 +02:00
Alug 6ec96b37bd remove hw_light 2024-07-21 22:38:57 +02:00
Alug 3653786e14 cleanup hw_main 2024-07-21 22:24:55 +02:00
Alug 5824d9e803 cleanup r_things a little 2024-07-21 22:24:51 +02:00
Alug 3ad3cdfa38 stop yelling clang 2024-07-21 22:24:49 +02:00
Alug efcd1df365 fix this oops 2024-07-21 22:24:46 +02:00
Alug aef62c45de smol cleanup
also check for splitscreen and if not dont run a for loop lul
2024-07-21 22:24:44 +02:00
Alug 94bd1cb37b more reference fixes 2024-07-21 22:24:41 +02:00
Alug f7bf3fe510 cleanup hw_main 2024-07-21 22:24:28 +02:00
Alug a771ebf0e8 cleanup r_things a little 2024-07-21 22:24:21 +02:00
Alug 6b4d02ae99 stop yelling clang 2024-07-21 22:24:15 +02:00
Alug 3e6cab1ec9 fix this oops 2024-07-21 22:24:11 +02:00
Alug 147c59c26b smol cleanup
also check for splitscreen and if not dont run a for loop lul
2024-07-21 22:24:09 +02:00
Alug db6f76d12d more reference fixes 2024-07-21 22:24:01 +02:00
Alug 86950c26d0 add check here too 2024-07-21 11:49:48 +02:00
Alug e1d4f10223 add "gamestatecooldown" cvar
to be able to change the cooldown between gamestate resends
2024-07-21 11:49:21 +02:00
Alug 01c1ae42a1 fix saturn packet going the wrong way 2024-07-20 18:30:10 +02:00
Alug 550871f576 smol cleanup 2024-07-20 18:21:19 +02:00
Alug 56fcca1f6b mark if node can receive savegame so it doesent run resynch code on em
should prevent some issues for when a client received gamestate but thinks it needs to be resynched getting stuck
2024-07-20 18:15:42 +02:00
Alug 930bde785c just reset everything resynchwise here 2024-07-20 16:24:36 +02:00
Alug 13aadc41ff should reset those here perhaps 2024-07-20 16:22:51 +02:00
Alug ea4998f666 add gamestate resend ontop of resynch code lmao
absolute hell
will fallback to just normal resynching when the client doesent send gamestate request packet
2024-07-20 16:17:19 +02:00
Alug 6f0e92e0d1 Merge branch 'Saturn-Next' into absolutehell 2024-07-20 15:02:41 +02:00
Alug a4085cb155 fix hoop midjoin crash in the dumbest way possible
cant figure out why it crashes so thisll do lol
2024-07-19 22:57:18 +02:00
Alug b7e77e10b6 improve virtual resource management 2024-07-19 22:57:16 +02:00
Alug 8f195530b5 fix declaration 2024-07-19 21:29:10 +02:00
Alug 048ccf52b0 Clean up mobj and thinker removal 2024-07-19 21:26:42 +02:00
Alug df9ad5a31f dont access delayremoved thinkers
uhhh
2024-07-19 21:26:02 +02:00
Alug 0b3284e23c fix ScreenCoords on 2 plyr splitscreen and shearing
+ remove non 16:10 hack since that issue was fixed elsewhere
2024-07-19 19:25:20 +02:00
Alug 36d598440a disable hudoffsets in splitscreen 2024-07-19 19:25:18 +02:00
indev 9cc42e6430 Add option to play power items sfx for growmusic and supermusic 2024-07-19 19:03:47 +03:00
Alug 3f5c19bffd add boolean to tell if node is saturn 2024-07-19 15:01:30 +02:00
Alug 800dbf5e78 add packet into packettypename 2024-07-19 15:00:45 +02:00
Alug 2b5db9ff3f make saturn packet reliable 2024-07-19 14:46:24 +02:00
Alug b07c8848ca make smol function for now 2024-07-19 14:43:19 +02:00
Alug 9bff8dd91f whoopss remove test stuff 2024-07-19 14:40:25 +02:00
Alug 19eee66c39 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:40:23 +02:00
Alug fbf7be8808 add audio buffer size into sound menu 2024-07-18 14:43:14 +02:00
Alug fcda4c1188 revert this in teleport 2024-07-17 22:19:11 +02:00
Alug deae234afa Revert "clean up mapload code a little more"
This reverts commit 79a5d174a5.
2024-07-17 12:21:05 +02:00
indev 82e33fd4e4 Attempt to fix possible use-after-free for awayviewmobj 2024-07-17 12:30:34 +03:00
Alug 15914c2f25 Skip over empty entries when populating vres, saving memory 2024-07-17 11:13:07 +02:00
Alug da64d3ccbf 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:12:58 +02:00
Alug 79a5d174a5 clean up mapload code a little more 2024-07-17 09:21:15 +02:00
indev 295d9768ce Fix linedef 415 executing random text if script lump doesn't have null terminator 2024-07-16 16:42:32 +03:00
Alug 9490b1235d did not mean to add this lol 2024-07-16 10:43:55 +02:00
Alug 55eb984ccd remove this check 2024-07-15 21:58:00 +02:00
Alug 4b1a82e14e fix more warnings 2024-07-15 21:43:25 +02:00
Alug 3c224923e9 fix some warnings in clang 2024-07-15 21:19:25 +02:00
Alug 2c4f5a68b9 fix A_ action protottypes 2024-07-15 21:10:11 +02:00
Alug d324c917ad Revert "fix some clang warnings"
This reverts commit fea89de037.
2024-07-15 20:57:09 +02:00
Alug bd8ff77fe0 more mobj reference fixes + cleanup 2024-07-15 13:56:28 +02:00
Alug 35d40e1d37 ndef 2024-07-14 17:30:52 +02:00
Alug e9e281fd2a clean up some net stuff 2024-07-14 17:22:25 +02:00
Alug 2437c5a19a Free mipmaps before freeing tags
ŝhould hopefully fix some random Z_free crashes
2024-07-14 17:17:01 +02:00
Alug b9b4de929d this does nothing lol 2024-07-14 17:15:43 +02:00
indev 28fc55b653 Refactor music name scrolling in music test 2024-07-14 15:33:31 +03:00
Alug 8f4df0ceca version string otherwise i forger 2024-07-14 10:18:27 +02:00
Alug ecde8a5e8b shut up 32bit gcc 2024-07-14 10:17:47 +02:00
Alug 715b106c9e shut up windoze 2024-07-14 09:51:13 +02:00
Alug 2114afa536 inline M_Memcpy 2024-07-13 16:04:43 +02:00
Alug c78816a8d1 also use IFCHANGED macro for levelinterpolators
just looks a bit neater
2024-07-13 16:04:41 +02:00
Alug 28516c4833 fix NOHW compile 2024-07-13 14:55:10 +02:00
Alug 837ed3535d Revert "smol optimization to HWR_Addline"
This reverts commit e6359663b1.
2024-07-13 13:06:45 +02:00
Alug bcb332e88f Revert "shut up gcc"
This reverts commit 17a5c6ed06.
2024-07-13 13:06:42 +02:00
Alug f4be7a8034 Revert "dont do this with portals"
This reverts commit f949fa54af.
2024-07-13 13:06:39 +02:00
Alug e69413f1e8 smol cleanup 2024-07-10 19:31:35 +02:00
Alug ee6dcfc678 fix conflict 2024-07-10 19:31:22 +02:00
Alug d4370a1811 clean up P_SetupLevel a little more 2024-07-10 19:31:17 +02:00
Alug babf4ca06a Map data lump interface
cleans up code alot and stuff

https://git.do.srb2.org/STJr/SRB2/-/merge_requests/535
2024-07-10 19:30:38 +02:00
Alug ccf0905469 change when dynamic slopes run depending on if you joined midgame 2024-07-10 19:29:48 +02:00
Alug 970130e02b mitigate dynamic slope desynchs
Perform dynamic slope thinking before other thinkers.
2024-07-10 19:28:44 +02:00
Alug 6088fa5134 Clean up graphic menus
- Renamed Experimental Options to Advanced Options
- Fixed the tooltips not displaying
- Made it look good again
2024-07-10 19:25:49 +02:00
indev 33bc484d69 Call ServerJoin hook when consoleplayer becomes available, since it is needed for configs (which what this hook is created for) 2024-07-10 19:09:14 +02:00
indev 6bf113d0ff Add info about ServerJoin into LUASTUFF.md (so i don't forget to do it later) 2024-07-10 19:09:11 +02:00
indev 630d910a9e Add ServerJoin lua hook, which gets called when client joins a server (listen server hosts joining their server also count) 2024-07-10 19:09:08 +02:00
Alug 3c70963f56 only interpolate pitch and roll when using 3d models
sprites dont need this for now
2024-07-10 18:58:55 +02:00
Alug 4c4f6f6d80 dont think precip mobj angle ever changes 2024-07-10 18:58:52 +02:00
Alug f949fa54af dont do this with portals 2024-07-10 18:58:05 +02:00
Alug 17a5c6ed06 shut up gcc 2024-07-10 18:58:02 +02:00
Alug e6359663b1 smol optimization to HWR_Addline 2024-07-10 18:57:59 +02:00
Alug 405cef6a01 fix IFCHANGED macro 2024-07-10 18:32:22 +02:00
Alug d4886f8923 forgor this 2024-07-10 10:18:50 +02:00
Alug c5ec61baa5 Fix mobj reference management of player->mo
https://git.do.srb2.org/KartKrew/RingRacers/-/commit/d0719ef5ba86a1da32fed171d74eb76c7254f4f6
2024-07-10 10:18:46 +02:00
Alug 7a9ffa7ee8 test remove all the networking crap from rendering code 2024-07-10 10:13:53 +02:00
Alug 5ff665a073 remove those 2 from experimental video menu
no reason to ever toggle them off
2024-07-10 10:08:19 +02:00
Alug 3d4e078a90 another m_menu moment 2024-07-10 10:07:51 +02:00
Alug 8ef613ef9b remove cv_mobjssector
idk why it even checks for pointinsubsector
2024-07-10 10:06:31 +02:00
Alug 988a672dea remove cv_grfofcut
same story
2024-07-10 09:59:50 +02:00
Alug cca9c51315 remove cv_slopepegfix
same as the other ones
2024-07-10 09:57:23 +02:00
Alug 18aa3689d9 m_menu moment 2024-07-10 09:54:43 +02:00
Alug 59ab6572b1 remove cv_fofzfightfix
more bloat
2024-07-10 09:54:03 +02:00
Alug b6cf933159 remove R_Pointtoangle toggle
its bloat, the difference is negigble at best
2024-07-10 09:50:25 +02:00
Alug 48f36ca8f3 35/2 != 17 = 17.5 ? 2024-07-10 04:55:01 +02:00
Alug fea89de037 fix some clang warnings 2024-07-10 04:53:28 +02:00
Alug e2f1dd1ce8 a 2024-07-10 04:51:59 +02:00
Alug 48ac3353cb Maybe hopefully fix ogl masterserver crash thing
port from durr
2024-07-10 04:51:52 +02:00
Alug 63015c3a93 Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2024-07-10 04:50:06 +02:00
Alug c7bd402e54 Merge remote-tracking branch 'origin/packetstat' into Saturn-Next 2024-07-10 04:49:58 +02:00
Alug 0c6f9b6cc1 basic frame skipping system 2024-07-10 04:49:32 +02:00
Alug b5d7b84c1e more changes to dither
use interger for distance scales
start z factor earlier
rename halfResolution to endResolution
2024-07-09 09:06:19 +02:00
Alug cbbde8dea5 more tweaks 2024-07-08 21:43:06 +02:00
Alug 58dd0b7591 oops that actually didnt fade out at all lol 2024-07-08 21:43:03 +02:00
Alug d9f2535402 scale and fade out dither pattern
makes the image a bit cleaner and easier to look at in palrender
2024-07-08 21:43:00 +02:00
Alug 66eb201466 simplify this a little 2024-07-08 21:42:53 +02:00
Alug edbf20d975 oops this should be min 2024-07-08 21:42:49 +02:00
Alug 711d7dcfcc Always use system-specific path seperator
https://git.srb2.org/KartKrew/RingRacers/-/commit/0f16c61d04f42b463db5c8987571fc986ae6ce9f
2024-07-08 21:42:38 +02:00
Alug 219979e20b dont think kart even supports trivial maps
so no need to constantly check for this
2024-07-08 21:42:36 +02:00
Alug 27917a0e85 shut up gcc 2024-07-03 17:37:29 +02:00
Alug 4b4b2d5cbc some crap from asan 2024-07-03 17:37:16 +02:00
Alug 8d968d7f89 fix some clang warnings 2024-07-03 17:36:37 +02:00
Alug 9090a5cd73 Merge pull request #131 from Indev450/optimizeluaactions
Only call the Lua API for overridden actions
2024-07-03 11:10:15 +00:00
Alug 59a50994b8 Merge branch 'Saturn-Next' into optimizeluaactions 2024-07-03 13:10:03 +02:00
Alug ac99a6ac3c Merge pull request #132 from Indev450/lua-hooks-table
Store hooks in a table with integer keys instead of registry with string keys
2024-07-03 11:08:58 +00:00
Alug fa2257ad3b Merge pull request #133 from Indev450/luafieldlookup
Optimize field lookups in Lua metatables
2024-07-03 11:08:44 +00:00
NepDisk 66ce0871bc Fix automap multiplayer crash
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2488
2024-07-03 13:07:29 +02:00
Alug c59564723c 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:07:17 +02:00
Alug 606717d253 prevent potential crash when trying to kill bananachain 2024-07-03 13:07:13 +02:00
Alug f73e84e0ad stuff 2024-07-03 13:07:04 +02:00
Alug fc01453544 scale dithering a little diff for a little smoother "fade" in pal render 2024-07-03 13:07:00 +02:00
Alug d37a1c799f change dither matrix to 4x4
a little grittier also smol cleanup
2024-07-03 13:06:57 +02:00
indev 3456ef96a7 Use a fake 2d array in dither shader so it compiles with older glsl versions (1.20 at least) 2024-07-03 13:06:53 +02:00
indev 40143375fc If shader compilation failed, print info log 2024-07-03 13:06:50 +02:00
Alug 7f34a1d83e add gr_lightdithering to shader
mhhm dithering
2024-07-03 13:06:47 +02:00
Alug 2316c117b1 improve teleport interpolation stuff 2024-07-03 13:06:44 +02:00
Alug 31b7482c3a small optimization to batching 2024-07-03 13:06:40 +02:00
Alug 0974625769 no need for this 2024-07-03 13:06:36 +02:00
Alug 266f5149b5 smoller opitmizations 2024-07-03 13:06:25 +02:00
Alug 008a9b9b3f optimize ogl polyobjs slightly 2024-07-03 13:06:22 +02:00
Alug ec2fd5b38f prevent crash in hw bsp 2024-07-03 13:06:19 +02:00
Alug d449a1b714 remove this again 2024-07-03 13:06:16 +02:00
NepDisk 0bd5ca5e3f Allow Users to Connect to Servers While In-Game
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2401/
2024-07-03 13:06:12 +02:00
NepDisk 06248e5388 Linux customshader compilation fix
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2418/
2024-07-03 13:06:09 +02:00
Alug 9c5a0ed7ee move HWR_LoadLevel to hw_main 2024-07-03 13:06:04 +02:00
Alug b199354167 this should be called on mapload 2024-07-03 13:06:02 +02:00
Alug 74ce725e3d oops 2 2024-07-03 13:05:59 +02:00
Alug 3d5e033158 oops 2024-07-03 13:05:56 +02:00
Alug ca58c1dee2 these appear to be unused so comment them out
dont need 6 arrays being allocated with MAXSKINS for nothing lul
2024-07-03 13:05:53 +02:00
Alug d51a69b052 Merge remote-tracking branch 'origin/lua-enumlib-sfxslotsfix' into Saturn-Next 2024-07-03 13:05:48 +02:00
Alug 1a96d96837 forgor this 2024-07-03 13:05:45 +02:00
Alug 2e7cd51ff8 limit localskins to 32
hope this doesent just die lol
2024-07-03 13:05:42 +02:00
Alug 112716dae5 Do not access memory on misaligned addresses
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2438
2024-07-03 13:05:39 +02:00
indev c13e780f29 Try fix glib preallocating too much space for sound freeslots 2024-06-20 16:55:58 +03:00
Alug c35887f5ee Revert "fix some interpolation issues"
This reverts commit e19f6f6656.
2024-06-17 12:52:09 +02:00
Alug 2f55c10ce3 Revert "more interp fixes"
This reverts commit 3a1a58bcfc.
2024-06-17 12:52:00 +02:00
Alug 0068312ce3 Revert "revert this part"
This reverts commit efe7dd23b6.
2024-06-17 12:51:57 +02:00
Alug ea49d92932 add missing HAVE_THREADS 2024-06-13 14:47:28 +02:00
Alug efe7dd23b6 revert this part
idk if that was netsafe so
2024-06-12 22:36:03 +02:00
Alug 3a1a58bcfc more interp fixes 2024-06-12 22:35:21 +02:00
Alug 953862f133 change this to int64 cause it fixes the intermission thing on high res
idk why that fixes it tbh but it does
2024-06-12 22:34:02 +02:00
Alug 41eb2ee969 fix oopsie on titled software wöter 2024-06-12 22:33:51 +02:00
Alug 225ecce676 lower min audio buffersize to 256 2024-06-12 22:33:44 +02:00
Alug 335b10a694 forgor 2024-06-12 22:33:36 +02:00
Alug 967220178c remove windows timing crap again
it actually made stuff a little wonky so revert that
2024-06-12 22:32:54 +02:00
Alug be7461ad51 use sdl ogl render instead of software for software mode on nix
oops
2024-06-12 22:31:53 +02:00
indev 5af7cf850a Fix string format warning for packetstat 2024-06-12 21:26:41 +03:00
indev 86395d4d8b Add a way to count number of handled packets (for debugging) 2024-06-12 21:05:21 +03:00
Alug 3412bb5380 fix encore flipcam with ogl shearing 2024-06-09 22:02:52 +02:00
Alug d66e7e660d reset those here ig
need a better place tbh
but those occasionally could get stuck for some reason
so just reset them when the menu gets opened
2024-06-09 18:56:18 +02:00
Alug 07d631e320 e 2024-06-09 18:55:52 +02:00
Alug 6ffb50530d add mobj check here 2024-06-09 18:55:49 +02:00
Alug bd7103d109 add check earlier in p_killmobj 2024-06-09 18:55:46 +02:00
Alug 4abc2ab5bd fix redifinition warning 2024-06-06 18:58:03 +02:00
Alug f8a8b8ac6e disable upx on nix by default 2024-06-06 18:58:00 +02:00
Alug cfe6e08168 fix masterserver ifdef 2024-06-06 18:57:57 +02:00
Alug 5139259037 fix HAVE_CURL 2024-06-06 18:57:55 +02:00
Alug 1503daf02b more minor loop stuff 2024-06-06 18:57:52 +02:00
Alug 4246e42948 minor sprite opitmizations 2024-06-06 18:57:31 +02:00
Alug 9b3eaa6fe8 smol optimization to skin loading 2024-06-06 18:57:25 +02:00
Alug 716685d809 zzz... 2024-06-03 17:15:43 +02:00
Alug dd72871ba6 Revert "use shader to prevent sprite floor clipping"
This reverts commit ee2ec01eb9.
2024-06-03 17:15:39 +02:00
Alug ea510f95b8 Revert "fix le dispoffset"
This reverts commit f977af6a80.
2024-06-03 17:15:36 +02:00
Alug 9de3db7c97 add shader for shadows to also fix sprite shadows in pal render 2024-06-03 16:52:25 +02:00
indev 0e927ce4bd Make sfxinfo_t and state_t use field tables too 2024-06-02 00:43:42 +03:00
indev 1747ebf481 Lua_optoption shouldn't change stack state at the end of call now 2024-06-02 00:43:09 +03:00
indev da9d57a624 Fix compilation for some gcc versions 2024-06-02 00:39:22 +03:00
Alug 086d0113c5 Optimize field lookups in Lua metatables
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2024#cd5b5ee262bf5129c4d400ad60d006e1fa917c1f
2024-05-28 18:16:43 +02:00
Alug 8cf6050d10 Only call the Lua API for overridden actions 2024-05-25 16:01:34 +02:00
indev b310168c12 Store hooks in a table with integer keys instead of registry with string keys 2024-05-25 16:39:16 +03:00
208 changed files with 27684 additions and 34015 deletions

No files matched your search

+346
View File
@@ -0,0 +1,346 @@
#!/bin/bash
set -e # Enable auto-exit for debugging :))
# Make Linux AppImage program data
# https://docs.appimage.org/reference/appdir.html
# PWD: {repo_root}/build
# See deployer.sh for usage
# Terminal stuff
RESET="$(tput sgr0)" #"\e[0m" # Resets terminal colors
# Colors for various information types
FAILURE="$(tput setaf 1)" #"\e[91m"
SUCCESS="$(tput setaf 2)" #"\e[92m"
NOTICE="$(tput setaf 3)" #"\e[93m"
VERBOSE="$(tput setaf 4)" #"\e[94m"
verbosity=0 # By default don't print anything unless it's *ultra* important.
quiet=0 # Also don't print anything if they supplied the quiet argument
# URL from which to download appimagetool if there isn't one available in your $PATH
# at time of writing only aarch64, armhf, i686, and x86_64 versions are available via this method
# in those cases, and honestly even outside of those cases, it's better to just put a working one in your $PATH yourself..
url="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$(uname -m).AppImage"
# A whitelist of libraries to include into SRB2's AppImage if SRB2 is dynamically linked.
# please don't add a newline at the end of this or i will cry :(
libraryWhitelist="
libbacktrace
libnsl
libSDL2
libSDL2_mixer
libgme
libopenmpt
libpng
libfluidsynth
libpulse
libmodplug
libvorbisfile
libopusfile
libFLAC
libmad
libmpg123
libvorbis
libpulsecommon
libsndfile
libsndio
libogg
libvorbisenc
libjson
libreadline
libwrap
libtinfo
libtirpc
libpng16"
# these kinda look like macros don't they
function print { (( "$quiet" == 0 )) && echo "$@" || :; } # echo if not quiet
function coloredText { printf "$1"; print "${@:2}"; printf "$RESET"; } # use print to inherit quiet
function success { coloredText "$SUCCESS" "$@"; } # use coloredText to inherit quiet
function important { coloredText "$NOTICE" "$@"; } # use coloredText to inherit quiet
function verboseOnly { (( "$verbosity" >= $1 )) && (coloredText "$VERBOSE" "${@:2}") || :; } # use coloredText to inherit quiet
# Parses an argument with a single dash
function parseSingleDashArg() {
while read -n 1 char; do
if [[ "$char" == '-' || "$char" == '' ]]; then
:
elif [[ "$char" == 'h' ]]; then
helppassed=1
elif [[ "$char" == 'q' ]]; then
quiet=1
elif [[ "$char" == 'v' ]]; then
verbosity="$((verbosity + 1))"
elif [[ "$char" == 'd' ]]; then
dry=1
elif [[ "$char" == 's' ]]; then
small=1
else
echo "$0: invalid option -- '$1'"
echo "Try '$0 --help' for more information."
return 1
fi
done <<<"$1"
}
# Simple help argument checker.
currentarg=1; # Which argument is --help...
# For $arg in the argument array...
for arg in "$@"; do
# Is it a help argument?
if [[ "$arg" == "--help" ]]; then
helppassed=1; # Help is passed, set $helppassed!
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}" # Remove argument from list
elif [[ "$arg" == "--quiet" ]]; then
quiet=1
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
elif [[ "$arg" == "--verbose" ]]; then
verbosity="$((verbosity + 1))" # Increase verbosity!
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
elif [[ "$arg" == "--dry" ]]; then
dry=1; # Show parameters instead of using them.
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
elif [[ "$arg" == "--small" ]]; then
small=1; # Don't copy assets to save on bandwidth.
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}"
elif [[ ! "$arg" == *'--'* && "$arg" == *'-'* ]]; then
parseSingleDashArg "$arg"
if [[ "$?" == 0 ]]; then
set -- "${@:1:$currentarg-1}" "${@:$currentarg+1}" # Remove argument from list
fi
elif [[ $arg == *'--'* ]]; then
print "$0: invalid option -- '$1'"
print "Try '$0 --help' for more information."
return 1
else
currentarg="$((currentarg+1))" # Increment current argument number otherwise...
fi
done
important "SRB2Kart AppImage Packager v1.0 modified for kart by NepDisk."
important "Orignal for SRB2 my mazmazz and Golden."
# Get root directory from the full path of this script.
__ROOT_DIR="$3"
if [[ -z "$3" ]]; then
# finds out where this script is and goes to that directory and goes up one for the root
scriptdir="$(dirname "${BASH_SOURCE[0]}")"
scriptbase="$(basename "${BASH_SOURCE[0]}")"
__ROOT_DIR="$(cd "$scriptdir" && pwd -P)"
fi
# If it starts with '.', put the current working directory behind it so things work.
if [[ "$__ROOT_DIR" == '.' || "$__ROOT_DIR" == '..' ]]; then
__ROOT_DIR="$PWD/$__ROOT_DIR"
fi
# Set up defaults
__PROGRAM_NAME="${PROGRAM_NAME:-"SRB2Kart Saturn"}"
__PROGRAM_DESCRIPTION="${PROGRAM_DESCRIPTION:-"Modded version of SRB2kart with more features."}"
__PROGRAM_FILENAME="${PROGRAM_FILENAME:-"lsdl2srb2kart"}"
__PROGRAM_ASSETS="${PROGRAM_ASSETS:-"$__ROOT_DIR/assets/installer"}"
__BUILD_DIR="${1:-"$__ROOT_DIR/bin"}"
__OUTPUT_FILENAME="${2:-"$__PROGRAM_FILENAME.AppImage"}"
__APPIMAGETOOL="${4:-"appimagetool"}"
if (! command -v "$__APPIMAGETOOL" &> /dev/null); then
__APPIMAGETOOL=
fi
# Stuff that prints and exits.
# Prints setup text using method given by arguments.
# Example: printSetup "print" # print "Setup for AppImage...
function printSetup {
$@ "Setup for AppImage in BUILD_DIR: '$__BUILD_DIR'..."
$@ "With the OUTPUT_FILENAME: '$__OUTPUT_FILENAME'"
$@ "And SRB2 Repository Root ROOT_DIR: '$__ROOT_DIR'"
$@ "Using APPIMAGETOOL: '$([ -z "$__APPIMAGETOOL" ] && echo '(download)' || echo $__APPIMAGETOOL)'"
$@ ""
$@ "This should be run from a Makefile or from the directory of the build. If it is not, then change to that directory or specify that directory as an argument."
$@ "If ROOT_DIR isn't SRB2's repository root, specify that as an argument too."
$@ "Make must have built the program before you run this script."
$@ ""
$@ "Make sure these Environment Variables are correct."
$@ "If not, then enter: export PROGRAM_VARIABLE=value"
$@ "PROGRAM_NAME: $__PROGRAM_NAME"
$@ "PROGRAM_DESCRIPTION: $__PROGRAM_DESCRIPTION"
$@ "PROGRAM_FILENAME: $__PROGRAM_FILENAME"
$@ "PROGRAM_ASSETS: $__PROGRAM_ASSETS"
}
if [[ "$helppassed" ]]; then
print "Usage: $(basename "$0") [OPTION]... [BUILD_DIR] [OUTPUT_NAME] [ROOT_DIR] [APPIMAGETOOL]"
print "Packages a SRB2 binary into an AppImage."
print "OPTIONs may be included anywhere within the arguments."
print ""
print "Arguments:"
print " -h, --help display this help and exit."
print " -q, --quiet don't display any text."
print " -v, --verbose make commands more verbose, will always print."
print " -s, --small don't copy SRB2 assets to save on bandwidth."
print " parameters regardless of --dry."
print " -d, --dry print parameters and exit."
print ""
if (( "$verbosity" > 0 )) || [[ "$dry" ]]; then
printSetup "print"
else
print "This should be run from a Makefile or from the directory of the build."
print "Make must have built the program before you run this script."
fi
exit;
fi
if (( "$verbosity" > 0 )) || [[ "$dry" ]]; then
printSetup "verboseOnly" "0"
verboseOnly 0 ""
if [[ "$dry" ]]; then
set -n # Enable debug mode and verbose for dry run.
fi
fi
# End stuff that prints and exits.
if (( "$verbosity" >= 4 )); then
set -v # Really verbose? Print *everything*!
fi
# Define AppDir structure
mkdir -p "$__BUILD_DIR/AppDir/usr/bin"
mkdir -p "$__BUILD_DIR/AppDir/lib"
mkdir -p "$__BUILD_DIR/AppDir/usr/share/applications"
mkdir -p "$__BUILD_DIR/AppDir/usr/share/icons/hicolor/256x256/apps"
# Copy program data
if [[ ! $small ]]; then
verboseOnly 1 "Packaging program assets..."
cp -r "$__PROGRAM_ASSETS"/* "$__BUILD_DIR/AppDir/usr/bin/"
cp -r "$__BUILD_DIR/$__PROGRAM_FILENAME" "$__BUILD_DIR/AppDir/usr/bin"
else
verboseOnly 1 "Skipping program asset packing, --small or -s passed..."
fi
verboseOnly 1 "Packaging SRB2..."
verboseOnly 1 "Assuming executable name $__PROGRAM_FILENAME"
cp -r "$__BUILD_DIR/$__PROGRAM_FILENAME" "$__BUILD_DIR/AppDir/usr/bin"
# Copy required dependencies, but only if the program is dynamically linked.
verboseOnly 1 "Testing if this build is dynamically linked..."
set +e # Disable auto-exit for ldd.
srb2Libraries="$(ldd "$__BUILD_DIR/$__PROGRAM_FILENAME")"
exitcode="$?"
set -e # Enable it again!
if (( $exitcode == 0 )); then
verboseOnly 1 "This build *is* dynamically linked! Packaging dependencies."
# read the dynamic libraries of srb2, trim off beginning whitespace, and get the third field seperated by spaces
# this gives us a newline-seperated list of libraries with their full paths.
srb2Libraries="$(echo "$srb2Libraries" | cut -f 2 | cut -d ' ' -f 3)"
# remove any extraneous newlines around the string
libraryWhitelist="$(echo $libraryWhitelist | head -c -1 | tr ' ' '\n')"
# replace e.g. 'abc' with '(/abc\b)', and replace newlines with '|'.
# this converts it into a grep regular expression to check for any whitelisted library names.
libraryWhitelist="$(printf "%s" "$libraryWhitelist" | sed 's|.*|(/\0\\b)|' | tr '\n' '|')"
# grab only the entries that match the regex
__LDD_LIST="$(printf "%s" "$srb2Libraries" | grep -E "$libraryWhitelist")"
# use echo to convert the newline-seperated list into an argument list
__LDD_LIST="$(echo $__LDD_LIST)"
# read into an array because i can't be bothered iterating the lines of a string today
# there's so many other things in this file that'd need to be adjusted to be POSIX-compliant anyway
IFS=' ' read -r -a paths <<< "$__LDD_LIST"
for path in "${paths[@]}"; do
if [ -f "$path" ]; then
verboseOnly 2 "Packaging dependency $(basename "$path")..."
cp "$path" $__BUILD_DIR/AppDir/lib/
else
verboseOnly 2 "Dependency $(basename "$path") not found"
fi
done
else
verboseOnly 1 "This SRB2 build is statically linked, skipping dependency packing."
fi
cd "$__BUILD_DIR/AppDir"
# Copy icons
verboseOnly 1 "Packaging resources..."
cp "$__ROOT_DIR/srb2.png" "./usr/share/icons/hicolor/256x256/apps/$__PROGRAM_FILENAME.png"
ln -sf "./usr/share/icons/hicolor/256x256/apps/$__PROGRAM_FILENAME.png" "./.DirIcon"
ln -sf "./usr/share/icons/hicolor/256x256/apps/$__PROGRAM_FILENAME.png" "./$__PROGRAM_FILENAME.png"
# Make desktop descriptor
cat > "./usr/share/applications/$__PROGRAM_FILENAME.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=$__PROGRAM_NAME
Comment=$__PROGRAM_DESCRIPTION
Icon=$__PROGRAM_FILENAME
Exec=AppRun %F
Categories=Game;
EOF
ln -sf "./usr/share/applications/$__PROGRAM_FILENAME.desktop" "./$__PROGRAM_FILENAME.desktop"
# Make entry point
echo -e '#!'"$(dirname "$SHELL")/sh" > ./AppRun
echo -e 'HERE="$(dirname "$(readlink -f "${0}")")"' >> ./AppRun
echo -e 'SRB2WADDIR=$HERE/usr/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HERE/lib exec $HERE/usr/bin/'"$__PROGRAM_FILENAME"' "$@"' >> ./AppRun
chmod +x ./AppRun
cd .. # now in $__BUILD_DIR
# Package AppImage
if [ -z "$__APPIMAGETOOL" ]; then
verboseOnly 1 "No valid appimagetool path given or detected, downloading appimagetool..."
# Print notice for internet connection.
important "If the command hangs here, check your internet connection, or download appimagetool and add it to your \$PATH and try compiling again."
(( "$verbosity" >= 3 )) && wget "$url" || wget -q "$url"
APPIMAGETOOL="./$(basename "$url")"
chmod a+x "$APPIMAGETOOL"
else
verboseOnly 1 "appimagetool path given or detected, no download required."
APPIMAGETOOL="$__APPIMAGETOOL"
fi
verboseOnly 1 "Packing AppImage $__OUTPUT_FILENAME"
if (( verbosity >= 3 )); then
"$APPIMAGETOOL" ./AppDir "$__OUTPUT_FILENAME"
elif (( verbosity >= 2 )); then
"$APPIMAGETOOL" ./AppDir "$__OUTPUT_FILENAME" >/dev/null
else
"$APPIMAGETOOL" ./AppDir "$__OUTPUT_FILENAME" >/dev/null 2>&1
fi
success "AppImage ready!"
verboseOnly 1 "Cleaning up files..."
rm -r ./AppDir
if [ -z "$__APPIMAGETOOL" ]; then
rm "$APPIMAGETOOL"
fi
cd "$__ROOT_DIR" # snap back to reality
+37
View File
@@ -28,6 +28,10 @@ exist.
Returns the values of the given HUD item's `xoffset`/`yoffset` cvars.
Available for any HUD item with offset cvars.
## patch = v.cachePatchRotated(name, rollangle)
Like v.cachePatch, it caches a new patch with the corresponding name. Unlike v.cachePatch, however,
a rollangle can be supplied to the function so that it returns a rotated patch instead.
## x, y, flags = v.getDrawInfo(item)
Returns the X, Y and flags where the given HUD item will be drawn for the current displayplayer.
@@ -130,3 +134,36 @@ if rawget(_G, "S_StopSoundByNum") ~= nil then
... -- Can use it
end
```
## addHook("ServerJoin", function())
ServerJoin hook called when client joins server (starting a listen server also calls it for host).
Generally it was made to make loading custom config files less hacky, but can be used for anything else too.
## player.viewrollangle field
Returns player's current view roll angle for the Screen Tilting feature, useful for HUD elements.
## G_SetPlayerGamepadIndicatorColor(player, skincolor)
Set a custom color for Supported Gamepads with RGB LED functionality.
To be used with Displayplayers.
Only takes Skincolors.
Best to be used in a Loop to ensure the color wont get overwritten by the game.
## G_PlayerDeviceRumble(player, low_strength, high_strength, -optional- duration)
Add Gamepad Rumble support for things.
To be used with Displayplayers.
Duration is in milliseconds and is optional to set, default value is 84ms.
# Other changes
## P_PlayRinglossSound(source, damager)
Add optional `damager` argument (should be `mobj_t`), which causes hurt sound also play for damager
if `karthitemdialog` option is enabled
## K_PlayHitEmSound(mobj, victim)
Add optional `victim` argument (should be a player's `mobj_t`), which causes "hit em" sound to be
delayed and played for victim too if `karthitemdialog` option is enabled
+8
View File
@@ -0,0 +1,8 @@
ifdef SILENT
MAKEFLAGS+=--no-print-directory
endif
all :
% ::
@$(MAKE) -C src $(MAKECMDGOALS)
+1 -1
View File
@@ -76,7 +76,7 @@ Crashlogs now contain alot more informations. and even more if your build has de
Also allows 64bit Windows builds to produce Crashlogs!
## MISC
- Bird's Camara Tilting feature is no longer turned on by default
- Bird's Camera Tilting feature is no longer turned on by default
- Bird's warning on the title screen has been removed
## Bugs
+1 -1
View File
@@ -1 +1 @@
/lsdlsrb2
/lsdl2srb2kart
+1
View File
@@ -28,6 +28,7 @@ LOCAL_SRC_FILES := am_map.c \
m_cheat.c \
m_fixed.c \
m_menu.c \
m_textinput.c \
m_misc.c \
m_queue.c \
m_random.c \
+557 -551
View File
File diff suppressed because it is too large. Load diff
+48 -78
View File
@@ -31,18 +31,6 @@
# compile all HW render and 3D sound DLLs for the set
# opengl_dll
# Pure Mingw only, compile OpenGL HW render DLL
# minigl_dll
# Pure Mingw only, compile MiniGL HW render DLL
# ds3d_dll
# Pure Mingw only, compile DirectX DirectSound HW sound DLL
# fmod_dll
# Pure Mingw only, compile FMOD HW sound DLL
# openal_dll
# Pure Mingw only, compile OpenAL HW sound DLL
# fmod_so
# Non-Mingw, compile FMOD HW sound SO
# openal_so
# Non-Mingw, compile OpenAL HW sound SO
#
#
# Addon:
@@ -69,10 +57,7 @@
# Compile without SDL_Mixer, add 'NOMIXER=1'
# Compile without BSD API, add 'NONET=1'
# Compile without IPX/SPX, add 'NOIPX=1'
# Compile Mingw/SDL with S_DS3S, add 'DS3D=1'
# Compile without libopenmpt, add 'NOOPENMPT=1'
# Compile with S_FMOD3D, add 'FMOD=1' (WIP)
# Compile with S_OPENAL, add 'OPENAL=1' (WIP)
# To link with the whole SDL_Image lib to load Icons, add 'SDL_IMAGE=1' but it isn't not realy needed
# To link with SDLMain to hide console or make on a console-less binary, add 'SDLMAIN=1'
#
@@ -106,6 +91,8 @@ ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
else # if you on the *nix
NOUPX=1
system:=$(shell uname -s)
ifeq ($(system),Linux)
@@ -205,6 +192,18 @@ USE_FBO_OGL=1
endif
endif
ifndef NONET
ifndef NOSATURNSYNCH
DOSATURNSYNCH=1
ifndef NOSATURNJOIN
DOSATURNJOIN=1
endif
ifndef NOSATURNPAK
DOSATURNPAK=1
endif
endif
endif
ifdef MINGW
include win32/Makefile.cfg
endif #ifdef MINGW
@@ -215,6 +214,7 @@ endif
ifdef LINUX
UNIXCOMMON=1
NOOBJDUMP=1
ifndef NOGME
HAVE_LIBGME=1
endif
@@ -278,8 +278,8 @@ ifdef NOHW
OPTS+=-DNOHW
else
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.o\
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
endif
@@ -384,6 +384,18 @@ OPTS+=-DUSE_FBO_OGL
endif
endif
ifndef NONET
ifndef NOSATURNSYNCH
OPTS+=-DDOSATURNSYNCH
ifndef NOSATURNJOIN
OPTS+=-DDOSATURNJOIN
endif
ifndef NOSATURNPAK
OPTS+=-DDOSATURNPAK
endif
endif
endif
ifdef HAVE_MINIUPNPC
ifdef NONET
HAVE_MINIUPNPC=''
@@ -492,6 +504,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/hu_stuff.o \
$(OBJDIR)/y_inter.o \
$(OBJDIR)/st_stuff.o \
$(OBJDIR)/k_director.o \
$(OBJDIR)/k_kart.o \
$(OBJDIR)/m_aatree.o \
$(OBJDIR)/m_anigif.o \
@@ -502,6 +515,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/m_fixed.o \
$(OBJDIR)/m_menu.o \
$(OBJDIR)/m_misc.o \
$(OBJDIR)/m_textinput.o \
$(OBJDIR)/m_perfstats.o \
$(OBJDIR)/m_random.o \
$(OBJDIR)/m_queue.o \
@@ -535,6 +549,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/r_splats.o \
$(OBJDIR)/r_patch.o \
$(OBJDIR)/r_things.o \
$(OBJDIR)/r_portal.o \
$(OBJDIR)/screen.o \
$(OBJDIR)/v_video.o \
$(OBJDIR)/s_sound.o \
@@ -630,6 +645,17 @@ ifndef NOUPX
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
endif
endif
ifdef APPIMAGE
@echo Building AppImage...
ifdef APPIMAGE_NOASSETS
$(.)../AppImage_build.sh --small --quiet $(BIN)/
else
$(.)../AppImage_build.sh -q $(BIN)/
endif
@echo AppImage build complete, please look for $(EXENAME).AppImage in $(BIN)
endif
@echo Build is done, please look for $(EXENAME) in $(BIN), \(checking for post steps\)
reobjdump:
@@ -650,7 +676,7 @@ else
dll : opengl_dll
endif
ifdef MINGW
all_dll: opengl_dll ds3d_dll fmod_dll openal_dll
all_dll: opengl_dll
opengl_dll: $(BIN)/r_opengl.dll
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
@@ -660,55 +686,24 @@ $(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
ifndef NOUPX
-$(UPX) $(UPX_OPTS) $@
endif
ds3d_dll: $(BIN)/s_ds3d.dll
$(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o
@echo Linking S_DS3d.dll...
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -ldsound -luuid
fmod_dll: $(BIN)/s_fmod.dll
$(BIN)/s_fmod.dll: $(OBJDIR)/s_fmod.o
-$(MKDIR) $(BIN)
@echo Linking S_FMOD.dll...
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lfmod
openal_dll: $(BIN)/s_openal.dll
$(BIN)/s_openal.dll: $(OBJDIR)/s_openal.o
-$(MKDIR) $(BIN)
@echo Linking S_OpenAL.dll...
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lopenal32
else
all_dll: fmod_so openal_so
fmod_so: $(BIN)/s_fmod.so
$(BIN)/s_fmod.so: $(OBJDIR)/s_fmod.o
-$(MKDIR) $(BIN)
@echo Linking S_FMOD.so...
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lfmod
openal_so: $(BIN)/s_openal.so
$(BIN)/s_openal.so: $(OBJDIR)/s_openal.o
-$(MKDIR) $(BIN)
@echo Linking S_OpenAL.so...
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lopenal
endif
else
ifdef SDL
ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
@@ -782,31 +777,6 @@ $(OBJDIR)/win_dbg.o: win32/win_dbg.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
endif
ifdef STATICHS
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
ifdef MINGW
$(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
endif
else
$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_fmod/s_fmod.c
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c
endif
ifdef FILTERS
$(OBJDIR)/%.o: $(INTERFACE)/filter/%.c
@echo $< needs deps
+12 -7
View File
@@ -12,7 +12,7 @@
# to avoid a false positive with the version detection...
SUPPORTED_GCC_VERSIONS:=\
141 14\
142 141 140 14\
132 131 130 13\
123 122 121 120 12\
114 113 112 111 110 11\
@@ -24,7 +24,7 @@ SUPPORTED_GCC_VERSIONS:=\
55 54 53 52 51 50\
49 48 47 46 45 44 43 42 41 40
LATEST_GCC_VERSION=14.1
LATEST_GCC_VERSION=14.2.1
# gcc or g++
ifdef PREFIX
@@ -78,12 +78,20 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
endif
endif
ifdef GCC141
ifdef GCC142
GCC141=1
endif
ifdef GCC141
GCC140=1
endif
ifdef GCC14
GCC14=1
GCC140=1
endif
ifdef GCC140
GCC132=1
endif
ifdef GCC132
@@ -437,9 +445,6 @@ endif
ifdef GCC44
WFLAGS+=-Wno-error=array-bounds
endif
ifdef GCC45
opts+=-fwrapv
endif
ifdef GCC46
WFLAGS+=-Wno-error=suggest-attribute=noreturn
endif
+382 -128
View File
@@ -1,8 +1,10 @@
// SONIC ROBO BLAST 2
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -26,43 +28,37 @@
#endif
// For use if I do walls with outsides/insides
static const UINT8 REDS = (8*16);
static const UINT8 REDS = (2*16);
static const UINT8 REDRANGE = 16;
static const UINT8 GRAYS = (1*16);
static const UINT8 GRAYSRANGE = 16;
static const UINT8 BROWNS = (3*16);
static const UINT8 YELLOWS = (7*16);
static const UINT8 GREENS = (10*16);
static const UINT8 BROWNS = (15*16);
static const UINT8 YELLOWS = (5*16)+8;
static const UINT8 GREENS = (6*16);
static const UINT8 BLUES = (9*16);
static const UINT8 DBLACK = 31;
static const UINT8 DWHITE = 0;
static const UINT8 NOCLIMBREDS = 248;
static const UINT8 NOCLIMBREDRANGE = 8;
static const UINT8 NOCLIMBGRAYS = 204;
static const UINT8 NOCLIMBBROWNS = (2*16);
static const UINT8 NOCLIMBYELLOWS = (11*16);
// Automap colors
#define BACKGROUND DBLACK
#define WALLCOLORS (REDS + REDRANGE/2)
#define WALLRANGE (REDRANGE/2)
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
#define NOCLIMBWALLRANGE (NOCLIMBREDRANGE/2)
#define THOKWALLCOLORS REDS
#define THOKWALLRANGE REDRANGE
#define NOCLIMBTHOKWALLCOLORS NOCLIMBREDS
#define NOCLIMBTHOKWALLRANGE NOCLIMBREDRANGE
#define TSWALLCOLORS GRAYS
#define TSWALLRANGE GRAYSRANGE
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
#define TSWALLCOLORS DWHITE
#define TSFINISHLINE GRAYS
#define TSFOFINFO (BLUES + 4)
#define FDWALLCOLORS BROWNS
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
#define CDWALLCOLORS YELLOWS
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
#define THINGCOLORS GREENS
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
#define XHAIRCOLORS GRAYS
// Automap passes
#define PASS_SOLID 1
#define PASS_INTANGIBLE 2
#define PASS_FOF 4
// controls
#define AM_PANUPKEY KEY_UPARROW
#define AM_PANDOWNKEY KEY_DOWNARROW
@@ -110,11 +106,6 @@ typedef struct
mpoint_t a, b;
} mline_t;
typedef struct
{
fixed_t slp, islp;
} islope_t;
//
// The vector graphics for the automap.
// A line drawing of the player pointing right,
@@ -136,16 +127,14 @@ static const mline_t player_arrow[] = {
#undef R
#define NUMPLYRLINES (sizeof (player_arrow)/sizeof (mline_t))
#if 0
#define R (FRACUNIT)
static mline_t triangle_guy[] = {
{ { (fixed_t)-.867f*R, (fixed_t)-.5f*R }, { (fixed_t) .867f*R, (fixed_t)-.5f*R } },
{ { (fixed_t) .867f*R, (fixed_t)-.5f*R }, { (fixed_t) 0, (fixed_t) R } },
{ { (fixed_t) 0, (fixed_t) R }, { (fixed_t)-.867f*R, (fixed_t)-.5f*R } }
static const mline_t cross_mark[] =
{
{ { -R, 0 }, { R, 0} },
{ { 0, -R }, { 0, R } },
};
#undef R
#define NUMTRIANGLEGUYLINES (sizeof (triangle_guy)/sizeof (mline_t))
#endif
#define NUMCROSSMARKLINES (sizeof(cross_mark)/sizeof(mline_t))
#define R (FRACUNIT)
static const mline_t thintriangle_guy[] = {
@@ -162,10 +151,14 @@ static boolean draw_grid = false;
boolean automapactive = false;
boolean am_recalc = false; //added : 05-02-98 : true when screen size changes
static boolean am_stopped = true;
static boolean am_minigen = false;
static UINT8 *am_buf = NULL;
static INT32 f_x, f_y; // location of window on screen (always zero for both)
static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively)
static boolean m_keydown[4]; // which window panning keys are being pressed down?
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
@@ -205,12 +198,13 @@ static fixed_t scale_ftom;
static player_t *plr; // the player represented by an arrow
static INT32 followplayer = true; // specifies whether to follow the player around
static boolean followplayer = true; // specifies whether to follow the player around
// function for drawing lines, depends on rendermode
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
static AMDRAWFLINEFUNC AM_drawFline;
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc);
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
static void AM_activateNewScale(void)
@@ -260,25 +254,15 @@ static inline void AM_restoreScaleAndLoc(void)
*/
static void AM_findMinMaxBoundaries(void)
{
size_t i;
fixed_t a;
fixed_t b;
fixed_t a, b;
min_x = min_y = +INT32_MAX;
max_x = max_y = -INT32_MAX;
min_x = minimapinfo.min_x << MAPBITS;
max_x = minimapinfo.max_x << MAPBITS;
min_y = minimapinfo.min_y << MAPBITS;
max_y = minimapinfo.max_y << MAPBITS;
for (i = 0; i < numvertexes; i++)
{
if (vertexes[i].x < min_x)
min_x = vertexes[i].x;
else if (vertexes[i].x > max_x)
max_x = vertexes[i].x;
if (vertexes[i].y < min_y)
min_y = vertexes[i].y;
else if (vertexes[i].y > max_y)
max_y = vertexes[i].y;
}
max_w = minimapinfo.map_w << MAPBITS;
max_h = minimapinfo.map_h << MAPBITS;
max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS);
max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS);
@@ -350,22 +334,23 @@ static void AM_initVariables(void)
old_m_h = m_h;
}
//
// Called when the screen size changes.
//
static void AM_FrameBufferInit(void)
{
f_x = f_y = 0;
f_w = vid.width;
f_h = vid.height;
am_buf = screens[0];
}
//
// should be called at the start of every level
// right now, i figure it out myself
//
static void AM_LevelInit(void)
{
f_x = f_y = 0;
f_w = vid.width;
f_h = vid.height;
AM_drawFline = AM_drawFline_soft;
#ifdef HWRENDER
if (rendermode == render_opengl)
AM_drawFline = HWR_drawAMline;
#endif
AM_findMinMaxBoundaries();
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
if (scale_mtof > max_scale_mtof)
@@ -387,7 +372,7 @@ void AM_Stop(void)
*
* \sa AM_Stop
*/
static inline void AM_Start(void)
void AM_Start(void)
{
static INT32 lastlevel = -1;
@@ -396,8 +381,12 @@ static inline void AM_Start(void)
am_stopped = false;
if (lastlevel != gamemap || am_recalc) // screen size changed
{
AM_LevelInit();
lastlevel = gamemap;
AM_FrameBufferInit();
if (lastlevel != gamemap)
{
AM_LevelInit();
lastlevel = gamemap;
}
am_recalc = false;
}
AM_initVariables();
@@ -423,6 +412,27 @@ static void AM_maxOutWindowScale(void)
AM_activateNewScale();
}
//
// set window panning
//
static void AM_setWindowPanning(void)
{
// up and down
if (m_keydown[2]) // pan up
m_paninc.y = FTOM(F_PANINC);
else if (m_keydown[3]) // pan down
m_paninc.y = -FTOM(F_PANINC);
else
m_paninc.y = 0;
// left and right
if (m_keydown[0]) // pan right
m_paninc.x = FTOM(F_PANINC);
else if (m_keydown[1]) // pan left
m_paninc.x = -FTOM(F_PANINC);
else
m_paninc.x = 0;
}
/** Responds to user inputs in automap mode.
*
* \param ev Event to possibly respond to.
@@ -455,35 +465,49 @@ boolean AM_Responder(event_t *ev)
{
case AM_PANRIGHTKEY: // pan right
if (!followplayer)
m_paninc.x = FTOM(F_PANINC);
{
m_keydown[0] = true;
AM_setWindowPanning();
}
else
rc = false;
break;
case AM_PANLEFTKEY: // pan left
if (!followplayer)
m_paninc.x = -FTOM(F_PANINC);
{
m_keydown[1] = true;
AM_setWindowPanning();
}
else
rc = false;
break;
case AM_PANUPKEY: // pan up
if (!followplayer)
m_paninc.y = FTOM(F_PANINC);
{
m_keydown[2] = true;
AM_setWindowPanning();
}
else
rc = false;
break;
case AM_PANDOWNKEY: // pan down
if (!followplayer)
m_paninc.y = -FTOM(F_PANINC);
{
m_keydown[3] = true;
AM_setWindowPanning();
}
else
rc = false;
break;
case AM_ZOOMOUTKEY: // zoom out
mtof_zoommul = M_ZOOMOUT;
ftom_zoommul = M_ZOOMIN;
AM_setWindowPanning();
break;
case AM_ZOOMINKEY: // zoom in
mtof_zoommul = M_ZOOMIN;
ftom_zoommul = M_ZOOMOUT;
AM_setWindowPanning();
break;
case AM_TOGGLEKEY:
AM_Stop();
@@ -497,6 +521,7 @@ boolean AM_Responder(event_t *ev)
}
else
AM_restoreScaleAndLoc();
AM_setWindowPanning();
break;
case AM_FOLLOWKEY:
followplayer = !followplayer;
@@ -516,14 +541,32 @@ boolean AM_Responder(event_t *ev)
switch (ev->data1)
{
case AM_PANRIGHTKEY:
if (!followplayer)
{
m_keydown[0] = false;
AM_setWindowPanning();
}
break;
case AM_PANLEFTKEY:
if (!followplayer)
m_paninc.x = 0;
{
m_keydown[1] = false;
AM_setWindowPanning();
}
break;
case AM_PANUPKEY:
if (!followplayer)
{
m_keydown[2] = false;
AM_setWindowPanning();
}
break;
case AM_PANDOWNKEY:
if (!followplayer)
m_paninc.y = 0;
{
m_keydown[3] = false;
AM_setWindowPanning();
}
break;
case AM_ZOOMOUTKEY:
case AM_ZOOMINKEY:
@@ -724,6 +767,16 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
}
#undef DOOUTCODE
//
// Draws a pixel.
//
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
{
if (xx < 0 || yy < 0 || xx >= f_w || yy >= f_h)
return; // off the screen
am_buf[(yy*f_w) + xx] = cc;
}
//
// Classic Bresenham w/ whatever optimizations needed for speed
//
@@ -745,8 +798,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
}
#endif
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
dx = fl->b.x - fl->a.x;
ax = 2 * (dx < 0 ? -dx : dx);
sx = dx < 0 ? -1 : 1;
@@ -763,7 +814,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
d = ay - ax/2;
for (;;)
{
PUTDOT(x, y, color)
AM_drawPixel(x, y, color);
if (x == fl->b.x)
return;
if (d >= 0)
@@ -780,7 +831,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
d = ax - ay/2;
for (;;)
{
PUTDOT(x, y, color)
AM_drawPixel(x, y, color);
if (y == fl->b.y)
return;
if (d >= 0)
@@ -792,8 +843,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
d += ax;
}
}
#undef PUTDOT
}
//
@@ -815,17 +864,18 @@ static void AM_drawGrid(INT32 color)
fixed_t x, y;
fixed_t start, end;
mline_t ml;
fixed_t gridsize = (MAPBLOCKUNITS<<MAPBITS);
// Figure out start of vertical gridlines
start = m_x;
if ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS))
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS));
if ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize)
start += gridsize - ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize);
end = m_x + m_w;
// draw vertical gridlines
ml.a.y = m_y;
ml.b.y = m_y + m_h;
for (x = start; x < end; x += (MAPBLOCKUNITS<<FRACBITS))
for (x = start; x < end; x += gridsize)
{
ml.a.x = x;
ml.b.x = x;
@@ -834,14 +884,14 @@ static void AM_drawGrid(INT32 color)
// Figure out start of horizontal gridlines
start = m_y;
if ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS))
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS));
if ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize)
start += gridsize - ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize);
end = m_y + m_h;
// draw horizontal gridlines
ml.a.x = m_x;
ml.b.x = m_x + m_w;
for (y = start; y < end; y += (MAPBLOCKUNITS<<FRACBITS))
for (y = start; y < end; y += gridsize)
{
ml.a.y = y;
ml.b.y = y;
@@ -849,14 +899,63 @@ static void AM_drawGrid(INT32 color)
}
}
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \
end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y) + FRACUNIT/2) >> FRACBITS; \
} else \
end1 = end2 = (normalheight + FRACUNIT/2) >> FRACBITS;
static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondarystore)
{
ffloor_t *secondaryrover = NULL;
for (; rover; rover = rover->next)
{
fixed_t rovt1, rovt2;
fixed_t rovb1, rovb2;
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_BLOCKPLAYER))
continue;
SLOPEPARAMS(*rover->t_slope, rovt1, rovt2, *rover->topheight)
SLOPEPARAMS(*rover->b_slope, rovb1, rovb2, *rover->bottomheight)
for (secondaryrover = secondarystore; secondaryrover; secondaryrover = secondaryrover->next)
{
fixed_t sect1, sect2;
fixed_t secb1, secb2;
if (!(secondaryrover->flags & FF_EXISTS))
continue;
if (!(secondaryrover->flags & FF_BLOCKPLAYER))
continue;
if (secondaryrover->secnum == rover->secnum)
break;
SLOPEPARAMS(*secondaryrover->t_slope, sect1, sect2, *secondaryrover->topheight)
SLOPEPARAMS(*secondaryrover->b_slope, secb1, secb2, *secondaryrover->bottomheight)
if (rovt1 != sect1)
continue;
if (rovt2 != sect2)
continue;
if (rovb1 != secb1)
continue;
if (rovb2 != secb2)
continue;
break;
}
if (secondaryrover == NULL)
break;
}
return rover;
}
//
// Determines visible lines, draws them.
// This is LineDef based, not LineSeg based.
//
static inline void AM_drawWalls(void)
static void AM_drawWalls(UINT8 pass)
{
size_t i;
static mline_t l;
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale)>>FRACBITS;
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
@@ -866,74 +965,143 @@ static inline void AM_drawWalls(void)
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
if (lines[i].backsector) {
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
}
#undef SLOPEPARAMS
if (!lines[i].backsector) // 1-sided
{
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBWALLCOLORS);
else
if (!(pass & PASS_SOLID))
;
else if (frontf1 != frontc1 || frontf2 != frontc2 || lines[i].frontsector->f_slope)
{
AM_drawMline(&l, TSWALLCOLORS);
}
else if (!am_minigen)
{
AM_drawMline(&l, WALLCOLORS);
}
continue;
}
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
{
if (backf1 == backc1 && backf2 == backc2
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
{
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
else
AM_drawMline(&l, TSWALLCOLORS);
if (!am_minigen && (pass & PASS_INTANGIBLE))
{
AM_drawMline(&l, GRIDCOLORS);
}
}
else
else if (pass & PASS_SOLID)
{
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS);
else
AM_drawMline(&l, THOKWALLCOLORS);
AM_drawMline(&l, TSWALLCOLORS);
}
}
else
{
if (lines[i].flags & ML_NOCLIMB) {
if (backf1 != frontf1 || backf2 != frontf2) {
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
}
else if (backc1 != frontc1 || backc2 != frontc2) {
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
//dont think kart even supports those idk?
/*if (lines[i].flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS))
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSWALLCOLORS); // Completely solid course boundary
}
else if ((lines[i].flags & ML_MIDSOLID)
&& sides[lines->sidenum[0]].midtexture)
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSWALLCOLORS); // solid midtexture, likely a course boundary
}*/
if ((backf1 != frontf1 && abs(backf1 - frontf1) > maxstep)
|| (backf2 != frontf2 && abs(backf2 - frontf2) > maxstep))
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSWALLCOLORS); // floor-wall, likely a course boundary
}
/*else if (lines[i].special == 2001) // guh its a sector effect in kart idk how to make it work tbh lol
{
if (pass & PASS_SOLID)
AM_drawMline(&l, TSFINISHLINE); // finish line
}*/
else if (backf1 != frontf1 || backf2 != frontf2)
{
if (pass & PASS_INTANGIBLE)
AM_drawMline(&l, FDWALLCOLORS); // floorlevel change
}
else if (backc1 != frontc1 || backc2 != frontc2)
{
if (!(pass & PASS_INTANGIBLE))
;
else if (abs(backc1 - frontc1) < maxstep
|| abs(backc2 - frontc2) < maxstep)
{
AM_drawMline(&l, CDWALLCOLORS); // ceilinglevel change
}
else
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
{
AM_drawMline(&l, GRIDCOLORS); // ceiling-wall, not likely to be a course boundary but flagged up just in case
}
}
else
{
if (backf1 != frontf1 || backf2 != frontf2) {
AM_drawMline(&l, FDWALLCOLORS); // floor level change
{
ffloor_t *rover = NULL;
if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors)
{
if (lines[i].backsector->ffloors == NULL)
{
// Check frontside for one solid
for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_BLOCKPLAYER))
continue;
break;
}
}
else if (lines[i].frontsector->ffloors == NULL)
{
// Check backside for one solid
for (rover = lines[i].backsector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_BLOCKPLAYER))
continue;
break;
}
}
else
{
// Check to see if any secnums exist in one but not the other.
rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors);
if (rover == NULL)
rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors);
}
}
if (rover != NULL)
{
if (pass & PASS_FOF)
AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet
}
else if (!am_minigen)
{
if (pass & PASS_INTANGIBLE)
AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line
}
}
else if (backc1 != frontc1 || backc2 != frontc2) {
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
}
else
AM_drawMline(&l, TSWALLCOLORS);
}
}
}
}
#undef SLOPEPARAMS
//
// Rotation in 2D.
// Used to rotate player arrow line character.
@@ -1006,7 +1174,7 @@ static inline void AM_drawPlayers(void)
if (!multiplayer)
{
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
return;
}
@@ -1015,12 +1183,15 @@ static inline void AM_drawPlayers(void)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (!players[i].mo)
continue;
p = &players[i];
if (p->skincolor > 0)
color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8];
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y);
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, p->mo->angle, color, p->mo->x, p->mo->y);
}
}
@@ -1040,13 +1211,27 @@ static inline void AM_drawThings(UINT8 colors)
}
}
/** Draws the crosshair, actually just a dot in software mode.
/** Draws the crosshair.
*
* \param color Color for the crosshair.
*/
static inline void AM_drawCrosshair(UINT8 color)
{
V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART);
const fixed_t scale = 4<<FRACBITS;
size_t i;
fline_t fl;
for (i = 0; i < NUMCROSSMARKLINES; i++)
{
fl.a.x = FixedMul(cross_mark[i].a.x, scale) >> FRACBITS;
fl.a.y = FixedMul(cross_mark[i].a.y, scale) >> FRACBITS;
fl.b.x = FixedMul(cross_mark[i].b.x, scale) >> FRACBITS;
fl.b.y = FixedMul(cross_mark[i].b.y, scale) >> FRACBITS;
fl.a.x += f_x + (f_w / 2);
fl.a.y += f_y + (f_h / 2);
fl.b.x += f_x + (f_w / 2);
fl.b.y += f_y + (f_h / 2);
AM_drawFline(&fl, color);
}
}
/** Draws the automap.
@@ -1056,11 +1241,80 @@ void AM_Drawer(void)
if (!automapactive)
return;
AM_drawFline = AM_drawFline_soft;
#ifdef HWRENDER
if (rendermode == render_opengl)
AM_drawFline = HWR_drawAMline;
#endif
AM_clearFB(BACKGROUND);
if (draw_grid) AM_drawGrid(GRIDCOLORS);
AM_drawWalls();
AM_drawWalls(PASS_FOF|PASS_INTANGIBLE|PASS_SOLID);
AM_drawPlayers();
AM_drawThings(THINGCOLORS);
AM_drawCrosshair(XHAIRCOLORS);
if (!followplayer) AM_drawCrosshair(XHAIRCOLORS);
}
minigen_t *AM_MinimapGenerate(INT32 mul)
{
static minigen_t ret = {0};
if (automapactive)
return NULL;
am_minigen = true;
AM_drawFline = AM_drawFline_soft; // yes, even in GL
//AM_FrameBufferInit();
f_x = f_y = 0;
ret.w = f_w = minimapinfo.minimap_w * mul;
ret.h = f_h = minimapinfo.minimap_h * mul;
am_buf = ret.buf = NULL;
//AM_LevelInit();
AM_findMinMaxBoundaries();
scale_mtof = min_scale_mtof - (min_scale_mtof/20);
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
//AM_initVariables();
f_oldloc.x = INT32_MAX;
m_paninc.x = m_paninc.y = 0;
ftom_zoommul = FRACUNIT;
mtof_zoommul = FRACUNIT;
m_w = FTOM(f_w);
m_h = FTOM(f_h);
//AM_changeWindowLoc();
m_x = min_x - FixedMul(m_w, FRACUNIT/40);
m_y = min_y - FixedMul(m_h, FRACUNIT/40);
m_x2 = m_x + m_w;
m_y2 = m_y + m_h;
// for saving & restoring
old_m_x = m_x;
old_m_y = m_y;
old_m_w = m_w;
old_m_h = m_h;
am_buf = ret.buf = malloc((f_w*f_h));
if (ret.buf == NULL)
return NULL;
//AM_clearFB(BACKGROUND);
memset(am_buf, 0xff, (f_w*f_h));
AM_drawWalls(PASS_FOF);
AM_drawWalls(PASS_INTANGIBLE);
AM_drawWalls(PASS_SOLID);
am_buf = NULL;
am_recalc = true;
am_minigen = false;
return &ret;
}
+17 -8
View File
@@ -1,8 +1,10 @@
// SONIC ROBO BLAST 2
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -26,11 +28,6 @@ typedef struct
fpoint_t a, b;
} fline_t;
// Used by ST StatusBar stuff.
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
extern boolean am_recalc; // true if screen size changes
extern boolean automapactive; // In AutoMap mode?
@@ -43,7 +40,19 @@ void AM_Ticker(void);
// Called by main loop, instead of view drawer if automap is active.
void AM_Drawer(void);
// Enables the automap.
void AM_Start(void);
// Called to force the automap to quit if the level is completed while it is up.
void AM_Stop(void);
typedef struct
{
INT32 w, h;
UINT8 *buf;
} minigen_t;
// Minimap generation
minigen_t *AM_MinimapGenerate(INT32 mul);
#endif
-4
View File
@@ -184,8 +184,6 @@ void I_OutputMsg(const char *fmt, ...)
void I_StartupMouse(void){}
void I_StartupMouse2(void){}
void I_StartupKeyboard(void){}
INT32 I_GetKey(void)
@@ -242,8 +240,6 @@ void I_GetJoystickEvents(void){}
void I_GetJoystick2Events(void){}
void I_GetMouseEvents(void){}
char *I_GetEnv(const char *name)
{
LOGW("I_GetEnv() called?!");
+2 -5
View File
@@ -36,7 +36,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
return;
// Lua can handle it!
if (LUAh_BotAI(sonic, tails, cmd))
if (LUA_HookBotAI(sonic, tails, cmd))
return;
if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
@@ -118,11 +118,8 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
return;
}
// Bot AI isn't programmed in analog.
//CV_SetValue(&cv_analog2, false);
// Let Lua scripts build ticcmds
if (LUAh_BotTiccmd(player, cmd))
if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
return;
// We don't have any main character AI, sorry. D:
+28 -23
View File
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
// Copyright (C) 1999-2024 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -11,6 +11,9 @@
/// \brief Macros to read/write from/to a UINT8 *,
/// used for packet creation and such
#ifndef __BYTEPTR_H__
#define __BYTEPTR_H__
#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__)
#define DEALIGNED
#endif
@@ -150,7 +153,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
#undef DEALIGNED
#define WRITESTRINGN(p, s, n) ({ \
#define WRITESTRINGN(p, s, n) do { \
size_t tmp_i; \
\
for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \
@@ -158,70 +161,72 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
\
if (tmp_i < n) \
WRITECHAR(p, '\0'); \
})
} while (0)
#define WRITESTRINGL(p, s, n) ({ \
#define WRITESTRINGL(p, s, n) do { \
size_t tmp_i; \
\
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
WRITECHAR(p, '\0'); \
})
} while (0)
#define WRITESTRING(p, s) ({ \
#define WRITESTRING(p, s) do { \
size_t tmp_i; \
\
for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
WRITECHAR(p, '\0'); \
})
} while (0)
#define WRITEMEM(p, s, n) ({ \
memcpy(p, s, n); \
p += n; \
})
#define WRITEMEM(p, s, n) do { \
memcpy(p, s, n); \
p += n; \
} while (0)
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
#define SKIPSTRINGN(p, n) ({ \
#define SKIPSTRINGN(p, n) do { \
size_t tmp_i = 0; \
\
while (tmp_i < n && READCHAR(p) != '\0') \
tmp_i++; \
})
} while (0)
#define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n)
#define READSTRINGN(p, s, n) ({ \
#define READSTRINGN(p, s, n) do { \
size_t tmp_i = 0; \
\
while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
})
} while (0)
#define READSTRINGL(p, s, n) ({ \
#define READSTRINGL(p, s, n) do { \
size_t tmp_i = 0; \
\
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
})
} while (0)
#define READSTRING(p, s) ({ \
#define READSTRING(p, s) do { \
size_t tmp_i = 0; \
\
while ((s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
})
} while (0)
#define READMEM(p, s, n) ({ \
memcpy(s, p, n); \
p += n; \
})
#define READMEM(p, s, n) do { \
memcpy(s, p, n); \
p += n; \
} while (0)
#endif // __BYTEPTR_H__
+1 -1
View File
@@ -628,7 +628,7 @@ static void COM_ExecuteString(char *ptext)
// check cvars
// Hurdler: added at Ebola's request ;)
// (don't flood the console in software mode with bad gr_xxx command)
// (don't flood the console in software mode with bad gl_xxx command)
if (!CV_Command() && con_destlines)
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
}
+62 -255
View File
@@ -32,6 +32,7 @@
#include "i_threads.h"
#include "d_main.h"
#include "m_menu.h"
#include "m_textinput.h"
#include "filesrch.h"
#ifdef HWRENDER
@@ -43,8 +44,12 @@
#ifdef HAVE_THREADS
I_mutex con_mutex;
# define Lock_state() I_lock_mutex(&con_mutex)
# define Unlock_state() I_unlock_mutex(con_mutex)
// g_in_exiting_signal_handler is an evil hack
// to avoid infinite SIGABRT recursion in the signal handler
// due to poisoned locks or mach-o kernel not supporting locks in signals
// or something like that. idk
# define Lock_state() if (!g_in_exiting_signal_handler) { I_lock_mutex(&con_mutex); }
# define Unlock_state() if (!g_in_exiting_signal_handler) { I_unlock_mutex(con_mutex); }
#else/*HAVE_THREADS*/
# define Lock_state()
# define Unlock_state()
@@ -93,9 +98,7 @@ static char inputlines[32][CON_MAXPROMPTCHARS]; // hold last 32 prompt lines
static INT32 inputline; // current input line number
static INT32 inputhist; // line number of history input line to restore
static size_t input_cur; // position of cursor in line
static size_t input_sel; // position of selection marker (I.E.: anything between this and input_cur is "selected")
static size_t input_len; // length of current line, used to bound cursor and such
static textinput_t input;
// notice: input does NOT include the "$" at the start of the line. - 11/3/16
// protos.
@@ -454,7 +457,8 @@ static void CON_InputInit(void)
// prepare the first prompt line
memset(inputlines, 0, sizeof (inputlines));
inputline = 0;
input_cur = input_sel = input_len = 0;
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
Unlock_state();
}
@@ -604,7 +608,7 @@ static void CON_MoveConsole(void)
}
// Not instant - Increment fracmovement fractionally
fracmovement += FixedMul(cons_speed.value*vid.fdupy, renderdeltatics);
fracmovement += FixedMul(cons_speed.value*vid.fdupy, (cv_uncappedhud.value ? renderdeltatics : FRACUNIT));
if (con_curlines < con_destlines) // Move the console downwards
{
@@ -798,113 +802,6 @@ void CON_Ticker(void)
Unlock_state();
}
//
// ----
//
// Shortcuts for adding and deleting characters, strings, and sections
// Necessary due to moving cursor
//
static void CON_InputClear(void)
{
Lock_state();
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
input_cur = input_sel = input_len = 0;
Unlock_state();
}
static void CON_InputSetString(const char *c)
{
Lock_state();
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
strcpy(inputlines[inputline], c);
input_cur = input_sel = input_len = strlen(c);
Unlock_state();
}
static void CON_InputAddString(const char *c)
{
size_t csize = strlen(c);
Lock_state();
if (input_len + csize > CON_MAXPROMPTCHARS-1)
{
Unlock_state();
return;
}
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur+csize], &inputlines[inputline][input_cur], input_len-input_cur);
memcpy(&inputlines[inputline][input_cur], c, csize);
input_len += csize;
input_sel = (input_cur += csize);
Unlock_state();
}
static void CON_InputDelSelection(void)
{
size_t start, end, len;
Lock_state();
if (input_cur > input_sel)
{
start = input_sel;
end = input_cur;
}
else
{
start = input_cur;
end = input_sel;
}
len = (end - start);
if (end != input_len)
memmove(&inputlines[inputline][start], &inputlines[inputline][end], input_len-end);
memset(&inputlines[inputline][input_len - len], 0, len);
input_len -= len;
input_sel = input_cur = start;
Unlock_state();
}
static void CON_InputAddChar(char c)
{
if (input_len >= CON_MAXPROMPTCHARS-1)
return;
Lock_state();
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur+1], &inputlines[inputline][input_cur], input_len-input_cur);
inputlines[inputline][input_cur++] = c;
inputlines[inputline][++input_len] = 0;
input_sel = input_cur;
Unlock_state();
}
static void CON_InputDelChar(void)
{
if (!input_cur)
return;
Lock_state();
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur-1], &inputlines[inputline][input_cur], input_len-input_cur);
inputlines[inputline][--input_len] = 0;
input_sel = --input_cur;
Unlock_state();
}
//
// ----
//
@@ -985,6 +882,10 @@ boolean CON_Responder(event_t *ev)
}
}
Lock_state();
M_TextInputHandle(&input, key);
Unlock_state();
// Always eat ctrl/shift/alt if console open, so the menu doesn't get ideas
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|| key == KEY_LCTRL || key == KEY_RCTRL
@@ -997,12 +898,11 @@ boolean CON_Responder(event_t *ev)
// show all cvars/commands that match what we have inputted
if (key == KEY_TAB)
{
if (!completion[0])
{
if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
if (!input.length || input.length >= 40 || strchr(input.buffer, ' '))
return true;
strcpy(completion, inputlines[inputline]);
strcpy(completion, input.buffer);
comskips = varskips = 0;
}
@@ -1023,42 +923,9 @@ boolean CON_Responder(event_t *ev)
return true;
}
if (key == 'x' || key == 'X')
{
if (input_sel > input_cur)
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
else
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
CON_InputDelSelection();
// Those are already handled in M_TextInputHandle, but they do extra logic... Maybe textinput_t should have some sort of callbacks?
if (key == 'x' || key == 'X' || key == 'v' || key == 'V')
completion[0] = 0;
return true;
}
else if (key == 'c' || key == 'C')
{
if (input_sel > input_cur)
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
else
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
return true;
}
else if (key == 'v' || key == 'V')
{
const char *paste = I_ClipboardPaste();
if (input_sel != input_cur)
CON_InputDelSelection();
if (paste != NULL)
CON_InputAddString(paste);
completion[0] = 0;
return true;
}
// Select all
if (key == 'a' || key == 'A')
{
input_sel = 0;
input_cur = input_len;
return true;
}
// ...why shouldn't it eat the key? if it doesn't, it just means you
// can control Sonic from the console, which is silly
@@ -1073,9 +940,9 @@ boolean CON_Responder(event_t *ev)
// remember typing for several completions (a-la-4dos)
if (!completion[0])
{
if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
if (!input.length || input.length >= 40 || strchr(input.buffer, ' '))
return true;
strcpy(completion, inputlines[inputline]);
strcpy(completion, input.buffer);
comskips = varskips = 0;
}
else
@@ -1106,7 +973,11 @@ boolean CON_Responder(event_t *ev)
cmd = CV_CompleteVar(completion, varskips);
if (cmd)
CON_InputSetString(va("%s ", cmd));
{
Lock_state();
M_TextInputSetString(&input, va("%s ", cmd));
Unlock_state();
}
else
{
if (comskips > 0)
@@ -1132,37 +1003,6 @@ boolean CON_Responder(event_t *ev)
return true;
}
if (key == KEY_LEFTARROW)
{
if (input_cur != 0)
--input_cur;
if (!shiftdown)
input_sel = input_cur;
return true;
}
else if (key == KEY_RIGHTARROW)
{
if (input_cur < input_len)
++input_cur;
if (!shiftdown)
input_sel = input_cur;
return true;
}
else if (key == KEY_HOME)
{
input_cur = 0;
if (!shiftdown)
input_sel = input_cur;
return true;
}
else if (key == KEY_END)
{
input_cur = input_len;
if (!shiftdown)
input_sel = input_cur;
return true;
}
// At this point we're messing with input
// Clear completion
completion[0] = 0;
@@ -1170,45 +1010,29 @@ boolean CON_Responder(event_t *ev)
// command enter
if (key == KEY_ENTER)
{
if (!input_len)
if (!input.length)
return true;
// push the command
COM_BufAddText(inputlines[inputline]);
COM_BufAddText(input.buffer);
COM_BufAddText("\n");
CONS_Printf("\x86""%c""\x80""%s\n", CON_PROMPTCHAR, inputlines[inputline]);
Lock_state();
// Only add command to history if it differs from previous one
if (strcmp(inputlines[inputline], inputlines[(inputline-1) & 31]))
if (strcmp(input.buffer, inputlines[(inputline-1) & 31]))
{
inputline = (inputline+1) & 31;
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
}
inputhist = inputline;
CON_InputClear();
M_TextInputClear(&input);
return true;
}
Unlock_state();
// backspace and delete command prompt
if (input_sel != input_cur)
{
if (key == KEY_BACKSPACE || key == KEY_DEL)
{
CON_InputDelSelection();
return true;
}
}
else if (key == KEY_BACKSPACE)
{
CON_InputDelChar();
return true;
}
else if (key == KEY_DEL)
{
if (input_cur == input_len)
return true;
++input_cur;
CON_InputDelChar();
return true;
}
@@ -1225,7 +1049,9 @@ boolean CON_Responder(event_t *ev)
if (inputhist == inputline)
inputhist = (inputline + 1) & 31;
CON_InputSetString(inputlines[inputhist]);
Lock_state();
M_TextInputSetString(&input, inputlines[inputhist]);
Unlock_state();
return true;
}
@@ -1239,41 +1065,16 @@ boolean CON_Responder(event_t *ev)
while (inputhist != inputline && !inputlines[inputhist][0]);
// back to currentline
Lock_state();
if (inputhist == inputline)
CON_InputClear();
M_TextInputClear(&input);
else
CON_InputSetString(inputlines[inputhist]);
M_TextInputSetString(&input, inputlines[inputhist]);
Unlock_state();
return true;
}
// allow people to use keypad in console (good for typing IP addresses) - Calum
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
{
char keypad_translation[] = {'7','8','9','-',
'4','5','6','+',
'1','2','3',
'0','.'};
key = keypad_translation[key - KEY_KEYPAD7];
}
else if (key == KEY_KPADSLASH)
key = '/';
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
key = CON_ShiftChar(key);
// enter a char into the command prompt
if (key < 32 || key > 127)
return true;
// add key to cmd line here
if (key >= 'A' && key <= 'Z' && !(shiftdown ^ capslock)) //this is only really necessary for dedicated servers
key = key + 'a' - 'A';
if (input_sel != input_cur)
CON_InputDelSelection();
CON_InputAddChar(key);
return true;
}
@@ -1435,7 +1236,7 @@ void CONS_Printf(const char *fmt, ...)
txt = malloc(8192);
va_start(argptr, fmt);
vsprintf(txt, fmt, argptr);
vsnprintf(txt, 8192, fmt, argptr);
va_end(argptr);
// echo console prints to log file
@@ -1555,16 +1356,16 @@ static void CON_DrawInput(void)
clen = con_width-13;
if (input_len <= clen)
if (input.length <= clen)
{
c = 0;
clen = input_len;
clen = input.length;
}
else // input line scrolls left if it gets too long
{
clen -= 2; // There will always be some extra truncation -- but where is what we'll find out
if (input_cur <= clen/2)
if (input.cursor <= clen/2)
{
// Close enough to right edge to show all
c = 0;
@@ -1575,15 +1376,15 @@ static void CON_DrawInput(void)
{
// Cursor in the middle (or right side) of input
// Move over for the ellipsis
c = input_cur - (clen/2) + 2;
c = input.cursor - (clen/2) + 2;
x += charwidth*2;
lellip = 1;
if (c + clen >= input_len)
if (c + clen >= input.length)
{
// Cursor in the right side of input
// We were too far over, so move back
c = input_len - clen;
c = input.length - clen;
}
else
{
@@ -1597,7 +1398,7 @@ static void CON_DrawInput(void)
if (lellip)
{
x -= charwidth*3;
if (input_sel < c)
if (input.select < c)
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART);
for (i = 0; i < 3; ++i, x += charwidth)
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
@@ -1607,7 +1408,7 @@ static void CON_DrawInput(void)
for (cend = c + clen; c < cend; ++c, x += charwidth)
{
if ((input_sel > c && input_cur <= c) || (input_sel <= c && input_cur > c))
if ((input.select > c && input.cursor <= c) || (input.select <= c && input.cursor > c))
{
V_DrawFill(x, y, charwidth, (10 * con_scalefactor), 107 | V_NOSCALESTART);
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_YELLOWMAP | V_NOSCALESTART, !cv_allcaps.value);
@@ -1615,14 +1416,14 @@ static void CON_DrawInput(void)
else
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
if (c == input_cur && con_tick >= 4)
if (c == input.cursor && con_tick >= 4)
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
}
if (cend == input_cur && con_tick >= 4)
if (cend == input.cursor && con_tick >= 4)
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
if (rellip)
{
if (input_sel > cend)
if (input.select > cend)
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART);
for (i = 0; i < 3; ++i, x += charwidth)
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
@@ -1665,7 +1466,10 @@ static void CON_DrawHudlines(void)
{
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
p++;
c++;
}
if (c >= con_width)
break;
if (*p < HU_FONTSTART)
;//charwidth = 4 * con_scalefactor;
else
@@ -1745,7 +1549,10 @@ static void CON_DrawConsole(void)
{
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
p++;
c++;
}
if (c >= con_width)
break;
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
}
}
+958 -471
View File
File diff suppressed because it is too large. Load diff
+45 -8
View File
@@ -41,6 +41,15 @@ applications may follow different packet versions.
#define BACKUPTICS 32
#define TICQUEUE 512 // more than enough for most timeouts....
#define MAXTEXTCMD 256
// No. of tics your controls can be delayed by.
// TODO: Instead of storing a ton of extra cmds for gentlemens' delay,
// keep them in a linked-list, with timestamps to discard everything that's older than already sent.
// That will support any amount of lag, and be less wasteful for clients who don't use it.
// This just works as a quick implementation.
#define MAXGENTLEMENDELAY TICRATE
//
// Packet structure
//
@@ -98,6 +107,16 @@ typedef enum
PT_MOREFILESNEEDED, // Server, to client: "you need these (+ more on top of those)"
PT_PING, // Packet sent to tell clients the other client's latency to server.
#ifdef SATURNSYNCH
PT_WILLRESENDGAMESTATE, // Hey Client, I am about to resend you the gamestate!
PT_CANRECEIVEGAMESTATE, // Okay Server, I'm ready to receive it, you can go ahead.
PT_RECEIVEDGAMESTATE, // Thank you Server, I am ready to play again!
// we will reserve this for now even if unused, so order wont get mangled
PT_ISSATURN, // Saturn specific identifier packet
#endif
NUMPACKETTYPE
} packettype_t;
@@ -363,6 +382,9 @@ typedef struct
UINT8 subversion; // Contains build version
UINT8 localplayers; // number of splitscreen players
UINT8 mode;
#ifdef SATURNJOIN
UINT8 issaturn;
#endif
} ATTRPACK clientconfig_pak;
#define SV_SPEEDMASK 0x03 // used to send kartspeed
@@ -563,26 +585,37 @@ extern UINT32 realpingtable[MAXPLAYERS];
extern UINT32 playerpingtable[MAXPLAYERS];
extern tic_t servermaxping;
extern boolean server_lagless;
extern tic_t simulated_lag;
extern tic_t lowest_lag;
extern consvar_t cv_mindelay, cv_lagless;
extern consvar_t
#ifdef VANILLAJOINNEXTROUND
cv_joinnextround,
#endif
cv_netticbuffer, cv_allownewplayer, cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
cv_netticbuffer, cv_allownewplayer,
#ifdef SATURNJOIN
cv_allownewsaturnplayer,
#endif
cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts,
#ifdef SATURNSYNCH
cv_resynchcooldown, cv_gamestateattempts,
#endif
cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
extern consvar_t cv_connectawaittime;
extern consvar_t cv_discordinvites;
// Used in d_net, the only dependence
tic_t ExpandTics(INT32 low, tic_t basetic);
//tic_t ExpandTics(INT32 low, tic_t basetic);
void D_ClientServerInit(void);
// Initialise the other field
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam);
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam); // splitsreen player
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam); // splitsreen3 player
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam); // splitsreen4 player
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
// Create any new ticcmds and broadcast to other players.
void NetKeepAlive(void);
@@ -626,13 +659,17 @@ extern char motd[254], server_context[8];
extern UINT8 playernode[MAXPLAYERS];
INT32 D_NumPlayers(void);
void D_ResetTiccmds(void);
tic_t GetLag(INT32 node);
UINT8 GetFreeXCmdSize(void);
//UINT8 GetFreeXCmdSize(UINT8 playerid);
extern UINT8 hu_resynching;
extern UINT8 hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
#ifdef SATURNSYNCH
extern UINT8 hu_redownloadinggamestate;
#endif
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
typedef struct rewind_s {
UINT8 savebuffer[(768*1024)];
-1
View File
@@ -25,7 +25,6 @@ typedef enum
ev_console,
ev_mouse,
ev_joystick,
ev_mouse2,
ev_joystick2,
ev_joystick3,
ev_joystick4,
+261 -165
View File
@@ -15,6 +15,7 @@
/// plus functions to parse command line parameters, configure game
/// parameters, and call the startup functions.
#include "d_netcmd.h"
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
#include <sys/stat.h>
#include <sys/types.h>
@@ -37,6 +38,7 @@
#include "d_net.h"
#include "f_finale.h"
#include "g_game.h"
#include "g_input.h"
#include "hu_stuff.h"
#include "i_sound.h"
#include "i_system.h"
@@ -83,10 +85,6 @@
#include "hardware/hw_main.h" // 3D View Rendering
#endif
#ifdef HW3SOUND
#include "hardware/hw3sound.h"
#endif
#ifdef HAVE_DISCORDRPC
#include "discord.h"
#endif
@@ -98,23 +96,22 @@ UINT8 window_notinfocus = false;
// DEMO LOOP
//
//static INT32 demosequence;
static const char *pagename = "MAP1PIC";
static char *startupwadfiles[MAX_WADFILES];
static char *startuppwads[MAX_WADFILES];
// autoloading
static char *autoloadwadfiles[MAX_WADFILES];
char *autoloadwadfiles[MAX_WADFILES];
char *autoloadwadfilespost[MAX_WADFILES];
boolean autoloading;
boolean autoloaded;
boolean postautoloaded;
boolean postautoloaded = false;
boolean wasautoloaded = false;
boolean devparm = false; // started game with -devparm
boolean singletics = false; // timedemo
boolean lastdraw = false;
postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
// These variables are only true if
@@ -136,6 +133,7 @@ char srb2home[256] = ".";
char srb2path[256] = ".";
boolean usehome = true;
const char *pandf = "%s" PATHSEP "%s";
static char addonsdir[MAX_WADPATH];
//
// EVENT HANDLING
@@ -149,6 +147,8 @@ INT32 eventhead, eventtail;
boolean dedicated = false;
boolean loaded_config = false;
//
// D_PostEvent
// Called by the I/O functions when input is detected
@@ -166,6 +166,77 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does.
static void D_PadMenuScrollInput(int input)
{
event_t myev = {0, 0, 0, 0};
myev.type = ev_keydown;
myev.data1 = input;
D_PostEvent(&myev); // put into eventlist
}
#define SCROLLDELAY 19 // TICRATE * ( (k+2) (1 - [wz + h + j - q]^2 - [(gk + 2g + k + 1)(h + j) + h - z]^2 - [16(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^2]^2 calculated by my butt
// this is absolutely awful and i hate it lmao
// but le hAx0r to make dpad also be able to scroll in the menu
static void D_GamePadMenuScrollTicker(void)
{
static SINT8 menuInputDelayTimer = 0;
int key = 0; // butt-on output
if (dedicated)
return;
// wish i had a switch ono
if (DPADUPSCROLL)
key = KEY_UPARROW;
else if (DPADDOWNSCROLL)
key = KEY_DOWNARROW;
else if (DPADLEFTSCROLL)
key = KEY_LEFTARROW;
else if (DPADRIGHTSCROLL)
key = KEY_RIGHTARROW;
if (key)
{
if (menuInputDelayTimer < SCROLLDELAY)
menuInputDelayTimer++;
if (menuInputDelayTimer == SCROLLDELAY)
D_PadMenuScrollInput(key);
}
else
{
menuInputDelayTimer = 0;
}
}
#undef SCROLLDELAY
static void D_DeviceLEDTick(void)
{
UINT8 i;
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
if (dedicated || numcontrollers == 0)
{
return;
}
for (i = 0; i <= splitscreen; i++)
{
if (!cv_usejoystick[i].value || !cv_gamepadled[i].value)
continue;
color[i] = G_GetSkinColor(i);
if (curcolor[i] == color[i]) // dont update if same colour
continue;
G_SetPlayerGamepadIndicatorColor(i, color[i]);
curcolor[i] = color[i];
}
}
//
// D_ProcessEvents
// Send all the events of the given timestamp down the responder chain
@@ -242,8 +313,9 @@ void D_ProcessEvents(void)
// added comment : there is a wipe eatch change of the gamestate
gamestate_t wipegamestate = GS_LEVEL;
static void D_Display(void)
static boolean D_Display(void)
{
boolean ranwipe = false;
boolean forcerefresh = false;
static boolean wipe = false;
INT32 wipedefindex = 0;
@@ -252,7 +324,7 @@ static void D_Display(void)
if (!dedicated)
{
if (nodrawers)
return; // for comparative timing/profiling
return false; // for comparative timing/profiling
// check for change of screen size (video mode)
if (setmodeneeded && !wipe)
@@ -262,7 +334,10 @@ static void D_Display(void)
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
if (rendermode == render_soft && !splitscreen)
{
R_InterpolateViewRollAngle(rendertimefrac_unpaused);
R_CheckViewMorph();
}
// change the view size if needed
if (setsizeneeded)
@@ -278,6 +353,7 @@ static void D_Display(void)
// save the current screen if about to wipe
wipe = (gamestate != wipegamestate);
if (wipe)
{
// set for all later
@@ -302,6 +378,7 @@ static void D_Display(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
ranwipe = true;
}
if (gamestate != GS_LEVEL && rendermode != render_none)
@@ -315,12 +392,13 @@ static void D_Display(void)
else //dedicated servers
{
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
ranwipe = true;
wipegamestate = gamestate;
}
}
if (dedicated) //bail out after wipe logic
return;
return false;
// do buffered drawing
switch (gamestate)
@@ -409,12 +487,14 @@ static void D_Display(void)
{
PS_START_TIMING(ps_rendercalltime);
R_ApplyLevelInterpolators(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
R_ApplyLevelInterpolators(rendertimefrac);
for (i = 0; i <= splitscreen; i++)
{
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
{
viewssnum = i;
if (i == 0) // Initialize for P1
{
viewwindowy = 0;
@@ -424,11 +504,9 @@ static void D_Display(void)
objectsdrawn = 0;
}
viewssnum = i;
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
if (rendermode == render_opengl)
HWR_RenderPlayerView();
else
#endif
if (rendermode != render_none)
@@ -477,13 +555,12 @@ static void D_Display(void)
if (rendermode == render_soft)
{
if (!splitscreen)
R_ApplyViewMorph();
if (!splitscreen)
R_ApplyViewMorph();
for (i = 0; i <= splitscreen; i++)
{
if (postimgtype[i])
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
V_DoPostProcessor(i, postimgparam[i]);
}
}
@@ -497,7 +574,6 @@ static void D_Display(void)
if (rendermode == render_soft)
{
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
usebuffer = true;
}
lastdraw = false;
}
@@ -531,7 +607,7 @@ static void D_Display(void)
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, V_SNAPTOTOP, patch);
}
if (demo.rewinding)
if (rendermode == render_soft && demo.rewinding)
V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM);
// vid size change is now finished if it was on...
@@ -561,11 +637,10 @@ static void D_Display(void)
{
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
ranwipe = true;
}
}
NetUpdate(); // send out any new accumulation
// It's safe to end the game now.
if (G_GetExitGameFlag())
{
@@ -610,6 +685,7 @@ static void D_Display(void)
PS_STOP_TIMING(ps_swaptime);
}
return ranwipe;
}
// =========================================================================
@@ -617,7 +693,6 @@ static void D_Display(void)
// =========================================================================
tic_t rendergametic;
static int menuInputDelayTimer = 0;
void D_SRB2Loop(void)
{
@@ -627,6 +702,7 @@ void D_SRB2Loop(void)
boolean interp = false;
boolean doDisplay = false;
int frameskip = 0;
if (dedicated)
server = true;
@@ -665,11 +741,11 @@ void D_SRB2Loop(void)
precise_t enterprecise = I_GetPreciseTime();
precise_t finishprecise = enterprecise;
{
// Casting the return value of a function is bad practice (apparently)
double budget = round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision());
capbudget = (precise_t) budget;
}
// Casting the return value of a function is bad practice (apparently)
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
capbudget = (precise_t) budget;
boolean ranwipe = false;
I_UpdateTime(cv_timescale.value);
@@ -696,16 +772,14 @@ void D_SRB2Loop(void)
debugload--;
#endif
interp = R_UsingFrameInterpolation() && !dedicated;
interp = (R_UsingFrameInterpolation() && !dedicated);
doDisplay = false;
#ifdef HW3SOUND
HW3S_BeginFrameUpdate();
#endif
renderisnewtic = (realtics > 0 || singletics);
refreshdirmenu = 0; // not sure where to put this, here as good as any?
if (realtics > 0 || singletics)
if (renderisnewtic)
{
// don't skip more than 10 frames at a time
// (fadein / fadeout cause massive frame skip!)
@@ -715,7 +789,7 @@ void D_SRB2Loop(void)
// process tics (but maybe not if realtic == 0)
TryRunTics(realtics);
if (lastdraw || singletics || gametic > rendergametic)
if (lastdraw || singletics || (gametic > rendergametic))
{
rendergametic = gametic;
rendertimeout = entertic + TICRATE/17;
@@ -724,14 +798,27 @@ void D_SRB2Loop(void)
}
else if (rendertimeout < entertic) // in case the server hang or netsplit
{
// Lagless camera! Yay!
if (cv_laglesscam.value && gamestate == GS_LEVEL && netgame)
{
// Evaluate the chase cam once for every local realtic
// This might actually be better suited inside G_Ticker or TryRunTics
for (tic_t chasecamtics = 0; (chasecamtics < realtics); chasecamtics++)
{
P_RunChaseCameras();
}
R_UpdateViewInterpolation();
}
doDisplay = true;
}
renderisnewtic = true;
}
else
{
renderisnewtic = false;
if (menuactive)
{
D_GamePadMenuScrollTicker();
}
D_DeviceLEDTick();
}
if (interp)
@@ -746,16 +833,26 @@ void D_SRB2Loop(void)
{
rendertimefrac = FRACUNIT;
}
if ((deltatics < 1.0) && !hu_stopped)
{
rendertimefrac_unpaused = g_time.timefrac;
}
else
{
rendertimefrac_unpaused = FRACUNIT;
}
}
else
{
renderdeltatics = realtics * FRACUNIT;
rendertimefrac = FRACUNIT;
rendertimefrac_unpaused = FRACUNIT;
}
if (interp || doDisplay)
if ((interp || doDisplay) && !frameskip)
{
D_Display();
ranwipe = D_Display();
}
// Only take screenshots after drawing.
@@ -767,59 +864,40 @@ void D_SRB2Loop(void)
// consoleplayer -> displayplayers (hear sounds from viewpoint)
S_UpdateSounds(); // move positional sounds
#ifdef HW3SOUND
HW3S_EndFrameUpdate();
#endif
LUA_Step();
#ifdef HAVE_DISCORDRPC
if (! dedicated)
if (!dedicated)
{
Discord_RunCallbacks();
}
#endif
// this is absolutely awful and i hate it lmao
if (menuactive && (DPADUPSCROLL || DPADDOWNSCROLL || DPADLEFTSCROLL || DPADRIGHTSCROLL))
{
event_t myev;
myev.type = ev_keydown;
if (renderisnewtic)
{
menuInputDelayTimer++;
if (menuInputDelayTimer >= 19) // TICRATE * ( (k+2) (1 - [wz + h + j - q]^2 - [(gk + 2g + k + 1)(h + j) + h - z]^2 - [16(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^2]^2 calculated by my butt
{
if (DPADUPSCROLL)
{
myev.data1 = KEY_UPARROW;
M_Responder(&myev);
}
else if (DPADDOWNSCROLL)
{
myev.data1 = KEY_DOWNARROW;
M_Responder(&myev);
}
else if (DPADLEFTSCROLL)
{
myev.data1 = KEY_LEFTARROW;
M_Responder(&myev);
}
else if (DPADRIGHTSCROLL)
{
myev.data1 = KEY_RIGHTARROW;
M_Responder(&myev);
}
}
}
}
else
menuInputDelayTimer = 0;
// Fully completed frame made.
finishprecise = I_GetPreciseTime();
// Use the time before sleep for frameskip calculations:
// post-sleep time is literally being intentionally wasted
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
deltatics = deltasecs * NEWTICRATE;
// If time spent this game loop exceeds a single tic,
// it's probably because of rendering.
//
// Skip rendering the next frame, up to a limit of 3
// frames before a frame is rendered no matter what.
//
// Wipes run an inner loop and artificially increase
// the measured time.
if (!ranwipe && (frameskip < 3) && (deltatics > 1.0))
{
frameskip++;
}
else
{
frameskip = 0;
}
if (!singletics)
{
INT64 elapsed = (INT64)(finishprecise - enterprecise);
@@ -827,7 +905,7 @@ void D_SRB2Loop(void)
// in the case of "match refresh rate" + vsync, don't sleep at all
const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0;
if (elapsed > 0 && (INT64)capbudget > elapsed && !vsync_with_match_refresh)
if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh)
{
I_SleepDuration(capbudget - (finishprecise - enterprecise));
}
@@ -898,11 +976,10 @@ void D_StartTitle(void)
//demosequence = -1;
gametype = GT_RACE; // SRB2kart
paused = false;
F_StartTitleScreen();
// Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade
/*if (rendermode != render_none)
V_SetPaletteLump("PLAYPAL");*/
S_ResetKeepAndSpecialMus(); // just in case
F_StartTitleScreen();
}
//
@@ -945,7 +1022,7 @@ static INT32 D_DetectFileType(const char* filename)
return 5;
else if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
return 6;
else if (!stricmp(&filename[strlen(filename) - 4], ".cfg"))
return 7;
else if (!stricmp(&filename[strlen(filename) - 4], ".txt"))
@@ -969,12 +1046,12 @@ static void D_AutoloadFile(const char *file, char **filearray)
if (!newfile)
I_Error("No more free memory to AutoloadFile %s",file);
if (!fileType)
if (!fileType)
{
CONS_Printf("D_AutoloadFile: File %s is unknown or invalid\n", file);
return;
}
strcpy(newfile, file);
if (fileType <= 6)
@@ -1004,8 +1081,7 @@ static void D_FindAddonsToAutoload(void)
const char *autoloadpath;
boolean postload;
INT32 i, len;
boolean hasprefix = false;
INT32 i;
char wadsToAutoload[256] = "";
// does it exist tho
@@ -1014,7 +1090,10 @@ static void D_FindAddonsToAutoload(void)
// If the file is found, run our shit
if (!autoloadconfigfile) // nope outta here
{
wasautoloaded = postautoloaded = true; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
return;
}
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL)
{
@@ -1024,7 +1103,8 @@ static void D_FindAddonsToAutoload(void)
|| (wadsToAutoload[0] == '#'))
continue;
// this marks it so that it loads after loading server addons
else if (fastncmp(wadsToAutoload, "postload ", 9)) {
else if (fastncmp(wadsToAutoload, "postload ", 9))
{
strremove(wadsToAutoload, "postload ");
postload = true;
}
@@ -1036,34 +1116,10 @@ static void D_FindAddonsToAutoload(void)
wadsToAutoload[i] = '\0';
}
len = strlen(wadsToAutoload);
hasprefix = false;
for (i = 0; i < len; ++i)
if (!postload && W_CheckPostLoadList(wadsToAutoload))
{
if (wadsToAutoload[i] == '_')
{
hasprefix = true;
break;
}
}
// Lets just hope no one adds bonuschars in autoload
if (hasprefix)
{
// We searching for c in prefix, which stands for "character" and doesn't work well with
// autoload atm, only fine for postload
for (i = 0; i < len; ++i)
{
if (wadsToAutoload[i] == '_') break; // Prefix end
if (wadsToAutoload[i] == 'c' || wadsToAutoload[i] == 'C')
{
CONS_Alert(CONS_WARNING, "forcing postload for %s as local skin\n", wadsToAutoload);
postload = true;
break; // Found it
}
}
CONS_Printf("forcing postload for file %s\n", wadsToAutoload);
postload = true;
}
// LOAD IT
@@ -1081,6 +1137,32 @@ static void D_FindAddonsToAutoload(void)
fclose(autoloadconfigfile);
}
static void D_AddAutoloadFiles(void)
{
if (wasautoloaded)
return;
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfiles);
wasautoloaded = true;
}
void D_AddPostloadFiles(void)
{
if (postautoloaded || !netgame)
return;
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
postautoloaded = true;
}
void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
@@ -1115,19 +1197,22 @@ boolean found_extra_kart;
boolean found_extra2_kart;
boolean found_extra3_kart;
boolean xtra_speedo; // extra speedometer check
boolean xtra_speedo_clr; // extra speedometer colour check
boolean xtra_speedo3; // 80x 11 extra speedometer check
boolean xtra_speedo_clr3; // 80x 11 extra speedometer colour check
boolean achi_speedo; // achiiro speedometer check
boolean achi_speedo_clr; // extra speedometer colour check
boolean clr_hud; // colour hud check
boolean big_lap; // bigger lap counter
boolean big_lap_color; // bigger lap counter but colour
boolean kartzspeedo; // kartZ speedo
boolean statdp; // stat display for extended player setup
boolean nametaggfx; // Nametag stuffs
boolean driftgaugegfx;
boolean xtra_speedo; // extra speedometer check
boolean xtra_speedo_clr; // extra speedometer colour check
boolean xtra_speedo3; // 80x 11 extra speedometer check
boolean xtra_speedo_clr3; // 80x 11 extra speedometer colour check
boolean achi_speedo; // achiiro speedometer check
boolean achi_speedo_clr; // extra speedometer colour check
boolean kartz_speedo; // kartZ speedo
boolean clr_hud; // colour hud check
boolean big_lap; // bigger lap counter
boolean big_lap_color; // bigger lap counter but colour
boolean statdp; // stat display for extended player setup
boolean nametaggfx; // Nametag stuffs
boolean driftgaugegfx; // Driftgauge stuffs
boolean multiitem_icon; // Extra icons for Sneakers, Banana and Jawz
//
static void IdentifyVersion(void)
{
@@ -1186,13 +1271,13 @@ static void IdentifyVersion(void)
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;
@@ -1353,8 +1438,6 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
I_mkdir(srb2home, 0700);
#else
snprintf(srb2home, sizeof srb2home, "%s", userhome);
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
@@ -1391,6 +1474,10 @@ void D_SRB2Main(void)
}
}
// Create addons dir
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
I_mkdir(addonsdir, 0755);
D_SetupProtocol();
// rand() needs seeded regardless of password
@@ -1489,13 +1576,15 @@ void D_SRB2Main(void)
// Possible value that changes depending on whether required files for speedometer are found or not
CV_PossibleValue_t speedo_cons_temp[NUMSPEEDOSTUFF] = {{1, "Default"}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}};
CV_PossibleValue_t driftgaugestyle_cons_temp[NUMSPEEDOSTUFF] = {{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {0, NULL}, {0, NULL}}; // ugh i dont want this but bleh
unsigned last_speedo_i = 0;
#define PUSHSPEEDO(id, name) { ++last_speedo_i; speedo_cons_temp[last_speedo_i].value = id; speedo_cons_temp[last_speedo_i].strvalue = name; }
unsigned last_driftgauge_i = 0;
#define PUSHCONS(cons, i, id, name) { ++i; cons[i].value = id; cons[i].strvalue = name; }
if (found_extra_kart || found_extra2_kart || found_extra3_kart) // found the funny, add it in!
{
// HAYA: These are seperated for a reason lmao
if (found_extra_kart)
if (found_extra_kart)
mainwads++;
if (found_extra2_kart)
mainwads++;
@@ -1506,7 +1595,7 @@ void D_SRB2Main(void)
if (W_CheckMultipleLumps("SP_SMSTC", "K_TRNULL", "SP_MKMH", "SP_MMPH", "SP_MFRAC", "SP_MPERC", NULL))
{
xtra_speedo = true;
PUSHSPEEDO(2, "Small");
PUSHCONS(speedo_cons_temp, last_speedo_i, 2, "Small");
}
if (W_LumpExists("SC_SMSTC"))
@@ -1516,14 +1605,14 @@ void D_SRB2Main(void)
if (W_CheckMultipleLumps("SP_AMSTC", "K_TRNULL", "SP_AKMH", "SP_AMPH", "SP_AFRAC", "SP_APERC", NULL))
{
achi_speedo = true;
PUSHSPEEDO(3, "Achii");
PUSHCONS(speedo_cons_temp, last_speedo_i, 3, "Achii");
}
if (W_CheckMultipleLumps("SC_AMSTC", "K_TRNULL", "SC_AKMH", "SC_AMPH", "SC_AFRAC", "SC_APERC", NULL))
achi_speedo_clr = true;
// check for bigger lap count
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
big_lap = true;
// now check for colour hud stuff
@@ -1532,7 +1621,7 @@ void D_SRB2Main(void)
clr_hud = true;
// check for bigger lap count but color** its color bitch
if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL))
if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL))
big_lap_color = true;
// kartzspeedo
@@ -1541,38 +1630,48 @@ void D_SRB2Main(void)
"K_KZSP13", "K_KZSP14", "K_KZSP15", "K_KZSP16", "K_KZSP17", "K_KZSP18", "K_KZSP19", \
"K_KZSP20", "K_KZSP21", "K_KZSP22", "K_KZSP23", "K_KZSP24", "K_KZSP25", NULL))
{
kartzspeedo = true;
PUSHSPEEDO(4, "P-Meter");
kartz_speedo = true;
PUSHCONS(speedo_cons_temp, last_speedo_i, 4, "P-Meter");
}
// stat display for extended player setup
if (W_CheckMultipleLumps("K_STATNB", "K_STATN1", "K_STATN2", "K_STATN3", "K_STATN4", \
"K_STATN5", "K_STATN6", NULL))
"K_STATN5", "K_STATN6", NULL))
statdp = true;
// Nametag stuffs
if (W_CheckMultipleLumps("NTLINE", "NTLINEV", "NTSP", "NTWH", NULL))
if (W_CheckMultipleLumps("NTLINE", "NTLINEV", "NTSP", "NTWH", NULL))
nametaggfx = true;
if (W_CheckMultipleLumps("K_DGAU","K_DCAU","K_DGSU","K_DCSU", NULL))
if (W_CheckMultipleLumps("K_DGAU","K_DCAU","K_DGSU","K_DCSU", NULL))
driftgaugegfx = true;
// extra item icons
if (W_CheckMultipleLumps("K_ITSHO2", "K_ITSHO3", "K_ITBAN2", "K_ITBAN3", "K_ITBAN4", "K_ITJAW2", NULL))
multiitem_icon = true;
if (found_extra3_kart)
{
// 80x11 speedometer crap
if (W_LumpExists("SP_SM3TC"))
{
xtra_speedo3 = true;
PUSHSPEEDO(5, "Extra");
PUSHCONS(speedo_cons_temp, last_speedo_i, 5, "Extra");
PUSHCONS(driftgaugestyle_cons_temp, last_driftgauge_i, 5, "Extra");
}
if (W_LumpExists("SC_SM3TC"))
xtra_speedo_clr3 = true;
}
}
}
#undef PUSHSPEEDO
#undef PUSHCONS
memcpy(speedo_cons_t, speedo_cons_temp, sizeof(speedo_cons_t));
memcpy(driftgaugestyle_cons_t, driftgaugestyle_cons_temp, sizeof(driftgaugestyle_cons_t));
// Do it before P_InitMapData because PNG patch
// conversion sometimes needs the palette
V_ReloadPalette();
//
// search for maps
@@ -1683,6 +1782,8 @@ void D_SRB2Main(void)
savedata.lives = 0; // flag this as not-used
loaded_config = true; // so pallettechange doesent get called 500 times at startup lol
//------------------------------------------------ COMMAND LINE PARAMS
// this must be done after loading gamedata,
@@ -1762,15 +1863,11 @@ void D_SRB2Main(void)
}
S_InitMusicDefs();
S_InitMTDefs();
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfiles);
D_AddAutoloadFiles();
// Set up splitscreen players before joining!
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
@@ -1973,15 +2070,14 @@ void D_SRB2Main(void)
if (dedicated && server)
{
pagename = "TITLESKY";
levelstarttic = gametic;
G_SetGamestate(GS_LEVEL);
if (!P_SetupLevel(false))
if (!P_SetupLevel(false, false))
I_Quit(); // fail so reset game stuff
}
#ifdef HAVE_DISCORDRPC
if (! dedicated)
if (!dedicated)
{
DRPC_Init();
}
+22 -13
View File
@@ -20,35 +20,44 @@
// make sure not to write back the config until it's been correctly loaded
extern tic_t rendergametic;
extern boolean loaded_config;
extern char srb2home[256]; //Alam: My Home
extern boolean usehome; //Alam: which path?
extern const char *pandf; //Alam: how to path?
extern char srb2path[256]; //Alam: SRB2's Home
// extra graphic patches for saturn specific thingies
extern boolean found_extra_kart; // for use in k_kart.c
extern boolean found_extra2_kart; // for use in k_kart.c
extern boolean found_extra3_kart; // for use in k_kart.c
extern boolean xtra_speedo; // extra speedometer check
extern boolean xtra_speedo_clr; // extra speedometer colour check
extern boolean xtra_speedo3; // 80x11 extra speedometer check
extern boolean xtra_speedo_clr3; // 80x11 extra speedometer colour check
extern boolean achi_speedo; // achiiro speedometer check
extern boolean achi_speedo_clr; // extra speedometer colour check
extern boolean clr_hud; // colour hud check
extern boolean big_lap; // bigger lap counter
extern boolean big_lap_color; // bigger lap counter but colour
extern boolean kartzspeedo; // kartZ speedo
extern boolean statdp; // stat display for extended player setup
extern boolean nametaggfx; // Nametag stuffs
extern boolean driftgaugegfx;
extern boolean xtra_speedo; // extra speedometer check
extern boolean xtra_speedo_clr; // extra speedometer colour check
extern boolean xtra_speedo3; // 80x11 extra speedometer check
extern boolean xtra_speedo_clr3; // 80x11 extra speedometer colour check
extern boolean achi_speedo; // achiiro speedometer check
extern boolean achi_speedo_clr; // extra speedometer colour check
extern boolean kartz_speedo; // kartZ speedo
extern boolean clr_hud; // colour hud check
extern boolean big_lap; // bigger lap counter
extern boolean big_lap_color; // bigger lap counter but colour
extern boolean statdp; // stat display for extended player setup
extern boolean nametaggfx; // Nametag stuffs
extern boolean driftgaugegfx; // Driftgauge stuffs
extern boolean multiitem_icon; // Extra icons for Sneakers, Banana and Jawz
//
// autoload stuff
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;
+30 -48
View File
@@ -64,16 +64,11 @@ static doomdata_t reboundstore[MAXREBOUND];
static INT16 reboundsize[MAXREBOUND];
static INT32 rebound_head, rebound_tail;
/// \brief bandwith of netgame
INT32 net_bandwidth;
/// \brief max length per packet
INT16 hardware_MAXPACKETLENGTH;
boolean (*I_NetGet)(void) = NULL;
void (*I_NetSend)(void) = NULL;
boolean (*I_NetCanSend)(void) = NULL;
boolean (*I_NetCanGet)(void) = NULL;
void (*I_NetCloseSocket)(void) = NULL;
void (*I_NetFreeNodenum)(INT32 nodenum) = NULL;
SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL;
@@ -643,6 +638,7 @@ void Net_WaitAllAckReceived(UINT32 timeout)
static void InitNode(node_t *node)
{
node->acktosend_head = node->acktosend_tail = 0;
memset(node->acktosend, 0, sizeof(node->acktosend));
node->firstacktosend = 0;
node->nextacknum = 1;
node->remotefirstack = 0;
@@ -793,7 +789,7 @@ static void fprintfstringnewline(char *s, size_t len)
}
/// \warning Keep this up-to-date if you add/remove/rename packet types
static const char *packettypename[NUMPACKETTYPE] =
const char *packettypename[NUMPACKETTYPE] =
{
"NOTHING",
"SERVERCFG",
@@ -836,13 +832,31 @@ static const char *packettypename[NUMPACKETTYPE] =
"MOREFILESNEEDED",
"PING"
#ifdef SATURNSYNCH
,
"WILLRESENDGAMESTATE",
"CANRECEIVEGAMESTATE",
"RECEIVEDGAMESTATE",
// we will reserve this for now even if unused, so order wont get mangled
"ISSATURN"
#endif
};
const char *Net_GetPacketName(UINT8 packettype)
{
if (packettype >= NUMPACKETTYPE)
return "UNKNOWN";
return packettypename[packettype];
}
static void DebugPrintpacket(const char *header)
{
fprintf(debugfile, "%-12s (node %d,ack %d,ackret %d,size %d) type(%d) : %s\n",
header, doomcom->remotenode, netbuffer->ack, netbuffer->ackreturn, doomcom->datalength,
netbuffer->packettype, packettypename[netbuffer->packettype]);
netbuffer->packettype, Net_GetPacketName(netbuffer->packettype));
switch (netbuffer->packettype)
{
@@ -1072,15 +1086,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
netbuffer->ackreturn = 0;
if (reliable)
{
if (I_NetCanSend && !I_NetCanSend())
{
if (netbuffer->packettype < PT_CANFAIL)
GetFreeAcknum(&netbuffer->ack, true);
DEBFILE("HSendPacket: Out of bandwidth\n");
return false;
}
else if (!GetFreeAcknum(&netbuffer->ack, false))
if (!GetFreeAcknum(&netbuffer->ack, false))
return false;
}
else
@@ -1208,7 +1214,7 @@ boolean HGetPacket(void)
}
break;
}
#endif // ndef NONET
#endif // ifndef NONET
return true;
}
@@ -1258,10 +1264,7 @@ void D_SetDoomcom(void)
{
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;
}
@@ -1280,13 +1283,11 @@ boolean D_CheckNetGame(void)
I_NetGet = Internal_Get;
I_NetSend = Internal_Send;
I_NetCanSend = NULL;
I_NetCloseSocket = NULL;
I_NetFreeNodenum = Internal_FreeNodenum;
I_NetMakeNodewPort = NULL;
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
net_bandwidth = 30000;
// I_InitNetwork sets doomcom and netgame
// check and initialize the network driver
multiplayer = false;
@@ -1306,7 +1307,6 @@ boolean D_CheckNetGame(void)
server = true; // WTF? server always true???
// no! The deault mode is server. Client is set elsewhere
// when the client executes connect command.
doomcom->ticdup = 1;
if (M_CheckParm("-extratic"))
{
@@ -1317,21 +1317,6 @@ boolean D_CheckNetGame(void)
CONS_Printf(M_GetText("Set extratics to %d\n"), doomcom->extratics);
}
if (M_CheckParm("-bandwidth"))
{
if (M_IsNextParm())
{
net_bandwidth = atoi(M_GetNextParm());
if (net_bandwidth < 1000)
net_bandwidth = 1000;
if (net_bandwidth > 100000)
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
CONS_Printf(M_GetText("Network bandwidth set to %d\n"), net_bandwidth);
}
else
I_Error("usage: -bandwidth <byte_per_sec>");
}
software_MAXPACKETLENGTH = hardware_MAXPACKETLENGTH;
if (M_CheckParm("-packetsize"))
{
@@ -1351,21 +1336,19 @@ boolean D_CheckNetGame(void)
if (netgame)
multiplayer = true;
if (doomcom->id != DOOMCOM_ID)
I_Error("Doomcom buffer invalid!");
if (doomcom->numnodes > MAXNETNODES)
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
netbuffer = (doomdata_t *)(void *)&doomcom->data;
#ifdef HOLEPUNCH
#ifdef HOLEPUNCH
holepunchpacket = (holepunch_t *)(void *)&doomcom->data;
#endif
#endif
#ifdef DEBUGFILE
if (M_CheckParm("-debugfile"))
{
char filename[21];
INT32 k = doomcom->consoleplayer - 1;
INT32 k = consoleplayer - 1;
if (M_IsNextParm())
k = atoi(M_GetNextParm()) - 1;
while (!debugfile && k < MAXPLAYERS)
@@ -1453,13 +1436,13 @@ void Command_Ping_f(void)
}
}
if (f_width < 10) f_width = 1;
if (f_width < 10) f_width = 1;
else if (f_width < 100) f_width = 2;
else f_width = 3;
else f_width = 3;
if (ms_width < 10) ms_width = 1;
if (ms_width < 10) ms_width = 1;
else if (ms_width < 100) ms_width = 2;
else ms_width = 3;
else ms_width = 3;
qsort(pingv, pingc, sizeof (struct pingcell), &pingcellcmp);
@@ -1498,7 +1481,6 @@ void D_CloseConnection(void)
I_NetGet = Internal_Get;
I_NetSend = Internal_Send;
I_NetCanSend = NULL;
I_NetCloseSocket = NULL;
I_NetFreeNodenum = Internal_FreeNodenum;
I_NetMakeNodewPort = NULL;
+1
View File
@@ -65,5 +65,6 @@ void Net_ConnectionTimeout(INT32 node);
void Net_AbortPacketType(UINT8 packettype);
void Net_SendAcks(INT32 node);
void Net_WaitAllAckReceived(UINT32 timeout);
const char *Net_GetPacketName(UINT8 packettype);
#endif
+405 -356
View File
File diff suppressed because it is too large. Load diff
+10 -19
View File
@@ -43,25 +43,12 @@ extern consvar_t cv_seenames, cv_allowseenames;
extern consvar_t cv_usemouse;
//WTF
extern consvar_t cv_mouseturn;
extern consvar_t cv_usejoystick;
extern consvar_t cv_usejoystick2;
extern consvar_t cv_usejoystick3;
extern consvar_t cv_usejoystick4;
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
#ifdef LJOYSTICK
extern consvar_t cv_joyport;
extern consvar_t cv_joyport2;
#endif
extern consvar_t cv_joyscale;
extern consvar_t cv_joyscale2;
extern consvar_t cv_joyscale3;
extern consvar_t cv_joyscale4;
// splitscreen with second mouse
extern consvar_t cv_mouse2port;
extern consvar_t cv_usemouse2;
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
extern consvar_t cv_mouse2opt;
#endif
extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS
// normally in p_mobj but the .h is not read
extern consvar_t cv_itemrespawntime;
@@ -128,6 +115,7 @@ extern consvar_t cv_kartvoterulechanges;
extern consvar_t cv_kartgametypepreference;
extern consvar_t cv_kartspeedometer;
extern consvar_t cv_kartvoices;
extern consvar_t cv_karthitemdialog;
extern consvar_t cv_karteliminatelast;
@@ -165,6 +153,7 @@ extern consvar_t cv_minihead;
extern consvar_t cv_showlapemblem;
extern consvar_t cv_showviewpointtext;
extern consvar_t cv_showdownloadprompt;
extern consvar_t cv_luaimmersion;
extern consvar_t cv_fakelocalskin;
extern consvar_t cv_showlocalskinmenus;
@@ -183,9 +172,7 @@ extern consvar_t cv_nametagdist;
extern consvar_t cv_showownnametag;
extern consvar_t cv_smallnametags;
extern consvar_t cv_nametagrestat;
extern consvar_t cv_nametaghop;
extern consvar_t cv_nametagscore;
extern consvar_t cv_shownametagfinish;
extern consvar_t cv_shownametagspectator;
#define SKINSELECTSPIN_PAIN 25
@@ -201,12 +188,18 @@ extern consvar_t cv_ps_thinkframe_page;
extern consvar_t cv_ps_samplesize;
extern consvar_t cv_ps_descriptor;
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
extern consvar_t cv_showtrackaddon;
extern consvar_t cv_showspecstuff;
extern consvar_t cv_betainterscreen;
extern consvar_t cv_laglesscam;
extern consvar_t cv_verticallook;
typedef enum
{
SKINMENUTYPE_SCROLL = 0,
@@ -304,8 +297,6 @@ typedef union {
#pragma pack()
#endif
extern tic_t driftsparkGrowTimer[16];
// add game commands, needs cleanup
void D_RegisterServerCommands(void);
void D_RegisterClientCommands(void);
+46 -7
View File
@@ -65,10 +65,10 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
#ifdef HAVE_CURL
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 35, 0)
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
#define XFERINFOFUNCTION
#else
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
#endif
#endif
@@ -111,6 +111,7 @@ static fileused_t transferFiles[UINT8_MAX + 1];
// Receiver structure
INT32 fileneedednum; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
static I_mutex downloadmutex;
char downloaddir[512] = "DOWNLOAD";
#ifdef CLIENT_LOADINGSCREEN
@@ -232,6 +233,9 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
void CL_PrepareDownloadSaveGame(const char *tmpsave)
{
#ifdef CLIENT_LOADINGSCREEN
lastfilenum = -1;
#endif
fileneedednum = 1;
fileneeded[0].status = FS_REQUESTED;
fileneeded[0].totalsize = UINT32_MAX;
@@ -833,7 +837,6 @@ void SV_FileSendTicker(void)
netbuffer->packettype = PT_FILEFRAGMENT;
// (((sendbytes-nowsentbyte)*TICRATE)/(I_GetTime()-starttime)<(UINT32)net_bandwidth)
while (packetsent-- && filestosend != 0)
{
for (i = currentnode, j = 0; j < MAXNETNODES;
@@ -1204,25 +1207,53 @@ size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
}
#ifdef XFERINFOFUNCTION
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
{
time_t curtime;
(void)clientp;
(void)ultotal;
(void)ulnow; // Function prototype requires these but we won't use, so just discard
curtime = time(NULL);
curl_dlnow = dlnow;
curl_dltotal = dltotal;
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
if (curtime > curl_starttime)
{
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
}
else
{
getbytes = 0;
}
return 0;
}
#else
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
{
time_t curtime;
(void)clientp;
(void)ultotal;
(void)ulnow; // Function prototype requires these but we won't use, so just discard
curtime = time(NULL);
curl_dlnow = dlnow;
curl_dltotal = dltotal;
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
if (curtime > curl_starttime)
{
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
}
else
{
getbytes = 0;
}
return 0;
}
#endif
@@ -1301,17 +1332,24 @@ void CURLPrepareFile(const char* url, int dfilenum)
curl_running = true;
#ifdef HAVE_THREADS
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
#endif
}
}
void CURLAbortFile(void)
{
curl_running = false;
// lock and unlock to wait for the download thread to exit
I_lock_mutex(&downloadmutex);
I_unlock_mutex(downloadmutex);
}
void CURLGetFile(void)
{
I_lock_mutex(&downloadmutex);
CURLMcode mc; /* return code used by curl_multi_wait() */
CURLcode easyres; /* Return from easy interface */
CURLMsg *m; /* for picking up messages with the transfer status */
@@ -1404,6 +1442,7 @@ void CURLGetFile(void)
multi_handle = NULL;
}
curl_running = false;
I_unlock_mutex(downloadmutex);
}
HTTP_login *
+19 -9
View File
@@ -347,6 +347,15 @@ typedef enum
RW_RAIL = 32
} ringweapons_t;
// enum for saved lap times
typedef enum
{
LAP_CUR,
LAP_BEST,
LAP_LAST,
LAP__MAX
} laptime_e;
// ========================================================================
// PLAYER STRUCTURE
// ========================================================================
@@ -395,7 +404,6 @@ typedef struct player_s
angle_t old_frameangle, old_frameangle2;
// SRB2Kart CEP: Sliptide rolling
INT32 sliptidemem;
angle_t sliproll;
INT16 lturn_max[MAXPREDICTTICS]; // What's the expected turn value for full-left for a number of frames back (to account for netgame latency)?
@@ -465,6 +473,7 @@ typedef struct player_s
INT16 numboxes; // Number of item boxes obtained for Race Mode
INT16 totalring; // Total number of rings obtained for Race Mode
tic_t realtime; // integer replacement for leveltime
tic_t laptime[LAP__MAX];
UINT8 laps; // Number of laps (optional)
////////////////////
@@ -537,15 +546,16 @@ typedef struct player_s
tic_t grieftime;
UINT8 griefstrikes;
UINT8 splitscreenindex;
#ifdef HWRENDER
fixed_t fovadd; // adjust FOV for hw rendering
#endif
tic_t hitemtimer;
UINT8 hitemvictim;
struct {
angle_t aiming, awayviewaiming, frameangle;
angle_t viewrollangle;
} lerp;
UINT8 splitscreenindex;
tic_t driftsparkGrowTimer;
fixed_t spinoutrot; // When a player spins out, this value increments modulus 360.
fixed_t fovadd; // adjust FOV for hw rendering
} player_t;
#endif
+1
View File
@@ -49,6 +49,7 @@ 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;
} thinker_t;
#endif
+146 -191
View File
File diff suppressed because it is too large. Load diff
+19 -12
View File
@@ -14,20 +14,26 @@
#define __DEHACKED_H__
#include "m_fixed.h" // for get_number
#include "info.h"
typedef enum
{
UNDO_NONE = 0x00,
UNDO_NEWLINE = 0x01,
UNDO_SPACE = 0x02,
UNDO_CUTLINE = 0x04,
UNDO_HEADER = 0x07,
UNDO_ENDTEXT = 0x08,
UNDO_TODO = 0,
UNDO_DONE = 0,
} undotype_f;
// Free slot names
// The crazy word-reading stuff uses these.
extern char *FREE_STATES[NUMSTATEFREESLOTS];
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
extern UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
#define DEH_WriteUndoline(a,b,c)
extern const char *const STATE_LIST[];
extern const char *const MOBJTYPE_LIST[];
extern const char *const MOBJFLAG_LIST[];
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
extern const char *const MOBJEFLAG_LIST[];
extern const char *const MAPTHINGFLAG_LIST[4];
extern const char *const PLAYERFLAG_LIST[];
extern const char *const ML_LIST[]; // Linedef flags
extern const char *COLOR_ENUMS[];
extern const char *const POWERS_LIST[];
extern const char *const KARTSTUFF_LIST[];
extern const char *const HUDITEMS_LIST[];
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
@@ -41,6 +47,7 @@ fixed_t get_number(const char *word);
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
const char *LUA_GetActionName(void *action);
void LUA_SetActionByName(void *state, const char *actiontocompare);
enum actionnum LUA_GetActionNumByName(const char *actiontocompare);
extern boolean deh_loaded;
+53 -24
View File
@@ -21,7 +21,6 @@
#define SOUND_DUMMY 0
#define SOUND_SDL 1
#define SOUND_MIXER 2
#define SOUND_FMOD 3
#ifndef SOUND
#ifdef HAVE_SDL
@@ -29,9 +28,6 @@
// Use Mixer interface?
#ifdef HAVE_MIXER
#define SOUND SOUND_MIXER
#ifdef HW3SOUND
#undef HW3SOUND
#endif
#endif
// Use generic SDL interface.
@@ -40,18 +36,8 @@
#endif
#else // No SDL.
// Use FMOD?
#ifdef HAVE_FMOD
#define SOUND SOUND_FMOD
#ifdef HW3SOUND
#undef HW3SOUND
#endif
#else
// No more interfaces. :(
#define SOUND SOUND_DUMMY
#endif
// No more interfaces. :(
#define SOUND SOUND_DUMMY
#endif
#endif
@@ -127,13 +113,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#ifndef USE_FBO_OGL
#define VERSIONSTRING "Saturn v6.2 "
#define VERSIONSTRINGW L"Saturn v6.2"
#else
#define VERSIONSTRING "Saturn v6.2 - FBO "
#define VERSIONSTRINGW L"Saturn v6.2 - FBO"
#endif
#define VERSIONSTRING "Saturn v7.2"
#define VERSIONSTRINGW L"Saturn v7.2"
// 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!
@@ -211,6 +192,7 @@ extern char logfilename[1024];
#define MAXPLAYERS 16
#define MAXSKINS 255
#define MAXLOCALSKINS 32
#define PLAYERSMASK (MAXPLAYERS-1)
#define MAXPLAYERNAME 21
@@ -473,7 +455,12 @@ void M_StartupLocale(void);
// M_GetText function that just returns the string.
#define M_GetText(x) (x)
#endif
void *M_Memcpy(void* dest, const void* src, size_t n);
FUNCINLINE static ATTRINLINE void *M_Memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
char *va(const char *format, ...) FUNCPRINTF;
char *M_GetToken(const char *inputString);
char *sizeu1(size_t num);
@@ -521,12 +508,31 @@ extern boolean capslock;
// i_system.c, replace getchar() once the keyboard has been appropriated
INT32 I_GetKey(void);
/* http://www.cse.yorku.ca/~oz/hash.html */
static inline
UINT32 quickncasehash (const char *p, size_t n)
{
size_t i = 0;
UINT32 x = 5381;
while (i < n && p[i])
{
x = (x * 33) ^ tolower(p[i]);
i++;
}
return x;
}
#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
#ifndef CLAMP
#define CLAMP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
#endif
#ifndef M_PIl
#define M_PIl 3.1415926535897932384626433832795029L
@@ -563,6 +569,29 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
// None of these that are disabled in the normal build are guaranteed to work perfectly
// Compile them at your own risk!
#ifndef NONET
//-- SATURN __
/// Enable gamestate resynching between Saturn servers and clients
/// Like SRB2 and RR does
/// Still highly experimental
#ifdef DOSATURNSYNCH
#define SATURNSYNCH
/// Detect if a client is on Saturn in the clientconfig.
/// To seperately allow them to join or block joining from vanilla clients.
#ifdef DOSATURNJOIN
#define SATURNJOIN
#endif
#endif
/// Server detection for if a connecting client is on Saturn.
/// For stuff like extra synching, etc.
#ifdef DOSATURNPAK
#define SATURNPAK
#endif
//-- <( ̄︶ ̄)> __
#endif
/// Undefine to use the new method of Gamma correction see colour cube in v_video.c
#define BACKWARDSCOMPATCORRECTION
+49 -8
View File
@@ -30,16 +30,26 @@
// =============================
// Selected by user.
extern INT16 gamemap;
extern char mapmusname[7];
extern UINT16 mapmusflags;
extern UINT32 mapmusposition;
extern UINT32 mapmusresume;
typedef struct
{
char name[7]; // Music name, up to 6-character name
void *data; // Music lump
UINT16 flags; // Track and reset bit
boolean looping; // Is this music looping?
UINT32 position; // Position to jump to
UINT32 resume; // Saved Position when music was stopped
UINT32 fadeinms; // Fade in time in ms (used for queue)
} music_t;
extern music_t mapmusic;
#define MUSIC_TRACKMASK 0x0FFF // ----************
#define MUSIC_RELOADRESET 0x8000 // *---------------
#define MUSIC_FORCERESET 0x4000 // -*--------------
// Use other bits if necessary.
extern INT16 gamemap;
extern INT16 maptol;
extern UINT8 globalweather;
extern INT32 curWeather;
@@ -112,7 +122,6 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
extern boolean nodrawers;
extern boolean noblit;
extern boolean lastdraw;
extern postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
extern INT32 viewwindowx, viewwindowy;
@@ -192,7 +201,7 @@ extern struct quake
// camera offsets and duration
fixed_t x,y,z;
angle_t roll;
UINT16 time;
tic_t time;
// location, radius, and intensity...
mappoint_t *epicenter;
@@ -213,6 +222,15 @@ typedef struct
char value[256]; // 255 usable characters. If this seriously isn't enough then wtf.
} customoption_t;
typedef struct
{
boolean use_custom_light;
UINT8 light_contrast; ///< Range of wall lighting. 0 is no lighting.
SINT8 sprite_backlight; ///< Subtract from wall lighting for sprites only.
boolean use_light_angle; ///< When false, wall lighting is evenly distributed. When true, wall lighting is directional.
angle_t light_angle; ///< Angle of directional wall lighting.
} mapheader_lighting_t;
/** Map header information.
*/
typedef struct
@@ -260,6 +278,10 @@ typedef struct
//boolean automap; ///< Displays a level's white map outline in modified games
fixed_t mobj_scale; ///< Replacement for TOL_ERZ3
mapheader_lighting_t lighting; ///< Wall and sprite lighting
mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode
boolean use_encore_lighting; ///< Whether to use separate Encore lighting
// Music stuff.
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
char musintername[7]; ///< Intermission screen music.
@@ -455,6 +477,14 @@ extern tic_t racecountdown, exitcountdown;
extern fixed_t gravity;
extern fixed_t mapobjectscale;
extern struct maplighting
{
UINT8 contrast;
SINT8 backlight;
boolean directional;
angle_t angle;
} maplighting;
//for CTF balancing
extern INT16 autobalance;
extern INT16 teamscramble;
@@ -483,7 +513,6 @@ extern boolean startedInFreePlay;
extern boolean legitimateexit;
extern boolean comebackshowninfo;
extern tic_t curlap, bestlap;
extern INT16 votelevels[4][2];
extern SINT8 votes[MAXPLAYERS];
@@ -510,6 +539,18 @@ extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
#define WAYPOINTSEQUENCESIZE 256
#define NUMWAYPOINTSEQUENCES 256
extern mobj_t *waypoints[NUMWAYPOINTSEQUENCES][WAYPOINTSEQUENCESIZE];
extern UINT16 numwaypoints[NUMWAYPOINTSEQUENCES];
void P_AddWaypoint(UINT8 sequence, UINT8 id, mobj_t *waypoint);
mobj_t *P_GetFirstWaypoint(UINT8 sequence);
mobj_t *P_GetLastWaypoint(UINT8 sequence);
mobj_t *P_GetPreviousWaypoint(mobj_t *current, boolean wrap);
mobj_t *P_GetNextWaypoint(mobj_t *current, boolean wrap);
mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo);
// =====================================
// Internal parameters, used for engine.
// =====================================
+27 -11
View File
@@ -342,17 +342,6 @@ union FColorRGBA
} ATTRPACK;
typedef union FColorRGBA RGBA_t;
typedef enum
{
postimg_none,
postimg_water,
postimg_motion,
postimg_flip,
postimg_heat,
postimg_mirror,
postimg_mirrorflip
} postimg_t;
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
#define LUMPERROR UINT32_MAX
@@ -367,6 +356,33 @@ typedef UINT32 tic_t;
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
#endif
#define TOSTR(x) #x
typedef UINT8 bitarray_t;
#define BIT_ARRAY_SIZE(n) (((n) + 7) >> 3)
static inline int
in_bit_array (const bitarray_t * const array, const int value)
{
return (array[value >> 3] & (1<<(value & 7)));
}
static inline void
set_bit_array (bitarray_t * const array, const int value)
{
array[value >> 3] |= (1<<(value & 7));
}
static inline void
unset_bit_array (bitarray_t * const array, const int value)
{
array[value >> 3] &= ~(1<<(value & 7));
}
#define intsign(n) \
((n) < 0 ? -1 : (n) > 0 ? 1 : 0)
typedef UINT64 precise_t;
#endif //__DOOMTYPE__
-4
View File
@@ -92,8 +92,6 @@ void I_OutputMsg(const char *error, ...)
void I_StartupMouse(void){}
void I_StartupMouse2(void){}
void I_StartupKeyboard(void){}
INT32 I_GetKey(void)
@@ -146,8 +144,6 @@ void I_GetJoystickEvents(void){}
void I_GetJoystick2Events(void){}
void I_GetMouseEvents(void){}
char *I_GetEnv(const char *name)
{
(void)name;
+5 -5
View File
@@ -170,8 +170,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) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
anim2 = (SHORT(pat2->width)<<FRACBITS) - ((((finalecount * scrollspeed) % (SHORT(pat2->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
animtimer = ((((finalecount * scrollspeed) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
anim2 = (SHORT(pat2->width)<<FRACBITS) - ((((finalecount * scrollspeed) % (SHORT(pat2->width)*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
// SRB2Kart: F_DrawPatchCol is over-engineered; recoded to be less shitty and error-prone
if (rendermode != render_none)
@@ -996,7 +996,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_GetHudUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetMenuUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
}
else if (finalecount < 52)
{
@@ -1012,8 +1012,8 @@ void F_TitleScreenDrawer(void)
F_SkyScroll(titlescrollspeed);
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
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);
if (transval)
V_DrawFadeScreen(120, 10 - transval);
+1 -1
View File
@@ -273,7 +273,7 @@ static void F_DoWipe(fademask_t *fademask)
else
{
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
transtbl = R_GetTranslucencyTable((9 - *mask) + 1);
// DRAWING LOOP
while (draw_linestogo--)
+16 -17
View File
@@ -37,7 +37,6 @@
#include <tchar.h>
#define SUFFIX "*"
#define SLASH "\\"
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#ifndef INVALID_FILE_ATTRIBUTES
@@ -135,7 +134,7 @@ opendir (const CHAR *szPath)
/* Allocate enough space to store DIR structure and the complete
* directory path given. */
nd = (DIR *) malloc (sizeof (DIR) + (strlen(szFullPath) + strlen (SLASH) +
strlen(SUFFIX) + 1) * sizeof (CHAR));
strlen(PATHSEP) + 1) * sizeof (CHAR));
if (!nd)
{
@@ -149,10 +148,9 @@ opendir (const CHAR *szPath)
/* Add on a slash if the path does not end with one. */
if (nd->dd_name[0] != '\0' &&
nd->dd_name[strlen (nd->dd_name) - 1] != '/' &&
nd->dd_name[strlen (nd->dd_name) - 1] != '\\')
nd->dd_name[strlen (nd->dd_name) - 1] != PATHSEP[0])
{
strcat (nd->dd_name, SLASH);
strcat (nd->dd_name, PATHSEP);
}
/* Add on the search pattern */
@@ -329,7 +327,8 @@ char menupath[1024];
size_t menupathindex[menudepth];
size_t menudepthleft = menudepth;
char menusearch[MAXSTRINGLENGTH+1];
char menusearchbuf[MAXSTRINGLENGTH+1];
textinput_t menusearch;
char **dirmenu, **coredirmenu; // core only local for this file
size_t sizedirmenu, sizecoredirmenu; // ditto
@@ -382,9 +381,9 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
return FS_NOTFOUND;
}
if (searchpath[searchpathindex[depthleft]-2] != '/')
if (searchpath[searchpathindex[depthleft]-2] != PATHSEP[0])
{
searchpath[searchpathindex[depthleft]-1] = '/';
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
searchpath[searchpathindex[depthleft]] = 0;
}
else
@@ -392,7 +391,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
while ((!found) && (depthleft < maxsearchdepth))
{
searchpath[searchpathindex[depthleft]]=0;
searchpath[searchpathindex[depthleft]] = 0;
dent = readdir(dirhandle[depthleft]);
if (!dent)
@@ -419,7 +418,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
if (S_ISDIR(fsstat.st_mode))
dent->d_type = DT_DIR;
else if (S_ISLNK(fsstat.st_mode))
dent->d_type = DT_LNK;
dent->d_type = DT_LNK;
}
// Symlinks aren't always directory symlinks. Dunno if this would resolve recursive
@@ -447,8 +446,8 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
depthleft++;
}
searchpath[searchpathindex[depthleft]-1]='/';
searchpath[searchpathindex[depthleft]]=0;
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
searchpath[searchpathindex[depthleft]] = 0;
}
else if (!strcasecmp(searchname, dent->d_name))
{
@@ -499,7 +498,7 @@ static boolean filemenucmp(char *haystack, char *needle)
strupr(localhaystack);
if (cv_addons_search_type.value)
return (strstr(localhaystack, needle) != 0);
return (!strncmp(localhaystack, needle, menusearch[0]));
return (!strncmp(localhaystack, needle, menusearch.length));
}
void closefilemenu(boolean validsize)
@@ -565,7 +564,7 @@ void searchfilemenu(char *tempname)
first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP...
if (!menusearch[0])
if (!menusearch.length)
{
if (dirmenu)
Z_Free(dirmenu);
@@ -592,7 +591,7 @@ void searchfilemenu(char *tempname)
return;
}
strcpy(localmenusearch, menusearch+1);
strcpy(localmenusearch, menusearch.buffer);
if (!cv_addons_search_case.value)
strupr(localmenusearch);
@@ -654,7 +653,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
}
else
menusearch[0] = menusearch[1] = 0; // clear search
M_TextInputInit(&menusearch, menusearchbuf, MAXSTRINGLENGTH+1);
if (!(dirhandle = opendir(menupath))) // get directory
{
@@ -798,7 +797,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
}
else if (ext == EXT_TXT)
{
if (!strcmp(dent->d_name, "log.txt") || !strcmp(dent->d_name, "errorlog.txt"))
if (!strncmp(dent->d_name, "log-", 4) || !strcmp(dent->d_name, "errorlog.txt"))
ext |= EXT_LOADED;
}
+3 -1
View File
@@ -7,6 +7,7 @@
#include "doomdef.h"
#include "d_netfil.h"
#include "m_menu.h" // MAXSTRINGLENGTH
#include "m_textinput.h"
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
@@ -34,7 +35,8 @@ extern char menupath[1024];
extern size_t menupathindex[menudepth];
extern size_t menudepthleft;
extern char menusearch[MAXSTRINGLENGTH+1];
extern char menusearchbuf[MAXSTRINGLENGTH+1];
extern textinput_t menusearch;
extern char **dirmenu;
extern size_t sizedirmenu;
+967 -1372
View File
File diff suppressed because it is too large. Load diff
+69 -41
View File
@@ -17,6 +17,8 @@
#include "doomdef.h"
#include "doomstat.h"
#include "d_event.h"
#include "p_saveg.h"
#include "m_textinput.h"
extern char gamedatafilename[64];
extern char timeattackfolder[64];
@@ -32,18 +34,19 @@ extern INT32 player_name_changes[MAXPLAYERS];
extern player_t players[MAXPLAYERS];
extern boolean playeringame[MAXPLAYERS];
extern UINT8 *demo_p;
extern savebuffer_t demobuf;
// ======================================
// DEMO playback/recording related stuff.
// ======================================
// demoplaying back and demo recording
extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality, cv_maxdemosize;
extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality, cv_maxdemosize, cv_demochangemap;
// Publicly-accessible demo vars
struct demovars_s {
char titlename[65];
textinput_t titlenameinput;
boolean recording, playback, timing;
UINT16 version; // Current file format of the demo being played
boolean title; // Title Screen demo can be cancelled by any key
@@ -63,9 +66,6 @@ struct demovars_s {
DSM_WILLSAVE,
DSM_SAVED
} savemode;
boolean freecam;
};
extern struct demovars_s demo;
@@ -115,15 +115,24 @@ extern consvar_t cv_songcredits;
extern consvar_t cv_showfreeplay;
extern consvar_t cv_growmusic, cv_supermusic;
extern consvar_t cv_pauseifunfocused;
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_lookbackaxis,cv_custom1axis,cv_custom2axis,cv_custom3axis,cv_xdeadzone,cv_ydeadzone;
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_lookbackaxis2,cv_custom1axis2,cv_custom2axis2,cv_custom3axis2,cv_xdeadzone2,cv_ydeadzone2;
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_lookbackaxis3,cv_custom1axis3,cv_custom2axis3,cv_custom3axis3,cv_xdeadzone3,cv_ydeadzone3;
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_custom1axis4,cv_custom2axis4,cv_custom3axis4,cv_xdeadzone4,cv_ydeadzone4;
extern consvar_t cv_invertmouse;
extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_camturnaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_camstrafeaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
// Hud offsets
@@ -137,24 +146,27 @@ extern consvar_t cv_##name##_yoffset;
DECL_HUD_OFFSET_X(name)\
DECL_HUD_OFFSET_Y(name)
DECL_HUD_OFFSET(item); // Item box
DECL_HUD_OFFSET(time); // Time
DECL_HUD_OFFSET(laps); // Number of laps
DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
DECL_HUD_OFFSET(speed); // Speedometer
DECL_HUD_OFFSET(posi); // Position in race
DECL_HUD_OFFSET(face); // Mini rankings
DECL_HUD_OFFSET(stcd); // Starting countdown
DECL_HUD_OFFSET(item); // Item box
DECL_HUD_OFFSET(time); // Time
DECL_HUD_OFFSET(laps); // Number of laps
DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
DECL_HUD_OFFSET(speed); // Speedometer
DECL_HUD_OFFSET(posi); // Position in race
DECL_HUD_OFFSET(wheel); // RA Wheel
DECL_HUD_OFFSET(face); // Mini rankings
DECL_HUD_OFFSET(stcd); // Starting countdown
DECL_HUD_OFFSET_Y(chek); // Check gfx
DECL_HUD_OFFSET(mini); // Minimap
DECL_HUD_OFFSET(want); // Wanted
DECL_HUD_OFFSET(stat); // Stats
DECL_HUD_OFFSET(mini); // Minimap
DECL_HUD_OFFSET(want); // Wanted
DECL_HUD_OFFSET(stat); // Stats
#undef DECL_HUD_OFFSET
#undef DECL_HUD_OFFSET_X
#undef DECL_HUD_OFFSET_Y
extern consvar_t cv_showinput;
extern consvar_t cv_posanim;
extern consvar_t cv_smallposnum;
extern consvar_t cv_newspeedometer;
extern consvar_t cv_saltyhop;
@@ -164,11 +176,11 @@ extern consvar_t cv_saltysquish;
extern consvar_t cv_driftsparkpulse;
extern consvar_t cv_gravstretch;
extern consvar_t cv_sloperoll;
extern consvar_t cv_spriteroll;
extern consvar_t cv_sliptideroll;
extern consvar_t cv_slamsound;
extern consvar_t cv_sloperolldist;
extern consvar_t cv_sparkroll;
extern consvar_t cv_spinoutroll;
extern consvar_t cv_cechotoggle;
@@ -181,6 +193,8 @@ typedef enum
AXISNONE = 0,
AXISTURN,
AXISMOVE,
AXISCAMTURN,
AXISCAMSTRAFE,
AXISBRAKE,
AXISAIM,
AXISLOOK,
@@ -262,9 +276,9 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost);
// A normal game starts at map 1, but a warp test can start elsewhere
void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar,
UINT8 ssplayers, boolean FLS);
void G_DoLoadLevel(boolean resetplayer);
void G_LoadDemoInfo(menudemo_t *pdemo);
void G_LoadDemoTitle(menudemo_t *pdemo); // For use in replay search feature
void G_DeferedPlayDemo(const char *demo);
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
@@ -351,6 +365,7 @@ extern demoghost *ghosts;
#define DFILE_ERROR_CANNOTLOAD 0x04 // Files are missing and cannot be loaded.
#define DFILE_ERROR_EXTRAFILES 0x05 // Extra files outside of the replay's file list are loaded.
void G_ResetDemoRecording(void);
void G_DoPlayDemo(char *defdemoname);
void G_TimeDemo(const char *name);
void G_AddGhost(char *defdemoname);
@@ -414,25 +429,36 @@ void G_SetGamestate(gamestate_t newstate);
// Gamedata record shit
void G_AllocMainRecordData(INT16 i);
//void G_AllocNightsRecordData(INT16 i);
void G_ClearRecords(void);
//UINT32 G_GetBestScore(INT16 map);
tic_t G_GetBestTime(INT16 map);
//tic_t G_GetBestLap(INT16 map);
//UINT16 G_GetBestRings(INT16 map);
//UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare);
//tic_t G_GetBestNightsTime(INT16 map, UINT8 mare);
//UINT8 G_GetBestNightsGrade(INT16 map, UINT8 mare);
//void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare);
//void G_SetNightsRecords(void);
// Time utility functions
FUNCMATH INT32 G_TicsToHours(tic_t tics);
FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full);
FUNCMATH INT32 G_TicsToSeconds(tic_t tics);
FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToHours(tic_t tics)
{
return tics/(3600*TICRATE);
}
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full)
{
return full ? (tics/(60*TICRATE)) : (tics/(60*TICRATE)%60);
}
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToSeconds(tic_t tics)
{
return (tics/TICRATE)%60;
}
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics)
{
return (INT32)((tics%TICRATE) * (100.00f/TICRATE));
}
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics)
{
return (INT32)((tics%TICRATE) * (1000.00f/TICRATE));
}
// Don't split up TOL handling
INT16 G_TOLFlag(INT32 pgametype);
@@ -440,4 +466,6 @@ INT16 G_TOLFlag(INT32 pgametype);
INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer);
void G_AddMapToBuffer(INT16 map);
void G_FixCamera(UINT8 view);
#endif
+189 -39
View File
@@ -14,11 +14,17 @@
#include "doomdef.h"
#include "doomstat.h"
#include "g_input.h"
#include "g_game.h"
#include "keys.h"
#include "hu_stuff.h" // need HUFONT start & end
#include "d_net.h"
#include "console.h"
#include "i_system.h"
#include "i_video.h"
#include "r_draw.h"
#include "v_video.h"
#define MAXMOUSESENSITIVITY 100 // sensitivity steps
static CV_PossibleValue_t mousesens_cons_t[] = {{1, "MIN"}, {MAXMOUSESENSITIVITY, "MAX"}, {0, NULL}};
@@ -27,17 +33,96 @@ static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "
// mouse values are used once
consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mousesens2 = {"mousesens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mouseysens2 = {"mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_turnsmooth = {"turnsmoothing", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static void G_ResetPlayerDeviceRumble(INT32 player);
static void rumble_off_handle(void);
static void rumble_off_handle2(void);
static void rumble_off_handle3(void);
static void rumble_off_handle4(void);
static void G_ResetPlayerGamepadIndicatorColor(INT32 player);
static void led_off_handle(void);
static void led_off_handle2(void);
static void led_off_handle3(void);
static void led_off_handle4(void);
consvar_t cv_rumble[MAXSPLITSCREENPLAYERS] = {
{"rumble", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle, 0, NULL, NULL, 0, 0, NULL},
{"rumble2", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle2, 0, NULL, NULL, 0, 0, NULL},
{"rumble3", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle3, 0, NULL, NULL, 0, 0, NULL},
{"rumble4", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, rumble_off_handle4, 0, NULL, NULL, 0, 0, NULL}
};
consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = {
{"gamepadled", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle, 0, NULL, NULL, 0, 0, NULL},
{"gamepadled2", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle2, 0, NULL, NULL, 0, 0, NULL},
{"gamepadled3", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle3, 0, NULL, NULL, 0, 0, NULL},
{"gamepadled4", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
};
consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS] = {
{"ledpowerup", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle, 0, NULL, NULL, 0, 0, NULL},
{"ledpowerup2", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle2, 0, NULL, NULL, 0, 0, NULL},
{"ledpowerup3", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle3, 0, NULL, NULL, 0, 0, NULL},
{"ledpowerup4", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
};
static void rumble_off_handle(void)
{
if (cv_rumble[0].value == 0)
G_ResetPlayerDeviceRumble(0);
}
static void rumble_off_handle2(void)
{
if (cv_rumble[1].value == 0)
G_ResetPlayerDeviceRumble(1);
}
static void rumble_off_handle3(void)
{
if (cv_rumble[2].value == 0)
G_ResetPlayerDeviceRumble(2);
}
static void rumble_off_handle4(void)
{
if (cv_rumble[3].value == 0)
G_ResetPlayerDeviceRumble(3);
}
static void led_off_handle(void)
{
G_ResetPlayerGamepadIndicatorColor(0);
}
static void led_off_handle2(void)
{
G_ResetPlayerGamepadIndicatorColor(1);
}
static void led_off_handle3(void)
{
G_ResetPlayerGamepadIndicatorColor(2);
}
static void led_off_handle4(void)
{
G_ResetPlayerGamepadIndicatorColor(3);
}
INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
INT32 mouse2x, mouse2y, mlook2y;
// joystick values are repeated
INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
@@ -59,7 +144,6 @@ typedef struct
} dclick_t;
static dclick_t mousedclicks[MOUSEBUTTONS];
static dclick_t joydclicks[JOYBUTTONS + JOYHATS*4];
static dclick_t mouse2dclicks[MOUSEBUTTONS];
static dclick_t joy2dclicks[JOYBUTTONS + JOYHATS*4];
static dclick_t joy3dclicks[JOYBUTTONS + JOYHATS*4];
static dclick_t joy4dclicks[JOYBUTTONS + JOYHATS*4];
@@ -144,14 +228,6 @@ void G_MapEventsToControls(event_t *ev)
if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3;
break;
case ev_mouse2: // buttons are virtual keys
if (menuactive || CON_Ready() || chat_on)
break;
mouse2x = (INT32)(ev->data2*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f));
mouse2y = (INT32)(ev->data3*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f));
mlook2y = (INT32)(ev->data3*((cv_mouseysens2.value*cv_mousesens2.value)/110.0f + 0.1f));
break;
default:
break;
}
@@ -169,12 +245,6 @@ void G_MapEventsToControls(event_t *ev)
gamekeydown[KEY_DBLJOY1+i] = flag;
}
for (i = 0; i < MOUSEBUTTONS; i++)
{
flag = G_CheckDoubleClick(gamekeydown[KEY_2MOUSE1+i], &mouse2dclicks[i]);
gamekeydown[KEY_DBL2MOUSE1+i] = flag;
}
for (i = 0; i < JOYBUTTONS + JOYHATS*4; i++)
{
flag = G_CheckDoubleClick(gamekeydown[KEY_2JOY1+i], &joy2dclicks[i]);
@@ -312,18 +382,8 @@ static keyname_t keynames[] =
{KEY_MOUSE1+5,"MOUSE6"},
{KEY_MOUSE1+6,"MOUSE7"},
{KEY_MOUSE1+7,"MOUSE8"},
{KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
{KEY_2MOUSE1+1,"SEC_MOUSE1"},
{KEY_2MOUSE1+2,"SEC_MOUSE3"},
{KEY_2MOUSE1+3,"SEC_MOUSE4"},
{KEY_2MOUSE1+4,"SEC_MOUSE5"},
{KEY_2MOUSE1+5,"SEC_MOUSE6"},
{KEY_2MOUSE1+6,"SEC_MOUSE7"},
{KEY_2MOUSE1+7,"SEC_MOUSE8"},
{KEY_MOUSEWHEELUP, "Wheel 1 UP"},
{KEY_MOUSEWHEELDOWN, "Wheel 1 Down"},
{KEY_2MOUSEWHEELUP, "Wheel 2 UP"},
{KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"},
{KEY_JOY1+0, "JOY1"},
{KEY_JOY1+1, "JOY2"},
@@ -334,7 +394,7 @@ static keyname_t keynames[] =
{KEY_JOY1+6, "JOY7"},
{KEY_JOY1+7, "JOY8"},
{KEY_JOY1+8, "JOY9"},
#if !defined (NOMOREJOYBTN_1S)
// we use up to 32 buttons in DirectInput
{KEY_JOY1+9, "JOY10"},
@@ -387,14 +447,6 @@ static keyname_t keynames[] =
{KEY_DBLMOUSE1+5, "DBLMOUSE6"},
{KEY_DBLMOUSE1+6, "DBLMOUSE7"},
{KEY_DBLMOUSE1+7, "DBLMOUSE8"},
{KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
{KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"},
{KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"},
{KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"},
{KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"},
{KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"},
{KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"},
{KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"},
{KEY_DBLJOY1+0, "DBLJOY1"},
{KEY_DBLJOY1+1, "DBLJOY2"},
@@ -779,7 +831,6 @@ static keyname_t keynames[] =
{KEY_DBL4HAT1+13, "DBLFOR_HATDOWN4"},
{KEY_DBL4HAT1+14, "DBLFOR_HATLEFT4"},
{KEY_DBL4HAT1+15, "DBLFOR_HATRIGHT4"},
};
static const char *gamecontrolname[num_gamecontrols] =
@@ -812,10 +863,109 @@ static const char *gamecontrolname[num_gamecontrols] =
"custom1",
"custom2",
"custom3",
"director",
"freecam",
"camfloat",
"camsink",
"strafeleft",
"straferight",
};
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
#include "k_kart.h"
UINT16 G_GetSkinColor(INT32 playernum)
{
if (gamestate == GS_LEVEL)
{
player_t *player = &players[displayplayers[playernum]];
// make rgb rainbow vomit when invul or flash blue when grow
if (cv_ledpowerup[playernum].value && player->mo && (player->kartstuff[k_invincibilitytimer] || player->kartstuff[k_growshrinktimer] || player->powers[pw_invulnerability]))
return player->mo->color;
// take actual player skincolour when ingame
if (player->skincolor)
return player->skincolor;
}
// otherwise just fallback to whatever the cvar is
switch (playernum)
{
case 0:
return cv_playercolor.value;
case 1:
return cv_playercolor2.value;
case 2:
return cv_playercolor3.value;
case 3:
return cv_playercolor4.value;
default:
return 0;
}
return 0;
}
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color)
{
UINT16 skincolor;
byteColor_t byte_color;
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (cv_gamepadled[playernum].value == 0)
{
return;
}
skincolor = color ? color : G_GetSkinColor(playernum);
byte_color = V_GetColor(colortranslations[skincolor][8]).s;
I_SetGamepadIndicatorColor(playernum, byte_color.red, byte_color.green, byte_color.blue);
}
static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
{
if (cv_gamepadled[playernum].value == 0)
{
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
}
else
G_SetPlayerGamepadIndicatorColor(playernum, 0);
}
static void G_ResetPlayerDeviceRumble(INT32 playernum)
{
I_GamepadRumble(playernum, 0, 0, 0);
}
void G_ResetAllDeviceRumbles(void)
{
int i;
int devices;
devices = I_NumJoys();
for (i = 0; i < devices; i++)
{
I_GamepadRumble(devices, 0, 0, 0);
}
}
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
{
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (cv_rumble[playernum].value == 0)
{
return;
}
I_GamepadRumble(playernum, low_strength, high_strength, duration);
}
//
// Detach any keys associated to the given game control
// - pass the pointer to the gamecontrol table for the player being edited
+18 -9
View File
@@ -15,6 +15,7 @@
#define __G_INPUT__
#include "d_event.h"
#include "doomstat.h"
#include "keys.h"
#include "command.h"
@@ -40,12 +41,10 @@ typedef enum
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4,
KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS,
KEY_2JOY1 = KEY_DBLHAT1 + MOUSEBUTTONS,
KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS,
KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4,
KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS,
KEY_DBL2JOY1 = KEY_2HAT1 + MOUSEBUTTONS,
KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS,
KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4,
@@ -62,10 +61,8 @@ typedef enum
KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4,
KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1,
KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1,
KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1,
NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1,
NUMINPUTS = KEY_MOUSEWHEELDOWN + 1,
} key_input_e;
typedef enum
@@ -98,17 +95,24 @@ typedef enum
gc_custom1, // Lua scriptable
gc_custom2, // Lua scriptable
gc_custom3, // Lua scriptable
gc_director,
gc_freecam, // Toggle for freecam while ingame
gc_camfloat, // alternative button for raising cam
gc_camsink, // alternative button for sinking
gc_strafeleft,
gc_straferight,
num_gamecontrols
} gamecontrols_e;
// mouse values are used once
extern consvar_t cv_mousesens, cv_mouseysens;
extern consvar_t cv_mousesens2, cv_mouseysens2;
extern consvar_t cv_controlperkey, cv_turnsmooth;
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS];
extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity
extern INT32 mouse2x, mouse2y, mlook2y;
extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
@@ -129,6 +133,11 @@ extern INT32 gamecontrol4[num_gamecontrols][2];
// peace to my little coder fingers!
// check a gamecontrol being active or not
UINT16 G_GetSkinColor(INT32 playernum);
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color);
void G_ResetAllDeviceRumbles(void);
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
// remaps the input event to a game control.
void G_MapEventsToControls(event_t *ev);
-85
View File
@@ -1,85 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2001 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//-----------------------------------------------------------------------------
/// \file
/// \brief 3D sound import/export prototypes for low-level hardware interface
#ifndef __HW_3DS_DRV_H__
#define __HW_3DS_DRV_H__
// Use standart hardware API
#include "hw_dll.h"
#include "hws_data.h"
#if defined (HAVE_SDL) || !defined (HWD)
EXPORT void HWRAPI(Shutdown) (void);
#endif
// Use standart Init and Shutdown functions
EXPORT INT32 HWRAPI (Startup) (I_Error_t FatalErrorFunction, snddev_t *snd_dev);
EXPORT u_int HWRAPI (AddSfx) (sfx_data_t *sfx);
EXPORT INT32 HWRAPI (AddSource) (source3D_data_t *src, u_int sfxhandle);
EXPORT INT32 HWRAPI (StartSource) (INT32 handle);
EXPORT void HWRAPI (StopSource) (INT32 handle);
EXPORT INT32 HWRAPI (GetHW3DSVersion) (void);
EXPORT void HWRAPI (BeginFrameUpdate) (void);
EXPORT void HWRAPI (EndFrameUpdate) (void);
EXPORT INT32 HWRAPI (IsPlaying) (INT32 handle);
EXPORT void HWRAPI (UpdateListener) (listener_data_t *data, INT32 num);
EXPORT void HWRAPI (UpdateSourceParms) (INT32 handle, INT32 vol, INT32 sep);
EXPORT void HWRAPI (SetGlobalSfxVolume) (INT32 volume);
EXPORT INT32 HWRAPI (SetCone) (INT32 handle, cone_def_t *cone_def);
EXPORT void HWRAPI (Update3DSource) (INT32 handle, source3D_pos_t *data);
EXPORT INT32 HWRAPI (ReloadSource) (INT32 handle, u_int sfxhandle);
EXPORT void HWRAPI (KillSource) (INT32 handle);
EXPORT void HWRAPI (KillSfx) (u_int sfxhandle);
EXPORT void HWRAPI (GetHW3DSTitle) (char *buf, size_t size);
#if !defined (_CREATE_DLL_)
struct hardware3ds_s
{
Startup pfnStartup;
AddSfx pfnAddSfx;
AddSource pfnAddSource;
StartSource pfnStartSource;
StopSource pfnStopSource;
GetHW3DSVersion pfnGetHW3DSVersion;
BeginFrameUpdate pfnBeginFrameUpdate;
EndFrameUpdate pfnEndFrameUpdate;
IsPlaying pfnIsPlaying;
UpdateListener pfnUpdateListener;
UpdateSourceParms pfnUpdateSourceParms;
SetGlobalSfxVolume pfnSetGlobalSfxVolume;
SetCone pfnSetCone;
Update3DSource pfnUpdate3DSource;
ReloadSource pfnReloadSource;
KillSource pfnKillSource;
KillSfx pfnKillSfx;
Shutdown pfnShutdown;
GetHW3DSTitle pfnGetHW3DSTitle;
};
extern struct hardware3ds_s hw3ds_driver;
#define HW3DS hw3ds_driver
#endif // _CREATE_DLL_
#endif // __HW_3DS_DRV_H__
-996
View File
@@ -1,996 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2001 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief Hardware 3D sound general code
#include "../doomdef.h"
#ifdef HW3SOUND
#include "../i_sound.h"
#include "../s_sound.h"
#include "../w_wad.h"
#include "../z_zone.h"
#include "../g_game.h"
#include "../tables.h"
#include "../sounds.h"
#include "../r_main.h"
#include "../r_things.h"
#include "../m_random.h"
#include "../p_local.h"
#include "hw3dsdrv.h"
#include "hw3sound.h"
#define ANGLE2DEG(x) (((double)(x)) / ((double)ANGLE_45/45))
#define NORM_PITCH 128
#define NORM_PRIORITY 64
#define NORM_SEP 128
#if 1
#define TPS(x) (x)
#else //Alam_GBC: MPS, not MPF!
#define TPS(x) ((float)(x)/(float)TICRATE)
#endif
struct hardware3ds_s hw3ds_driver;
typedef struct source_s
{
sfxinfo_t *sfxinfo;
const void *origin;
INT32 handle; // Internal source handle
channel_type_t type; // Sound type (attack, scream, etc)
} source_t;
typedef struct ambient_sdata_s
{
source3D_data_t left;
source3D_data_t right;
} ambient_sdata_t;
typedef struct ambient_source_s
{
source_t left;
source_t right;
} ambient_source_t;
// Static sources
// This sources always creates
static source_t p_attack_source; // Player attack source
static source_t p_attack_source2; // Player2 attack source
static source_t p_scream_source; // Player scream source
static source_t p_scream_source2; // Player2 scream source
static ambient_source_t ambient_source; // Ambinet sound sources
// abuse???
//static source3D_data_t p_attack_sdata; // ?? Now just holds precalculated player attack source data
//static source3D_data_t p_default_sdata;// ?? ---- // ---- // ---- // ---- player scream source data
static ambient_sdata_t ambient_sdata; // Precalculated datas of an ambient sound sources
// Stack of dynamic sources
static source_t *sources = NULL; // Much like original channels
static INT32 num_sources = 0;
// Current mode of 3D sound system
// Default is original (stereo) mode
INT32 hws_mode = HWS_DEFAULT_MODE;
//=============================================================================
void HW3S_SetSourcesNum(void)
{
INT32 i;
// Allocating the internal channels for mixing
// (the maximum number of sounds rendered
// simultaneously) within zone memory.
if (sources)
HW3S_StopSounds();
Z_Free(sources);
if (cv_numChannels.value <= STATIC_SOURCES_NUM)
I_Error("HW3S_SetSourcesNum: Number of sound sources cannot be less than %d\n", STATIC_SOURCES_NUM + 1);
num_sources = cv_numChannels.value - STATIC_SOURCES_NUM;
sources = (source_t *) Z_Malloc(num_sources * sizeof (*sources), PU_STATIC, 0);
// Free all channels for use
for (i = 0; i < num_sources; i++)
{
sources[i].sfxinfo = NULL;
sources[i].type = CT_NORMAL;
sources[i].handle = -1;
}
}
//=============================================================================
static void HW3S_KillSource(INT32 snum)
{
source_t * s = &sources[snum];
if (s->sfxinfo)
{
HW3DS.pfnStopSource(s->handle);
HW3DS.pfnKillSource(s->handle);
s->handle = -1;
s->sfxinfo->usefulness--;
s->origin = NULL;
s->sfxinfo = NULL;
}
}
//=============================================================================
/*
static void HW3S_StopSource(INT32 snum)
{
source_t * s = &sources[snum];
if (s->sfxinfo)
{
// stop the sound playing
HW3DS.pfnStopSource(s->handle);
}
}
*/
//=============================================================================
void HW3S_StopSound(void *origin)
{
INT32 snum;
for (snum = 0; snum < num_sources; snum++)
{
if (sources[snum].sfxinfo && sources[snum].origin == origin)
{
HW3S_KillSource(snum);
break;
}
}
}
void HW3S_StopSoundByID(void *origin, sfxenum_t sfx_id)
{
INT32 snum;
for (snum = 0; snum < num_sources; snum++)
{
if (sources[snum].sfxinfo == &S_sfx[sfx_id] && sources[snum].origin == origin)
{
HW3S_KillSource(snum);
break;
}
}
}
void HW3S_StopSoundByNum(sfxenum_t sfxnum)
{
INT32 snum;
for (snum = 0; snum < num_sources; snum++)
{
if (sources[snum].sfxinfo == &S_sfx[sfxnum])
{
HW3S_KillSource(snum);
break;
}
}
}
//=============================================================================
void HW3S_StopSounds(void)
{
INT32 snum;
// kill all playing sounds at start of level
// (trust me - a good idea)
for (snum = 0; snum < num_sources; snum++)
if (sources[snum].sfxinfo)
HW3S_KillSource(snum);
// Also stop all static sources
HW3DS.pfnStopSource(p_attack_source.handle);
HW3DS.pfnStopSource(p_attack_source2.handle);
HW3DS.pfnStopSource(p_scream_source.handle);
HW3DS.pfnStopSource(p_scream_source2.handle);
HW3DS.pfnStopSource(ambient_source.left.handle);
HW3DS.pfnStopSource(ambient_source.right.handle);
}
//=============================================================================
static INT32 HW3S_GetSource(const void *origin, sfxinfo_t *sfxinfo, boolean splitsound)
{
//
// If none available, return -1. Otherwise source #.
// source number to use
INT32 snum;
source_t * src;
INT32 sep = NORM_SEP, pitch = NORM_PITCH, volume = 255;
(void)splitsound;
// Find an open source
for (snum = 0, src = sources; snum < num_sources; src++, snum++)
{
if (!src->sfxinfo)
break;
#if 0
if (origin && src->origin == origin)
{
HW3S_KillSource(snum);
break;
}
#endif
}
#if 0
// Check to see if it is audible
if (origin && origin != listenmobj)
{
INT32 rc;
rc = S_AdjustSoundParams(listenmobj, origin, &volume, &sep, &pitch, sfxinfo);
if (!rc)
return -1;
}
#else
(void)origin;
(void)pitch;
(void)volume;
(void)sep;
#endif
// None available
if (snum == num_sources)
{
// Look for lower priority
for (snum = 0, src = sources; snum < num_sources; src++, snum++)
if (src->sfxinfo->priority <= sfxinfo->priority)
break;
if (snum == num_sources)
{
// No lower priority. Sorry, Charlie.
return -1;
}
else
{
// Otherwise, kick out lower priority
HW3S_KillSource(snum);
}
}
return snum;
}
//=============================================================================
static void HW3S_FillSourceParameters
(const mobj_t *origin,
source3D_data_t *data,
channel_type_t c_type)
{
fixed_t x = 0, y = 0, z = 0;
data->max_distance = MAX_DISTANCE;
data->min_distance = MIN_DISTANCE;
if (origin && origin != players[displayplayers[0]].mo)
{
data->head_relative = false;
data->pos.momx = TPS(FIXED_TO_FLOAT(origin->momx));
data->pos.momy = TPS(FIXED_TO_FLOAT(origin->momy));
data->pos.momz = TPS(FIXED_TO_FLOAT(origin->momz));
x = origin->x;
y = origin->y;
z = origin->z;
if (c_type == CT_ATTACK)
{
const angle_t an = origin->angle >> ANGLETOFINESHIFT;
x += FixedMul(16*FRACUNIT, FINECOSINE(an));
y += FixedMul(16*FRACUNIT, FINESINE(an));
z += origin->height >> 1;
}
else if (c_type == CT_SCREAM)
z += origin->height - (5 * FRACUNIT);
}
else
{
data->head_relative = true;
data->pos.momx = 0.0f;
data->pos.momy = 0.0f;
data->pos.momz = 0.0f;
}
data->pos.x = FIXED_TO_FLOAT(x);
data->pos.y = FIXED_TO_FLOAT(y);
data->pos.z = FIXED_TO_FLOAT(z);
}
#define HEADER_SIZE 8
//==============================================================
/*
static void make_outphase_sfx(void *dest, void *src, INT32 size)
{
SINT8 *s = (SINT8 *)src + HEADER_SIZE, *d = (SINT8 *)dest + HEADER_SIZE;
M_Memcpy(dest, src, HEADER_SIZE);
size -= HEADER_SIZE;
while (size--)
*d++ = -(*s++);
}
*/
//INT32 HW3S_Start3DSound(const void *origin, source3D_data_t *source_parm, cone_def_t *cone_parm, channel_type_t channel, INT32 sfx_id, INT32 vol, INT32 pitch);
//=============================================================================
INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, channel_type_t c_type, sfxenum_t sfx_id, INT32 volume, INT32 pitch, INT32 sep)
{
sfxinfo_t *sfx;
const mobj_t *origin = (const mobj_t *)origin_p;
source3D_data_t source3d_data;
INT32 s_num = 0;
source_t *source = NULL;
mobj_t *listenmobj = players[displayplayers[0]].mo; // TODO: Kart 4P does not support sounds properly here
mobj_t *listenmobj2 = NULL;
if (splitscreen) listenmobj2 = players[displayplayers[1]].mo;
if (sound_disabled)
return -1;
sfx = &S_sfx[sfx_id];
if (sfx->skinsound!=-1 && origin && origin->skin)
{
// it redirect player sound to the sound in the skin table
sfx_id = ((skin_t *)origin->skin)->soundsid[sfx->skinsound];
sfx = &S_sfx[sfx_id];
}
if (!sfx->data)
sfx->data = HW3S_GetSfx(sfx);
// judgecutor 08-16-2002
// Sound pitching for both Doom and Heretic
#if 0
if (cv_rndsoundpitch.value)
{
/*if (gamemode != heretic)
{
if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit)
pitch += 8 - (M_RandomByte()&15);
else if (sfx_id != sfx_itemup && sfx_id != sfx_tink)
pitch += 16 - (M_RandomByte()&31);
}
else*/
pitch = 128 + (M_RandomByte() & 7) - (M_RandomByte() & 7);
}
#endif
if (pitch < 0)
pitch = NORMAL_PITCH;
if (pitch > 255)
pitch = 255;
if (sep < 0)
sep = 128;
if (splitscreen && listenmobj2) // Copy the sound for the split player
{
if (c_type != CT_NORMAL && origin && (origin == listenmobj2))
{
if (c_type == CT_ATTACK)
{
if (origin == listenmobj2)
source = &p_attack_source;
else
source = &p_attack_source2;
}
else
{
if (origin == listenmobj2)
source = &p_scream_source;
else
source = &p_scream_source2;
}
if (source->sfxinfo != sfx)
{
HW3DS.pfnStopSource(source->handle);
source->handle = HW3DS.pfnReloadSource(source->handle, sfx->volume);
//I_OutputMsg("PlayerSound data reloaded\n");
}
}
else if (c_type == CT_AMBIENT)
{
// sfx_data_t outphased_sfx;
if (ambient_source.left.sfxinfo != sfx)
{
HW3DS.pfnStopSource(ambient_source.left.handle);
HW3DS.pfnStopSource(ambient_source.right.handle);
// judgecutor:
// Outphased sfx's temporarily not used!!!
/*
outphased_sfx.data = Z_Malloc(sfx_data.length, PU_STATIC, 0);
make_outphase_sfx(outphased_sfx.data, sfx_data.data, sfx_data.length);
outphased_sfx.length = sfx_data.length;
outphased_sfx.id = sfx_data.id;
*/
ambient_source.left.handle = HW3DS.pfnReloadSource(ambient_source.left.handle, (u_int)sfx->length);
//ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, &outphased_sfx);
ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, (u_int)sfx->length);
ambient_source.left.sfxinfo = ambient_source.right.sfxinfo = sfx;
//Z_Free(outphased_sfx.data);
}
HW3DS.pfnUpdateSourceParms(ambient_source.left.handle, volume, -1);
HW3DS.pfnUpdateSourceParms(ambient_source.right.handle, volume, -1);
if (sfx->usefulness++ < 0)
sfx->usefulness = -1;
// Ambient sound is special case
HW3DS.pfnStartSource(ambient_source.left.handle);
HW3DS.pfnStartSource(ambient_source.right.handle);
}
else
{
s_num = HW3S_GetSource(origin, sfx, true);
if (s_num < 0)
{
//I_OutputMsg("No free source, aborting\n");
return -1;
}
source = &sources[s_num];
if (origin && c_type == CT_NORMAL)
{
if (!source_parm)
{
source_parm = &source3d_data;
source3d_data.permanent = 0;
HW3S_FillSourceParameters(origin, source_parm, c_type);
}
source->handle = HW3DS.pfnAddSource(source_parm, (u_int)sfx->length);
}
else
source->handle = HW3DS.pfnAddSource(NULL, (u_int)sfx->length);
}
// increase the usefulness
if (sfx->usefulness++ < 0)
sfx->usefulness = -1;
source->sfxinfo = sfx;
source->origin = origin;
HW3DS.pfnStartSource(source->handle);
}
if (c_type != CT_NORMAL && origin && (origin == listenmobj))
{
if (c_type == CT_ATTACK)
{
if (origin == listenmobj)
source = &p_attack_source;
else
source = &p_attack_source2;
}
else
{
if (origin == listenmobj)
source = &p_scream_source;
else
source = &p_scream_source2;
}
if (source->sfxinfo != sfx)
{
HW3DS.pfnStopSource(source->handle);
source->handle = HW3DS.pfnReloadSource(source->handle, sfx->volume);
//I_OutputMsg("PlayerSound data reloaded\n");
}
}
else if (c_type == CT_AMBIENT)
{
// sfx_data_t outphased_sfx;
if (ambient_source.left.sfxinfo != sfx)
{
HW3DS.pfnStopSource(ambient_source.left.handle);
HW3DS.pfnStopSource(ambient_source.right.handle);
// judgecutor:
// Outphased sfx's temporarily not used!!!
/*
outphased_sfx.data = Z_Malloc(sfx_data.length, PU_STATIC, 0);
make_outphase_sfx(outphased_sfx.data, sfx_data.data, sfx_data.length);
outphased_sfx.length = sfx_data.length;
outphased_sfx.id = sfx_data.id;
*/
ambient_source.left.handle = HW3DS.pfnReloadSource(ambient_source.left.handle, (u_int)sfx->length);
//ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, &outphased_sfx);
ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, (u_int)sfx->length);
ambient_source.left.sfxinfo = ambient_source.right.sfxinfo = sfx;
//Z_Free(outphased_sfx.data);
}
HW3DS.pfnUpdateSourceParms(ambient_source.left.handle, volume, -1);
HW3DS.pfnUpdateSourceParms(ambient_source.right.handle, volume, -1);
if (sfx->usefulness++ < 0)
sfx->usefulness = -1;
// Ambient sound is special case
HW3DS.pfnStartSource(ambient_source.left.handle);
HW3DS.pfnStartSource(ambient_source.right.handle);
return -1;
}
else
{
s_num = HW3S_GetSource(origin, sfx, false);
if (s_num < 0)
{
//I_OutputMsg("No free source, aborting\n");
return -1;
}
source = &sources[s_num];
if (origin && c_type == CT_NORMAL)
{
if (!source_parm)
{
source_parm = &source3d_data;
source3d_data.permanent = 0;
HW3S_FillSourceParameters(origin, source_parm, c_type);
}
source->handle = HW3DS.pfnAddSource(source_parm, (u_int)sfx->length);
}
else
source->handle = HW3DS.pfnAddSource(NULL, (u_int)sfx->length);
}
// increase the usefulness
if (sfx->usefulness++ < 0)
sfx->usefulness = -1;
source->sfxinfo = sfx;
source->origin = origin;
HW3DS.pfnStartSource(source->handle);
return s_num;
}
// Start normal sound
//=============================================================================
void HW3S_StartSound(const void *origin, sfxenum_t sfx_id)
{
HW3S_I_StartSound(origin, NULL, CT_NORMAL, sfx_id, 255, NORMAL_PITCH, NORMAL_SEP);
}
//=============================================================================
void S_StartAttackSound(const void *origin, sfxenum_t sfx_id)
{
if (hws_mode != HWS_DEFAULT_MODE)
HW3S_I_StartSound(origin, NULL, CT_ATTACK, sfx_id, 255, NORMAL_PITCH, NORMAL_SEP);
else
S_StartSound(origin, sfx_id);
}
void S_StartScreamSound(const void *origin, sfxenum_t sfx_id)
{
if (hws_mode != HWS_DEFAULT_MODE)
HW3S_I_StartSound(origin, NULL, CT_SCREAM, sfx_id, 255, NORMAL_PITCH, NORMAL_SEP);
else
S_StartSound(origin, sfx_id);
}
#if 0 /// NOTE: not used
void S_StartAmbientSound(sfxenum_t sfx_id, INT32 volume)
{
if (hws_mode != HWS_DEFAULT_MODE)
{
volume += 30;
if (volume > 255)
volume = 255;
HW3S_I_StartSound(NULL, NULL, CT_AMBIENT, sfx_id, volume, NORMAL_PITCH, NORMAL_SEP);
}
else
S_StartSoundAtVolume(NULL, sfx_id, volume);
}
#endif
FUNCMATH static inline float AmbientPos(angle_t an)
{
const fixed_t fm = FixedMul(FLOAT_TO_FIXED(MIN_DISTANCE), FINESINE(an>>ANGLETOFINESHIFT));
return FIXED_TO_FLOAT(fm);
}
//=============================================================================
INT32 HW3S_Init(I_Error_t FatalErrorFunction, snddev_t *snd_dev)
{
INT32 succ;
source3D_data_t source_data;
if (HW3DS.pfnStartup(FatalErrorFunction, snd_dev))
{
// Attack source
source_data.head_relative = 1;
source_data.pos.x = 0.0f;
source_data.pos.y = 16.0f;
source_data.pos.z = -FIXED_TO_FLOAT(mobjinfo[MT_PLAYER].height >> 1);
source_data.pos.momx = 0.0f;
source_data.pos.momy = 0.0f;
source_data.pos.momz = 0.0f;
source_data.min_distance = MIN_DISTANCE;
source_data.max_distance = MAX_DISTANCE;
source_data.permanent = 1;
p_attack_source.sfxinfo = NULL;
M_Memcpy(&p_attack_source2, &p_attack_source, sizeof (source_t));
p_attack_source.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
p_attack_source2.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
// Scream source
source_data.pos.y = 0;
source_data.pos.z = 0;
p_scream_source.sfxinfo = NULL;
M_Memcpy(&p_scream_source2, &p_scream_source, sizeof (source_t));
p_scream_source.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
p_scream_source2.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
//FIXED_TO_FLOAT(mobjinfo[MT_PLAYER].height - (5 * FRACUNIT));
// Ambient sources (left and right) at 210 and 330 degree
// relative to listener
memset(&ambient_sdata, 0, sizeof (ambient_sdata));
ambient_sdata.left.head_relative = 1;
ambient_sdata.left.pos.x = ambient_sdata.left.pos.y = AmbientPos(ANG210);
ambient_sdata.left.max_distance = MAX_DISTANCE;
ambient_sdata.left.min_distance = MIN_DISTANCE;
ambient_sdata.left.permanent = 1;
M_Memcpy(&ambient_sdata.right, &ambient_sdata.left, sizeof (source3D_data_t));
ambient_sdata.right.pos.x = -ambient_sdata.left.pos.x;
ambient_source.left.handle = HW3DS.pfnAddSource(&ambient_sdata.left, sfx_None);
ambient_source.right.handle = HW3DS.pfnAddSource(&ambient_sdata.right, sfx_None);
succ = p_attack_source.handle > -1 && p_scream_source.handle > -1 &&
p_attack_source2.handle > -1 && p_scream_source2.handle > -1 &&
ambient_source.left.handle > -1 && ambient_source.right.handle > -1;
//I_OutputMsg("Player handles: attack %d, default %d\n", p_attack_source.handle, p_scream_source.handle);
return succ;
}
return 0;
}
//=============================================================================
INT32 HW3S_GetVersion(void)
{
return HW3DS.pfnGetHW3DSVersion();
}
//=============================================================================
void HW3S_BeginFrameUpdate(void)
{
if (hws_mode != HWS_DEFAULT_MODE)
HW3DS.pfnBeginFrameUpdate();
}
//=============================================================================
void HW3S_EndFrameUpdate(void)
{
if (hws_mode != HWS_DEFAULT_MODE)
HW3DS.pfnEndFrameUpdate();
}
//=============================================================================
INT32 HW3S_SoundIsPlaying(INT32 handle)
{
return HW3DS.pfnIsPlaying(handle);
}
INT32 HW3S_OriginPlaying(void *origin)
{
INT32 snum;
if (!origin)
return 0;
for (snum = 0; snum < num_sources; snum++)
if (sources[snum].origin == origin)
return 1;
return 0;
}
INT32 HW3S_IdPlaying(sfxenum_t id)
{
INT32 snum;
for (snum = 0; snum < num_sources; snum++)
if ((size_t)(sources[snum].sfxinfo - S_sfx) == (size_t)id)
return 1;
return 0;
}
INT32 HW3S_SoundPlaying(void *origin, sfxenum_t id)
{
INT32 snum;
if (!origin)
return 0;
for (snum = 0; snum < num_sources; snum++)
{
if (sources[snum].origin == origin
&& (size_t)(sources[snum].sfxinfo - S_sfx) == (size_t)id)
return 1;
}
return 0;
}
//=============================================================================
static void HW3S_UpdateListener(mobj_t *listener)
{
listener_data_t data;
if (!listener || !listener->player)
return;
if (camera.chase)
{
data.x = FIXED_TO_FLOAT(camera.x);
data.y = FIXED_TO_FLOAT(camera.y);
data.z = FIXED_TO_FLOAT(camera.z + camera.height - (5 * FRACUNIT));
data.f_angle = ANGLE2DEG(camera.angle);
data.h_angle = ANGLE2DEG(camera.aiming);
data.momx = TPS(FIXED_TO_FLOAT(camera.momx));
data.momy = TPS(FIXED_TO_FLOAT(camera.momy));
data.momz = TPS(FIXED_TO_FLOAT(camera.momz));
}
else
{
data.x = FIXED_TO_FLOAT(listener->x);
data.y = FIXED_TO_FLOAT(listener->y);
data.z = FIXED_TO_FLOAT(listener->z + listener->height - (5 * FRACUNIT));
data.f_angle = ANGLE2DEG(listener->angle);
data.h_angle = ANGLE2DEG(listener->player->aiming);
data.momx = TPS(FIXED_TO_FLOAT(listener->momx));
data.momy = TPS(FIXED_TO_FLOAT(listener->momy));
data.momz = TPS(FIXED_TO_FLOAT(listener->momz));
}
HW3DS.pfnUpdateListener(&data, 1);
}
static void HW3S_UpdateListener2(mobj_t *listener)
{
listener_data_t data;
if (!listener || !listener->player)
{
HW3DS.pfnUpdateListener(NULL, 2);
return;
}
if (camera2.chase)
{
data.x = FIXED_TO_FLOAT(camera2.x);
data.y = FIXED_TO_FLOAT(camera2.y);
data.z = FIXED_TO_FLOAT(camera2.z + camera2.height - (5 * FRACUNIT));
data.f_angle = ANGLE2DEG(camera2.angle);
data.h_angle = ANGLE2DEG(camera2.aiming);
data.momx = TPS(FIXED_TO_FLOAT(camera2.momx));
data.momy = TPS(FIXED_TO_FLOAT(camera2.momy));
data.momz = TPS(FIXED_TO_FLOAT(camera2.momz));
}
else
{
data.x = FIXED_TO_FLOAT(listener->x);
data.y = FIXED_TO_FLOAT(listener->y);
data.z = FIXED_TO_FLOAT(listener->z + listener->height - (5 * FRACUNIT));
data.f_angle = ANGLE2DEG(listener->angle);
data.h_angle = ANGLE2DEG(listener->player->aiming);
data.momx = TPS(FIXED_TO_FLOAT(listener->momx));
data.momy = TPS(FIXED_TO_FLOAT(listener->momy));
data.momz = TPS(FIXED_TO_FLOAT(listener->momz));
}
HW3DS.pfnUpdateListener(&data, 2);
}
void HW3S_SetSfxVolume(INT32 volume)
{
HW3DS.pfnSetGlobalSfxVolume(volume);
}
static void HW3S_Update3DSource(source_t *src)
{
source3D_data_t data;
data.permanent = 0;
HW3S_FillSourceParameters(src->origin, &data, src->type);
HW3DS.pfnUpdate3DSource(src->handle, &data.pos);
}
void HW3S_UpdateSources(void)
{
mobj_t *listener = players[displayplayers[0]].mo;
mobj_t *listener2 = NULL;
source_t *src;
INT32 audible, snum, volume, sep, pitch;
if (splitscreen) listener2 = players[displayplayers[1]].mo;
HW3S_UpdateListener2(listener2);
HW3S_UpdateListener(listener);
for (snum = 0, src = sources; snum < num_sources; src++, snum++)
{
if (src->sfxinfo)
{
#if 0
if (HW3DS.pfnIsPlaying(src->handle))
{
if (src->origin)
{
// initialize parameters
volume = 255; // 8 bits internal volume precision
pitch = NORM_PITCH;
sep = NORM_SEP;
// check non-local sounds for distance clipping
// or modify their params
if (src->origin && listener != src->origin && !(listener2 && src->origin == listener2))
{
INT32 audible2;
INT32 volume2 = volume, sep2 = sep, pitch2 = pitch;
audible = S_AdjustSoundParams(listener, src->origin, &volume, &sep, &pitch,
src->sfxinfo);
if (listener2)
{
audible2 = S_AdjustSoundParams(listener2,
src->origin, &volume2, &sep2, &pitch2, src->sfxinfo);
if (audible2 && (!audible || (audible && volume2 > volume)))
{
audible = true;
volume = volume2;
sep = sep2;
pitch = pitch2;
}
}
if (audible)
HW3S_Update3DSource(src); // Update positional sources
else
HW3S_KillSource(snum); //Kill it!
}
}
}
else
{
// Source allocated but stopped. Kill.
HW3S_KillSource(snum);
}
#else
if (src->origin && listener != src->origin && !(listener2 && src->origin == listener2))
HW3S_Update3DSource(src); // Update positional sources
(void)pitch;
(void)sep;
(void)volume;
(void)audible;
#endif
}
}
}
void HW3S_Shutdown(void)
{
HW3DS.pfnShutdown();
}
void *HW3S_GetSfx(sfxinfo_t *sfx)
{
sfx_data_t sfx_data;
if (sfx->lumpnum == LUMPERROR)
sfx->lumpnum = S_GetSfxLumpNum (sfx);
sfx_data.length = W_LumpLength(sfx->lumpnum);
sfx_data.data = Z_Malloc(sfx_data.length, PU_SOUND, &sfx->data);
W_ReadLump(sfx->lumpnum, sfx_data.data);
sfx_data.priority = sfx->priority;
sfx->length = HW3DS.pfnAddSfx(&sfx_data);
Z_ChangeTag(sfx->data, PU_CACHE);
return sfx_data.data;
}
void HW3S_FreeSfx(sfxinfo_t *sfx)
{
INT32 snum;
for (snum = 0; snum < num_sources; snum++)
{
if (sources[snum].sfxinfo == sfx)
{
HW3S_KillSource(snum);
break;
}
}
if (sfx->length > 0)
HW3DS.pfnKillSfx((u_int)sfx->length);
sfx->length = 0;
sfx->lumpnum = LUMPERROR;
Z_Free(sfx->data);
sfx->data = NULL;
}
#endif
-106
View File
@@ -1,106 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2001 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//-----------------------------------------------------------------------------
/// \file
/// \brief High-level functions of hardware 3D sound
#ifndef __HW3_SOUND_H__
#define __HW3_SOUND_H__
#ifdef HW3SOUND
#include "hws_data.h"
//#include "../s_sound.h"
//#include "../p_mobj.h"
// Default sound mode (original stereo mode)
enum
{
HWS_DEFAULT_MODE = 0,
HWS_DS3D,
HWS_OTHER,
HWS_FMOD3D,
HWS_OPENAL,
};
typedef enum
{
CT_NORMAL = 0,
CT_ATTACK,
CT_SCREAM,
CT_AMBIENT,
} channel_type_t;
extern INT32 hws_mode; // Current sound mode
#if defined (HW3DS) || defined (DOXYGEN)
INT32 HW3S_Init(I_Error_t FatalErrorFunction, snddev_t *snd_dev);
#endif
void HW3S_Shutdown(void);
INT32 HW3S_GetVersion(void);
// Common case - start 3D or 2D source
void HW3S_StartSound(const void *origin, sfxenum_t sfx_id);
// Special cases of 3D sources
void S_StartAmbientSound(sfxenum_t sfx_id, INT32 volume);
void S_StartAttackSound(const void *origin, sfxenum_t sfx_id);
void S_StartScreamSound(const void *origin, sfxenum_t sfx_id);
// Starts 3D sound with specified parameters
// origin - for object movement tracking. NULL are possible value (no movement tracking)
// source_parm - 3D source parameters (position etc.)
// cone_parm - 3D source cone parameters. NULL are possible value (default cone will be used)
// channel -
// sfx_id - sfx id
// vol - sound volume
// pitch - sound pitching value
// Returns: - sound id
INT32 HW3S_I_StartSound(const void *origin, source3D_data_t *source_parm, channel_type_t channel, sfxenum_t sfx_id, INT32 vol, INT32 pitch, INT32 sep);
void HW3S_StopSoundByID(void *origin, sfxenum_t sfx_id);
void HW3S_StopSoundByNum(sfxenum_t sfxnum);
void HW3S_StopSound(void *origin);
void HW3S_StopSounds(void);
void HW3S_BeginFrameUpdate(void);
void HW3S_EndFrameUpdate(void);
void HW3S_UpdateSources(void);
void HW3S_SetSfxVolume(INT32 volume);
// Utility functions
INT32 HW3S_SoundIsPlaying(INT32 handle);
void HW3S_SetSourcesNum(void);
INT32 HW3S_OriginPlaying(void *origin);
INT32 HW3S_IdPlaying(sfxenum_t id);
INT32 HW3S_SoundPlaying(void *origin, sfxenum_t id);
void *HW3S_GetSfx(sfxinfo_t *sfx);
void HW3S_FreeSfx(sfxinfo_t *sfx);
#else // HW3SOUND
//#define S_StartAmbientSound(i,v) S_StartSoundAtVolume(NULL, i, v)
#define S_StartAttackSound S_StartSound
#define S_StartScreamSound S_StartSound
#endif // HW3SOUND
INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source,
INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
#endif // __HW3_SOUND_H__
+109 -114
View File
@@ -15,8 +15,9 @@
#include "hw_main.h"
#include "../i_system.h"
#include "../qs22j.h"
#include "../doomdef.h"
#include "../qs22j.h"
// The texture for the next polygon given to HWR_ProcessPolygon.
// Set with HWR_SetCurrentTexture.
@@ -35,7 +36,7 @@ int finalVertexArrayAllocSize = 65536;
PolygonArrayEntry* polygonArray = NULL;// contains the polygon data from DrawPolygon, waiting to be processed
int polygonArraySize = 0;
UINT32* polygonIndexArray = NULL;// contains sorting pointers for polygonArray
PolygonArrayEntry **polygonArraySorted = NULL;// contains sorted pointers to polygonArray
int polygonArrayAllocSize = 65536;
FOutVector* unsortedVertexArray = NULL;// contains unsorted vertices and texture coordinates from DrawPolygon
@@ -46,35 +47,37 @@ int unsortedVertexArrayAllocSize = 65536;
// Call HWR_RenderBatches to render all the collected geometry.
void HWR_StartBatching(void)
{
if (currently_batching)
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
if (currently_batching)
{
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
}
// init arrays if that has not been done yet
// init arrays if that has not been done yet
if (!finalVertexArray)
{
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
finalVertexIndexArray = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
polygonArray = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
}
currently_batching = true;
currently_batching = true;
}
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
// This replaces the direct calls to GL_SetTexture in cases where batching is available.
// The texture selection is saved for the next HWR_ProcessPolygon call.
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
void HWR_SetCurrentTexture(GLMipmap_t *texture)
{
if (currently_batching)
{
current_texture = texture;
}
else
{
HWD.pfnSetTexture(texture);
}
if (currently_batching)
{
current_texture = texture;
}
else
{
GL_SetTexture(texture);
}
}
// If batching is enabled, this function collects the polygon data and the chosen texture
@@ -82,7 +85,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
// render the polygon immediately.
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader_target, boolean horizonSpecial)
{
if (currently_batching)
if (currently_batching)
{
if (!pSurf)
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
@@ -96,8 +99,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
free(polygonArray);
polygonArray = new_array;
// also need to redo the index array, dont need to copy it though
free(polygonIndexArray);
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
free(polygonArraySorted);
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
}
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
@@ -127,40 +130,30 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
}
else
{
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
}
}
static int comparePolygons(const void *p1, const void *p2)
{
unsigned int index1 = *(const unsigned int*)p1;
unsigned int index2 = *(const unsigned int*)p2;
PolygonArrayEntry* poly1 = &polygonArray[index1];
PolygonArrayEntry* poly2 = &polygonArray[index2];
PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
int diff;
INT64 diff64;
UINT32 downloaded1 = 0;
UINT32 downloaded2 = 0;
int shader1 = poly1->shader;
int shader2 = poly2->shader;
// make skywalls and horizon lines first in order
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
shader1 = -1;
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
shader2 = -1;
diff = shader1 - shader2;
if (diff != 0) return diff;
int shader1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? -1 : poly1->shader;
int shader2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? -1 : poly2->shader;
// skywalls and horizon lines must retain their order for horizon lines to work
if (shader1 == -1 && shader2 == -1)
return index1 - index2;
return poly1 - poly2;
if (poly1->texture)
downloaded1 = poly1->texture->downloaded; // there should be a opengl texture name here, usable for comparisons
if (poly2->texture)
downloaded2 = poly2->texture->downloaded;
diff = shader1 - shader2;
if (diff != 0) return diff;
UINT32 downloaded1 = poly1->texture ? poly1->texture->downloaded : 0; // there should be a opengl texture name here, usable for comparisons
UINT32 downloaded2 = poly2->texture ? poly2->texture->downloaded : 0;
diff64 = downloaded1 - downloaded2;
if (diff64 != 0) return diff64;
@@ -179,33 +172,29 @@ static int comparePolygons(const void *p1, const void *p2)
diff = poly1->surf.LightInfo.fade_start - poly2->surf.LightInfo.fade_start;
if (diff != 0) return diff;
diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end;
if (diff != 0) return diff;
diff = poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional;
return diff;
}
static int comparePolygonsNoShaders(const void *p1, const void *p2)
{
unsigned int index1 = *(const unsigned int*)p1;
unsigned int index2 = *(const unsigned int*)p2;
PolygonArrayEntry* poly1 = &polygonArray[index1];
PolygonArrayEntry* poly2 = &polygonArray[index2];
PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
int diff;
INT64 diff64;
GLMipmap_t *texture1 = poly1->texture;
GLMipmap_t *texture2 = poly2->texture;
UINT32 downloaded1 = 0;
UINT32 downloaded2 = 0;
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
texture1 = NULL;
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
texture2 = NULL;
if (texture1)
downloaded1 = texture1->downloaded; // there should be a opengl texture name here, usable for comparisons
if (texture2)
downloaded2 = texture2->downloaded;
GLMipmap_t *texture1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? NULL : poly1->texture;
GLMipmap_t *texture2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? NULL : poly2->texture;
// skywalls and horizon lines must retain their order for horizon lines to work
if (!texture1 && !texture2)
return index1 - index2;
return poly1 - poly2;
UINT32 downloaded1 = texture1 ? texture1->downloaded : 0; // there should be a opengl texture name here, usable for comparisons
UINT32 downloaded2 = texture2 ? texture2->downloaded : 0;
diff64 = downloaded1 - downloaded2;
if (diff64 != 0) return diff64;
@@ -222,14 +211,14 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
// the rendering backend to draw them.
void HWR_RenderBatches(void)
{
int finalVertexWritePos = 0;// position in finalVertexArray
int finalVertexWritePos = 0;// position in finalVertexArray
int finalIndexWritePos = 0;// position in finalVertexIndexArray
int polygonReadPos = 0;// position in polygonIndexArray
int polygonReadPos = 0;// position in polygonArraySorted
int currentShader;
int nextShader = 0;
GLMipmap_t *currentTexture;
GLMipmap_t *currentTexture = NULL;
GLMipmap_t *nextTexture = NULL;
FBITFIELD currentPolyFlags = 0;
FBITFIELD nextPolyFlags = 0;
@@ -238,12 +227,13 @@ void HWR_RenderBatches(void)
int i;
if (!currently_batching)
if (!currently_batching)
I_Error("HWR_RenderBatches called without starting batching");
nextSurfaceInfo.LightInfo.fade_end = 0;
nextSurfaceInfo.LightInfo.fade_start = 0;
nextSurfaceInfo.LightInfo.light_level = 0;
nextSurfaceInfo.LightInfo.directional = false;
currently_batching = false;// no longer collecting batches
if (!polygonArraySize)
@@ -258,19 +248,21 @@ void HWR_RenderBatches(void)
ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0;
ps_hw_numshaders.value.i = ps_hw_numtextures.value.i
= ps_hw_numpolyflags.value.i = ps_hw_numcolors.value.i = 1;
// init polygonIndexArray
// init polygonArraySorted
for (i = 0; i < polygonArraySize; i++)
{
polygonIndexArray[i] = i;
polygonArraySorted[i] = &polygonArray[i];
}
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
if (cv_grshaders.value && gr_shadersavailable)
qs22j(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
if (cv_glshaders.value && gl_shadersavailable)
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
else
qs22j(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders);
PS_STOP_TIMING(ps_hw_batchsorttime);
// sort order
// 1. shader
// 2. texture
@@ -280,24 +272,24 @@ void HWR_RenderBatches(void)
PS_START_TIMING(ps_hw_batchdrawtime);
currentShader = polygonArray[polygonIndexArray[0]].shader;
currentTexture = polygonArray[polygonIndexArray[0]].texture;
currentPolyFlags = polygonArray[polygonIndexArray[0]].polyFlags;
currentSurfaceInfo = polygonArray[polygonIndexArray[0]].surf;
currentShader = polygonArraySorted[0]->shader;
currentTexture = polygonArraySorted[0]->texture;
currentPolyFlags = polygonArraySorted[0]->polyFlags;
currentSurfaceInfo = polygonArraySorted[0]->surf;
// For now, will sort and track the colors. Vertex attributes could be used instead of uniforms
// and a color array could replace the color calls.
// set state for first batch
if (cv_grshaders.value && gr_shadersavailable)
if (cv_glshaders.value && gl_shadersavailable)
{
HWD.pfnSetShader(currentShader);
GL_SetShader(currentShader);
}
if (currentPolyFlags & PF_NoTexture)
currentTexture = NULL;
else
HWD.pfnSetTexture(currentTexture);
else
GL_SetTexture(currentTexture);
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
{
@@ -322,8 +314,8 @@ void HWR_RenderBatches(void)
// reset write pos
// repeat loop
int index = polygonIndexArray[polygonReadPos++];
int numVerts = polygonArray[index].numVerts;
PolygonArrayEntry *entry = polygonArraySorted[polygonReadPos++];
int numVerts = entry->numVerts;
// before writing, check if there is enough room
// using 'while' instead of 'if' here makes sure that there will *always* be enough room.
// probably never will this loop run more than once though
@@ -344,7 +336,7 @@ void HWR_RenderBatches(void)
finalVertexIndexArray = new_index_array;
}
// write the vertices of the polygon
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[polygonArray[index].vertsIndex],
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex],
numVerts * sizeof(FOutVector));
// write the indexes, pointing to the fan vertexes but in triangles format
firstIndex = finalVertexWritePos;
@@ -364,14 +356,14 @@ void HWR_RenderBatches(void)
else
{
// check if a state change is required, set the change bools and next vars
int nextIndex = polygonIndexArray[polygonReadPos];
nextShader = polygonArray[nextIndex].shader;
nextTexture = polygonArray[nextIndex].texture;
nextPolyFlags = polygonArray[nextIndex].polyFlags;
nextSurfaceInfo = polygonArray[nextIndex].surf;
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 && cv_grshaders.value && gr_shadersavailable)
if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
{
changeState = true;
changeShader = true;
@@ -386,14 +378,15 @@ void HWR_RenderBatches(void)
changeState = true;
changePolyFlags = true;
}
if (cv_grshaders.value && gr_shadersavailable)
if (cv_glshaders.value && gl_shadersavailable)
{
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.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
currentSurfaceInfo.LightInfo.directional != nextSurfaceInfo.LightInfo.directional)
{
changeState = true;
changeSurfaceInfo = true;
@@ -412,7 +405,7 @@ void HWR_RenderBatches(void)
if (changeState || stopFlag)
{
// execute draw call
HWD.pfnDrawIndexedTriangles(&currentSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
GL_DrawIndexedTriangles(&currentSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
// update stats
ps_hw_numcalls.value.i++;
ps_hw_numverts.value.i += finalIndexWritePos;
@@ -426,38 +419,41 @@ void HWR_RenderBatches(void)
if (stopFlag) break;
// change state according to change bools and next vars, update current vars and reset bools
if (changeShader)
if (changeState)
{
HWD.pfnSetShader(nextShader);
currentShader = nextShader;
changeShader = false;
if (changeShader)
{
GL_SetShader(nextShader);
currentShader = nextShader;
changeShader = false;
ps_hw_numshaders.value.i++;
}
if (changeTexture)
{
// texture should be already ready for use from calls to SetTexture during batch collection
HWD.pfnSetTexture(nextTexture);
currentTexture = nextTexture;
changeTexture = false;
ps_hw_numshaders.value.i++;
}
if (changeTexture)
{
// texture should be already ready for use from calls to GL_SetTexture during batch collection
GL_SetTexture(nextTexture);
currentTexture = nextTexture;
changeTexture = false;
ps_hw_numtextures.value.i++;
}
if (changePolyFlags)
{
currentPolyFlags = nextPolyFlags;
changePolyFlags = false;
ps_hw_numtextures.value.i++;
}
if (changePolyFlags)
{
currentPolyFlags = nextPolyFlags;
changePolyFlags = false;
ps_hw_numpolyflags.value.i++;
}
if (changeSurfaceInfo)
{
currentSurfaceInfo = nextSurfaceInfo;
changeSurfaceInfo = false;
ps_hw_numpolyflags.value.i++;
}
if (changeSurfaceInfo)
{
currentSurfaceInfo = nextSurfaceInfo;
changeSurfaceInfo = false;
ps_hw_numcolors.value.i++;
ps_hw_numcolors.value.i++;
}
// and that should be it?
}
// and that should be it?
}
// reset the arrays (set sizes to 0)
polygonArraySize = 0;
@@ -466,5 +462,4 @@ void HWR_RenderBatches(void)
PS_STOP_TIMING(ps_hw_batchdrawtime);
}
#endif // HWRENDER
+4 -2
View File
@@ -15,9 +15,11 @@
#include "hw_defs.h"
#include "hw_data.h"
#include "hw_drv.h"
#include "hw_gl.h"
typedef struct
extern boolean currently_batching;
typedef struct
{
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
unsigned int vertsIndex;// location of verts in unsortedVertexArray
+26 -16
View File
@@ -46,7 +46,7 @@ typedef struct
// when loading the map, this is set to true if portals are found.
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
boolean gr_maphasportals = false;
boolean gl_maphasportals = false;
// ==========================================================================
// FLOOR & CEILING CONVEX POLYS GENERATION
@@ -371,14 +371,14 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
line_t *line = lseg->linedef;
// portal check
if (!gr_maphasportals && line->special == 40 && lseg->side == 0)
if (!gl_maphasportals && line->special == 40 && lseg->side == 0)
{
// Find the other side!
INT32 line2 = P_FindSpecialLineFromTag(40, line->tag, -1);
if (line == &lines[line2])
line2 = P_FindSpecialLineFromTag(40, line->tag, line2);
if (line2 >= 0) // found it!
gr_maphasportals = 1;
gl_maphasportals = 1;
}
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
@@ -667,9 +667,15 @@ static boolean PointInSeg(polyvertex_t *a,polyvertex_t *v1,polyvertex_t *v2)
// v1 = origine
ax= v2->x-v1->x;
ay= v2->y-v1->y;
norm = (float)hypot(ax, ay);
ax /= norm;
ay /= norm;
norm = hypotf(ax, ay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
if (norm != 0) // yes, this can be exactly 0
#pragma GCC diagnostic pop
{
ax /= norm;
ay /= norm;
}
bx = a->x-v1->x;
by = a->y-v1->y;
//d = a.b
@@ -762,7 +768,7 @@ static INT32 SolveTProblem(void)
INT32 i;
size_t l;
if (cv_grsolvetjoin.value == 0)
if (cv_glsolvetjoin.value == 0)
return 0;
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
@@ -772,9 +778,11 @@ static INT32 SolveTProblem(void)
for (l = 0; l < addsubsector; l++)
{
p = extrasubsectors[l].planepoly;
if (p)
for (i = 0; i < p->numpts; i++)
SearchSegInBSP((INT32)numnodes-1, &p->pts[i], p);
if (!p)
continue;
for (i = 0; i < p->numpts; i++)
SearchSegInBSP((INT32)numnodes-1, &p->pts[i], p);
}
//CONS_Debug(DBG_RENDER, "numsplitpoly %d\n", numsplitpoly);
return numsplitpoly;
@@ -802,8 +810,10 @@ static void AdjustSegs(void)
count = subsectors[i].numlines;
lseg = &segs[subsectors[i].firstline];
p = extrasubsectors[i].planepoly;
//if (!p)
//continue;
if (!p)
continue;
for (; count--; lseg++)
{
float distv1,distv2,tmp;
@@ -895,7 +905,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
#endif
// reset the portal flag
gr_maphasportals = 0;
gl_maphasportals = 0;
// find min/max boundaries of map
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
@@ -913,9 +923,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
// allocate table for back to front drawing of subsectors
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors);
if (!gr_drawsubsectors)
I_Error("couldn't malloc gr_drawsubsectors\n");*/
/*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
if (!gl_drawsubsectors)
I_Error("couldn't malloc gl_drawsubsectors\n");*/
// number of the first new subsector that might be added
addsubsector = numsubsectors;
+223 -202
View File
@@ -14,9 +14,10 @@
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "hw_batching.h"
#include "../doomstat.h" //gamemode
@@ -54,10 +55,10 @@ static INT32 format2bpp(GLTextureFormat_t format)
// It is now split from it for my sanity! (and the sanity of others)
// -- Monster Iestyn (13/02/19)
static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap,
INT32 pblockheight, INT32 blockmodulo,
fixed_t yfracstep, fixed_t scale_y,
texpatch_t *originPatch, INT32 patchheight,
INT32 bpp, RGBA_t *palette)
INT32 pblockheight, INT32 blockmodulo,
fixed_t yfracstep, fixed_t scale_y,
texpatch_t *originPatch, INT32 patchheight,
INT32 bpp, RGBA_t *palette)
{
fixed_t yfrac, position, count;
UINT8 *dest;
@@ -73,6 +74,9 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
(void)patchheight; // This parameter is unused
if (!mipmap)
return;
if (originPatch) // originPatch can be NULL here, unlike in the software version
originy = originPatch->originy;
@@ -108,14 +112,14 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
count--;
texel = source[yfrac>>FRACBITS];
alpha = 0xff;
alpha = 0xFF;
//Hurdler: not perfect, but better than holes
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
// Make pixel transparent if chroma keyed
if ((mipmap && mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
alpha = 0x00;
//Hurdler: 25/04/2000: now support colormap in hardware mode
if (mipmap->colormap)
if (mipmap && mipmap->colormap)
texel = mipmap->colormap[texel];
// hope compiler will get this switch out of the loops (dreams...)
@@ -123,7 +127,8 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
// Alam: SRB2 uses Mingw, HUGS
switch (bpp)
{
case 2 : texelu16 = (UINT16)((alpha<<8) | texel);
case 2 : // uhhhhhhhh..........
texelu16 = (UINT16)((alpha<<8) | texel);
memcpy(dest, &texelu16, sizeof(UINT16));
break;
case 3 : colortemp = palette[texel];
@@ -141,6 +146,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
dest += blockmodulo;
yfrac += yfracstep;
}
patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4);
}
}
@@ -166,7 +172,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
if (pwidth <= 0 || pheight <= 0)
return;
palette = HWR_GetTexturePalette();
ncols = pwidth;
@@ -182,6 +188,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
// NOTE: should this actually be pblockwidth*bpp?
blockmodulo = pblockwidth*bpp;
// Draw each column to the block cache
@@ -216,7 +223,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (texture->width <= 0 || texture->height <= 0)
return;
palette = HWR_GetTexturePalette();
x1 = patch->originx;
@@ -260,6 +267,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (bpp < 1 || bpp > 4)
I_Error("HWR_DrawTexturePatchInCache: no drawer defined for this bpp (%d)\n",bpp);
// NOTE: should this actually be pblockwidth*bpp?
blockmodulo = pblockwidth*bpp;
// Draw each column to the block cache
@@ -275,15 +283,15 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
}
}
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
{
UINT8 *block;
INT32 bpp, i;
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
INT32 blocksize = (grMipmap->width * grMipmap->height);
INT32 blocksize = (glMipmap->width * glMipmap->height);
bpp = format2bpp(grMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
bpp = format2bpp(glMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(glMipmap->data));
switch (bpp)
{
@@ -303,7 +311,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
// Create a composite texture from patches, adapt the texture size to a power of 2
// height and width for the hardware texture cache.
//
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noencore)
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noencore)
{
UINT8 *block;
texture_t *texture;
@@ -311,9 +319,9 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
patch_t *realpatch;
INT32 blockwidth, blockheight, blocksize;
INT32 i;
INT32 i, idx;
boolean skyspecial = false; //poor hack for Legacy large skies..
RGBA_t *palette;
palette = HWR_GetTexturePalette();
@@ -328,30 +336,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
)
{
skyspecial = true;
grtex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
gltex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
}
else
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
grtex->mipmap.width = (UINT16)texture->width;
grtex->mipmap.height = (UINT16)texture->height;
gltex->mipmap.width = (UINT16)(texture->width);
gltex->mipmap.height = (UINT16)(texture->height);
if (skyspecial)
grtex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
else
grtex->mipmap.format = textureformat;
gltex->mipmap.format = textureformat;
grtex->mipmap.colormap = colormaps;
gltex->mipmap.colormap = colormaps;
#ifdef GLENCORE
if (encoremap && !noencore)
grtex->mipmap.colormap += COLORMAP_REMAPOFFSET;
gltex->mipmap.colormap += COLORMAP_REMAPOFFSET;
#endif
blockwidth = texture->width;
blockheight = texture->height;
blocksize = (blockwidth * blockheight);
block = MakeBlock(&grtex->mipmap);
block = MakeBlock(&gltex->mipmap);
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
{
@@ -359,14 +367,15 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
RGBA_t col;
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
for (j = 0; j < blockheight; j++)
for (idx = 0, j = 0; j < blockheight; j++)
{
for (i = 0; i < blockwidth; i++)
for (i = 0; i < blockwidth; i++, idx++)
{
block[4*(j*blockwidth+i)+0] = col.s.red;
block[4*(j*blockwidth+i)+1] = col.s.green;
block[4*(j*blockwidth+i)+2] = col.s.blue;
block[4*(j*blockwidth+i)+3] = 0xff;
block[4*idx+0] = col.s.red;
block[4*idx+1] = col.s.green;
block[4*idx+2] = col.s.blue;
block[4*idx+3] = 0xff;
}
}
}
@@ -375,85 +384,94 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
{
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
HWR_DrawTexturePatchInCache(&grtex->mipmap,
blockwidth, blockheight,
texture, patch,
realpatch);
Z_Unlock(realpatch);
}
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
if (format2bpp(grtex->mipmap.format)==4)
{
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
if (realpatch != NULL)
{
if (block[i] == 0)
{
grtex->mipmap.flags |= TF_TRANSPARENT;
break;
}
HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
}
}
grtex->scaleX = 1.0f/(texture->width*FRACUNIT);
grtex->scaleY = 1.0f/(texture->height*FRACUNIT);
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
if (format2bpp(gltex->mipmap.format) == 4)
{
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
{
if (block[i] != 0)
continue;
gltex->mipmap.flags |= TF_TRANSPARENT;
break;
}
}
gltex->scaleX = 1.0f/(texture->width*FRACUNIT);
gltex->scaleY = 1.0f/(texture->height*FRACUNIT);
}
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
// patch may be NULL if glMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
{
if (glMipmap == NULL)
return;
if (patch == NULL || glPatch == NULL)
{
Z_Free(glMipmap->data);
glMipmap->data = NULL;
return;
}
// don't do it twice (like a cache)
if (grMipmap->width == 0)
if (glMipmap->width == 0)
{
// save the original patch header so that the GLPatch can be casted
// into a standard patch_t struct and the existing code can get the
// orginal patch dimensions and offsets.
grPatch->width = SHORT(patch->width);
grPatch->height = SHORT(patch->height);
grPatch->leftoffset = SHORT(patch->leftoffset);
grPatch->topoffset = SHORT(patch->topoffset);
glPatch->width = SHORT(patch->width);
glPatch->height = SHORT(patch->height);
glPatch->leftoffset = SHORT(patch->leftoffset);
glPatch->topoffset = SHORT(patch->topoffset);
//grMipmap->width = (UINT16)SHORT(patch->width);
//grMipmap->height = (UINT16)SHORT(patch->height);
grMipmap->width = grMipmap->height = 1;
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
glMipmap->width = glMipmap->height = 1;
while (glMipmap->width < glPatch->width) glMipmap->width <<= 1;
while (glMipmap->height < glPatch->height) glMipmap->height <<= 1;
// no wrap around, no chroma key
grMipmap->flags = 0;
glMipmap->flags = 0;
// setup the texture info
grMipmap->format = patchformat;
//grPatch->max_s = grPatch->max_t = 1.0f;
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
glMipmap->format = patchformat;
//glPatch->max_s = glPatch->max_t = 1.0f;
glPatch->max_s = (float)glPatch->width / (float)glMipmap->width;
glPatch->max_t = (float)glPatch->height / (float)glMipmap->height;
}
Z_Free(grMipmap->data);
grMipmap->data = NULL;
Z_Free(glMipmap->data);
glMipmap->data = NULL;
if (makebitmap)
{
MakeBlock(grMipmap);
HWR_DrawPatchInCache(grMipmap,
grMipmap->width, grMipmap->height,
grPatch->width, grPatch->height,
MakeBlock(glMipmap);
HWR_DrawPatchInCache(glMipmap,
glMipmap->width, glMipmap->height,
glPatch->width, glPatch->height,
patch);
}
//grPatch->max_s = grPatch->max_t = 1.0f;
}
// =================================================
// CACHING HANDLING
// =================================================
static size_t gr_numtextures;
static GLMapTexture_t *gr_textures; // For all textures
static size_t gl_numtextures;
static GLMapTexture_t *gl_textures; // For all textures
void HWR_InitTextureCache(void)
{
gr_numtextures = 0;
gr_textures = NULL;
gl_numtextures = 0;
gl_textures = NULL;
}
// Callback function for HWR_FreeTextureCache.
@@ -493,7 +511,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
if (next->data)
Z_Free(next->data);
next->data = NULL;
HWD.pfnDeleteTexture(next);
GL_DeleteTexture(next);
// Free the old colormap mipmap from memory.
free(next);
@@ -504,7 +522,7 @@ void HWR_FreeMipmapCache(void)
{
INT32 i;
// free references to the textures
HWD.pfnClearMipMapCache();
GL_ClearMipMapCache();
// free all hardware-converted graphics cached in the heap
// our gool is only the textures since user of the texture is the texture cache
@@ -525,10 +543,10 @@ void HWR_FreeTextureCache(void)
// now the heap don't have any 'user' pointing to our
// texturecache info, we can free it
if (gr_textures)
free(gr_textures);
gr_textures = NULL;
gr_numtextures = 0;
if (gl_textures)
free(gl_textures);
gl_textures = NULL;
gl_numtextures = 0;
}
void HWR_LoadTextures(size_t pnumtextures)
@@ -536,13 +554,13 @@ void HWR_LoadTextures(size_t pnumtextures)
// we must free it since numtextures changed
HWR_FreeTextureCache();
gr_numtextures = pnumtextures;
gl_numtextures = pnumtextures;
#ifdef GLENCORE
gr_textures = calloc(pnumtextures, sizeof (*gr_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
gl_textures = calloc(pnumtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
#else
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
gl_textures = calloc(pnumtextures, sizeof (*gl_textures));
#endif
if (gr_textures == NULL)
if (gl_textures == NULL)
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
}
@@ -551,9 +569,9 @@ void HWR_LoadTextures(size_t pnumtextures)
// --------------------------------------------------------------------------
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
{
GLMapTexture_t *grtex;
GLMapTexture_t *gltex;
if (tex < 0 || tex >= (signed)gr_numtextures)
if (tex < 0 || tex >= (signed)gl_numtextures)
{
#ifdef PARANOIA
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
@@ -562,26 +580,25 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
#endif
}
#ifdef GLENCORE
grtex = &gr_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
#else
grtex = &gr_textures[tex];
gltex = &gl_textures[tex];
#endif
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_GenerateTexture(tex, grtex, noencore);
if (!gltex->mipmap.data && !gltex->mipmap.downloaded)
HWR_GenerateTexture(tex, gltex, noencore);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grtex->mipmap.downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
if (!gltex->mipmap.downloaded)
GL_SetTexture(&gltex->mipmap);
HWR_SetCurrentTexture(&gltex->mipmap);
// The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(gltex->mipmap.data, PU_HWRCACHE_UNLOCKED);
return grtex;
return gltex;
}
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
{
#ifdef GLENCORE
UINT8 *flat;
@@ -590,8 +607,8 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
size_t size, pflatsize;
// setup the texture info
grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
glMipmap->format = GL_TEXFMT_P_8;
glMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
size = W_LumpLength(flatlumpnum);
@@ -619,135 +636,139 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
pflatsize = 64;
break;
}
grMipmap->width = (UINT16)pflatsize;
grMipmap->height = (UINT16)pflatsize;
glMipmap->width = (UINT16)pflatsize;
glMipmap->height = (UINT16)pflatsize;
// the flat raw data needn't be converted with palettized textures
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
PU_HWRCACHE, &grMipmap->data));
W_ReadLump(flatlumpnum, Z_Malloc(size, PU_HWRCACHE, &glMipmap->data));
#ifdef GLENCORE
flat = grMipmap->data;
flat = glMipmap->data;
for (steppy = 0; steppy < size; steppy++)
if (flat[steppy] != HWR_PATCHES_CHROMAKEY_COLORINDEX)
flat[steppy] = grMipmap->colormap[flat[steppy]];
{
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
continue;
flat[steppy] = glMipmap->colormap[flat[steppy]];
}
#endif
}
// Download a Doom 'flat' to the hardware cache and make it ready for use
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
GLMipmap_t *grmip;
GLMipmap_t *glMipmap;
if (flatlumpnum == LUMPERROR)
return;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
glMipmap = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
grmip->colormap = colormaps;
glMipmap->colormap = colormaps;
#ifdef GLENCORE
if (!noencoremap && encoremap)
grmip->colormap += COLORMAP_REMAPOFFSET;
glMipmap->colormap += COLORMAP_REMAPOFFSET;
#endif
if (!grmip->downloaded && !grmip->data)
HWR_CacheFlat(grmip, flatlumpnum);
if (!glMipmap->downloaded && !glMipmap->data)
HWR_CacheFlat(glMipmap, flatlumpnum);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
if (!glMipmap->downloaded)
GL_SetTexture(glMipmap);
HWR_SetCurrentTexture(glMipmap);
// The system-memory data can be purged now.
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
}
//
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
// : load it first in doom cache if not already
//
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
{
if (!grmip->downloaded && !grmip->data)
if (!glMipmap->downloaded && !glMipmap->data)
{
patch_t *patch = gpatch->rawpatch;
patch_t *patch = glPatch->rawpatch;
if (!patch)
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
HWR_MakePatch(patch, gpatch, grmip, true);
patch = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
HWR_MakePatch(patch, glPatch, glMipmap, true);
// You can't free rawpatch for some reason?
// (Obviously I can't, sprite rotation needs that...)
if (!gpatch->rawpatch)
if (!glPatch->rawpatch)
Z_Free(patch);
}
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
if (!glMipmap->downloaded)
GL_SetTexture(glMipmap);
HWR_SetCurrentTexture(glMipmap);
// The system-memory data can be purged now.
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
// -----------------+
void HWR_GetPatch(GLPatch_t *gpatch)
void HWR_GetPatch(GLPatch_t *glPatch)
{
// is it in hardware cache
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
{
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
// flush the software patch before the conversion! oh yeah I suffered
patch_t *ptr = gpatch->rawpatch;
patch_t *ptr = glPatch->rawpatch;
if (!ptr)
ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, true);
// this is inefficient.. but the hardware patch in heap is purgeable so it should
// not fragment memory, and besides the REAL cache here is the hardware memory
if (!gpatch->rawpatch)
if (!glPatch->rawpatch)
Z_Free(ptr);
}
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!gpatch->mipmap->downloaded)
HWD.pfnSetTexture(gpatch->mipmap);
HWR_SetCurrentTexture(gpatch->mipmap);
if (!glPatch->mipmap->downloaded)
GL_SetTexture(glPatch->mipmap);
HWR_SetCurrentTexture(glPatch->mipmap);
// The system-memory patch data can be purged now.
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
}
// -------------------+
// HWR_GetMappedPatch : Same as HWR_GetPatch for sprite color
// -------------------+
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
void HWR_GetMappedPatch(GLPatch_t *glPatch, const UINT8 *colormap)
{
GLMipmap_t *grmip, *newmip;
GLMipmap_t *glMipmap, *newMipmap;
// Blatant hack for encore colormapping aside...
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
{
// Load the default (green) color in doom cache (temporary?) AND hardware cache
HWR_GetPatch(gpatch);
HWR_GetPatch(glPatch);
return;
}
// search for the mimmap
// search for the mipmap
// skip the first (no colormap translated)
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
{
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap)
{
HWR_LoadMappedPatch(grmip, gpatch);
return;
}
glMipmap = glMipmap->nextcolormap;
if (glMipmap->colormap != colormap)
continue;
HWR_LoadMappedPatch(glMipmap, glPatch);
return;
}
// not found, create it!
// If we are here, the sprite with the current colormap is not already in hardware memory
@@ -756,38 +777,38 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
// (it have a liste of mipmap)
// this malloc is cleared in HWR_FreeTextureCache
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
newMipmap = calloc(1, sizeof (*newMipmap));
if (newMipmap == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
grmip->nextcolormap = newmip;
glMipmap->nextcolormap = newMipmap;
newmip->colormap = colormap;
HWR_LoadMappedPatch(newmip, gpatch);
newMipmap->colormap = colormap;
HWR_LoadMappedPatch(newMipmap, glPatch);
}
void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
void HWR_UnlockCachedPatch(GLPatch_t *glPatch)
{
if (!gpatch)
if (!glPatch)
return;
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
}
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
{
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
GLPatch_t *grpatch;
GLPatch_t *glPatch;
if (!(grpatch = M_AATreeGet(hwrcache, lumpnum)))
if (!(glPatch = M_AATreeGet(hwrcache, lumpnum)))
{
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grpatch->wadnum = wadnum;
grpatch->lumpnum = lumpnum;
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, grpatch);
glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
glPatch->wadnum = wadnum;
glPatch->lumpnum = lumpnum;
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, glPatch);
}
return grpatch;
return glPatch;
}
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
@@ -814,6 +835,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
stepy = ((INT32)SHORT(fmheight)<<FRACBITS)/pblockheight;
stepx = ((INT32)SHORT(fmwidth)<<FRACBITS)/pblockwidth;
posy = 0;
for (j = 0; j < pblockheight; j++)
{
posx = 0;
@@ -835,14 +857,14 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
Z_Free(flat);
}
static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
{
size_t size;
UINT16 fmheight = 0, fmwidth = 0;
// setup the texture info
grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
grMipmap->flags = 0;
glMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
glMipmap->flags = 0;
size = W_LumpLength(fademasklumpnum);
@@ -871,28 +893,28 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
}
// Thankfully, this will still work for this scenario
grMipmap->width = fmwidth;
grMipmap->height = fmheight;
glMipmap->width = fmwidth;
glMipmap->height = fmheight;
MakeBlock(grMipmap);
MakeBlock(glMipmap);
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
HWR_DrawFadeMaskInCache(glMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
// I DO need to convert this because it isn't power of 2 and we need the alpha
}
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{
GLMipmap_t *grmip;
GLMipmap_t *glMipmap;
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
glMipmap = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!grmip->downloaded && !grmip->data)
HWR_CacheFadeMask(grmip, fademasklumpnum);
if (!glMipmap->downloaded && !glMipmap->data)
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
HWD.pfnSetTexture(grmip);
GL_SetTexture(glMipmap);
// The system-memory data can be purged now.
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
}
// =================================================
@@ -904,15 +926,15 @@ void HWR_SetPalette(RGBA_t *palette)
if (HWR_ShouldUsePaletteRendering())
{
// set the palette for palette postprocessing
if (cv_grpalettedepth.value == 16)
if (cv_glpalettedepth.value == 16)
{
// crush to 16-bit rgb565, like software currently does in the standard configuration
// Note: Software's screenshots have the 24-bit palette, but the screen gets
// the 16-bit version! For making comparison screenshots either use an external screenshot
// tool or set the palette depth to 24 bits.
RGBA_t crushed_palette[256];
int i;
for (i = 0; i < 256; i++)
for (int i = 0; i < 256; i++)
{
float fred = (float)(palette[i].s.red >> 3);
float fgreen = (float)(palette[i].s.green >> 2);
@@ -922,21 +944,21 @@ void HWR_SetPalette(RGBA_t *palette)
crushed_palette[i].s.blue = (UINT8)(fblue / 31.0f * 255.0f);
crushed_palette[i].s.alpha = 255;
}
HWD.pfnSetScreenPalette(crushed_palette);
GL_SetScreenPalette(crushed_palette);
}
else
{
HWD.pfnSetScreenPalette(palette);
GL_SetScreenPalette(palette);
}
// this part is responsible for keeping track of the palette OUTSIDE of a level.
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
HWR_SetMapPalette();
}
else
{
// set the palette for the textures
HWD.pfnSetTexturePalette(palette);
GL_SetPalette(palette);
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
memset(mapPalette, 0, sizeof(mapPalette));
// hardware driver will flush there own cache if cache is non paletized
@@ -969,7 +991,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
}
}
#undef STEP_SIZE
HWD.pfnSetPaletteLookup(lut);
GL_SetPaletteLookup(lut);
Z_Free(lut);
}
@@ -982,11 +1004,9 @@ void HWR_SetMapPalette(void)
RGBA_t *palette;
int i;
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
{
// outside of a level, pMasterPalette should have PLAYPAL ready for us
//palette = pMasterPalette; // we dont have this in kart so just use pLocalPalette as before
// outside of a level, pLocalPalette should have PLAYPAL ready for us
palette = pLocalPalette;
}
else
@@ -996,8 +1016,10 @@ void HWR_SetMapPalette(void)
lumpnum_t lumpnum = W_GetNumForName(GetPalette());
size_t palsize = W_LumpLength(lumpnum);
UINT8 *RGB_data;
if (palsize < 768) // 256 * 3
I_Error("HWR_SetMapPalette: A programmer assumed palette lumps are at least 768 bytes long, but apparently this was a wrong assumption!\n");
RGB_data = W_CacheLumpNum(lumpnum, PU_CACHE);
// we got the RGB palette now, but we need it in RGBA format.
for (i = 0; i < 256; i++)
@@ -1017,7 +1039,7 @@ void HWR_SetMapPalette(void)
// in palette rendering mode, this means that all rgba textures now have wrong colors
// and the lookup table is outdated
HWR_SetPaletteLookup(mapPalette);
HWD.pfnSetTexturePalette(mapPalette);
GL_SetPalette(mapPalette);
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
{
@@ -1040,12 +1062,11 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
for (i = 0; i < 256 * 32; i++)
hw_lighttable[i] = palette[lighttable[i]];
id = HWD.pfnCreateLightTable(hw_lighttable);
id = GL_CreateLightTable(hw_lighttable);
Z_Free(hw_lighttable);
return id;
}
// get hwr lighttable id for colormap, create it if it doesn't already exist
UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
{
@@ -1077,7 +1098,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
void HWR_ClearLightTables(void)
{
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWD.pfnClearLightTables();
GL_ClearLightTables();
}
#endif //HWRENDER
+4 -4
View File
@@ -333,20 +333,20 @@ 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 / M_PI;
clipfov = atan(1 / projMatrix[0]) * 360.0f / M_PIl;
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
if (floatangle >= 180.0)
return 0xffffffff;
a1 = ANG1 * (int)floatangle;
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
return a1;
}
// SRB2CB I don't think used any of this stuff, let's disable for now since SRB2 probably doesn't want it either
// compiler complains about (p)glGetFloatv anyway, in case anyone wants this
// only r_opengl.c can use the base gl funcs as it turns out, that's a problem for whoever wants sphere frustum checks
// btw to renable define HAVE_SPHEREFRUSTRUM in hw_clip.h
#ifdef HAVE_SPHEREFRUSTRUM
//
// gld_FrustumSetup
//
@@ -458,4 +458,4 @@ boolean gld_SphereInFrustum(float x, float y, float z, float radius)
}
return true;
}
#endif
#endif
+7 -6
View File
@@ -33,30 +33,31 @@ typedef enum GLTextureFormat_e
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
} GLTextureFormat_t;
// data holds the address of the graphics data cached in heap memory
// NULL if the texture is not in Doom heap cache.
// Texture information (misleadingly named "mipmap" all over the code.)
// The *data pointer holds the address of the graphics data cached in heap memory.
// NULL if the texture is not in SRB2's heap cache.
struct GLMipmap_s
{
// for UpdateTexture
GLTextureFormat_t format;
void *data;
UINT32 flags;
UINT16 width, height;
UINT32 downloaded; // tex_downloaded
UINT32 downloaded; // The GPU has this texture.
struct GLMipmap_s *nextmipmap;
struct GLMipmap_s *nextcolormap;
const UINT8 *colormap;
};
typedef struct GLMipmap_s GLMipmap_t;
//
// Doom texture info, as cached for hardware rendering
// Level textures, as cached for hardware rendering.
//
struct GLMapTexture_s
{
GLMipmap_t mipmap;
float scaleX; //used for scaling textures on walls
float scaleX; //used for scaling textures on walls
float scaleY;
};
typedef struct GLMapTexture_s GLMapTexture_t;
+62 -41
View File
@@ -121,42 +121,26 @@ typedef struct
poly_t *planepoly; // the generated convex polygon
} extrasubsector_t;
//here lies gr_vissprite
// Kart features
#define USE_FTRANSFORM_ANGLEZ
#define USE_FTRANSFORM_MIRROR
// Vanilla features
//#define USE_MODEL_NEXTFRAME
typedef struct
{
FLOAT x,y,z; // position
#ifdef USE_FTRANSFORM_ANGLEZ
FLOAT anglex,angley,anglez; // aimingangle / viewangle
FLOAT anglex2,anglez2; // secondaries
#else
FLOAT anglex,angley; // aimingangle / viewangle
FLOAT anglex2; // secondaries
#endif
FLOAT scalex,scaley,scalez;
FLOAT spritexscale,spriteyscale;
FLOAT fovxangle, fovyangle;
FLOAT anglex, angley, anglez; // aimingangle / viewangle
FLOAT anglex2, anglez2; // secondaries
FLOAT scalex, scaley, scalez;
FLOAT fovangle;
UINT8 splitscreen;
boolean flip; // screenflip
boolean roll;
boolean rollmodel;
SINT8 rollflip;
FLOAT rollangle;
UINT8 rotaxis;
FLOAT centerx, centery;
#ifdef USE_FTRANSFORM_MIRROR
FLOAT rollx, rollz;
boolean mirror; // SRB2Kart: Encore Mode
boolean mirrorflip; // Encore Mode with Flipcam
#endif
boolean shearing; // 14042019
angle_t viewaiming; // 17052019
float viewaiming; // 17052019
} FTransform;
// Transformed vector, as passed to HWR API
@@ -166,6 +150,41 @@ typedef struct
FLOAT s,t;
} FOutVector;
typedef struct vbo_vertex_s
{
float x, y, z;
float u, v;
unsigned char r, g, b, a;
} gl_skyvertex_t;
typedef enum gl_skyloopmode_e
{
HWD_SKYLOOP_FAN,
HWD_SKYLOOP_STRIP
} gl_skyloopmode_t;
typedef struct
{
gl_skyloopmode_t mode;
int vertexcount;
int vertexindex;
boolean use_texture;
} gl_skyloopdef_t;
typedef struct
{
unsigned int vbo;
int rows, columns;
int loopcount;
int detail, vertex_count;
int texture, width, height;
boolean rebuild; // VBO needs to be rebuilt
gl_skyloopdef_t *loops;
gl_skyvertex_t *data;
} gl_sky_t;
// Shader targets used to render specific types of geometry.
// A shader target is resolved to an actual shader with HWR_GetShaderFromTarget.
// The shader returned may be a base shader or a custom shader.
@@ -173,10 +192,9 @@ enum
{
SHADER_NONE = -1,
SHADER_FLOOR = 0,
SHADER_SHADOW,
SHADER_WALL,
SHADER_MODEL,
SHADER_SPRITE,
SHADER_MODEL,
SHADER_WATER,
SHADER_FOG,
SHADER_SKY,
@@ -204,7 +222,6 @@ enum hwdshaderstage
typedef enum hwdshaderstage hwdshaderstage_t;
// ==========================================================================
// RENDER MODES
// ==========================================================================
@@ -215,22 +232,22 @@ enum EPolyFlags
{
// the first 5 are mutually exclusive
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pels are discarded (holes in texture)
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pixels are discarded (holes in texture)
PF_Translucent = 0x00000002, // Poly is transparent, alpha = level of transparency
PF_Additive = 0x00000004, // Poly is added to the frame buffer
PF_Environment = 0x00000008, // Poly should be drawn environment mapped.
// Hurdler: used for text drawing
PF_Substractive = 0x00000010, // for splat
PF_NoAlphaTest = 0x00000020, // hiden param
PF_Fog = 0x00000040, // Fog blocks
PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog)&~PF_NoAlphaTest,
PF_Environment = 0x00000004, // Poly should be drawn environment mapped. (Hurdler: used for text drawing)
PF_Additive = 0x00000008, // Source blending factor is additive.
PF_Subtractive = 0x00000010, // Subtractive color blending
PF_ReverseSubtract = 0x00000020, // Reverse subtract, used in wall splats (decals)
PF_Multiplicative = 0x00000040, // Multiplicative color blending
PF_Fog = 0x20000000, // Fog blocks
PF_NoAlphaTest = 0x40000000, // Disables alpha testing
PF_Blending = (PF_Masked|PF_Translucent|PF_Environment|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Fog) & ~PF_NoAlphaTest,
// other flag bits
PF_Occlude = 0x00000100, // Update the depth buffer
PF_NoDepthTest = 0x00000200, // Disable the depth test mode
PF_Invisible = 0x00000400, // Disable write to color buffer
PF_Decal = 0x00000800, // Enable polygon offset
PF_Occlude = 0x00000100, // Updates the depth buffer
PF_NoDepthTest = 0x00000200, // Disables the depth test mode
PF_Invisible = 0x00000400, // Disables write to color buffer
PF_Decal = 0x00000800, // Enables polygon offset
PF_Modulated = 0x00001000, // Modulation (multiply output with constant RGBA)
// When set, pass the color constant into the FSurfaceInfo -> FlatColor
PF_NoTexture = 0x00002000, // Disable texture
@@ -272,6 +289,7 @@ struct FLightInfo
FUINT light_level;
FUINT fade_start;
FUINT fade_end;
boolean directional;
};
typedef struct FLightInfo FLightInfo;
@@ -289,9 +307,6 @@ typedef struct FSurfaceInfo FSurfaceInfo;
enum hwdsetspecialstate
{
#ifdef USE_FBO_OGL
HWD_SET_FRAMEBUFFER,
#endif
HWD_SET_SHADERS,
HWD_SET_TEXTUREFILTERMODE,
@@ -313,6 +328,11 @@ typedef enum hwdsetspecialstate hwdspecialstate_t;
enum hwdshaderinfo
{
HWD_SHADERINFO_LEVELTIME = 1,
HWD_SHADERINFO_LIGHT_X,
HWD_SHADERINFO_LIGHT_Y,
HWD_SHADERINFO_LIGHT_Z,
HWD_SHADERINFO_LIGHT_CONTRAST,
HWD_SHADERINFO_LIGHT_BACKLIGHT,
};
typedef enum hwdshaderinfo hwdshaderinfo_t;
@@ -346,6 +366,7 @@ enum hwdscreentexture
HWD_SCREENTEXTURE_WIPE_END, // destination image for the wipe/fade effect
HWD_SCREENTEXTURE_GENERIC1, // underwater/heat effect, intermission background
HWD_SCREENTEXTURE_GENERIC2, // palette-based colormap fade, final screen texture
HWD_SCREENTEXTURE_VHS,
NUMSCREENTEXTURES, // (generic3 is unused if palette rendering is disabled)
};
typedef enum hwdscreentexture hwdscreentexture_t;
+144 -116
View File
@@ -18,9 +18,10 @@
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "../m_misc.h" //FIL_WriteFile()
#include "../r_draw.h" //viewborderlump
@@ -61,6 +62,9 @@ static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
//
// -----------------+
// HWR_DrawPatch : Draw a 'tile' graphic
@@ -122,16 +126,17 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
flags |= PF_ForceWrapY;
// clip it since it is used for bunny scroll in doom I
HWD.pfnDrawPolygon(NULL, v, 4, flags);
GL_DrawPolygon(NULL, v, 4, flags);
}
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags)
{
FOutVector v[4];
FBITFIELD flags;
float cx = FIXED_TO_FLOAT(x);
float cy = FIXED_TO_FLOAT(y);
UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT);
UINT8 blendmode = ((bflags & V_BLENDMASK) >> V_BLENDSHIFT);
// 3--2
// | /|
@@ -142,6 +147,9 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
if (alphalevel >= 10 && alphalevel < 13)
return;
const float fvw = (float)vid.width;
const float fvh = (float)vid.height;
// make patch ready in hardware cache
if (!colormap)
HWR_GetPatch(gpatch);
@@ -225,21 +233,21 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
Z_Free(realpatch);
}
// centre screen
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
{
if (option & V_SNAPTORIGHT)
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(option & V_SNAPTOLEFT))
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
}
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
else if (option & V_SNAPTOBOTTOM)
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(option & V_SNAPTOTOP))
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2;
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
}
}
}
@@ -256,12 +264,12 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
}
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
cx = -1 + (cx / (vid.width/2));
cy = 1 - (cy / (vid.height/2));
cx = -1.0f + (cx / (vid.width / 2.0f));
cy = 1.0f - (cy / (vid.height / 2.0f));
// fwidth and fheight are similar
fwidth /= vid.width / 2;
fheight /= vid.height / 2;
fwidth /= fvw / 2.0f;
fheight /= fvh / 2.0f;
// set the polygon vertices to the right positions
v[0].x = v[3].x = cx;
@@ -286,7 +294,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
v[0].t = v[1].t = 0.0f;
v[2].t = v[3].t = gpatch->max_t;
flags = PF_Translucent|PF_NoDepthTest;
// whoops
if (blendmode)
flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest;
else
flags = PF_Translucent|PF_NoDepthTest;
if (option & V_WRAPX)
flags |= PF_ForceWrapX;
@@ -294,19 +306,22 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
flags |= PF_ForceWrapY;
// clip it since it is used for bunny scroll in doom I
if (alphalevel)
{
FSurfaceInfo Surf;
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated;
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
GL_DrawPolygon(&Surf, v, 4, flags);
}
else
HWD.pfnDrawPolygon(NULL, v, 4, flags);
GL_DrawPolygon(NULL, v, 4, flags);
}
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
@@ -326,6 +341,9 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
if (alphalevel >= 10 && alphalevel < 13)
return;
const float fvw = (float)vid.width;
const float fvh = (float)vid.height;
// make patch ready in hardware cache
HWR_GetPatch(gpatch);
@@ -376,21 +394,21 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
Z_Free(realpatch);
}
// centre screen
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
{
if (option & V_SNAPTORIGHT)
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(option & V_SNAPTOLEFT))
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
}
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
else if (option & V_SNAPTOBOTTOM)
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(option & V_SNAPTOTOP))
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2;
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
}
}
}
@@ -422,12 +440,12 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
}
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
cx = -1 + (cx / (vid.width/2));
cy = 1 - (cy / (vid.height/2));
cx = -1.0f + (cx / (vid.width / 2.0f));
cy = 1.0f - (cy / (vid.height / 2.0f));
// fwidth and fheight are similar
fwidth /= vid.width / 2;
fheight /= vid.height / 2;
fwidth /= fvw / 2.0f;
fheight /= fvh / 2.0f;
// set the polygon vertices to the right positions
v[0].x = v[3].x = cx;
@@ -455,15 +473,17 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
{
FSurfaceInfo Surf;
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value];
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value];
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated;
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
GL_DrawPolygon(&Surf, v, 4, flags);
}
else
HWD.pfnDrawPolygon(NULL, v, 4, flags);
GL_DrawPolygon(NULL, v, 4, flags);
}
// ==========================================================================
@@ -539,7 +559,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
// BTW, I see we put 0 for PFs, and If I'm right, that
// means we take the previous PFs as default
// how can we be sure they are ok?
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
}
@@ -552,33 +572,33 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
// 0--1
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
{
FOutVector v[4];
FSurfaceInfo Surf;
FOutVector v[4];
FSurfaceInfo Surf;
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f;
v[0].y = v[1].y = -1.0f;
v[2].y = v[3].y = 1.0f;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f;
v[0].y = v[1].y = -1.0f;
v[2].y = v[3].y = 1.0f;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = 1.0f;
v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = 1.0f;
v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f;
if (color & 0xFF00) // Do COLORMAP fade.
{
if (HWR_ShouldUsePaletteRendering() && cv_grscreentextures.value)
if (color & 0xFF00) // Do COLORMAP fade.
{
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
{
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
Surf.LightTableId = HWR_GetLightTableID(NULL);
Surf.LightInfo.light_level = strength;
HWD.pfnMakeScreenTexture(scr_tex);
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
HWD.pfnUnSetShader();
GL_MakeScreenTexture(scr_tex);
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
GL_UnSetShader();
return;
}
@@ -588,21 +608,21 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
Surf.PolyColor.s.alpha = (strength*8);
poly_flags |= PF_Translucent;
}
}
else // Do TRANSMAP** fade.
{
}
else // Do TRANSMAP** fade.
{
RGBA_t *palette = HWR_GetTexturePalette();
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
if (HWR_ShouldUsePaletteRendering())
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
else
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
poly_flags |= PF_Translucent;
}
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
poly_flags |= PF_Translucent;
}
GL_DrawPolygon(&Surf, v, 4, poly_flags);
}
// Draw the console background with translucency support
@@ -629,7 +649,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
Surf.PolyColor.rgba = UINT2RGBA(color);
Surf.PolyColor.s.alpha = 0x80;
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
@@ -652,17 +672,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
INT32 basewindowx, basewindowy;
GLPatch_t *patch;
// if (gr_viewwidth == vid.width)
// if (gl_viewwidth == vid.width)
// return;
if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowx), vid.fdupx));
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdupx));
// top
HWR_DrawFlatFill(0, 0,
@@ -776,16 +796,16 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
F2DCoord v1, v2;
RGBA_t color_rgba;
RGBA_t *palette = HWR_GetTexturePalette();
color_rgba = palette[color&0xFF];
v1.x = ((float)fl->a.x-(vid.width/2.0f))*(2.0f/vid.width);
v1.y = ((float)fl->a.y-(vid.height/2.0f))*(2.0f/vid.height);
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
GL_Draw2DLine(&v1, &v2, color_rgba);
}
// -----------------+
@@ -810,6 +830,9 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
fy = (float)y;
fw = fh = (float)wh;
const float fvw = (float)vid.width;
const float fvh = (float)vid.height;
if (!(color & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
@@ -819,20 +842,20 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
fw *= dupx;
fh *= dupy;
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dupx)) > 1.0E-36f)
{
if (color & V_SNAPTORIGHT)
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(color & V_SNAPTOLEFT))
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
}
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(color & V_SNAPTOTOP))
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
}
}
@@ -853,16 +876,16 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
return;
if (fx + fw > vid.width)
{
fwait = fw - ((float)vid.width - fx);
fw = (float)vid.width - fx;
fwait = fw - (fvw- fx);
fw = fvw - fx;
}
if (fy + fh > vid.height)
fh = (float)vid.height - fy;
fh = fvh - fy;
fx = -1 + fx / (vid.width / 2);
fy = 1 - fy / (vid.height / 2);
fw = fw / (vid.width / 2);
fh = fh / (vid.height / 2);
fx = -1.0f + fx / (vid.width / 2.0f);
fy = 1.0f - fy / (vid.height / 2.0f);
fw = fw / (fvw / 2.0f);
fh = fh / (fvh / 2.0f);
v[0].x = v[3].x = fx;
v[2].x = v[1].x = fx + fw;
@@ -879,7 +902,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
Surf.PolyColor = palette[color&0xFF];
HWD.pfnDrawPolygon(&Surf, v, 4,
GL_DrawPolygon(&Surf, v, 4,
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
}
@@ -906,6 +929,9 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
fw = (float)w;
fh = (float)h;
const float fvw = (float)vid.width;
const float fvh = (float)vid.height;
if (!(options & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
@@ -918,7 +944,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
clearColour.green = (float)rgbaColour.s.green / 255;
clearColour.blue = (float)rgbaColour.s.blue / 255;
clearColour.alpha = 1;
HWD.pfnClearBuffer(true, false, false, &clearColour);
GL_ClearBuffer(true, false, false, &clearColour);
return;
}
@@ -927,25 +953,25 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
fw *= dupx;
fh *= dupy;
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dupx)) > 1.0E-36f)
{
if (options & V_SNAPTORIGHT)
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(options & V_SNAPTOLEFT))
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
}
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
{
// same thing here
if (options & V_SNAPTOBOTTOM)
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(options & V_SNAPTOTOP))
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
}
if (options & V_SPLITSCREEN)
fy += ((float)BASEVIDHEIGHT * dupy)/2;
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
if (options & V_HORZSCREEN)
fx += ((float)BASEVIDWIDTH * dupx)/2;
fx += (FLOATBASEVIDWIDTH * dupx)/2;
}
@@ -965,14 +991,14 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
if (fw <= 0 || fh <= 0)
return;
if (fx + fw > vid.width)
fw = (float)vid.width - fx;
fw = fvw - fx;
if (fy + fh > vid.height)
fh = (float)vid.height - fy;
fh = fvh - fy;
fx = -1 + fx / (vid.width / 2);
fy = 1 - fy / (vid.height / 2);
fw = fw / (vid.width / 2);
fh = fh / (vid.height / 2);
fx = -1.0f + fx / (vid.width / 2.0f);
fy = 1.0f - fy / (vid.height / 2.0f);
fw = fw / (fvw / 2.0f);
fh = fh / (fvh / 2.0f);
v[0].x = v[3].x = fx;
v[2].x = v[1].x = fx + fw;
@@ -989,7 +1015,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
Surf.PolyColor.rgba = UINT2RGBA(color);
Surf.PolyColor.s.alpha = 0x80;
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
// -----------------+
@@ -1017,6 +1043,9 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
fw = (float)w;
fh = (float)h;
const float fvw = (float)vid.width;
const float fvh = (float)vid.height;
if (!(color & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
@@ -1029,7 +1058,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
clearColour.green = (float)rgbaColour.s.green / 255;
clearColour.blue = (float)rgbaColour.s.blue / 255;
clearColour.alpha = 1;
HWD.pfnClearBuffer(true, false, false, &clearColour);
GL_ClearBuffer(true, false, false, &clearColour);
return;
}
@@ -1038,26 +1067,25 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
fw *= dupx;
fh *= dupy;
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
{
if (color & V_SNAPTORIGHT)
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
else if (!(color & V_SNAPTOLEFT))
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
}
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
else if (!(color & V_SNAPTOTOP))
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
}
if (color & V_SPLITSCREEN)
fy += ((float)BASEVIDHEIGHT * dupy)/2;
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
if (color & V_HORZSCREEN)
fx += ((float)BASEVIDWIDTH * dupx)/2;
fx += (FLOATBASEVIDWIDTH * dupx)/2;
}
if (fx >= vid.width || fy >= vid.height)
@@ -1076,14 +1104,14 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
if (fw <= 0 || fh <= 0)
return;
if (fx + fw > vid.width)
fw = (float)vid.width - fx;
fw = fvw - fx;
if (fy + fh > vid.height)
fh = (float)vid.height - fy;
fh = fvh - fy;
fx = -1 + fx / (vid.width / 2);
fy = 1 - fy / (vid.height / 2);
fw = fw / (vid.width / 2);
fh = fh / (vid.height / 2);
fx = -1.0f + fx / (vid.width / 2.0f);
fy = 1.0f - fy / (vid.height / 2.0f);
fw = fw / (fvw / 2.0f);
fh = fh / (fvh / 2.0f);
v[0].x = v[3].x = fx;
v[2].x = v[1].x = fx + fw;
@@ -1107,7 +1135,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
}
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
#ifdef HAVE_PNG
@@ -1126,7 +1154,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
#define _FILE_OFFSET_BITS 0
#endif
#include "png.h"
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
#define USE_PNG // PNG is only used if write is supported (see ../m_misc.c)
#endif
@@ -1191,7 +1219,7 @@ UINT8 *HWR_GetScreenshot(void)
return NULL;
// returns 24bit 888 RGB
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
return buf;
}
@@ -1207,7 +1235,7 @@ boolean HWR_Screenshot(const char *pathname)
}
// returns 24bit 888 RGB
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
#ifdef USE_PNG
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
-142
View File
@@ -1,142 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief imports/exports for the GPU hardware low-level interface API
#ifndef __HWR_DRV_H__
#define __HWR_DRV_H__
// this must be here 19991024 by Kin
#include "../screen.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_md2.h"
#include "hw_dll.h"
#include "../doomdef.h"
// ==========================================================================
// STANDARD DLL EXPORTS
// ==========================================================================
EXPORT boolean HWRAPI(Init) (void);
EXPORT void HWRAPI(SetupGLInfo) (void);
EXPORT void HWRAPI(SetTexturePalette) (RGBA_t *ppal);
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data);
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
EXPORT void HWRAPI(ClearMipMapCache) (void);
//Hurdler: added for backward compatibility
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
//Hurdler: added for new development
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
EXPORT void HWRAPI(FlushScreenTextures) (void);
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
#define SCREENVERTS 10
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
// jimita
EXPORT boolean HWRAPI(InitShaders) (void);
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage);
EXPORT boolean HWRAPI(CompileShader) (int slot);
EXPORT void HWRAPI(SetShader) (int slot);
EXPORT void HWRAPI(UnSetShader) (void);
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut);
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable);
EXPORT void HWRAPI(ClearLightTables)(void);
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette);
// ==========================================================================
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
// ==========================================================================
#if !defined (_CREATE_DLL_)
struct hwdriver_s
{
Init pfnInit;
SetupGLInfo pfnSetupGLInfo;
SetTexturePalette pfnSetTexturePalette;
FinishUpdate pfnFinishUpdate;
Draw2DLine pfnDraw2DLine;
DrawPolygon pfnDrawPolygon;
DrawIndexedTriangles pfnDrawIndexedTriangles;
SetBlend pfnSetBlend;
ClearBuffer pfnClearBuffer;
SetTexture pfnSetTexture;
UpdateTexture pfnUpdateTexture;
DeleteTexture pfnDeleteTexture;
ReadScreenTexture pfnReadScreenTexture;
GClipRect pfnGClipRect;
ClearMipMapCache pfnClearMipMapCache;
SetSpecialState pfnSetSpecialState;
DrawModel pfnDrawModel;
CreateModelVBOs pfnCreateModelVBOs;
SetTransform pfnSetTransform;
GetTextureUsed pfnGetTextureUsed;
PostImgRedraw pfnPostImgRedraw;
FlushScreenTextures pfnFlushScreenTextures;
DoScreenWipe pfnDoScreenWipe;
DrawScreenTexture pfnDrawScreenTexture;
MakeScreenTexture pfnMakeScreenTexture;
RenderVhsEffect pfnRenderVhsEffect;
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
RenderSkyDome pfnRenderSkyDome;
InitShaders pfnInitShaders;
LoadShader pfnLoadShader;
CompileShader pfnCompileShader;
SetShader pfnSetShader;
UnSetShader pfnUnSetShader;
SetShaderInfo pfnSetShaderInfo;
SetPaletteLookup pfnSetPaletteLookup;
CreateLightTable pfnCreateLightTable;
ClearLightTables pfnClearLightTables;
SetScreenPalette pfnSetScreenPalette;
};
extern struct hwdriver_s hwdriver;
#define HWD hwdriver
#endif //not defined _CREATE_DLL_
#endif //__HWR_DRV_H__
+79
View File
@@ -0,0 +1,79 @@
// SONIC ROBO BLAST 2 Kart
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
// Copyright (C) 2020 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_gl.h
/// \brief OpenGL low-level interface API
#ifndef __HWR_GL_H__
#define __HWR_GL_H__
#include "../screen.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_md2.h"
#define SCREENVERTS 10
boolean GL_Init(void);
void GL_FinishUpdate(INT32 waitvbl);
void SetupGLInfo(void);
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
void GL_SetTransform(FTransform *stransform);
void GL_SetBlend(FBITFIELD PolyFlags);
void GL_SetPalette(RGBA_t *palette);
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
#define GL_DrawModel(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface) GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface)
void GL_RenderSkyDome(gl_sky_t *sky);
void GL_SetTexture(GLMipmap_t *pTexInfo);
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
void GL_Flush(void);
#define GL_ClearMipMapCache GL_Flush
INT32 GL_GetTextureUsed(void);
void GL_CreateModelVBOs(model_t *model);
void GL_ReadScreenTexture(int tex, UINT16 *dst_data);
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
void GL_MakeScreenTexture(int tex);
void GL_FlushScreenTextures(void);
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean useshader);
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
boolean GL_InitShaders(void);
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
boolean GL_CompileShader(int slot);
void GL_SetShader(int slot);
void GL_UnSetShader(void);
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value);
void GL_SetPaletteLookup(UINT8 *lut);
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
void GL_ClearLightTables(void);
void GL_SetScreenPalette(RGBA_t *palette);
#endif // __HWR_GL_H__
+6 -13
View File
@@ -23,16 +23,15 @@
// needed for sprite rendering
// equivalent of the software renderer's vissprites
typedef struct gr_vissprite_s
typedef struct gl_vissprite_s
{
float x1, x2;
float z1, z2;
float gz, gzt;
float tz, ty;
float tz;
float scale;
float spritexscale, spriteyscale;
float spritexoffset, spriteyoffset;
UINT32 renderflags;
GLPatch_t *gpatch;
boolean flip;
UINT8 translucency; //alpha level 0-255
@@ -42,7 +41,9 @@ typedef struct gr_vissprite_s
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gr_vissprite_t;
} gl_vissprite_t;
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model);
// --------
// hw_bsp.c
@@ -64,7 +65,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore);
void HWR_GetPatch(GLPatch_t *gpatch);
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
void HWR_SetPalette(RGBA_t *palette);
@@ -82,14 +83,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
extern INT32 patchformat;
extern INT32 textureformat;
// --------
// hw_main.c // originally hw_drawnodes.c from HWPortal branch
// --------
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
// --------
// hw_shaders.c
// --------
-27
View File
@@ -1,27 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_light.h"
#include "hw_drv.h"
#include "../i_video.h"
#include "../z_zone.h"
#include "../m_random.h"
#include "../m_bbox.h"
#include "../w_wad.h"
#include "../r_state.h"
#include "../r_main.h"
#include "../p_local.h"
#endif // HWRENDER
-20
View File
@@ -1,20 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief Dynamic lighting & coronas add on by Hurdler
#ifndef _HW_LIGHTS_
#define _HW_LIGHTS_
#include "hw_glob.h"
#include "hw_defs.h"
#endif
+2138 -2579
View File
File diff suppressed because it is too large. Load diff
+120 -78
View File
@@ -20,14 +20,17 @@
#ifndef __HWR_MAIN_H__
#define __HWR_MAIN_H__
#include "hw_gl.h"
#include "hw_glob.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_portal.h"
#include "../am_map.h"
#include "../d_player.h"
#include "../r_defs.h"
#include "../m_perfstats.h"
#include "../v_video.h"
#define GLENCORE
@@ -35,15 +38,32 @@
void HWR_Startup(void);
void HWR_Shutdown(void);
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
extern float gr_basewindowcenterx, gr_basewindowcentery;
extern float gl_basewindowcenterx, gl_basewindowcentery;
extern unsigned msaa;
extern boolean a2c;
extern FTransform atransform;
extern float gr_viewsin, gr_viewcos;
extern float gl_viewsin, gl_viewcos;
extern boolean gl_drawing_stencil;
extern seg_t *gl_curline;
extern side_t *gl_sidedef;
extern line_t *gl_linedef;
extern sector_t *gl_frontsector;
extern sector_t *gl_backsector;
enum
{
HWR_STENCIL_NORMAL,
HWR_STENCIL_BEGIN,
HWR_STENCIL_REVERSE,
HWR_STENCIL_DEPTH,
HWR_STENCIL_SKY
};
// Performance stats
extern ps_metric_t ps_hw_nodesorttime;
@@ -62,11 +82,11 @@ extern ps_metric_t ps_hw_numcolors;
extern ps_metric_t ps_hw_batchsorttime;
extern ps_metric_t ps_hw_batchdrawtime;
extern boolean gr_shadersavailable;
extern boolean gl_shadersavailable;
// hw_draw.c
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap);
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags);
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options); // Lat: separate flags from color since color needs to be an uint to work right.
@@ -81,109 +101,131 @@ UINT8 *HWR_GetScreenshot(void);
boolean HWR_Screenshot(const char *lbmname);
// hw_main.c
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_SetViewSize(void);
void HWR_AddCommands(void);
void HWR_SetTransform(float fpov, player_t *player);
void HWR_ClearClipper(void);
boolean HWR_UseShader(void);
boolean HWR_ShouldUsePaletteRendering(void);
boolean HWR_PalRenderFlashpal(void);
void HWR_TogglePaletteRendering(void);
void HWR_RenderPlayerView(void);
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
void HWR_ClearSkyDome(void);
void HWR_BuildSkyDome(void);
void HWR_SetTransform(float fpov);
void HWR_ClearClipper(void);
void HWR_SetStencilState(int state, int level);
// My original intention was to split hw_main.c
// into files like hw_bsp.c, hw_sprites.c...
// hw_main.c: Lighting and fog
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap, const boolean directional);
UINT8 HWR_GetTranstableAlpha(INT32 transtablenum);
FBITFIELD HWR_GetBlendModeFlag(INT32 ast);
FBITFIELD HWR_SurfaceBlend(INT32 style, INT32 transtablenum, FSurfaceInfo *pSurf);
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
// Get amount of memory used by gpu textures in bytes
INT32 HWR_GetTextureUsed(void);
// Get amount of memory used by gpu textures in bytes;
FUNCINLINE static ATTRINLINE INT32 HWR_GetTextureUsed(void)
{
return GL_GetTextureUsed();
}
// hw_main.c: Post-rendering
void HWR_DoPostProcessor(player_t *player);
void HWR_StartScreenWipe(void);
void HWR_EndScreenWipe(void);
void HWR_DrawIntermissionBG(void);
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
void HWR_MakeScreenFinalTexture(void);
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
// hw_main.c: Planes
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
FUNCINLINE static ATTRINLINE void HWR_StartScreenWipe(void)
{
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
}
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddPolyObjectPlanes(void);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
FUNCINLINE static ATTRINLINE void HWR_EndScreenWipe(void)
{
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
}
FUNCINLINE static ATTRINLINE void HWR_DrawIntermissionBG(void)
{
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
}
FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
{
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
}
FUNCINLINE static ATTRINLINE void HWR_MakeScreenFinalTexture(void)
{
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
}
FUNCINLINE static ATTRINLINE void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
{
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
}
// hw_main.c: Segs
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
// moved HWR_SplitWall to hw_main.c
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
void HWR_DrawSkyBackground(float fpov);
void HWR_AddPolyObjectSegs(void);
// hw_main.c: Sprites
void HWR_AddSprites(sector_t *sec);
void HWR_ProjectSprite(mobj_t *thing);
void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
void HWR_DrawSprites(void);
// hw_bsp.c
void HWR_CreatePlanePolygons(INT32 bspnum);
extern boolean gr_maphasportals;
extern boolean gl_maphasportals;
// hw_cache.c
void HWR_LoadTextures(size_t pnumtextures);
RGBA_t *HWR_GetTexturePalette(void);
void HWR_SetShaderState(void);
// Console variables
extern consvar_t cv_grshaders;
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
extern consvar_t cv_glscreentextures;
#ifdef USE_FBO_OGL
extern consvar_t cv_grframebuffer;
extern consvar_t cv_glframebuffer;
#endif
extern consvar_t cv_grfofcut;
extern consvar_t cv_fofzfightfix;
extern consvar_t cv_splitwallfix;
extern consvar_t cv_slopepegfix;
extern consvar_t cv_grshearing;
extern consvar_t cv_grfov;
extern consvar_t cv_grmdls;
extern consvar_t cv_grfog;
extern consvar_t cv_grfogdensity;
extern consvar_t cv_grfiltermode;
extern consvar_t cv_granisotropicmode;
extern consvar_t cv_grcorrecttricks;
extern consvar_t cv_grfovchange;
extern consvar_t cv_grsolvetjoin;
extern consvar_t cv_grspritebillboarding;
extern consvar_t cv_grfakecontrast;
extern consvar_t cv_grslopecontrast;
extern consvar_t cv_grhorizonlines;
extern consvar_t cv_grfallbackplayermodel;
extern consvar_t cv_grbatching;
extern consvar_t cv_grrenderdistance;
extern consvar_t cv_grpaletterendering;
extern consvar_t cv_grpalettedepth;
extern consvar_t cv_grflashpal;
extern consvar_t cv_grscreentextures;
extern consvar_t cv_grportals;
extern consvar_t cv_nostencil;
extern consvar_t cv_secbright;
extern CV_PossibleValue_t granisotropicmode_cons_t[];
extern consvar_t cv_glmdls;
extern consvar_t cv_glfallbackplayermodel;
extern consvar_t cv_glspritebillboarding;
extern consvar_t cv_glshearing;
extern consvar_t cv_glfakecontrast;
extern consvar_t cv_glslopecontrast;
extern consvar_t cv_glshaders;
extern consvar_t cv_gllightdither;
extern consvar_t cv_glsecbright;
extern consvar_t cv_glfiltermode;
extern consvar_t cv_glanisotropicmode;
extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_glbatching;
extern consvar_t cv_glrenderdistance;
extern consvar_t cv_glhorizonlines;
extern consvar_t cv_glportals;
extern consvar_t cv_glpaletterendering;
extern consvar_t cv_glpalettedepth;
extern consvar_t cv_glflashpal;
FUNCINLINE static ATTRINLINE boolean HWR_UseShader(void)
{
return (cv_glshaders.value && gl_shadersavailable);
}
FUNCINLINE static ATTRINLINE boolean HWR_ShouldUsePaletteRendering(void)
{
return (cv_glpaletterendering.value && (pLocalPalette != NULL) && HWR_UseShader());
}
FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
{
return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value);
}
#endif
+166 -200
View File
@@ -25,13 +25,14 @@
#include "../doomstat.h"
#ifdef HWRENDER
#include "hw_drv.h"
#include "hw_light.h"
#include "hw_gl.h"
#include "hw_md2.h"
#include "../d_main.h"
#include "../r_bsp.h"
#include "../r_fps.h"
#include "../r_main.h"
#include "../p_setup.h"
#include "../m_misc.h"
#include "../w_wad.h"
#include "../z_zone.h"
@@ -44,8 +45,8 @@
#include "hw_main.h"
#include "../v_video.h"
#ifdef HAVE_PNG
#ifdef HAVE_PNG
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
@@ -75,7 +76,7 @@
md2_t md2_models[NUMSPRITES];
md2_t md2_playermodels[MAXSKINS];
md2_t md2_localplayermodels[MAXSKINS];
md2_t md2_localplayermodels[MAXLOCALSKINS];
/*
@@ -148,7 +149,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
}
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *glpatch)
{
png_structp png_ptr;
png_infop png_info_ptr;
@@ -202,7 +203,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE);
Z_Free(grpatch->mipmap->data);
Z_Free(glpatch->mipmap->data);
return 0;
}
#ifdef USE_FAR_KEYWORD
@@ -243,7 +244,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->data);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &glpatch->mipmap->data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch;
@@ -283,7 +284,7 @@ typedef struct
} PcxHeader;
static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
GLPatch_t *grpatch)
GLPatch_t *glpatch)
{
PcxHeader header;
#define PALSIZE 768
@@ -323,7 +324,7 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->data);
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &glpatch->mipmap->data);
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{
@@ -365,43 +366,43 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
// -----------------+
static void md2_loadTexture(md2_t *model)
{
GLPatch_t *grpatch;
GLPatch_t *glpatch;
const char *filename = model->filename;
if (model->grpatch)
if (model->glpatch)
{
grpatch = model->grpatch;
Z_Free(grpatch->mipmap->data);
glpatch = model->glpatch;
Z_Free(glpatch->mipmap->data);
}
else
{
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->grpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->glpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
#endif
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
{
grpatch->notfound = true;// mark it so its not searched for again repeatedly
glpatch->notfound = true;// mark it so its not searched for again repeatedly
return;
}
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
// for palette rendering, color cube is applied in post-processing instead of here
if (!HWR_ShouldUsePaletteRendering())
@@ -409,7 +410,7 @@ static void md2_loadTexture(md2_t *model)
UINT32 size;
RGBA_t *image;
// Lactozilla: Apply colour cube
image = grpatch->mipmap->data;
image = glpatch->mipmap->data;
size = w*h;
while (size--)
{
@@ -418,8 +419,8 @@ static void md2_loadTexture(md2_t *model)
}
}
}
HWD.pfnSetTexture(grpatch->mipmap);
HWR_UnlockCachedPatch(grpatch);
GL_SetTexture(glpatch->mipmap);
HWR_UnlockCachedPatch(glpatch);
}
// -----------------+
@@ -427,49 +428,49 @@ static void md2_loadTexture(md2_t *model)
// -----------------+
static void md2_loadBlendTexture(md2_t *model)
{
GLPatch_t *grpatch;
GLPatch_t *glpatch;
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
strcpy(filename, model->filename);
FIL_ForceExtension(filename, "_blend.png");
if (model->blendgrpatch)
if (model->blendglpatch)
{
grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap->data);
glpatch = model->blendglpatch;
Z_Free(glpatch->mipmap->data);
}
else
{
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->blendgrpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->blendglpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
#endif
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
{
grpatch->notfound = true;// mark it so its not searched for again repeatedly
glpatch->notfound = true;// mark it so its not searched for again repeatedly
Z_Free(filename);
return;
}
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
}
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(grpatch);
GL_SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(glpatch);
Z_Free(filename);
}
@@ -490,14 +491,16 @@ void HWR_InitMD2(void)
{
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].glpatch = NULL;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
}
for (s = 0; s < MAXLOCALSKINS; s++)
{
md2_localplayermodels[s].scale = -1.0f;
md2_localplayermodels[s].model = NULL;
md2_localplayermodels[s].grpatch = NULL;
md2_localplayermodels[s].glpatch = NULL;
md2_localplayermodels[s].skin = -1;
md2_localplayermodels[s].notfound = true;
md2_localplayermodels[s].error = false;
@@ -506,7 +509,7 @@ void HWR_InitMD2(void)
{
md2_models[i].scale = -1.0f;
md2_models[i].model = NULL;
md2_models[i].grpatch = NULL;
md2_models[i].glpatch = NULL;
md2_models[i].skin = -1;
md2_models[i].notfound = true;
md2_models[i].error = false;
@@ -679,7 +682,7 @@ spritemd2found:
#define SETBRIGHTNESS(brightness,r,g,b) \
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glMipmap, INT32 skinnum, skincolors_t color)
{
UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h;
@@ -695,24 +698,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
memset(translation, 0, sizeof(translation));
memset(cutoff, 0, sizeof(cutoff));
if (grmip->width == 0)
if (glMipmap->width == 0)
{
grmip->width = gpatch->width;
grmip->height = gpatch->height;
glMipmap->width = gpatch->width;
glMipmap->height = gpatch->height;
// no wrap around, no chroma key
grmip->flags = 0;
glMipmap->flags = 0;
// setup the texture info
grmip->format = GL_TEXFMT_RGBA;
glMipmap->format = GL_TEXFMT_RGBA;
}
if (grmip->data)
if (glMipmap->data)
{
Z_Free(grmip->data);
grmip->data = NULL;
Z_Free(glMipmap->data);
glMipmap->data = NULL;
}
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->data);
cur = Z_Malloc(size*4, PU_HWRCACHE, &glMipmap->data);
memset(cur, 0x00, size*4);
image = gpatch->mipmap->data;
@@ -793,10 +796,9 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
}
}
}
}
if (translen > 0)
colorbrightnesses[translen] = colorbrightnesses[translen-1];
}
while (size--)
{
@@ -1043,28 +1045,29 @@ skippixel:
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLMipmap_t *grmip, *newmip;
GLMipmap_t *glMipmap, *newMipmap;
if (colormap == colormaps || colormap == NULL)
{
// Don't do any blending
HWD.pfnSetTexture(gpatch->mipmap);
GL_SetTexture(gpatch->mipmap);
return;
}
// search for the mimmap
// search for the Mipmap
// skip the first (no colormap translated)
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
{
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap)
glMipmap = glMipmap->nextcolormap;
if (glMipmap->colormap != colormap)
continue;
if (glMipmap->downloaded && glMipmap->data)
{
if (grmip->downloaded && grmip->data)
{
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
return;
}
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
return;
}
}
@@ -1075,26 +1078,25 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
// (it have a liste of mipmap)
// this malloc is cleared in HWR_FreeTextureCache
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
newMipmap = calloc(1, sizeof (*newMipmap));
if (newMipmap == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
grmip->nextcolormap = newmip;
newmip->colormap = colormap;
glMipmap->nextcolormap = newMipmap;
newMipmap->colormap = colormap;
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
HWD.pfnSetTexture(newmip);
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
GL_SetTexture(newMipmap);
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_DrawMD2 : Draw MD2
// :
// Returns :
// -----------------+
void HWR_DrawMD2(gr_vissprite_t *spr)
void HWR_DrawMD2(gl_vissprite_t *spr)
{
md2_t *md2;
@@ -1104,7 +1106,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
FTransform p;
FSurfaceInfo Surf;
if (!cv_grmdls.value)
if (!cv_glmdls.value)
return;
if (spr->precip)
@@ -1118,7 +1120,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
{
sector_t *sector = spr->mobj->subsector->sector;
extracolormap_t *colormap = sector->extra_colormap;
UINT8 lightlevel = 255;
INT32 lightlevel = 255;
if (sector->numlights)
{
@@ -1141,7 +1143,9 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
colormap = sector->extra_colormap;
}
HWR_Lighting(&Surf, lightlevel, colormap);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, true);
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !(spr->mobj->frame & FF_FULLBRIGHT));
}
else
{
@@ -1159,11 +1163,9 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
spritedef_t *sprdef;
spriteframe_t *sprframe;
spriteinfo_t *sprinfo;
INT32 rollfactor = 0;
angle_t ang;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
@@ -1177,13 +1179,31 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
// Apparently people don't like jump frames like that, so back it goes
//if (tics > durs)
//durs = tics;
INT32 blendmode;
if (spr->mobj->frame & FF_BLENDMASK)
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
else
blendmode = spr->mobj->blendmode;
blendmode = min(AST_MODULATE, blendmode);
if (spr->mobj->flags2 & MF2_SHADOW)
{
Surf.PolyColor.s.alpha = 0x40;
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
}
else if (spr->mobj->frame & FF_TRANSMASK)
{
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
Surf.PolyFlags = HWR_SurfaceBlend(blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
}
else
Surf.PolyColor.s.alpha = 0xFF;
{
// this hack is dumb, but the blendmodes refuse to work otherwise
Surf.PolyColor.s.alpha = (blendmode == AST_TRANSLUCENT) ? 0xFF : 0xFE;
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
}
// dont forget to enabled the depth test because we can't do this like
// before: polygons models are not sorted
@@ -1233,7 +1253,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
if (md2->model)
{
md2_printModelInfo(md2->model);
HWD.pfnCreateModelVBOs(md2->model);
GL_CreateModelVBOs(md2->model);
}
else
{
@@ -1243,22 +1263,22 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
}
}
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->grpatch;
gpatch = md2->glpatch;
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
gpatch = md2->glpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendgrpatch)->notfound)))
&& (!md2->blendglpatch
|| ((!((GLPatch_t *)md2->blendglpatch)->mipmap->format || !((GLPatch_t *)md2->blendglpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendglpatch)->notfound)))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
md2->blendglpatch && ((GLPatch_t *)md2->blendglpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendglpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendglpatch)->height)
{
INT32 tcskinnum = TC_DEFAULT;
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
@@ -1283,12 +1303,12 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
}
else tcskinnum = TC_DEFAULT;
}
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendglpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
}
else
{
// This is safe, since we know the texture has been downloaded
HWD.pfnSetTexture(gpatch->mipmap);
GL_SetTexture(gpatch->mipmap);
}
}
else
@@ -1312,7 +1332,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
// Interpolate the model interpolation. (lol)
tics -= FixedToFloat(rendertimefrac);
if (cv_grmdls.value == 1 && tics <= durs)
if (cv_glmdls.value == 1 && tics <= durs)
{
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE)
@@ -1339,7 +1359,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.x = FIXED_TO_FLOAT(interp.x);
p.y = FIXED_TO_FLOAT(interp.y)+md2->offset;
if (spr->mobj->eflags & MFE_VERTICALFLIP)
if (flip)
p.z = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
else
p.z = FIXED_TO_FLOAT(interp.z);
@@ -1362,112 +1382,58 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
const fixed_t anglef = AngleFixed((R_PointToAngle(interp.x, interp.y))-ANGLE_180);
p.angley = FIXED_TO_FLOAT(anglef);
}
p.rollangle = 0.0f;
p.rollflip = 1;
p.rotaxis = 0;
p.spritexscale = FIXED_TO_FLOAT(spr->mobj->spritexscale);
p.spriteyscale = FIXED_TO_FLOAT(spr->mobj->spriteyscale);
angle_t sliptideroll = 0;
if (spr->mobj->player)
sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value) ? spr->mobj->player->sliproll : 0);
const angle_t sliptideroll = ((cv_sliptideroll.value && spr->mobj->player) ? spr->mobj->player->sliproll : 0);
const SINT8 flipfactor = flip ? -1 : 1;
if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value))
if (spr->mobj->rollangle || sliptideroll)
{
angle_t rollang = 0;
rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0);
angle_t rollang = sliptideroll
? (spr->mobj->rollangle) + (sliptideroll * spr->mobj->player->kartstuff[k_aizdriftstrat])
: (spr->mobj->rollangle);
rollang = (spr->mobj->player && sliptideroll && cv_sliptideroll.value)
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->sliptidemem)
: (spr->mobj->rollangle * rollfactor);
fixed_t anglef = AngleFixed(rollang);
p.rollangle = FIXED_TO_FLOAT(anglef);
p.rollmodel = (spr->mobj->rollmodel);
p.roll = true;
// rotation pivot
p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2)*(p.spritexscale);
p.centery = FIXED_TO_FLOAT(spr->mobj->height/2)*(p.spriteyscale);
p.rollangle = 0.0f;
// rotation axis
if (sprinfo->available)
p.rotaxis = (UINT8)(sprinfo->pivot[(spr->mobj->frame & FF_FRAMEMASK)].rotaxis);
if (anglef)
{
fixed_t camAngleDiff = AngleFixed(viewangle) - FLOAT_TO_FIXED(p.angley); // dumb reconversion back, I know
// for NiGHTS specifically but should work everywhere else
ang = R_PointToAngle (spr->mobj->x, spr->mobj->y) - (spr->mobj->player ? spr->mobj->player->frameangle : spr->mobj->angle);
if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right
p.rollflip = 1;
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
p.rollflip = -1;
p.rollangle = FIXED_TO_FLOAT(anglef);
p.roll = true;
// rotation pivot
if (sprinfo->available)
{
p.centerx = FIXED_TO_FLOAT(sprinfo->pivot[frame].x);
p.centery = FIXED_TO_FLOAT(sprinfo->pivot[frame].y);
}
else
{
p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2);
p.centery = FIXED_TO_FLOAT(spr->mobj->height/2);
}
// rotation axes relative to camera
p.rollx = FIXED_TO_FLOAT(FINECOSINE(FixedAngle(camAngleDiff) >> ANGLETOFINESHIFT));
p.rollz = FIXED_TO_FLOAT(FINESINE(FixedAngle(camAngleDiff) >> ANGLETOFINESHIFT));
}
}
p.anglex = 0.0f;
p.anglex2 = 0.0f;
#ifdef USE_FTRANSFORM_ANGLEZ
// Slope rotation from Kart
p.anglez = 0.0f;
p.anglez2 = 0.0f;
// use secondary angles for the slope rotation
if (spr->mobj->standingslope)
{
fixed_t tempz = spr->mobj->standingslope->normal.z;
fixed_t tempy = spr->mobj->standingslope->normal.y;
fixed_t tempx = spr->mobj->standingslope->normal.x;
fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
p.anglez2 = FIXED_TO_FLOAT(tempangle);
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
p.anglex2 = FIXED_TO_FLOAT(tempangle);
}
else if ((spr->mobj->sloperoll || spr->mobj->slopepitch) && (!P_IsObjectOnGround(spr->mobj)) && (!paused))
{
SINT8 flipfactor = flip ? -1 : 1;
angle_t camang = R_PointToAngle(interp.x, interp.y);
angle_t mobjang;
if (spr->mobj->flags & (MF_NOTHINK|MF_SCENERY))
mobjang = spr->mobj->angle;
else
mobjang = interp.angle;
angle_t fmoang;
fmoang = camang - mobjang;
// slopepitch
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
p.anglez -= flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
// sloperoll
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
p.anglez += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
p.roll = true;
}
// slope pitch and roll
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.sloperoll));
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.slopepitch));
// pitch and roll
if (interp.roll || interp.pitch)
{
SINT8 flipfactor = flip ? -1 : 1;
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.roll));
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.pitch));
p.roll = true;
}
#endif
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.roll));
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.pitch));
p.flip = atransform.flip;
#ifdef USE_FTRANSFORM_MIRROR
p.mirror = atransform.mirror; // from Kart
#endif
HWD.pfnSetShader(SHADER_MODEL); // model shader
GL_SetShader(SHADER_MODEL); // model shader
{
SINT8 flipfactor = flip ? -1 : 1;
float this_scale = FIXED_TO_FLOAT(interp.scale);
float xs = this_scale * FIXED_TO_FLOAT(interp.spritexscale);
@@ -1477,11 +1443,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
// offset perpendicular to the camera angle
p.x -= ox * gr_viewsin;
p.y += ox * gr_viewcos;
p.x -= ox * gl_viewsin;
p.y += ox * gl_viewcos;
p.z += oy;
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
GL_DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
}
}
}
+4 -4
View File
@@ -28,8 +28,8 @@ typedef struct
float scale;
float offset;
model_t *model;
void *grpatch;
void *blendgrpatch;
void *glpatch;
void *blendglpatch;
boolean notfound;
INT32 skin;
boolean error;
@@ -37,10 +37,10 @@ typedef struct
extern md2_t md2_models[NUMSPRITES];
extern md2_t md2_playermodels[MAXSKINS];
extern md2_t md2_localplayermodels[MAXSKINS];
extern md2_t md2_localplayermodels[MAXLOCALSKINS];
void HWR_InitMD2(void);
void HWR_DrawMD2(gr_vissprite_t *spr);
void HWR_DrawMD2(gl_vissprite_t *spr);
void HWR_AddPlayerMD2(INT32 skin, boolean local);
void HWR_AddSpriteMD2(size_t spritenum);
+231
View File
@@ -0,0 +1,231 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1996 by id Software, Inc.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_portal.c
/// \brief OpenGL renderer portals.
// ==========================================================================
// Visual portals (attr. Hannu Hanhi)
// ==========================================================================
#ifdef HWRENDER
#include "../r_portal.h"
#include "../z_zone.h"
#include "hw_clip.h"
#include "hw_gl.h"
#include "hw_defs.h"
#include "hw_main.h"
#include "hw_portal.h"
SINT8 gl_portal_state = GLPORTAL_OFF;
gl_portallist_t *currentportallist;
// clip the area outside the portal destination window
void HWR_PortalClipping(gl_portal_t *portal)
{
gld_clipper_SafeAddClipRange(portal->angle1, portal->angle2);
}
static gl_portal_t* HWR_Portal_Add (seg_t *seg)
{
gl_portal_t *portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
// Linked list.
if (!currentportallist->base)
{
currentportallist->base = portal;
currentportallist->cap = portal;
}
else
{
currentportallist->cap->next = portal;
currentportallist->cap = portal;
}
portal->next = NULL;
portal->seg = seg;
return portal;
}
void HWR_FreePortalList(gl_portallist_t freelist)
{
portalcullsector = NULL;
// free memory from portal list allocated by calls to Add2Lines
gl_portal_t *gl_portal_temp = freelist.base;
while (gl_portal_temp)
{
gl_portal_t *nextportal = gl_portal_temp->next;
Z_Free(gl_portal_temp);
gl_portal_temp = nextportal;
}
}
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
{
gl_portal_t *portal = HWR_Portal_Add(seg);
// Offset the portal view by the linedef centers
line_t* start = &lines[line1];
line_t* dest = &lines[line2];
angle_t dangle = R_PointToAngle2(0, 0, dest->dx, dest->dy) - R_PointToAngle2(start->dx, start->dy, 0, 0);
fixed_t disttopoint;
angle_t angtopoint;
vertex_t dest_c, start_c;
// looking glass center
start_c.x = start->v1->x/2 + start->v2->x/2;
start_c.y = start->v1->y/2 + start->v2->y/2;
// other side center
dest_c.x = dest->v1->x/2 + dest->v2->x/2;
dest_c.y = dest->v1->y/2 + dest->v2->y/2;
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
angtopoint += dangle;
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
portal->viewangle = viewangle + dangle;
portal->angle1 = R_PointToAngle64(seg->v1->x, seg->v1->y) + dangle;
portal->angle2 = R_PointToAngle64(seg->v2->x, seg->v2->y) + dangle;
portal->clipline = line2;
}
void HWR_PortalFrame(gl_portal_t* portal)
{
viewx = portal->viewx;
viewy = portal->viewy;
viewz = portal->viewz;
viewangle = portal->viewangle;
//viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
//viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
if (portal->clipline != -1)
{
portalclipline = &lines[portal->clipline];
portalcullsector = portalclipline->frontsector;
viewsector = portalclipline->frontsector;
}
else
{
portalclipline = NULL;
portalcullsector = NULL;
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
}
// Renders a portal segment.
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
{
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
// set our portal state and prepare to render the seg
HWR_SetPortalState(state);
gl_curline = portal->seg;
gl_frontsector = portal->seg->frontsector;
gl_backsector = portal->seg->backsector;
HWR_ProcessSeg();
gl_drawing_stencil = false;
// need to work around the r_opengl PF_Invisible bug with this call
// similarly as in the linkdraw hack in HWR_DrawSprites
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
}
// Renders a single portal from the current viewpoint.
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
{
// draw portal seg to stencil buffer with increment
HWR_SetTransform(fpov);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// go to portal frame lmao
HWR_PortalFrame(portal);
// call HWR_RenderViewpoint
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
// return to current frame
if (rootportal)
HWR_PortalFrame(rootportal);
else // current frame is not a portal frame but the main view!
{
R_SetupFrame(viewssnum, false);
portalclipline = NULL;
}
// remove portal seg from stencil buffer
HWR_SetTransform(fpov);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// draw portal seg to depth buffer
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_DEPTH);
}
// returns true if the point is on the correct (viewable) side of the
// portal destination line
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y)
{
// we are checking if the point is on the viewable side of the portal exit.
// being exactly on the portal exit line is not enough to pass the test.
// P_PointOnLineSide could behave differently from this expectation on this case,
// so first check if the point is precisely on the line, and then if not, check the side.
vertex_t closest_point;
P_ClosestPointOnLine(x, y, portalclipline, &closest_point);
if (closest_point.x != x || closest_point.y != y)
{
if (P_PointOnLineSide(x, y, portalclipline) != 1)
return true;
}
return false;
}
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
{
if (!portalclipline)
return true;
if (HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]))
{
return true;
}
// we did not find any reason to pass the check, so return failure
return false;
}
#endif
+81
View File
@@ -0,0 +1,81 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_portal.h
/// \brief OpenGL renderer portal struct, functions, linked list extern.
#ifndef __HW_PORTAL__
#define __HW_PORTAL__
#ifdef HWRENDER
#include "../doomstat.h"
#include "../r_data.h"
#include "../r_bsp.h"
/** Portal structure.
*/
enum
{
GLPORTAL_OFF,
GLPORTAL_SEARCH,
GLPORTAL_STENCIL,
GLPORTAL_DEPTH,
GLPORTAL_INSIDE,
};
typedef struct gl_portal_s
{
struct gl_portal_s *next;
// Viewport.
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
seg_t *seg; // seg that is used for drawing to the stencil buffer
INT32 clipline; // Optional clipline for line-based portals
// angles for the left and right edges of the portal
// relative to the viewpoint
angle_t angle1;
angle_t angle2;
} gl_portal_t;
typedef struct gl_portallist_s
{
gl_portal_t *base;
gl_portal_t *cap;
} gl_portallist_t;
extern SINT8 gl_portal_state;
// new thing
extern gl_portallist_t *currentportallist;
static inline void HWR_SetPortalState (SINT8 state)
{
gl_portal_state = state;
}
// Adds an entry to the clipper for portal rendering
void HWR_PortalClipping(gl_portal_t *portal);
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg);
void HWR_PortalFrame(gl_portal_t* portal);
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level);
void HWR_FreePortalList(gl_portallist_t portallist);
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord);
#endif
#endif
+139 -28
View File
@@ -13,7 +13,7 @@
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "hw_shaders.h"
#include "../z_zone.h"
@@ -25,13 +25,10 @@ static struct {
const char *vertex;
const char *fragment;
} const gl_shadersources[] = {
// Floor shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
// Shadow shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_SHADOW_FRAGMENT_SHADER},
// Wall shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
@@ -39,7 +36,7 @@ static struct {
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
// Model shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
{GLSL_MODEL_LIGHTING_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
// Water shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WATER_FRAGMENT_SHADER},
@@ -52,7 +49,7 @@ static struct {
// Palette postprocess shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_PALETTE_POSTPROCESS_FRAGMENT_SHADER},
// UI colormap fade shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_FRAGMENT_SHADER},
@@ -82,6 +79,7 @@ static shadertarget_t gl_shadertargets[NUMSHADERTARGETS];
#define WHITESPACE_CHARS " \t"
#define PALETTE_RENDERING_DEFINE "#define SRB2_PALETTE_RENDERING"
#define LIGHT_DITHERING_DEFINE "#define SRB2_LIGHT_DITHER"
// Initialize shader variables and the backend's shader system. Load the base shaders.
// Returns false if shaders cannot be used.
@@ -89,7 +87,7 @@ boolean HWR_InitShaders(void)
{
int i;
if (!HWD.pfnInitShaders())
if (!GL_InitShaders())
return false;
for (i = 0; i < NUMSHADERTARGETS; i++)
@@ -278,10 +276,13 @@ static char *HWR_PreprocessShader(char *original)
// Calculate length of modified shader.
new_len = original_len;
if (cv_grpaletterendering.value)
if (cv_glpaletterendering.value)
ADD_TO_LEN(PALETTE_RENDERING_DEFINE)
if (cv_gllightdither.value)
ADD_TO_LEN(LIGHT_DITHERING_DEFINE)
#undef ADD_TO_LEN
#define VERSION_PART "#version "
@@ -320,9 +321,12 @@ static char *HWR_PreprocessShader(char *original)
}
// Write the defines.
if (cv_grpaletterendering.value)
if (cv_glpaletterendering.value)
WRITE_DEFINE(PALETTE_RENDERING_DEFINE)
if (cv_gllightdither.value)
WRITE_DEFINE(LIGHT_DITHERING_DEFINE)
#undef WRITE_DEFINE
// Write a #line directive, so compiler errors will report line numbers from the
@@ -362,16 +366,16 @@ static void HWR_CompileShader(int index)
{
char *preprocessed = HWR_PreprocessShader(vertex_source);
if (!preprocessed) return;
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
}
if (fragment_source)
{
char *preprocessed = HWR_PreprocessShader(fragment_source);
if (!preprocessed) return;
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
}
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
gl_shaders[index].compiled = GL_CompileShader(index);
}
// compile or recompile shaders
@@ -396,17 +400,18 @@ void HWR_CompileShaders(void)
int HWR_GetShaderFromTarget(int shader_target)
{
int custom_shader = gl_shadertargets[shader_target].custom_shader;
// use custom shader if following are true
// - custom shader exists
// - custom shader has been compiled successfully
// - custom shaders are enabled
// - custom shaders are allowed by the server
if (custom_shader != -1 && gl_shaders[custom_shader].compiled &&
cv_grshaders.value == 1)
return custom_shader;
else
return gl_shadertargets[shader_target].base_shader;
if (cv_glshaders.value == 1)
{
int custom_shader = gl_shadertargets[shader_target].custom_shader;
// use custom shader if following are true
// - custom shader exists
// - custom shader has been compiled successfully
// - custom shaders are enabled
if (custom_shader != -1 && gl_shaders[custom_shader].compiled)
return custom_shader;
}
return gl_shadertargets[shader_target].base_shader;
}
static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
@@ -425,7 +430,6 @@ static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
customshaderxlat_t shaderxlat[] =
{
{"Flat", SHADER_FLOOR},
{"Shadow", SHADER_SHADOW},
{"WallTexture", SHADER_WALL},
{"Sprite", SHADER_SPRITE},
{"Model", SHADER_MODEL},
@@ -446,6 +450,106 @@ void HWR_LoadAllCustomShaders(void)
HWR_LoadCustomShadersFromFile(i, W_FileHasFolders(wadfiles[i]));
}
static const char version_directives[][14] = {
"#version 330\n",
"#version 150\n",
"#version 140\n",
"#version 130\n",
"#version 120\n",
"#version 110\n",
};
static boolean HWR_VersionDirectiveExists(const char* source)
{
return strncmp(source, "#version", 8) == 0;
}
static char* HWR_PrependVersionDirective(const char* source, UINT32 version_index)
{
const UINT32 version_len = sizeof(version_directives[version_index]) - 1;
const UINT32 source_len = strlen(source);
char* result = Z_Malloc(source_len + version_len + 1, PU_STATIC, NULL);
strcpy(result, version_directives[version_index]);
strcpy(result + version_len, source);
return result;
}
static void HWR_ReplaceVersionInplace(char* shader, UINT32 version_index)
{
shader[9] = version_directives[version_index][9];
shader[10] = version_directives[version_index][10];
shader[11] = version_directives[version_index][11];
}
static boolean HWR_CheckVersionDirectives(const char* vert, const char* frag)
{
return HWR_VersionDirectiveExists(vert) && HWR_VersionDirectiveExists(frag);
}
static void HWR_TryToCompileShaderWithImplicitVersion(INT32 shader_index, INT32 shaderxlat_id)
{
char* vert_shader = gl_shaders[shader_index].vertex;
char* frag_shader = gl_shaders[shader_index].fragment;
boolean vert_shader_version_exists = HWR_VersionDirectiveExists(vert_shader);
boolean frag_shader_version_exists = HWR_VersionDirectiveExists(frag_shader);
if (!vert_shader_version_exists)
CONS_Alert(CONS_WARNING, "HWR_LoadCustomShadersFromFile: vertex shader '%s' is missing a #version directive\n", HWR_GetShaderName(shaderxlat_id));
if (!frag_shader_version_exists)
CONS_Alert(CONS_WARNING, "HWR_LoadCustomShadersFromFile: fragment shader '%s' is missing a #version directive\n", HWR_GetShaderName(shaderxlat_id));
// try to compile as is
HWR_CompileShader(shader_index);
if (gl_shaders[shader_index].compiled)
return;
// try each version directive
for (UINT32 i = 0; i < sizeof(version_directives) / sizeof(version_directives[0]); ++i)
{
CONS_Alert(CONS_NOTICE, "HWR_TryToCompileShaderWithImplicitVersion: Trying %s\n", version_directives[i]);
if (!vert_shader_version_exists)
{
// first time reallocation would have to be made
if (i == 0)
{
void* old = (void*)gl_shaders[shader_index].vertex;
vert_shader = gl_shaders[shader_index].vertex = HWR_PrependVersionDirective(vert_shader, i);
Z_Free(old);
}
else
HWR_ReplaceVersionInplace(vert_shader, i);
}
if (!frag_shader_version_exists)
{
if (i == 0)
{
void* old = (void*)gl_shaders[shader_index].fragment;
frag_shader = gl_shaders[shader_index].fragment = HWR_PrependVersionDirective(frag_shader, i);
Z_Free(old);
}
else
HWR_ReplaceVersionInplace(frag_shader, i);
}
HWR_CompileShader(shader_index);
if (gl_shaders[shader_index].compiled)
{
CONS_Alert(CONS_NOTICE, "HWR_TryToCompileShaderWithImplicitVersion: Compiled with %s\n",
version_directives[i]);
CONS_Alert(CONS_WARNING, "Implicit GLSL version is used. Correct behavior is not guaranteed\n");
return;
}
}
}
void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
{
UINT16 lump;
@@ -458,7 +562,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
int i;
boolean modified_shaders[NUMSHADERTARGETS] = {0};
if (!gr_shadersavailable)
if (!gl_shadersavailable)
return;
lump = HWR_FindShaderDefs(wadnum);
@@ -602,13 +706,20 @@ skip_field:
{
int shader_index = i + NUMSHADERTARGETS; // index to gl_shaders
gl_shadertargets[i].custom_shader = shader_index;
// if only one stage (vertex/fragment) is defined, the other one
// is copied from the base shaders.
if (!gl_shaders[shader_index].fragment)
gl_shaders[shader_index].fragment = Z_StrDup(gl_shadersources[i].fragment);
if (!gl_shaders[shader_index].vertex)
gl_shaders[shader_index].vertex = Z_StrDup(gl_shadersources[i].vertex);
HWR_CompileShader(shader_index);
if (!HWR_CheckVersionDirectives(gl_shaders[shader_index].vertex, gl_shaders[shader_index].fragment))
HWR_TryToCompileShaderWithImplicitVersion(shader_index, i);
else
HWR_CompileShader(shader_index);
if (!gl_shaders[shader_index].compiled)
CONS_Alert(CONS_ERROR, "HWR_LoadCustomShadersFromFile: A compilation error occured for the %s shader in file %s. See the console messages above for more information.\n", shaderxlat[i].type, wadfiles[wadnum]->filename);
}
+80 -9
View File
@@ -31,6 +31,31 @@
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
"}\0"
// reinterpretation of sprite lighting for models
// it's a combination of how it works for normal sprites & papersprites
#define GLSL_MODEL_LIGHTING_VERTEX_SHADER \
"uniform float lighting;\n" \
"uniform vec3 light_dir;\n" \
"uniform float light_contrast;\n" \
"uniform float light_backlight;\n" \
"void main()\n" \
"{\n" \
"gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n" \
"float light = lighting;\n" \
"if (length(light_dir) > 0.000001) {\n" \
"mat4 m4 = gl_ProjectionMatrix * gl_ModelViewMatrix;\n" \
"mat3 m3 = mat3( m4[0].xyz, m4[1].xyz, m4[2].xyz );\n" \
"float extralight = -dot(normalize(gl_Normal * m3), normalize(light_dir));\n" \
"extralight *= light_contrast - light_backlight;\n" \
"extralight *= lighting / 255.0;\n" \
"light += extralight * 2.5;\n" \
"}\n" \
"light = clamp(light / 255.0, 0.0, 1.0);\n" \
"gl_FrontColor = vec4(light, light, light, 1.0);\n" \
"gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n" \
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
"}\0"
// ==================
// Fragment shaders
// ==================
@@ -51,16 +76,55 @@
//
// Include GLSL_FLOOR_FUDGES or GLSL_WALL_FUDGES or define the fudges in shaders that use this macro.
#define GLSL_DOOM_COLORMAP_DITHER \
"float baseValue = max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
"float endResolutionx = scr_resolution.x;\n" \
"float endResolutiony = scr_resolution.y;\n" \
"if (scr_resolution.x > 1280.0) {\n" \
"endResolutionx = scr_resolution.x * 0.5;\n" \
"}\n" \
"if (scr_resolution.y > 720.0) {\n" \
"endResolutiony = scr_resolution.y * 0.5;\n" \
"}\n" \
"float zFactor = clamp((z - 192.0) / (6144.0 - 192.0), 0.0, 1.0);\n" \
"int scaleFactor = int(mix(1.0, 8.0, zFactor));\n" \
"endResolutionx = endResolutionx * scaleFactor;\n" \
"endResolutiony = endResolutiony * scaleFactor;\n" \
"vec2 normalizedPosition = position * vec2(endResolutionx / scr_resolution.x, endResolutiony / scr_resolution.y);\n" \
"int x = int(mod(normalizedPosition.x, 4.0));\n" \
"int y = int(mod(normalizedPosition.y, 4.0));\n" \
"float bayerMatrix[4*4] = float[4*4](\n" \
"0.0, 8.0, 2.0, 10.0,\n" \
"12.0, 4.0, 14.0, 6.0,\n" \
"3.0, 11.0, 1.0, 9.0,\n" \
"15.0, 7.0, 13.0, 5.0\n" \
");\n" \
"#ifdef SRB2_PALETTE_RENDERING\n" \
"float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 11.0);\n" \
"#else\n" \
"float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 16.0);\n" \
"#endif\n" \
"return mix(baseValue + threshold - 0.5 / 16.0, baseValue, zFactor);\n"
#define GLSL_DOOM_COLORMAP_NODITHER \
"return max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
#define GLSL_DOOM_COLORMAP \
"float R_DoomColormap(float light, float z)\n" \
"uniform vec2 scr_resolution;\n" \
"float R_DoomColormap(float light, float z, vec2 position)\n" \
"{\n" \
"float lightnum = clamp(light / 17.0, 0.0, 15.0);\n" \
"float lightz = clamp(z / 16.0, 0.0, 127.0);\n" \
"float startmap = (15.0 - lightnum) * 4.0;\n" \
"float scale = 160.0 / (lightz + 1.0);\n" \
"float cap = (155.0 - light) * 0.26;\n" \
"return max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \
"#ifdef SRB2_LIGHT_DITHER\n" \
GLSL_DOOM_COLORMAP_DITHER \
"#else\n" \
GLSL_DOOM_COLORMAP_NODITHER \
"#endif\n" \
"}\n"
// lighting cap adjustment:
// first num (155.0), increase to make it start to go dark sooner
// second num (0.26), increase to make it go dark faster
@@ -69,7 +133,7 @@
"float R_DoomLightingEquation(float light)\n" \
"{\n" \
"float z = gl_FragCoord.z / gl_FragCoord.w;\n" \
"float colormap = floor(R_DoomColormap(light, z)) + 0.5;\n" \
"float colormap = floor(R_DoomColormap(light, z, gl_FragCoord.xy)) + 0.5;\n" \
"return clamp(colormap, 0.0, 31.0) / 32.0;\n" \
"}\n"
@@ -95,7 +159,7 @@
#define GLSL_PALETTE_RENDERING \
"float tex_pal_idx = texture3D(palette_lookup_tex, vec3((texel * 63.0 + 0.5) / 64.0))[0] * 255.0;\n" \
"float z = gl_FragCoord.z / gl_FragCoord.w;\n" \
"float light_y = clamp(floor(R_DoomColormap(lighting, z)), 0.0, 31.0);\n" \
"float light_y = clamp(floor(R_DoomColormap(lighting, z, gl_FragCoord.xy)), 0.0, 31.0);\n" \
"vec2 lighttable_coord = vec2((tex_pal_idx + 0.5) / 256.0, (light_y + 0.5) / 32.0);\n" \
"vec4 final_color = texture2D(lighttable_tex, lighttable_coord);\n" \
"final_color.a = texel.a * poly_color.a;\n" \
@@ -133,7 +197,7 @@
"gl_FragColor = final_color;\n" \
"}\n" \
"#endif\0"
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
"uniform sampler2D tex;\n" \
"uniform vec4 poly_color;\n" \
@@ -164,16 +228,21 @@
"#define SCALE_FUDGE 2.2\n"
#define GLSL_FLOOR_FRAGMENT_SHADER \
"#version 120\n" \
GLSL_FLOOR_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER
// this is very backwards
// but we wanna have the game look like vanilla does
// oh well
#define GLSL_WALL_FRAGMENT_SHADER \
"#version 120\n" \
"#ifdef SRB2_PALETTE_RENDERING\n" \
GLSL_WALL_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER
#define GLSL_SHADOW_FRAGMENT_SHADER \
"#else\n" \
GLSL_FLOOR_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
"#endif\n" \
GLSL_SOFTWARE_FRAGMENT_SHADER
//
// Water surface shader
@@ -190,6 +259,7 @@
"vec4 texel = texture2D(tex, vec2(gl_TexCoord[0].s - sdistort, gl_TexCoord[0].t - cdistort));\n"
#define GLSL_WATER_FRAGMENT_SHADER \
"#version 120\n" \
GLSL_FLOOR_FUDGES \
"const float freq = 0.025;\n" \
"const float amp = 0.025;\n" \
@@ -238,6 +308,7 @@
// The floor fudges are used, but should the wall fudges be used instead? or something inbetween?
// or separate values for floors and walls? (need to change more than this shader for that)
#define GLSL_FOG_FRAGMENT_SHADER \
"#version 120\n" \
GLSL_FLOOR_FUDGES \
"uniform vec4 tint_color;\n" \
"uniform vec4 fade_color;\n" \
-123
View File
@@ -1,123 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2005 by SRB2 Jr. Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief 3D sound definitions
#ifndef __HWS_DATA_H__
#define __HWS_DATA_H__
#define NORMAL_SEP 128
// abuse?
#define STATIC_SOURCES_NUM 6 // Total number of static sources
#define MIN_DISTANCE 160.0f
#define MAX_DISTANCE 1200.0f
typedef struct source_pos_s
{
double x;
double y;
double z;
} source_pos_t;
typedef struct source3D_pos_s
{
float x;
float y;
float z;
//float angle;
float momx;
float momy;
float momz;
} source3D_pos_t;
enum {NORMAL_PITCH = 128};
/*typedef struct source2D_data_s
{
INT32 volume;
INT32 sep;
} source2D_data_t;*/
// General 3D sound source description
typedef struct source3D_data_s
{
float min_distance; //
float max_distance; //
INT32 head_relative; //
INT32 permanent; //
source3D_pos_t pos; // source position in 3D
} source3D_data_t;
// Sound data
typedef struct sfx_data_s
{
size_t length;
void *data;
INT32 priority;
INT32 sep; // Only when source is 2D sound
} sfx_data_t;
// Sound cone (for 3D sources)
typedef struct cone_def_s
{
float inner;
float outer;
INT32 outer_gain;
/*float f_angle;
float h_angle;*/
} cone_def_t;
typedef struct listener_data_s
{
// Listener position
double x;
double y;
double z;
// Listener front and head orientation (degrees)
double f_angle;
double h_angle;
// Listener momentums
double momx;
double momy;
double momz;
} listener_data_t;
typedef struct snddev_s
{
INT32 sample_rate;
INT32 bps;
size_t numsfxs;
// Windows specific data
#ifdef _WIN32
UINT32 cooplevel;
HWND hWnd;
#endif
} snddev_t;
#endif //__HWS_DATA_H__
+3 -22
View File
@@ -358,8 +358,8 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
else
textureformatGL = GL_RGB5_A1;
SetModelView(lvid->width, lvid->height);
SetStates();
GL_SetModelView(lvid->width, lvid->height);
GL_SetStates();
// we need to clear the depth buffer. Very important!!!
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
// -----------------+
// FinishUpdate : Swap front and back buffers
// -----------------+
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
void GL_FinishUpdate (INT32 waitvbl)
{
#ifdef USE_WGL_SWAP
static INT32 oldwaitvbl = 0;
@@ -547,23 +547,4 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
SwapBuffers(hDC);
}
// -----------------+
// SetPalette : Set the color lookup table for paletted textures
// : in OpenGL, we store values for conversion of paletted graphics when
// : they are downloaded to the 3D card.
// -----------------+
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
{
INT32 i;
for (i = 0; i < 256; i++)
{
myPaletteData[i].s.red = pal[i].s.red;
myPaletteData[i].s.green = pal[i].s.green;
myPaletteData[i].s.blue = pal[i].s.blue;
myPaletteData[i].s.alpha = pal[i].s.alpha;
}
}
#endif
File diff suppressed because it is too large. Load diff
+14 -17
View File
@@ -43,8 +43,9 @@
#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows
#include "../../doomdef.h"
#include "../hw_drv.h"
#include "../hw_gl.h"
#include "../../z_zone.h"
// ==========================================================================
@@ -65,14 +66,15 @@ extern FILE *gllogstream;
// PROTOS
// ==========================================================================
boolean LoadGL(void);
FUNCPRINTF void GL_DBG_Printf(const char *format, ...);
void *GetGLFunc(const char *proc);
boolean SetupGLfunc(void);
void SetupGLFunc4(void);
void Flush(void);
INT32 isExtAvailable(const char *extension, const GLubyte *start);
void SetModelView(GLint w, GLint h);
void SetStates(void);
void GL_Flush(void);
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start);
void GL_SetModelView(GLint w, GLint h);
void GL_SetStates(void);
#ifndef GL_EXT_texture_filter_anisotropic
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
@@ -98,21 +100,14 @@ typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
extern PFNglGetIntegerv pglGetIntegerv;
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
extern PFNglGetString pglGetString;
#if 0
typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap); // redefined in r_opengl.c
static PFNglEnableClientState pglEnableClientState;
#endif
#endif
#ifdef USE_FBO_OGL
void GLFramebuffer_Generate(void);
void GLFramebuffer_Delete(void);
void GL_Framebuffer_DeleteAttachments(void);
void GLFramebuffer_GenerateAttachments(void);
void GLFramebuffer_DeleteAttachments(void);
void GLFramebuffer_Enable(void);
void GLFramebuffer_Disable(void);
void GL_Framebuffer_Unbind(void);
void GL_Framebuffer_Enable(void);
void GL_Framebuffer_Disable(void);
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
@@ -126,6 +121,8 @@ extern boolean supportFBO;
extern const GLubyte *gl_version;
extern const GLubyte *gl_renderer;
extern const GLubyte *gl_extensions;
extern const GLubyte *gl_vendor;
extern GLuint gl_num_extensions;
extern int majorGL, minorGL;
File diff suppressed because it is too large. Load diff
-59
View File
@@ -1,59 +0,0 @@
[Project]
FileName=s_ds3d.dev
Name=s_ds3d
Ver=1
IsCpp=1
Type=3
Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-Os_@@_-fno-strict-aliasing_@@_-fomit-frame-pointer_@@_
CppCompiler=
Includes=
Linker=--def ../s_mingw.def_@@_-luuid_@@_-ldsound_@@_
Libs=
UnitCount=1
Folders=
ObjFiles=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Icon=
ExeOutput=C:\srb2demo2
ObjectOutput=..\..\..\objs\Mingw\s_ds3d
OverrideOutput=1
OverrideOutputName=s_ds3d.dll
HostApplication=
CommandLine=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=00000000000000000111d0
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=s_ds3d.c
Folder=
Compile=1
CompileCpp=0
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=0.1
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=s_ds3d.exe
ProductName=s_ds3d
ProductVersion=0.1
AutoIncBuildNr=0
-99
View File
@@ -1,99 +0,0 @@
# Microsoft Developer Studio Project File - Name="s_ds3d" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=s_ds3d - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "s_ds3d.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "s_ds3d.mak" CFG="s_ds3d - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "s_ds3d - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "s_ds3d - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "s_ds3d - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\bin\VC\Release\s_ds3d"
# PROP Intermediate_Dir "..\..\..\objs\VC\Release\s_ds3d"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_DS3D_EXPORTS" /YX /FD /c
# ADD CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 dsound.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\s_ds3d.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\s_ds3d.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "s_ds3d - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\bin\VC\Debug\s_ds3d"
# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\s_ds3d"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_DS3D_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 dsound.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\s_ds3d.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\s_ds3d.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none /incremental:no /nodefaultlib
!ENDIF
# Begin Target
# Name "s_ds3d - Win32 Release"
# Name "s_ds3d - Win32 Debug"
# Begin Source File
SOURCE=.\s_ds3d.c
# End Source File
# End Target
# End Project
File diff suppressed because it is too large. Load diff
-59
View File
@@ -1,59 +0,0 @@
[Project]
FileName=s_fmod.dev
Name=s_fmod
Ver=1
IsCpp=1
Type=3
Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-Os_@@_-fomit-frame-pointer_@@_
CppCompiler=
Includes=..\..\win32\FMOD
Linker=--def ../s_mingw.def_@@_-lfmod_@@_
Libs=..\..\win32\FMOD
UnitCount=1
Folders=
ObjFiles=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Icon=
ExeOutput=C:\srb2demo2
ObjectOutput=..\..\..\objs\Mingw\s_fmod
OverrideOutput=1
OverrideOutputName=s_fmod.dll
HostApplication=
CommandLine=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=00000000000000000111d0
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=s_fmod.c
Folder=
Compile=1
CompileCpp=0
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=1
Minor=0
Release=8
Build=42
LanguageID=1033
CharsetID=1252
CompanyName=Alam Arias
FileVersion=1.42
FileDescription=SRB2 Sound API DLL for FMOD
InternalName=Super FMOD!
LegalCopyright=
LegalTrademarks=
OriginalFilename=s_fmod.dll
ProductName=s_fmod
ProductVersion=0.1
AutoIncBuildNr=0
-97
View File
@@ -1,97 +0,0 @@
# Microsoft Developer Studio Project File - Name="s_fmod" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=s_fmod - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "s_fmod.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "s_fmod.mak" CFG="s_fmod - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "s_fmod - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "s_fmod - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "s_fmod - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\bin\VC\Release\s_fmod"
# PROP Intermediate_Dir "..\..\..\objs\VC\Release\s_fmod"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_FMOD_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 fmodvc.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\s_fmod.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\s_fmod.dll"
!ELSEIF "$(CFG)" == "s_fmod - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\bin\VC\Debug\s_fmod"
# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\s_fmod"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_FMOD_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 fmodvc.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\s_fmod.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\s_fmod.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "s_fmod - Win32 Release"
# Name "s_fmod - Win32 Debug"
# Begin Source File
SOURCE=.\s_fmod.c
# End Source File
# End Target
# End Project
-998
View File
@@ -1,998 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2001 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief General driver for 3D sound system
///
/// Implementend via OpenAL API
#ifdef _WINDOWS
//#define WIN32_LEAN_AND_MEAN
#define RPC_NO_WINDOWS_H
#include <windows.h>
#include <stdio.h>
FILE* logstream = NULL;
#else
#include <stdarg.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#ifndef HAVE_SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
FILE* logstream = NULL;
#endif
#endif
#ifdef __APPLE__
#include <al.h> //Main AL
#include <alc.h> //Helpers
#else
#include <AL/al.h> //Main AL
#include <AL/alc.h> //Helpers
#endif
#define _CREATE_DLL_
#include "../../doomdef.h"
#include "../hw3dsdrv.h"
//#undef DEBUG_TO_FILE
//#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
#define DEBUG_TO_FILE
//#endif
// Internal sound stack
typedef struct stack_snd_s
{
ALuint ALsource;// 3D data of 3D source
ALint sfx_id;// Currently unused
ALint LRU;// Currently unused
ALboolean permanent;// Flag of static source
} stack_snd_t;
#ifndef AL_INVALID
#define AL_INVALID (-1)
#endif
static I_Error_t I_ErrorOpenAl = NULL;
static stack_snd_t *ALstack = NULL; // Sound stack
static ALsizei allocated_sounds = 0; // Size of stack
static ALsizei allocate_delta = 16;
static ALCdevice *ALCDevice = NULL;
static ALCcontext *ALContext = NULL;
static ALenum ALo_Lasterror = AL_NO_ERROR;
static ALenum ALCo_Lasterror = ALC_NO_ERROR;
static ALenum ALo_GetError(ALvoid)
{
ALo_Lasterror = alGetError();
return ALo_Lasterror;
}
static ALenum ALCo_GetError(ALvoid)
{
ALCo_Lasterror = alcGetError(ALCDevice);
return ALCo_Lasterror;
}
static ALfloat ALvol(ALint vol, ALsizei step)
{
return ((ALfloat)vol)/(ALfloat)step;
}
/*
static ALfloat Alpitch(ALint pitch)
{
#if 1
pitch = NORMAL_PITCH;
#endif
return pitch < NORMAL_PITCH ?
(float)(pitch + NORMAL_PITCH) / (NORMAL_PITCH * 2)
:(float)pitch / (float)NORMAL_PITCH;
}
*/
static const ALchar *GetALErrorString(ALenum err)
{
switch (err)
{
case AL_NO_ERROR:
return "There no error";
break;
case AL_INVALID_NAME:
return "Invalid name";
break;
case AL_INVALID_ENUM:
return "Invalid enum";
break;
case AL_INVALID_VALUE:
return "Invalid value";
break;
case AL_INVALID_OPERATION:
return "Invalid operation";
break;
case AL_OUT_OF_MEMORY:
return "Out Of Memory";
break;
default:
return alGetString(err);
break;
}
}
static const ALchar *GetALCErrorString(ALenum err)
{
switch (err)
{
case ALC_NO_ERROR:
return "There no error";
break;
case ALC_INVALID_DEVICE:
return "Invalid Device";
break;
case ALC_INVALID_CONTEXT:
return "Invalid Context";
break;
case ALC_INVALID_ENUM:
return "Invalid enum";
break;
case ALC_INVALID_VALUE:
return "Invalid value";
break;
case ALC_OUT_OF_MEMORY:
return "Out Of Memory";
break;
default:
return alcGetString(ALCDevice, err);
break;
}
}
/***************************************************************
*
* DBG_Printf
* Output error messages to debug log if DEBUG_TO_FILE is defined,
* else do nothing
*
**************************************************************
*/
// -----------------+
// DBG_Printf : Output error messages to debug log if DEBUG_TO_FILE is defined,
// : else do nothing
// Returns :
// -----------------+
FUNCPRINTF void DBG_Printf(const char *lpFmt, ... )
{
#ifdef DEBUG_TO_FILE
char str[4096] = "";
va_list arglist;
va_start(arglist, lpFmt);
vsnprintf(str, 4096, lpFmt, arglist);
va_end(arglist);
if (logstream)
fwrite(str, strlen(str), 1 , logstream);
#else
lpFmt = NULL;
#endif
}
/***************************************************************
*
* Grow internal sound stack by allocate_delta amount
*
***************************************************************
*/
static ALboolean reallocate_stack(void)
{
stack_snd_t *new_stack;
if (ALstack)
new_stack = realloc(ALstack, sizeof (stack_snd_t) * (allocated_sounds + allocate_delta));
else
new_stack = malloc(sizeof (stack_snd_t) * (allocate_delta));
if (new_stack)
{
ALsizei clean_stack;
ALstack = new_stack;
memset(&ALstack[allocated_sounds], 0, allocate_delta * sizeof (stack_snd_t));
for (clean_stack = allocated_sounds; clean_stack < allocated_sounds; clean_stack++)
ALstack[clean_stack].ALsource = (ALuint)AL_INVALID;
allocated_sounds += allocate_delta;
return AL_TRUE;
}
return AL_FALSE;
}
/***************************************************************
*
* Destroys source in stack
*
***************************************************************
*/
static ALvoid kill_sound(stack_snd_t *snd)
{
if (alIsSource(snd->ALsource))
alDeleteSources(1,&snd->ALsource);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alDeleteSources, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
memset(snd,0, sizeof (stack_snd_t));
snd->ALsource = (ALuint)AL_INVALID;
}
/***************************************************************
*
* Returns free (unused) source stack slot
* If none available sound stack will be increased
*
***************************************************************
*/
static ALsizei find_handle(void)
{
ALsizei free_sfx = 0;
stack_snd_t *snd;
for (snd = ALstack; free_sfx < allocated_sounds; snd++, free_sfx++)
{
if (snd->permanent)
continue;
if (snd->ALsource==(ALuint)AL_INVALID)
break;
if (!alIsSource(snd->ALsource))
break;
ALo_GetError();
if (snd->sfx_id == 0)
break;
}
// No suitable resource found so increase sound stack
//DBG_Printf("sfx chan %d\n", free_sfx);
if (free_sfx == allocated_sounds)
{
DBG_Printf("No free or same sfx found so increase stack (currently %d srcs)\n", allocated_sounds);
free_sfx = reallocate_stack() ? free_sfx : (ALsizei)AL_INVALID;
}
return free_sfx;
}
static ALvoid ALSetPan(ALuint sid, INT32 sep)
{
ALfloat facing[3] ={0.0f, 0.0f, 0.0f}; //Alam: bad?
const ALfloat fsep = (ALfloat)sep;
const ALfloat nsep = (ALfloat)NORMAL_SEP;
if (sep)
{
facing[0] = (ALfloat)(fsep/nsep);
facing[2] = 1.0f;
}
alSourcefv(sid, AL_POSITION, facing);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alSourcefv, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
/******************************************************************************
*
* Initialise driver and listener
*
*****************************************************************************/
EXPORT INT32 HWRAPI( Startup ) (I_Error_t FatalErrorFunction, snddev_t *snd_dev)
{
ALenum model = AL_INVERSE_DISTANCE_CLAMPED;
ALCboolean inited = ALC_FALSE;
ALCint AlSetup[8] = {ALC_FREQUENCY,22050,ALC_REFRESH,35,ALC_SYNC,AL_FALSE,ALC_INVALID,ALC_INVALID};
#if (defined (_WIN32) || defined (_WIN64)) && 0
const ALCubyte *ALCdriver = alcGetString(NULL,ALC_DEFAULT_DEVICE_SPECIFIER);
const ALCubyte *DSdriver = "DirectSound";
if (!strcmp((const ALCbyte *)ALCdriver,"DirectSound3D")) //Alam: OpenAL's DS3D is buggy
ALCDevice = alcOpenDevice(DSdriver); //Open DirectSound
else //Alam: The OpenAl device
ALCDevice = alcOpenDevice(ALCdriver); //Open Default
#else
ALCDevice = alcOpenDevice(alcGetString(NULL,ALC_DEFAULT_DEVICE_SPECIFIER));
#endif
if (ALCo_GetError() != ALC_NO_ERROR || !ALCDevice)
{
DBG_Printf("S_OpenAl: Error %s when opening device!\n", GetALCErrorString(ALCo_Lasterror));
return inited;
}
else
{
DBG_Printf("Driver Name : %s\n", alcGetString(ALCDevice,ALC_DEVICE_SPECIFIER));
DBG_Printf("Extensions : %s\n", alcGetString(ALCDevice,ALC_EXTENSIONS));
DBG_Printf("S_OpenAl: OpenAl Device %s opened\n",alcGetString(ALCDevice, ALC_DEVICE_SPECIFIER));
}
I_ErrorOpenAl = FatalErrorFunction;
AlSetup[1] = snd_dev->sample_rate; //ALC_FREQUENCY
AlSetup[1] = 44100;
AlSetup[3] = 35; //ALC_REFRESH
//Alam: The Environment?
ALContext = alcCreateContext(ALCDevice,AlSetup);
if (ALCo_GetError() != ALC_NO_ERROR || !ALContext)
{
DBG_Printf("S_OpenAl: Error %s when making the environment!\n",GetALCErrorString(ALCo_Lasterror));
return inited;
}
else
{
DBG_Printf("S_OpenAl: OpenAl environment made\n");
}
alcMakeContextCurrent(ALContext);
if (ALCo_GetError() != ALC_NO_ERROR)
{
DBG_Printf("S_OpenAl: Error %s when setting the environment!\n",GetALCErrorString(ALCo_Lasterror));
return inited;
}
else
{
DBG_Printf("S_OpenAl: OpenAl environment setted up\n");
}
DBG_Printf("Vendor : %s\n", alGetString(AL_VENDOR));
DBG_Printf("Renderer : %s\n", alGetString(AL_RENDERER));
DBG_Printf("Version : %s\n", alGetString(AL_VERSION));
DBG_Printf("Extensions : %s\n", alGetString(AL_EXTENSIONS));
alDopplerFactor(0.0f);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("S_OpenAl: Error %s when setting Doppler Factor!\n",GetALErrorString(ALo_Lasterror));
return inited;
}
else
{
DBG_Printf("S_OpenAl: Doppler Factor of %f setted\n", alGetDouble(AL_DOPPLER_FACTOR));
}
alSpeedOfSound(600.0f);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("S_OpenAl: Error %s when setting Speed of Sound!\n",GetALErrorString(ALo_Lasterror));
return inited;
}
else
{
DBG_Printf("S_OpenAl: Speed of Sound set to %f\n", alGetDouble(AL_SPEED_OF_SOUND));
}
alDistanceModel(model);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("S_OpenAl: Error %s when setting Distance Model!\n",GetALErrorString(ALo_Lasterror));
return inited;
}
else
{
//DBG_Printf("S_OpenAl: %s mode setted\n",alGetString(model));
}
inited = reallocate_stack();
return inited;
}
/******************************************************************************
*
* Shutdown 3D Sound
*
******************************************************************************/
EXPORT void HWRAPI( Shutdown ) ( void )
{
ALsizei i;
DBG_Printf ("S_OpenAL Shutdown()\n");
for (i = 0; i < allocated_sounds; i++)
{
StopSource(i);
kill_sound(ALstack + i);
}
#if defined(linux) || defined(__linux) || defined(__linux__)
alcMakeContextCurrent(NULL);
//TODO:check?
#endif
if (ALContext)
{
alcDestroyContext(ALContext);
ALContext = NULL;
}
if (ALstack)
{
free(ALstack);
ALstack = NULL;
}
//TODO:check?
if (ALCDevice)
{
alcCloseDevice(ALCDevice);
ALCDevice = NULL;
}
//TODO:check?
}
#ifdef _MSC_VER
#pragma warning(disable : 4200)
#pragma pack(1)
#endif
typedef struct
{
ALushort header; // 3?
ALushort samplerate; // 11025+
ALushort samples; // number of samples
ALushort dummy; // 0
ALubyte data[0]; // data;
} ATTRPACK dssfx_t;
#ifdef _MSC_VER
#pragma pack()
#pragma warning(default : 4200)
#endif
static ALsizei getfreq(ALvoid *sfxdata, size_t len)
{
dssfx_t *dsfx = sfxdata;
const ALsizei freq = SHORT(dsfx->samplerate);
if (len <= 8)
return 0;
else
return freq;
}
static ALsizei makechan(ALuint sfxhandle, ALboolean perm)
{
ALsizei chan = find_handle();
if (chan == (ALsizei)AL_INVALID) return chan;
alGenSources(1, &ALstack[chan].ALsource);
if (ALo_GetError() != AL_NO_ERROR || !alIsSource(ALstack[chan].ALsource))
{
DBG_Printf("S_OpenAl: Error %s when make an ALSource!\n",GetALErrorString(ALo_Lasterror));
ALstack[chan].ALsource = (ALuint)AL_INVALID;
return (ALsizei)AL_INVALID;
}
ALstack[chan].permanent = perm;
alSourceQueueBuffers(ALstack[chan].ALsource, 1, &sfxhandle);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("S_OpenAl: Error %s when queue up an alSource!\n",GetALErrorString(ALo_Lasterror));
}
return chan;
}
/******************************************************************************
*
* Creates ?D source
*
******************************************************************************/
EXPORT INT32 HWRAPI ( AddSource ) (source3D_data_t *src, u_int sfxhandle)
{
ALsizei chan = makechan(sfxhandle, (ALboolean)(src?src->permanent:AL_FALSE));
ALuint sid = (ALuint)AL_INVALID;
if (chan == (ALsizei)AL_INVALID)
return AL_INVALID;
else
sid = ALstack[chan].ALsource;
if (src) //3D
{
#if 0
alSourcef(sid, AL_REFERENCE_DISTANCE, src->min_distance);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_REFERENCE_DISTANCE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alSourcef(sid, AL_MAX_DISTANCE, src->max_distance);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_MAX_DISTANCE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
#endif
if (src->head_relative)
alSourcei(sid, AL_SOURCE_RELATIVE, AL_TRUE);
else
alSourcei(sid, AL_SOURCE_RELATIVE, AL_FALSE);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_SOURCE_RELATIVE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alSource3f(sid, AL_POSITION, src->pos.x, src->pos.z, src->pos.y);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_POSITION, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alSource3f(sid, AL_VELOCITY, src->pos.momx, src->pos.momz, src->pos.momy);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_VELOCITY, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
else //2D
{
alSourcei(sid, AL_SOURCE_RELATIVE, AL_TRUE);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_SOURCE_RELATIVE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
alSourcef(sid, AL_ROLLOFF_FACTOR, 0.0f);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_ROLLOFF_FACTOR, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alSourcef(sid, AL_REFERENCE_DISTANCE, 0.0f);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_REFERENCE_DISTANC, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
return chan;
}
EXPORT INT32 HWRAPI ( StartSource ) (INT32 chan)
{
ALint state = AL_NONE;
ALuint sid = (ALuint)AL_INVALID;
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource))
return AL_FALSE;
else
sid = ALstack[chan].ALsource;
ALo_GetError();
alSourcePlay(sid);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alSourcePlay, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alGetSourcei(sid, AL_SOURCE_STATE, &state);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alGetSourcei, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
return (state == AL_PLAYING);
}
EXPORT void HWRAPI ( StopSource) (INT32 chan)
{
ALuint sfxhandle = AL_NONE;
ALuint sid = (ALuint)AL_INVALID;
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource))
return;
else
sid = ALstack[chan].ALsource;
ALo_GetError();
#if 1
alSourceQueueBuffers(sid, 1, &sfxhandle);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alSourceQueueBuffers, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
#else
alSourceStop(sid);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alSourceStop, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
#endif
}
EXPORT INT32 HWRAPI ( GetHW3DSVersion) (void)
{
return VERSION;
}
EXPORT void HWRAPI (BeginFrameUpdate) (void)
{
alcSuspendContext(ALContext);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alcSuspendContext, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
EXPORT void HWRAPI (EndFrameUpdate) (void)
{
alcProcessContext(ALContext);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alcProcessContext, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
EXPORT INT32 HWRAPI (IsPlaying) (INT32 chan)
{
ALint state = AL_NONE;
ALuint sid = (ALuint)AL_INVALID;
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource))
return AL_FALSE;
else
sid = ALstack[chan].ALsource;
ALo_GetError();
alGetSourcei(sid, AL_SOURCE_STATE, &state);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alGetSourcei, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
return (state == AL_PLAYING);
}
/******************************************************************************
* UpdateListener
*
* Set up main listener properties:
* - position
* - orientation
* - velocity
*****************************************************************************/
EXPORT void HWRAPI (UpdateListener) (listener_data_t *data, INT32 num)
{
if (num != 1) return;
if (data)
{
ALfloat facing[6];
ALdouble f_angle = 0.0;
if (data->f_angle) f_angle = (ALdouble)((data->f_angle) / 180.0l * M_PIl);
facing[0] = (ALfloat)cos(f_angle);
facing[1] = 0.0f;
facing[2] = (ALfloat)sin(f_angle);
facing[3] = 0.0f;
facing[4] = 1.0f;
facing[5] = 0.0f;
alListener3f(AL_POSITION,(ALfloat)-data->x,(ALfloat)data->z,(ALfloat)data->y);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_POSITIO, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alListener3f(AL_VELOCITY,(ALfloat)data->momx,(ALfloat)data->momz,(ALfloat)data->momy);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_VELOCITY, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alListenerfv(AL_ORIENTATION, facing);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_ORIENTATION, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
else
{
DBG_Printf("Error: 1st listener data is missing\n");
}
}
/******************************************************************************
*
* Update volume for 2D source and separation (panning) of 2D source
*
*****************************************************************************/
EXPORT void HWRAPI (UpdateSourceParms) (INT32 chan, INT32 vol, INT32 sep)
{
ALuint sid = AL_NONE;
ALint is2d = AL_FALSE;
if (chan > AL_INVALID && !alIsSource(ALstack[chan].ALsource))
return;
else
sid = ALstack[chan].ALsource;
alGetSourcei(sid, AL_SOURCE_RELATIVE, &is2d);
if (!is2d)
return;
if (vol != -1)
{
alSourcef(sid,AL_GAIN,ALvol(vol,256));
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: alSourcef, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
if (sep != -1)
{
ALSetPan(sid,sep-NORMAL_SEP);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: ALSetPan, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
}
// --------------------------------------------------------------------------
// Set the global volume for sound effects
// --------------------------------------------------------------------------
EXPORT void HWRAPI (SetGlobalSfxVolume) (INT32 vol)
{
alListenerf(AL_GAIN, ALvol(vol,32));
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_GAIN, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
//Alam: Not Used?
EXPORT INT32 HWRAPI (SetCone) (INT32 chan, cone_def_t *cone_def)
{
ALuint sid = AL_NONE;
ALint is2d = AL_FALSE;
if (chan > AL_INVALID && !alIsSource(ALstack[chan].ALsource))
return AL_FALSE;
else
sid = ALstack[chan].ALsource;
alGetSourcei(sid, AL_SOURCE_RELATIVE, &is2d);
if(is2d || !cone_def)
return AL_FALSE;
alSourcef(sid,AL_CONE_INNER_ANGLE,cone_def->inner);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_CONE_INNER_ANGLE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alSourcef(sid,AL_CONE_OUTER_ANGLE,cone_def->outer);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_CONE_OUTER_ANGL, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alSourcei(sid,AL_CONE_OUTER_GAIN, cone_def->outer_gain);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_CONE_OUTER_GAIN, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
return AL_TRUE;
}
EXPORT void HWRAPI (Update3DSource) (INT32 chan, source3D_pos_t *sfx)
{
ALuint sid = AL_NONE;
ALint is2d = AL_FALSE;
if (chan > AL_INVALID && !alIsSource(ALstack[chan].ALsource))
return;
else
sid = ALstack[chan].ALsource;
alGetSourcei(sid, AL_SOURCE_RELATIVE, &is2d);
if (is2d)
return;
alSource3f(sid, AL_POSITION, sfx->x, sfx->z, sfx->y);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_POSITION, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
alSource3f(sid, AL_VELOCITY, sfx->momx, sfx->momz, sfx->momy);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("%s: AL_VELOCITY, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
//-------------------------------------------------------------
// Load new sound data into source
//-------------------------------------------------------------
EXPORT INT32 HWRAPI (ReloadSource) (INT32 chan, u_int sfxhandle)
{
ALuint sid;
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource) || !alIsBuffer(sfxhandle))
return AL_INVALID;
else
sid = ALstack[chan].ALsource;
ALo_GetError();
alSourceQueueBuffers(sid, 1, &sfxhandle);
if (ALo_GetError() == AL_INVALID_OPERATION) //Alam: not needed?
{
alSourceStop(sid);
alSourcei(sid, AL_BUFFER, sfxhandle);
ALo_GetError();
}
if (ALo_Lasterror != AL_NO_ERROR)
{
DBG_Printf("%s: alSourcei, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
return chan;
}
/******************************************************************************
*
* Destroy source and remove it from stack if it is a 2D source.
* Otherwise put source into cache
*
*****************************************************************************/
EXPORT void HWRAPI (KillSource) (INT32 chan)
{
if (chan > AL_INVALID && (ALsizei)chan <= allocated_sounds)
kill_sound(ALstack + chan);
}
EXPORT u_int HWRAPI (AddSfx) (sfx_data_t *sfx)
{
ALuint chan = (ALuint)AL_INVALID;
ALsizei freq = 11025;
ALubyte *data = NULL;
ALsizei size = 0;
if (!sfx)
return 0;
else
{
data = ((ALubyte *)sfx->data)+8;
size = (ALsizei)(sfx->length-8);
}
alGenBuffers(1, &chan);
if (ALo_GetError() != AL_NO_ERROR || !alIsBuffer(chan))
{
DBG_Printf("S_OpenAl: Error %s when make an ALBuffer!\n",GetALErrorString(ALo_Lasterror));
return (u_int)AL_INVALID;
}
freq = getfreq(sfx->data, sfx->length);
alBufferData(chan, AL_FORMAT_MONO8, data, size, freq);
if (ALo_GetError() != AL_NO_ERROR)
{
DBG_Printf("S_OpenAl: Error %s when setting up a alBuffer!\n",GetALErrorString(ALo_Lasterror));
}
return chan;
}
EXPORT void HWRAPI (KillSfx) (u_int sfxhandle)
{
ALuint ALsfx = sfxhandle;
if (!alIsBuffer(ALsfx))
return;
alDeleteBuffers(1, &ALsfx);
if (ALo_GetError() == AL_INVALID_OPERATION)
{
// Buffer leak
}
else if (ALo_Lasterror != AL_NO_ERROR)
{
DBG_Printf("%s: alDeleteBuffers, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
}
}
EXPORT void HWRAPI (GetHW3DSTitle) (char *buf, size_t size)
{
strncpy(buf, "OpenAL", size);
}
#ifdef _WINDOWS
BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved) // reserved
{
// Perform actions based on the reason for calling.
UNREFERENCED_PARAMETER(lpvReserved);
switch ( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
#ifdef DEBUG_TO_FILE
logstream = fopen("s_openal.log", "wt");
if (logstream == NULL)
return FALSE;
#endif
DisableThreadLibraryCalls(hinstDLL);
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
#ifdef DEBUG_TO_FILE
if ( logstream)
{
fclose(logstream);
logstream = NULL;
}
#endif
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
#elif !defined (_WINDOWS)
// **************************************************************************
// FUNCTIONS
// **************************************************************************
EXPORT void _init()
{
#ifdef DEBUG_TO_FILE
logstream = fopen("s_openal.log", "w+");
#endif
}
EXPORT void _fini()
{
#ifdef DEBUG_TO_FILE
if (logstream)
fclose(logstream);
logstream = NULL;
#endif
}
#endif
-59
View File
@@ -1,59 +0,0 @@
[Project]
FileName=s_openal.dev
Name=s_openal
Ver=1
IsCpp=1
Type=3
Compiler=-D_M_IX86=500_@@_-Wall_@@_-fexceptions_@@_-D_WINDOWS_@@_
CppCompiler=
Includes=
Linker=--def ../s_mingw.def_@@_-lopenal32_@@_
Libs=
UnitCount=1
Folders=
ObjFiles=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Icon=
ExeOutput=..\..\..\bin
ObjectOutput=..\..\..\objs\Mingw\s_opengl
OverrideOutput=0
OverrideOutputName=s_openal.dll
HostApplication=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000010001001001001
[Unit1]
FileName=s_openal.c
Folder=
Compile=1
CompileCpp=0
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=0.1
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=s_openal.dll
ProductName=s_openal
ProductVersion=0.1
AutoIncBuildNr=0
-98
View File
@@ -1,98 +0,0 @@
# Microsoft Developer Studio Project File - Name="s_openal" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=s_openal - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "s_openal.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "s_openal.mak" CFG="s_openal - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "s_openal - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "s_openal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "s_openal - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\bin\VC\Release\s_openal"
# PROP Intermediate_Dir "..\..\..\objs\VC\Release\s_openal"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_OPENAL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /win32
# SUBTRACT MTL /mktyplib203
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 OpenAL32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\s_openal.pdb" /machine:I386 /out:"C:\srb2demo2\s_openal.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "s_openal - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\bin\VC\Debug\s_openal"
# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\s_openal"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_OPENAL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "_MBCS" /D "_USRDLL" /D "S_OPENAL_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 OpenAL32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\s_openal.pdb" /debug /machine:I386 /out:"C:\srb2demo2\s_openaldebug.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "s_openal - Win32 Release"
# Name "s_openal - Win32 Debug"
# Begin Source File
SOURCE=.\s_openal.c
# End Source File
# End Target
# End Project
+21 -16
View File
@@ -289,7 +289,7 @@ int
HMS_register (void)
{
struct HMS_buffer *hms;
int ok;
int okay;
char post[256];
@@ -316,23 +316,23 @@ HMS_register (void)
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
ok = HMS_do(hms);
okay = HMS_do(hms);
if (ok)
if (okay)
{
hms_server_token = strdup(strtok(hms->buffer, "\n"));
}
HMS_end(hms);
return ok;
return okay;
}
int
HMS_unlist (void)
{
struct HMS_buffer *hms;
int ok;
int okay;
hms = HMS_connect("servers/%s/unlist", hms_server_token);
@@ -342,19 +342,19 @@ HMS_unlist (void)
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
ok = HMS_do(hms);
okay = HMS_do(hms);
HMS_end(hms);
free(hms_server_token);
return ok;
return okay;
}
int
HMS_update (void)
{
struct HMS_buffer *hms;
int ok;
int okay;
char post[256];
@@ -376,10 +376,10 @@ HMS_update (void)
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
ok = HMS_do(hms);
okay = HMS_do(hms);
HMS_end(hms);
return ok;
return okay;
}
void
@@ -488,7 +488,7 @@ int
HMS_compare_mod_version (char *buffer, size_t buffer_size)
{
struct HMS_buffer *hms;
int ok;
int okay;
char *version;
char *version_name;
@@ -498,7 +498,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
if (! hms)
return 0;
ok = 0;
okay = 0;
if (HMS_do(hms))
{
@@ -510,16 +510,16 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
if (atoi(version) != MODVERSION)
{
strlcpy(buffer, version_name, buffer_size);
ok = 1;
okay = 1;
}
else
ok = -1;
okay = -1;
}
}
HMS_end(hms);
return ok;
return okay;
}
const char *
@@ -532,7 +532,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
if (! hms)
return NULL;
if (HMS_do(hms))
boolean okay = HMS_do(hms);
if (okay)
{
char *p = strstr(hms->buffer, "\n\n");
@@ -550,6 +552,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
HMS_end(hms);
if (!okay)
return NULL;
return buffer;
}
+268 -396
View File
@@ -26,6 +26,7 @@
#include "i_video.h"
#include "i_system.h"
#include "r_fps.h"
#include "st_stuff.h" // ST_HEIGHT
#include "r_local.h"
@@ -49,6 +50,8 @@
#include "s_sound.h" // song credits
#include "k_kart.h"
#include "m_textinput.h"
#ifdef HWRENDER
#include "hardware/hw_main.h"
#endif
@@ -67,7 +70,6 @@ patch_t *hu_font[HU_FONTSIZE];
patch_t *kart_font[KART_FONTSIZE]; // SRB2kart
patch_t *tny_font[HU_FONTSIZE];
patch_t *tallnum[10]; // 0-9
patch_t *nightsnum[10]; // 0-9
// Level title and credits fonts
patch_t *lt_font[LT_FONTSIZE];
@@ -86,8 +88,8 @@ patch_t *frameslash; // framerate stuff. Used in screen.c
static player_t *plr;
boolean chat_on; // entering a chat message?
static char w_chat[HU_MAXMSGLEN + 1];
static size_t c_input = 0; // let's try to make the chat input less shitty.
static char w_chat_buf[HU_MAXMSGLEN + 1];
static textinput_t w_chat;
static boolean headsupactive = false;
boolean hu_showscores; // draw rankings
static char hu_tick;
@@ -98,24 +100,8 @@ patch_t *rflagico;
patch_t *bflagico;
patch_t *rmatcico;
patch_t *bmatcico;
patch_t *tagico;
patch_t *tallminus;
//-------------------------------------------
// coop hud
//-------------------------------------------
patch_t *emeraldpics[7];
patch_t *tinyemeraldpics[7];
static patch_t *emblemicon;
static patch_t *tokenicon;
//-------------------------------------------
// misc vars
//-------------------------------------------
// crosshair 0 = off, 1 = cross, 2 = angle, 3 = point, see m_menu.c
static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics
// song credits
static patch_t *songcreditbg;
@@ -379,8 +365,6 @@ void HU_LoadGraphics(void)
{
sprintf(buffer, "STTNUM%d", i);
tallnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "NGTNUM%d", i);
nightsnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "PINGN%d", i);
pingnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "OPPRNK0%d", i);
@@ -390,32 +374,6 @@ void HU_LoadGraphics(void)
// minus for negative tallnums
tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX);
// cache the crosshairs, don't bother to know which one is being used,
// just cache all 3, they're so small anyway.
for (i = 0; i < HU_CROSSHAIRS; i++)
{
sprintf(buffer, "CROSHAI%c", '1'+i);
crosshair[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
emblemicon = W_CachePatchName("EMBLICON", PU_HUDGFX);
tokenicon = W_CachePatchName("TOKNICON", PU_HUDGFX);
emeraldpics[0] = W_CachePatchName("CHAOS1", PU_HUDGFX);
emeraldpics[1] = W_CachePatchName("CHAOS2", PU_HUDGFX);
emeraldpics[2] = W_CachePatchName("CHAOS3", PU_HUDGFX);
emeraldpics[3] = W_CachePatchName("CHAOS4", PU_HUDGFX);
emeraldpics[4] = W_CachePatchName("CHAOS5", PU_HUDGFX);
emeraldpics[5] = W_CachePatchName("CHAOS6", PU_HUDGFX);
emeraldpics[6] = W_CachePatchName("CHAOS7", PU_HUDGFX);
tinyemeraldpics[0] = W_CachePatchName("TEMER1", PU_HUDGFX);
tinyemeraldpics[1] = W_CachePatchName("TEMER2", PU_HUDGFX);
tinyemeraldpics[2] = W_CachePatchName("TEMER3", PU_HUDGFX);
tinyemeraldpics[3] = W_CachePatchName("TEMER4", PU_HUDGFX);
tinyemeraldpics[4] = W_CachePatchName("TEMER5", PU_HUDGFX);
tinyemeraldpics[5] = W_CachePatchName("TEMER6", PU_HUDGFX);
tinyemeraldpics[6] = W_CachePatchName("TEMER7", PU_HUDGFX);
songcreditbg = W_CachePatchName("K_SONGCR", PU_HUDGFX);
// cache ping gfx:
@@ -594,7 +552,10 @@ void HU_AddChatText(const char *text, boolean playsound)
if (OLDCHAT) // if we're using oldchat, print directly in console
CONS_Printf("%s\n", text);
else // if we aren't, still save the message to log.txt
CON_LogMessage(va("%s\n", text));
{
CON_LogMessage(text);
CON_LogMessage("\n"); // Add newline. Don't use va for that, since `text` might be refering to va's buffer itself
}
#else
(void)playsound;
CONS_Printf("%s\n", text);
@@ -998,7 +959,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
if (LUAh_PlayerMsg(playernum, target, flags, msg, spam_eatmsg))
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
return;
if (spam_eatmsg)
@@ -1140,71 +1101,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
#endif
}
// Handles key input and string input
//
static inline boolean HU_keyInChatString(char *s, char ch)
{
size_t l;
if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART])
|| ch == ' ') // Allow spaces, of course
{
l = strlen(s);
if (l < HU_MAXMSGLEN - 1)
{
if (c_input >= strlen(s)) // don't do anything complicated
{
s[l++] = ch;
s[l]=0;
}
else
{
// move everything past c_input for new characters:
size_t m = HU_MAXMSGLEN-1;
while (m>=c_input)
{
if (s[m])
s[m+1] = (s[m]);
if (m == 0) // prevent overflow
break;
m--;
}
s[c_input] = ch; // and replace this.
}
c_input++;
return true;
}
return false;
}
else if (ch == KEY_BACKSPACE)
{
size_t i = c_input;
if (c_input <= 0)
return false;
if (!s[i-1])
return false;
if (i >= strlen(s)-1)
{
s[strlen(s)-1] = 0;
c_input--;
return false;
}
for (; (i < HU_MAXMSGLEN); i++)
{
s[i-1] = s[i];
}
c_input--;
}
else if (ch != KEY_ENTER)
return false; // did not eat key
return true; // ate the key
}
#endif
//
@@ -1253,8 +1149,12 @@ void HU_Ticker(void)
if (cechotimer > 0) --cechotimer;
// Animate the desynch dots
if (hu_resynching)
resynch_ticker++; //tic tic tic tic tic
if (hu_resynching
#ifdef SATURNSYNCH
|| hu_redownloadinggamestate
#endif
)
resynch_ticker++; //tic tic tic tic tic
HU_TickSongCredits();
}
@@ -1273,9 +1173,9 @@ static boolean HU_clearChatSpaces(void)
char c; // current character we're iterating.
boolean nothingbutspaces = true;
for (; i < strlen(w_chat); i++) // iterate through message and eradicate all spaces that don't belong.
for (; i < strlen(w_chat_buf); i++) // iterate through message and eradicate all spaces that don't belong.
{
c = w_chat[i];
c = w_chat_buf[i];
if (!c)
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
@@ -1287,128 +1187,110 @@ static boolean HU_clearChatSpaces(void)
return nothingbutspaces;
}
//
//
static void HU_queueChatChar(INT32 c)
static void HU_SendChatMessage(void)
{
// send automaticly the message (no more chat char)
if (c == KEY_ENTER)
char buf[2 + HU_MAXMSGLEN + 1];
char *msg = &buf[2];
size_t ci = 2;
INT32 target = 0;
char c;
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
do {
c = w_chat_buf[-2+ci++];
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
buf[ci-1]=c;
} while (c);
M_TextInputClear(&w_chat);
// last minute mute check
if (CHAT_MUTE)
{
char buf[2 + HU_MAXMSGLEN + 1];
char *msg = &buf[2];
size_t i;
size_t ci = 2;
INT32 target = 0;
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
return;
}
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
{
INT32 spc = 1; // used if nodenum[1] is a space.
char *nodenum = (char*) malloc(3);
const char *newmsg;
do {
c = w_chat[-2+ci++];
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
buf[ci-1]=c;
} while (c);
i = 0;
for (;(i<HU_MAXMSGLEN);i++)
w_chat[i] = 0; // reset this.
// what we're gonna do now is check if the node exists
// with that logic, characters 4 and 5 are our numbers:
c_input = 0;
for (;(i<HU_MAXMSGLEN);i++)
w_chat[i] = 0; // reset this.
c_input = 0;
// last minute mute check
if (CHAT_MUTE)
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
if (teamtalk)
{
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
return;
}
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
memcpy(nodenum, msg+3, 2);
nodenum[2] = '\0';
// check for undesirable characters in our "number"
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
{
INT32 spc = 1; // used if nodenum[1] is a space.
char *nodenum = (char*) malloc(3);
const char *newmsg;
// what we're gonna do now is check if the node exists
// with that logic, characters 4 and 5 are our numbers:
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
if (teamtalk)
{
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
return;
}
memcpy(nodenum, msg+3, 2);
nodenum[2] = '\0';
// check for undesirable characters in our "number"
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
{
// check if nodenum[1] is a space
if (nodenum[1] == ' ')
spc = 0;
// let it slide
else
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return;
}
}
// I'm very bad at C, I swear I am, additional checks eww!
if (spc != 0)
{
if (msg[5] != ' ')
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return;
}
}
target = atoi((const char*) nodenum); // turn that into a number
free(nodenum);
//CONS_Printf("%d\n", target);
// check for target player, if it doesn't exist then we can't send the message!
if (target < MAXPLAYERS && playeringame[target]) // player exists
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
// check if nodenum[1] is a space
if (nodenum[1] == ' ')
spc = 0;
// let it slide
else
{
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return;
}
// we need to get rid of the /pm<node>
newmsg = msg+5+spc;
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
}
if (ci > 3) // don't send target+flags+empty message.
// I'm very bad at C, I swear I am, additional checks eww!
if (spc != 0)
{
if (teamtalk)
buf[0] = -1; // target
else
buf[0] = target;
buf[1] = 0; // flags
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
if (msg[5] != ' ')
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return;
}
}
return;
target = atoi((const char*) nodenum); // turn that into a number
free(nodenum);
//CONS_Printf("%d\n", target);
// check for target player, if it doesn't exist then we can't send the message!
if (target < MAXPLAYERS && playeringame[target]) // player exists
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
else
{
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
return;
}
// we need to get rid of the /pm<node>
newmsg = msg+5+spc;
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
}
if (ci > 3) // don't send target+flags+empty message.
{
if (teamtalk)
buf[0] = -1; // target
else
buf[0] = target;
buf[1] = 0; // flags
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
}
}
#endif
void HU_clearChatChars(void)
{
size_t i = 0;
for (;i<HU_MAXMSGLEN;i++)
w_chat[i] = 0; // reset this.
M_TextInputClear(&w_chat);
chat_on = false;
c_input = 0;
}
#ifndef NONET
@@ -1456,7 +1338,8 @@ boolean HU_Responder(event_t *ev)
&& netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
{
chat_on = true;
w_chat[0] = 0;
w_chat_buf[0] = 0;
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
teamtalk = false;
chat_scrollmedown = true;
typelines = 1;
@@ -1466,7 +1349,8 @@ boolean HU_Responder(event_t *ev)
&& netgame && !OLD_MUTE)
{
chat_on = true;
w_chat[0] = 0;
w_chat_buf[0] = 0;
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
teamtalk = G_GametypeHasTeams(); // Don't teamtalk if we don't have teams.
chat_scrollmedown = true;
typelines = 1;
@@ -1491,62 +1375,13 @@ boolean HU_Responder(event_t *ev)
&& ev->data1 != gamecontrol[gc_talkkey][1]))
return false;
c = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(c) : CON_ShiftChar(c);
M_TextInputHandle(&w_chat, c);
// pasting. pasting is cool. chat is a bit limited, though :(
if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE)
{
const char *paste = I_ClipboardPaste();
size_t chatlen;
size_t pastelen;
// create a dummy string real quickly
if (paste == NULL)
return true;
chatlen = strlen(w_chat);
pastelen = strlen(paste);
if (chatlen+pastelen > HU_MAXMSGLEN)
return true; // we can't paste this!!
if (c_input >= strlen(w_chat)) // add it at the end of the string.
{
memcpy(&w_chat[chatlen], paste, pastelen); // copy all of that.
c_input += pastelen;
/*size_t i = 0;
for (;i<pastelen;i++)
{
HU_queueChatChar(paste[i]); // queue it so that it's actually sent. (this chat write thing is REALLY messy.)
}*/
return true;
}
else // otherwise, we need to shift everything and make space, etc etc
{
size_t i = HU_MAXMSGLEN-1;
while (i >= c_input)
{
if (w_chat[i])
w_chat[i+pastelen] = w_chat[i];
if (i == 0) // prevent overflow
break;
i--;
}
memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
c_input += pastelen;
return true;
}
}
if (!CHAT_MUTE && HU_keyInChatString(w_chat,c))
{
HU_queueChatChar(c);
}
if (c == KEY_ENTER)
{
chat_on = false;
c_input = 0; // reset input cursor
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
HU_SendChatMessage();
}
else if (c == KEY_ESCAPE
|| ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1]
@@ -1554,7 +1389,6 @@ boolean HU_Responder(event_t *ev)
&& c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle.
{
chat_on = false;
c_input = 0; // reset input cursor
}
else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS!
{
@@ -1568,10 +1402,6 @@ boolean HU_Responder(event_t *ev)
justscrolleddown = true;
chat_scrolltime = 4;
}
else if (c == KEY_LEFTARROW && c_input != 0 && !OLDCHAT) // i said go back
c_input--;
else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat) && !OLDCHAT) // don't need to check for admin or w/e here since the chat won't ever contain anything if it's muted.
c_input++;
return true;
}
#endif
@@ -1925,8 +1755,9 @@ static void HU_DrawChat(void)
INT32 charwidth = 4, charheight = 6;
INT32 boxw = cv_chatwidth.value;
INT32 t = 0, c = 0, y = chaty - (typelines*charheight);
UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday!
UINT32 i = 0, saylen = strlen(w_chat_buf); // You learn new things everyday!
INT32 cflag = 0;
size_t select_start = 0, select_end = 0;
const char *ntalk = "Say: ", *ttalk = "Team: ";
const char *talk = ntalk;
const char *mute = "Chat has been muted.";
@@ -1988,13 +1819,19 @@ static void HU_DrawChat(void)
i = 0;
typelines = 1;
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
V_DrawChatCharacter(chatx + 2 + c, y+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
V_DrawChatCharacter(chatx+2+c+charwidth*w_chat.cursor, y+1, '_'|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
while (w_chat[i])
if (w_chat.select != w_chat.cursor)
{
select_start = min(w_chat.select, w_chat.cursor);
select_end = max(w_chat.select, w_chat.cursor);
}
while (w_chat_buf[i])
{
boolean skippedline = false;
if (c_input == (i+1))
if (w_chat.cursor == (i+1))
{
INT32 cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
INT32 cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
@@ -2009,10 +1846,14 @@ static void HU_DrawChat(void)
}
//Hurdler: isn't it better like that?
if (w_chat[i] < HU_FONTSTART)
++i;
else
V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
if (w_chat_buf[i] >= HU_FONTSTART)
V_DrawChatCharacter(chatx + c + 2, y, w_chat_buf[i] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
// Draw selection
if (i >= select_start && i < select_end)
V_DrawFill(chatx + c + 2, y-1, charwidth, charheight, 103|V_TRANSLUCENT|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t);
++i;
c += charwidth;
if (c > boxw-(charwidth*2) && !skippedline)
@@ -2024,7 +1865,7 @@ static void HU_DrawChat(void)
}
// handle /pm list. It's messy, horrible and I don't care.
if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
{
INT32 count = 0;
INT32 p_dispy = chaty - charheight -1;
@@ -2044,38 +1885,38 @@ static void HU_DrawChat(void)
{
// filter: (code needs optimization pls help I'm bad with C)
if (w_chat[3])
if (w_chat_buf[3])
{
char *nodenum;
UINT32 n;
// right, that's half important: (w_chat[4] may be a space since /pm0 msg is perfectly acceptable!)
if ( ( ((w_chat[3] != 0) && ((w_chat[3] < '0') || (w_chat[3] > '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' '))
// right, that's half important: (w_chat_buf[4] may be a space since /pm0 msg is perfectly acceptable!)
if ( ( ((w_chat_buf[3] != 0) && ((w_chat_buf[3] < '0') || (w_chat_buf[3] > '9'))) || ((w_chat_buf[4] != 0) && (((w_chat_buf[4] < '0') || (w_chat_buf[4] > '9'))))) && (w_chat_buf[4] != ' '))
break;
nodenum = (char*) malloc(3);
memcpy(nodenum, w_chat+3, 2);
memcpy(nodenum, w_chat_buf+3, 2);
nodenum[2] = '\0';
n = atoi((const char*) nodenum); // turn that into a number
free(nodenum);
// special cases:
if ((n == 0) && !(w_chat[4] == '0'))
if ((n == 0) && !(w_chat_buf[4] == '0'))
{
if (!(i<10))
continue;
}
else if ((n == 1) && !(w_chat[3] == '0'))
else if ((n == 1) && !(w_chat_buf[3] == '0'))
{
if (!((i == 1) || ((i >= 10) && (i <= 19))))
continue;
}
else if ((n == 2) && !(w_chat[3] == '0'))
else if ((n == 2) && !(w_chat_buf[3] == '0'))
{
if (!((i == 2) || ((i >= 20) && (i <= 29))))
continue;
}
else if ((n == 3) && !(w_chat[3] == '0'))
else if ((n == 3) && !(w_chat_buf[3] == '0'))
{
if (!((i == 3) || ((i >= 30) && (i <= 31))))
continue;
@@ -2114,6 +1955,7 @@ static void HU_DrawChat_Old(void)
size_t i = 0;
const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
const char *talk = ntalk;
size_t select_start = 0, select_end = 0;
INT32 charwidth = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
INT32 charheight = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
if (teamtalk)
@@ -2142,14 +1984,19 @@ static void HU_DrawChat_Old(void)
c += charwidth;
}
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
V_DrawCharacter(HU_INPUTX+c, y+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, !cv_allcaps.value);
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
V_DrawCharacter(HU_INPUTX+c+charwidth*w_chat.cursor, y+2*con_scalefactor, '_'|cv_constextsize.value|V_NOSCALESTART|t, !cv_allcaps.value);
if (w_chat.select != w_chat.cursor)
{
select_start = min(w_chat.select, w_chat.cursor);
select_end = max(w_chat.select, w_chat.cursor);
}
i = 0;
while (w_chat[i])
while (w_chat_buf[i])
{
if (c_input == (i+1) && hu_tick < 4)
if (w_chat.cursor == (i+1) && hu_tick < 4)
{
INT32 cursorx = (HU_INPUTX+c+charwidth < vid.width) ? (HU_INPUTX + c + charwidth) : (HU_INPUTX); // we may have to go down.
INT32 cursory = (cursorx != HU_INPUTX) ? (y) : (y+charheight);
@@ -2157,17 +2004,18 @@ static void HU_DrawChat_Old(void)
}
//Hurdler: isn't it better like that?
if (w_chat[i] < HU_FONTSTART)
{
++i;
//charwidth = 4 * con_scalefactor;
}
else
if (w_chat_buf[i] >= HU_FONTSTART)
{
//charwidth = SHORT(hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
V_DrawCharacter(HU_INPUTX + c, y, w_chat_buf[i] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
}
// Draw selection
if (i >= select_start && i < select_end)
V_DrawFill(HU_INPUTX + c, y, charwidth, charheight, 103|V_TRANSLUCENT|cv_constextsize.value|V_NOSCALESTART|t);
++i;
c += charwidth;
if (c >= vid.width)
{
@@ -2339,7 +2187,7 @@ void HU_DrawSongCredits(void)
//
void HU_Drawer(void)
{
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))
if (cv_vhseffect.value && ((paused && !camera[R_GetViewNumber()].freecam) || (demo.playback && cv_playbackspeed.value > 1)))
V_DrawVhsEffect(demo.rewinding);
#ifndef NONET
@@ -2382,7 +2230,7 @@ void HU_Drawer(void)
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_scores);
LUAh_ScoresHUD(luahuddrawlist_scores);
LUA_HUDHOOK(scores, luahuddrawlist_scores);
}
LUA_HUD_DrawList(luahuddrawlist_scores);
@@ -2397,28 +2245,16 @@ void HU_Drawer(void)
if (gamestate != GS_LEVEL)
return;
// draw the crosshair, not when viewing demos nor with chasecam
/*if (!automapactive && !demo.playback)
{
if (cv_crosshair.value && !camera[0].chase && !players[displayplayers[0]].spectator)
HU_DrawCrosshair();
if (cv_crosshair2.value && !camera[1].chase && !players[displayplayers[1]].spectator)
HU_DrawCrosshair2();
if (cv_crosshair3.value && !camera[2].chase && !players[displayplayers[2]].spectator)
HU_DrawCrosshair3();
if (cv_crosshair4.value && !camera[3].chase && !players[displayplayers[3]].spectator)
HU_DrawCrosshair4();
}*/
// draw song credits
if (cv_songcredits.value)
HU_DrawSongCredits();
// draw desynch text
if (hu_resynching)
if (hu_resynching
#ifdef SATURNSYNCH
|| hu_redownloadinggamestate
#endif
)
{
char resynch_text[14];
UINT32 i;
@@ -2520,92 +2356,138 @@ Ping_gfx_num (int lag)
return 4;
}
static int
Ping_gfx_color (int lag)
{
if (lag < 2)
return SKINCOLOR_JAWZ;
else if (lag < 4)
return SKINCOLOR_MINT;
else if (lag < 7)
return SKINCOLOR_GOLD;
else if (lag < 10)
return SKINCOLOR_RED;
else
return SKINCOLOR_WHITE; // SKINCOLOR_MAGENTA
}
static const UINT8 *
Ping_gfx_colormap (UINT32 lag, boolean gentleman)
{
const UINT8 *colormap = NULL;
if (K_UseColorHud())
colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE);
if (servermaxping && lag > servermaxping && hu_tick < 4)
{
// flash ping red if too high
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
}
else if (gentleman)
{
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PASTEL, GTC_CACHE);
}
return colormap;
}
static UINT32
Ping_conversion (UINT32 lag)
{
if (cv_pingmeasurement.value)
{
lag = (INT32)(lag * (1000.00f / TICRATE));
}
return lag;
}
//
// HU_drawPing
//
void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
{
UINT8 *colormap = NULL;
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
INT32 gfxnum; // gfx to draw
//SRB2/Kart v1.0 style
UINT8 numbars = 0; // how many ping bars do we draw?
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
SINT8 i = 0;
SINT8 yoffset = 6;
//INT32 dx;
gfxnum = Ping_gfx_num(lag);
if (!cv_pingstyle.value)
UINT32 lag = playerpingtable[pnum];
const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag));
if (gentleman)
{
lag = simulated_lag;
}
if (cv_pingstyle.value == 0) // kart
{
gfxnum = Ping_gfx_num(lag);
if (measureid == 1)
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
if (cv_pingicon.value)
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
if (servermaxping && lag > servermaxping && hu_tick < 4)
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE); // flash ping red if too high
if (cv_pingmeasurement.value)
lag = (INT32)(lag * (1000.00f / TICRATE));
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, Ping_conversion(lag), Ping_gfx_colormap(lag, gentleman));
if (measureid == 0)
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
}
else if (cv_pingstyle.value) // old style ping
else if (cv_pingstyle.value == 1) // old style ping
{
if (cv_pingicon.value)
{
if (lag < 4)
{
numbars = 3;
barcolor = 184;
}
else if (lag < 7)
{
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
barcolor = 103;
}
else if (lag < 10)
{
numbars = 1;
barcolor = 155; // need a better red
}
else // brazil
{
numbars = 0;
barcolor = 31;
}
}
if (cv_pingmeasurement.value)
lag = (INT32)(lag * (1000.00f / TICRATE));
if (vid.width >= 640) // how sad, we're using a shit resolution.
{
if (measureid == 1)
{
//dx = x+1 - (V_SmallStringWidth(va("%dms", lag), V_ALLOWLOWERCASE|flags)/2);
//V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", lag));
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", lag));
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", Ping_conversion(lag)));
}
else if (measureid == 0)
{
//dx = x+1 - (V_SmallStringWidth(va("d%d", lag), flags)/2);
//V_DrawSmallString(dx, y+4, flags, va("d%d", lag));
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", lag));
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", Ping_conversion(lag)));
}
}
if (cv_pingicon.value)
{
for (i=0; (i<3); i++) // Draw the ping bar
{
switch (lag)
{
case 0 ... 1:
numbars = 3;
barcolor = 215; // Blue
break;
case 2 ... 3:
numbars = 3;
barcolor = 184; // Green
break;
case 4 ... 6:
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
barcolor = 103; // Yellow
break;
case 7 ... 9:
numbars = 1;
barcolor = 155; // Red
break;
default: // Brazil
numbars = 0;
barcolor = 31; // black
break;
}
if (gentleman)
{
barcolor = 194; // make it purplish
// bars get indirectly set earlier
}
for (i = 0; (i < 3); i++) // Draw the ping bar
{
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
if (i < numbars)
@@ -2699,8 +2581,10 @@ static inline void HU_DrawSpectatorTicker(void)
}
}
if (netgame && i != serverplayer)
HU_drawPing((templength - duptweak)+8, height-20, playerpingtable[i], V_TRANSLUCENT);
if ((netgame && i != serverplayer) || (cv_mindelay.value && P_IsLocalPlayer(&players[i])))
{
HU_drawPlayerPing((templength - duptweak)+8, height-20, i, V_TRANSLUCENT);
}
}
if ((length += len) >= dupadjust+8)
@@ -2721,7 +2605,8 @@ static void HU_DrawRankings(void)
boolean completed[MAXPLAYERS];
UINT32 whiteplayer = MAXPLAYERS;
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
if (!automapactive)
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
if (cons_menuhighlight.value)
hilicol = cons_menuhighlight.value;
@@ -2737,10 +2622,14 @@ static void HU_DrawRankings(void)
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametype_cons_t[gametype].strvalue);
// draw the current map in the lower right if theres none just say its unknown
if (!G_BuildMapTitle(gamemap))
char *maptitle = G_BuildMapTitle(gamemap);
if (!maptitle)
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "UNKNOWN");
else
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, G_BuildMapTitle(gamemap));
{
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, maptitle);
Z_Free(maptitle);
}
if (G_GametypeHasTeams())
{
@@ -2790,18 +2679,6 @@ static void HU_DrawRankings(void)
V_DrawCenteredString(256, 16, hilicol, va("%d", cv_pointlimit.value));
}
}
/*else if (gametype == GT_COOP)
{
INT32 totalscore = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
totalscore += players[i].score;
}
V_DrawCenteredString(256, 8, 0, "TOTAL SCORE");
V_DrawCenteredString(256, 16, 0, va("%u", totalscore));
}*/
else
{
if (circuitmap)
@@ -2874,12 +2751,7 @@ static void HU_DrawRankings(void)
#endif
}
/*if (G_GametypeHasTeams())
HU_DrawTeamTabRankings(tab, whiteplayer); //separate function for Spazzo's silly request -- gotta fix this up later
else if (scorelines > 10)*/
HU_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, whiteplayer, hilicol);
/*else
HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/
// draw spectators in a ticker across the bottom
if (netgame && G_GametypeHasSpectators())
+1 -7
View File
@@ -42,8 +42,6 @@
#define CRED_FONTEND 'Z' // the last font character
#define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1)
#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
extern char *shiftxform; // english translation shift table
extern char english_shiftxform[];
@@ -90,18 +88,14 @@ extern patch_t *tallnum[10];
extern patch_t *pingnum[10];
extern patch_t *pinggfx[5];
extern patch_t *ranknum[10];
extern patch_t *nightsnum[10];
extern patch_t *framecounter;
extern patch_t *frameslash;
extern patch_t *lt_font[LT_FONTSIZE];
extern patch_t *cred_font[CRED_FONTSIZE];
extern patch_t *emeraldpics[7];
extern patch_t *tinyemeraldpics[7];
extern patch_t *rflagico;
extern patch_t *bflagico;
extern patch_t *rmatcico;
extern patch_t *bmatcico;
extern patch_t *tagico;
extern patch_t *tallminus;
// set true whenever the tab rankings are being shown for any reason
@@ -125,7 +119,7 @@ void HU_Drawer(void);
char HU_dequeueChatChar(void);
void HU_Erase(void);
void HU_clearChatChars(void);
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // Lat': Ping drawer for scoreboard.
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard.
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
//void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);
+1 -1
View File
@@ -53,6 +53,6 @@ typedef struct JoyType_s JoyType_t;
for palyer[sic] 1-4's joystick/gamepad
*/
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;
extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
#endif // __I_JOY_H__
-28
View File
@@ -34,7 +34,6 @@
#define NO_BAN_TIME (time_t)(-1)
extern INT16 hardware_MAXPACKETLENGTH;
extern INT32 net_bandwidth; // in byte/s
#if defined(_MSC_VER)
#pragma pack(1)
@@ -42,36 +41,17 @@ extern INT32 net_bandwidth; // in byte/s
typedef struct
{
/// Supposed to be DOOMCOM_ID
INT32 id;
/// SRB2 executes an INT32 to execute commands.
INT16 intnum;
/// Communication between SRB2 and the driver.
/// Is CMD_SEND or CMD_GET.
INT16 command;
/// Is dest for send, set by get (-1 = no packet).
INT16 remotenode;
/// Number of bytes in doomdata to be sent
INT16 datalength;
/// Info common to all nodes.
/// Console is always node 0.
INT16 numnodes;
/// Flag: 1 = no duplication, 2-5 = dup for slow nets.
INT16 ticdup;
/// Flag: 1 = send a backup tic in every packet.
INT16 extratics;
/// kind of game
INT16 gametype;
/// Flag: -1 = new game, 0-5 = load savegame
INT16 savegame;
/// currect map
INT16 map;
/// Info specific to this node.
INT16 consoleplayer;
/// Number of "slots": the highest player number in use plus one.
INT16 numslots;
@@ -102,18 +82,10 @@ extern holepunch_t *holepunchpacket;
*/
extern boolean (*I_NetGet)(void);
/** \brief ask to driver if there is data waiting
*/
extern boolean (*I_NetCanGet)(void);
/** \brief send packet within doomcom struct
*/
extern void (*I_NetSend)(void);
/** \brief ask to driver if all is ok to send data now
*/
extern boolean (*I_NetCanSend)(void);
/** \brief close a connection
\param nodenum node to be closed
-1
View File
@@ -159,7 +159,6 @@ boolean I_SetSongPosition(UINT32 position);
UINT32 I_GetSongPosition(void);
void I_UpdateSongLagThreshold (void);
void I_UpdateSongLagConditions (void);
/// ------------------------
// MUSIC PLAYBACK
+15 -23
View File
@@ -34,6 +34,9 @@ extern UINT8 graphics_started;
*/
extern UINT8 keyboard_started;
/** \brief Set to true when inside a signal handler that will exit the program. */
extern boolean g_in_exiting_signal_handler;
/** \brief The I_GetFreeMem function
\param total total memory in the system
@@ -199,9 +202,13 @@ void I_JoyScale4(void);
// Called by D_SRB2Main.
/** \brief to startup joystick
*/
void I_InitJoystick(UINT8 index);
/** \brief to startup the first joystick
*/
void I_InitJoystick(void);
void I_InitJoystick1(void);
/** \brief to startup the second joystick
*/
@@ -219,6 +226,8 @@ void I_InitJoystick4(void);
*/
INT32 I_NumJoys(void);
extern INT32 numcontrollers;
/** \brief The *I_GetJoyName function
\param joyindex which joystick
@@ -227,6 +236,9 @@ INT32 I_NumJoys(void);
*/
const char *I_GetJoyName(INT32 joyindex);
void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 blue);
#ifndef NOMUMBLE
#include "p_mobj.h" // mobj_t
#include "s_sound.h" // listener_t
@@ -239,10 +251,6 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener);
*/
void I_StartupMouse(void);
/** \brief Startup the second mouse
*/
void I_StartupMouse2(void);
/** \brief setup timer irq and user timer routine.
*/
void I_StartupTimer(void);
@@ -301,25 +309,9 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
*/
const char *I_LocateWad(void);
/** \brief First Joystick's events
/** \brief Joystick events
*/
void I_GetJoystickEvents(void);
/** \brief Second Joystick's events
*/
void I_GetJoystick2Events(void);
/** \brief Third Joystick's events
*/
void I_GetJoystick3Events(void);
/** \brief Fourth Joystick's events
*/
void I_GetJoystick4Events(void);
/** \brief Mouses events
*/
void I_GetMouseEvents(void);
void I_GetJoystickEvents(UINT8 index);
char *I_GetEnv(const char *name);
+28 -88
View File
@@ -100,6 +100,14 @@
#undef ETIMEDOUT
#endif
#define ETIMEDOUT WSAETIMEDOUT
#ifdef EHOSTUNREACH
#undef EHOSTUNREACH
#endif
#define EHOSTUNREACH WSAEHOSTUNREACH
#ifdef ENETUNREACH
#undef ENETUNREACH
#endif
#define ENETUNREACH WSAENETUNREACH
#ifndef IOC_VENDOR
#define IOC_VENDOR 0x18000000
#endif
@@ -160,7 +168,6 @@ static UINT8 UPNP_support = TRUE;
#endif
#include "i_addrinfo.h"
#define SELECTTEST
#define DEFAULTPORT "5029"
@@ -742,59 +749,6 @@ static boolean SOCK_Get(void)
}
#endif
// check if we can send (do not go over the buffer)
#ifndef NONET
static fd_set masterset;
#ifdef SELECTTEST
static boolean FD_CPY(fd_set *src, fd_set *dst, SOCKET_TYPE *fd, size_t len)
{
size_t i;
boolean testset = false;
FD_ZERO(dst);
for (i = 0; i < len;i++)
{
if(fd[i] != (SOCKET_TYPE)ERRSOCKET &&
FD_ISSET(fd[i], src) && !FD_ISSET(fd[i], dst)) // no checking for dups
{
FD_SET(fd[i], dst);
testset = true;
}
}
return testset;
}
static boolean SOCK_CanSend(void)
{
struct timeval timeval_for_select = {0, 0};
fd_set tset;
int wselect;
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
return false;
wselect = select(255, NULL, &tset, NULL, &timeval_for_select);
if (wselect >= 1)
return true;
return false;
}
static boolean SOCK_CanGet(void)
{
struct timeval timeval_for_select = {0, 0};
fd_set tset;
int rselect;
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
return false;
rselect = select(255, &tset, NULL, NULL, &timeval_for_select);
if (rselect >= 1)
return true;
return false;
}
#endif
#endif
#ifndef NONET
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
{
@@ -816,6 +770,8 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr
return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d);
}
#define ALLOWEDERROR(x) ((x) == ECONNREFUSED || (x) == EWOULDBLOCK || (x) == EHOSTUNREACH || (x) == ENETUNREACH)
static void SOCK_Send(void)
{
ssize_t c = ERRSOCKET;
@@ -831,7 +787,11 @@ static void SOCK_Send(void)
for (j = 0; j < broadcastaddresses; j++)
{
if (myfamily[i] == broadcastaddress[j].any.sa_family)
SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
{
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
break;
}
}
}
return;
@@ -841,7 +801,11 @@ static void SOCK_Send(void)
for (i = 0; i < mysocketses; i++)
{
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
{
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
break;
}
}
return;
}
@@ -853,12 +817,13 @@ static void SOCK_Send(void)
if (c == ERRSOCKET)
{
int e = errno; // save error code so it can't be modified later
if (e != ECONNREFUSED && e != EWOULDBLOCK)
if (!ALLOWEDERROR(e))
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
}
}
#endif
#undef ALLOWEDERROR
#endif //NONET
#ifndef NONET
static void SOCK_FreeNodenum(INT32 numnode)
@@ -1010,7 +975,6 @@ static boolean UDP_Socket(void)
mysockets[s] = ERRSOCKET;
for (s = 0; s < MAXNETNODES+1; s++)
nodesocket[s] = ERRSOCKET;
FD_ZERO(&masterset);
s = 0;
memset(&hints, 0x00, sizeof (hints));
@@ -1037,7 +1001,6 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
}
@@ -1058,7 +1021,6 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
#ifdef HAVE_MINIUPNPC
@@ -1091,7 +1053,6 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
}
@@ -1112,7 +1073,6 @@ static boolean UDP_Socket(void)
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
{
FD_SET(mysockets[s], &masterset);
myfamily[s] = hints.ai_family;
s++;
}
@@ -1279,16 +1239,15 @@ boolean I_InitTcpDriver(void)
static void SOCK_CloseSocket(void)
{
size_t i;
for (i=0; i < MAXNETNODES+1; i++)
for (i = 0; i < mysocketses; i++)
{
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET
&& FD_ISSET(mysockets[i], &masterset))
{
FD_CLR(mysockets[i], &masterset);
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET)
close(mysockets[i]);
}
mysockets[i] = ERRSOCKET;
}
mysocketses = 0;
}
#endif
@@ -1398,9 +1357,7 @@ static void rendezvous(int size)
if (tic == refreshtic)
{
#ifdef HOLEPUNCH
holepunchpacket->magic = hole_punch_magic;
#endif
sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4);
}
@@ -1425,7 +1382,6 @@ static void SOCK_RegisterHolePunch(void)
rendezvous(4);
}
#endif
#endif
static boolean SOCK_OpenSocket(void)
@@ -1445,13 +1401,7 @@ static boolean SOCK_OpenSocket(void)
I_NetFreeNodenum = SOCK_FreeNodenum;
I_NetMakeNodewPort = SOCK_NetMakeNodewPort;
#ifdef SELECTTEST
// seem like not work with libsocket : (
I_NetCanSend = SOCK_CanSend;
I_NetCanGet = SOCK_CanGet;
#endif
#ifdef HOLEPUNCH
I_NetRequestHolePunch = SOCK_RequestHolePunch;
I_NetRegisterHolePunch = SOCK_RegisterHolePunch;
#endif
@@ -1692,8 +1642,6 @@ boolean I_InitTcpNetwork(void)
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
if (dedicated)
doomcom->numnodes = 0;
/* else if (M_IsNextParm())
doomcom->numnodes = (INT16)atoi(M_GetNextParm());*/
else
doomcom->numnodes = 1;
@@ -1707,7 +1655,6 @@ boolean I_InitTcpNetwork(void)
// FIXME:
// ??? and now ?
// server on a big modem ??? 4*isdn
net_bandwidth = 16000;
hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
ret = true;
@@ -1722,7 +1669,6 @@ boolean I_InitTcpNetwork(void)
// server address only in ip
if (serverhostname[0])
{
CV_Set(&cv_lastserver, serverhostname);
COM_BufAddText("connect \"");
COM_BufAddText(serverhostname);
COM_BufAddText("\"\n");
@@ -1732,13 +1678,9 @@ boolean I_InitTcpNetwork(void)
}
else
{
// Not quite sure if we want to save that but i'll do that for now
CV_Set(&cv_lastserver, "any");
// so we're on a LAN
COM_BufAddText("connect any\n");
net_bandwidth = 800000;
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
}
}
@@ -1763,8 +1705,6 @@ boolean I_InitTcpNetwork(void)
{
// so we're on a LAN
COM_BufAddText("connect any\n");
net_bandwidth = 800000;
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ void I_UpdateTime(fixed_t timescale)
ticratescaled = (double)TICRATE * FIXED_TO_FLOAT(timescale);
enterprecise = I_GetPreciseTime();
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();
elapsedseconds = (double)((INT64)enterprecise - oldenterprecise) / I_GetPrecisePrecision();
tictimer += elapsedseconds;
while (tictimer > 1.0/ticratescaled)
{
+4
View File
@@ -139,9 +139,13 @@ UINT32 I_GetRefreshRate(void);
boolean I_UseNativeKeyboard(void);
boolean I_CheckNativeRes(void);
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void);
void I_DownSample(void);
boolean UseScreenFBO(void);
extern boolean downsample;
#endif
+10 -11
View File
@@ -21,7 +21,6 @@
#include "d_player.h"
#include "lzf.h"
// Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c!
char sprnames[NUMSPRITES + 1][5] =
{
"NULL","UNKN","THOK","PLAY","POSS","SPOS","FISH","BUZZ","RBUZ","JETB",
@@ -1822,7 +1821,7 @@ state_t states[NUMSTATES] =
// Rain
{SPR_RAIN, FF_TRANS50, -1, {NULL}, 0, 0, S_NULL}, // S_RAIN1
{SPR_RAIN, FF_TRANS50, 1, {NULL}, 0, 0, S_RAIN1}, // S_RAINRETURN
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_RAINRETURN
// Snowflake
{SPR_SNO1, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SNOW1
@@ -1841,9 +1840,9 @@ state_t states[NUMSTATES] =
{SPR_SPLH, FF_TRANS50|8, 2, {NULL}, 0, 0, S_NULL}, // S_SPLISH9
// Water Splash
{SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1
{SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2
{SPR_SPLA, FF_TRANS90|2, 3, {NULL}, 0, 0, S_RAINRETURN}, // S_SPLASH3
{SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1
{SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2
{SPR_SPLA, FF_TRANS90|2, 3, {NULL}, 0, 0, S_NULL}, // S_SPLASH3
// Smoke
{SPR_SMOK, FF_TRANS50 , 4, {NULL}, 0, 0, S_SMOKE2}, // S_SMOKE1
@@ -11198,22 +11197,22 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_RAIN1, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_rainin, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_SPLASH1, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
-72*FRACUNIT, // speed -- -24*FRACUNIT originally, srb2kart x3 (nya)
1*FRACUNIT, // radius
8*FRACUNIT, // height
0, // display offset
4, // mass
80, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
@@ -11226,7 +11225,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
@@ -11240,7 +11239,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
4*FRACUNIT, // radius
4*FRACUNIT, // height
0, // display offset
4, // mass
0, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
+427 -204
View File
@@ -22,218 +22,441 @@
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
// For great modding!!
/** Action pointer for reading actions from Dehacked lumps.
*/
typedef struct
{
actionf_t action; ///< Function pointer corresponding to the actual action.
const char *name; ///< Name of the action in ALL CAPS.
} actionpointer_t;
/** Array mapping action names to action functions.
* Names must be in ALL CAPS for case insensitive comparisons.
*/
extern actionpointer_t actionpointers[];
// IMPORTANT!
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONPOINTERS ARRAY IN DEHACKED.C
enum actionnum
{
A_EXPLODE = 0,
A_PAIN,
A_FALL,
A_MONITORPOP,
A_LOOK,
A_CHASE,
A_FACESTABCHASE,
A_FACETARGET,
A_FACETRACER,
A_SCREAM,
A_BOSSDEATH,
A_CUSTOMPOWER,
A_GIVEWEAPON,
A_RINGSHIELD,
A_RINGBOX,
A_INVINCIBILITY,
A_SUPERSNEAKERS,
A_BUNNYHOP,
A_BUBBLESPAWN,
A_FANBUBBLESPAWN,
A_BUBBLERISE,
A_BUBBLECHECK,
A_AWARDSCORE,
A_EXTRALIFE,
A_BOMBSHIELD,
A_JUMPSHIELD,
A_WATERSHIELD,
A_FORCESHIELD,
A_PITYSHIELD,
A_GRAVITYBOX,
A_SCORERISE,
A_PARTICLESPAWN,
A_ATTRACTCHASE,
A_DROPMINE,
A_FISHJUMP,
A_THROWNRING,
A_GRENADERING, // SRB2kart
A_SETSOLIDSTEAM,
A_UNSETSOLIDSTEAM,
A_SIGNPLAYER,
A_OVERLAYTHINK,
A_JETCHASE,
A_JETBTHINK,
A_JETGTHINK,
A_JETGSHOOT,
A_SHOOTBULLET,
A_MINUSDIGGING,
A_MINUSPOPUP,
A_MINUSCHECK,
A_CHICKENCHECK,
A_MOUSETHINK,
A_DETONCHASE,
A_CAPECHASE,
A_ROTATESPIKEBALL,
A_SLINGAPPEAR,
A_MACEROTATE,
A_UNIDUSBALL,
A_ROCKSPAWN,
A_SETFUSE,
A_CRAWLACOMMANDERTHINK,
A_SMOKETRAILER,
A_RINGEXPLODE,
A_OLDRINGEXPLODE,
A_MIXUP,
A_RECYCLEPOWERS,
A_BOSS1CHASE,
A_FOCUSTARGET,
A_BOSS2CHASE,
A_BOSS2POGO,
A_BOSSZOOM,
A_BOSSSCREAM,
A_BOSS2TAKEDAMAGE,
A_BOSS7CHASE,
A_GOOPSPLAT,
A_BOSS2POGOSFX,
A_BOSS2POGOTARGET,
A_BOSSJETFUME,
A_EGGMANBOX,
A_TURRETFIRE,
A_SUPERTURRETFIRE,
A_TURRETSTOP,
A_JETJAWROAM,
A_JETJAWCHOMP,
A_POINTYTHINK,
A_CHECKBUDDY,
A_HOODTHINK,
A_ARROWCHECK,
A_SNAILERTHINK,
A_SHARPCHASE,
A_SHARPSPIN,
A_VULTUREVTOL,
A_VULTURECHECK,
A_SKIMCHASE,
A_1UPTHINKER,
A_SKULLATTACK,
A_LOBSHOT,
A_FIRESHOT,
A_SUPERFIRESHOT,
A_BOSSFIRESHOT,
A_BOSS7FIREMISSILES,
A_BOSS1LASER,
A_BOSS4REVERSE,
A_BOSS4SPEEDUP,
A_BOSS4RAISE,
A_SPARKFOLLOW,
A_BUZZFLY,
A_GUARDCHASE,
A_EGGSHIELD,
A_SETREACTIONTIME,
A_BOSS1SPIKEBALLS,
A_BOSS3TAKEDAMAGE,
A_BOSS3PATH,
A_LINEDEFEXECUTE,
A_PLAYSEESOUND,
A_PLAYATTACKSOUND,
A_PLAYACTIVESOUND,
A_SPAWNOBJECTABSOLUTE,
A_SPAWNOBJECTRELATIVE,
A_CHANGEANGLERELATIVE,
A_CHANGEANGLEABSOLUTE,
A_PLAYSOUND,
A_FINDTARGET,
A_FINDTRACER,
A_SETTICS,
A_SETRANDOMTICS,
A_CHANGECOLORRELATIVE,
A_CHANGECOLORABSOLUTE,
A_MOVERELATIVE,
A_MOVEABSOLUTE,
A_THRUST,
A_ZTHRUST,
A_SETTARGETSTARGET,
A_SETOBJECTFLAGS,
A_SETOBJECTFLAGS2,
A_RANDOMSTATE,
A_RANDOMSTATERANGE,
A_DUALACTION,
A_REMOTEACTION,
A_TOGGLEFLAMEJET,
A_ITEMPOP, // SRB2kart
A_JAWZCHASE, // SRB2kart
A_JAWZEXPLODE, // SRB2kart
A_SPBCHASE, // SRB2kart
A_MINEEXPLODE, // SRB2kart
A_BALLHOGEXPLODE, // SRB2kart
A_LIGHTNINGFOLLOWPLAYER, //SRB2kart
A_FZBOOMFLASH, //SRB2kart
A_FZBOOMSMOKE, //SRB2kart
A_RANDOMSHADOWFRAME, //SRB2kart
A_ROAMINGSHADOWTHINKER, //SRB2kart
A_MAYONAKAARROW, //SRB2kart
A_REAPERTHINKER, //SRB2kart
A_MEMENTOSTPPARTICLES, //SRB2kart
A_FLAMEPARTICLE, // SRB2kart
A_ORBITNIGHTS,
A_GHOSTME,
A_SETOBJECTSTATE,
A_SETOBJECTTYPESTATE,
A_KNOCKBACK,
A_PUSHAWAY,
A_RINGDRAIN,
A_SPLITSHOT,
A_MISSILESPLIT,
A_MULTISHOT,
A_INSTALOOP,
A_CUSTOM3DROTATE,
A_SEARCHFORPLAYERS,
A_CHECKRANDOM,
A_CHECKTARGETRINGS,
A_CHECKRINGS,
A_CHECKTOTALRINGS,
A_CHECKHEALTH,
A_CHECKRANGE,
A_CHECKHEIGHT,
A_CHECKTRUERANGE,
A_CHECKTHINGCOUNT,
A_CHECKAMBUSH,
A_CHECKCUSTOMVALUE,
A_CHECKCUSVALMEMO,
A_SETCUSTOMVALUE,
A_USECUSVALMEMO,
A_RELAYCUSTOMVALUE,
A_CUSVALACTION,
A_FORCESTOP,
A_FORCEWIN,
A_SPIKERETRACT,
A_INFOSTATE,
A_REPEAT,
A_SETSCALE,
A_REMOTEDAMAGE,
A_HOMINGCHASE,
A_TRAPSHOT,
A_VILETARGET,
A_VILEATTACK,
A_VILEFIRE,
A_BRAKCHASE,
A_BRAKFIRESHOT,
A_BRAKLOBSHOT,
A_NAPALMSCATTER,
A_SPAWNFRESHCOPY,
NUMACTIONS
};
struct mobj_s;
// IMPORTANT NOTE: If you add/remove from this list of action
// functions, don't forget to update them in dehacked.c!
void A_Explode();
void A_Pain();
void A_Fall();
void A_MonitorPop();
void A_Look();
void A_Chase();
void A_FaceStabChase();
void A_FaceTarget();
void A_FaceTracer();
void A_Scream();
void A_BossDeath();
void A_CustomPower(); // Use this for a custom power
void A_GiveWeapon(); // Gives the player weapon(s)
void A_JumpShield(); // Obtained Jump Shield
void A_RingShield(); // Obtained Ring Shield
void A_RingBox(); // Obtained Ring Box Tails
void A_Invincibility(); // Obtained Invincibility Box
void A_SuperSneakers(); // Obtained Super Sneakers Box
void A_BunnyHop(); // have bunny hop tails
void A_BubbleSpawn(); // Randomly spawn bubbles
void A_FanBubbleSpawn();
void A_BubbleRise(); // Bubbles float to surface
void A_BubbleCheck(); // Don't draw if not underwater
void A_AwardScore();
void A_ExtraLife(); // Extra Life
void A_BombShield(); // Obtained Bomb Shield
void A_WaterShield(); // Obtained Water Shield
void A_ForceShield(); // Obtained Force Shield
void A_PityShield(); // Obtained Pity Shield. We're... sorry.
void A_GravityBox();
void A_ScoreRise(); // Rise the score logo
void A_ParticleSpawn();
void A_AttractChase(); // Ring Chase
void A_DropMine(); // Drop Mine from Skim or Jetty-Syn Bomber
void A_FishJump(); // Fish Jump
void A_ThrownRing(); // Sparkle trail for red ring
void A_GrenadeRing(); // SRB2kart
void A_SetSolidSteam();
void A_UnsetSolidSteam();
void A_SignPlayer();
void A_OverlayThink();
void A_JetChase();
void A_JetbThink(); // Jetty-Syn Bomber Thinker
void A_JetgThink(); // Jetty-Syn Gunner Thinker
void A_JetgShoot(); // Jetty-Syn Shoot Function
void A_ShootBullet(); // JetgShoot without reactiontime setting
void A_MinusDigging();
void A_MinusPopup();
void A_MinusCheck();
void A_ChickenCheck();
void A_MouseThink(); // Mouse Thinker
void A_DetonChase(); // Deton Chaser
void A_CapeChase(); // Fake little Super Sonic cape
void A_RotateSpikeBall(); // Spike ball rotation
void A_SlingAppear();
void A_MaceRotate();
void A_UnidusBall();
void A_RockSpawn();
void A_SetFuse();
void A_CrawlaCommanderThink(); // Crawla Commander
void A_SmokeTrailer();
void A_RingExplode();
void A_OldRingExplode();
void A_MixUp();
void A_RecyclePowers();
void A_BossScream();
void A_Boss2TakeDamage();
void A_GoopSplat();
void A_Boss2PogoSFX();
void A_Boss2PogoTarget();
void A_EggmanBox();
void A_TurretFire();
void A_SuperTurretFire();
void A_TurretStop();
void A_JetJawRoam();
void A_JetJawChomp();
void A_PointyThink();
void A_CheckBuddy();
void A_HoodThink();
void A_ArrowCheck();
void A_SnailerThink();
void A_SharpChase();
void A_SharpSpin();
void A_VultureVtol();
void A_VultureCheck();
void A_SkimChase();
void A_SkullAttack();
void A_LobShot();
void A_FireShot();
void A_SuperFireShot();
void A_BossFireShot();
void A_Boss7FireMissiles();
void A_Boss1Laser();
void A_FocusTarget();
void A_Boss4Reverse();
void A_Boss4SpeedUp();
void A_Boss4Raise();
void A_SparkFollow();
void A_BuzzFly();
void A_GuardChase();
void A_EggShield();
void A_SetReactionTime();
void A_Boss1Spikeballs();
void A_Boss3TakeDamage();
void A_Boss3Path();
void A_LinedefExecute();
void A_PlaySeeSound();
void A_PlayAttackSound();
void A_PlayActiveSound();
void A_1upThinker();
void A_BossZoom(); //Unused
void A_Boss1Chase();
void A_Boss2Chase();
void A_Boss2Pogo();
void A_Boss7Chase();
void A_BossJetFume();
void A_SpawnObjectAbsolute();
void A_SpawnObjectRelative();
void A_ChangeAngleRelative();
void A_ChangeAngleAbsolute();
void A_RollAngle();
void A_ChangeRollAngleRelative();
void A_ChangeRollAngleAbsolute();
void A_PlaySound();
void A_FindTarget();
void A_FindTracer();
void A_SetTics();
void A_SetRandomTics();
void A_ChangeColorRelative();
void A_ChangeColorAbsolute();
void A_MoveRelative();
void A_MoveAbsolute();
void A_Thrust();
void A_ZThrust();
void A_SetTargetsTarget();
void A_SetObjectFlags();
void A_SetObjectFlags2();
void A_RandomState();
void A_RandomStateRange();
void A_DualAction();
void A_RemoteAction();
void A_ToggleFlameJet();
void A_ItemPop(); // SRB2kart
void A_JawzChase(); // SRB2kart
void A_JawzExplode(); // SRB2kart
void A_SPBChase(); // SRB2kart
void A_MineExplode(); // SRB2kart
void A_BallhogExplode(); // SRB2kart
void A_LightningFollowPlayer(); // SRB2kart: Lightning shield effect player chasing
void A_FZBoomFlash(); // SRB2kart
void A_FZBoomSmoke(); // SRB2kart
void A_RandomShadowFrame(); //SRB2kart: Shadow spawner frame randomizer
void A_RoamingShadowThinker(); // SRB2kart: Roaming Shadow moving + attacking players.
void A_MayonakaArrow(); //SRB2kart: midnight channel arrow sign
void A_ReaperThinker(); //SRB2kart: mementos reaper
void A_MementosTPParticles(); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
void A_FlameParticle(); // SRB2kart
void A_OrbitNights();
void A_GhostMe();
void A_SetObjectState();
void A_SetObjectTypeState();
void A_KnockBack();
void A_PushAway();
void A_RingDrain();
void A_SplitShot();
void A_MissileSplit();
void A_MultiShot();
void A_InstaLoop();
void A_Custom3DRotate();
void A_SearchForPlayers();
void A_CheckRandom();
void A_CheckTargetRings();
void A_CheckRings();
void A_CheckTotalRings();
void A_CheckHealth();
void A_CheckRange();
void A_CheckHeight();
void A_CheckTrueRange();
void A_CheckThingCount();
void A_CheckAmbush();
void A_CheckCustomValue();
void A_CheckCusValMemo();
void A_SetCustomValue();
void A_UseCusValMemo();
void A_RelayCustomValue();
void A_CusValAction();
void A_ForceStop();
void A_ForceWin();
void A_SpikeRetract();
void A_InfoState();
void A_Repeat();
void A_SetScale();
void A_RemoteDamage();
void A_HomingChase();
void A_TrapShot();
void A_VileTarget();
void A_VileAttack();
void A_VileFire();
void A_BrakChase();
void A_BrakFireShot();
void A_BrakLobShot();
void A_NapalmScatter();
void A_SpawnFreshCopy();
void A_Explode(struct mobj_s *actor);
void A_Pain(struct mobj_s *actor);
void A_Fall(struct mobj_s *actor);
void A_MonitorPop(struct mobj_s *actor);
void A_Look(struct mobj_s *actor);
void A_Chase(struct mobj_s *actor);
void A_FaceStabChase(struct mobj_s *actor);
void A_FaceTarget(struct mobj_s *actor);
void A_FaceTracer(struct mobj_s *actor);
void A_Scream(struct mobj_s *actor);
void A_BossDeath(struct mobj_s *actor);
void A_CustomPower(struct mobj_s *actor); // Use this for a custom power
void A_GiveWeapon(struct mobj_s *actor); // Gives the player weapon(s)
void A_JumpShield(struct mobj_s *actor); // Obtained Jump Shield
void A_RingShield(struct mobj_s *actor); // Obtained Ring Shield
void A_RingBox(struct mobj_s *actor); // Obtained Ring Box Tails
void A_Invincibility(struct mobj_s *actor); // Obtained Invincibility Box
void A_SuperSneakers(struct mobj_s *actor); // Obtained Super Sneakers Box
void A_BunnyHop(struct mobj_s *actor); // have bunny hop tails
void A_BubbleSpawn(struct mobj_s *actor); // Randomly spawn bubbles
void A_FanBubbleSpawn(struct mobj_s *actor);
void A_BubbleRise(struct mobj_s *actor); // Bubbles float to surface
void A_BubbleCheck(struct mobj_s *actor); // Don't draw if not underwater
void A_AwardScore(struct mobj_s *actor);
void A_ExtraLife(struct mobj_s *actor); // Extra Life
void A_BombShield(struct mobj_s *actor); // Obtained Bomb Shield
void A_WaterShield(struct mobj_s *actor); // Obtained Water Shield
void A_ForceShield(struct mobj_s *actor); // Obtained Force Shield
void A_PityShield(struct mobj_s *actor); // Obtained Pity Shield. We're... sorry.
void A_GravityBox(struct mobj_s *actor);
void A_ScoreRise(struct mobj_s *actor); // Rise the score logo
void A_ParticleSpawn(struct mobj_s *actor);
void A_AttractChase(struct mobj_s *actor); // Ring Chase
void A_DropMine(struct mobj_s *actor); // Drop Mine from Skim or Jetty-Syn Bomber
void A_FishJump(struct mobj_s *actor); // Fish Jump
void A_ThrownRing(struct mobj_s *actor); // Sparkle trail for red ring
void A_GrenadeRing(struct mobj_s *actor); // SRB2kart
void A_SetSolidSteam(struct mobj_s *actor);
void A_UnsetSolidSteam(struct mobj_s *actor);
void A_SignPlayer(struct mobj_s *actor);
void A_OverlayThink(struct mobj_s *actor);
void A_JetChase(struct mobj_s *actor);
void A_JetbThink(struct mobj_s *actor); // Jetty-Syn Bomber Thinker
void A_JetgThink(struct mobj_s *actor); // Jetty-Syn Gunner Thinker
void A_JetgShoot(struct mobj_s *actor); // Jetty-Syn Shoot Function
void A_ShootBullet(struct mobj_s *actor); // JetgShoot without reactiontime setting
void A_MinusDigging(struct mobj_s *actor);
void A_MinusPopup(struct mobj_s *actor);
void A_MinusCheck(struct mobj_s *actor);
void A_ChickenCheck(struct mobj_s *actor);
void A_MouseThink(struct mobj_s *actor); // Mouse Thinker
void A_DetonChase(struct mobj_s *actor); // Deton Chaser
void A_CapeChase(struct mobj_s *actor); // Fake little Super Sonic cape
void A_RotateSpikeBall(struct mobj_s *actor); // Spike ball rotation
void A_SlingAppear(struct mobj_s *actor);
void A_MaceRotate(struct mobj_s *actor);
void A_UnidusBall(struct mobj_s *actor);
void A_RockSpawn(struct mobj_s *actor);
void A_SetFuse(struct mobj_s *actor);
void A_CrawlaCommanderThink(struct mobj_s *actor); // Crawla Commander
void A_SmokeTrailer(struct mobj_s *actor);
void A_RingExplode(struct mobj_s *actor);
void A_OldRingExplode(struct mobj_s *actor);
void A_MixUp(struct mobj_s *actor);
void A_RecyclePowers(struct mobj_s *actor);
void A_BossScream(struct mobj_s *actor);
void A_Boss2TakeDamage(struct mobj_s *actor);
void A_GoopSplat(struct mobj_s *actor);
void A_Boss2PogoSFX(struct mobj_s *actor);
void A_Boss2PogoTarget(struct mobj_s *actor);
void A_EggmanBox(struct mobj_s *actor);
void A_TurretFire(struct mobj_s *actor);
void A_SuperTurretFire(struct mobj_s *actor);
void A_TurretStop(struct mobj_s *actor);
void A_JetJawRoam(struct mobj_s *actor);
void A_JetJawChomp(struct mobj_s *actor);
void A_PointyThink(struct mobj_s *actor);
void A_CheckBuddy(struct mobj_s *actor);
void A_HoodThink(struct mobj_s *actor);
void A_ArrowCheck(struct mobj_s *actor);
void A_SnailerThink(struct mobj_s *actor);
void A_SharpChase(struct mobj_s *actor);
void A_SharpSpin(struct mobj_s *actor);
void A_VultureVtol(struct mobj_s *actor);
void A_VultureCheck(struct mobj_s *actor);
void A_SkimChase(struct mobj_s *actor);
void A_SkullAttack(struct mobj_s *actor);
void A_LobShot(struct mobj_s *actor);
void A_FireShot(struct mobj_s *actor);
void A_SuperFireShot(struct mobj_s *actor);
void A_BossFireShot(struct mobj_s *actor);
void A_Boss7FireMissiles(struct mobj_s *actor);
void A_Boss1Laser(struct mobj_s *actor);
void A_FocusTarget(struct mobj_s *actor);
void A_Boss4Reverse(struct mobj_s *actor);
void A_Boss4SpeedUp(struct mobj_s *actor);
void A_Boss4Raise(struct mobj_s *actor);
void A_SparkFollow(struct mobj_s *actor);
void A_BuzzFly(struct mobj_s *actor);
void A_GuardChase(struct mobj_s *actor);
void A_EggShield(struct mobj_s *actor);
void A_SetReactionTime(struct mobj_s *actor);
void A_Boss1Spikeballs(struct mobj_s *actor);
void A_Boss3TakeDamage(struct mobj_s *actor);
void A_Boss3Path(struct mobj_s *actor);
void A_LinedefExecute(struct mobj_s *actor);
void A_PlaySeeSound(struct mobj_s *actor);
void A_PlayAttackSound(struct mobj_s *actor);
void A_PlayActiveSound(struct mobj_s *actor);
void A_1upThinker(struct mobj_s *actor);
void A_BossZoom(struct mobj_s *actor); //Unused
void A_Boss1Chase(struct mobj_s *actor);
void A_Boss2Chase(struct mobj_s *actor);
void A_Boss2Pogo(struct mobj_s *actor);
void A_Boss7Chase(struct mobj_s *actor);
void A_BossJetFume(struct mobj_s *actor);
void A_SpawnObjectAbsolute(struct mobj_s *actor);
void A_SpawnObjectRelative(struct mobj_s *actor);
void A_ChangeAngleRelative(struct mobj_s *actor);
void A_ChangeAngleAbsolute(struct mobj_s *actor);
void A_RollAngle(struct mobj_s *actor);
void A_ChangeRollAngleRelative(struct mobj_s *actor);
void A_ChangeRollAngleAbsolute(struct mobj_s *actor);
void A_PlaySound(struct mobj_s *actor);
void A_FindTarget(struct mobj_s *actor);
void A_FindTracer(struct mobj_s *actor);
void A_SetTics(struct mobj_s *actor);
void A_SetRandomTics(struct mobj_s *actor);
void A_ChangeColorRelative(struct mobj_s *actor);
void A_ChangeColorAbsolute(struct mobj_s *actor);
void A_MoveRelative(struct mobj_s *actor);
void A_MoveAbsolute(struct mobj_s *actor);
void A_Thrust(struct mobj_s *actor);
void A_ZThrust(struct mobj_s *actor);
void A_SetTargetsTarget(struct mobj_s *actor);
void A_SetObjectFlags(struct mobj_s *actor);
void A_SetObjectFlags2(struct mobj_s *actor);
void A_RandomState(struct mobj_s *actor);
void A_RandomStateRange(struct mobj_s *actor);
void A_DualAction(struct mobj_s *actor);
void A_RemoteAction(struct mobj_s *actor);
void A_ToggleFlameJet(struct mobj_s *actor);
void A_ItemPop(struct mobj_s *actor); // SRB2kart
void A_JawzChase(struct mobj_s *actor); // SRB2kart
void A_JawzExplode(struct mobj_s *actor); // SRB2kart
void A_SPBChase(struct mobj_s *actor); // SRB2kart
void A_MineExplode(struct mobj_s *actor); // SRB2kart
void A_BallhogExplode(struct mobj_s *actor); // SRB2kart
void A_LightningFollowPlayer(struct mobj_s *actor); // SRB2kart: Lightning shield effect player chasing
void A_FZBoomFlash(struct mobj_s *actor); // SRB2kart
void A_FZBoomSmoke(struct mobj_s *actor); // SRB2kart
void A_RandomShadowFrame(struct mobj_s *actor); //SRB2kart: Shadow spawner frame randomizer
void A_RoamingShadowThinker(struct mobj_s *actor); // SRB2kart: Roaming Shadow moving + attacking players.
void A_MayonakaArrow(struct mobj_s *actor); //SRB2kart: midnight channel arrow sign
void A_ReaperThinker(struct mobj_s *actor); //SRB2kart: mementos reaper
void A_MementosTPParticles(struct mobj_s *actor); //SRB2kart: mementos teleporter particles. Man that's a lot of actions for my shite.
void A_FlameParticle(struct mobj_s *actor); // SRB2kart
void A_OrbitNights(struct mobj_s *actor);
void A_GhostMe(struct mobj_s *actor);
void A_SetObjectState(struct mobj_s *actor);
void A_SetObjectTypeState(struct mobj_s *actor);
void A_KnockBack(struct mobj_s *actor);
void A_PushAway(struct mobj_s *actor);
void A_RingDrain(struct mobj_s *actor);
void A_SplitShot(struct mobj_s *actor);
void A_MissileSplit(struct mobj_s *actor);
void A_MultiShot(struct mobj_s *actor);
void A_InstaLoop(struct mobj_s *actor);
void A_Custom3DRotate(struct mobj_s *actor);
void A_SearchForPlayers(struct mobj_s *actor);
void A_CheckRandom(struct mobj_s *actor);
void A_CheckTargetRings(struct mobj_s *actor);
void A_CheckRings(struct mobj_s *actor);
void A_CheckTotalRings(struct mobj_s *actor);
void A_CheckHealth(struct mobj_s *actor);
void A_CheckRange(struct mobj_s *actor);
void A_CheckHeight(struct mobj_s *actor);
void A_CheckTrueRange(struct mobj_s *actor);
void A_CheckThingCount(struct mobj_s *actor);
void A_CheckAmbush(struct mobj_s *actor);
void A_CheckCustomValue(struct mobj_s *actor);
void A_CheckCusValMemo(struct mobj_s *actor);
void A_SetCustomValue(struct mobj_s *actor);
void A_UseCusValMemo(struct mobj_s *actor);
void A_RelayCustomValue(struct mobj_s *actor);
void A_CusValAction(struct mobj_s *actor);
void A_ForceStop(struct mobj_s *actor);
void A_ForceWin(struct mobj_s *actor);
void A_SpikeRetract(struct mobj_s *actor);
void A_InfoState(struct mobj_s *actor);
void A_Repeat(struct mobj_s *actor);
void A_SetScale(struct mobj_s *actor);
void A_RemoteDamage(struct mobj_s *actor);
void A_HomingChase(struct mobj_s *actor);
void A_TrapShot(struct mobj_s *actor);
void A_VileTarget(struct mobj_s *actor);
void A_VileAttack(struct mobj_s *actor);
void A_VileFire(struct mobj_s *actor);
void A_BrakChase(struct mobj_s *actor);
void A_BrakFireShot(struct mobj_s *actor);
void A_BrakLobShot(struct mobj_s *actor);
void A_NapalmScatter(struct mobj_s *actor);
void A_SpawnFreshCopy(struct mobj_s *actor);
extern boolean actionsoverridden[NUMACTIONS];
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
#define NUMMOBJFREESLOTS 1024
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
// Hey, moron! If you change this table, don't forget about sprnames in info.c and the sprite lights in hw_light.c!
typedef enum sprite
{
SPR_NULL, // invisible object
+415
View File
@@ -0,0 +1,415 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by AJ "Tyron" Martinez.
// Copyright (C) 2024 by James Robert Roman.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file k_director.c
/// \brief SRB2kart automatic spectator camera.
//#include "k_kart.h"
#include "doomdef.h"
#include "doomstat.h"
#include "g_game.h"
#include "v_video.h"
#include "k_director.h"
#include "d_netcmd.h"
#include "p_local.h"
#include "st_stuff.h"
#define SWITCHTIME TICRATE * 5 // cooldown between unforced switches
#define BOREDOMTIME 3 * TICRATE / 2 // how long until players considered far apart?
#define TRANSFERTIME TICRATE // how long to delay reaction shots?
#define BREAKAWAYDIST 2000 // how *far* until players considered far apart?
#define WALKBACKDIST 400 // how close should a trailing player be before we switch?
#define PINCHDIST 20000 // how close should the leader be to be considered "end of race"?
struct directorinfo
{
player_t* viewplayer;
tic_t cooldown; // how long has it been since we last switched?
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
INT32 attacker; // who to switch to when freeze delay elapses
INT32 maxdist; // how far is the closest player from finishing?
INT32 sortedplayers[MAXPLAYERS]; // position-1 goes in, player index comes out.
INT32 gap[MAXPLAYERS]; // gap between a given position and their closest pursuer
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
} directorinfo;
static inline boolean race_rules(void)
{
return gametype == GT_RACE;
}
static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
{
return FixedMul(n, FixedDiv(scale, mapobjectscale));
}
boolean K_DirectorIsAvailable(void)
{
if (splitscreen || (demo.playback && demo.title) || modeattacking)
return false;
return ((gamestate == GS_LEVEL) && ((demo.playback && !camera[0].freecam) || (players[consoleplayer].spectator && (D_NumPlayers() > 1))));
}
static boolean K_DirectorIsEnabled(void)
{
return (cv_director.value && K_DirectorIsAvailable());
}
void K_InitDirector(void)
{
INT32 playernum;
directorinfo.cooldown = SWITCHTIME;
directorinfo.freeze = 0;
directorinfo.attacker = 0;
directorinfo.maxdist = 0;
directorinfo.viewplayer = NULL;
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
{
directorinfo.sortedplayers[playernum] = -1;
directorinfo.gap[playernum] = INT32_MAX;
directorinfo.boredom[playernum] = 0;
}
}
static fixed_t K_GetDistanceToFinish(player_t player)
{
mobj_t *mo;
fixed_t dist = 0;
INT16 maxMoveCount = -1;
INT16 maxAngle = -1;
if (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE))
{
for (mo = waypointcap; mo != NULL; mo = mo->tracer)
{
if (mo->spawnpoint->angle != 0)
continue;
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
mo->y - player.mo->y),
mo->z - player.mo->z) / FRACUNIT;
break;
}
}
else // crappy optimization weeeee
{
for (mo = waypointcap; mo != NULL; mo = mo->tracer)
{
if (mo->movecount > maxMoveCount)
maxMoveCount = mo->movecount;
if (mo->spawnpoint->angle > maxAngle)
maxAngle = mo->spawnpoint->angle;
if (!(mo->movecount == maxMoveCount && mo->spawnpoint->angle == maxAngle)) // sprint maps finishline waypoint is the one with highest movecount AND angle
continue;
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
mo->y - player.mo->y),
mo->z - player.mo->z) / FRACUNIT;
break;
}
}
return dist;
}
static fixed_t K_GetFinishGap(INT32 leader, INT32 follower)
{
fixed_t dista = K_GetDistanceToFinish(players[follower]);
fixed_t distb = K_GetDistanceToFinish(players[leader]);
if (players[follower].kartstuff[k_position] < players[leader].kartstuff[k_position])
{
return distb - dista;
}
else
{
return dista - distb;
}
}
static void K_UpdateDirectorPositions(void)
{
INT32 playernum;
INT32 position;
player_t* target;
memset(directorinfo.sortedplayers, -1, sizeof(directorinfo.sortedplayers));
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
{
target = &players[playernum];
if (playeringame[playernum] && !target->spectator && target->kartstuff[k_position] > 0)
{
directorinfo.sortedplayers[target->kartstuff[k_position] - 1] = playernum;
}
}
for (position = 0; position < MAXPLAYERS - 1; position++)
{
directorinfo.gap[position] = INT32_MAX;
if (directorinfo.sortedplayers[position] == -1 || directorinfo.sortedplayers[position + 1] == -1)
{
continue;
}
directorinfo.gap[position] = ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
if (directorinfo.gap[position] >= BREAKAWAYDIST)
{
directorinfo.boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfo.boredom[position] + 1));
}
else if (directorinfo.boredom[position] > 0)
{
directorinfo.boredom[position]--;
}
}
if (directorinfo.sortedplayers[0] == -1)
{
directorinfo.maxdist = -1;
return;
}
directorinfo.maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
}
static boolean K_CanSwitchDirector(void)
{
if (directorinfo.cooldown > 0)
{
return false;
}
return true;
}
static void K_DirectorSwitch(INT32 player, boolean force)
{
if (!K_DirectorIsEnabled())
{
return;
}
if (players[player].exiting)
{
return;
}
if (!force && !K_CanSwitchDirector())
{
return;
}
G_ResetView(1, player, true);
directorinfo.cooldown = SWITCHTIME;
}
static void K_DirectorForceSwitch(INT32 player, INT32 time)
{
if (players[player].exiting)
{
return;
}
directorinfo.attacker = player;
directorinfo.freeze = time;
}
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
{
if (!K_DirectorIsEnabled())
{
return;
}
if (directorinfo.viewplayer != player)
{
return;
}
if (inflictor && inflictor->player)
{
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME);
}
else if (source && source->player)
{
K_DirectorForceSwitch(source->player - players, TRANSFERTIME);
}
}
void K_DrawDirectorDebugger(void)
{
INT32 position;
INT32 leader;
INT32 follower;
INT32 ytxt;
if (!cv_kartdebugdirector.value)
{
return;
}
V_DrawThinString(10, 0, V_70TRANS, va("PLACE"));
V_DrawThinString(40, 0, V_70TRANS, va("CONF?"));
V_DrawThinString(80, 0, V_70TRANS, va("GAP"));
V_DrawThinString(120, 0, V_70TRANS, va("BORED"));
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfo.cooldown));
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfo.maxdist));
for (position = 0; position < MAXPLAYERS - 1; position++)
{
ytxt = 10 * (position + 1);
leader = directorinfo.sortedplayers[position];
follower = directorinfo.sortedplayers[position + 1];
if (leader == -1 || follower == -1)
break;
V_DrawThinString(10, ytxt, V_70TRANS, va("%d", position));
V_DrawThinString(20, ytxt, V_70TRANS, va("%d", position + 1));
if (players[leader].kartstuff[k_positiondelay])
{
V_DrawThinString(40, ytxt, V_70TRANS, va("NG"));
}
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfo.gap[position]));
if (directorinfo.boredom[position] >= BOREDOMTIME)
{
V_DrawThinString(120, ytxt, V_70TRANS, va("BORED"));
}
else
{
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfo.boredom[position]));
}
V_DrawThinString(150, ytxt, V_70TRANS, va("%s", player_names[leader]));
V_DrawThinString(230, ytxt, V_70TRANS, va("%s", player_names[follower]));
}
}
void K_UpdateDirector(void)
{
INT32 targetposition;
directorinfo.viewplayer = &players[displayplayers[0]];
if (!K_DirectorIsEnabled())
{
return;
}
K_UpdateDirectorPositions();
if (directorinfo.cooldown > 0) {
directorinfo.cooldown--;
}
// handle pending forced switches
if (directorinfo.freeze > 0)
{
if (!(--directorinfo.freeze))
K_DirectorSwitch(directorinfo.attacker, true);
return;
}
// if there's only one player left in the list, just switch to that player
if (directorinfo.sortedplayers[0] != -1 && (directorinfo.sortedplayers[1] == -1 ||
// TODO: Battle; I just threw this together quick. Focus on leader.
!race_rules()))
{
K_DirectorSwitch(directorinfo.sortedplayers[0], false);
return;
}
// aaight, time to walk through the standings to find the first interesting pair
// NB: targetposition/sortedplayers is 0-indexed, aiming at the "back half" of a given pair by default.
// we adjust for this when comparing to player->position or when looking at the leading player, Don't Freak Out
for (targetposition = 1; targetposition < MAXPLAYERS; targetposition++)
{
INT32 target;
// you are out of players, try again
if (directorinfo.sortedplayers[targetposition] == -1)
{
break;
}
// pair too far apart? try the next one
if (directorinfo.boredom[targetposition - 1] >= BOREDOMTIME)
{
continue;
}
// pair finished? try the next one
if (players[directorinfo.sortedplayers[targetposition]].exiting)
{
continue;
}
// don't risk switching away from forward pairs at race end, might miss something!
if (directorinfo.maxdist > PINCHDIST)
{
// if the "next" player is close enough, they should be able to see everyone fine!
// walk back through the standings to find a vantage that gets everyone in frame.
// (also creates a pretty cool effect w/ overtakes at speed)
while (targetposition < MAXPLAYERS && directorinfo.gap[targetposition] < WALKBACKDIST)
{
targetposition++;
}
}
target = directorinfo.sortedplayers[targetposition];
// stop here since we're already viewing this player
if (displayplayers[0] == target)
{
break;
}
// if we're certain the back half of the pair is actually in this position, try to switch
if (!players[target].kartstuff[k_positiondelay])
{
K_DirectorSwitch(target, false);
}
// even if we're not certain, if we're cetain we're watching the WRONG player, try to switch
if (directorinfo.viewplayer->kartstuff[k_position] != targetposition+1 && !directorinfo.viewplayer->kartstuff[k_positiondelay])
{
K_DirectorSwitch(target, false);
}
break;
}
}
void K_ToggleDirector(void)
{
if (!K_DirectorIsAvailable())
return;
if (!K_DirectorIsEnabled())
{
G_AdjustView(1, 1, true);
directorinfo.cooldown = 0; // switch immediately
}
directortoggletimer = 0;
CV_SetValue(&cv_director, (cv_director.value ^ 1));
}
+18
View File
@@ -0,0 +1,18 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by AJ "Tyron" Martinez.
// Copyright (C) 2024 by James Robert Roman.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file k_director.h
/// \brief SRB2kart automatic spectator camera.
boolean K_DirectorIsAvailable(void);
void K_InitDirector(void);
void K_UpdateDirector(void);
void K_DrawDirectorDebugger(void);
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
void K_ToggleDirector(void);
+1545 -949
View File
File diff suppressed because it is too large. Load diff
+14 -7
View File
@@ -11,6 +11,7 @@
#define KART_FULLTURN 800
extern UINT8 colortranslations[MAXTRANSLATIONS][16];
extern const char *KartColor_Names[MAXSKINCOLORS];
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
@@ -22,19 +23,25 @@ boolean K_UseColorHud(void);
void K_RegisterKartStuff(void);
extern consvar_t cv_colorizedhud;
extern consvar_t cv_colorizeditembox;
extern consvar_t cv_colorizedhudcolor;
extern consvar_t cv_coloredspeedlines, cv_coloredsneakertrail;
extern consvar_t cv_bananajitter;
extern consvar_t cv_bananthrowroll;
extern consvar_t cv_airsparks;
extern consvar_t cv_colorizedhud, cv_colorizeditembox, cv_colorizedhudcolor;
extern consvar_t cv_darkitembox;
extern consvar_t cv_biglaps;
extern consvar_t cv_highresportrait;
extern consvar_t cv_stat_xoffset;
extern consvar_t cv_stat_yoffset;
extern consvar_t cv_stat_xoffset, cv_stat_yoffset;
extern consvar_t cv_showstats;
extern consvar_t cv_fancyroulette;
extern consvar_t cv_showlaptimes;
extern consvar_t cv_battlespeedo;
extern consvar_t cv_multiitemicon;
extern consvar_t cv_huditemamount;
#define NUMSPEEDOSTUFF 6
extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
extern CV_PossibleValue_t driftgaugestyle_cons_t[NUMSPEEDOSTUFF];
boolean K_IsPlayerLosing(player_t *player);
boolean K_IsPlayerWanted(player_t *player);
@@ -54,7 +61,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
void K_StealBumper(player_t *player, player_t *victim, boolean force);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
void K_SpawnMineExplosion(mobj_t *source, UINT8 color);
void K_RollMobjBySlopes(mobj_t *mo, boolean usedistance);
void K_RollMobjBySlopes(mobj_t *mo, pslope_t *slope);
void K_SpawnBoostTrail(player_t *player);
void K_SpawnSparkleTrail(mobj_t *mo);
void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent);
@@ -91,7 +98,7 @@ void K_UpdateSpectateGrief(void);
void K_PlayAttackTaunt(mobj_t *source);
void K_PlayBoostTaunt(mobj_t *source);
void K_PlayOvertakeSound(mobj_t *source);
void K_PlayHitEmSound(mobj_t *source);
void K_PlayHitEmSound(mobj_t *source, mobj_t *victim);
void K_PlayPowerGloatSound(mobj_t *source);
const char *K_GetItemPatch(UINT8 item, boolean tiny);
-30
View File
@@ -1910,15 +1910,6 @@ msgstr ""
msgid " Not found: %s\n"
msgstr ""
#: hardware/s_ds3d/s_ds3d.c:617 p_tick.c:168 sdl/i_sound.c:1347
#: win32/win_snd.c:1073 win32/win_snd.c:1431
msgid "Done\n"
msgstr ""
#: hardware/s_ds3d/s_ds3d.c:617 win32/win_snd.c:1073
msgid "Failed\n"
msgstr ""
#: hu_stuff.c:375
msgid "The chat is muted. You can't say anything at the moment.\n"
msgstr ""
@@ -3174,21 +3165,6 @@ msgstr ""
msgid "I_ShutdownMusic: "
msgstr ""
#: sdl/i_sound.c:1494
msgid " disabled loading FMOD\n"
msgstr ""
#: sdl/i_sound.c:1513
msgid " failed to load FMOD\n"
msgstr ""
#: sdl/i_sound.c:1522 win32/win_snd.c:1237
#, c-format
msgid ""
"Wrong FMOD DLL version.\n"
"You should be using FMOD %s\n"
msgstr ""
#: sdl/i_sound.c:1611
msgid "I_InitMusic:"
msgstr ""
@@ -3803,12 +3779,6 @@ msgstr ""
msgid "%d mixer devices available\n"
msgstr ""
#: win32/win_snd.c:1227
msgid ""
" failed to load FMOD\n"
" no DigiMusic support\n"
msgstr ""
#: win32/win_snd.c:1289
msgid "No MIDI devices available, music is disabled\n"
msgstr ""
-30
View File
@@ -1994,15 +1994,6 @@ msgstr ""
msgid " Not found: %s\n"
msgstr ""
#: hardware/s_ds3d/s_ds3d.c:617 p_tick.c:168 sdl/i_sound.c:1347
#: win32/win_snd.c:1071 win32/win_snd.c:1429
msgid "Done\n"
msgstr ""
#: hardware/s_ds3d/s_ds3d.c:617 win32/win_snd.c:1071
msgid "Failed\n"
msgstr ""
#: hu_stuff.c:405
msgid "The chat is muted. You can't say anything at the moment.\n"
msgstr ""
@@ -3377,21 +3368,6 @@ msgstr ""
msgid "I_ShutdownMusic: "
msgstr ""
#: sdl/i_sound.c:1494
msgid " disabled loading FMOD\n"
msgstr ""
#: sdl/i_sound.c:1513
msgid " failed to load FMOD\n"
msgstr ""
#: sdl/i_sound.c:1522 win32/win_snd.c:1235
#, c-format
msgid ""
"Wrong FMOD DLL version.\n"
"You should be using FMOD %s\n"
msgstr ""
#: sdl/i_sound.c:1611
msgid "I_InitMusic:"
msgstr ""
@@ -3999,12 +3975,6 @@ msgstr ""
msgid "%d mixer devices available\n"
msgstr ""
#: win32/win_snd.c:1225
msgid ""
" failed to load FMOD\n"
" no DigiMusic support\n"
msgstr ""
#: win32/win_snd.c:1287
msgid "No MIDI devices available, music is disabled\n"
msgstr ""
+98 -11
View File
@@ -20,6 +20,7 @@
#include "m_random.h"
#include "s_sound.h"
#include "g_game.h"
#include "g_input.h"
#include "hu_stuff.h" // HU_AddChatText
#include "console.h"
#include "k_kart.h" // SRB2Kart
@@ -655,7 +656,7 @@ static int lib_pSpawnShadowMobj(lua_State *L)
NOHUD
if (!caster)
return LUA_ErrInvalid(L, "mobj_t");
caster->haveshadow = true;
P_SpawnShadowMobj(caster);
return 0;
}
@@ -1108,6 +1109,18 @@ static int lib_pCheckSight(lua_State *L)
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));
return 1;
}
static int lib_pCheckHoopPosition(lua_State *L)
{
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@@ -1258,6 +1271,7 @@ static int lib_pPlayRinglossSound(lua_State *L)
{
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
player_t *player = NULL;
mobj_t *damager = NULL;
NOHUD
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
@@ -1267,8 +1281,15 @@ static int lib_pPlayRinglossSound(lua_State *L)
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
if (!lua_isnoneornil(L, 3))
{
damager = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
if (!damager)
return LUA_ErrInvalid(L, "mobj_t");
}
if (!player || P_IsLocalPlayer(player))
P_PlayRinglossSound(source);
P_PlayRinglossSound(source, damager);
return 0;
}
@@ -1544,8 +1565,9 @@ static int lib_pSetSkyboxMobj(lua_State *L)
// Shhh, neither does P_StartQuake.
static int lib_pStartQuake(lua_State *L)
{
tic_t q_time = (tic_t)luaL_checkinteger(L, 2);
fixed_t q_intensity = luaL_checkinteger(L, 1);
UINT16 q_time = (UINT16)luaL_checkinteger(L, 2);
fixed_t q_radius = luaL_optinteger(L, 4, 512<<FRACBITS);
static mappoint_t q_epicenter = {0,0,0};
NOHUD
@@ -1597,11 +1619,8 @@ static int lib_pStartQuake(lua_State *L)
}
else
quake.epicenter = NULL;
quake.radius = luaL_optinteger(L, 4, 512*FRACUNIT);
// These things are actually used in 2.1.
quake.intensity = q_intensity;
quake.time = q_time;
P_StartQuake(q_time, q_intensity, q_radius);
return 0;
}
@@ -1810,7 +1829,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
S_StartSoundAtVolume(origin, sound_id, volume);
S_StartSoundAtVolume(origin, sound_id, volume);
return 0;
}
@@ -1912,7 +1931,7 @@ static int lib_sChangeMusic(lua_State *L)
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
else
#endif
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
position = (UINT32)luaL_optinteger(L, 5, 0);
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
@@ -2556,10 +2575,22 @@ static int lib_kOvertakeSound(lua_State *L)
static int lib_kHitEmSound(lua_State *L)
{
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *victim = NULL;
if (!lua_isnoneornil(L, 2))
{
victim = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
if (!victim)
return LUA_ErrInvalid(L, "mobj_t");
}
NOHUD
if (!mobj->player)
return luaL_error(L, "K_PlayHitEmSound: mobj_t isn't a player object."); //Nothing bad would happen if we let it run the func, but telling why it ain't doing anything is helpful.
K_PlayHitEmSound(mobj);
if (victim && !victim->player)
return luaL_error(L, "K_PlayHitEmSound: mobj_t isn't a player object."); //Same as above
K_PlayHitEmSound(mobj, victim);
return 0;
}
@@ -3000,6 +3031,58 @@ static int lib_kSetHyuCountdown(lua_State *L)
return 0;
}
// G_INPUT
////////////
static int lib_gSetPlayerGamepadIndicatorColor(lua_State *L)
{
INT32 player = -1;
player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
UINT16 color = (UINT16)luaL_checkinteger(L, 2); // skincolor
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
{
if (plr - players == displayplayers[i])
{
player = i;
break;
}
}
// Not a local player
if (player == -1) return 0;
// pls update with color 0 when youre done with changing led stuff so it can get player color again
G_SetPlayerGamepadIndicatorColor(player, color);
return 0;
}
static int lib_gPlayerDeviceRumble(lua_State *L)
{
INT32 player = -1;
player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
UINT16 low_strength = (UINT16)luaL_checkinteger(L, 2); // low frequency rumble motor strenght
UINT16 high_strength = (UINT16)luaL_checkinteger(L, 3); // high frequency rumble motor strenght
UINT32 duration = (UINT32)luaL_optinteger(L, 4, 84); // duration of rumble in ms
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
{
if (plr - players == displayplayers[i])
{
player = i;
break;
}
}
// Not a local player
if (player == -1) return 0;
G_PlayerDeviceRumble(player, low_strength, high_strength, duration);
return 0;
}
static luaL_Reg lib[] = {
{"print", lib_print},
{"chatprint", lib_chatprint},
@@ -3083,7 +3166,6 @@ static luaL_Reg lib[] = {
{"P_LookForEnemies",lib_pLookForEnemies},
{"P_NukeEnemies",lib_pNukeEnemies},
{"P_HomingAttack",lib_pHomingAttack},
//{"P_SuperReady",lib_pSuperReady},
{"P_Telekinesis",lib_pTelekinesis},
// p_map
@@ -3096,6 +3178,7 @@ 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},
@@ -3247,6 +3330,10 @@ static luaL_Reg lib[] = {
{"K_SetIndirectItemCooldown",lib_kSetIndirectItemCountdown},
{"K_SetHyudoroCooldown",lib_kSetHyuCountdown},
//g_input
{"G_SetPlayerGamepadIndicatorColor",lib_gSetPlayerGamepadIndicatorColor},
{"G_PlayerDeviceRumble",lib_gPlayerDeviceRumble},
{NULL, NULL}
};
+57 -14
View File
@@ -81,6 +81,9 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
lua_pushstring(gL, buf);
}
LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too.
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
return;
deny:
@@ -143,7 +146,7 @@ void COM_Lua_f(void)
if (netgame && !( flags & COM_LOCAL ))/* don't send local commands */
{ // Send the command through the network
UINT8 argc;
lua_pop(gL, 1); // pop command info table
lua_pop(gL, 2); // pop command info table and LUA_GetErrorMessage
if (flags & COM_ADMIN && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command.
{
@@ -166,7 +169,7 @@ void COM_Lua_f(void)
for (i = 0; i < argc; i++)
WRITESTRINGN(p, COM_Argv(i), 255);
if (flags & 2)
SendNetXCmd2(XD_LUACMD, buf, p-buf);
SendNetXCmdForPlayer(1, XD_LUACMD, buf, p-buf);
else
SendNetXCmd(XD_LUACMD, buf, p-buf);
free(buf);
@@ -182,6 +185,8 @@ void COM_Lua_f(void)
for (i = 1; i < COM_Argc(); i++)
lua_pushstring(gL, COM_Argv(i));
LUA_Call(gL, (int)COM_Argc(), 0, 1); // COM_Argc is 1-based, so this will cover the player we passed too.
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
}
// Wrapper for COM_AddCommand
@@ -453,9 +458,11 @@ static int lib_cvRegisterVar(lua_State *L)
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && stricmp(cvar->string, "0"))))
{
char *temp = NULL;
if (!category)
{
char *temp = strdup(wadfiles[numwadfiles - 1]->filename);
temp = strdup(wadfiles[numwadfiles - 1]->filename);
nameonly(temp);
category = temp;
@@ -465,6 +472,8 @@ static int lib_cvRegisterVar(lua_State *L)
M_SlotCvarIntoModMenu(cvar, category, menu_name);
else
M_SlotCvarIntoModMenu(cvar, category, cvar->name);
free (temp);
}
// return cvar userdata
@@ -580,27 +589,59 @@ static luaL_Reg lib[] = {
{NULL, NULL}
};
enum cvar_e
{
cvar_name,
cvar_defaultvalue,
cvar_flags,
cvar_value,
cvar_string,
cvar_changed,
};
static const char *const cvar_opt[] = {
"name",
"defaultvalue",
"flags",
"value",
"string",
"changed",
NULL,
};
static int cvar_fields_ref = LUA_NOREF;
static int cvar_get(lua_State *L)
{
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
const char *field = luaL_checkstring(L, 2);
enum cvar_e field = Lua_optoption(L, 2, -1, cvar_fields_ref);
if(fastcmp(field,"name"))
switch (field)
{
case cvar_name:
lua_pushstring(L, cvar->name);
else if(fastcmp(field,"defaultvalue"))
break;
case cvar_defaultvalue:
lua_pushstring(L, cvar->defaultvalue);
else if(fastcmp(field,"flags"))
break;
case cvar_flags:
lua_pushinteger(L, cvar->flags);
else if(fastcmp(field,"value"))
break;
case cvar_value:
lua_pushinteger(L, cvar->value);
else if(fastcmp(field,"string"))
break;
case cvar_string:
lua_pushstring(L, cvar->string);
else if(fastcmp(field,"changed"))
break;
case cvar_changed:
lua_pushboolean(L, cvar->changed);
else if (devparm)
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, field);
else
return 0;
break;
default:
if (devparm)
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, field);
else
return 0;
}
return 1;
}
@@ -612,6 +653,8 @@ int LUA_ConsoleLib(lua_State *L)
lua_setfield(L, -2, "__index");
lua_pop(L,1);
cvar_fields_ref = Lua_CreateFieldTable(L, cvar_opt);
// Set empty registry tables
lua_newtable(L);
lua_setfield(L, LUA_REGISTRYINDEX, "COM_Command");
+116 -89
View File
@@ -12,102 +12,129 @@
#include "r_defs.h"
#include "d_player.h"
#include "s_sound.h"
#include "lua_hudlib_drawlist.h"
enum hook {
hook_NetVars=0,
hook_MapChange,
hook_MapLoad,
hook_PlayerJoin,
hook_PreThinkFrame,
hook_ThinkFrame,
hook_PostThinkFrame,
hook_MobjSpawn,
hook_MobjCollide,
hook_MobjMoveCollide,
hook_TouchSpecial,
hook_MobjFuse,
hook_MobjThinker,
hook_BossThinker,
hook_ShouldDamage,
hook_MobjDamage,
hook_MobjDeath,
hook_BossDeath,
hook_MobjRemoved,
hook_JumpSpecial,
hook_AbilitySpecial,
hook_SpinSpecial,
hook_JumpSpinSpecial,
hook_BotTiccmd,
hook_BotAI,
hook_LinedefExecute,
hook_PlayerMsg,
hook_HurtMsg,
hook_PlayerSpawn,
hook_PlayerQuit,
hook_PlayerThink,
hook_MusicChange,
hook_ShouldSpin, //SRB2KART
hook_ShouldExplode, //SRB2KART
hook_ShouldSquish, //SRB2KART
hook_PlayerSpin, //SRB2KART
hook_PlayerExplode, //SRB2KART
hook_PlayerSquish, //SRB2KART
hook_PlayerCmd, //SRB2KART
hook_IntermissionThinker, //SRB2KART
hook_VoteThinker, //SRB2KART
/*
* Do you know what an 'X Macro' is? Such a macro is called over each element of
* a list and expands the input. I use it for the hook lists because both an enum
* and array of hook names need to be kept in order. The X Macro handles this
* automatically.
*/
hook_MAX // last hook
};
extern const char *const hookNames[];
#define MOBJ_HOOK_LIST(X) \
X (MobjSpawn),/* P_SpawnMobj */\
X (MobjCollide),/* PIT_CheckThing */\
X (MobjMoveCollide),/* tritto */\
X (TouchSpecial),/* P_TouchSpecialThing */\
X (MobjFuse),/* when mobj->fuse runs out */\
X (MobjThinker),/* P_MobjThinker, P_SceneryThinker */\
X (BossThinker),/* P_GenericBossThinker */\
X (ShouldDamage),/* P_DamageMobj (Should mobj take damage?) */\
X (MobjDamage),/* P_DamageMobj (Mobj actually takes damage!) */\
X (MobjDeath),/* P_KillMobj */\
X (BossDeath),/* A_BossDeath */\
X (MobjRemoved),/* P_RemoveMobj */\
X (HurtMsg),/* imhurttin */\
#define HOOK_LIST(X) \
X (NetVars),/* add to archive table (netsave) */\
X (MapChange),/* (before map load) */\
X (MapLoad),\
X (PlayerJoin),/* Got_AddPlayer */\
X (PreThinkFrame)/* frame (before mobj and player thinkers) */,\
X (ThinkFrame),/* frame (after mobj and player thinkers) */\
X (PostThinkFrame),/* frame (at end of tick, ie after overlays, precipitation, specials) */\
X (JumpSpecial),/* P_DoJumpStuff (Any-jumping) */\
X (AbilitySpecial),/* P_DoJumpStuff (Double-jumping) */\
X (SpinSpecial),/* P_DoSpinAbility (Spin button effect) */\
X (JumpSpinSpecial),/* P_DoJumpStuff (Spin button effect (mid-air)) */\
X (BotTiccmd),/* B_BuildTiccmd */\
X (PlayerMsg),/* chat messages */\
X (PlayerSpawn),/* G_SpawnPlayer */\
X (PlayerQuit),\
X (PlayerThink),/* P_PlayerThink */\
X (MusicChange),\
X (ShouldSpin),/*SRB2KART*/\
X (ShouldExplode),/*SRB2KART*/\
X (ShouldSquish),/*SRB2KART*/\
X (PlayerSpin),/*SRB2KART*/\
X (PlayerExplode),/*SRB2KART*/\
X (PlayerSquish),/*SRB2KART*/\
X (PlayerCmd),/* building the player's ticcmd struct (Ported from SRB2Kart) */\
X (IntermissionThinker),/* Y_Ticker */\
X (VoteThinker),/*SRB2KART*/\
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
#define STRING_HOOK_LIST(X) \
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
X (LinedefExecute),\
#define HUD_HOOK_LIST(X) \
X (game),\
X (scores),/* emblems/multiplayer list */\
X (intermission),\
X (vote),\
/*
* I chose to access the hook enums through a macro as well. This could provide
* a hint to lookup the macro's definition instead of the enum's definition.
* (Since each enumeration is not defined in the source code, but by the list
* macros above, it is not greppable.) The name passed to the macro can also be
* grepped and found in the lists above.
*/
#define MOBJ_HOOK(name) mobjhook_ ## name
#define HOOK(name) hook_ ## name
#define HUD_HOOK(name) hudhook_ ## name
#define STRING_HOOK(name) stringhook_ ## name
#define ENUM(X) enum { X ## _LIST (X) X(MAX) }
ENUM (MOBJ_HOOK);
ENUM (HOOK);
ENUM (HUD_HOOK);
ENUM (STRING_HOOK);
#undef ENUM
/* dead simple, LUA_HOOK(GameQuit) */
#define LUA_HOOK(type) LUA_HookVoid(HOOK(type))
#define LUA_HUDHOOK(type,drawlist) LUA_HookHUD(HUD_HOOK(type),(drawlist))
extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd.
extern int hook_defrosting;
void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
void LUAh_MapLoad(void); // Hook for map load
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
void LUAh_PreThinkFrame(void); // Hook for frame (before mobj and player thinkers)
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
void LUAh_PostThinkFrame(void); // Hook for frame (at end of tick, ie after overlays, precipitation, specials)
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
boolean LUAh_MobjThinker(mobj_t *mo); // Hook for P_MobjThinker or P_SceneryThinker by mobj type
#define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type
UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?)
boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!)
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping)
#define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping)
#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect)
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute); // Hook for chat messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping,
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
void LUA_HookVoid(int hook);
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
int LUA_HookMobj(mobj_t *, int hook);
int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook);
void LUA_HookInt(INT32 integer, int hook);
//void LUA_HookBool(boolean value, int hook);
int LUA_HookPlayer(player_t *, int hook);
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
boolean LUAh_PlayerSpin(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 LUAh_PlayerExplode(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 LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
void LUA_HookPreThinkFrame(void);
void LUA_HookThinkFrame(void);
void LUA_HookPostThinkFrame(void);
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher);
int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source);
int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd);
void LUA_HookLinedefExecute(line_t *, mobj_t *, sector_t *);
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute);
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source);
int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
void LUA_HookPlayerQuit(player_t *, int);
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
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.
Loaded 100 of 208 files, more files were not shown because too many files have changed in this diff. Show more