Compare commits

...
271 Commits
v4 ... v5
Author SHA1 Message Date
Alug 040faa4c1c Merge branch 'Saturn-Next' into Saturn 2023-12-17 13:29:30 +01:00
Alug 640934634d fix typo 2023-12-17 12:45:13 +01:00
Alug 9842815557 fix compiler warning 2023-12-16 19:11:54 +01:00
Alug 4d19769dd0 you forgor this X) 2023-12-16 14:55:26 +01:00
indev dd75012982 Simplify calculating transparency flags a bit 2023-12-16 11:36:16 +03:00
Alug 9d48ac5bad hide fpscounter when you hide the hud
this was so absolutely annoying sometimes lmao
2023-12-16 07:04:01 +01:00
Alug 0dc8f320a9 make fps counter and ping display also translucent 2023-12-16 07:03:37 +01:00
Alug c9e96949a3 v5 2023-12-15 23:34:53 +01:00
indev 2d70bd0c73 Merge pull request #83 from Indev450/gl3mipmaps
make mipmaps less stuttery
2023-12-16 00:37:34 +03:00
indev 3949add6af Fix NOHW compilation 2023-12-16 00:31:28 +03:00
indev b87eeaa873 Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-12-16 00:21:21 +03:00
Alug b56402a0a9 software sprites should do the same as opengl
no idea why it even was like that tbh

sliptiding was not toggable here

Fixes https://github.com/Indev450/SRB2Kart-Saturn/issues/82
2023-12-16 05:31:49 +01:00
indev b1a47f164e Fix birdmod map-music-resume feature not working in cases when you use grow with invincibility 2023-12-16 00:21:09 +03:00
indev 7fa0820a93 Merge pull request #81 from Indev450/hflip
FF_HORIZONTALFLIP and mobj->mirrored
2023-12-15 00:53:01 +03:00
Alug f2ad6199bf experiment: change max LOD to 16
suprisingly, this made stutters even less for some reason, will need to test things
2023-12-13 01:04:12 +01:00
indev 14f0e70a9b Retreive OpenGL version only once at startup 2023-12-13 00:31:49 +03:00
alufolie91 58147117be gl 1.4 and gl2 can use GL_GENERATE_MIPMAP
uhhhhhhh
2023-12-12 11:12:23 +01:00
Alug 5c4e00694a uh oops
accidentally broke polyobjects
2023-12-12 09:26:49 +01:00
alufolie91 8d123f5e83 use the old thing when gl version below 3.0
also should compile for those with gl version lower than 3 hopefully

uhhh idk if this even is right at all tbh
2023-12-12 08:25:59 +01:00
alufolie91 d78fb05be0 use glGenerateMipmap instead of gluBuild2DMipmaps
as advised by https://www.khronos.org/opengl/wiki/Common_Mistakes#gluBuild2DMipmaps

fixes the godawful stuttering everywhere with mipmaps enabled
2023-12-12 07:50:23 +01:00
alufolie91 b9124e717d i slep
Zzz...
2023-12-12 06:35:48 +01:00
alufolie91 84c2721d8b disable here instead of in function itself 2023-12-12 04:56:22 +01:00
Alug 1569ec7a8b shrug 2023-12-11 14:51:08 +01:00
Alug f741c3ff17 eee 2023-12-10 17:13:54 +01:00
Alug ff31eb7d17 Zzz... 2023-12-10 17:07:00 +01:00
Alug 52b5db7ad0 use hwr_useshader also in palshader
this ensures palshader stuff can only do things when shaders are on AND availible
2023-12-09 08:14:33 +01:00
Alug f10608ea2c smh 2023-12-09 07:52:47 +01:00
Alug 364eb1b0c8 clean up a little + add some comments 2023-12-09 07:52:11 +01:00
Alug 0e2d793a7a add HWR_UseShader bool for shader stuff
just to make things look neater
2023-12-09 07:42:13 +01:00
Alug 9b8c569c9e reorder things a little 2023-12-09 07:38:12 +01:00
Alug 9402a006f4 FF_HORIZONTALFLIP and mobj->mirrored
from: https://git.do.srb2.org/STJr/SRB2/-/merge_requests/987
2023-12-07 18:35:27 +01:00
Alug 6aae3d5f90 more accurate transparent fof plane brigthness for palrendering mode 2023-12-07 17:54:27 +01:00
Alug b5cdc0ca94 just use simple boolean for flashpal
more sane than whatever tf it was before
2023-12-07 00:13:45 +01:00
Alug 28c0339261 a 2023-12-06 23:31:46 +01:00
alufolie91 d7cb89a232 Merge remote-tracking branch 'origin/hayaautoload' into Saturn-Next 2023-12-06 23:29:31 +01:00
hayaunderscore 98b132fcc4 use partialaddwadfile for addon autoload 2023-12-06 17:25:26 +01:00
alufolie91 37377a42e6 postload 2023-12-06 17:25:20 +01:00
hayaunderscore 088f1800ff AUTOLOADING HECK YEAH 2023-12-06 17:24:54 +01:00
alufolie91 a96fb7d247 prevent tab rankings from crashing when map has no name
thought i already did that lol
2023-12-05 22:18:32 +01:00
Alug ca30725f8d more stuff 2023-12-05 01:37:10 +01:00
Alug 6d8337dbad more zzz... 2023-12-05 01:21:50 +01:00
Alug 6a8360ab46 revert R_PointOnSegSide
no idea, was just guesswork and might actually slow things down so i revert it
2023-12-05 01:11:39 +01:00
Alug ddeb438a29 clean up colour hud a little 2023-12-05 01:06:41 +01:00
Alug 11fdaf1515 lol 2023-12-05 00:50:33 +01:00
Alug 7c68d50548 move stuff in pause menu Zzz... 2023-12-05 00:45:13 +01:00
Alug c81a434f0b was a bit ugly 2023-12-05 00:25:27 +01:00
alufolie91 c88f3dc302 Revert "Port Prevent dropped ticcmds due to interp timing jutter from srb2-next"
This reverts commit fed1b23b8b.
2023-12-04 23:51:24 +01:00
alufolie91 ffb22a954f forgor some of those 2023-12-04 23:46:20 +01:00
hayaunderscore 31f9937d7e Fix horizon lines not rendering with portals + fix portal wall z-fighting 2023-12-04 10:28:29 +01:00
Alug 1abdc6c747 Revert "Fix horizon lines not rendering on levels with portals"
This reverts commit ccb2c4ef18.
2023-12-03 22:36:28 +01:00
indev 122cb918a1 Merge pull request #80 from Indev450/musictest
Musictest
2023-12-03 14:30:39 +03:00
hayaunderscore a92f05b864 MUSCINFO
separate lump for music test stuff
2023-12-03 02:39:16 +01:00
alufolie91 a457bc4187 :chonkbuncle: 2023-12-02 22:51:55 +01:00
alufolie91 bb5b888aef Merge branch 'Saturn-Next' into musictest 2023-12-02 21:24:52 +01:00
alufolie91 2797fa9a05 add global toggle for bird music things + move stuff to s_sound
well reason a global toggle is, cause stuff always does stuff even when "disabled" and i cant be assed trying to unmangle this mess

like this we can just turn off everything and game behaves like vanilla

default is off so everythings disabled

if someone wants to do a better approach go ahead
2023-12-01 19:14:15 +01:00
alufolie91 7d5c63d8ee assign bool instead of if else thing 2023-12-01 16:39:47 +01:00
alufolie91 39b70b3686 add drawstretchypatch lua support 2023-12-01 16:13:45 +01:00
alufolie91 34933fdf82 optimise span drawers a little 2023-12-01 15:25:47 +01:00
hayaunderscore ccb2c4ef18 Fix horizon lines not rendering on levels with portals 2023-12-01 09:38:09 +01:00
alufolie91 ea5ac63e0f a 2023-12-01 09:36:40 +01:00
indev de04223443 Merge pull request #78 from Indev450/opengl-polyobj-nozcalloc
Opengl polyobj nozcalloc
2023-11-30 20:13:17 +03:00
indev 20467bdc1e Merge pull request #79 from Indev450/anigif-optimization
Optimize gif recording in opengl a bit
2023-11-30 20:12:50 +03:00
alufolie91 fc458128cf show file of where the music comes from + toggle
ty indev c:
2023-11-28 11:42:46 +01:00
Alug e57ad13004 align stuff proper + make it kart menu blue 2023-11-28 09:39:02 +01:00
alufolie91 88e8c0541b show some music info on bottom right when playing in music test
also allows the game to read "usage" from musicdefs
2023-11-28 07:34:03 +01:00
indev 2a3a63ca28 Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-28 01:46:43 +03:00
indev c2ddac2c1e Allow using localskins for any kind of mobj from lua 2023-11-28 01:46:28 +03:00
alufolie91 9de9b72940 do the same for lighttable tex 2023-11-27 22:34:02 +01:00
alufolie91 4cb3b5bc0d fix hudcolor when returning from time attacking 2023-11-27 22:28:28 +01:00
alufolie91 dc190be6b3 Zzz...
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2023-11-27 21:58:28 +01:00
alufolie91 0373b19269 hopefully fix older hardware crashing even if they dont use palshader
also guard the last InitPalette, we do not need to call it if we dont use palshader

also if either pglTexImage3D or ltcachetail->id is null, the game wont crash now, instead returns, and turns off the palshader so all should work hopefully
2023-11-27 21:46:18 +01:00
Alug 3610096c35 this always annoyed me
why was it always offcenter like that?
2023-11-27 19:05:17 +01:00
Alug 2b75d0b26b replace those with gl error messages instead 2023-11-27 18:35:38 +01:00
Alug a27dc33e25 1 extra row
hope this right lul
2023-11-27 15:58:13 +01:00
Alug 3718c5bd51 fix small gap on some resolutions 2023-11-27 15:45:44 +01:00
Alug a256e170ab fix interpolation speeding things up + make box wider 2023-11-27 15:37:22 +01:00
Alug 2009ed38f0 we dont have that stuff so remove it 2023-11-27 15:19:21 +01:00
indev 7599d9ddd4 Fix assigning null character out of string bounds 2023-11-27 17:06:38 +03:00
indev 0907c219af Change maximum string length for name in music test 2023-11-27 16:57:38 +03:00
indev 0ae1f2606f Merge branch 'musictest' of ssh://github.com/Indev450/SRB2Kart-Saturn into musictest 2023-11-27 16:49:54 +03:00
indev 2abb65403f Make music names in music test scroll 2023-11-27 16:49:48 +03:00
alufolie91 223e858d00 musictest should return you to music options menu 2023-11-27 14:25:26 +01:00
alufolie91 2769847c90 remove unused things + move stuff around
e
2023-11-27 14:13:15 +01:00
alufolie91 0fc3d9d4d6 do NOT change how sound freeslotting works
reasons
2023-11-27 14:03:54 +01:00
alufolie91 d6702be08b make it its own thing, add back normal sound test 2023-11-27 13:58:35 +01:00
alufolie91 d41c7bedd8 port musictest from srb2 + making it not crash
thing is super ugly, also replaces current sound test for now, which needs to be fixed
2023-11-27 13:23:53 +01:00
alufolie91 d0f9993385 add more stuff to experimental video menu + smol cleanup
might aswell add the other things
2023-11-27 06:09:02 +01:00
Alug caf05f5923 e 2023-11-27 05:48:02 +01:00
Alug cc996759be add stuff the experimental video stuff
idk description could be better but i suck at writing lmao

those three things were introduced back in v.5.3  internal (before release) which was the version which had some performance regression

those were looked into and from my testing saturn often performs better than vanilla

however those features still may tax computers from others, so i decided to make toggles for those things
2023-11-27 05:35:20 +01:00
Alug 51de2a4610 Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-27 05:21:31 +01:00
Alug e15c9558fa toggle for slope midtexture pegging fix
also fixes a wrong ESLOPE ifdef
2023-11-27 05:21:26 +01:00
Alug 29edb49861 toggle for slope midtexture pegging fix 2023-11-27 05:20:33 +01:00
Alug 7ce3d0c733 add toggle for texture zfight fix 2023-11-27 04:40:13 +01:00
Alug fb8cdbb9cc only do it like that in pal rendering mode 2023-11-27 04:23:28 +01:00
Alug 882554a3fe splitwallfix toggle
idk maybe some still get worse performance from this
2023-11-27 04:10:39 +01:00
indev 40a8554cc9 Attempt to fix rare 'server player kick' bug 2023-11-26 23:52:07 +03:00
alufolie91 146a80e91c Dont mark this shit as modify doofus 2023-11-25 10:38:24 +01:00
hayaunderscore b533dbee55 Localskin support probably 2023-11-25 10:37:48 +01:00
hayaunderscore 3ede4eb1a6 Remove this dumb debug print 2023-11-25 10:37:43 +01:00
hayaunderscore 5813c2b3c3 Experimental SPRTINFO support
Based of leftover code from patch rotation
2023-11-25 10:37:35 +01:00
NepDisk 2b1dc82bfa Fix complilation due to menu code 2023-11-25 00:55:29 +03:00
NepDisk 0b59c156a0 Merge branch 'cleanedupcharpicker' into stacking-dev
Merge the new character select menu I created
2023-11-23 08:58:27 +01:00
NepDisk 03fb7fd145 Oops forgot to remove this 2023-11-23 08:58:04 +01:00
NepDisk f99e516e63 SkinSearch command. 2023-11-23 08:57:55 +01:00
Alug f62642f855 your hudcolor choice should overwrite everything else
also "fixes" the splitscreen issue thats been mentioned,
now whichever hudcolor you choose gets applied, regardless of splitscreen or if you sswitch viewpoints
2023-11-22 20:54:19 +01:00
NepDisk 3adad0ed18 Add Saturn peeps to credits :D 2023-11-22 09:10:26 +01:00
Alug 429976faf8 a 2023-11-22 08:27:16 +01:00
Alug 1d40c26fd9 make players snap when looking back and using sloperoll
always looked a bit weird tbh
2023-11-22 06:47:42 +01:00
indev 4c730ec84d Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-22 01:48:59 +03:00
indev 2d25fabe64 Fix few missing packet type names in d_net.c 2023-11-22 01:48:41 +03:00
Alug 095ec063fb spriteoffsets should be 0 + a little more oraganized 2023-11-21 22:22:03 +01:00
NepDisk ab8d3e2642 Change default offset so stat display doesn't go over mr 2023-11-21 19:41:59 +01:00
Alug cbd59a04f6 toggle for localskin menus
well wanna be able to toggle things
2023-11-21 17:34:07 +01:00
Alug e49e6b8998 toggle for playing music while paused 2023-11-21 17:02:10 +01:00
alufolie91 02cd4e753d make software horizonlines also extend fofs 2023-11-20 22:40:41 +01:00
indev d06f923066 Fix filesearch trying to open file symlinks as directory 2023-11-20 16:10:02 +03:00
Alug bb9f7c8196 also hide the other localskin menu in option menu when youre server 2023-11-19 08:46:34 +01:00
Alug bf2c786a02 make pause menu look more like vanilla now that some things get disabled
I HATE MENU CODE AAAAAAAAAAAAa
2023-11-19 08:02:13 +01:00
alufolie91 7d66da2b94 lol 2023-11-19 06:43:29 +01:00
hayaunderscore f346f075ee Fix localskin options not being available for server admins 2023-11-19 06:10:53 +01:00
Alug 38c612a752 add "find" command to search for for cvars
its better than "help", more organized and it shows any variable containing what you searched for

from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2217
2023-11-19 02:27:42 +01:00
Alug d77ccd0dfc fixeur symlinks
i hope
2023-11-19 01:28:28 +01:00
Alug 7ba146b4ff Improve file search performance on Linux and FreeBSD
from: https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2198
2023-11-19 00:56:18 +01:00
Alug cf8ef69fed fix an overflow crash in terminal lul
could hold down the a key before and make the game crash

from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2206
2023-11-19 00:51:27 +01:00
indev 2f5b894c47 Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-18 19:41:06 +03:00
indev e248b85380 Apply translucenthud for the VIEWPOINT text 2023-11-18 19:40:58 +03:00
NepDisk 84cc8d10a7 Quick bug fix for pages 2023-11-18 06:18:07 +01:00
NepDisk 0b4e70faf3 perfstats for PreThinkFrame and PostThinkFrame plus small rewrite 2023-11-18 06:14:03 +01:00
alufolie91 78018e1f78 I_SetSongTrack(int) should be I_SetSongTrack(INT32)
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2213
2023-11-18 05:13:04 +01:00
alufolie91 7a2f925078 Make module music volume more accurate
from https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2215
2023-11-18 05:09:45 +01:00
Alug ec1123251f fix sliptide toggle for 3d models 2023-11-17 23:45:17 +01:00
Alug cc408cc859 fix not being able to close warning screen when a mod spams warnings
lmao
2023-11-17 23:28:53 +01:00
Alug 16f8299c4a fix admin menu stuff
uuuuhhh
2023-11-17 20:48:27 +01:00
alufolie91 10953dbb3a add toggle to hide player ip addresses in nodes or listplayers command
also add "listplayers" command, which is pretty much the same as "nodes" but with colors and it looks better

tho kept "nodes" command just in case its needed for smth
2023-11-17 20:29:07 +01:00
NepDisk 49aaa25255 Mouse Controls for saturn 2023-11-17 18:10:14 +01:00
indev ccbb894a6b Remove repeating code in VHS effect 2023-11-16 21:16:56 +03:00
indev 54542031a1 Fix the opengl VHS effect on linux 2023-11-16 20:20:49 +03:00
NepDisk ff04b83ec0 English (UK) 2023-11-16 18:06:35 +01:00
NepDisk b03faeff25 Do highresportaits for saturn specfically 2023-11-16 18:06:29 +01:00
alufolie91 d1becfcf0c this is better
like srb2 does it, but kk forgor
2023-11-16 17:19:13 +01:00
Alug 3c078c6676 uhh should be fixed_t or not? 2023-11-16 03:23:17 +01:00
alufolie91 4e6dc92033 fix "Resynching..." speeding up with interpolation
:p
2023-11-16 03:15:18 +01:00
Alug 8d607594ff add stuff to menu 2023-11-15 23:38:36 +01:00
Alug 71486a4982 opengl vhs effect
im in so much pain
2023-11-15 23:17:42 +01:00
Alug 9ae1f20735 actually only do it if its not centered 2023-11-15 21:24:39 +01:00
Alug 53febafd50 eeh do it later
idk looks better imo
2023-11-15 20:53:25 +01:00
alufolie91 7f7ea2c592 reset camera when joining from spec
camera look never got reset when you enter a game from spec, so if you looked up or down, you also did so ingame lol
2023-11-15 20:47:28 +01:00
Alug dc1dfe0d4d smh 2023-11-15 20:13:19 +01:00
alufolie91 48e3c14d30 hide screentex toggle in software
its an opengl only thing, so no need to toggle if in software mode
2023-11-15 20:09:09 +01:00
alufolie91 16b3687774 forgor 2023-11-15 19:58:13 +01:00
Alug cf101ccc5d add "experimental video options" menu
for a few things that might be interesting for some

also make some adjustments
2023-11-15 19:51:05 +01:00
Alug d04a6ad5ee Add more cvars to menu and lower minimum vote time 2023-11-15 19:45:22 +01:00
NepDisk 840c7ea154 Update speedometer code to refernce new values 2023-11-15 19:39:06 +01:00
NepDisk 268300913d fix for real this time 2023-11-15 19:39:01 +01:00
NepDisk 7a4ef35e7b forgot discord support ugh... 2023-11-15 19:38:33 +01:00
Alug 84140f3faa Revert "why did i remove this back then??"
i saw what this did again
fix for avoiding precip crash, cause precip doesent have that stuff

This reverts commit 2e4e0a8554538c841fb4c7be63449b32365d6bc0.
2023-11-15 10:12:07 +01:00
NepDisk 673a03e033 Stat display enable and disable luahook 2023-11-14 20:59:38 +01:00
Alug 32d4a38b9e just always reset palette regardless
the palshader palette however only gets reset when you enter palshader mode

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2023-11-14 20:06:11 +01:00
Alug 7cc4d1f601 simplify this stuff
idk why i didnt do it like this in the first place tbh

no need for 3 seperate onchanges, i can just do shit like this

all of them pretty much did the same anyways

now the shader and all two palshader toggles reset palette stuff when it detects that youre in palrender mode aaaA
2023-11-14 20:02:07 +01:00
Alug 25e60a9882 ugh toggling shaders also needs to reset palette shit sometimes 2023-11-14 19:35:37 +01:00
Alug 79582ce73d we use them tho its good to future proof just in case 2023-11-14 18:31:19 +01:00
NepDisk 3526a52827 Allow holepunching to be disabled via a new define plus part 2 to masterserver 2023-11-14 18:29:48 +01:00
NepDisk 4b8bc46358 Master server 'b gone. Makes disabling the define actually alone the compile to work 2023-11-14 18:29:34 +01:00
Alug ddd6488b55 Fix typos and reword some stuff 2023-11-14 18:27:20 +01:00
Alug dfccca4026 Add a toggle to cut precip in half
ye this pretty much cuts the weather thinker count in half

since weather spawns all mobjs regardless of distance setting
its  good for ppl who like weather effects but have weaker hardware
2023-11-14 06:08:38 +01:00
Alug d33c1e83de Revert "refactor weather switching"
This reverts commit 873a611b33b0a3ef62633c1e8327c86ab0617655.

eeh i dont trust it tbh
2023-11-14 02:32:56 +01:00
alufolie91 2ffc7293af screw it, revamp the whole thing
blurgh like this theres never a condition where paletteshader shit runs even if you have shaders turned off and stuff
2023-11-13 22:44:23 +01:00
Alug fde184b7a7 Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-13 21:52:25 +01:00
Alug 7163194ce9 fixup paletteshader stuff
uaghgegheuaghuagheghg

now every dumb edge case should be covered
and the palette should never turn to garbage if you toggle stuff around
2023-11-13 21:52:18 +01:00
indev ec97111d26 Make K_GetHudColor use player skincolor instead of color cvar when possible. Also fix compilation warning 2023-11-13 21:38:13 +03:00
Alug 6d24d5a44a reset palshader lookup if you toggle the thing
otherwise it can sometimes screw up and show garbage colors when toggling

idk if this is the right way tho
2023-11-13 18:53:56 +01:00
NepDisk 3700dc3bae Fix P-meter speedo not scaling on mobjscaled map 2023-11-13 01:23:44 +01:00
indev 6114bdd9dc Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-13 01:36:01 +03:00
indev 2fe912eebf Fix compilation with NOTHREADS 2023-11-13 01:35:49 +03:00
Alug ccf6840cd5 forgor and fixuer typos :p 2023-11-12 18:21:16 +01:00
alufolie91 955c7f0cfb remove some tooltips for things we dont have 2023-11-12 17:56:59 +01:00
alufolie91 994fd6354f fix kk typo lol
fixes the X symbol with itembox offsets changed
2023-11-12 17:30:08 +01:00
indev 30602a8eb7 Fix crash related to localskins and stat display 2023-11-12 19:10:51 +03:00
alufolie91 2290c1955b oops we dont have that menu lol 2023-11-12 17:04:45 +01:00
hayaunderscore f167db0cc6 Fix weird stutter on grow and invinc music stutters 2023-11-12 17:00:44 +01:00
hayaunderscore 42e04ce981 haya you fucking dumbass
never use mo->player here again
2023-11-12 16:59:15 +01:00
Alug 41cf467f2a Revert "Revert "localskin rework incoming!!!!!""
This reverts commit 25b5e5f510.
2023-11-12 16:58:26 +01:00
alufolie91 2ca7c8178f Implement tooltips for rest of the menus (Aside from HUD and data options)
by @NepDisk ty much
2023-11-12 16:57:38 +01:00
alufolie91 c4d8de471e P-MeterSpeedometer
by @NepDisk thx much
2023-11-12 16:56:52 +01:00
Alug 2a49236914 Fix colourizedhudcolor not respecting your colourized hud choice
make the stuff also grey out in the menu if you disable stuff
2023-11-12 16:43:33 +01:00
Alug fcf0836e7b Fix shadows from sometimes crashing on mapload
this properly fixes the mapchange spam from crashing the game

P_RunShadows, like any other thinker function, should also be called in preticker not just ticker

potentioally also fixes other issues
2023-11-12 16:09:34 +01:00
Alug 284845aad6 Cleanup Splitwall and remove smth we dont need
Perhaps not removing the endpegmul setting to 0 in some cases caused many of those division by zero crashes aswell

since i reverted the stuff relating to this a while back
2023-11-12 02:08:36 +01:00
Alug 44b2937ea1 Avoid a devision by zero in Splitwall and make it static 2023-11-12 01:46:58 +01:00
alufolie91 00c20f7c8c revert this thing
just incase, dont wanna break high res support
2023-11-12 00:39:04 +01:00
alufolie91 e74a28a2c1 Fix old big room fix
no idea what i was thinking
but kart does use viewx and viewy for those originially, so just let me do a 64bit version of R_PointToAngleEx
2023-11-11 22:08:48 +01:00
alufolie91 91ed5c4871 why did i remove this back then?? 2023-11-11 21:38:12 +01:00
alufolie91 7ca88fb131 make it save lol 2023-11-11 21:29:44 +01:00
alufolie91 76047e75d5 Toggle for FOF wall cutoff when slopes
was testing things, so might aswell add this
2023-11-11 21:01:53 +01:00
Alug 25b5e5f510 Revert "localskin rework incoming!!!!!"
This reverts commit 6196185d62.
2023-11-11 17:39:17 +01:00
indev 4377a6d7fe Remove unnecessary Z_Calloc from HWR_AddPolyObjectSegs
Effect is most likely unnoticable but still having less calls to Z_Calloc and Z_Free would be better
2023-11-11 18:43:37 +03:00
indev 5cfe9a4c4e Optimize gif recording in opengl a bit 2023-11-11 18:27:24 +03:00
Alug b5f90ab5b9 Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-10 22:37:48 +01:00
Alug badf395dad Remove WIndows shake thing
noone likes it
also theres been reports of this thing triggering false positives in anti viruses
2023-11-10 22:37:40 +01:00
indev 1e13abea19 Attempt to fix the rewrite bug 2023-11-10 18:59:58 +03:00
alufolie91 ca08c7b6e4 Merge remote-tracking branch 'origin/hayathings' into Saturn-Next 2023-11-10 16:24:35 +01:00
alufolie91 d427cd60b2 fix merge conflicts 2023-11-10 16:22:49 +01:00
hayaunderscore f29240f3e8 FUCKING TYPO 2023-11-10 16:16:24 +01:00
hayaunderscore 6196185d62 localskin rework incoming!!!!! 2023-11-10 16:16:07 +01:00
alufolie91 ba825cf688 Fix some issues 2023-11-10 16:16:02 +01:00
hayaunderscore cbbc356386 yeah yeah yeah 2023-11-10 16:15:43 +01:00
alufolie91 62cc95da95 Tooltips....
WIP, and only for the Saturn Options for now,,,,,,
2023-11-10 16:15:28 +01:00
indev 48ae18cede Merge pull request #77 from Indev450/stat-display-hud
Stat display hud
2023-11-10 18:11:23 +03:00
Alug cd804c5984 Fix FOFs with transferline flag and many linedefs randomly crashing
linenum could go out of bounds if you use more than 4 linedefs for such setup, hence making the game unable to retrieve textures and therefore crashing the games sometimes

Visually its not perfect, but you shouldnt do it anyways, atleast it wont crash everything now

ty much indev <3
2023-11-10 01:01:24 +01:00
indev c338453ce9 Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-09 21:34:53 +03:00
indev 6d5d1a1339 Fix RA ghosts failing to load 2023-11-09 21:34:40 +03:00
alufolie91 953e1734b4 Merge remote-tracking branch 'origin/spriteclip' into Saturn-Next 2023-11-09 18:00:36 +01:00
NepDisk cc01c576a3 move zero down for saturn menu by 5 2023-11-09 19:53:13 +03:00
NepDisk 018bac2be6 Add menus and redo saturn menu offsets so it fits 2023-11-09 19:51:49 +03:00
indev c01bc39659 Add stat display 2023-11-09 11:20:31 +03:00
NepDisk 5d49fd9411 Add shortcuts for current/next map to map command 2023-11-08 23:31:08 +01:00
Alug 23775b6ec0 Fix the gravstretch setting sometimes not saving
I hate this so much but it works
I used the same values the game presented before so the behaviour (hopefully) shouldnt change and like this i atleast can call off "Off"
2023-11-08 23:22:00 +01:00
alufolie91 b8ada40a72 fix highres sprites 2023-11-08 18:55:21 +01:00
alufolie91 58c72ab345 make it actually do something
knew it didnt really work before
2023-11-08 18:46:41 +01:00
alufolie91 143dc55f90 Merge remote-tracking branch 'origin/Saturn-Next' into spriteclip 2023-11-08 18:46:00 +01:00
Alug 227664bd12 Zzzzz... 2023-11-08 17:25:05 +01:00
alufolie91 3ee2e47724 Fix uninitialized reads in PreparePolygon
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1392
2023-11-08 17:24:59 +01:00
Alug 4aa4e235a5 Hide localskin menu stuff when youre the host/offline play
now only shows if you are a player in a netgame
2023-11-08 17:20:21 +01:00
Alug 76521ec0dd make wide lap sticker go back to normal when race is finished 2023-11-08 15:16:51 +01:00
Alug dfae95c7a3 fix the flashpal issue for good 2023-11-08 09:43:13 +01:00
alufolie91 7a31dffcdc Merge branch 'Saturn' into Saturn-Next
oh somehow this didnt make it into next
2023-11-07 00:23:35 +01:00
Alug 0f27f573f6 remove asm leftover 2023-11-06 15:52:16 +01:00
NepDisk 67d2673dc0 Add menu option for showing all maps 2023-11-06 11:50:23 +01:00
NepDisk c36564df1e Add toggle for ping icon 2023-11-06 11:49:50 +01:00
NepDisk 4ed6066e97 Ping measurement menu option 2023-11-06 11:49:35 +01:00
NepDisk 4e7a5d1b89 Fix offset looking ping icon in compact
Alug: grrrrrr frame delay measurement users..
2023-11-06 11:48:09 +01:00
indev c70ef22141 Add option to masterserver_debug to not print verbose debug messages in console (errors are still printed) 2023-11-06 13:25:49 +03:00
indev d15f69dfcd Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-06 12:01:04 +03:00
indev 27734387c0 Fix compilation with NOHW and NOOPENMPT 2023-11-06 12:00:47 +03:00
Alug b05eb4d848 paletteshader fix for potatoes 2023-11-06 02:02:20 +01:00
Alug 5e079a3990 Revert "Improve file search performance on Linux and FreeBSD"
This reverts commit 5c54f7dc7a.

smth smth doesent support symlinks
2023-11-06 01:13:58 +01:00
Alug 39964e995d add slopecontrast
same as wall contrast but for slopes
gives slopes a bit more contrast instead of them having the same brightness as everything else
there to clog up the opengl menu even more :p
2023-11-06 01:13:36 +01:00
Alug 8d80118a72 fix ping command showing a random players ms ping instead of your ping
bruh
2023-11-05 22:17:46 +01:00
Alug 5a163be5e8 Fix crash in FixedDiv when passing -2147483648
lul
2023-11-05 21:31:47 +01:00
Alug 429d8620e1 Use nanosleep for I_SleepDuration on *nix
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2184
2023-11-05 21:12:03 +01:00
Alug 5c54f7dc7a Improve file search performance on Linux and FreeBSD
from: https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2198
2023-11-05 21:00:03 +01:00
Alug 153ae53f8c sigh 2023-11-05 18:29:45 +01:00
Alug 95e54e97e5 show gamemap in tab ranking screen instead of gametype
this time functional
2023-11-05 16:51:58 +01:00
Alug 949bbebf7b fix ping stuff with new fps counter shit
goddammit i never do anything when im tired again
2023-11-05 16:29:55 +01:00
Alug ef1eea5ba8 Revert "show mapname instead of gametype in tab ranking"
This reverts commit cb03260e43.
2023-11-05 01:31:34 +01:00
Gustaf Alhäll d3ea2eb287 Fix FreeBSD build errors 2023-11-05 01:14:11 +01:00
Alug 383b395c78 bruh 2023-11-05 01:11:56 +01:00
Alug cb03260e43 show mapname instead of gametype in tab ranking
who tf needs the gametype the mapname much more useful
2023-11-05 01:08:58 +01:00
Alug e8a92dd836 add a "compact" fps counter option
it just removes the "FPS" text and moves the ping display much further down

also dont show it during startup
2023-11-05 00:16:18 +01:00
alufolie91 a6296445da windows 10 and 11 support :trollge: 2023-11-04 23:35:01 +01:00
alufolie91 2658003a1a move this out of NONET compile stuff
was error on my part sry indev :c
2023-11-04 23:31:27 +01:00
hayaunderscore 54c6196412 Fun fact: visual scale already factors for scale
So no need for this!
2023-11-04 23:27:32 +01:00
Alug 4b3989f18c v4 <- when next branch uses old version name lmao 2023-11-04 23:13:53 +01:00
Alug 3b41873893 make the thing compile, remove drmingw stuff from 64bit builds
and properly link libbacktrace

rip in piece drmingw but we got goddamn 64bit crashlogs now c:
2023-11-04 23:09:39 +01:00
Alug a211badb73 Update README.md
bruh this formatting
2023-11-04 21:11:25 +01:00
Alug 262a07ea9a Update README.md
before i forgert that later lmao
2023-11-04 21:10:45 +01:00
Alug ef323c66c7 Update README.md
i most likely forgor smth
but the most important thing was libbacktrace dependency for building the gam,e
2023-11-04 21:07:22 +01:00
indev 74c8b05469 Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-11-04 23:00:11 +03:00
alufolie91 8028c285ff Add libs and DLLs for libbacktrace 2023-11-04 21:02:35 +01:00
indev 966b273ecd More information in debug log 2023-11-04 23:00:05 +03:00
Alug bf2eecf9a4 Update README.md
i most likely forgor smth
but the most important thing was libbacktrace dependency for building the gam,e
2023-11-04 20:39:19 +01:00
indev 84d9665467 Bye bye unix-specific backtrace 2023-11-04 22:30:38 +03:00
indev df60b9ceee Try to get full traceback in all builds, or fall back to simple traceback if that failed 2023-11-04 22:00:17 +03:00
indev 37459d3d09 Simple backtrace in non-debug builds 2023-11-03 17:46:36 +03:00
indev 3e0cc1bb48 Use asctime instead of manually formatting time 2023-11-03 15:54:17 +03:00
indev ae5cf2116f Don't use unix-specific functions for libbacktrace crash report 2023-11-03 15:37:31 +03:00
indev 6c1426f1f3 Always include time.h 2023-11-03 15:18:55 +03:00
indev 067ebba4d4 Don't use libbacktrace on win32 2023-11-03 15:12:44 +03:00
indev dc16f8b4a6 Make libbacktrace crash reports append to file instead of overwriting. Add more info into libbacktrace crash reports 2023-11-03 15:04:38 +03:00
indev 9ed348c8a8 Use libbacktrace for crash logs (wip) 2023-11-03 14:11:56 +03:00
Alug 3ccf44a0be fixuer localskin stuff
Fixes the Apply to all players and displaying player not working (thx haya c: )

Fixes the Vibrating? player animation speeding up when uncapped in localskinmenu

Make so that the char spin speed respects the setting from saturn options (and add pain support )
2023-11-02 15:02:26 +01:00
alufolie91 c31e7ff2b3 Optimize sprite rendering by ignoring completely occluded sprites
backport of the srb2 thing
judging by perfstats it often cuts the spritecount in half
take with a grain of salt since i barely tested it
software mode only btw

https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2131?commit_id=b8313ceda283ac0c8dd9ab6141e83a31f0bb9639
2023-09-08 12:44:13 +02:00
108 changed files with 6341 additions and 3260 deletions

No files matched your search

+2
View File
@@ -16,3 +16,5 @@
#Appveyor
/appveyor.yml -crlf -whitespace
# Other
*.c text=auto
*.h text=auto
+21
View File
@@ -7,9 +7,11 @@
- Sprites player rotation on slopes; going on hills, levitate, going down, and so on alters your sprites (configurable)
- You can alter all the base kart HUD element offsets on the fly in the Saturn Options settings menu
- `addfilelocal` Command, for those who want to use things like their custom hud in netgames (Same as addfile but completely client sided)
- Palette rendering, make the OpenGL renderer (almost) look like software mode!
- OpenMPT for Tracker module playback instead of GME
- Fixes looping and sounds better
- Allows filter configuration
- Colourize your Kart HUD, to either your player color or whichever colour you like! (optional / requieres extra2.kart file)
- The minimal brightness with Shaders can be configured, now you can seeeee in dark areas (0-255 , uses Sector brightness values)
- Lua HUD hooks for Intermission (ex: You can make hostmod votes still visible during intermission!)
- Lua HUD hooks for Vote Screen (ex: You can make hostmod votes still visible during map vote screen!)
@@ -17,9 +19,12 @@
- Smaller Speedometer (optional / requieres extra.kart file)
- Record Attack input display can now be used everywhere
- Smaller minimap icons and also show player names on the minimap (toggable)
- Support for animated votescreens!
- `showmusiccredit` command, shows you the current music track again
- `listskins` show a list of all skins currently loaded
- Visual Portals from Haya's HEP Client
- Horizonline effect in OpenGL (watch the endless bricks on SNES Bowsers Castle!)
- Localskins! use whatever skin you like!
- Toggable lowercase menu's also from Haya's HEP client
- Everything that Galaxy has
@@ -39,6 +44,9 @@
- Toggable Lap animation
- Main menu shows the current renderer being used
- MSAA and A2C Antialiasing support (Configurable in renderer.txt file)
- A simple button to rejoin your last visited server
- Ability to show ALL maps in the mapselect screen, this includes hidden or hellmaps "showallmaps yes/no"
- Ability to toggle the Stagetitlecard "maptitles on/off"
## Performance / Debugging
@@ -57,6 +65,15 @@
- The annoying depraction messages for `P_TeleportMove` and `P_AproxDistance` have been silenced
- Silenced the annoying "cant find next map..." messages as theyre super useless and annoying anyways
- Added a small cooldown on `map` command due to spamming causing a SIGSEGV
- Many bugfixes to the Software renderer, so its much less prone to crashing
- Many bugfixes to the OpenGL renderer (too many too list all of them here; check the changelogs for more information)
- Bugfixes to the soundsystem, mainly regarding Sound muting
- Refactored Zone Memory Allocations (helps a bit with large maps)
- Many many more crash fixes and other bugfixes to the basegame (too many too list all of them here; check the changelogs for more information)
- Crash Backtraces have been replaced by libbacktrace (except for 32bit Windows builds)
Crashlogs now contain alot more informations. and even more if your build has debug symbols
Also allows 64bit Windows builds to produce Crashlogs!
## MISC
- Bird's Camara Tilting feature is no longer turned on by default
@@ -67,12 +84,16 @@
- A2C antialiasing makes transparent surfaces even more transparent
- You tell us! c:
## Note
Check the LUASTUFF file for more information on all the lua things Saturn has.
## Dependencies
- SDL2 (Linux/OS X only)
- SDL2-Mixer (Linux/OS X only)
- libupnp (Linux/OS X only)
- libgme (Linux/OS X only)
- libopenmpt (Linux/OS X only)
- libbacktrace (Linux/OS X only)
## Compiling
+1 -3
View File
@@ -23,10 +23,8 @@ and don't forget to build r_opengl.dll for srb2dd.
## srb2kart, 64-bit
* libs\dll-binaries\x86_64\exchndl.dll
* libs\dll-binaries\x86_64\libgme.dll
* libs\dll-binaries\x86_64\discord-rpc.dll
* libs\dll-binaries\x86_64\mgwhelp.dll (depend for exchndl.dll)
* libs\SDL2\x86_64-w64-mingw32\bin\SDL2.dll
* libs\SDL2_mixer\x86_64-w64-mingw32\bin\*.dll (get everything)
* libs\libopenmpt\x86_64\bin\mingw\libopenmpt.dll
* libs\libopenmpt\x86_64\bin\mingw\libopenmpt.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
# Copyright (C) 2012-2016 Free Software Foundation, Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# (2) Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# (3) The name of the author may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+36
View File
@@ -0,0 +1,36 @@
# libbacktrace
A C library that may be linked into a C/C++ program to produce symbolic backtraces
Initially written by Ian Lance Taylor <iant@golang.org>.
This is version 1.0.
It is likely that this will always be version 1.0.
The libbacktrace library may be linked into a program or library and
used to produce symbolic backtraces.
Sample uses would be to print a detailed backtrace when an error
occurs or to gather detailed profiling information.
In general the functions provided by this library are async-signal-safe,
meaning that they may be safely called from a signal handler.
The libbacktrace library is provided under a BSD license.
See the source files for the exact license text.
The public functions are declared and documented in the header file
backtrace.h, which should be #include'd by a user of the library.
Building libbacktrace will generate a file backtrace-supported.h,
which a user of the library may use to determine whether backtraces
will work.
See the source file backtrace-supported.h.in for the macros that it
defines.
As of October 2020, libbacktrace supports ELF, PE/COFF, Mach-O, and
XCOFF executables with DWARF debugging information.
In other words, it supports GNU/Linux, *BSD, macOS, Windows, and AIX.
The library is written to make it straightforward to add support for
other object file and debugging formats.
The library relies on the C++ unwind API defined at
https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html
This API is provided by GCC and clang.
+188
View File
@@ -0,0 +1,188 @@
/* backtrace.h -- Public header file for stack backtrace library.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
(3) The name of the author may not be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
#ifndef BACKTRACE_H
#define BACKTRACE_H
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The backtrace state. This struct is intentionally not defined in
the public interface. */
struct backtrace_state;
/* The type of the error callback argument to backtrace functions.
This function, if not NULL, will be called for certain error cases.
The DATA argument is passed to the function that calls this one.
The MSG argument is an error message. The ERRNUM argument, if
greater than 0, holds an errno value. The MSG buffer may become
invalid after this function returns.
As a special case, the ERRNUM argument will be passed as -1 if no
debug info can be found for the executable, but the function
requires debug info (e.g., backtrace_full, backtrace_pcinfo). The
MSG in this case will be something along the lines of "no debug
info". Similarly, ERRNUM will be passed as -1 if there is no
symbol table, but the function requires a symbol table (e.g.,
backtrace_syminfo). This may be used as a signal that some other
approach should be tried. */
typedef void (*backtrace_error_callback) (void *data, const char *msg,
int errnum);
/* Create state information for the backtrace routines. This must be
called before any of the other routines, and its return value must
be passed to all of the other routines. FILENAME is the path name
of the executable file; if it is NULL the library will try
system-specific path names. If not NULL, FILENAME must point to a
permanent buffer. If THREADED is non-zero the state may be
accessed by multiple threads simultaneously, and the library will
use appropriate atomic operations. If THREADED is zero the state
may only be accessed by one thread at a time. This returns a state
pointer on success, NULL on error. If an error occurs, this will
call the ERROR_CALLBACK routine.
Calling this function allocates resources that cannot be freed.
There is no backtrace_free_state function. The state is used to
cache information that is expensive to recompute. Programs are
expected to call this function at most once and to save the return
value for all later calls to backtrace functions. */
extern struct backtrace_state *backtrace_create_state (
const char *filename, int threaded,
backtrace_error_callback error_callback, void *data);
/* The type of the callback argument to the backtrace_full function.
DATA is the argument passed to backtrace_full. PC is the program
counter. FILENAME is the name of the file containing PC, or NULL
if not available. LINENO is the line number in FILENAME containing
PC, or 0 if not available. FUNCTION is the name of the function
containing PC, or NULL if not available. This should return 0 to
continuing tracing. The FILENAME and FUNCTION buffers may become
invalid after this function returns. */
typedef int (*backtrace_full_callback) (void *data, uintptr_t pc,
const char *filename, int lineno,
const char *function);
/* Get a full stack backtrace. SKIP is the number of frames to skip;
passing 0 will start the trace with the function calling
backtrace_full. DATA is passed to the callback routine. If any
call to CALLBACK returns a non-zero value, the stack backtrace
stops, and backtrace returns that value; this may be used to limit
the number of stack frames desired. If all calls to CALLBACK
return 0, backtrace returns 0. The backtrace_full function will
make at least one call to either CALLBACK or ERROR_CALLBACK. This
function requires debug info for the executable. */
extern int backtrace_full (struct backtrace_state *state, int skip,
backtrace_full_callback callback,
backtrace_error_callback error_callback,
void *data);
/* The type of the callback argument to the backtrace_simple function.
DATA is the argument passed to simple_backtrace. PC is the program
counter. This should return 0 to continue tracing. */
typedef int (*backtrace_simple_callback) (void *data, uintptr_t pc);
/* Get a simple backtrace. SKIP is the number of frames to skip, as
in backtrace. DATA is passed to the callback routine. If any call
to CALLBACK returns a non-zero value, the stack backtrace stops,
and backtrace_simple returns that value. Otherwise
backtrace_simple returns 0. The backtrace_simple function will
make at least one call to either CALLBACK or ERROR_CALLBACK. This
function does not require any debug info for the executable. */
extern int backtrace_simple (struct backtrace_state *state, int skip,
backtrace_simple_callback callback,
backtrace_error_callback error_callback,
void *data);
/* Print the current backtrace in a user readable format to a FILE.
SKIP is the number of frames to skip, as in backtrace_full. Any
error messages are printed to stderr. This function requires debug
info for the executable. */
extern void backtrace_print (struct backtrace_state *state, int skip, FILE *);
/* Given PC, a program counter in the current program, call the
callback function with filename, line number, and function name
information. This will normally call the callback function exactly
once. However, if the PC happens to describe an inlined call, and
the debugging information contains the necessary information, then
this may call the callback function multiple times. This will make
at least one call to either CALLBACK or ERROR_CALLBACK. This
returns the first non-zero value returned by CALLBACK, or 0. */
extern int backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc,
backtrace_full_callback callback,
backtrace_error_callback error_callback,
void *data);
/* The type of the callback argument to backtrace_syminfo. DATA and
PC are the arguments passed to backtrace_syminfo. SYMNAME is the
name of the symbol for the corresponding code. SYMVAL is the
value and SYMSIZE is the size of the symbol. SYMNAME will be NULL
if no error occurred but the symbol could not be found. */
typedef void (*backtrace_syminfo_callback) (void *data, uintptr_t pc,
const char *symname,
uintptr_t symval,
uintptr_t symsize);
/* Given ADDR, an address or program counter in the current program,
call the callback information with the symbol name and value
describing the function or variable in which ADDR may be found.
This will call either CALLBACK or ERROR_CALLBACK exactly once.
This returns 1 on success, 0 on failure. This function requires
the symbol table but does not require the debug info. Note that if
the symbol table is present but ADDR could not be found in the
table, CALLBACK will be called with a NULL SYMNAME argument.
Returns 1 on success, 0 on error. */
extern int backtrace_syminfo (struct backtrace_state *state, uintptr_t addr,
backtrace_syminfo_callback callback,
backtrace_error_callback error_callback,
void *data);
#ifdef __cplusplus
} /* End extern "C". */
#endif
#endif
Binary file not shown.
-2
View File
@@ -24,12 +24,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define APNG_H
#ifndef _MSC_VER
#ifndef _WII
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
+77 -24
View File
@@ -49,6 +49,7 @@ static void COM_CEchoDuration_f(void);
static void COM_Exec_f(void);
static void COM_Wait_f(void);
static void COM_Help_f(void);
static void COM_Find_f(void);
static void COM_Toggle_f(void);
static void COM_Add_f(void);
@@ -299,6 +300,7 @@ void COM_Init(void)
COM_AddCommand("exec", COM_Exec_f);
COM_AddCommand("wait", COM_Wait_f);
COM_AddCommand("help", COM_Help_f);
COM_AddCommand("find", COM_Find_f);
COM_AddCommand("toggle", COM_Toggle_f);
COM_AddCommand("add", COM_Add_f);
RegisterNetXCmd(XD_NETVAR, Got_NetVar);
@@ -820,7 +822,7 @@ static void COM_Help_f(void)
if (cvar)
{
CONS_Printf("\x82""Variable %s:\n", cvar->name);
CONS_Printf(M_GetText(" flags :"));
CONS_Printf(M_GetText(" flags: "));
if (cvar->flags & CV_SAVE)
CONS_Printf("AUTOSAVE ");
if (cvar->flags & CV_FLOAT)
@@ -874,30 +876,9 @@ static void COM_Help_f(void)
return;
}
CONS_Printf("No exact match, searching...\n");
// commands
CONS_Printf("\x82""Commands:\n");
for (cmd = com_commands; cmd; cmd = cmd->next)
{
if (!strstr(cmd->name, help))
continue;
CONS_Printf("%s ",cmd->name);
i++;
}
CONS_Printf("No variable or command named %s", help);
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing help without arguments\n");
// variables
CONS_Printf("\x82""\nVariables:\n");
for (cvar = consvar_vars; cvar; cvar = cvar->next)
{
if ((cvar->flags & CV_NOSHOWHELP) || (!strstr(cvar->name, help)))
continue;
CONS_Printf("%s ", cvar->name);
i++;
}
CONS_Printf("\x82""\nCheck wiki.srb2.org for more or type help <command or variable>\n");
CONS_Debug(DBG_GAMELOGIC, "\x87Total : %d\n", i);
}
return;
}
@@ -927,6 +908,78 @@ static void COM_Help_f(void)
}
}
static void COM_Find_f(void)
{
static char prefix[80];
xcommand_t *cmd;
consvar_t *cvar;
cmdalias_t *alias;
const char *match;
const char *help;
size_t helplen;
boolean matchesany;
if (COM_Argc() != 2)
{
CONS_Printf(M_GetText("find <text>: Search for variables, commands and aliases containing <text>\n"));
return;
}
help = COM_Argv(1);
helplen = strlen(help);
CONS_Printf("\x82""Variables:\n");
matchesany = false;
for (cvar = consvar_vars; cvar; cvar = cvar->next)
{
if (cvar->flags & CV_NOSHOWHELP)
continue;
match = strstr(cvar->name, help);
if (match != NULL)
{
memcpy(prefix, cvar->name, match - cvar->name);
prefix[match - cvar->name] = '\0';
CONS_Printf(" %s\x83%s\x80%s\n", prefix, help, &match[helplen]);
matchesany = true;
}
}
if (!matchesany)
CONS_Printf(" (none)\n");
CONS_Printf("\x82""Commands:\n");
matchesany = false;
for (cmd = com_commands; cmd; cmd = cmd->next)
{
match = strstr(cmd->name, help);
if (match != NULL)
{
memcpy(prefix, cmd->name, match - cmd->name);
prefix[match - cmd->name] = '\0';
CONS_Printf(" %s\x83%s\x80%s\n", prefix, help, &match[helplen]);
matchesany = true;
}
}
if (!matchesany)
CONS_Printf(" (none)\n");
CONS_Printf("\x82""Aliases:\n");
matchesany = false;
for (alias = com_alias; alias; alias = alias->next)
{
match = strstr(alias->name, help);
if (match != NULL)
{
memcpy(prefix, alias->name, match - alias->name);
prefix[match - alias->name] = '\0';
CONS_Printf(" %s\x83%s\x80%s\n", prefix, help, &match[helplen]);
matchesany = true;
}
}
if (!matchesany)
CONS_Printf(" (none)\n");
}
/** Toggles a console variable. Useful for on/off values.
*
* This works on on/off, yes/no values only
+4 -14
View File
@@ -869,7 +869,9 @@ boolean CON_Responder(event_t *ev)
static UINT8 consdown = false; // console is treated differently due to rare usage
// sequential completions a la 4dos
static char completion[80];
static char completioncmd[80 + sizeof("find ")] = "find ";
static char *completion = &completioncmd[sizeof("find ")-1];
static INT32 comskips, varskips;
const char *cmd = "";
@@ -948,7 +950,6 @@ boolean CON_Responder(event_t *ev)
// show all cvars/commands that match what we have inputted
if (key == KEY_TAB)
{
size_t i, len;
if (!completion[0])
{
@@ -957,19 +958,8 @@ boolean CON_Responder(event_t *ev)
strcpy(completion, inputlines[inputline]);
comskips = varskips = 0;
}
len = strlen(completion);
//first check commands
CONS_Printf("\nCommands:\n");
for (i = 0, cmd = COM_CompleteCommand(completion, i); cmd; cmd = COM_CompleteCommand(completion, ++i))
CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, cmd+len);
if (i == 0) CONS_Printf(" (none)\n");
//now we move on to CVARs
CONS_Printf("Variables:\n");
for (i = 0, cmd = CV_CompleteVar(completion, i); cmd; cmd = CV_CompleteVar(completion, ++i))
CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, cmd+len);
if (i == 0) CONS_Printf(" (none)\n");
COM_BufInsertText(completioncmd);
return true;
}
+126 -20
View File
@@ -47,6 +47,7 @@
#include "k_kart.h"
#include "s_sound.h" // sfx_syfail
#include "m_perfstats.h"
#include "d_main.h"
#ifdef CLIENT_LOADINGSCREEN
// cl loading screen
@@ -171,6 +172,8 @@ static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shownodeip = {"showipinnodelist", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -1899,6 +1902,15 @@ static void CL_LoadReceivedSavegame(void)
demo.title = false;
automapactive = false;
if (!postautoloaded)
{
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
postautoloaded = true;
}
// load a base level
if (P_LoadNetGame())
{
@@ -1939,12 +1951,13 @@ static void CL_LoadReceivedSavegame(void)
static void SendAskInfo(INT32 node)
{
tic_t asktime;
#ifdef HOLEPUNCH
if (node != 0 && node != BROADCASTADDR &&
cv_rendezvousserver.string[0])
{
I_NetRequestHolePunch(node);
}
#endif
asktime = I_GetTime();
@@ -3345,7 +3358,7 @@ static void Command_Nodes(void)
{
CONS_Printf("%.2u: %*s", i, (int)maxlen, player_names[i]);
CONS_Printf(" - %.2d", playernode[i]);
if (I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL)
if ((I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL) && (cv_shownodeip.value))
CONS_Printf(" - %s", address);
if (IsPlayerAdmin(i))
@@ -3359,6 +3372,94 @@ static void Command_Nodes(void)
}
}
//Screw the base game nodes lets replace with listplayers instead.
static void Command_Listplayers(void)
{
const char *address;
int width = 0;
boolean admin;
boolean spectator;
/*
Mode of player status for an individual player (admin, spectator).
1 for admin
2 for spectator
4 for both
*/
int mode = 0;
INT32 totalplayers = 0;
const char *cc;
const char *pcc;
INT32 i;
int n;
for (i = 0; i < MAXPLAYERS; ++i)
if (playeringame[i])
{
n = strlen(player_names[i]);
if (n > width)
width = n;
if (mode != 7)
{
admin = IsPlayerAdmin(i);
spectator = players[i].spectator;
if (admin)
mode |= 1;
if (spectator)
mode |= 2;
if (admin && spectator)
mode |= 4;
}
}
for (i = 0; i < MAXPLAYERS; ++i)
if (playeringame[i])
{
admin = IsPlayerAdmin(i);
spectator = players[i].spectator;
if (admin)
cc = "\x85";/* red */
else if (spectator)
cc = "\x86";/* gray */
else
cc = "";
pcc = HU_SkinColorToConsoleColor(players[i].skincolor);
CONS_Printf("%.2d: ""%s""%-*s""\x80", i, pcc,width, player_names[i]);
if ((I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL) && (cv_shownodeip.value))
CONS_Printf(" -- %s", address);
else/* print spacer */
{
/* ...but not if there's a crammed status and were admin */
if (mode != 7 || !admin)
CONS_Printf(" -- ");/* -- self */
}
if (admin)
CONS_Printf(M_GetText("%s"" (admin)"),cc);
if (spectator)
CONS_Printf(M_GetText("%s"" (spectator)"),cc);
CONS_Printf("\n");
totalplayers++;
}
if (totalplayers == 1)
CONS_Printf("\nThere is 1 player in the game.\n");
else
CONS_Printf("\nThere are %d players in the game.\n", totalplayers);
}
static void Command_Ban(void)
{
if (COM_Argc() < 2)
@@ -3924,6 +4025,7 @@ void D_ClientServerInit(void)
COM_AddCommand("reloadbans", Command_ReloadBan);
COM_AddCommand("connect", Command_connect);
COM_AddCommand("nodes", Command_Nodes);
COM_AddCommand("listplayers", Command_Listplayers);
#ifdef HAVE_CURL
COM_AddCommand("set_http_login", Command_set_http_login);
COM_AddCommand("list_http_logins", Command_list_http_logins);
@@ -4215,6 +4317,13 @@ static void Got_RemovePlayer(UINT8 **p, INT32 playernum)
pnum = READUINT8(*p);
reason = READUINT8(*p);
if (pnum == serverplayer)
{
CONS_Alert(CONS_WARNING, "Attempt to remove server player\n");
return;
}
CL_RemovePlayer(pnum, reason);
#ifdef HAVE_DISCORDRPC
@@ -4981,36 +5090,26 @@ static void HandlePacketFromPlayer(SINT8 node)
/// \todo Use a separate cvar for that kind of timeout?
freezetimeout[node] = I_GetTime() + connectiontimeout;
//Ported this from 2.2 Prevent dropped ticcmds due to interp timing jutter
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
tic_t faketic = maketic;
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
&& (maketic - firstticstosend < TICQUEUE - 1))
faketic++;
// Don't do anything for packets of type NODEKEEPALIVE?
// Sryder 2018/07/01: Update the freezetimeout still!
if (netbuffer->packettype == PT_NODEKEEPALIVE
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS)
break;
// Copy ticcmd Prevent dropped ticcmds due to interp timing jutter
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1);
// Copy ticcmd
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1);
// Check ticcmd for "speed hacks"
if (CheckForSpeedHacks((UINT8)netconsole))
break;
// Splitscreen cmd Prevent dropped ticcmds due to interp timing jutter
// Splitscreen cmd
if (((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
|| (netbuffer->packettype == PT_CLIENT3CMD || netbuffer->packettype == PT_CLIENT3MIS)
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
&& (nodetoplayer2[node] >= 0))
{
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][(UINT8)nodetoplayer2[node]],
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer2[node]],
&netbuffer->u.client2pak.cmd2, 1);
if (CheckForSpeedHacks((UINT8)nodetoplayer2[node]))
@@ -5021,7 +5120,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
&& (nodetoplayer3[node] >= 0))
{
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][(UINT8)nodetoplayer3[node]],
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer3[node]],
&netbuffer->u.client3pak.cmd3, 1);
if (CheckForSpeedHacks((UINT8)nodetoplayer3[node]))
@@ -5031,7 +5130,7 @@ static void HandlePacketFromPlayer(SINT8 node)
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
&& (nodetoplayer4[node] >= 0))
{
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][(UINT8)nodetoplayer4[node]],
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer4[node]],
&netbuffer->u.client4pak.cmd4, 1);
if (CheckForSpeedHacks((UINT8)nodetoplayer4[node]))
@@ -5299,7 +5398,7 @@ static void HandlePacketFromPlayer(SINT8 node)
}
else
{
DEBFILE(va("frame not in bound: %u\n", neededtic));
DEBFILE(va("frame not in bound: %u (bounds are from %u to %u)\n", neededtic, realstart, realend));
/*if (realend < neededtic - 2 * TICRATE || neededtic + 2 * TICRATE < realstart)
I_Error("Received an out of order PT_SERVERTICS packet!\n"
"Got tics %d-%d, needed tic %d\n\n"
@@ -6153,6 +6252,7 @@ static void UpdatePingTable(void)
}
}
#ifdef HOLEPUNCH
static void RenewHolePunch(void)
{
if (cv_rendezvousserver.string[0])
@@ -6168,6 +6268,7 @@ static void RenewHolePunch(void)
}
}
}
#endif
// Handle timeouts to prevent definitive freezes from happenning
static void HandleNodeTimeouts(void)
@@ -6201,11 +6302,14 @@ void NetKeepAlive(void)
#ifdef MASTERSERVER
MasterClient_Ticker();
#endif
#ifdef HOLEPUNCH
if (netgame && serverrunning)
{
RenewHolePunch();
}
#endif
if (client)
{
@@ -6318,10 +6422,12 @@ void NetUpdate(void)
MasterClient_Ticker(); // Acking the Master Server
#endif
#ifdef HOLEPUNCH
if (netgame && serverrunning)
{
RenewHolePunch();
}
#endif
if (client)
{
+2
View File
@@ -515,6 +515,8 @@ extern consvar_t cv_kicktime;
extern consvar_t cv_showjoinaddress;
extern consvar_t cv_playbackspeed;
extern consvar_t cv_shownodeip;
#define BASEPACKETSIZE offsetof(doomdata_t, u)
#define FILETXHEADER offsetof(filetx_pak, data)
#define BASESERVERTICSSIZE offsetof(doomdata_t, u.serverpak.cmds[0])
+160 -8
View File
@@ -66,7 +66,7 @@
#include "fastcmp.h"
#include "r_fps.h" // Frame interpolation/uncapped
#include "keys.h"
#include "filesrch.h" // refreshdirmenu
#include "filesrch.h" // refreshdirmenu, pathisdirectory
#include "d_protocol.h"
#include "m_perfstats.h"
@@ -94,8 +94,6 @@
// platform independant focus loss
UINT8 window_notinfocus = false;
INT32 window_x;
INT32 window_y;
//
// DEMO LOOP
@@ -105,6 +103,13 @@ static const char *pagename = "MAP1PIC";
static char *startupwadfiles[MAX_WADFILES];
static char *startuppwads[MAX_WADFILES];
// autoloading
static char *autoloadwadfiles[MAX_WADFILES];
char *autoloadwadfilespost[MAX_WADFILES];
boolean autoloading;
boolean autoloaded;
boolean postautoloaded;
boolean devparm = false; // started game with -devparm
boolean singletics = false; // timedemo
@@ -885,7 +890,131 @@ static void D_AddFile(const char *file, char **filearray)
filearray[pnumwadfiles] = newfile;
}
static inline void D_CleanFile(char **filearray)
// Taken from TSoURDt3rd
// https://github.com/StarManiaKG/The-Story-of-Uncapped-Revengence-Discord-the-3rd/blob/main/src/STAR/star_functions.c
static INT32 D_DetectFileType(const char* filename)
{
if (pathisdirectory(filename) == 1)
return 1;
else
{
if (!stricmp(&filename[strlen(filename) - 4], ".wad"))
return 2;
else if (!stricmp(&filename[strlen(filename) - 4], ".pk3"))
return 3;
else if (!stricmp(&filename[strlen(filename) - 5], ".kart"))
return 4;
else if (!stricmp(&filename[strlen(filename) - 4], ".lua"))
return 5;
else if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
return 6;
else if (!stricmp(&filename[strlen(filename) - 4], ".cfg"))
return 7;
else if (!stricmp(&filename[strlen(filename) - 4], ".txt"))
return 8;
}
return 0;
}
// autoload that shit
static void D_AutoloadFile(const char *file, char **filearray)
{
size_t pnumwadfiles;
char *newfile;
INT32 fileType = D_DetectFileType(file);
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
;
newfile = malloc(strlen(file) + 1);
if (!newfile)
I_Error("No more free memory to AutoloadFile %s",file);
if (!fileType)
{
CONS_Printf("D_AutoloadFile: File %s is unknown or invalid\n", file);
return;
}
strcpy(newfile, file);
if (fileType <= 6)
filearray[pnumwadfiles] = newfile;
else
COM_BufAddText(va("exec %s\n", newfile));
}
static char *strremove(char *str, const char *sub) {
char *p, *q, *r;
if (*sub && (q = r = strstr(str, sub)) != NULL) {
size_t len = strlen(sub);
while ((r = strstr(p = r + len, sub)) != NULL) {
while (p < r)
*q++ = *p++;
}
while ((*q++ = *p++) != '\0')
continue;
}
return str;
}
// FIND THEM
static void D_FindAddonsToAutoload(void)
{
FILE *autoloadconfigfile;
const char *autoloadpath;
boolean postload;
INT32 i;
char wadsToAutoload[256] = "", renameAutoloadStrings[256] = "";
// does it exist tho
autoloadpath = va("%s"PATHSEP"%s",srb2home,AUTOLOADCONFIGFILENAME);
autoloadconfigfile = fopen(autoloadpath, "r");
// If the file is found, run our shit
if (!autoloadconfigfile) // nope outta here
return;
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL)
{
postload = false;
// skip if commented or empty
if ((wadsToAutoload[1] == '\0' || wadsToAutoload[1] == '\n')
|| (wadsToAutoload[0] == '#'))
continue;
// this marks it so that it loads after loading server addons
else if (fastncmp(wadsToAutoload, "postload ", 9)) {
strremove(wadsToAutoload, "postload ");
postload = true;
}
// Remove Any Empty or Skipped Lines
for (i = 0; wadsToAutoload[i] != '\0'; i++)
{
if (wadsToAutoload[i] == '\n')
wadsToAutoload[i] = '\0';
}
// LOAD IT
if (!postload)
D_AutoloadFile(wadsToAutoload, autoloadwadfiles);
else
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost);
// end it here
for (i = 0; wadsToAutoload[i] != '\0'; i++)
wadsToAutoload[i] = '\0';
}
// we dont want memory leaks around here do we?
fclose(autoloadconfigfile);
}
void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
@@ -921,6 +1050,8 @@ boolean snw_speedo; // snowy speedometer 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 speedometer
boolean statdp; // New stat
static void IdentifyVersion(void)
{
@@ -1186,6 +1317,9 @@ void D_SRB2Main(void)
if (M_CheckParm("-password") && M_IsNextParm())
D_SetPassword(M_GetNextParm());
// FIND THEM
D_FindAddonsToAutoload();
// add any files specified on the command line with -file wadfile
// to the wad list
if (!(M_CheckParm("-connect") && !M_CheckParm("-server")))
@@ -1278,25 +1412,42 @@ void D_SRB2Main(void)
mainwads++;
if (found_extra2_kart)
mainwads++;
// now check for speedometer stuff
if (W_CheckMultipleLumps("SP_SMSTC", "K_TRNULL", "SP_MKMH", "SP_MMPH", "SP_MFRAC", "SP_MPERC", NULL))
snw_speedo = true;
// check for bigger lap count
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
big_lap = true;
// now check for colour hud stuff
if (W_CheckMultipleLumps("K_SCTIME", "K_SCTIMW", "K_SCLAPS", "K_SCLAPW", \
"K_SCBALN", "K_SCBALW", "K_SCKARM", "K_SCTOUT", "K_ISMULC", "K_ITMULC", "K_ITBC","K_ITBCD", "K_ISBC", "K_ISBCD", NULL))
clr_hud = true;
// check for bigger lap count but color** its color bitch
if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL))
big_lap_color = true;
// kartzspeedo
if (W_CheckMultipleLumps("K_KZSP1", "K_KZSP2", "K_KZSP3", "K_KZSP4", "K_KZSP5", \
"K_KZSP6", "K_KZSP7", "K_KZSP8", "K_KZSP9", "K_KZSP10", "K_KZSP11", "K_KZSP12", \
"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;
// stat display for extended player setup
if (W_CheckMultipleLumps("K_STATNB", "K_STATN1", "K_STATN2", "K_STATN3", "K_STATN4", \
"K_STATN5", "K_STATN6", NULL))
statdp = true;
}
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);
//
// search for maps
//
@@ -1491,6 +1642,7 @@ void D_SRB2Main(void)
I_InitMusic();
S_InitSfxChannels(cv_soundvolume.value);
S_InitMusicDefs();
S_InitMTDefs();
}
CONS_Printf("ST_Init(): Init status bar.\n");
+10
View File
@@ -32,6 +32,14 @@ extern boolean snw_speedo; // snowy speedometer 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 autoloading;
extern boolean autoloaded;
extern boolean postautoloaded;
extern char *autoloadwadfilespost[MAX_WADFILES];
// the infinite loop of D_SRB2Loop() called from win_main for windows version
void D_SRB2Loop(void) FUNCNORETURN;
@@ -48,6 +56,8 @@ void D_PostEvent(const event_t *ev);
void D_ProcessEvents(void);
void D_CleanFile(char **filearray);
const char *D_Home(void);
//
+11 -1
View File
@@ -51,7 +51,9 @@ doomcom_t *doomcom = NULL;
/// \brief network packet data, points inside doomcom
doomdata_t *netbuffer = NULL;
/// \brief hole punching packet, also points inside doomcom
#ifdef HOLEPUNCH
holepunch_t *holepunchpacket = NULL;
#endif
#ifdef DEBUGFILE
FILE *debugfile = NULL; // put some net info in a file during the game
@@ -75,8 +77,10 @@ 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;
#ifdef HOLEPUNCH
void (*I_NetRequestHolePunch)(INT32 node) = NULL;
void (*I_NetRegisterHolePunch)(void) = NULL;
#endif
boolean (*I_NetOpenSocket)(void) = NULL;
boolean (*I_Ban) (INT32 node) = NULL;
void (*I_ClearBans)(void) = NULL;
@@ -827,6 +831,10 @@ static const char *packettypename[NUMPACKETTYPE] =
"CLIENTJOIN",
"NODETIMEOUT",
"RESYNCHING",
"TELLFILESNEEDED",
"MOREFILESNEEDED",
"PING"
};
@@ -1349,7 +1357,9 @@ boolean D_CheckNetGame(void)
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
netbuffer = (doomdata_t *)(void *)&doomcom->data;
#ifdef HOLEPUNCH
holepunchpacket = (holepunch_t *)(void *)&doomcom->data;
#endif
#ifdef DEBUGFILE
if (M_CheckParm("-debugfile"))
@@ -1458,7 +1468,7 @@ void Command_Ping_f(void)
if (!server && playeringame[consoleplayer])
{
CONS_Printf("\nYour ping is %d frames (%d ms)\n", playerpingtable[consoleplayer], (INT32)(playerpingtable[i] * (1000.00f / TICRATE)));
CONS_Printf("\nYour ping is %d frames (%d ms)\n", playerpingtable[consoleplayer], (INT32)(playerpingtable[consoleplayer] * (1000.00f / TICRATE)));
}
}
+38 -16
View File
@@ -195,6 +195,8 @@ static void Command_Isgamemodified_f(void);
static void Command_Cheats_f(void);
static void Command_ListSkins(void);
static void Command_SkinSearch(void);
#ifdef _DEBUG
static void Command_Togglemodified_f(void);
@@ -295,12 +297,16 @@ consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk
// haha I've beaten you now, ONLINE
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
INT32 cv_debug;
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL};
//WTF
consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
@@ -412,7 +418,7 @@ consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", CV_NOSHOWHELP,
consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartdebugcolorize = {"kartdebugcolorize", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t votetime_cons_t[] = {{10, "MIN"}, {3600, "MAX"}, {0, NULL}};
static CV_PossibleValue_t votetime_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, NULL}};
consvar_t cv_votetime = {"votetime", "20", CV_NETVAR, votetime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ringslinger = {"ringslinger", "No", CV_NETVAR|CV_NOSHOWHELP|CV_CALL|CV_CHEAT, CV_YesNo,
@@ -477,6 +483,7 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pingicon = {"pingicon", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -508,7 +515,7 @@ static CV_PossibleValue_t skinselectspin_cons_t[] = {
consvar_t cv_skinselectspin = {"skinselectspin", "5", CV_SAVE, skinselectspin_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t perfstats_cons_t[] = {
{0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {0, NULL}};
{0, "Off"}, {1, "Rendering"}, {2, "Logic"}, {3, "ThinkFrame"}, {4, "PreThinkFrame"}, {5, "PostThinkFrame"}, {0, NULL}};
consvar_t cv_perfstats = {"perfstats", "Off", CV_CALL, perfstats_cons_t, PS_PerfStats_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ps_thinkframe_page = {"ps_thinkframe_page", "1", CV_CALL, CV_Natural, PS_ThinkFrame_Page_OnChange, 0, NULL, NULL, 0, 0, NULL};
@@ -522,8 +529,8 @@ consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_
consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}};
consvar_t cv_skinselectmenu = {"skinselectmenu", "Grid", CV_SAVE, skinselectmenu_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {SKINMENUTYPE_EXTENDED, "Extended"}, {0, NULL}};
consvar_t cv_skinselectmenu = {"skinselectmenu", "Extended", CV_SAVE, skinselectmenu_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t skinselectgridsort_t[] ={
{ SKINMENUSORT_REALNAME, "Real name" },
@@ -773,6 +780,7 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_joinnextround);
#endif
CV_RegisterVar(&cv_showjoinaddress);
CV_RegisterVar(&cv_shownodeip);
CV_RegisterVar(&cv_blamecfail);
#endif
@@ -786,6 +794,7 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_pingtimeout);
CV_RegisterVar(&cv_showping);
CV_RegisterVar(&cv_pingmeasurement);
CV_RegisterVar(&cv_pingicon);
#ifdef SEENAMES
CV_RegisterVar(&cv_allowseenames);
@@ -965,6 +974,8 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_luaimmersion);
CV_RegisterVar(&cv_fakelocalskin);
CV_RegisterVar(&cv_showlocalskinmenus);
//CV_RegisterVar(&cv_crosshair);
//CV_RegisterVar(&cv_crosshair2);
@@ -1095,22 +1106,12 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_ps_thinkframe_page);
CV_RegisterVar(&cv_ps_samplesize);
CV_RegisterVar(&cv_ps_descriptor);
CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade);
CV_RegisterVar(&cv_respawnfademusicout);
CV_RegisterVar(&cv_respawnfademusicback);
CV_RegisterVar(&cv_resetspecialmusic);
CV_RegisterVar(&cv_resume);
CV_RegisterVar(&cv_fading);
//Value used to store last server player has joined
CV_RegisterVar(&cv_lastserver);
CV_RegisterVar(&cv_showallmaps);
CV_RegisterVar(&cv_showmusicfilename);
// ingame object placing
COM_AddCommand("objectplace", Command_ObjectPlace_f);
@@ -1156,6 +1157,7 @@ void D_RegisterClientCommands(void)
#endif
COM_AddCommand("listskins", Command_ListSkins);
COM_AddCommand("skinsearch", Command_SkinSearch);
}
/**
@@ -3080,7 +3082,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
if (paused)
{
if (!menuactive || netgame)
if ((!menuactive || netgame) && (!cv_pausemusic.value))
S_PauseAudio();
}
else
@@ -6058,6 +6060,26 @@ static void Command_ListSkins(void)
}
}
static void Command_SkinSearch(void)
{
size_t i;
UINT16 s;
UINT16 ic = 0;
//skin_t *skininput = &skins[s];
for (i = 1; i < COM_Argc(); i++){
for( s = 0 ; s < numallskins ; s++ )
{
skin_t *skininput = &skins[s];
if (strcasestr(skininput->realname,COM_Argv(i)))
{
ic++;
CONS_Printf("%d. %s%s:\x80 %s\n", ic,HU_SkinColorToConsoleColor(skininput->prefcolor),skininput->realname,skininput->name);
}
}
}
CONS_Printf("Total %d skins.\n", ic);
}
/** Sends a color change for the console player, unless that player is moving.
* \sa cv_playercolor, Color2_OnChange, Skin_OnChange
* \author Graue <graue@oceanbase.org>
+6 -1
View File
@@ -41,6 +41,8 @@ extern consvar_t cv_splitplayers;
extern consvar_t cv_seenames, cv_allowseenames;
#endif
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;
@@ -153,6 +155,7 @@ extern consvar_t cv_maxping;
extern consvar_t cv_pingtimeout;
extern consvar_t cv_showping;
extern consvar_t cv_pingmeasurement;
extern consvar_t cv_pingicon;
//extern consvar_t cv_smallpos;
extern consvar_t cv_showminimapnames;
@@ -163,6 +166,7 @@ extern consvar_t cv_showlapemblem;
extern consvar_t cv_showviewpointtext;
extern consvar_t cv_luaimmersion;
extern consvar_t cv_fakelocalskin;
extern consvar_t cv_showlocalskinmenus;
extern consvar_t cv_skipmapcheck;
@@ -182,7 +186,8 @@ typedef enum
{
SKINMENUTYPE_SCROLL = 0,
SKINMENUTYPE_2D, // 1
SKINMENUTYPE_GRID // 2
SKINMENUTYPE_GRID, // 2
SKINMENUTYPE_EXTENDED // 3
} skinmenutype_t;
typedef enum
+1 -1
View File
@@ -1342,7 +1342,7 @@ void CURLGetFile(void)
if (easyres == CURLE_HTTP_RETURNED_ERROR)
curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code);
easy_handle_error = (response_code) ? va("HTTP reponse code %ld", response_code) : curl_easy_strerror(easyres);
easy_handle_error = (response_code) ? va("HTTP response code %ld", response_code) : curl_easy_strerror(easyres);
curl_curfile->status = FS_FALLBACK;
curl_curfile->currentsize = curl_origfilesize;
curl_curfile->totalsize = curl_origtotalfilesize;
+2 -2
View File
@@ -416,8 +416,8 @@ typedef struct player_s
UINT8 skincolor;
INT32 skin;
INT32 localskin;
boolean skinlocal;
INT32 localskin; // current localskin number
boolean skinlocal; // determines if localskin is a skin already loaded in the server
UINT32 score; // player score
fixed_t dashspeed; // dashing speed
+1
View File
@@ -8277,6 +8277,7 @@ struct {
// Frame settings
{"FF_FRAMEMASK",FF_FRAMEMASK},
{"FF_HORIZONTALFLIP",FF_HORIZONTALFLIP},
{"FF_PAPERSPRITE",FF_PAPERSPRITE},
{"FF_ANIMATE",FF_ANIMATE},
{"FF_FULLBRIGHT",FF_FULLBRIGHT},
+4
View File
@@ -480,14 +480,18 @@ void DRPC_UpdatePresence(void)
// Server info
if (netgame)
{
#ifdef MASTERSERVER
if (cv_advertise.value)
{
discordPresence.state = "Public";
}
else
{
#endif
discordPresence.state = "Private";
#ifdef MASTERSERVER
}
#endif
discordPresence.partyId = server_context; // Thanks, whoever gave us Mumble support, for implementing the EXACT thing Discord wanted for this field!
discordPresence.partySize = D_NumPlayers(); // Players in server
+3 -2
View File
@@ -127,8 +127,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v4 "
#define VERSIONSTRINGW L"Saturn v4"
#define VERSIONSTRING "Saturn v5 "
#define VERSIONSTRINGW L"Saturn v5"
// 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!
@@ -639,6 +639,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#if defined (HAVE_CURL) && ! defined (NONET)
#define MASTERSERVER
#define HOLEPUNCH
#else
#undef UPDATE_ALERT
#endif
-2
View File
@@ -108,8 +108,6 @@ extern boolean digital_disabled;
extern boolean menuactive; // Menu overlaid?
extern UINT8 paused; // Game paused?
extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message)
extern INT32 window_x;
extern INT32 window_y;
extern boolean nodrawers;
extern boolean noblit;
+1 -1
View File
@@ -169,7 +169,7 @@ void I_SetMusicVolume(UINT8 volume)
(void)volume;
}
boolean I_SetSongTrack(int track)
boolean I_SetSongTrack(INT32 track)
{
(void)track;
return false;
+17 -3
View File
@@ -520,6 +520,19 @@ static const char *credits[] = {
"Karol \"Fooruman\" D""\x1E""browski", // Dąbrowski, <Sryder> accents in srb2 :ytho:
"\"Virt\"",
"",
"\1Saturn",
"\"Alufolie91\" aka \"Alug\"",
"\"Indev\"",
"\"Haya\"",
"\"NepDisk\"",
"\"Xyzzy\"",
" ",
"\"Sunflower\" aka \"AnimeSonic\"",
"\"Yuz\" aka \"Yuzler\"",
"\"Democrab\"",
"\"Expand\" aka \"Maver\"",
"\"Nexit\"",
"",
"\1Special Thanks",
"SEGA",
"Sonic Team",
@@ -559,10 +572,11 @@ static struct {
{224, 80+(216*13), "K_ITMINE", SKINCOLOR_BRONZE},
{224, 80+(216*14), "K_ITTHNS", SKINCOLOR_RASPBERRY},
{224, 80+(216*15), "K_ITINV1", SKINCOLOR_GREY},
{224, 80+(216*16), "K_ITSINK", SKINCOLOR_PINETREE},
// This Tyler52 gag is troublesome
// Alignment should be ((spaces+1 * 100) + (headers+1 * 38) + (lines * 15))
// Current max image spacing: (216*17)
{112, (16*100)+(19*38)+(103*15), "TYLER52", SKINCOLOR_NONE},
{112, (17*100)+(20*38)+(114*15), "TYLER52", SKINCOLOR_NONE},
{0, 0, NULL, SKINCOLOR_NONE}
};
@@ -596,6 +610,7 @@ void F_StartCredits(void)
timetonext = 2*TICRATE;
}
void F_CreditDrawer(void)
{
UINT16 i;
@@ -925,7 +940,6 @@ void F_GameEndTicker(void)
D_StartTitle();
}
// ==============
// TITLE SCREEN
// ==============
@@ -988,7 +1002,7 @@ void F_TitleScreenDrawer(void)
else
{
INT32 transval = 0;
if (finalecount <= (50+(9<<1)))
transval = (finalecount - 50)>>1;
+36
View File
@@ -337,6 +337,23 @@ size_t dir_on[menudepth];
UINT8 refreshdirmenu = 0;
char *refreshdirname = NULL;
// Checks if the specified path is a directory.
// Returns 1 if so, 0 if not, and -1 if an error occurred.
// direrror is set if there was an error.
INT32 pathisdirectory(const char *path)
{
struct stat fsstat;
if (stat(path, &fsstat) < 0)
{
return -1;
}
else if (S_ISDIR(fsstat.st_mode))
return 1;
return 0;
}
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth)
{
filestatus_t retval = FS_NOTFOUND;
@@ -396,9 +413,28 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
// okay, now we actually want searchpath to incorporate d_name
strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
#if defined(__linux__) || defined(__FreeBSD__)
if (dent->d_type == DT_UNKNOWN)
if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode))
dent->d_type = DT_DIR;
else if (lstat(searchpath,&fsstat) == 0 && S_ISLNK(fsstat.st_mode))
dent->d_type = DT_LNK;
// Symlinks aren't always directory symlinks. Dunno if this would resolve recursive
// symlinks, but i think stat already does that
if (dent->d_type == DT_LNK && stat(searchpath,&fsstat) == 0 && !S_ISDIR(fsstat.st_mode))
{
dent->d_type = DT_UNKNOWN;
}
// Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups.
// FIXME: should we also follow symlinks?
if ((dent->d_type == DT_DIR && depthleft) || (dent->d_type == DT_LNK && depthleft))
#else
if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
; // was the file (re)moved? can't stat it
else if (S_ISDIR(fsstat.st_mode) && depthleft)
#endif
{
searchpathindex[--depthleft] = strlen(searchpath) + 1;
dirhandle[depthleft] = opendir(searchpath);
+1
View File
@@ -89,6 +89,7 @@ typedef enum
REFRESHDIR_GAMEDATA = 64
} refreshdir_enum;
INT32 pathisdirectory(const char *path);
void closefilemenu(boolean validsize);
void searchfilemenu(char *tempname);
boolean preparefilemenu(boolean samedepth, boolean replayhut);
+30 -21
View File
@@ -496,8 +496,12 @@ consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_c
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t stretchfactor_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
consvar_t cv_gravstretch = {"gravstretch", "0", CV_FLOAT | CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t stretchfactor_t[] = {
{0, "Off"}, {FRACUNIT/8, "0.125"}, {FRACUNIT/4, "0.250"},
{3*FRACUNIT/8, "0.375"}, {FRACUNIT/2, "0.500"}, {5*FRACUNIT/8, "0.625"},
{3*FRACUNIT/4, "0.750"}, {7*FRACUNIT/8, "0.875"}, {FRACUNIT, "Max"}, {0, NULL}};
consvar_t cv_gravstretch = {"gravstretch", "0", CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
@@ -515,14 +519,6 @@ consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldis
consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resetspecialmusic = {"resetspecialmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
#if MAXPLAYERS > 16
#error "please update player_name table using the new value for MAXPLAYERS"
#endif
@@ -1423,9 +1419,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
side += ((axis * sidemove[0]) >> 10);
}
// Specator mouse turning
if (player->spectator)
if (player->spectator || cv_mouseturn.value)
{
//THIS WORKS WTF????????
cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8)));
}
@@ -1961,7 +1957,7 @@ boolean G_Responder(event_t *ev)
paused = true;
S_PauseAudio();
}
else if (paused)
else if ((paused) && (!cv_pausemusic.value))
S_PauseAudio();
else
S_ResumeAudio();
@@ -2828,7 +2824,7 @@ void G_PlayerReborn(INT32 player)
/* I'm putting this here because lol */
fade = ( cv_fading.value && P_IsLocalPlayer(p) );
fade = (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(p));
if (fade)
{
@@ -5036,16 +5032,29 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc)
INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
{
boolean usemapcode = false;
INT32 newmapnum;
size_t mapnamelen;
size_t mapnamelen = strlen(mapname);
char *p;
mapnamelen = strlen(mapname);
if (mapnamelen == 2)/* maybe two digit code */
if (mapnamelen == 1)
{
if (mapname[0] == '*') // current map
return gamemap;
else if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map
{
newmapnum = mapheaderinfo[gamemap-1]->nextlevel;
if (newmapnum < 1 || newmapnum > NUMMAPS)
{
CONS_Alert(CONS_ERROR, M_GetText("NextLevel (%d) is not a valid map.\n"), newmapnum);
return 0;
}
else
return newmapnum;
}
}
else if (mapnamelen == 2)/* maybe two digit code */
{
if (( newmapnum = M_MapNumber(mapname[0], mapname[1]) ))
usemapcode = true;
@@ -8189,7 +8198,7 @@ void G_AddGhost(char *defdemoname)
count = READUINT16(p);
while (count--)
{
SKIPSTRING(p);
p += 2;
SKIPSTRING(p);
p++;
}
-11
View File
@@ -160,19 +160,8 @@ extern consvar_t cv_sliptideroll;
extern consvar_t cv_slamsound;
extern consvar_t cv_sloperolldist;
extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade;
extern consvar_t cv_respawnfademusicout;
extern consvar_t cv_respawnfademusicback;
extern consvar_t cv_resetspecialmusic;
extern consvar_t cv_cechotoggle;
extern consvar_t cv_resume;
extern consvar_t cv_fading;
#ifndef NONET
extern consvar_t cv_chatlogsize;
#endif
+5 -5
View File
@@ -183,14 +183,15 @@ enum EPolyFlags
PF_NoDepthTest = 0x00000200, // Disable the depth test mode
PF_Invisible = 0x00000400, // Disable write to color buffer
PF_Decal = 0x00000800, // Enable polygon offset
PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB)
PF_Modulated = 0x00001000, // Modulation (multiply output with constant RGBA)
// When set, pass the color constant into the FSurfaceInfo -> FlatColor
PF_NoTexture = 0x00002000, // Disable texture
PF_Ripple = 0x00004000, // Water shader effect
PF_ColorMapped = 0x00008000, // Surface has "tint" and "fade" colors, which are sent as uniforms to a shader.
// 0x00008000
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
PF_ForceWrapY = 0x00040000, // Force repeat texture on Y
PF_ForceWrapY = 0x00040000, // Forces repeat texture on Y
PF_Ripple = 0x00100000 // Water ripple effect. The current backend doesn't use it for anything.
// 0x20000000
// 0x40000000
// 0x80000000
@@ -208,7 +209,6 @@ enum ETextureFlags
typedef struct GLMipmap_s FTextureInfo;
// jimita 14032019
struct FLightInfo
{
FUINT light_level;
@@ -225,7 +225,7 @@ struct FSurfaceInfo
RGBA_t TintColor;
RGBA_t FadeColor;
UINT32 LightTableId;
FLightInfo LightInfo; // jimita 14032019
FLightInfo LightInfo;
};
typedef struct FSurfaceInfo FSurfaceInfo;
+4 -1
View File
@@ -1138,10 +1138,13 @@ static inline boolean saveTGA(const char *file_name, void *buffer,
UINT8 *HWR_GetScreenshot(void)
{
UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf));
static UINT8 *buf = NULL;
buf = realloc(buf, vid.width * vid.height * 3);
if (!buf)
return NULL;
// returns 24bit 888 RGB
HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf);
return buf;
+6 -2
View File
@@ -28,6 +28,7 @@
// ==========================================================================
EXPORT boolean HWRAPI(Init) (void);
EXPORT void HWRAPI(SetupGLInfo) (void);
#if defined (PURESDL) || defined (macintosh)
EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma);
#else
@@ -49,7 +50,7 @@ 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, FSurfaceInfo *Surface);
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);
@@ -63,6 +64,7 @@ EXPORT void HWRAPI(EndScreenWipe) (void);
EXPORT void HWRAPI(DoScreenWipe) (void);
EXPORT void HWRAPI(DrawIntermissionBG) (void);
EXPORT void HWRAPI(MakeScreenTexture) (void);
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
EXPORT void HWRAPI(MakeScreenFinalTexture) (void);
EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height);
@@ -94,6 +96,7 @@ EXPORT void HWRAPI(ClearLightTableCache) (void);
struct hwdriver_s
{
Init pfnInit;
SetupGLInfo pfnSetupGLInfo;
SetPalette pfnSetPalette;
FinishUpdate pfnFinishUpdate;
Draw2DLine pfnDraw2DLine;
@@ -117,6 +120,7 @@ struct hwdriver_s
DoScreenWipe pfnDoScreenWipe;
DrawIntermissionBG pfnDrawIntermissionBG;
MakeScreenTexture pfnMakeScreenTexture;
RenderVhsEffect pfnRenderVhsEffect;
MakeScreenFinalTexture pfnMakeScreenFinalTexture;
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
@@ -144,4 +148,4 @@ extern struct hwdriver_s hwdriver;
#endif //not defined _CREATE_DLL_
#endif //__HWR_DRV_H__
#endif //__HWR_DRV_H__
+579 -208
View File
File diff suppressed because it is too large. Load diff
+14 -2
View File
@@ -89,6 +89,10 @@ 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);
// My original intention was to split hw_main.c
// into files like hw_bsp.c, hw_sprites.c...
@@ -107,11 +111,12 @@ 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(int width, int height);
// hw_main.c: Planes
void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap, subsector_t *subsector);
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);
#ifdef POLYOBJECTS
@@ -127,7 +132,7 @@ 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, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags);
// moved HWR_SplitWall to hw_main.c
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
void HWR_DrawSkyBackground(float fpov);
@@ -162,6 +167,10 @@ void HWR_CorrectSWTricks(void);
// Console variables
extern consvar_t cv_grshaders;
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;
@@ -177,15 +186,18 @@ 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_grfallbackplayermodel;
extern consvar_t cv_grbatching;
extern consvar_t cv_grrenderdistance;
extern consvar_t cv_grusecustomshaders;
extern consvar_t cv_grpaletteshader;
extern consvar_t cv_grscreentextures;
extern consvar_t cv_grflashpal;
extern consvar_t cv_grportals;
extern consvar_t cv_nostencil;
extern consvar_t cv_secbright;
extern consvar_t cv_grvhseffect;
extern CV_PossibleValue_t granisotropicmode_cons_t[];
+8 -8
View File
@@ -1149,6 +1149,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
INT32 tics = spr->mobj->tics;
//mdlframe_t *next = NULL;
const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP);
const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !(spr->mobj->frame & FF_HORIZONTALFLIP));
spritedef_t *sprdef;
spriteframe_t *sprframe;
spriteinfo_t *sprinfo;
@@ -1366,17 +1367,16 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
angle_t sliptideroll = 0;
if (spr->mobj->player)
sliptideroll = ((cv_sloperoll.value) ? spr->mobj->player->sliproll : 0);
sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value) ? spr->mobj->player->sliproll : 0);
if ((spr->mobj->rollangle)||sliptideroll)
if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value))
{
angle_t rollang = 0;
rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0);
if (spr->mobj->player)
rollang = (spr->mobj->rollangle*rollfactor) + (sliptideroll*spr->mobj->player->sliptidemem);
else
rollang = (spr->mobj->rollangle*rollfactor);
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);
@@ -1423,7 +1423,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
HWD.pfnSetShader(4); // model shader
{
float this_scale = FIXED_TO_FLOAT(interp.scale);
float this_scale = FIXED_TO_FLOAT(interp.scale);
float xs = this_scale * FIXED_TO_FLOAT(interp.spritexscale);
float ys = this_scale * FIXED_TO_FLOAT(interp.spriteyscale);
@@ -1436,7 +1436,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.y += ox * gr_viewcos;
p.z += oy;
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, &Surf);
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
}
}
}
+275 -59
View File
@@ -166,6 +166,8 @@ static const GLfloat byte2float[256] = {
0.972549f, 0.976471f, 0.980392f, 0.984314f, 0.988235f, 0.992157f, 0.996078f, 1.000000f
};
// Loaded OpenGL version
static int majorGL = 0, minorGL = 0;
// -----------------+
// GL_DBG_Printf : Output debug messages to debug log if DEBUG_TO_FILE is defined,
@@ -453,6 +455,12 @@ static PFNglCopyTexSubImage2D pglCopyTexSubImage2D;
typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
static PFNgluBuild2DMipmaps pgluBuild2DMipmaps;
/* 3.0 functions */
#ifdef GL_VERSION_3_0
typedef void (APIENTRY * PFNglGenerateMipmap) (GLenum target);
static PFNglGenerateMipmap pglGenerateMipmap;
#endif
/* 1.3 functions for multitexturing */
typedef void (APIENTRY *PFNglActiveTexture) (GLenum);
static PFNglActiveTexture pglActiveTexture;
@@ -629,7 +637,6 @@ static boolean gl_shaderprogramchanged = true;
static boolean gl_batching = false;// are we currently collecting batches?
static GLint gl_palette[768];
static INT32 gl_use_palette_shader = 0;
boolean gl_palette_initialized = false;
static INT32 gl_enable_screen_textures = 1;
@@ -1029,6 +1036,10 @@ void SetupGLFunc4(void)
// GLU
pgluBuild2DMipmaps = GetGLFunc("gluBuild2DMipmaps");
#ifdef GL_VERSION_3_0
pglGenerateMipmap = GetGLFunc("glGenerateMipmap");
#endif
}
// jimita
@@ -1251,7 +1262,7 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void)
KillShaders();
return LoadShaders();
if (gl_use_palette_shader)
if (HWR_ShouldUsePaletteRendering())
{
InitPalette(0, false);
}
@@ -1340,6 +1351,20 @@ void InitPalette(int flashnum, boolean skiplut)
if (!skiplut)
{
GLenum internalFormat;
if (gl_version[0] == '1' || gl_version[0] == '2')
{
// if the OpenGL version is below 3.0, then the GL_R8 format may not be available.
// so use GL_LUMINANCE8 instead to get a single component 8-bit format
// (it is possible to have access to shaders even in some OpenGL 1.x systems,
// so palette rendering can still possibly be achieved there)
internalFormat = GL_LUMINANCE8;
}
else
{
internalFormat = GL_R8;
}
// init the palette conversion lookup texture
GLubyte *pal_lookup_tex = malloc(LUT_SIZE*LUT_SIZE*LUT_SIZE*sizeof(GLubyte));
@@ -1361,9 +1386,14 @@ void InitPalette(int flashnum, boolean skiplut)
pglBindTexture(GL_TEXTURE_3D, palette_tex_num);
pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (!pglTexImage3D)
I_Error("pglTexImage3D is NULL!");
pglTexImage3D(GL_TEXTURE_3D, 0, GL_R8, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex);
if (!pglTexImage3D){
GL_MSG_Error("pglTexImage3D is NULL!");
CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it
return;
}
pglTexImage3D(GL_TEXTURE_3D, 0, internalFormat, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex);
free(pal_lookup_tex);
}
#undef STEP_SIZE
@@ -1561,6 +1591,17 @@ EXPORT boolean HWRAPI(Init) (void)
}
// -----------------+
// SetupGLInfo : Retreive and store currently loaded OpenGL version
// -----------------+
EXPORT void HWRAPI(SetupGLInfo) (void)
{
const GLubyte *versionGL = pglGetString(GL_VERSION);
CONS_Printf("Loaded OpenGL version %s\n", (const char*)versionGL);
sscanf((const char*)versionGL, "%d.%d", &majorGL, &minorGL);
}
// -----------------+
// ClearMipMapCache : Flush OpenGL textures from memory
// -----------------+
@@ -1582,13 +1623,31 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable)
ltcachetail = cache_entry;
}
ltcachetail->next = NULL;
GLenum internalFormat;
if (gl_version[0] == '1' || gl_version[0] == '2')
{
// if the OpenGL version is below 3.0, then the GL_R8 format may not be available.
// so use GL_LUMINANCE8 instead to get a single component 8-bit format
// (it is possible to have access to shaders even in some OpenGL 1.x systems,
// so palette rendering can still possibly be achieved there)
internalFormat = GL_LUMINANCE8;
}
else
{
internalFormat = GL_R8;
}
pglGenTextures(1, &ltcachetail->id);
if (!ltcachetail->id)
I_Error("hwr lighttable cache entry id is zero");
if (!ltcachetail->id){
GL_MSG_Error("HWR Lighttable cache entry id is zero");
CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it
return;
}
pglBindTexture(GL_TEXTURE_2D, ltcachetail->id);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 256, 32, 0, GL_RED, GL_UNSIGNED_BYTE, lighttable);
pglTexImage2D(GL_TEXTURE_2D, 0, internalFormat, 256, 32, 0, GL_RED, GL_UNSIGNED_BYTE, lighttable);
// restore previously bound texture
if (!gl_batching)
@@ -1721,7 +1780,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too
if (!gl_palette_initialized)
if ((!gl_palette_initialized) && (HWR_ShouldUsePaletteRendering()))
InitPalette(0, false); // just gonna put this here for now
}
@@ -1923,6 +1982,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
const GLvoid *ptex = tex;
INT32 w, h;
GLuint texnum = 0;
if (!pTexInfo->downloaded)
{
@@ -2044,12 +2104,25 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (MipMap)
{
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (majorGL == 1 && minorGL >= 0 && minorGL < 4)
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
else if ((majorGL == 1 && minorGL >= 4) || (majorGL == 2))
{
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
}
#ifdef GL_VERSION_3_0
else if (majorGL >= 3)
{
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
pglGenerateMipmap(GL_TEXTURE_2D);
}
#endif
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 16);
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
}
else
@@ -2065,12 +2138,25 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (MipMap)
{
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (majorGL == 1 && minorGL >= 0 && minorGL < 4)
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
else if ((majorGL == 1 && minorGL >= 4) || (majorGL == 2))
{
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
}
#ifdef GL_VERSION_3_0
else if (majorGL >= 3)
{
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
pglGenerateMipmap(GL_TEXTURE_2D);
}
#endif
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 16);
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
}
else
@@ -2085,13 +2171,26 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
{
if (MipMap)
{
pgluBuild2DMipmaps(GL_TEXTURE_2D, textureformatGL, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (majorGL == 1 && minorGL >= 0 && minorGL < 4)
pgluBuild2DMipmaps(GL_TEXTURE_2D, textureformatGL, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
else if ((majorGL == 1 && minorGL >= 4) || (majorGL == 2))
{
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
}
#ifdef GL_VERSION_3_0
else if (majorGL >= 3)
{
pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
pglGenerateMipmap(GL_TEXTURE_2D);
}
#endif
// Control the mipmap level of detail
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); // the lower the number, the higer the detail
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 16);
}
else
{
@@ -2304,10 +2403,10 @@ static int comparePolygons(const void *p1, const void *p2)
diff = poly1->texNum - poly2->texNum;
if (diff != 0) return diff;
if (gl_use_palette_shader)
if (HWR_ShouldUsePaletteRendering())
{
diff = poly1->surf.LightTableId - poly2->surf.LightTableId;
if (diff != 0) return diff;
diff = poly1->surf.LightTableId - poly2->surf.LightTableId;
if (diff != 0) return diff;
}
diff = poly1->polyFlags - poly2->polyFlags;
@@ -2447,7 +2546,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
if (gl_allowshaders)
{
Shader_Load(&currentSurfaceInfo, &firstPoly, &firstTint, &firstFade);
if (gl_use_palette_shader)
if (HWR_ShouldUsePaletteRendering())
{
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId);
@@ -2564,7 +2663,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
changeState = true;
changePolyFlags = true;
}
if ((gl_allowshaders) && (gl_use_palette_shader))
if ((gl_allowshaders) && (HWR_ShouldUsePaletteRendering()))
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
@@ -2578,7 +2677,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
changeSurfaceInfo = true;
}
}
else if ((gl_allowshaders) && (!gl_use_palette_shader))
else if ((gl_allowshaders) && (!HWR_ShouldUsePaletteRendering()))
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
@@ -2709,7 +2808,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade);
if (gl_use_palette_shader)
if (HWR_ShouldUsePaletteRendering())
{
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId);
@@ -2793,37 +2892,40 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
// PolyColor
if (pSurf)
{
// If Modulated, mix the surface colour to the texture
// If modulated, mix the surface colour to the texture
if (CurrentPolyFlags & PF_Modulated)
{
// Poly color
poly.red = byte2float[pSurf->PolyColor.s.red];
poly.green = byte2float[pSurf->PolyColor.s.green];
poly.blue = byte2float[pSurf->PolyColor.s.blue];
poly.alpha = byte2float[pSurf->PolyColor.s.alpha];
pglColor4ubv((GLubyte*)&pSurf->PolyColor.s);
}
// Tint color
tint.red = byte2float[pSurf->TintColor.s.red];
tint.green = byte2float[pSurf->TintColor.s.green];
tint.blue = byte2float[pSurf->TintColor.s.blue];
tint.alpha = byte2float[pSurf->TintColor.s.alpha];
// If the surface is either modulated or colormapped, or both
if (CurrentPolyFlags & (PF_Modulated | PF_ColorMapped))
{
poly.red = byte2float[pSurf->PolyColor.s.red];
poly.green = byte2float[pSurf->PolyColor.s.green];
poly.blue = byte2float[pSurf->PolyColor.s.blue];
poly.alpha = byte2float[pSurf->PolyColor.s.alpha];
}
// Fade color
fade.red = byte2float[pSurf->FadeColor.s.red];
fade.green = byte2float[pSurf->FadeColor.s.green];
fade.blue = byte2float[pSurf->FadeColor.s.blue];
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
if (gl_use_palette_shader && gl_allowshaders)
// Only if the surface is colormapped
if (CurrentPolyFlags & PF_ColorMapped)
{
tint.red = byte2float[pSurf->TintColor.s.red];
tint.green = byte2float[pSurf->TintColor.s.green];
tint.blue = byte2float[pSurf->TintColor.s.blue];
tint.alpha = byte2float[pSurf->TintColor.s.alpha];
fade.red = byte2float[pSurf->FadeColor.s.red];
fade.green = byte2float[pSurf->FadeColor.s.green];
fade.blue = byte2float[pSurf->FadeColor.s.blue];
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
}
if (HWR_ShouldUsePaletteRendering() && gl_allowshaders)
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
pglActiveTexture(GL_TEXTURE0);
}
}
}
Shader_Load(pSurf, &poly, &tint, &fade);
}
@@ -3165,10 +3267,6 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
break;
}
break;
case HWD_SET_PALETTE_SHADER_ENABLED:
gl_use_palette_shader = Value;
break;
case HWD_SET_TEXTUREFILTERMODE:
switch (Value)
@@ -3205,11 +3303,25 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
mag_filter = GL_LINEAR;
min_filter = GL_NEAREST;
}
if (!pgluBuild2DMipmaps)
if (majorGL == 1 && minorGL >= 0 && minorGL < 4)
{
MipMap = GL_FALSE;
min_filter = GL_LINEAR;
if (!pgluBuild2DMipmaps)
{
MipMap = GL_FALSE;
min_filter = GL_LINEAR;
}
}
#ifdef GL_VERSION_3_0
else
{
if (!pglGenerateMipmap)
{
MipMap = GL_FALSE;
min_filter = GL_LINEAR;
}
}
#endif
Flush(); //??? if we want to change filter mode by texture, remove this
break;
@@ -3517,7 +3629,7 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
#define BUFFER_OFFSET(i) ((char*)(i))
static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface)
static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
{
static GLRGBAFloat poly = {0,0,0,0};
static GLRGBAFloat tint = {0,0,0,0};
@@ -3578,12 +3690,13 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
pglEnable(GL_NORMALIZE);
#ifdef USE_FTRANSFORM_MIRROR
// flipped is if the object is flipped
// flipped is if the object is vertically flipped
// hflipped is if the object is horizontally flipped
// pos->flip is if the screen is flipped vertically
// pos->mirror is if the screen is flipped horizontally
// XOR all the flips together to figure out what culling to use!
{
boolean reversecull = (flipped ^ pos->flip ^ pos->mirror);
boolean reversecull = (flipped ^ hflipped ^ pos->flip ^ pos->mirror);
if (reversecull)
pglCullFace(GL_FRONT);
else
@@ -3591,7 +3704,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
}
#else
// pos->flip is if the screen is flipped too
if (flipped != pos->flip) // If either are active, but not both, invert the model's culling
if (flipped ^ hflipped ^ pos->flip) // If one or three of these are active, but not two, invert the model's culling
pglCullFace(GL_FRONT);
else
pglCullFace(GL_BACK);
@@ -3601,6 +3714,8 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
pglTranslatef(pos->x, pos->z, pos->y);
if (flipped)
scaley = -scaley;
if (hflipped)
scalez = -scalez;
#ifdef USE_FTRANSFORM_ANGLEZ
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f); // rotate by slope from Kart
#endif
@@ -3729,9 +3844,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
// -----------------+
// HWRAPI DrawModel : Draw a model
// -----------------+
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface)
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)
{
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, Surface);
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface);
}
// -----------------+
@@ -4145,6 +4260,107 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
tex_downloaded = screentexture;
}
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
{
INT32 texsize = 512;
float xfix, yfix;
float fix[8];
GLubyte color[4] = {255, 255, 255, 255};
float i;
float screenVerts[12] =
{
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};
// look for power of two that is large enough for the screen
while (texsize < screen_width || texsize < screen_height)
texsize <<= 1;
xfix = 1/((float)(texsize)/((float)((screen_width))));
yfix = 1/((float)(texsize)/((float)((screen_height))));
// Slight fuzziness
MakeScreenTexture();
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
pglBindTexture(GL_TEXTURE_2D, screentexture);
for (i = 0; i < 1; i += 2.f/vid.height)
{
fix[2] = (float)(rand() % 128) / -22000 * xfix;
fix[0] = fix[2];
fix[6] = fix[0] + xfix;
fix[4] = fix[2] + xfix;
fix[1] = fix[7] = i*yfix;
fix[3] = fix[5] = (i+0.015)*yfix;
screenVerts[1] = screenVerts[10] = 2*i - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03;
pglColor4ubv(color);
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
// Upward bar
MakeScreenTexture();
pglBindTexture(GL_TEXTURE_2D, screentexture);
color[0] = color[1] = color[2] = 190;
color[3] = 250;
pglColor4ubv(color);
fix[0] = 0.0f;
fix[6] = xfix;
fix[2] = (float)updistort / screen_width * xfix;
fix[4] = fix[2] + fix[6];
screenVerts[1] = screenVerts[10] = 2.0f*upbary/screen_height - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/screen_height;
fix[1] = fix[7] = (float)upbary/screen_height * yfix;
fix[3] = fix[5] = fix[1] + (float)barsize/2/screen_height * yfix;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
fix[1] = fix[7] += (fix[3] - fix[7])*2;
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
// Downward bar
MakeScreenTexture();
pglBindTexture(GL_TEXTURE_2D, screentexture);
fix[0] = 0.0f;
fix[6] = xfix;
fix[2] = (float)downdistort / screen_width * -xfix;
fix[4] = fix[2] + fix[6];
screenVerts[1] = screenVerts[10] = 2.0f*downbary/screen_height - 1.0f;
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/screen_height;
fix[1] = fix[7] = (float)downbary/screen_height * yfix;
fix[3] = fix[5] = fix[1] + (float)barsize/2/screen_height * yfix;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
fix[1] = fix[7] += (fix[3] - fix[7])*2;
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
{
INT32 texsize = 512;
@@ -4241,7 +4457,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
// prepare shader, if it is enabled
Shader_SetUniforms(NULL, NULL, NULL, NULL);
if (gl_use_palette_shader && cv_grshaders.value)
if (HWR_ShouldUsePaletteRendering())
{
pglUseProgram(gl_shaderprograms[8].program); // palette shader
pglActiveTexture(GL_TEXTURE1);
@@ -4255,7 +4471,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
tex_downloaded = finalScreenTexture;
if (gl_use_palette_shader && cv_grshaders.value)
if (HWR_ShouldUsePaletteRendering())
{
pglUseProgram(0);
pglActiveTexture(GL_TEXTURE0);
-9
View File
@@ -534,9 +534,6 @@ EXPORT INT32 HWRAPI(Startup) (I_Error_t FatalErrorFunction, snddev_t *snd_dev)
case FSOUND_OUTPUT_A3D:
DBG_Printf("FMOD driver: A3D driver.\n");
break;
case FSOUND_OUTPUT_XBOX:
DBG_Printf("FMOD driver: Xbox driver\n");
break;
case FSOUND_OUTPUT_OSS:
DBG_Printf("FMOD driver: Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers.\n");
break;
@@ -549,12 +546,6 @@ EXPORT INT32 HWRAPI(Startup) (I_Error_t FatalErrorFunction, snddev_t *snd_dev)
case FSOUND_OUTPUT_MAC:
DBG_Printf("FMOD driver: Mac SoundManager driver\n");
break;
case FSOUND_OUTPUT_PS2:
DBG_Printf("FMOD driver: PlayStation 2 driver\n");
break;
case FSOUND_OUTPUT_GC:
DBG_Printf("FMOD driver: Gamecube driver\n");
break;
case FSOUND_OUTPUT_NOSOUND_NONREALTIME:
DBG_Printf("FMOD driver: This is the same as nosound, but the sound generation is driven by FSOUND_Update\n");
break;
+12 -6
View File
@@ -42,8 +42,9 @@ consvar_t cv_masterserver_timeout = {
NULL, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
};
CV_PossibleValue_t masterserver_debug_cons_t[] = {{0, "Off"}, {1, "PrintOnly"}, {2, "On"}, {0, NULL}};
consvar_t cv_masterserver_debug = {
"masterserver_debug", "Off", CV_SAVE|CV_CALL, CV_OnOff,
"masterserver_debug", "Off", CV_SAVE|CV_CALL, masterserver_debug_cons_t,
MasterServer_Debug_OnChange, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
};
@@ -86,12 +87,17 @@ Printf_url (const char *url)
{
boolean startup;
#ifdef HAVE_THREADS
I_lock_mutex(&con_mutex);
startup = con_startup;
I_unlock_mutex(con_mutex);
#else
startup = con_startup;
#endif
(startup ? I_OutputMsg : CONS_Printf)(
"HMS: connecting '%s'...\n", url);
if (cv_masterserver_debug.value)
(startup ? I_OutputMsg : CONS_Printf)(
"HMS: connecting '%s'...\n", url);
}
static size_t
@@ -201,7 +207,7 @@ HMS_connect (const char *format, ...)
buffer->buffer = malloc(buffer->end);
buffer->needle = 0;
if (cv_masterserver_debug.value)
if (cv_masterserver_debug.value == 2)
{
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_STDERR, logstream);
@@ -385,7 +391,7 @@ HMS_list_servers (void)
if (! hms)
return;
if (HMS_do(hms))
if (HMS_do(hms) && cv_masterserver_debug.value)
{
CONS_Printf("%s\n", hms->buffer);
}
@@ -579,7 +585,7 @@ MasterServer_Debug_OnChange (void)
{
#ifdef MASTERSERVER
/* TODO: change to 'latest-log.txt' for log files revision. */
if (cv_masterserver_debug.value)
if (cv_masterserver_debug.value == 2)
CONS_Printf("Master server debug messages will appear in log.txt\n");
#endif
}
+45 -9
View File
@@ -1142,6 +1142,10 @@ void HU_Ticker(void)
}
if (cechotimer > 0) --cechotimer;
// Animate the desynch dots
if (hu_resynching)
resynch_ticker++; //tic tic tic tic tic
HU_TickSongCredits();
}
@@ -2579,8 +2583,24 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
gfxnum = Ping_gfx_num(lag);
if (measureid == 1)
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
{
if (cv_ticrate.value == 2){
V_DrawScaledPatch(x+12 - pingmeasure[measureid]->width, y+22, flags, pingmeasure[measureid]);
}else{
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
}
}
if (cv_pingicon.value)
{
if (cv_ticrate.value == 2){
V_DrawScaledPatch(x+2, y+13, flags, pinggfx[gfxnum]);
}else{
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
}
}
if (servermaxping && lag > servermaxping && hu_tick < 4)
{
@@ -2592,11 +2612,21 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
{
lag = (INT32)(lag * (1000.00f / TICRATE));
}
if (cv_ticrate.value == 2){
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+22, flags, lag, colormap);
}else{
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, lag, colormap);
if (measureid == 0)
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
if (measureid == 0){
if (cv_ticrate.value == 2){
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+22, flags, pingmeasure[measureid]);
}else{
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
}
}
}
//
@@ -2684,10 +2714,16 @@ static void HU_DrawRankings(void)
hilicol = ((gametype == GT_RACE) ? V_SKYMAP : V_REDMAP);
// draw the current gametype in the lower right
if (modeattacking)
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "Record Attack");
//if (modeattacking)
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "Record Attack");
//else
//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))
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "UNKNOWN");
else
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametype_cons_t[gametype].strvalue);
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, G_BuildMapTitle(gamemap));
if (G_GametypeHasTeams())
{
+9 -2
View File
@@ -79,19 +79,24 @@ typedef struct
char data[MAXPACKETLENGTH];
} ATTRPACK doomcom_t;
#ifdef HOLEPUNCH
typedef struct
{
INT32 magic;
INT32 addr;
INT16 port;
} ATTRPACK holepunch_t;
#endif
#if defined(_MSC_VER)
#pragma pack()
#endif
extern doomcom_t *doomcom;
#ifdef HOLEPUNCH
extern holepunch_t *holepunchpacket;
#endif
/** \brief return packet in doomcom struct
*/
@@ -152,12 +157,14 @@ extern void (*I_NetCloseSocket)(void);
/** \brief send a hole punching request
*/
#ifdef HOLEPUNCH
extern void (*I_NetRequestHolePunch)(INT32 node);
#endif
/** \brief register this machine on the hole punching server
*/
#ifdef HOLEPUNCH
extern void (*I_NetRegisterHolePunch)(void);
#endif
extern boolean (*I_Ban) (INT32 node);
extern void (*I_ClearBans)(void);
-2
View File
@@ -369,6 +369,4 @@ const char *I_ClipboardPaste(void);
void I_RegisterSysCommands(void);
void I_CursedWindowMovement(int xd, int yd);
#endif
+15 -2
View File
@@ -201,8 +201,10 @@ static size_t broadcastaddresses = 0;
static boolean nodeconnected[MAXNETNODES+1];
static banned_t *banned;
/* See ../doc/Holepunch-Protocol.txt */
#ifdef HOLEPUNCH
static const INT32 hole_punch_magic = MSBF_LONG (0x52eb11);
#endif
#endif
static size_t numbans = 0;
static size_t banned_size = 0;
@@ -609,8 +611,10 @@ is_external_address (UINT32 p)
}
}
#ifdef HOLEPUNCH
static boolean hole_punch(ssize_t c)
{
/* See ../doc/Holepunch-Protocol.txt */
if (cv_rendezvousserver.string[0] &&
c == 10 && holepunchpacket->magic == hole_punch_magic &&
@@ -631,7 +635,9 @@ static boolean hole_punch(ssize_t c)
{
return false;
}
}
#endif
// Returns true if a packet was received from a new node, false in all other cases
static boolean SOCK_Get(void)
@@ -655,11 +661,12 @@ static boolean SOCK_Get(void)
break;
}
#endif
#ifdef HOLEPUNCH
if (hole_punch(c))
{
break;
}
#endif
// find remote node number
for (j = 1; j <= MAXNETNODES; j++) //include LAN
@@ -1363,7 +1370,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
}
/* See ../doc/Holepunch-Protocol.txt */
#ifdef HOLEPUNCH
static void rendezvous(int size)
{
char *addrs = strdup(cv_rendezvousserver.string);
@@ -1391,7 +1398,9 @@ 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);
}
@@ -1417,6 +1426,8 @@ static void SOCK_RegisterHolePunch(void)
}
#endif
#endif
static boolean SOCK_OpenSocket(void)
{
#ifndef NONET
@@ -1439,9 +1450,11 @@ static boolean SOCK_OpenSocket(void)
I_NetCanSend = SOCK_CanSend;
I_NetCanGet = SOCK_CanGet;
#endif
#ifdef HOLEPUNCH
I_NetRequestHolePunch = SOCK_RequestHolePunch;
I_NetRegisterHolePunch = SOCK_RegisterHolePunch;
#endif
// build the socket but close it first
SOCK_CloseSocket();
-41
View File
@@ -30,12 +30,6 @@ static precise_t enterprecise, oldenterprecise;
static fixed_t entertic, oldentertics;
static double tictimer;
// A little more than the minimum sleep duration on Windows.
// May be incorrect for other platforms, but we don't currently have a way to
// query the scheduler granularity. SDL will do what's needed to make this as
// low as possible though.
#define MIN_SLEEP_DURATION_MS 2.1
tic_t I_GetTime(void)
{
return g_time.time;
@@ -86,38 +80,3 @@ void I_UpdateTime(fixed_t timescale)
g_time.timefrac = FLOAT_TO_FIXED(fractional);
}
}
void I_SleepDuration(precise_t duration)
{
UINT64 precision = I_GetPrecisePrecision();
INT32 sleepvalue = cv_sleep.value;
UINT64 delaygranularity;
precise_t cur;
precise_t dest;
{
double gran = round(((double)(precision / 1000) * sleepvalue * MIN_SLEEP_DURATION_MS));
delaygranularity = (UINT64)gran;
}
cur = I_GetPreciseTime();
dest = cur + duration;
// the reason this is not dest > cur is because the precise counter may wrap
// two's complement arithmetic is our friend here, though!
// e.g. cur 0xFFFFFFFFFFFFFFFE = -2, dest 0x0000000000000001 = 1
// 0x0000000000000001 - 0xFFFFFFFFFFFFFFFE = 3
while ((INT64)(dest - cur) > 0)
{
// If our cv_sleep value exceeds the remaining sleep duration, use the
// hard sleep function.
if (sleepvalue > 0 && (dest - cur) > delaygranularity)
{
I_Sleep(sleepvalue);
}
// Otherwise, this is a spinloop.
cur = I_GetPreciseTime();
}
}
+352 -174
View File
@@ -8,6 +8,7 @@
#include "hu_stuff.h"
#include "g_game.h"
#include "m_random.h"
#include "m_menu.h" // ffdhidshfuisduifigergho9igj89dgodhfih AAAAAAAAAA
#include "p_local.h"
#include "p_slopes.h"
#include "r_draw.h"
@@ -54,25 +55,33 @@ consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0,
consvar_t cv_want_xoffset = {"hud_wanted_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_want_yoffset = {"hud_wanted_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_newspeedometer = {"newspeedometer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_stat_xoffset = {"hud_stat_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_stat_yoffset = {"hud_stat_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
//extra hud things
consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t speedo_cons_t[] = {{1, "Default"}, {2, "Small"}, {3, "P-Meter"}, {0, NULL}};
consvar_t cv_newspeedometer = {"newspeedometer", "Default", CV_SAVE, speedo_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
//hardcode saltyhop mhhm
consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
//Colourized HUD
consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, Saturn_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_colorizeditembox = {"colorizeditembox", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t HudColor_cons_t[MAXSKINCOLORS+1];
consvar_t cv_colorizedhudcolor = {"colorizedhudcolor", "Skin Color", CV_SAVE, HudColor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_darkitembox = {"darkitembox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_highresportrait = {"highresportrait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //make char potraits use their high-res version instead
consvar_t cv_biglaps = {"biglaphud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // here for ppl who dont want to make 2 more patches for their custom hud
consvar_t cv_darkitembox = {"darkitembox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //itembox gets a dark box with specific items
consvar_t cv_biglaps = {"biglaphud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //here for ppl who dont want to make 2 more patches for their custom hud
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
@@ -553,7 +562,7 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
return;
}
starttranscolor = (skinnum != TC_DEFAULT) ? ( (local) ? localskins : skins )[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
starttranscolor = (skinnum != TC_DEFAULT) ? ((local) ? localskins : skins)[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
// Fill in the entries of the palette that are fixed
for (i = 0; i < starttranscolor; i++)
@@ -587,11 +596,18 @@ UINT8 K_GetKartColorByName(const char *name)
return 0;
}
UINT8 K_GetHudColor()
UINT8 K_GetHudColor(void)
{
if (cv_colorizedhud.value){
if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value;
}
if (stplyr && P_IsLocalPlayer(stplyr) && gamestate == GS_LEVEL) return stplyr->skincolor;
return ((stplyr && gamestate == GS_LEVEL) ? stplyr->skincolor : cv_playercolor.value);
}
boolean K_UseColorHud(void)
{
if (stplyr && players - stplyr != consoleplayer) return stplyr->skincolor;
if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value;
return cv_playercolor.value;
return (cv_colorizedhud.value && clr_hud);
}
//}
@@ -679,10 +695,14 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_mini_yoffset);
CV_RegisterVar(&cv_want_xoffset);
CV_RegisterVar(&cv_want_yoffset);
CV_RegisterVar(&cv_stat_xoffset);
CV_RegisterVar(&cv_stat_yoffset);
CV_RegisterVar(&cv_showstats);
CV_RegisterVar(&cv_showinput);
CV_RegisterVar(&cv_newspeedometer);
CV_RegisterVar(&cv_saltyhop);
CV_RegisterVar(&cv_saltyhopsfx);
CV_RegisterVar(&cv_saltysquish);
@@ -696,6 +716,8 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_biglaps);
CV_RegisterVar(&cv_highresportrait);
CV_RegisterVar(&cv_slamsound);
CV_RegisterVar(&cv_minihead);
@@ -705,6 +727,9 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_stagetitle);
CV_RegisterVar(&cv_lessflicker);
CV_RegisterVar(&cv_mouseturn);
}
//}
@@ -3059,7 +3084,7 @@ static void K_SpawnAIZDust(player_t *player)
static void K_StretchPlayerGravity(player_t *p)
{
fixed_t mos = mapobjectscale;
fixed_t mos = FRACUNIT;
fixed_t rzs = abs(p->mo->momz);
fixed_t zspd = abs(rzs/mos);
fixed_t stretchScaleFactor = 0;
@@ -3087,7 +3112,7 @@ static void K_StretchPlayerGravity(player_t *p)
if (p->mo->slamsoundtimer)
p->mo->slamsoundtimer--;
if (cv_slamsound.value == 1 && (p->mo->eflags & MFE_JUSTHITFLOOR) && p->mo->stretchslam > 4*mos && !p->mo->slamsoundtimer)
if (cv_slamsound.value && (p->mo->eflags & MFE_JUSTHITFLOOR) && p->mo->stretchslam > 4*mos && !p->mo->slamsoundtimer)
{
S_StartSound(p->mo, sfx_s3k4c);
p->mo->slamsoundtimer = TICRATE;
@@ -3120,12 +3145,11 @@ static void K_StretchPlayerGravity(player_t *p)
else
slamDiv = FixedDiv(p->mo->stretchslam, stretchScaleFactor);
p->mo->spritexscale = (dxs+(((slamDiv*2)/3)*2));
p->mo->spriteyscale = ((dys-(slamDiv)));
p->mo->spriteyscale = (dys-(slamDiv));
if (p->mo->stretchslam > 0)
p->mo->stretchslam -= (4*mos);
else
p->mo->stretchslam = 0;
}
}
@@ -3193,6 +3217,7 @@ static void K_QuiteSaltyHop(player_t *p)
static INT32 K_FindPlayerNum(player_t *plyr)
{
INT32 i;
for(i = 0; i < 4; i++)
{
if (plyr == &players[displayplayers[i]])
@@ -3222,7 +3247,6 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
lookAngle = R_PointToAngle2(camera[pNum].x, camera[pNum].y, p->mo->x, p->mo->y);
if (!R_PointToDist(p->mo->x, p->mo->y))
lookAngle = p->mo->angle;
@@ -3234,13 +3258,10 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
p->mo->reservezangle = zangle;
p->mo->reservexydir = xydirection;
}
else
else if (p->mo->reservezangle)
{
if (p->mo->reservezangle)
{
zangle = p->mo->reservezangle;
xydirection = p->mo->reservexydir;
}
zangle = p->mo->reservezangle;
xydirection = p->mo->reservexydir;
}
if ((p->mo->eflags & MFE_VERTICALFLIP) && (!dontflip))
@@ -3248,12 +3269,10 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
an = (lookAngle - xydirection);
final_slope = -(FixedMul(FINESINE(an>>ANGLETOFINESHIFT), zangle));
an = (INT32)(final_slope - p->tilt_sprite) / 3; // instead of just a direct snap
if (an)
p->tilt_sprite += an;
else
p->tilt_sprite = final_slope;
an = (INT32)(final_slope - p->tilt_sprite) / (camspin[pNum] ? 1 : 3);
p->tilt_sprite = an ? p->tilt_sprite + an : final_slope;
return -p->tilt_sprite;
}
@@ -6007,7 +6026,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
P_SetScale(overlay, player->mo->scale);
}
player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds
if (P_IsLocalPlayer(player))
if (P_IsLocalPlayer(player) && cv_supermusic.value && cv_birdmusic.value)
S_ChangeMusicSpecial("kinvnc");
else
S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc));
@@ -6212,7 +6231,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
player->mo->destscale = (6*player->mo->destscale)/8;
player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds
if (P_IsLocalPlayer(player))
if (P_IsLocalPlayer(player) && cv_growmusic.value && cv_birdmusic.value )
S_ChangeMusicSpecial("kgrow");
else
S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow));
@@ -6881,21 +6900,15 @@ void K_UpdateSpectateGrief(void)
INT32 i;
if (nospectategrief)
{
return;
}
if (leveltime <= (starttime + 20*TICRATE))
{
return;
}
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
{
continue;
}
numingame++;
}
@@ -6944,6 +6957,10 @@ static patch_t *skp_smallstickerclr;
static patch_t *kp_itemmulstickerclr[2];
static patch_t *kp_itembgclr[4];
//Kartz speedo
static patch_t *kp_kartzspeedo[25];
static patch_t *kp_startcountdown[16];
static patch_t *kp_racefinish[6];
@@ -7029,12 +7046,12 @@ void K_LoadKartHUDGraphics(void)
kp_karmasticker = W_CachePatchName("K_STKARM", PU_HUDGFX);
kp_splitkarmabomb = W_CachePatchName("K_SPTKRM", PU_HUDGFX);
kp_timeoutsticker = W_CachePatchName("K_STTOUT", PU_HUDGFX);
if (big_lap){
kp_lapstickerbig = W_CachePatchName("K_STLAPB", PU_HUDGFX);
kp_lapstickerbig2 = W_CachePatchName("K_STLA2B", PU_HUDGFX);
}
}
//Colourized hud
if (clr_hud)
{
@@ -7056,12 +7073,41 @@ void K_LoadKartHUDGraphics(void)
kp_lapstickerbigclr = W_CachePatchName("K_SCLAPB", PU_HUDGFX);
kp_lapstickerbig2clr = W_CachePatchName("K_SCLA2B", PU_HUDGFX);
}
if (snw_speedo){
if (snw_speedo)
skp_smallstickerclr = W_CachePatchName("SC_SMSTC", PU_HUDGFX);
}
}
//KartZ speedo
if (kartzspeedo)
{
kp_kartzspeedo[0] = W_CachePatchName("K_KZSP1", PU_HUDGFX);
kp_kartzspeedo[1] = W_CachePatchName("K_KZSP2", PU_HUDGFX);
kp_kartzspeedo[2] = W_CachePatchName("K_KZSP3", PU_HUDGFX);
kp_kartzspeedo[3] = W_CachePatchName("K_KZSP4", PU_HUDGFX);
kp_kartzspeedo[4] = W_CachePatchName("K_KZSP5", PU_HUDGFX);
kp_kartzspeedo[5] = W_CachePatchName("K_KZSP6", PU_HUDGFX);
kp_kartzspeedo[6] = W_CachePatchName("K_KZSP7", PU_HUDGFX);
kp_kartzspeedo[7] = W_CachePatchName("K_KZSP8", PU_HUDGFX);
kp_kartzspeedo[8] = W_CachePatchName("K_KZSP9", PU_HUDGFX);
kp_kartzspeedo[9] = W_CachePatchName("K_KZSP10", PU_HUDGFX);
kp_kartzspeedo[10] = W_CachePatchName("K_KZSP11", PU_HUDGFX);
kp_kartzspeedo[11] = W_CachePatchName("K_KZSP12", PU_HUDGFX);
kp_kartzspeedo[12] = W_CachePatchName("K_KZSP13", PU_HUDGFX);
kp_kartzspeedo[13] = W_CachePatchName("K_KZSP14", PU_HUDGFX);
kp_kartzspeedo[14] = W_CachePatchName("K_KZSP15", PU_HUDGFX);
kp_kartzspeedo[15] = W_CachePatchName("K_KZSP16", PU_HUDGFX);
kp_kartzspeedo[16] = W_CachePatchName("K_KZSP17", PU_HUDGFX);
kp_kartzspeedo[17] = W_CachePatchName("K_KZSP18", PU_HUDGFX);
kp_kartzspeedo[18] = W_CachePatchName("K_KZSP19", PU_HUDGFX);
kp_kartzspeedo[19] = W_CachePatchName("K_KZSP20", PU_HUDGFX);
kp_kartzspeedo[20] = W_CachePatchName("K_KZSP21", PU_HUDGFX);
kp_kartzspeedo[21] = W_CachePatchName("K_KZSP22", PU_HUDGFX);
kp_kartzspeedo[22] = W_CachePatchName("K_KZSP23", PU_HUDGFX);
kp_kartzspeedo[23] = W_CachePatchName("K_KZSP24", PU_HUDGFX);
kp_kartzspeedo[24] = W_CachePatchName("K_KZSP25", PU_HUDGFX);
}
// Starting countdown
kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX);
kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX);
@@ -7531,6 +7577,121 @@ INT32 K_calcSplitFlags(INT32 snapflags)
return (splitflags|snapflags);
}
static void K_drawKartStats(void)
{
INT32 x, y, spdoffset, flags;
// For 1-player display
x = 15;
y = 150;
spdoffset = 0;
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
UINT8 splitnum = 0;
for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum)
{
if (stplyr == &players[displayplayers[splitnum]])
break;
}
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_statdisplay))
return;
#endif
// I tried my best, but this is still mess :/
if (splitscreen)
{
if (splitscreen == 1)
{
// If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping
// to bottom
if (splitnum == 0)
{
y /= 2;
flags = V_SNAPTOLEFT;
}
else
{
// Can move it down a bit
y += 20;
}
}
else
{
// In 4-player splitscreen...
flags = 0;
// ...For players 2 and 4, which are at right side, we move x coordinate...
if (splitnum == 1 || splitnum == 3)
x += BASEVIDWIDTH/2;
// ...Else, for players on left side we can snap position to left...
else
flags |= V_SNAPTOLEFT;
// ...For players 1 and 2, which are at top side, we move y coordinate...
if (splitnum == 0 || splitnum == 1)
y /= 2;
// ...Else, for players on bottom side we can snap position to bottom
else
{
flags |= V_SNAPTOBOTTOM;
// Can move it down a bit
y += 20;
}
}
}
//Internal offset for speedometer
if (cv_kartspeedometer.value)
{
if (cv_newspeedometer.value == 2 && snw_speedo)
spdoffset = -10;
else
spdoffset = -14;
}
else
spdoffset = 0;
// Customizations c:
x += 18 + cv_stat_xoffset.value;
y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset;
flags |= V_HUDTRANS;
skin_t *fakeskin;
fakeskin = &skins[stplyr->skin];
// local skinner
if (stplyr->localskin)
{
if (stplyr->skinlocal)
fakeskin = &localskins[stplyr->localskin - 1];
else
fakeskin = &skins[stplyr->localskin - 1];
}
if (!splitscreen)
{
// Skin name
V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin->realname));
// Icon and stats
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
else
V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE));
V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE));
}
else
{
// In splitscreen, just draw a string with stats
V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight));
}
}
static void K_drawKartItem(void)
{
// ITEM_X = BASEVIDWIDTH-50; // 270
@@ -7542,7 +7703,7 @@ static void K_drawKartItem(void)
patch_t *localpatch = kp_nodraw;
patch_t *localbg;
if (cv_colorizeditembox.value && cv_colorizedhud.value && clr_hud)
if (cv_colorizeditembox.value && K_UseColorHud())
localbg = ((offset) ? kp_itembgclr[2] : kp_itembgclr[0]);
else
localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]);
@@ -7706,12 +7867,8 @@ static void K_drawKartItem(void)
break;
case KITEM_INVINCIBILITY:
localpatch = localinv;
if (cv_darkitembox.value){
if (cv_colorizeditembox.value && cv_colorizedhud.value && clr_hud)
localbg = kp_itembgclr[offset+1];
else
localbg = kp_itembg[offset+1];
}
if (cv_darkitembox.value)
localbg = (cv_colorizeditembox.value && K_UseColorHud()) ? kp_itembgclr[offset + 1] : kp_itembg[offset + 1];
break;
case KITEM_BANANA:
localpatch = kp_banana[offset];
@@ -7733,12 +7890,8 @@ static void K_drawKartItem(void)
break;
case KITEM_SPB:
localpatch = kp_selfpropelledbomb[offset];
if (cv_darkitembox.value){
if (cv_colorizeditembox.value && cv_colorizedhud.value && clr_hud)
localbg = kp_itembgclr[offset+1];
else
localbg = kp_itembg[offset+1];
}
if (cv_darkitembox.value)
localbg = (cv_colorizeditembox.value && K_UseColorHud()) ? kp_itembgclr[offset + 1] : kp_itembg[offset + 1];
break;
case KITEM_GROW:
localpatch = kp_grow[offset];
@@ -7748,12 +7901,8 @@ static void K_drawKartItem(void)
break;
case KITEM_THUNDERSHIELD:
localpatch = kp_thundershield[offset];
if (cv_darkitembox.value){
if (cv_colorizeditembox.value && cv_colorizedhud.value && clr_hud)
localbg = kp_itembgclr[offset+1];
else
localbg = kp_itembg[offset+1];
}
if (cv_darkitembox.value)
localbg = (cv_colorizeditembox.value && K_UseColorHud()) ? kp_itembgclr[offset + 1] : kp_itembg[offset + 1];
break;
case KITEM_HYUDORO:
localpatch = kp_hyudoro[offset];
@@ -7822,31 +7971,18 @@ static void K_drawKartItem(void)
colmap = R_GetTranslationColormap(colormode, localcolor, GTC_CACHE);
if (cv_colorizeditembox.value && cv_colorizedhud.value && clr_hud)
{
if (cv_colorizeditembox.value && K_UseColorHud())
V_DrawMappedPatch(fx, fy, V_HUDTRANS|fflags, localbg,colormap);
}
else
{
V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, localbg);
}
// Then, the numbers:
if (stplyr->kartstuff[k_itemamount] >= numberdisplaymin && !stplyr->kartstuff[k_itemroulette])
{
//Colourized hud
if (cv_colorizedhud.value && clr_hud)
{
V_DrawMappedPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), kp_itemmulstickerclr[offset],colormap); // flip this graphic for p2 and p4 in split and shift it.
}
else
{
V_DrawScaledPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), kp_itemmulsticker[offset]); // flip this graphic for p2 and p4 in split and shift it.
}
if (!K_UseColorHud())
V_DrawScaledPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), kp_itemmulsticker[offset]);
else //Colourized hud
V_DrawMappedPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), kp_itemmulstickerclr[offset], colormap); // flip this graphic for p2 and p4 in split and shift it.
V_DrawFixedPatch(fx<<FRACBITS, fy<<FRACBITS, FRACUNIT, V_HUDTRANS|fflags, localpatch, colmap);
if (offset)
@@ -7856,7 +7992,7 @@ static void K_drawKartItem(void)
V_DrawString(fx+24, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|fflags, va("x%d", stplyr->kartstuff[k_itemamount]));
else
{
V_DrawScaledPatch(fy+28, fy+41, V_HUDTRANS|fflags, kp_itemx);
V_DrawScaledPatch(fx+28, fy+41, V_HUDTRANS|fflags, kp_itemx);
V_DrawKartString(fx+38, fy+36, V_HUDTRANS|fflags, va("%d", stplyr->kartstuff[k_itemamount]));
}
}
@@ -7910,14 +8046,11 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
}
}
if (!cv_colorizedhud.value || !clr_hud)
if (!K_UseColorHud())
V_DrawScaledPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwide : kp_timestickerwide));
else
else //Colourized hud
{
//Colourized hud
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawMappedPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwideclr : kp_timestickerwideclr), colormap);
}
@@ -8078,9 +8211,8 @@ static void K_DrawKartPositionNum(INT32 num)
scale *= 2;
overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
}
if (splitscreen)
scale /= 2;
if (cv_showinput.value && !splitscreen) // anuther one.
if (splitscreen || (cv_showinput.value && !splitscreen))
scale /= 2;
W = FixedMul(W<<FRACBITS, scale)>>FRACBITS;
@@ -8285,7 +8417,10 @@ static boolean K_drawKartPositionFaces(void)
{
player_t *p;
p = &players[rankplayer[i]];
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap);
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceWant(p), colormap);
else
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceRank(p), colormap);
}
#ifdef HAVE_BLUA
@@ -8375,7 +8510,10 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
{
player_t *p;
p = &players[tab[i].num];
V_DrawMappedPatch(x, y-4, 0, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap);
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(p), colormap);
else
V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap);
}
/*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this
{
@@ -8438,6 +8576,14 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
}
}
static boolean K_BigLapSticker(void)
{
if (K_UseColorHud())
return ((cv_numlaps.value > 9) && (big_lap_color) && (cv_biglaps.value) && (!stplyr->exiting));
else
return ((cv_numlaps.value > 9) && (big_lap) && (cv_biglaps.value) && (!stplyr->exiting));
}
static void K_drawKartLaps(void)
{
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
@@ -8447,7 +8593,6 @@ static void K_drawKartLaps(void)
if (splitscreen > 1)
{
// pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen.
{
@@ -8472,8 +8617,6 @@ static void K_drawKartLaps(void)
}
}
if (stplyr->exiting) // draw stuff as god intended.
{
V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag);
@@ -8495,31 +8638,22 @@ static void K_drawKartLaps(void)
}
else
{
if (!cv_colorizedhud.value || !clr_hud){
if ((cv_numlaps.value > 9) && (big_lap) && (cv_biglaps.value)){
if (stplyr->laps+1 > 9)
V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerbig2);
else
V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerbig);
}
if (!K_UseColorHud())
{
if (K_BigLapSticker())
V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2 : kp_lapstickerbig));
else
V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapsticker);
}
else
else //Colourized hud
{
//Colourized hud
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
if ((cv_numlaps.value > 9) && (big_lap_color) && (cv_biglaps.value)){
if (stplyr->laps+1 > 9)
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerbig2clr, colormap);
else
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerbigclr, colormap);
}
if (K_BigLapSticker())
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2clr : kp_lapstickerbigclr), colormap);
else
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerclr, colormap);
}
if (stplyr->exiting)
V_DrawKartString(LAPS_X+33, LAPS_Y+3, V_HUDTRANS|splitflags, "FIN");
else
@@ -8534,6 +8668,11 @@ static void K_drawKartSpeedometer(void)
return;
fixed_t convSpeed = 0;
//KartZ speedo
fixed_t fuspeed = 0;
INT32 spdpatch = 0;
INT32 speedtype = 0;
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
@@ -8562,7 +8701,7 @@ static void K_drawKartSpeedometer(void)
}
// man.
if ((!cv_newspeedometer.value) || (cv_newspeedometer.value && !snw_speedo))
if ((cv_newspeedometer.value == 1) || (cv_newspeedometer.value == 2 && !snw_speedo) || (cv_newspeedometer.value == 3 && !kartzspeedo))
{
switch (speedtype) {
case 1:
@@ -8581,21 +8720,86 @@ static void K_drawKartSpeedometer(void)
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d %%", convSpeed));
}
}
else if (cv_newspeedometer.value && snw_speedo) { // why bother if we dont?
if (!cv_colorizedhud.value || !clr_hud)
else if (cv_newspeedometer.value == 2 && snw_speedo) // why bother if we dont?
{
if (!K_UseColorHud())
V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallsticker));
else
else //Colourized hud
{
//Colourized hud
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawMappedPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallstickerclr), colormap);
}
V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed, 3, NULL);
V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatches[cv_kartspeedometer.value]);
}
// Kart Z speedo bullshit...
// Draw the Speed counter.
// Warning large if statement below...
else if (cv_newspeedometer.value == 3 && kartzspeedo)
{
fuspeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
if (fuspeed < 2 && fuspeed > 0)
spdpatch = 0;
else if (fuspeed < 5 && fuspeed > 1)
spdpatch = 1;
else if (fuspeed < 7 && fuspeed > 4)
spdpatch = 2;
else if (fuspeed < 10 && fuspeed > 6)
spdpatch = 3;
else if (fuspeed < 12 && fuspeed > 9)
spdpatch = 4;
else if (fuspeed < 15 && fuspeed > 11)
spdpatch = 5;
else if (fuspeed < 17 && fuspeed > 14)
spdpatch = 6;
else if (fuspeed < 20 && fuspeed > 16)
spdpatch = 7;
else if (fuspeed < 22 && fuspeed > 19)
spdpatch = 8;
else if (fuspeed < 25 && fuspeed > 21)
spdpatch = 9;
else if (fuspeed < 27 && fuspeed > 24)
spdpatch = 10;
else if (fuspeed < 30 && fuspeed > 26)
spdpatch = 11;
else if (fuspeed < 32 && fuspeed > 29)
spdpatch = 12;
else if (fuspeed < 35 && fuspeed > 31)
spdpatch = 13;
else if (fuspeed < 37 && fuspeed > 34)
spdpatch = 14;
else if (fuspeed < 40 && fuspeed > 36)
spdpatch = 15;
else if (fuspeed < 42 && fuspeed > 39)
spdpatch = 16;
else if (fuspeed < 45 && fuspeed > 41)
spdpatch = 17;
else if (fuspeed < 47 && fuspeed > 44)
spdpatch = 18;
else if (fuspeed < 50 && fuspeed > 46)
spdpatch = 19;
else if (fuspeed < 52 && fuspeed > 49)
spdpatch = 20;
else if (fuspeed < 55 && fuspeed > 51)
spdpatch = 21;
else if (fuspeed < 57 && fuspeed > 54 && (leveltime&4))
spdpatch = 24;
else if (fuspeed < 57 && fuspeed > 54 && !(leveltime&4))
spdpatch = 23;
else if (fuspeed < 60 && fuspeed > 56 && (leveltime&4))
spdpatch = 24;
else if (fuspeed < 60 && fuspeed > 56 && !(leveltime&4))
spdpatch = 23;
else if (fuspeed > 59 && (leveltime&4))
spdpatch = 24;
else if (fuspeed > 59 && !(leveltime&4))
spdpatch = 23;
V_DrawScaledPatch(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, kp_kartzspeedo[spdpatch]);
}
}
@@ -8609,7 +8813,6 @@ static void K_drawKartBumpersOrKarma(void)
if (splitscreen > 1)
{
// we will reuse lap coords here since it's essentially the same shit.
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
@@ -8631,7 +8834,7 @@ static void K_drawKartBumpersOrKarma(void)
V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_splitkarmabomb, colormap);
V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
}
else // the above doesn't need to account for weird stuff since the max amount of karma necessary is always 2 ^^^^
else // the above doesn't need to account for weird stuff since the max amount of karma necessary is always 2 ^^^^
{
if (flipstring) // for p2 and p4, assume we can have more than 10 bumpers. It's retarded but who knows.
{
@@ -8640,7 +8843,7 @@ static void K_drawKartBumpersOrKarma(void)
V_DrawMappedPatch(BASEVIDWIDTH-stringw-16, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
}
else // draw bumpers normally.
else // draw bumpers normally.
{
V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
@@ -8651,39 +8854,15 @@ static void K_drawKartBumpersOrKarma(void)
{
if (stplyr->kartstuff[k_bumper] <= 0)
{
//Colourized hud
if (cv_colorizedhud.value && clr_hud)
{
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_karmastickerclr, colormap);
}
else
{
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_karmasticker, colormap);
}
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, (K_UseColorHud() ? kp_karmastickerclr : kp_karmasticker), colormap);
V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|splitflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
}
else
{
if (stplyr->kartstuff[k_bumper] > 9 && cv_kartbumpers.value > 9)
//Colourized hud
if (cv_colorizedhud.value && clr_hud)
{
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_bumperstickerwideclr, colormap);
}
else
{
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_bumperstickerwide, colormap);
}
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, (K_UseColorHud() ? kp_bumperstickerwideclr : kp_bumperstickerwide), colormap);
else
//Colourized hud
if (cv_colorizedhud.value && clr_hud)
{
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_bumperstickerclr, colormap);
}
else
{
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_bumpersticker, colormap);
}
V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, (K_UseColorHud() ? kp_bumperstickerclr : kp_bumpersticker), colormap);
V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|splitflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
}
@@ -8783,7 +8962,7 @@ static void K_drawKartWanted(void)
if (players[battlewanted[i]].skincolor)
{
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? ( (p->skinlocal) ? localfacewantprefix : facewantprefix )[( (p->localskin) ? p->localskin-1 : p->skin )] : ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )]), colormap);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? R_GetSkinFaceWant(p) : R_GetSkinFaceRank(p)), colormap);
/*if (basey2) // again with 4p stuff
V_DrawFixedPatch(x<<FRACBITS, (y - (basey-basey2))<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);*/
}
@@ -8863,7 +9042,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
fixed_t xscale, yscale, zoom;
if (mo->skin)
skin = ((skin_t*)( (mo->localskin) ? mo->localskin : mo->skin ))-( (skinlocal) ? localskins : skins );
skin = ((skin_t*)((mo->localskin) ? mo->localskin : mo->skin))-((skinlocal) ? localskins : skins);
maxx = maxy = INT32_MAX;
minx = miny = INT32_MIN;
@@ -8907,39 +9086,37 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
if (encoremode)
amnumxpos = -amnumxpos;
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->width/2))<<FRACBITS);
amypos = amnumypos + ((y + AutomapPic->height/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->height/2))<<FRACBITS);
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin]->width/2))<<FRACBITS);
amypos = amnumypos + ((y + AutomapPic->height/2 - (((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin]->height/2))<<FRACBITS);
if (!mo->color) // 'default' color
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
else
{
UINT8 *colormap = R_GetTranslationColormap((mo->colorized) ? TC_RAINBOW : skin, mo->color, GTC_CACHE);
UINT8 *colormap;
if (mo->colorized)
colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE);
else
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
if (cv_minihead.value == 1)
{
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap);
}
else if (cv_minihead.value == 0)
{
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap);
}
if (cv_minihead.value)
V_DrawFixedPatch(amxpos + (2*FRACUNIT), amypos + (2*FRACUNIT), FRACUNIT/2, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
else
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK))
{
const char *player_name = va("%c%s", V_GetSkincolorChar(mo->color), player_names[mo->player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4 * FRACUNIT), amypos - (3 * FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
if (mo->player
&& ((G_RaceGametype() && mo->player->kartstuff[k_position] == spbplace)
|| (G_BattleGametype() && K_IsPlayerWanted(mo->player))))
{
if (cv_minihead.value == 1)
V_DrawFixedPatch(amxpos, amypos, FRACUNIT / 2, flags, kp_wantedreticle, NULL);
else if (cv_minihead.value == 0)
V_DrawFixedPatch(amxpos - (4<<FRACBITS), amypos - (4<<FRACBITS), FRACUNIT, flags, kp_wantedreticle, NULL);
if (cv_minihead.value)
V_DrawFixedPatch(amxpos, amypos, FRACUNIT/2, flags, kp_wantedreticle, NULL);
else
V_DrawFixedPatch(amxpos - (4<<FRACBITS), amypos - (4<<FRACBITS), FRACUNIT, flags, kp_wantedreticle, NULL);
}
}
}
@@ -9224,13 +9401,11 @@ static void K_drawBattleFullscreen(void)
V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE));
else
{
if (!cv_colorizedhud.value || !clr_hud)
if (!K_UseColorHud())
V_DrawFixedPatch(x<<FRACBITS, ty<<FRACBITS, scale, 0, kp_timeoutstickerclr, NULL);
else
else //Colourized hud
{
//Colourized hud
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, ty<<FRACBITS, scale, 0, kp_timeoutstickerclr, colormap);
}
@@ -9524,9 +9699,6 @@ static void K_drawChallengerScreen(void)
static void K_drawLapStartAnim(void)
{
if (! cv_showlapemblem.value)
return;
// This is an EVEN MORE insanely complicated animation.
const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation];
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
@@ -9809,6 +9981,12 @@ void K_drawKartHUD(void)
#endif
K_drawInput();
if (!demo.title && cv_showstats.value)
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_statdisplay))
#endif
K_drawKartStats();
if (demo.title) // Draw title logo instead in demo.titles
{
INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
@@ -9900,7 +10078,7 @@ void K_drawKartHUD(void)
{
if (stplyr->exiting)
K_drawKartFinish();
else if (stplyr->kartstuff[k_lapanimation] && !splitscreen)
else if (stplyr->kartstuff[k_lapanimation] && !splitscreen && cv_showlapemblem.value)
K_drawLapStartAnim();
}
+5 -1
View File
@@ -17,7 +17,7 @@ extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
UINT8 K_GetKartColorByName(const char *name);
UINT8 K_GetHudColor();
UINT8 K_GetHudColor(void);
void K_RegisterKartStuff(void);
@@ -26,6 +26,10 @@ extern consvar_t cv_colorizeditembox;
extern consvar_t 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_showstats;
boolean K_IsPlayerLosing(player_t *player);
boolean K_IsPlayerWanted(player_t *player);
+53 -22
View File
@@ -430,6 +430,9 @@ void LUAh_PlayerJoin(int playernum)
void LUAh_PreThinkFrame(void)
{
hook_p hookp;
// variables used by perf stats
int hook_index = 0;
precise_t time_taken = 0;
if (!gL || !(hooksAvailable[hook_PreThinkFrame/8] & (1<<(hook_PreThinkFrame%8))))
return;
@@ -437,19 +440,32 @@ void LUAh_PreThinkFrame(void)
for (hookp = roothook; hookp; hookp = hookp->next)
{
if (hookp->type != hook_PreThinkFrame)
continue;
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
if (lua_pcall(gL, 0, 0, 1)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
if (hookp->type == hook_PreThinkFrame)
{
if (cv_perfstats.value == 4)
time_taken = I_GetPreciseTime();
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
if (lua_pcall(gL, 0, 0, 1)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
}
if (cv_perfstats.value == 4)
{
lua_Debug ar;
time_taken = I_GetPreciseTime() - time_taken;
// we need the function, let's just retrieve it again
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_getinfo(gL, ">S", &ar);
PS_SetPreThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
hook_index++;
}
}
}
}
lua_pop(gL, 1); // Pop error handler
}
@@ -498,6 +514,9 @@ void LUAh_ThinkFrame(void)
void LUAh_PostThinkFrame(void)
{
hook_p hookp;
// variables used by perf stats
int hook_index = 0;
precise_t time_taken = 0;
if (!gL || !(hooksAvailable[hook_PostThinkFrame/8] & (1<<(hook_PostThinkFrame%8))))
return;
@@ -505,19 +524,31 @@ void LUAh_PostThinkFrame(void)
for (hookp = roothook; hookp; hookp = hookp->next)
{
if (hookp->type != hook_PostThinkFrame)
continue;
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
if (lua_pcall(gL, 0, 0, 1)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
if (hookp->type == hook_PostThinkFrame)
{
if (cv_perfstats.value == 5)
time_taken = I_GetPreciseTime();
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
if (lua_pcall(gL, 0, 0, 1)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
}
if (cv_perfstats.value == 5)
{
lua_Debug ar;
time_taken = I_GetPreciseTime() - time_taken;
// we need the function, let's just retrieve it again
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_getinfo(gL, ">S", &ar);
PS_SetPostThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
hook_index++;
}
}
}
lua_pop(gL, 1); // Pop error handler
}
+1
View File
@@ -31,6 +31,7 @@ enum hud {
hud_battlecomebacktimer, // comeback timer in battlefullscreen. separated for ease of use.
hud_wanted,
hud_speedometer,
hud_statdisplay,
hud_freeplay,
hud_rankings, // Tab rankings
+38
View File
@@ -54,6 +54,7 @@ static const char *const hud_disable_options[] = {
"battlecomebacktimer", // come back timer in battlefullscreen
"wanted",
"speedometer",
"statdisplay",
"freeplay",
"rankings",
NULL};
@@ -595,6 +596,42 @@ static int libd_drawOnMinimap(lua_State *L)
return 0;
}
static int libd_drawStretched(lua_State *L)
{
fixed_t x, y, hscale, vscale;
INT32 flags;
patch_t *patch;
UINT8 *colormap = NULL;
huddrawlist_h list;
HUDONLY
x = luaL_checkinteger(L, 1);
y = luaL_checkinteger(L, 2);
hscale = luaL_checkinteger(L, 3);
if (hscale < 0)
return luaL_error(L, "negative horizontal scale");
vscale = luaL_checkinteger(L, 4);
if (vscale < 0)
return luaL_error(L, "negative vertical scale");
patch = *((patch_t **)luaL_checkudata(L, 5, META_PATCH));
flags = luaL_optinteger(L, 6, 0);
if (!lua_isnoneornil(L, 7))
colormap = *((UINT8 **)luaL_checkudata(L, 7, META_COLORMAP));
flags &= ~V_PARAMMASK; // Don't let crashes happen.
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
list = (huddrawlist_h) lua_touserdata(L, -1);
lua_pop(L, 1);
if (LUA_HUD_IsDrawListValid(list))
LUA_HUD_AddDrawStretched(list, x, y, hscale, vscale, patch, flags, colormap);
else
V_DrawStretchyFixedPatch(x, y, hscale, vscale, flags, patch, colormap);
return 0;
}
static int libd_drawNum(lua_State *L)
{
INT32 x, y, flags, num;
@@ -912,6 +949,7 @@ static luaL_Reg lib_draw[] = {
{"cachePatch", libd_cachePatch},
{"draw", libd_draw},
{"drawScaled", libd_drawScaled},
{"drawStretched", libd_drawStretched},
{"drawNum", libd_drawNum},
{"drawPaddedNum", libd_drawPaddedNum},
{"drawPingNum", libd_drawPingNum},
+27
View File
@@ -20,6 +20,7 @@
enum drawitem_e {
DI_Draw = 0,
DI_DrawScaled,
DI_DrawStretched,
DI_DrawNum,
DI_DrawPaddedNum,
DI_DrawPingNum,
@@ -216,6 +217,29 @@ void LUA_HUD_AddDrawScaled(
item->colormap = colormap;
}
void LUA_HUD_AddDrawStretched(
huddrawlist_h list,
fixed_t x,
fixed_t y,
fixed_t hscale,
fixed_t vscale,
patch_t *patch,
INT32 flags,
UINT8 *colormap
)
{
size_t i = AllocateDrawItem(list);
drawitem_t *item = &list->items[i];
item->type = DI_DrawStretched;
item->x = x;
item->y = y;
item->hscale = hscale;
item->vscale = vscale;
item->patch = patch;
item->flags = flags;
item->colormap = colormap;
}
void LUA_HUD_AddDrawNum(
huddrawlist_h list,
INT32 x,
@@ -377,6 +401,9 @@ void LUA_HUD_DrawList(huddrawlist_h list)
case DI_DrawScaled:
V_DrawFixedPatch(item->x, item->y, item->scale, item->flags, item->patch, item->colormap);
break;
case DI_DrawStretched:
V_DrawStretchyFixedPatch(item->x, item->y, item->hscale, item->vscale, item->flags, item->patch, item->colormap);
break;
case DI_DrawNum:
V_DrawTallNum(item->x, item->y, item->flags, item->num);
break;
+10
View File
@@ -42,6 +42,16 @@ void LUA_HUD_AddDraw(
INT32 flags,
UINT8 *colormap
);
void LUA_HUD_AddDrawStretched(
huddrawlist_h list,
fixed_t x,
fixed_t y,
fixed_t hscale,
fixed_t vscale,
patch_t *patch,
INT32 flags,
UINT8 *colormap
);
void LUA_HUD_AddDrawScaled(
huddrawlist_h list,
fixed_t x,
+35 -7
View File
@@ -143,6 +143,7 @@ static const udata_field_t mobj_fields[] = {
FIELD(mobj_t, cvmem, udatalib_getter_int32, udatalib_setter_int32),
FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset),
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean),
{ NULL },
};
@@ -217,7 +218,7 @@ UNIMPLEMENTED(mobjnum)
// For some dumb reason it is valid to set sloperoll, even though it is read
// only
int mobj_sloperoll_noop(lua_State *L) { return 0; }
int mobj_sloperoll_noop(lua_State *L) { (void)L; return 0; }
// Now other getters/setters with arbitary logic
@@ -415,13 +416,40 @@ int mobj_localskin_setter(lua_State *L)
{
mobj_t *mo = GETMO();
// TODO - add ability to set localskin to non-player mobjs
// Will probably just need to reimplement SetLocalPlayerSkin as something
// like SetLocalObjectSkin
if (!mo->player)
return luaL_error(L, "mobj.localskin can't be set for non-player mobjs!");
if (mo->player)
{
SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL);
}
else
{
INT32 i;
char skin[SKINNAMESIZE+1]; // all skin names are limited to this length
strlcpy(skin, luaL_checkstring(L, 2), sizeof skin);
strlwr(skin); // all skin names are lowercase
// Try localskins
for (i = 0; i < numlocalskins; i++)
{
if (stricmp(localskins[i].name, skin) == 0)
{
mo->localskin = &localskins[i];
mo->skinlocal = true;
return 0;
}
}
// Try other skins
for (i = 0; i < numskins; i++)
{
if (fastcmp(skins[i].name, skin))
{
mo->localskin = &skins[i];
mo->skinlocal = false;
return 0;
}
}
}
SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL);
return 0;
}
+15 -11
View File
@@ -465,19 +465,23 @@ static size_t gifframe_size = 8192;
static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
{
UINT8 r, g, b;
size_t src = 0, dest = 0;
size_t size = (vid.width * vid.height * 3);
size_t src, dest;
int x, y;
InitColorLUT();
while (src < size)
for (x = 0; x < vid.width; x += scrbuf_downscaleamt)
{
r = (UINT8)linear[src];
g = (UINT8)linear[src + 1];
b = (UINT8)linear[src + 2];
scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
src += (3 * scrbuf_downscaleamt);
dest += scrbuf_downscaleamt;
for (y = 0; y < vid.height; y += scrbuf_downscaleamt)
{
dest = y*vid.width + x;
src = dest*3;
r = (UINT8)linear[src];
g = (UINT8)linear[src + 1];
b = (UINT8)linear[src + 2];
scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
}
}
}
#endif
@@ -514,7 +518,7 @@ static void GIF_framewrite(void)
{
UINT8 *linear = HWR_GetScreenshot();
GIF_rgbconvert(linear, movie_screen);
free(linear);
//free(linear); // Allocated 'statically', no need to free now
}
#endif
}
@@ -530,7 +534,7 @@ static void GIF_framewrite(void)
{
UINT8 *linear = HWR_GetScreenshot();
GIF_rgbconvert(linear, screens[0]);
free(linear);
//free(linear); // Allocated 'statically', no need to free now
}
#endif
+3 -7
View File
@@ -20,11 +20,6 @@
#include <stdlib.h>
#endif
// Was this just for the #define USEASM?
//#ifdef _WIN32_WCE
//#include "sdl12/SRB2CE/cehelp.h"
//#endif
/*!
\brief bits of the fraction
*/
@@ -43,6 +38,8 @@
typedef INT32 fixed_t;
typedef UINT32 ufixed_t;
/*!
\brief convert fixed_t into floating number
*/
@@ -61,7 +58,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)
#define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT))
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
/** \brief The FixedMul function
\param a fixed_t number
@@ -115,7 +111,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedInt(fixed_t a)
*/
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b)
{
if ((abs(a) >> (FRACBITS-2)) >= abs(b))
if (((ufixed_t)abs(a) >> (FRACBITS-2)) >= (ufixed_t)abs(b))
return (a^b) < 0 ? INT32_MIN : INT32_MAX;
return FixedDiv2(a, b);
+1603 -148
View File
File diff suppressed because it is too large. Load diff
+26
View File
@@ -147,6 +147,8 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
#define MAXSTRINGLENGTH 32
#define MAXTOOLTIPS 255
typedef union
{
struct menu_s *submenu; // IT_SUBMENU
@@ -184,6 +186,7 @@ typedef struct menu_s
INT16 x, y; // x, y of menu
INT16 lastOn; // last item user was on in menu
boolean (*quitroutine)(void); // called before quit a menu return true if we can
const char* tooltips[MAXTOOLTIPS]; // tooltips! give me that info bitch
} menu_t;
void M_SetupNextMenu(menu_t *menudef);
@@ -242,6 +245,7 @@ extern description_t description[MAXSKINS];
extern consvar_t cv_showfocuslost;
extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort;
extern consvar_t cv_showallmaps;
extern consvar_t cv_showmusicfilename;
extern CV_PossibleValue_t gametype_cons_t[];
extern char dummystaffname[22];
@@ -269,6 +273,9 @@ void PDistort_menu_Onchange(void);
// Bird menu updating
void Bird_menu_Onchange(void);
// Saturn menu updating
void Saturn_menu_Onchange(void);
void M_ReplayHut(INT32 choice);
void M_SetPlaybackMenuPointer(void);
@@ -288,6 +295,20 @@ void M_PopupMasterServerRules(void);
M_DrawGenericMenu,\
x, y,\
0,\
NULL,\
NULL\
}
#define DEFAULTSCROLLSTYLE(header, source, prev, x, y)\
{\
header,\
sizeof(source)/sizeof(menuitem_t),\
prev,\
source,\
M_DrawGenericScrollMenu,\
x, y,\
0,\
NULL,\
NULL\
}
@@ -300,6 +321,7 @@ void M_PopupMasterServerRules(void);
M_DrawPauseMenu,\
x, y,\
0,\
NULL,\
NULL\
}
@@ -312,6 +334,7 @@ void M_PopupMasterServerRules(void);
M_DrawCenteredMenu,\
BASEVIDWIDTH/2, y,\
0,\
NULL,\
NULL\
}
@@ -324,6 +347,7 @@ void M_PopupMasterServerRules(void);
M_DrawServerMenu,\
24,40,\
0,\
NULL,\
NULL\
}
@@ -336,6 +360,7 @@ void M_PopupMasterServerRules(void);
M_DrawControl,\
26, 40,\
0,\
NULL,\
NULL\
}
@@ -348,6 +373,7 @@ void M_PopupMasterServerRules(void);
M_DrawImageDef,\
0, 0,\
0,\
NULL,\
NULL\
}
+1 -1
View File
@@ -193,7 +193,7 @@ INT32 M_MapNumber(char first, char second)
// ==========================================================================
// some libcs has no access function, make our own
#if defined (_WIN32_WCE) || defined (_WII)
#if 0
int access(const char *path, int amode)
{
int accesshandle = -1;
+2
View File
@@ -41,6 +41,8 @@ void M_StopMovie(void);
// the file where game vars and settings are saved
#define CONFIGFILENAME "kartconfig.cfg"
// autoload!
#define AUTOLOADCONFIGFILENAME "autoload.cfg"
INT32 M_MapNumber(char first, char second);
+174 -27
View File
@@ -63,7 +63,10 @@ static ps_metric_t ps_removecount = {0};
ps_metric_t ps_checkposition_calls = {0};
ps_metric_t ps_lua_prethinkframe_time = {0};
ps_metric_t ps_lua_thinkframe_time = {0};
ps_metric_t ps_lua_postthinkframe_time = {0};
ps_metric_t ps_lua_mobjhooks = {0};
ps_metric_t ps_otherlogictime = {0};
@@ -156,7 +159,9 @@ perfstatrow_t gamelogic_rows[] = {
{" mobjs ", " Mobjs: ", &ps_thlist_times[THINK_MOBJ], PS_TIME|PS_LEVEL},
{" dynslop", " Dynamic slopes: ", &ps_thlist_times[THINK_DYNSLOPE], PS_TIME|PS_LEVEL},
{" precip ", " Precipitation: ", &ps_thlist_times[THINK_PRECIP], PS_TIME|PS_LEVEL},*/
{" lprethinkf", " LUAh_PreThinkFrame:", &ps_lua_prethinkframe_time, PS_TIME|PS_LEVEL},
{" lthinkf", " LUAh_ThinkFrame:", &ps_lua_thinkframe_time, PS_TIME|PS_LEVEL},
{" lpostthinkf", " LUAh_PostThinkFrame:", &ps_lua_postthinkframe_time, PS_TIME|PS_LEVEL},
{" other ", " Other: ", &ps_otherlogictime, PS_TIME|PS_LEVEL},
{0}
};
@@ -189,10 +194,43 @@ int ps_frame_index = 0;
int ps_tick_index = 0;
// dynamically allocated resizeable array for thinkframe hook stats
ps_hookinfo_t *prethinkframe_hooks = NULL;
int prethinkframe_hooks_length = 0;
int prethinkframe_hooks_capacity = 16;
ps_hookinfo_t *thinkframe_hooks = NULL;
int thinkframe_hooks_length = 0;
int thinkframe_hooks_capacity = 16;
ps_hookinfo_t *postthinkframe_hooks = NULL;
int postthinkframe_hooks_length = 0;
int postthinkframe_hooks_capacity = 16;
void PS_SetPreThinkFrameHookInfo(int index, precise_t time_taken, char* short_src)
{
if (!prethinkframe_hooks)
{
// array needs to be initialized
prethinkframe_hooks = Z_Calloc(sizeof(ps_hookinfo_t) * prethinkframe_hooks_capacity, PU_STATIC, NULL);
}
if (index >= prethinkframe_hooks_capacity)
{
// array needs more space, realloc with double size
int new_capacity = prethinkframe_hooks_capacity * 2;
prethinkframe_hooks = Z_Realloc(prethinkframe_hooks,
sizeof(ps_hookinfo_t) * new_capacity, PU_STATIC, NULL);
// initialize new memory with zeros so the pointers in the structs are null
memset(&prethinkframe_hooks[prethinkframe_hooks_capacity], 0,
sizeof(ps_hookinfo_t) * prethinkframe_hooks_capacity);
prethinkframe_hooks_capacity = new_capacity;
}
prethinkframe_hooks[index].time_taken.value.p = time_taken;
memcpy(prethinkframe_hooks[index].short_src, short_src, LUA_IDSIZE * sizeof(char));
// since the values are set sequentially from begin to end, the last call should leave
// the correct value to this variable
prethinkframe_hooks_length = index + 1;
}
void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src)
{
if (!thinkframe_hooks)
@@ -218,6 +256,33 @@ void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src)
thinkframe_hooks_length = index + 1;
}
void PS_SetPostThinkFrameHookInfo(int index, precise_t time_taken, char* short_src)
{
if (!postthinkframe_hooks)
{
// array needs to be initialized
postthinkframe_hooks = Z_Calloc(sizeof(ps_hookinfo_t) * postthinkframe_hooks_capacity, PU_STATIC, NULL);
}
if (index >= postthinkframe_hooks_capacity)
{
// array needs more space, realloc with double size
int new_capacity = postthinkframe_hooks_capacity * 2;
postthinkframe_hooks = Z_Realloc(postthinkframe_hooks,
sizeof(ps_hookinfo_t) * new_capacity, PU_STATIC, NULL);
// initialize new memory with zeros so the pointers in the structs are null
memset(&postthinkframe_hooks[postthinkframe_hooks_capacity], 0,
sizeof(ps_hookinfo_t) * postthinkframe_hooks_capacity);
postthinkframe_hooks_capacity = new_capacity;
}
postthinkframe_hooks[index].time_taken.value.p = time_taken;
memcpy(postthinkframe_hooks[index].short_src, short_src, LUA_IDSIZE * sizeof(char));
// since the values are set sequentially from begin to end, the last call should leave
// the correct value to this variable
postthinkframe_hooks_length = index + 1;
}
static boolean PS_HighResolution(void)
{
return (vid.width >= 640 && vid.height >= 400);
@@ -578,7 +643,11 @@ void PS_UpdateTickStats(void)
ps_tictime.value.p -
ps_playerthink_time.value.p -
ps_thinkertime.value.p -
ps_lua_thinkframe_time.value.p;
ps_lua_prethinkframe_time.value.p -
ps_lua_thinkframe_time.value.p -
ps_lua_postthinkframe_time.value.p;
PS_CountThinkers();
}
@@ -590,21 +659,37 @@ void PS_UpdateTickStats(void)
PS_UpdateRowHistories(misc_calls_rows, false);
}
}
if (cv_perfstats.value == 3 && cv_ps_samplesize.value > 1 && PS_IsLevelActive())
if (cv_ps_samplesize.value > 1)
{
int i;
for (i = 0; i < thinkframe_hooks_length; i++)
if(cv_perfstats.value >= 3 && PS_IsLevelActive())
{
PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false, false);
int i;
if (cv_perfstats.value == 3)
{
for (i = 0; i < thinkframe_hooks_length; i++)
PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false, false);
}
else if (cv_perfstats.value == 4)
{
for (i = 0; i < prethinkframe_hooks_length; i++)
PS_UpdateMetricHistory(&prethinkframe_hooks[i].time_taken, true, false, false);
}
else if (cv_perfstats.value == 5)
{
for (i = 0; i < postthinkframe_hooks_length; i++)
PS_UpdateMetricHistory(&postthinkframe_hooks[i].time_taken, true, false, false);
}
}
}
if (cv_perfstats.value && cv_ps_samplesize.value > 1)
{
ps_tick_index++;
if (ps_tick_index >= cv_ps_samplesize.value)
ps_tick_index = 0;
if (ps_tick_samples_left)
ps_tick_samples_left--;
if (cv_perfstats.value)
{
ps_tick_index++;
if (ps_tick_index >= cv_ps_samplesize.value)
ps_tick_index = 0;
if (ps_tick_samples_left)
ps_tick_samples_left--;
}
}
}
@@ -624,7 +709,7 @@ static void PS_DrawDescriptorHeader(void)
int samples_left = max(ps_frame_samples_left, ps_tick_samples_left);
int x, y;
if (cv_perfstats.value == 3)
if (cv_perfstats.value >= 3)
{
x = 2;
y = 0;
@@ -717,21 +802,20 @@ static void PS_DrawGameLogicStats(void)
#define WIDTH 106
#define HEIGHT 4
#define MAX_X 214
#define MAX_Y 192
#define MAX_Y 182
#define START_X 2
#define START_Y 4
#define PAGE_ENTRIES ((MAX_Y - START_Y) / HEIGHT)
static void PS_DrawThinkFrameStats(void)
static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
{
char s[100];
int i;
int maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1;
int page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
int pagestart = min((page - 1)*PAGE_ENTRIES, thinkframe_hooks_length);
int pageend = min(pagestart + PAGE_ENTRIES, thinkframe_hooks_length);
int maxpage = 0;
int page = 0;
int pagestart = 0;
int pageend = 0;
// text writing position
int x = START_X;
int y = START_Y;
@@ -741,19 +825,44 @@ static void PS_DrawThinkFrameStats(void)
last_mod_name[0] = '\0';
INT32 total = 0;
//Decide page length based and drawn text on choosen thinker type
if (cv_perfstats.value == 3){
maxpage = thinkframe_hooks_length/PAGE_ENTRIES + 1;
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
pagestart = min((page - 1)*PAGE_ENTRIES, thinkframe_hooks_length);
pageend = min(pagestart + PAGE_ENTRIES, thinkframe_hooks_length);
V_DrawSmallString(MAX_X-50, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "ThinkFrame");
}
else if (cv_perfstats.value == 4){
maxpage = prethinkframe_hooks_length/PAGE_ENTRIES + 1;
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
pagestart = min((page - 1)*PAGE_ENTRIES, prethinkframe_hooks_length);
pageend = min(pagestart + PAGE_ENTRIES, prethinkframe_hooks_length);
V_DrawSmallString(MAX_X-60, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PreThinkFrame");
}
else if (cv_perfstats.value == 5){
maxpage = postthinkframe_hooks_length/PAGE_ENTRIES + 1;
page = max(1, min(cv_ps_thinkframe_page.value, maxpage));
pagestart = min((page - 1)*PAGE_ENTRIES, postthinkframe_hooks_length);
pageend = min(pagestart + PAGE_ENTRIES, postthinkframe_hooks_length);
V_DrawSmallString(MAX_X-65, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, "PostThinkFrame");
}
PS_DrawDescriptorHeader();
for (i = 0; i < thinkframe_hooks_length; i++)
for (i = 0; i < hook_length; i++)
{
#define NEXT_ROW() y += HEIGHT;
INT32 value = PS_GetMetricScreenValue(&thinkframe_hooks[i].time_taken, true);
INT32 value = PS_GetMetricScreenValue(&hook[i].time_taken, true);
total += value;
if (i < pagestart || i >= pageend) continue;
char* str = thinkframe_hooks[i].short_src;
char* str = hook[i].short_src;
char* tempstr = tempbuffer;
int len = (int)strlen(str);
char* str_ptr;
@@ -808,6 +917,8 @@ static void PS_DrawThinkFrameStats(void)
snprintf(s, sizeof s - 1, "PAGE %d", page);
V_DrawSmallString(START_X, MAX_Y+2*HEIGHT, V_MONOSPACE | V_GREENMAP, s);
}
}
void PS_ThinkFrame_Page_OnChange(void)
@@ -828,6 +939,24 @@ void PS_ThinkFrame_Page_OnChange(void)
#undef PAGE_ENTRIES
static void PS_DrawPreThinkFrameStats(void)
{
draw_think_frame_stats(prethinkframe_hooks_length, prethinkframe_hooks);
}
static void PS_DrawThinkFrameStats(void)
{
draw_think_frame_stats(thinkframe_hooks_length, thinkframe_hooks);
}
static void PS_DrawPostThinkFrameStats(void)
{
draw_think_frame_stats(postthinkframe_hooks_length, postthinkframe_hooks);
}
void M_DrawPerfStats(void)
{
if (cv_perfstats.value == 1) // rendering
@@ -841,7 +970,7 @@ void M_DrawPerfStats(void)
// tics when frame skips happen
PS_DrawGameLogicStats();
}
else if (cv_perfstats.value == 3) // lua thinkframe
else if (cv_perfstats.value >= 3) // lua thinkframe
{
if (!PS_IsLevelActive())
return;
@@ -850,13 +979,23 @@ void M_DrawPerfStats(void)
// Low resolutions can't really use V_DrawSmallString that is used by thinkframe stats.
// A low-res version using V_DrawThinString could be implemented,
// but it would have much less space for information.
V_DrawThinString(80, 92, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Perfstats 3 is not available");
V_DrawThinString(80, 92, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Lua Perfstats is not available");
V_DrawThinString(80, 100, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "for resolutions below 640x400.");
return;
}
else
if (cv_perfstats.value == 3)
{
PS_DrawThinkFrameStats();
}
else if (cv_perfstats.value == 4)
{
PS_DrawPreThinkFrameStats();
}
else if (cv_perfstats.value == 5)
{
PS_DrawPostThinkFrameStats();
}
}
}
@@ -867,10 +1006,18 @@ static void PS_ClearHistory(void)
Z_FreeTags(PU_PERFSTATS, PU_PERFSTATS);
// thinkframe hook metric history pointers need to be cleared manually
for (i = 0; i < prethinkframe_hooks_length; i++)
{
prethinkframe_hooks[i].time_taken.history = NULL;
}
for (i = 0; i < thinkframe_hooks_length; i++)
{
thinkframe_hooks[i].time_taken.history = NULL;
}
for (i = 0; i < postthinkframe_hooks_length; i++)
{
postthinkframe_hooks[i].time_taken.history = NULL;
}
ps_frame_index = ps_tick_index = 0;
// PS_UpdateMetricHistory will set these correctly when it runs
+5
View File
@@ -44,12 +44,17 @@ extern ps_metric_t ps_thlist_times[];
extern ps_metric_t ps_checkposition_calls;
extern ps_metric_t ps_lua_prethinkframe_time;
extern ps_metric_t ps_lua_thinkframe_time;
extern ps_metric_t ps_lua_postthinkframe_time;
extern ps_metric_t ps_lua_mobjhooks;
extern ps_metric_t ps_otherlogictime;
void PS_SetPreThinkFrameHookInfo(int index, precise_t time_taken, char* short_src);
void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src);
void PS_SetPostThinkFrameHookInfo(int index, precise_t time_taken, char* short_src);
void PS_UpdateTickStats(void);
+26 -5
View File
@@ -57,8 +57,12 @@ static void Command_Listserv_f(void);
#endif/*MASTERSERVER*/
static void Update_parameters (void);
#ifdef MASTERSERVER
static void MasterServer_OnChange(void);
static void Advertise_OnChange(void);
@@ -69,16 +73,26 @@ static CV_PossibleValue_t masterserver_update_rate_cons_t[] = {
{0, NULL}
};
#endif
#ifdef MASTERSERVER
consvar_t cv_masterserver = {"masterserver", "https://ms.kartkrew.org/ms/api", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL};
#endif
#ifdef HOLEPUNCH
consvar_t cv_rendezvousserver = {"holepunchserver", "relay.kartkrew.org", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_server_contact = {"server_contact", "", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL};
#ifdef MASTERSERVER
consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, MasterClient_Ticker, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_advertise = {"advertise", "No", CV_NETVAR|CV_CALL|CV_NOINIT, CV_YesNo, Advertise_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
int ms_QueryId;
@@ -98,6 +112,7 @@ UINT16 current_port = 0;
void AddMServCommands(void)
{
#ifndef NONET
#ifdef MASTERSERVER
CV_RegisterVar(&cv_masterserver);
CV_RegisterVar(&cv_masterserver_update_rate);
CV_RegisterVar(&cv_masterserver_timeout);
@@ -105,7 +120,11 @@ void AddMServCommands(void)
CV_RegisterVar(&cv_masterserver_token);
CV_RegisterVar(&cv_masterserver_nagattempts);
CV_RegisterVar(&cv_advertise);
#endif
#ifdef HOLEPUNCH
CV_RegisterVar(&cv_rendezvousserver);
#endif
CV_RegisterVar(&cv_servername);
CV_RegisterVar(&cv_server_contact);
#ifdef MASTERSERVER
@@ -548,19 +567,20 @@ Update_parameters (void)
}
#endif/*MASTERSERVER*/
}
#ifdef MASTERSERVER
static void MasterServer_OnChange(void)
{
#ifdef MASTERSERVER
UnregisterServer();
Set_api(cv_masterserver.string);
if (Online())
RegisterServer();
#endif/*MASTERSERVER*/
}
}
#endif/*MASTERSERVER*/
#ifdef MASTERSERVER
static void
Advertise_OnChange(void)
{
@@ -596,3 +616,4 @@ Advertise_OnChange(void)
M_PopupMasterServerRules();
}
}
#endif
+13 -4
View File
@@ -51,18 +51,25 @@ typedef struct
#endif
// ================================ GLOBALS ===============================
extern consvar_t cv_masterserver, cv_servername;
#ifdef MASTERSERVER
extern consvar_t cv_masterserver;
#endif
extern consvar_t cv_servername;
extern consvar_t cv_server_contact;
#ifdef MASTERSERVER
extern consvar_t cv_masterserver_update_rate;
extern consvar_t cv_masterserver_timeout;
extern consvar_t cv_masterserver_debug;
extern consvar_t cv_masterserver_token;
extern consvar_t cv_rendezvousserver;
extern consvar_t cv_advertise;
extern consvar_t cv_masterserver_nagattempts;
#endif
#ifdef HOLEPUNCH
extern consvar_t cv_rendezvousserver;
#endif
#ifdef HAVE_THREADS
extern int ms_QueryId;
@@ -71,7 +78,7 @@ extern I_mutex ms_QueryId_mutex;
extern msg_server_t *ms_ServerList;
extern I_mutex ms_ServerList_mutex;
#endif
#ifdef MASTERSERVER
void RegisterServer(void);
void UnregisterServer(void);
@@ -97,3 +104,5 @@ int HMS_compare_mod_version (char *buffer, size_t size_of_buffer);
const char * HMS_fetch_rules (char *buffer, size_t size_of_buffer);
#endif
#endif
+1 -1
View File
@@ -2348,7 +2348,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
}
target->player->playerstate = PST_DEAD;
if (cv_fading.value && P_IsLocalPlayer(target->player))
if (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(target->player))
{
if (netgame || multiplayer)
ms = cv_respawntime.value * 1000;
-1
View File
@@ -142,7 +142,6 @@ extern consvar_t cv_quaketilt;
extern consvar_t cv_tiltsmoothing;
extern consvar_t cv_actionmovie;
extern consvar_t cv_windowquake;
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
+45 -17
View File
@@ -6063,13 +6063,22 @@ static void P_AddOverlay(mobj_t *thing)
static void P_RemoveOverlay(mobj_t *thing)
{
mobj_t *mo;
if (overlaycap == thing)
{
P_SetTarget(&overlaycap, thing->hnext);
P_SetTarget(&thing->hnext, NULL);
return;
}
for (mo = overlaycap; mo; mo = mo->hnext)
if (mo->hnext == thing)
{
P_SetTarget(&mo->hnext, thing->hnext);
P_SetTarget(&thing->hnext, NULL);
return;
}
{
if (mo->hnext != thing)
continue;
P_SetTarget(&mo->hnext, thing->hnext);
P_SetTarget(&thing->hnext, NULL);
return;
}
}
void P_RunShadows(void)
@@ -6175,12 +6184,14 @@ static void P_RemoveShadow(mobj_t *thing)
}
for (mo = shadowcap; mo; mo = mo->hnext)
if (mo->hnext == thing)
{
P_SetTarget(&mo->hnext, thing->hnext);
P_SetTarget(&thing->hnext, NULL);
return;
}
{
if (mo->hnext != thing)
continue;
P_SetTarget(&mo->hnext, thing->hnext);
P_SetTarget(&thing->hnext, NULL);
return;
}
}
void A_BossDeath(mobj_t *mo);
@@ -10359,7 +10370,7 @@ void P_SpawnPrecipitation(void)
subsector_t *precipsector = NULL;
precipmobj_t *rainmo = NULL;
if (dedicated || !(cv_drawdist_precip.value) || curWeather == PRECIP_NONE || curWeather == PRECIP_STORM_NORAIN) // SRB2Kart
if (dedicated || /*!cv_precipdensity*/!cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart
return;
// Use the blockmap to narrow down our placing patterns
@@ -10370,8 +10381,16 @@ void P_SpawnPrecipitation(void)
//for (j = 0; j < cv_precipdensity.value; ++j) -- density is 1 for kart always
{
x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3);
y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3);
if (cv_lessprecip.value)
{
x = basex*1.5 + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3);
y = basey*1.5 + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3);
}
else
{
x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3);
y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3);
}
precipsector = R_IsPointInSubsector(x, y);
@@ -10402,13 +10421,22 @@ void P_SpawnPrecipitation(void)
}
else // everything else.
rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN);
if (curWeather == PRECIP_BLANK)
rainmo->precipflags |= PCF_INVISIBLE;
// Randomly assign a height, now that floorz is set.
rainmo->z = M_RandomRange(rainmo->floorz>>FRACBITS, rainmo->ceilingz>>FRACBITS)<<FRACBITS;
}
}
if (curWeather == PRECIP_BLANK)
{
curWeather = PRECIP_RAIN;
P_SwitchWeather(PRECIP_BLANK);
}
else if (curWeather == PRECIP_STORM_NORAIN)
{
curWeather = PRECIP_RAIN;
P_SwitchWeather(PRECIP_STORM_NORAIN);
}
}
//
+1
View File
@@ -395,6 +395,7 @@ typedef struct mobj_s
boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation)
boolean colorized; // Whether the mobj uses the rainbow colormap
boolean mirrored; // The object's rotations will be mirrored left to right, e.g., see frame AL from the right and AR from the left
boolean rollmodel; // OpenGL: Should this model rotate?
tic_t slamsoundtimer;
+2
View File
@@ -37,6 +37,8 @@
/// \brief Frame flags: only the frame number
#define FF_FRAMEMASK 0x1ff
/// \brief Frame flags: Flip sprite horizontally
#define FF_HORIZONTALFLIP 0x400
/// \brief Frame flags: Thin, paper-like sprite (for collision equivalent, see MF_PAPERCOLLISION)
#define FF_PAPERSPRITE 0x800
/// \brief Frame flags: Simple stateless animation
+13 -5
View File
@@ -1976,14 +1976,22 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->thinker.function.acp1 = thinker;
mobj->rollangle = 0;
mobj->spritexoffset = mobj->spriteyoffset = mobj->old_spritexoffset = mobj->old_spriteyoffset = FRACUNIT;
mobj->spritexscale = mobj->spriteyscale = mobj->old_spritexscale = mobj->old_spriteyscale = FRACUNIT;
mobj->realxscale = mobj->realyscale = FRACUNIT;
mobj->sloperoll = 0;
mobj->reservexydir = 0;
mobj->reservezangle = 0;
mobj->spritexoffset = mobj->old_spritexoffset = 0;
mobj->spriteyoffset = mobj->old_spriteyoffset = 0;
mobj->spritexscale = mobj->old_spritexscale = FRACUNIT;
mobj->spriteyscale = mobj->old_spriteyscale = FRACUNIT;
mobj->realxscale = FRACUNIT;
mobj->realyscale = FRACUNIT;
mobj->stretchslam = 0;
mobj->slamsoundtimer = 0;
mobj->sloperoll = mobj->reservezangle = mobj->reservexydir = 0;
mobj->mirrored = 0;
mobj->z = z;
mobj->floorz = floorz;
mobj->ceilingz = ceilingz;
+10 -5
View File
@@ -3490,11 +3490,8 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
if (wadfiles[wadnum]->important)
partadd_important = true;
if (local)
wadfiles[wadnum]->localfile = true;
else
wadfiles[wadnum]->localfile = false;
wadfiles[wadnum]->localfile = local;
//
// search for sound replacements
@@ -3554,6 +3551,11 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
//
S_LoadMusicDefs(wadnum);
//
// edit music defs for stuff like musictest
//
S_LoadMTDefs(wadnum);
//
// search for maps
//
@@ -3587,6 +3589,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
if (!mapsadded)
CONS_Printf(M_GetText("No maps added\n"));
// TODO: Experimental SPRTINFO support, test first
R_LoadSpriteInfoLumps(wadnum, wadfiles[wadnum]->numlumps);
refreshdirmenu &= ~REFRESHDIR_GAMEDATA; // Under usual circumstances we'd wait for REFRESHDIR_GAMEDATA to disappear the next frame, but it's a bit too dangerous for that...
partadd_stage = 0;
return wadnum;
+76 -17
View File
@@ -2002,14 +2002,53 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
//
void P_SwitchWeather(INT32 weathernum)
{
boolean purge = true;
boolean raintype = (PRECIP_SNOW || PRECIP_RAIN || PRECIP_STORM || PRECIP_STORM_NOSTRIKES || PRECIP_BLANK);
boolean purge = false;
INT32 swap = 0;
if (weathernum == curWeather)
return;
if (weathernum == raintype && curWeather == raintype)
purge = false;
switch (weathernum)
{
case PRECIP_NONE: // None
if (curWeather == PRECIP_NONE)
return; // Nothing to do.
purge = true;
break;
case PRECIP_STORM: // Storm
case PRECIP_STORM_NOSTRIKES: // Storm w/ no lightning
case PRECIP_RAIN: // Rain
if (curWeather == PRECIP_SNOW || curWeather == PRECIP_BLANK || curWeather == PRECIP_STORM_NORAIN)
swap = PRECIP_RAIN;
break;
case PRECIP_SNOW: // Snow
if (curWeather == PRECIP_SNOW)
return; // Nothing to do.
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES || curWeather == PRECIP_BLANK || curWeather == PRECIP_STORM_NORAIN)
swap = PRECIP_SNOW; // Need to delete the other precips.
break;
case PRECIP_STORM_NORAIN: // Storm w/o rain
if (curWeather == PRECIP_SNOW
|| curWeather == PRECIP_STORM
|| curWeather == PRECIP_STORM_NOSTRIKES
|| curWeather == PRECIP_RAIN
|| curWeather == PRECIP_BLANK)
swap = PRECIP_STORM_NORAIN;
else if (curWeather == PRECIP_STORM_NORAIN)
return;
break;
case PRECIP_BLANK:
if (curWeather == PRECIP_SNOW
|| curWeather == PRECIP_STORM
|| curWeather == PRECIP_STORM_NOSTRIKES
|| curWeather == PRECIP_RAIN)
swap = PRECIP_BLANK;
else if (curWeather == PRECIP_STORM_NORAIN)
swap = PRECIP_BLANK;
else if (curWeather == PRECIP_BLANK)
return;
break;
default:
CONS_Debug(DBG_GAMELOGIC, "P_SwitchWeather: Unknown weather type %d.\n", weathernum);
break;
}
if (purge)
{
@@ -2026,7 +2065,7 @@ void P_SwitchWeather(INT32 weathernum)
P_RemovePrecipMobj(precipmobj);
}
}
else // Rather than respawn all that crap, reuse it!
else if (swap && !((swap == PRECIP_BLANK && curWeather == PRECIP_STORM_NORAIN) || (swap == PRECIP_STORM_NORAIN && curWeather == PRECIP_BLANK))) // Rather than respawn all that crap, reuse it!
{
thinker_t *think;
precipmobj_t *precipmobj;
@@ -2038,7 +2077,7 @@ void P_SwitchWeather(INT32 weathernum)
continue; // not a precipmobj thinker
precipmobj = (precipmobj_t *)think;
if (weathernum == PRECIP_RAIN || weathernum == PRECIP_STORM || weathernum == PRECIP_STORM_NOSTRIKES) // Snow To Rain
if (swap == PRECIP_RAIN) // Snow To Rain
{
precipmobj->flags = mobjinfo[MT_RAIN].flags;
st = &states[mobjinfo[MT_RAIN].spawnstate];
@@ -2053,7 +2092,7 @@ void P_SwitchWeather(INT32 weathernum)
precipmobj->precipflags |= PCF_RAIN;
//think->function.acp1 = (actionf_p1)P_RainThinker;
}
else if (weathernum == PRECIP_SNOW) // Rain To Snow
else if (swap == PRECIP_SNOW) // Rain To Snow
{
INT32 z;
@@ -2078,7 +2117,7 @@ void P_SwitchWeather(INT32 weathernum)
//think->function.acp1 = (actionf_p1)P_SnowThinker;
}
else // Remove precip, but keep it around for reuse.
else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
{
//think->function.acp1 = (actionf_p1)P_NullPrecipThinker;
@@ -2092,31 +2131,48 @@ void P_SwitchWeather(INT32 weathernum)
case PRECIP_SNOW: // snow
curWeather = PRECIP_SNOW;
if (purge)
if (!swap)
P_SpawnPrecipitation();
break;
case PRECIP_RAIN: // rain
{
boolean dontspawn = false;
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
dontspawn = true;
curWeather = PRECIP_RAIN;
if (purge)
if (!dontspawn && !swap)
P_SpawnPrecipitation();
break;
}
case PRECIP_STORM: // storm
{
boolean dontspawn = false;
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
dontspawn = true;
curWeather = PRECIP_STORM;
if (purge)
if (!dontspawn && !swap)
P_SpawnPrecipitation();
break;
}
case PRECIP_STORM_NOSTRIKES: // storm w/o lightning
{
if (purge)
boolean dontspawn = false;
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
dontspawn = true;
curWeather = PRECIP_STORM_NOSTRIKES;
if (!dontspawn && !swap)
P_SpawnPrecipitation();
break;
@@ -2124,11 +2180,14 @@ void P_SwitchWeather(INT32 weathernum)
case PRECIP_STORM_NORAIN: // storm w/o rain
curWeather = PRECIP_STORM_NORAIN;
if (!swap)
P_SpawnPrecipitation();
break;
case PRECIP_BLANK: //preloaded
case PRECIP_BLANK:
curWeather = PRECIP_BLANK;
if (purge)
if (!swap)
P_SpawnPrecipitation();
break;
+9 -2
View File
@@ -662,7 +662,10 @@ void P_Ticker(boolean run)
ps_checkposition_calls.value.i = 0;
#ifdef HAVE_BLUA
PS_START_TIMING(ps_lua_prethinkframe_time);
LUAh_PreThinkFrame();
PS_STOP_TIMING(ps_lua_prethinkframe_time);
#endif
PS_START_TIMING(ps_playerthink_time);
@@ -772,8 +775,6 @@ void P_Ticker(boolean run)
quake.x = M_RandomRange(-ir,ir);
quake.y = M_RandomRange(-ir,ir);
quake.z = M_RandomRange(-ir,ir);
if (cv_windowquake.value)
I_CursedWindowMovement(FixedInt(quake.x), FixedInt(quake.y));
ir >>= 2;
ir = M_RandomRange(-ir,ir);
if (ir < 0)
@@ -825,7 +826,11 @@ void P_Ticker(boolean run)
D_MapChange(gamemap, gametype, encoremode, true, 0, false, false);
#ifdef HAVE_BLUA
PS_START_TIMING(ps_lua_postthinkframe_time);
LUAh_PostThinkFrame();
PS_STOP_TIMING(ps_lua_postthinkframe_time);
#endif
}
@@ -920,6 +925,8 @@ void P_PreTicker(INT32 frames)
// Run shield positioning
//P_RunShields();
P_RunOverlays();
P_RunShadows();
P_UpdateSpecials();
P_RespawnSpecials();
+29 -12
View File
@@ -1281,13 +1281,17 @@ void P_RestoreMusic(player_t *player)
if (wantedmus == 2 && cv_growmusic.value)
{
S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
if (cv_birdmusic.value)
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
if (cv_birdmusic.value)
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else
{
@@ -1297,14 +1301,20 @@ void P_RestoreMusic(player_t *player)
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (mapmusresume && cv_resume.value)
position = mapmusresume;
else
position = mapmusposition;
if (cv_birdmusic.value)
{
if (mapmusresume && cv_resume.value)
position = mapmusresume;
else
position = mapmusposition;
S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0,
S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar();
S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0,
S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar();
}
else
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
mapmusresume = 0;
}
}
@@ -7159,7 +7169,6 @@ consvar_t cv_quaketilt = {"quaketilt", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_actionmovie = {"actionmovie", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_windowquake = {"windowquake", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
fixed_t t_cam_dist = -42;
fixed_t t_cam_height = -42;
@@ -8063,7 +8072,7 @@ boolean P_SpectatorJoinGame(player_t *player)
// Pressing fire assigns you to a team that needs players if allowed.
// Partial code reproduction from p_tick.c autobalance code.
else if (G_GametypeHasTeams())
{
{
INT32 changeto = 0;
INT32 z, numplayersred = 0, numplayersblue = 0;
@@ -8099,6 +8108,10 @@ boolean P_SpectatorJoinGame(player_t *player)
player->kartstuff[k_spectatewait] = 0;
player->ctfteam = changeto;
player->playerstate = PST_REBORN;
//center camera if its not already
if ((P_IsLocalPlayer(player)) && localaiming[0] != 0)
localaiming[0] = 0;
//Reset away view
if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer)
@@ -8113,7 +8126,7 @@ boolean P_SpectatorJoinGame(player_t *player)
}
// Joining in game from firing.
else
{
{
if (player->mo)
{
P_RemoveMobj(player->mo);
@@ -8124,6 +8137,10 @@ boolean P_SpectatorJoinGame(player_t *player)
player->kartstuff[k_spectatewait] = 0;
player->playerstate = PST_REBORN;
//center camera if its not already
if ((P_IsLocalPlayer(player)) && localaiming[0] != 0)
localaiming[0] = 0;
//Reset away view
if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer)
displayplayers[0] = consoleplayer;
+4 -4
View File
@@ -410,8 +410,8 @@ static void R_AddLine(seg_t *line)
return;
// big room fix
angle1 = R_PointToAngle64(line->v1->x, line->v1->y);
angle2 = R_PointToAngle64(line->v2->x, line->v2->y);
angle1 = R_PointToAngleEx64(viewx, viewy, line->v1->x, line->v1->y);
angle2 = R_PointToAngleEx64(viewx, viewy, line->v2->x, line->v2->y);
curline = line;
// Clip to view edges.
@@ -613,8 +613,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
check = checkcoord[boxpos];
// big room fix
angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
angle1 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
angle2 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
if ((signed)angle1 < (signed)angle2)
{
+1 -5
View File
@@ -39,11 +39,7 @@
#endif
// Not sure if this is necessary, but it was in w_wad.c, so I'm putting it here too -Shadow Hog
#ifdef _WIN32_WCE
#define AVOID_ERRNO
#else
#include <errno.h>
#endif
//
// Texture definition.
@@ -1325,7 +1321,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
extra_colormaps[mapnum].fadeend = (UINT16)fadeend;
extra_colormaps[mapnum].fog = fog;
if (rendermode == render_soft || rendermode == render_opengl)
if (rendermode != render_none)
{
double r, g, b, cbrightness;
int p;
+2
View File
@@ -407,6 +407,8 @@ typedef enum
ST_NEGATIVE
} slopetype_t;
#define HORIZONSPECIAL 41
typedef struct line_s
{
// Vertices, from v1 to v2.
+27
View File
@@ -579,6 +579,33 @@ UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors
return RGetTranslationColormap(( skin - skins ), color, flags, false);
}
patch_t* R_GetSkinFaceRank(player_t* ply)
{
if (ply->skinlocal && ply->localskin)
return localfacerankprefix[ply->localskin - 1];
else if (ply->localskin)
return facerankprefix[ply->localskin - 1];
return facerankprefix[ply->skin];
}
patch_t* R_GetSkinFaceWant(player_t* ply)
{
if (ply->skinlocal && ply->localskin)
return localfacewantprefix[ply->localskin - 1];
else if (ply->localskin)
return facewantprefix[ply->localskin - 1];
return facewantprefix[ply->skin];
}
patch_t* R_GetSkinFaceMini(player_t* ply)
{
if (ply->skinlocal && ply->localskin)
return localfacemmapprefix[ply->localskin - 1];
else if (ply->localskin)
return facemmapprefix[ply->localskin - 1];
return facemmapprefix[ply->skin];
}
/** \brief Flushes cache of translation colormaps.
Flushes cache of translation colormaps, but doesn't actually free the
+3
View File
@@ -117,6 +117,9 @@ extern lumpnum_t viewborderlump[8];
void R_InitTranslationTables(void);
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags);
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local);
patch_t* R_GetSkinFaceRank(player_t* ply);
patch_t* R_GetSkinFaceWant(player_t* ply);
patch_t* R_GetSkinFaceMini(player_t* ply);
void R_FlushTranslationColormapCache(void);
UINT8 R_GetColorByName(const char *name);
+40 -33
View File
@@ -542,16 +542,19 @@ void R_DrawTranslatedColumn_8(void)
*/
void R_DrawSpan_8 (void)
{
UINT32 xposition;
UINT32 yposition;
UINT32 xstep, ystep;
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count;
size_t count = (ds_x2 - ds_x1 + 1);
xposition = ds_xfrac; yposition = ds_yfrac;
xstep = ds_xstep; ystep = ds_ystep;
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
// can be used for the fraction part. This allows calculation of the memory address in the
@@ -560,13 +563,12 @@ void R_DrawSpan_8 (void)
// bit per power of two (obviously)
// Ok, because I was able to eliminate the variable spot below, this function is now FASTER
// than the original span renderer. Whodathunkit?
xposition = ds_xfrac << nflatshiftup; yposition = ds_yfrac << nflatshiftup;
xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup;
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
count = ds_x2 - ds_x1 + 1;
if (dest+8 > deststop)
return;
@@ -576,35 +578,35 @@ void R_DrawSpan_8 (void)
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
// have the uber complicated math to calculate it now, so that was a memory write we didn't
// need!
dest[0] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[0] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
dest[1] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[1] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
dest[2] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[2] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
dest[3] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[3] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
dest[4] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[4] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
dest[5] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[5] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
dest[6] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[6] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
dest[7] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
dest[7] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
@@ -613,7 +615,7 @@ void R_DrawSpan_8 (void)
}
while (count-- && dest <= deststop)
{
*dest++ = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
*dest++ = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
xposition += xstep;
yposition += ystep;
}
@@ -1281,15 +1283,20 @@ void R_DrawTranslucentSplat_8 (void)
*/
void R_DrawTranslucentSpan_8 (void)
{
UINT32 xposition;
UINT32 yposition;
UINT32 xstep, ystep;
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count;
size_t count = (ds_x2 - ds_x1 + 1);
UINT32 val;
xposition = ds_xfrac; yposition = ds_yfrac;
xstep = ds_xstep; ystep = ds_ystep;
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
// can be used for the fraction part. This allows calculation of the memory address in the
@@ -1298,57 +1305,57 @@ void R_DrawTranslucentSpan_8 (void)
// bit per power of two (obviously)
// Ok, because I was able to eliminate the variable spot below, this function is now FASTER
// than the original span renderer. Whodathunkit?
xposition = ds_xfrac << nflatshiftup; yposition = ds_yfrac << nflatshiftup;
xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup;
xposition <<= nflatshiftup; yposition <<= nflatshiftup;
xstep <<= nflatshiftup; ystep <<= nflatshiftup;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
count = ds_x2 - ds_x1 + 1;
while (count >= 8)
{
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
// have the uber complicated math to calculate it now, so that was a memory write we didn't
// need!
dest[0] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[0]);
dest[0] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[0]);
xposition += xstep;
yposition += ystep;
dest[1] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[1]);
dest[1] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[1]);
xposition += xstep;
yposition += ystep;
dest[2] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[2]);
dest[2] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[2]);
xposition += xstep;
yposition += ystep;
dest[3] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[3]);
dest[3] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[3]);
xposition += xstep;
yposition += ystep;
dest[4] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[4]);
dest[4] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[4]);
xposition += xstep;
yposition += ystep;
dest[5] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[5]);
dest[5] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[5]);
xposition += xstep;
yposition += ystep;
dest[6] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[6]);
dest[6] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[6]);
xposition += xstep;
yposition += ystep;
dest[7] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[7]);
dest[7] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[7]);
xposition += xstep;
yposition += ystep;
dest += 8;
count -= 8;
}
while (count--)
while (count-- && dest <= deststop)
{
*dest = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + *dest);
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
*dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest);
dest++;
xposition += xstep;
yposition += ystep;
+37 -46
View File
@@ -37,16 +37,6 @@
#include "hardware/hw_main.h"
#endif
//profile stuff ---------------------------------------------------------
//#define TIMING
#ifdef TIMING
#include "p5prof.h"
INT64 mycount;
INT64 mytotal = 0;
//unsigned long nombre = 100000;
#endif
//profile stuff ---------------------------------------------------------
// Fineangles in the SCREENWIDTH wide window.
#define FIELDOFVIEW 2048
@@ -197,7 +187,8 @@ consvar_t cv_flipcam4 = {"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo,
consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ffloorclip = {"ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ffloorclip = {"r_ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_spriteclip = {"r_spriteclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_soniccd = {"soniccd", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_allowmlook = {"allowmlook", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, NULL, NULL, 0, 0, NULL};
@@ -207,6 +198,7 @@ consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, N
consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// cap fov, fov too high tears software apart.
@@ -352,7 +344,7 @@ INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *restrict node)
}
// killough 5/2/98: reformatted
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *restrict line)
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line)
{
fixed_t lx = line->v1->x;
fixed_t ly = line->v1->y;
@@ -369,10 +361,9 @@ INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *restrict line)
y -= ly;
// Try to quickly decide by looking at sign bits.
// also use a mask to avoid branch prediction
INT32 mask = (ldy ^ ldx ^ x ^ y) >> 31;
return (mask & ((ldy ^ x) < 0)) | // (left is negative)
(~mask & (FixedMul(y, ldx>>FRACBITS) >= FixedMul(ldy>>FRACBITS, x)));
if ((ldy ^ ldx ^ x ^ y) < 0)
return (ldy ^ x) < 0; // (left is negative)
return FixedMul(y, ldx>>FRACBITS) >= FixedMul(ldy>>FRACBITS, x);
}
//
@@ -404,22 +395,6 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y)
0;
}
angle_t R_PointToAngle64(INT64 x, INT64 y)
{
return (y -= viewy, (x -= viewx) || y) ?
x >= 0 ?
y >= 0 ?
(x > y) ? tantoangle[SlopeDivEx(y,x)] : // octant 0
ANGLE_90-tantoangle[SlopeDivEx(x,y)] : // octant 1
x > (y = -y) ? 0-tantoangle[SlopeDivEx(y,x)] : // octant 8
ANGLE_270+tantoangle[SlopeDivEx(x,y)] : // octant 7
y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDivEx(y,x)] : // octant 3
ANGLE_90 + tantoangle[SlopeDivEx(x,y)] : // octant 2
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDivEx(y,x)] : // octant 4
ANGLE_270-tantoangle[SlopeDivEx(x,y)] : // octant 5
0;
}
angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
{
return (y -= pviewy, (x -= pviewx) || y) ?
@@ -514,6 +489,32 @@ angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1)
0;
}
angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1)
{
INT64 dx = x1 - x2;
INT64 dy = y1 - y2;
// Check for potential overflow or underflow
if (dx < INT64_MIN || dx > INT64_MAX || dy < INT64_MIN || dy > INT64_MAX)
{
x1 = (INT64)(dx / 2 + x2);
y1 = (INT64)(dy / 2 + y2);
}
return (y1 -= y2, (x1 -= x2) || y1) ?
x1 >= 0 ?
y1 >= 0 ?
(x1 > y1) ? tantoangle[SlopeDivEx(y1, x1)] : // octant 0
ANGLE_90 - tantoangle[SlopeDivEx(x1, y1)] : // octant 1
x1 > (y1 = -y1) ? 0 - tantoangle[SlopeDivEx(y1, x1)] : // octant 8
ANGLE_270 + tantoangle[SlopeDivEx(x1, y1)] : // octant 7
y1 >= 0 ? (x1 = -x1) > y1 ? ANGLE_180 - tantoangle[SlopeDivEx(y1, x1)] : // octant 3
ANGLE_90 + tantoangle[SlopeDivEx(x1, y1)] : // octant 2
(x1 = -x1) > (y1 = -y1) ? ANGLE_180 + tantoangle[SlopeDivEx(y1, x1)] : // octant 4
ANGLE_270 - tantoangle[SlopeDivEx(x1, y1)] : // octant 5
0;
}
//
// R_ScaleFromGlobalAngle
// Returns the texture mapping scale for the current line (horizontal span)
@@ -1811,26 +1812,15 @@ void R_RenderPlayerView(player_t *player)
// The head node is the last node output.
//profile stuff ---------------------------------------------------------
#ifdef TIMING
mytotal = 0;
ProfZeroTimer();
#endif
ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0;
PS_START_TIMING(ps_bsptime);
R_RenderBSPNode((INT32)numnodes - 1);
PS_STOP_TIMING(ps_bsptime);
ps_numsprites.value.i = visspritecount;
PS_START_TIMING(ps_sw_spritecliptime);
R_ClipSprites();
PS_STOP_TIMING(ps_sw_spritecliptime);
#ifdef TIMING
RDMSR(0x10, &mycount);
mytotal += mycount; // 64bit add
CONS_Debug(DBG_RENDER, "RenderBSPNode: 0x%d %d\n", *((INT32 *)&mytotal + 1), (INT32)mytotal);
#endif
//profile stuff ---------------------------------------------------------
ps_numsprites.value.i = numvisiblesprites;
// PORTAL RENDERING
PS_START_TIMING(ps_sw_portaltime);
@@ -1916,6 +1906,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_drawdist);
//CV_RegisterVar(&cv_drawdist_nights);
CV_RegisterVar(&cv_drawdist_precip);
CV_RegisterVar(&cv_lessprecip);
CV_RegisterVar(&cv_fov);
CV_RegisterVar(&cv_chasecam);
@@ -1926,6 +1917,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_shadowoffs);
CV_RegisterVar(&cv_skybox);
CV_RegisterVar(&cv_ffloorclip);
CV_RegisterVar(&cv_spriteclip);
CV_RegisterVar(&cv_cam_dist);
CV_RegisterVar(&cv_cam_still);
@@ -1959,7 +1951,6 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_quaketilt);
CV_RegisterVar(&cv_tiltsmoothing);
CV_RegisterVar(&cv_actionmovie);
CV_RegisterVar(&cv_windowquake);
CV_RegisterVar(&cv_driftsparkpulse);
CV_RegisterVar(&cv_gravstretch);
+3 -3
View File
@@ -68,9 +68,9 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node);
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line);
angle_t R_PointToAngle(fixed_t x, fixed_t y);
angle_t R_PointToAngle64(INT64 x, INT64 y);
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1);
angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1);
fixed_t R_PointToDist(fixed_t x, fixed_t y);
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
angle_t R_PlayerSliptideAngle(player_t *player);
@@ -111,9 +111,9 @@ extern consvar_t cv_homremoval;
extern consvar_t cv_chasecam, cv_chasecam2, cv_chasecam3, cv_chasecam4;
extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4;
extern consvar_t cv_shadow, cv_shadowoffs;
extern consvar_t cv_ffloorclip;
extern consvar_t cv_ffloorclip, cv_spriteclip;
extern consvar_t cv_translucency;
extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_drawdist_precip;
extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_drawdist_precip, cv_lessprecip;
extern consvar_t cv_fov;
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
+1037 -1018
View File
File diff suppressed because it is too large. Load diff
+17 -3
View File
@@ -755,7 +755,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (pfloor->master->flags & ML_TFERLINE)
{
size_t linenum = curline->linedef-backsector->lines[0];
size_t linenum = min(curline->linedef-backsector->lines[0], pfloor->master->frontsector->linecount);
newline = pfloor->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
}
@@ -2653,8 +2653,22 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{
ffloor[i].f_pos >>= 4;
ffloor[i].f_pos_slope >>= 4;
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range);
if (linedef->special == 41) // Horizon lines extend FOFs in contact with them too.
{
ffloor[i].f_step = 0;
ffloor[i].f_frac = (centeryfrac>>4);
topfrac++; // Prevent 1px HOM
}
else
{
#ifdef ESLOPE
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range);
#else
ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos);
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
#endif
}
}
}
+112 -31
View File
@@ -589,7 +589,8 @@ void R_DelSpriteDefs(UINT16 wadnum)
//
// GAME FUNCTIONS
//
UINT32 visspritecount;
UINT32 visspritecount, numvisiblesprites;
static UINT32 clippedvissprites;
static vissprite_t *visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL};
@@ -642,9 +643,12 @@ void R_InitSprites(void)
// it can be is do before loading config for skin cvar possible value
R_InitSkins();
for (i = 0; i < numwadfiles; i++)
for (i = 0; i < numwadfiles; i++)
{
R_AddSkins((UINT16)i, false);
R_LoadSpriteInfoLumps(i, wadfiles[i]->numlumps);
}
//
// check if all sprites have frames
//
@@ -661,7 +665,7 @@ void R_InitSprites(void)
//
void R_ClearSprites(void)
{
visspritecount = clippedvissprites = 0;
visspritecount = numvisiblesprites = clippedvissprites = 0;
}
//
@@ -940,10 +944,10 @@ static void R_DrawVisSprite(vissprite_t *vis)
{
vis->scale = FixedMul(vis->scale, this_scale);
vis->scalestep = FixedMul(vis->scalestep, this_scale);
vis->xiscale = FixedDiv(vis->xiscale,this_scale);
vis->xiscale = FixedDiv(vis->xiscale, this_scale);
vis->isScaled = true;
}
dc_texturemid = FixedDiv(dc_texturemid,this_scale);
dc_texturemid = FixedDiv(dc_texturemid, this_scale);
}
spryscale = vis->scale;
@@ -1311,13 +1315,16 @@ static void R_ProjectSprite(mobj_t *thing)
size_t rot;
UINT8 flip;
/*boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(thing));
/*boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(thing));*/
boolean mirrored = thing->mirrored;
boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored);*/
boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
INT32 lindex;
vissprite_t *vis;
spritecut_e cut = SC_NONE;
angle_t ang = 0; // gcc 4.6 and lower fix
fixed_t iscale;
@@ -1393,11 +1400,11 @@ static void R_ProjectSprite(mobj_t *thing)
rot = thing->frame&FF_FRAMEMASK;
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
if (thing->skin && thing->sprite == SPR_PLAY)
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
{
sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef;
#ifdef ROTSPRITE
sprinfo = &spriteinfo[thing->sprite];
sprinfo = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->sprinfo;
#endif
if (rot >= sprdef->numframes)
@@ -1439,6 +1446,8 @@ static void R_ProjectSprite(mobj_t *thing)
if (sprframe->rotate != SRF_SINGLE || papersprite)
{
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
if (mirrored)
ang = InvAngle(ang);
if (papersprite)
ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT));
}
@@ -1468,7 +1477,7 @@ static void R_ProjectSprite(mobj_t *thing)
}
I_Assert(lump < max_spritelumps);
if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES)
this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale);
else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
@@ -1480,20 +1489,15 @@ static void R_ProjectSprite(mobj_t *thing)
spr_topoffset = spritecachedinfo[lump].topoffset;
#ifdef ROTSPRITE
if (thing->player)
{
sliptiderollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), ((cv_sloperoll.value == 1) ? thing->player->sliproll*(thing->player->sliptidemem) : 0));
}
else
sliptiderollangle = 0;
if ((thing->rollangle)||(thing->sloperoll)||sliptiderollangle)
if ((thing->rollangle)||(thing->sloperoll)||(thing->player && thing->player->sliproll))
{
if (thing->player)
rollsum = (thing->rollangle) + (thing->sloperoll) + sliptiderollangle;
{
sliptiderollangle = cv_sliptideroll.value ? thing->player->sliproll*(thing->player->sliptidemem) : 0;
rollsum = (thing->rollangle)+(thing->sloperoll)+FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
}
else
rollsum = (thing->rollangle) + (thing->sloperoll);
rollsum = (thing->rollangle)+(thing->sloperoll);
rollangle = R_GetRollAngle(rollsum);
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
@@ -1515,6 +1519,7 @@ static void R_ProjectSprite(mobj_t *thing)
// calculate edges of the shape
spritexscale = interp.spritexscale;
spriteyscale = interp.spriteyscale;
if (spritexscale < 1 || spriteyscale < 1)
return;
@@ -1533,6 +1538,8 @@ static void R_ProjectSprite(mobj_t *thing)
spr_offset += interp.spritexoffset * flipoffset;
spr_topoffset += interp.spriteyoffset * flipoffset;
}
flip = !flip != !hflip;
if (flip)
offset = spr_offset - spr_width;
@@ -2193,6 +2200,14 @@ void R_SortVisSprites(void)
bestscale = bestdispoffset = INT32_MAX;
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
{
// Remove this sprite if it was determined to not be visible
if (ds->cut & SC_NOTVISIBLE)
{
ds->next->prev = ds->prev;
ds->prev->next = ds->next;
continue;
}
if (ds->sortscale < bestscale)
{
bestscale = ds->sortscale;
@@ -2206,12 +2221,15 @@ void R_SortVisSprites(void)
best = ds;
}
}
best->next->prev = best->prev;
best->prev->next = best->next;
best->next = &vsprsortedhead;
best->prev = vsprsortedhead.prev;
vsprsortedhead.prev->next = best;
vsprsortedhead.prev = best;
if (best)
{
best->next->prev = best->prev;
best->prev->next = best->next;
best->next = &vsprsortedhead;
best->prev = vsprsortedhead.prev;
vsprsortedhead.prev->next = best;
vsprsortedhead.prev = best;
}
}
}
@@ -2573,7 +2591,45 @@ static void R_DrawPrecipitationSprite(vissprite_t *spr)
R_DrawPrecipitationVisSprite(spr);
}
// R_ClipSprites
static boolean R_CheckSpriteVisible(vissprite_t *spr, INT32 x1, INT32 x2)
{
INT16 sz = spr->sz;
INT16 szt = spr->szt;
fixed_t texturemid, yscale, scalestep = spr->scalestep;
INT32 height;
if (scalestep)
{
height = spr->patch->height;
yscale = spr->scale;
scalestep = FixedMul(scalestep, spr->spriteyscale);
if (spr->thingscale != FRACUNIT)
texturemid = FixedDiv(spr->texturemid, max(spr->thingscale, 1));
else
texturemid = spr->texturemid;
}
for (INT32 x = x1; x <= x2; x++)
{
if (scalestep)
{
fixed_t top = centeryfrac - FixedMul(texturemid, yscale);
fixed_t bottom = top + (height * yscale);
szt = (INT16)(top >> FRACBITS);
sz = (INT16)(bottom >> FRACBITS);
yscale += scalestep;
}
if (spr->cliptop[x] < spr->clipbot[x] && sz > spr->cliptop[x] && szt < spr->clipbot[x])
return true;
}
return false;
}
// R_ClipVisSprite
// Clips vissprites without drawing, so that portals can work. -Red
void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2)
{
@@ -2756,8 +2812,15 @@ void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2)
spr->clipbot[x] = (INT16)viewheight;
if (spr->cliptop[x] == -2)
//Fab : 26-04-98: was -1, now clips against console bottom
spr->cliptop[x] = (INT16)con_clipviewtop;
spr->cliptop[x] = -1;
}
// Check if it'll be visible
// Not done for floorsprites.
if (cv_spriteclip.value)
{
if (!R_CheckSpriteVisible(spr, x1, x2))
spr->cut |= SC_NOTVISIBLE;
}
}
@@ -2826,6 +2889,13 @@ void R_ClipSprites(void)
for (; clippedvissprites < visspritecount; clippedvissprites++)
{
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
if (cv_spriteclip.value
&& (spr->szt > vid.height || spr->sz < 0))
{
spr->cut |= SC_NOTVISIBLE;
continue;
}
if (spr->x2 < cx)
{
@@ -2844,6 +2914,9 @@ void R_ClipSprites(void)
}
R_ClipVisSprite(spr, spr->x1, spr->x2);
if ((spr->cut & SC_NOTVISIBLE) == 0)
numvisiblesprites++;
}
}
@@ -2923,6 +2996,7 @@ UINT8 skinstatscount[9][9] = {
UINT8 skinsorted[MAXSKINS];
skin_t localskins[MAXSKINS];
skin_t allskins[MAXSKINS*2];
// FIXTHIS: don't work because it must be inistilised before the config load
//#define SKINVALUES
#ifdef SKINVALUES
@@ -3015,6 +3089,7 @@ void R_InitSkins(void)
skin->spritedef.numframes = sprites[SPR_PLAY].numframes;
skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes;
skin->sprinfo = spriteinfo[SPR_PLAY];
ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, 0);
// Set values for Sonic skin
@@ -3539,6 +3614,7 @@ next_token:
free(buf2);
lump++; // if no sprite defined use spirte just after this one
INT32 sprnum;
if (skin->sprite[0] == '\0')
{
const char *csprname = W_CheckNameForNumPwad(wadnum, lump);
@@ -3549,6 +3625,9 @@ next_token:
lastlump++;
// allocate (or replace) sprite frames, and set spritedef
R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump);
// i feel like generally most skin authors just use PLAY here, so just assume PLAY
sprnum = SPR_PLAY;
}
else
{
@@ -3596,6 +3675,8 @@ next_token:
R_AddSingleSpriteDef(sprname, &skin->spritedef, wadnum, lstart, lend);
}
sprnum = numspritelumps - 1;
// I don't particularly care about skipping to the end of the used frames.
// We could be using frames from ANYWHERE in the current WAD file, including
// right before us, which is a terrible idea.
+6 -2
View File
@@ -79,6 +79,7 @@ typedef struct
{
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
spritedef_t spritedef;
spriteinfo_t sprinfo;
UINT16 wadnum;
char sprite[4]; // Sprite name, if seperated from S_SKIN.
skinflags_t flags;
@@ -114,7 +115,10 @@ typedef enum
SC_NONE = 0,
SC_TOP = 1,
SC_BOTTOM = 2,
SC_VFLIP = 3
SC_VFLIP = 3,
SC_NOTVISIBLE = 4,
SC_CUTMASK = SC_TOP|SC_BOTTOM|SC_NOTVISIBLE,
SC_FLAGMASK = ~SC_CUTMASK
} spritecut_e;
// A vissprite_t is a thing that will be drawn during a refresh,
@@ -175,7 +179,7 @@ typedef struct vissprite_s
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} vissprite_t;
extern UINT32 visspritecount;
extern UINT32 visspritecount, numvisiblesprites;
void R_ClipSprites(void);
void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2);
+261 -5
View File
@@ -27,6 +27,8 @@
#include "r_sky.h" // skyflatnum
#include "p_local.h" // camera info
#include "m_misc.h" // for tunes command
#include "m_cond.h" // for conditionsets
#include "m_menu.h" // bird music stuff
#ifdef HAVE_BLUA
#include "lua_hook.h" // MusicChange hook
@@ -96,6 +98,9 @@ consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff,
consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
//bird music stuff
static CV_PossibleValue_t music_resync_threshold_cons_t[] = {
{0, "MIN"},
{1000, "MAX"},
@@ -106,6 +111,16 @@ consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV
consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagConditions, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resetspecialmusic = {"resetspecialmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_birdmusic = {"birdmusicstuff", "No", CV_SAVE|CV_CALL, CV_YesNo, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
#ifdef HAVE_OPENMPT
openmpt_module *openmpt_mhandle = NULL;
@@ -270,11 +285,25 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_gamemidimusic);
#endif
//bird music stuff
CV_RegisterVar(&cv_playmusicifunfocused);
CV_RegisterVar(&cv_playsoundifunfocused);
CV_RegisterVar(&cv_pausemusic);
CV_RegisterVar(&cv_music_resync_threshold);
CV_RegisterVar(&cv_music_resync_powerups_only);
CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade);
CV_RegisterVar(&cv_respawnfademusicout);
CV_RegisterVar(&cv_respawnfademusicback);
CV_RegisterVar(&cv_resetspecialmusic);
CV_RegisterVar(&cv_resume);
CV_RegisterVar(&cv_fading);
CV_RegisterVar(&cv_birdmusic);
COM_AddCommand("tunes", Command_Tunes_f);
COM_AddCommand("restartaudio", Command_RestartAudio_f);
@@ -1294,6 +1323,19 @@ static UINT32 queue_fadeinms;
musicdef_t *musicdefstart = NULL; // First music definition
struct cursongcredit cursongcredit; // Currently displayed song credit info
musicdef_t soundtestsfx = {
"_STSFX", // prevents exactly one valid track name from being used on the sound test
"Sound Effects",
"",
"SEGA, Sonic Team Jr, other sources",
1, // show on soundtest page 1
0, // with no conditions
0,
0,
false,
NULL
};
//
// search for music definition in wad
//
@@ -1400,6 +1442,8 @@ void S_LoadMusicDefs(UINT16 wadnum)
//CONS_Printf("S_LoadMusicDefs: Added song '%s'\n", def->name);
}
}
strncpy(def->filename, wadfiles[wadnum]->filename, 256);
skip_lump:
stoken = strtok(NULL, "\r\n ");
@@ -1422,19 +1466,33 @@ skip_lump:
free(buf2);
return;
}
if (!stricmp(stoken, "usage")) {
#if 0 // Ignore for now
STRBUFCPY(def->usage, value);
for (value = def->usage; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set usage to '%s'\n", def->usage);
#endif
} else if (!stricmp(stoken, "source")) {
STRBUFCPY(def->source, value);
for (value = def->source; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
} else if (!stricmp(stoken, "title")) {
def->use_info = true;
STRBUFCPY(def->title, value);
for (value = def->title; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
} else if (!stricmp(stoken, "alttitle")) {
STRBUFCPY(def->alttitle, value);
for (value = def->alttitle; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
} else if (!stricmp(stoken, "authors")) {
STRBUFCPY(def->authors, value);
for (value = def->authors; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
} else {
CONS_Alert(CONS_WARNING, "MUSICDEF: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
}
@@ -1461,7 +1519,168 @@ void S_InitMusicDefs(void)
S_LoadMusicDefs(i);
}
//
// search for music definition in wad
//
static UINT16 W_CheckForMusicInfoInPwad(UINT16 wadid)
{
UINT16 i;
lumpinfo_t *lump_p;
lump_p = wadfiles[wadid]->lumpinfo;
for (i = 0; i < wadfiles[wadid]->numlumps; i++, lump_p++)
if (memcmp(lump_p->name, "MUSCINFO", 8) == 0)
return i;
return INT16_MAX; // not found
}
void S_LoadMTDefs(UINT16 wadnum)
{
UINT16 lump;
char *buf;
char *buf2;
char *stoken;
char *value;
size_t size;
musicdef_t *def, *prev;
UINT16 line = 1; // for better error msgs
lump = W_CheckForMusicInfoInPwad(wadnum);
if (lump == INT16_MAX)
return;
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
size = W_LumpLengthPwad(wadnum, lump);
// for strtok
buf2 = malloc(size+1);
if (!buf2)
I_Error("S_LoadMTDefs: No more free memory\n");
M_Memcpy(buf2,buf,size);
buf2[size] = '\0';
def = prev = NULL;
stoken = strtok (buf2, "\r\n ");
// Find music def
while (stoken)
{
/*if ((stoken[0] == '/' && stoken[1] == '/')
|| (stoken[0] == '#')) // skip comments
{
stoken = strtok(NULL, "\r\n"); // skip end of line
if (def)
stoken = strtok(NULL, "\r\n= ");
else
stoken = strtok(NULL, "\r\n ");
line++;
}
else*/ if (!stricmp(stoken, "lump"))
{
value = strtok(NULL, "\r\n ");
if (!value)
{
CONS_Alert(CONS_WARNING, "MUSICDEF: Lump '%s' is missing name. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
stoken = strtok(NULL, "\r\n"); // skip end of line
goto skip_lump;
}
// No existing musicdefs
if (!musicdefstart)
{
musicdefstart = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
STRBUFCPY(musicdefstart->name, value);
strlwr(musicdefstart->name);
def = musicdefstart;
//CONS_Printf("S_LoadMusicDefs: Initialized musicdef w/ song '%s'\n", def->name);
}
else
{
def = musicdefstart;
// Search if this is a replacement
//CONS_Printf("S_LoadMusicDefs: Searching for song replacement...\n");
while (def)
{
if (!stricmp(def->name, value))
{
//CONS_Printf("S_LoadMusicDefs: Found song replacement '%s'\n", def->name);
break;
}
prev = def;
def = def->next;
}
// Nothing found, abort.
if (!def)
{
CONS_Alert(CONS_WARNING, "MUSCINFO: Music def for '%s' does not exist. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
free(buf2);
return;
}
}
skip_lump:
stoken = strtok(NULL, "\r\n ");
line++;
}
else
{
value = strtok(NULL, "\r\n= ");
if (!value)
{
CONS_Alert(CONS_WARNING, "MUSCINFO: Field '%s' is missing value. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
stoken = strtok(NULL, "\r\n"); // skip end of line
goto skip_field;
}
if (!def)
{
CONS_Alert(CONS_ERROR, "MUSCINFO: No music definition before field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
free(buf2);
return;
}
if (!stricmp(stoken, "title")) {
def->use_info = true;
STRBUFCPY(def->title, value);
for (value = def->title; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
} else if (!stricmp(stoken, "alttitle")) {
STRBUFCPY(def->alttitle, value);
for (value = def->alttitle; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
} else if (!stricmp(stoken, "authors")) {
STRBUFCPY(def->authors, value);
for (value = def->authors; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces.
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
} else {
CONS_Alert(CONS_WARNING, "MUSCINFO: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
}
skip_field:
stoken = strtok(NULL, "\r\n= ");
line++;
}
}
free(buf2);
return;
}
void S_InitMTDefs(void)
{
UINT16 i;
for (i = 0; i < numwadfiles; i++)
S_LoadMTDefs(i);
}
//
// S_FindMusicCredit
//
@@ -1522,6 +1741,42 @@ void S_ShowMusicCredit(void)
S_ShowSpecifiedMusicCredit(music_name);
}
musicdef_t **soundtestdefs = NULL;
INT32 numsoundtestdefs = 0;
//
// S_PrepareSoundTest
//
// Prepare sound test. What am I, your butler?
//
boolean S_PrepareSoundTest(void)
{
musicdef_t *def;
INT32 pos = numsoundtestdefs = 0;
for (def = musicdefstart; def; def = def->next)
{
numsoundtestdefs++;
}
if (!numsoundtestdefs)
return false;
if (soundtestdefs)
Z_Free(soundtestdefs);
if (!(soundtestdefs = Z_Malloc(numsoundtestdefs*sizeof(musicdef_t *), PU_STATIC, NULL)))
I_Error("S_PrepareSoundTest(): could not allocate soundtestdefs.");
for (def = musicdefstart; def /*&& i < numsoundtestdefs*/; def = def->next)
{
soundtestdefs[pos++] = def;
}
return true;
}
/// ------------------------
/// Music Status
/// ------------------------
@@ -1699,7 +1954,8 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
if (S_MusicDisabled())
return false;
I_UpdateSongLagConditions();
if (cv_birdmusic.value)
I_UpdateSongLagConditions();
if ((!fadeinms && !I_PlaySong(looping)) ||
(fadeinms && !I_FadeInPlaySong(fadeinms, looping)))
@@ -1823,7 +2079,7 @@ void S_StopMusic(void)
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
return;
if (strcasecmp(music_name, mapmusname) == 0)
if ((cv_birdmusic.value) && (strcasecmp(music_name, mapmusname) == 0))
mapmusresume = I_GetSongPosition();
if (I_SongPaused())
+34 -2
View File
@@ -42,6 +42,7 @@ extern consvar_t cv_gamemidimusic;
extern consvar_t cv_gamesounds;
extern consvar_t cv_playmusicifunfocused;
extern consvar_t cv_playsoundifunfocused;
extern consvar_t cv_pausemusic;
#ifdef HAVE_OPENMPT
extern consvar_t cv_modfilter;
@@ -52,9 +53,23 @@ extern consvar_t cv_amigatype;
#endif
#endif
//bird music stuff
extern consvar_t cv_music_resync_threshold;
extern consvar_t cv_music_resync_powerups_only;
extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade;
extern consvar_t cv_respawnfademusicout;
extern consvar_t cv_respawnfademusicback;
extern consvar_t cv_resetspecialmusic;
extern consvar_t cv_resume;
extern consvar_t cv_fading;
extern consvar_t cv_birdmusic;
extern CV_PossibleValue_t soundvolume_cons_t[];
typedef enum
@@ -144,11 +159,25 @@ boolean S_SpeedMusic(float speed);
typedef struct musicdef_s
{
char name[7];
//char usage[256];
char usage[256];
char source[256];
char filename[256];
// for the music test stuff
// generally if these are present on vanilla the game would throw up a warning
// a sacrifice i suppose
char title[256];
char alttitle[256];
char authors[256];
boolean use_info;
struct musicdef_s *next;
} musicdef_t;
extern musicdef_t soundtestsfx;
extern musicdef_t *musicdefstart;
extern musicdef_t **soundtestdefs;
extern INT32 numsoundtestdefs;
extern UINT8 soundtestpage;
extern struct cursongcredit
{
musicdef_t *def;
@@ -157,14 +186,17 @@ extern struct cursongcredit
UINT8 trans;
} cursongcredit;
extern musicdef_t *musicdefstart;
void S_LoadMusicDefs(UINT16 wadnum);
void S_InitMusicDefs(void);
void S_LoadMTDefs(UINT16 wadnum);
void S_InitMTDefs(void);
musicdef_t *S_FindMusicCredit(const char *musname);
void S_ShowSpecifiedMusicCredit(const char *musname);
void S_ShowMusicCredit(void);
boolean S_PrepareSoundTest(void);
//
// Music Seeking
//
+25 -7
View File
@@ -70,6 +70,8 @@ consvar_t cv_shittyscreen = {"televisionsignal", "Okay", CV_NOSHOWHELP, shittysc
static void SCR_ChangeFullscreen (void);
static INT32 SCR_FPSflags(void);
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
// =========================================================================
@@ -411,6 +413,14 @@ void SCR_CalculateFPS(void)
#endif
}
// this is pretty dumb, but has to be done like this, otherwise the fps counter just disappears sometimes for no reason lol
static INT32 SCR_FPSflags(void)
{
if (!cv_translucenthud.value) return V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS; // eee kinda works ig
return (((10-cv_translucenthud.value)*V_10TRANS) & V_ALPHAMASK) | V_SNAPTOBOTTOM|V_SNAPTORIGHT;
}
void SCR_DisplayTicRate(void)
{
const UINT8 *ticcntcolor = NULL;
@@ -418,10 +428,15 @@ void SCR_DisplayTicRate(void)
UINT32 benchmark = (cap == 0) ? I_GetRefreshRate() : cap;
INT32 x = 318;
double fps = round(averageFPS);
INT32 fpsflags = SCR_FPSflags();
if (gamestate == GS_NULL)
return;
// draw "FPS"
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTORIGHT, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
if (cv_ticrate.value == 1)
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
if (fps > (benchmark - 5))
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
else if (fps < 20)
@@ -439,15 +454,16 @@ void SCR_DisplayTicRate(void)
}
// draw total frame:
V_DrawPingNum(x, 190, V_SNAPTOBOTTOM|V_SNAPTORIGHT, cap, ticcntcolor);
V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor);
x -= digits * 4;
// draw "/"
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTORIGHT, frameslash, ticcntcolor);
// draw "/"
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, fpsflags, frameslash, ticcntcolor);
}
// draw our actual framerate
V_DrawPingNum(x, 190, V_SNAPTOBOTTOM|V_SNAPTORIGHT, fps, ticcntcolor);
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
}
// SCR_DisplayLocalPing
@@ -456,9 +472,11 @@ void SCR_DisplayTicRate(void)
void SCR_DisplayLocalPing(void)
{
UINT32 ping = playerpingtable[consoleplayer]; // consoleplayer's ping is everyone's ping in a splitnetgame :P
INT32 fpsflags = SCR_FPSflags();
if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level
{
INT32 dispy = cv_ticrate.value ? 160 : 181;
HU_drawPing(307, dispy, ping, V_SNAPTORIGHT | V_SNAPTOBOTTOM);
HU_drawPing(307, dispy, ping, fpsflags);
}
}
+2 -7
View File
@@ -39,13 +39,8 @@
// we try to re-allocate a minimum of buffers for stability of the memory,
// so all the small-enough tables based on screen size, are allocated once
// and for all at the maximum size.
#if defined (_WIN32_WCE)
#define MAXVIDWIDTH 320
#define MAXVIDHEIGHT 200
#else
#define MAXVIDWIDTH 2560 // don't set this too high because actually
#define MAXVIDHEIGHT 1440 // lots of tables are allocated with the MAX size.
#endif
#define MAXVIDWIDTH 3840 // don't set this too high because actually
#define MAXVIDHEIGHT 2160 // lots of tables are allocated with the MAX size.
#define BASEVIDWIDTH 320 // NEVER CHANGE THIS! This is the original
#define BASEVIDHEIGHT 200 // resolution of the graphics.
+1 -1
View File
@@ -55,7 +55,7 @@ ifdef FREEBSD
OPTS+=-DLINUX -DFREEBSD -I/usr/X11R6/include
SDL_CONFIG?=sdl11-config
LDFLAGS+=-L/usr/X11R6/lib
LIBS+=-lipx -lkvm
LIBS+=-lkvm -lexecinfo
endif
#
+9
View File
@@ -106,6 +106,15 @@ endif
endif
endif
ifndef NOLIBBACKTRACE
OPTS+=-DHAVE_LIBBACKTRACE
ifdef MINGW64
CPPFLAGS+=-I../libs/libbacktrace/include
LDFLAGS+=-L../libs/libbacktrace/lib/x86_64
endif
LIBS:=-lbacktrace $(LIBS)
endif
CFLAGS+=$(SDL_CFLAGS)
LIBS:=$(SDL_LDFLAGS) $(LIBS)
ifdef STATIC
+2
View File
@@ -78,6 +78,7 @@ void *hwSym(const char *funcName,void *handle)
funcPointer = &OglSdlSetPalette;
GETFUNC(Init);
GETFUNC(SetupGLInfo);
GETFUNC(Draw2DLine);
GETFUNC(DrawPolygon);
GETFUNC(SetBlend);
@@ -99,6 +100,7 @@ void *hwSym(const char *funcName,void *handle)
GETFUNC(DoScreenWipe);
GETFUNC(DrawIntermissionBG);
GETFUNC(MakeScreenTexture);
GETFUNC(RenderVhsEffect);
GETFUNC(MakeScreenFinalTexture);
GETFUNC(DrawScreenFinalTexture);
+19
View File
@@ -37,6 +37,12 @@
//#define SDLMAIN
#endif
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
struct backtrace_state *bt_state = NULL;
#endif
#ifdef SDLMAIN
#include "SDL_main.h"
#elif defined(FORCESDLMAIN)
@@ -105,6 +111,19 @@ int main(int argc, char **argv)
myargc = argc;
myargv = argv; /// \todo pull out path to exe from this string
#ifdef HAVE_LIBBACKTRACE
bt_state = backtrace_create_state(
argv[0],
#ifdef HAVE_THREADS
1,
#else
0,
#endif
NULL,
NULL
);
#endif
#ifdef HAVE_TTF
#ifdef _WIN32
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE);
+227 -127
View File
@@ -42,7 +42,16 @@ typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#endif
// A little more than the minimum sleep duration on Windows.
// May be incorrect for other platforms, but we don't currently have a way to
// query the scheduler granularity. SDL will do what's needed to make this as
// low as possible though.
#define MIN_SLEEP_DURATION_MS 2.1
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#ifdef __GNUC__
@@ -90,7 +99,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#include <kvm.h>
#endif
#include <nlist.h>
#include <sys/vmmeter.h>
#include <sys/sysctl.h>
#endif
#endif
@@ -137,12 +146,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#include <errno.h>
#endif
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#include <execinfo.h>
#include <time.h>
#define UNIXBACKTRACE
#endif
// Locations for searching the srb2.srb
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2Kart"
@@ -197,6 +200,161 @@ static char returnWadPath[256];
#include "../byteptr.h"
#endif
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
// TODO - move this to some header file instead
extern struct backtrace_state *bt_state;
static void printsignal(FILE *fp, INT32 num)
{
switch (num)
{
case SIGILL:
fprintf(fp, "SIGILL - illegal instruction - invalid function image");
break;
case SIGFPE:
fprintf(fp, "SIGFPE - mathematical exception");
break;
case SIGSEGV:
fprintf(fp, "SIGSEGV - segment violation");
break;
case SIGABRT:
fprintf(fp, "SIGABRT - abnormal termination triggered by abort call");
break;
default:
fprintf(fp, "Signal number %d", num);
}
}
typedef struct bt_out_buf_s {
boolean error;
char *pos;
size_t size;
} bt_out_buf_t;
static void bt_syminfo_cb(void *data, uintptr_t pc, const char *symname, uintptr_t symval, uintptr_t symsize)
{
(void)symval;
(void)symsize;
bt_out_buf_t *buf = (bt_out_buf_t*)data;
if (!symname)
symname = "???";
int n = snprintf(buf->pos, buf->size, "%p %s\n", (void*)pc, symname);
if (n <= 0)
{
buf->size = 0;
return;
}
buf->pos += n;
buf->size -= n;
}
static int bt_simple_cb(void *data, uintptr_t pc)
{
bt_out_buf_t *buf = (bt_out_buf_t*)data;
backtrace_syminfo(bt_state, pc, bt_syminfo_cb, NULL, data);
if (!buf->size) return 1;
return 0;
}
static int bt_full_cb(void *data, uintptr_t pc, const char *filename, int lineno, const char *function)
{
bt_out_buf_t *buf = (bt_out_buf_t*)data;
if (!filename) filename = "???";
if (!function) function = "???";
int n = snprintf(buf->pos, buf->size, "%p %s\n\t%s:%d\n", (void*)pc, function, filename, lineno);
if (n <= 0) return 1;
buf->pos += n;
buf->size -= n;
if (!buf->size) return 1;
return 0;
}
static void bt_error_cb(void *data, const char *msg, int errnum)
{
(void)msg; // We don't need this
bt_out_buf_t *buf = (bt_out_buf_t*)data;
// No debug info
if (errnum == -1)
buf->error = true;
}
static void write_backtrace(INT32 num)
{
FILE *out = fopen(va("%s" PATHSEP "%s", srb2home, "srb2kart-crash-log.txt"), "a");
time_t rawtime;
struct tm *timeinfo;
const size_t BUFSIZE = 8192;
char backtrace[BUFSIZE];
bt_out_buf_t buf;
buf.error = false;
buf.pos = backtrace;
buf.size = BUFSIZE;
if (!out)
{
fprintf(stderr, "\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n");
out = stderr;
}
// Get the current time as a string.
time(&rawtime);
timeinfo = localtime(&rawtime);
fprintf(out, "------------------------\n\n");
fprintf(out, "Program name: %s %s\n", SRB2APPLICATION, VERSIONSTRING);
if (compdate && comptime && comprevision && compbranch)
fprintf(out, "Compiled: %s %s, commit %s, branch %s\n", compdate, comptime, comprevision, compbranch);
fprintf(out, "Time of crash: %s\n", asctime(timeinfo));
fprintf(out, "Caused by: ");
printsignal(out, num);
fprintf(out, "\nBacktrace:\n");
// Try to get full backtrace, it will print files and line numbers
backtrace_full(bt_state, 2, bt_full_cb, bt_error_cb, (void*)&buf);
if (buf.error)
{
// Fall back to simple backtrace, only prints function names
backtrace_simple(bt_state, 2, bt_simple_cb, NULL, (void*)&buf);
}
fputs(backtrace, out);
if (out != stderr)
{
fclose(out);
fprintf(stderr, "Crash report created, find srb2kart-crash-log.txt in your SRB2Kart directory\n");
}
}
#endif
/** \brief The JoyReset function
\param JoySet Joystick info to reset
@@ -258,85 +416,6 @@ SDL_bool framebuffer = SDL_FALSE;
UINT8 keyboard_started = false;
#ifdef UNIXBACKTRACE
static void bt_write_file(int fd, const char *string) {
ssize_t written = 0;
ssize_t sourcelen = strlen(string);
while (fd != -1 && (written != -1 && errno != EINTR) && written < sourcelen)
written = write(fd, string, sourcelen);
}
static void bt_write_stderr(const char *string) {
bt_write_file(STDERR_FILENO, string);
}
static void bt_write_all(int fd, const char *string) {
bt_write_file(fd, string);
bt_write_file(STDERR_FILENO, string);
}
static void write_backtrace(INT32 signal)
{
int fd = -1;
time_t rawtime;
struct tm timeinfo;
size_t bt_size;
enum { BT_SIZE = 1024, STR_SIZE = 32 };
void *funcptrs[BT_SIZE];
char timestr[STR_SIZE];
const char *filename = va("%s" PATHSEP "%s", srb2home, "crash-log.txt");
fd = open(filename, O_CREAT|O_APPEND|O_RDWR, S_IRUSR|S_IWUSR);
if (fd == -1) // File handle error
bt_write_stderr("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n");
// Get the current time as a string.
time(&rawtime);
localtime_r(&rawtime, &timeinfo);
strftime(timestr, STR_SIZE, "%a, %d %b %Y %T %z", &timeinfo);
bt_write_file(fd, "------------------------\n"); // Nice looking seperator
bt_write_all(fd, "\n"); // Newline to look nice for both outputs.
bt_write_all(fd, "An error occurred within SRB2! Send this stack trace to someone who can help!\n");
if (fd != -1) // If the crash log exists,
bt_write_stderr("(Or find crash-log.txt in your SRB2 directory.)\n"); // tell the user where the crash log is.
// Tell the log when we crashed.
bt_write_file(fd, "Time of crash: ");
bt_write_file(fd, timestr);
bt_write_file(fd, "\n");
// Give the crash log the cause and a nice 'Backtrace:' thing
// The signal is given to the user when the parent process sees we crashed.
bt_write_file(fd, "Cause: ");
bt_write_file(fd, strsignal(signal));
bt_write_file(fd, "\n"); // Newline for the signal name
bt_write_all(fd, "\nBacktrace:\n");
// Flood the output and log with the backtrace
bt_size = backtrace(funcptrs, BT_SIZE);
backtrace_symbols_fd(funcptrs, bt_size, fd);
backtrace_symbols_fd(funcptrs, bt_size, STDERR_FILENO);
bt_write_file(fd, "\n"); // Write another newline to the log so it looks nice :)
if (fd != -1) {
fsync(fd); // reaaaaally make sure we got that data written.
close(fd);
}
}
#endif // UNIXBACKTRACE
static void I_ReportSignal(int num, int coredumped)
{
//static char msg[] = "oh no! back to reality!\r\n";
@@ -395,9 +474,11 @@ static void I_ReportSignal(int num, int coredumped)
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
D_QuitNetGame(); // Fix server freezes
#ifdef UNIXBACKTRACE
#ifdef HAVE_LIBBACKTRACE
write_backtrace(num);
#endif
I_ReportSignal(num, 0);
I_ShutdownSystem();
signal(num, SIG_DFL); //default signal action
@@ -585,6 +666,7 @@ void I_GetConsoleEvents(void)
return;
ev.type = ev_console;
ev.data1 = 0;
if (read(STDIN_FILENO, &key, 1) == -1 || !key)
return;
@@ -611,7 +693,7 @@ void I_GetConsoleEvents(void)
}
else return;
}
else
else if (tty_con.cursor < sizeof (tty_con.buffer))
{
// push regular character
ev.data1 = tty_con.buffer[tty_con.cursor] = key;
@@ -791,7 +873,8 @@ static void I_RegisterSignals (void)
#ifdef NEWSIGNALHANDLER
static void signal_handler_child(INT32 num)
{
#ifdef UNIXBACKTRACE
#ifdef HAVE_LIBBACKTRACE
write_backtrace(num);
#endif
@@ -952,12 +1035,6 @@ INT32 I_GetKey (void)
return rc;
}
void
I_CursedWindowMovement (int xd, int yd)
{
SDL_SetWindowPosition(window, window_x + xd, window_y + yd);
}
//
// I_JoyScale
//
@@ -3146,6 +3223,52 @@ void I_Sleep(UINT32 ms)
SDL_Delay(ms);
}
void I_SleepDuration(precise_t duration)
{
#if defined(__linux__) || defined(__FreeBSD__)
UINT64 precision = I_GetPrecisePrecision();
struct timespec ts = {
.tv_sec = duration / precision,
.tv_nsec = duration * 1000000000 / precision % 1000000000,
};
int status;
do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
while (status == EINTR);
#else
UINT64 precision = I_GetPrecisePrecision();
INT32 sleepvalue = cv_sleep.value;
UINT64 delaygranularity;
precise_t cur;
precise_t dest;
{
double gran = round(((double)(precision / 1000) * sleepvalue * MIN_SLEEP_DURATION_MS));
delaygranularity = (UINT64)gran;
}
cur = I_GetPreciseTime();
dest = cur + duration;
// the reason this is not dest > cur is because the precise counter may wrap
// two's complement arithmetic is our friend here, though!
// e.g. cur 0xFFFFFFFFFFFFFFFE = -2, dest 0x0000000000000001 = 1
// 0x0000000000000001 - 0xFFFFFFFFFFFFFFFE = 3
while ((INT64)(dest - cur) > 0)
{
// If our cv_sleep value exceeds the remaining sleep duration, use the
// hard sleep function.
if (sleepvalue > 0 && (dest - cur) > delaygranularity)
{
I_Sleep(sleepvalue);
}
// Otherwise, this is a spinloop.
cur = I_GetPreciseTime();
}
#endif
}
#ifdef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr)
{
@@ -3916,40 +4039,17 @@ static long get_entry(const char* name, const char* buf)
size_t I_GetFreeMem(size_t *total)
{
#ifdef FREEBSD
struct vmmeter sum;
kvm_t *kd;
struct nlist namelist[] =
{
#define X_SUM 0
{"_cnt"},
{NULL}
};
if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL)
{
if (total)
*total = 0L;
return 0;
}
if (kvm_nlist(kd, namelist) != 0)
{
kvm_close (kd);
if (total)
*total = 0L;
return 0;
}
if (kvm_read(kd, namelist[X_SUM].n_value, &sum,
sizeof (sum)) != sizeof (sum))
{
kvm_close(kd);
if (total)
*total = 0L;
return 0;
}
kvm_close(kd);
u_int v_free_count, v_page_size, v_page_count;
size_t size = sizeof(v_free_count);
sysctlbyname("vm.stats.vm.v_free_count", &v_free_count, &size, NULL, 0);
size = sizeof(v_page_size);
sysctlbyname("vm.stats.vm.v_page_size", &v_page_size, &size, NULL, 0);
size = sizeof(v_page_count);
sysctlbyname("vm.stats.vm.v_page_count", &v_page_count, &size, NULL, 0);
if (total)
*total = sum.v_page_count * sum.v_page_size;
return sum.v_free_count * sum.v_page_size;
*total = v_page_count * v_page_size;
return v_free_count * v_page_size;
#elif defined (SOLARIS)
/* Just guess */
if (total)
+18 -18
View File
@@ -640,9 +640,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
break;
case SDL_WINDOWEVENT_MAXIMIZED:
break;
case SDL_WINDOWEVENT_MOVED:
window_x = evt.data1;
window_y = evt.data2;
}
if (mousefocus && kbfocus)
@@ -1451,7 +1448,7 @@ void I_FinishUpdate(void)
if (I_SkipFrame())
return;
if (cv_ticrate.value)
if (cv_ticrate.value && st_overlay)
SCR_DisplayTicRate();
if (cv_showping.value && netgame && consoleplayer != serverplayer)
@@ -1981,7 +1978,6 @@ void I_StartupGraphics(void)
#ifdef HWRENDER
else if (M_CheckParm("-opengl"))
rendermode = render_opengl;
#endif
msaa = 0; boolean msaa_set = false;
a2c = false; boolean a2c_set = false;
@@ -2011,7 +2007,6 @@ void I_StartupGraphics(void)
FILE * file = OpenRendererFile("r");
if (file != NULL)
{
#ifdef HWRENDER
while (fgets(line, sizeof line, file) != NULL)
{
word = strtok(line, " \n");
@@ -2063,18 +2058,19 @@ void I_StartupGraphics(void)
fclose(file);
}
#endif
if (rendermode == render_none)
{
#ifdef HWRENDER
rendermode = render_opengl;
CONS_Printf("Defaulting to OpenGL renderer.\n");
#else
rendermode = render_soft;
CONS_Printf("Using default software renderer.\n");
#endif
}
}
#endif
if (rendermode == render_none)
{
#ifdef HWRENDER
rendermode = render_opengl;
CONS_Printf("Defaulting to OpenGL renderer.\n");
#else
rendermode = render_soft;
CONS_Printf("Using default software renderer.\n");
#endif
}
{
FILE * file = OpenRendererFile("w");
@@ -2089,10 +2085,12 @@ void I_StartupGraphics(void)
fputs("opengl\n", file);
}
#ifdef HWRENDER
fprintf(file, "msaa %u\n", msaa);
if (a2c)
fputs("a2c\n", file);
#endif
fclose(file);
}
@@ -2111,6 +2109,7 @@ void I_StartupGraphics(void)
if (rendermode == render_opengl)
{
HWD.pfnInit = hwSym("Init",NULL);
HWD.pfnSetupGLInfo = hwSym("SetupGLInfo",NULL);
HWD.pfnFinishUpdate = NULL;
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
@@ -2134,6 +2133,7 @@ void I_StartupGraphics(void)
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
HWD.pfnRenderVhsEffect = hwSym("RenderVhsEffect",NULL);
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
@@ -2150,7 +2150,7 @@ void I_StartupGraphics(void)
HWD.pfnStartBatching = hwSym("StartBatching",NULL);
HWD.pfnRenderBatches = hwSym("RenderBatches",NULL);
HWD.pfnAddLightTable = hwSym("AddLightTable",NULL);
HWD.pfnClearLightTableCache = hwSym("ClearLightTableCache",NULL);
+6 -6
View File
@@ -624,7 +624,7 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata)
return;
music_bytes += len;
if (gamestate == GS_LEVEL)
if ((gamestate == GS_LEVEL) && (cv_birdmusic.value))
Countstutter(len);
}
@@ -696,8 +696,8 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
music_volume = 18;
// apply volume to stream
for (i = 0, p = (short *)stream; i < len/2; i++, p++)
*p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40;
for (i = 0, p = (short *)stream; i < len / 2; i++, p++)
*p = ((INT32)*p) * music_volume * internal_volume / 100 / 20;
}
#endif
@@ -721,8 +721,8 @@ static void mix_openmpt(void *udata, Uint8 *stream, int len)
music_volume = 18;
// apply volume to stream
for (i = 0, p = (short *)stream; i < len/2; i++, p++)
*p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40;
for (i = 0, p = (short *)stream; i < len / 2; i++, p++)
*p = ((INT32)*p) * music_volume * internal_volume / 100 / 20;
}
#endif
@@ -1375,7 +1375,7 @@ void I_SetMusicVolume(UINT8 volume)
Mix_VolumeMusic(get_real_volume(music_volume));
}
boolean I_SetSongTrack(int track)
boolean I_SetSongTrack(INT32 track)
{
#ifdef HAVE_LIBGME
+1 -1
View File
@@ -1476,7 +1476,7 @@ void I_SetMusicVolume(UINT8 volume)
(void)volume;
}
boolean I_SetSongTrack(int track)
boolean I_SetSongTrack(INT32 track)
{
(void)track;
return false;
+5 -5
View File
@@ -245,7 +245,7 @@ void ST_doPaletteStuff(void)
palette = 0;
#ifdef HWRENDER
if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && cv_grpaletteshader.value && !cv_grflashpal.value))
if ((rendermode == render_opengl) && (!HWR_PalRenderFlashpal()))
palette = 0; // No flashpals here in OpenGL
#endif
@@ -254,7 +254,7 @@ void ST_doPaletteStuff(void)
st_palette = palette;
#ifdef HWRENDER
if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value))
if (rendermode == render_soft || (rendermode == render_opengl && HWR_PalRenderFlashpal()))
#else
if (rendermode != render_none)
#endif
@@ -1971,8 +1971,8 @@ static void ST_overlayDrawer(void)
strlcpy(name, player_names[stplyr-players], 13);*/
// Show name of player being displayed
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("VIEWPOINT:"));
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[stplyr-players]);
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANS, M_GetText("VIEWPOINT:"));
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANS|V_ALLOWLOWERCASE, player_names[stplyr-players]);
}
}
else if (!demo.title)
@@ -2207,7 +2207,7 @@ void ST_Drawer(void)
//25/08/99: Hurdler: palette changes is done for all players,
// not only player1! That's why this part
// of code is moved somewhere else.
if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value))
if (rendermode == render_soft || (rendermode == render_opengl && HWR_PalRenderFlashpal()))
#endif
if (rendermode != render_none) ST_doPaletteStuff();
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff. Show more