Compare commits

...
Author SHA1 Message Date
indev 41ee6de784 Make non-important files still load textures and animdefs 2024-01-12 15:35:24 +03:00
indev 0a6a40741b Don't reload addfilelocal'd files if md5 matches 2024-01-12 14:55:40 +03:00
indev b7ffaf4243 Warn about possible crash for vanilla when failing to spawn mapthing 2024-01-11 20:13:13 +03:00
Alug 2321e4aa7f use og values for pal 2024-01-09 13:38:35 +01:00
indev 6304a46c84 Allow setting 'none' or nil to mo.localskin and player.localskin 2024-01-08 19:06:31 +03:00
Alug 32cc37a424 update credits 2024-01-08 09:56:14 +01:00
Alug 7242c3c778 fix compiler warning
ugh
2024-01-08 08:58:55 +01:00
Alug 07481fc2aa sleepy moment 2024-01-08 08:52:20 +01:00
Alug 77577530da menu stuff 2024-01-08 08:50:08 +01:00
Alug 213718d1bd add toggle to be able to either rotate just players or everything
you can either just having Players be rotated on slopes, or every mobj

more customizable and also for performance concerns for some
also some stuff i forgor
2024-01-08 08:34:32 +01:00
Alug 9bf10bf35b make new cvar "spriteroll" for sprite rotation disable
so stuff that uses spriterotation can still be used when slope rotation is toggled off
better for some effects
2024-01-08 08:29:58 +01:00
Alug cb0c75e9a8 dont do anything if sloperoll is disabled
well it still precalcs some things, but only on gamestart which is needed since we cant reeinit sprites everytime we change sloperoll
2024-01-08 08:09:43 +01:00
Alug cf78516c77 use fudge defines + remove wall and floor doom_colormap shader
both are now consilidated ( i have no idea how to spell that) into doom_colormap shader
2024-01-06 08:13:24 +01:00
Alug 39489fc6f1 use srb2´s sky shader
also its finally a defined shader now + move default fragment shader to the top
2024-01-06 08:12:20 +01:00
indev 910e20b542 Fix flipped objects having wrong slope roll angle 2024-01-06 03:13:49 +03:00
Alug 7f78873a8a Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2024-01-06 01:07:54 +01:00
Alug 26938c20db fix 3d model offsets when flipped 2024-01-06 01:07:48 +01:00
indev 8562c9ad7d Hide ping when showhud is set to Off 2024-01-06 01:04:46 +03:00
indev d81640c57e Fix hud offsets for position number, also refactor offsets definition a bit 2024-01-05 19:04:13 +03:00
Alug 619fe7bdaf fix menu fade screen background using wrong things in palshader 2024-01-05 01:24:43 +01:00
Alug 05b74102c0 little changes to palshader
use gl_texture 2 in postprocess like srb2s palshader does it
also disable depthtest for screentextures in palshader mode
2024-01-05 01:24:38 +01:00
Alug 5d699d4cf3 revert this 2024-01-05 01:24:31 +01:00
Alug 17c4a35df5 change order of those 2024-01-05 01:24:23 +01:00
Alug a304229511 Merge pull request #84 from Chearii/Saturn-pitch-roll
Pitch and roll, and slope equivalents
2024-01-02 00:08:59 +01:00
Chearii b55fc95ce8 Remove `camera_tilting from K_RollMobjBySlopes`, and make the divisor a static value 2024-01-01 17:11:25 -05:00
Chearii f2faa87e51 Menu changes and additions.
"Player Distortion" is now "Sprite Distortion" to reflect the additions and changes to the slope-rolling system.
All relevant option names have also been changed.
2024-01-01 14:29:32 -05:00
Chearii d79d754b15 Changes to model rendering
Standard slope rotation is now handled through secondary variables, while the primary ones are used for pitch and roll.
2024-01-01 14:28:02 -05:00
Chearii 1babed3d66 Changes to rotation rendering
Handlers for ``pitch``, ``roll``, and slope equivalents have been added.
2024-01-01 14:26:29 -05:00
Chearii 5ec64e50ef Lots of pitch and roll stuff
``pitch``, ``roll``, slope versions, interpolation, and ``P_RollPitchMobj``
2024-01-01 13:26:17 -05:00
Chearii 793e8bfdcb Add `K_RollMobjBySlopes` and spark and trail rolling 2024-01-01 13:22:56 -05:00
Chearii 7a4d5ac1c1 Add `cv_sparkroll` 2024-01-01 13:21:23 -05:00
Alug 728cf1eca9 switches should have default i think ug 2023-12-31 03:46:07 +01:00
Alug 9a1883cd66 duh 2023-12-31 03:01:03 +01:00
indev ea49c2a557 Fix 'Add local skins...' position in pause menu for remote admins 2023-12-29 20:58:39 +03:00
Alug 647641214a try and cleanup sector special comments a little 2023-12-27 13:30:09 +01:00
Alug 8e6023d850 invert encore remap is 12 not 15?
is it?
2023-12-27 13:11:08 +01:00
Alug ca288b89b3 why do that twice? 2023-12-27 13:10:48 +01:00
indev 0e12ad0189 Fix HWR_DrawFill ignoring transparency levels 10-13 2023-12-24 21:40:15 +03:00
Alug c163f25319 Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-12-24 18:54:16 +01:00
Alug a926cdf7c1 add translucency support to V_Drawfill
ayeyeerasyedasaedysase

i really hope the software version doesent break aaaaaaaaa
2023-12-24 18:54:10 +01:00
indev 134364eee3 Always load vanilla musicdefs 2023-12-24 20:51:16 +03:00
Alug 142d678e8c oops 2023-12-23 20:42:11 +01:00
Alug 86394e2c43 Merge branch 'Saturn-Next' of https://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-12-23 20:36:41 +01:00
Alug 405de4e597 remove asm leftovers - profiling stuff 2023-12-23 20:36:35 +01:00
indev 1a6893289c Remove p5prof.h from src/CMakeLists.txt 2023-12-23 22:29:02 +03:00
indev 3297a885eb Remove args.h from src/CMakeLists.txt 2023-12-23 22:24:13 +03:00
Alug 590440ff82 make palshader a little more accurate 2023-12-22 22:54:33 +01:00
Alug 37187c7753 fix pal water shader 2023-12-22 20:20:06 +01:00
indev 1b8b92925a Add files for flatpak package (by riomccloud) 2023-12-22 15:51:05 +03:00
Alug b87b55ec45 fix compiler warning 2023-12-21 13:42:05 +01:00
Alug 0a38a2fd89 forgor to add ping display stuff to menu
someone pls make a better tooltip i bed ingles
2023-12-21 13:41:52 +01:00
Alug ea3fc8f526 Kart v1.0/srb2 styled fps counter option
this was so much pain for whatever reason lmao
2023-12-21 13:41:13 +01:00
Alug bccc79fe4b Kart v1.0/srb2 ping display option
well i adjusted it a little and made it compatible with the frame ping stuff
just hope the bar stuff is right but seemed so
also changed it so the numbers are right alignent so they dont go out of screen
aaaa
2023-12-21 12:06:31 +01:00
Alug 2a6f551f7a fix compact fps counter screwing up ping counter offsets in tab rankings
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2023-12-21 10:31:45 +01:00
Alug f7f3b6497b fix palshader compiler warning + other stuff
asdfgfagregar
set a gl special state instead of using the boolean in r_opengl
also move hwr_ code out of setshaders
2023-12-21 10:08:57 +01:00
Alug 0dca9f9537 use the bool
brap
2023-12-21 09:22:19 +01:00
Alug d07e7ade4a this does absolutely nothing
leftover from porting musictest
2023-12-21 09:18:20 +01:00
Alug 8dcdbecf0c fix may be unitialized warning 2023-12-21 09:01:27 +01:00
hayaunderscore c7c645de00 Portal code cleanup 2023-12-21 08:27:38 +01:00
hayaunderscore 23c7aaeff2 Some hardware renderer cleanup
GRAH WARNINGS
2023-12-21 08:27:34 +01:00
indev cdde33843e Refactor localskin command a bit, get rid of args.c since it is unused 2023-12-20 22:34:47 +03:00
Alug ca47e2edb7 Merge branch 'Saturn-Next' into Saturn 2023-12-20 18:21:57 +01:00
Alug 54ed45f531 remove pal postprocess shader
it never worked, and isnt the right one to do things anyways
the normal GLSL_PALETTE_FRAGMENT_SHADER already does a good job as a postprocess shader, and works similar to srb2´s newer paletterenderer branch
2023-12-20 17:38:20 +01:00
Alug 6ca2087dbc better wall and floor colormap calc
values taken from based on https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1516
2023-12-20 05:53:36 +01:00
Alug 51166640f5 proper water shader for palette renderer
based on https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1516
2023-12-20 05:15:27 +01:00
Alug ed3b1ea353 use floor light for fog shader
how it should be
2023-12-20 04:02:15 +01:00
Alug 8555d38283 v5.1 2023-12-19 20:54:46 +01:00
Alug d66f7fb369 forgor to add those 2023-12-19 20:20:42 +01:00
Alug 7818f17b27 show localskin option menu in options even when youre host
this is not the pause menu one, but the options one
since some may still want to apply a localskin to a player for some reason
2023-12-19 20:09:48 +01:00
Alug dd833097b3 fix some colour hud stuff not being greyed out if its unavailable 2023-12-19 20:08:20 +01:00
Alug dddb88db92 timeout sticker uses wrong patch 2023-12-19 19:04:05 +01:00
Alug 769d93c7da dont prep shaders if theyre uneeded 2023-12-19 17:38:13 +01:00
indev 661dfde6af Don't print discord username in streamer mode at all since discriminators are not a thing anymore 2023-12-18 22:04:41 +03:00
indev 71dea0161d Only warn about custom master server when failed to connect to it 2023-12-18 14:15:01 +03:00
indev 37e9f54af9 Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next 2023-12-18 02:47:56 +03:00
Alug 5651219d2f Merge branch 'Saturn' into Saturn-Next 2023-12-18 00:47:12 +01:00
indev c544cf9a7c Fix static memory being re-tagged as purgable
Fixes crashes caused by lua-cached patches becoming invalid, may fix other crashes related to that
2023-12-18 02:45:40 +03:00
Alug 69c10365e5 menu stuff is the worst 2023-12-17 21:04:54 +01:00
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
122 changed files with 7450 additions and 5612 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.
+20
View File
@@ -0,0 +1,20 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Sonic Robo Blast 2 Kart Saturn
Comment=A kart racing mod based on the 3D Sonic the Hedgehog fangame Sonic Robo Blast 2
TryExec=srb2kart.sh
Exec=srb2kart.sh
Icon=org.srb2.SRB2Kart-Saturn
Terminal=false
Categories=Game;SportsGame;
Keywords=kart;sonic;racer;multiplayer;doom;
Actions=OpenGL;Software;
[Desktop Action OpenGL]
Name=OpenGL renderer
Exec=srb2kart.sh -opengl
[Desktop Action Software]
Name=Software renderer
Exec=srb2kart.sh -software
+80
View File
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2023 Flathub maintainers -->
<component type="desktop-application">
<id>org.srb2.SRB2Kart-Saturn</id>
<metadata_license>FSFAP</metadata_license>
<project_license>GPL-2.0+</project_license>
<name>Sonic Robo Blast 2 Kart Saturn</name>
<summary>Modded SRB2Kart adding many custom features</summary>
<description>
<p>
A modded net-compatible version of SRB2Kart v1.6 that offers multiple code optimizations, palette rendering, player sprite rotation, base Kart HUD customization, and many more.
</p>
</description>
<launchable type="desktop-id">org.srb2.SRB2Kart-Saturn.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://wiki.srb2.org/w/images/a/ac/Srb2kart_title.png</image>
<caption>Title screen</caption>
</screenshot>
<screenshot>
<image>https://user-images.githubusercontent.com/15758649/227740700-26e0962b-5572-486c-b633-7d4990d86f89.png</image>
<caption>Game modes</caption>
</screenshot>
<screenshot>
<image>https://user-images.githubusercontent.com/1964655/82821921-3d180c00-9ea5-11ea-937b-e1f53fe6c686.png</image>
<caption>Game play as Sonic</caption>
</screenshot>
<screenshot>
<image>https://user-images.githubusercontent.com/1964655/82821933-41442980-9ea5-11ea-9146-38998161edae.png</image>
<caption>Game play as Tails</caption>
</screenshot>
<screenshot>
<image>https://user-images.githubusercontent.com/1964655/82821966-502adc00-9ea5-11ea-9cbd-274d7adb479e.png</image>
<caption>Game play as Eggman</caption>
</screenshot>
<screenshot>
<image>https://user-images.githubusercontent.com/1964655/82821980-5620bd00-9ea5-11ea-9eec-2835ebb2a262.png</image>
<caption>Game play as Metal Sonic</caption>
</screenshot>
</screenshots>
<url type="homepage">https://github.com/Indev450/SRB2Kart-Saturn</url>
<url type="bugtracker">https://github.com/Indev450/SRB2Kart-Saturn/issues</url>
<developer_name>Indev450</developer_name>
<provides>
<binary>srb2kart</binary>
</provides>
<releases>
<release version="5.1" date="2023-12-20">
<description>
<p>The complete changelog can be found on the build's GitHub repository.</p>
</description>
<url>https://github.com/Indev450/SRB2Kart-Saturn/releases/tag/v5.1</url>
</release>
<release version="5.0" date="2023-12-17">
<description>
<p>The complete changelog can be found on the build's GitHub repository.</p>
</description>
<url>https://github.com/Indev450/SRB2Kart-Saturn/releases/tag/v5</url>
</release>
</releases>
<categories>
<category>Game</category>
<category>SportsGame</category>
</categories>
<recommends>
<control>keyboard</control>
<control>gamepad</control>
</recommends>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">moderate</content_attribute>
<content_attribute id="language-humor">mild</content_attribute>
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-info">mild</content_attribute>
</content_rating>
<keywords>
<keyword>doom</keyword>
<keyword>multiplayer</keyword>
<keyword>racing</keyword>
</keywords>
</component>
-3
View File
@@ -3,7 +3,6 @@
# Core sources
set(SRB2_CORE_SOURCES
am_map.c
args.c
b_bot.c
command.c
comptime.c
@@ -53,7 +52,6 @@ set(SRB2_CORE_SOURCES
set(SRB2_CORE_HEADERS
am_map.h
args.h
b_bot.h
byteptr.h
command.h
@@ -107,7 +105,6 @@ set(SRB2_CORE_HEADERS
m_swap.h
md5.h
mserv.h
p5prof.h
s_sound.h
screen.h
sounds.h
-1
View File
@@ -538,7 +538,6 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/i_time.o \
$(OBJDIR)/lzf.o \
$(OBJDIR)/b_bot.o \
$(OBJDIR)/args.o \
$(i_net_o) \
$(i_system_o) \
$(i_sound_o) \
-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
-1309
View File
File diff suppressed because it is too large. Load diff
-206
View File
@@ -1,206 +0,0 @@
// -----------------------------------------------------------------------------
// Args: a C99 library for parsing command line arguments.
// Version: 2.8.0
// Notes: This has been edited to work properly within SRB2.
// Licensed under the 0BSD license.
// -----------------------------------------------------------------------------
#ifndef args_h
#define args_h
#include "doomtype.h"
// -----------------------------------------------------------------------------
// Types.
// -----------------------------------------------------------------------------
// An ArgParser instance stores registered flags, options and commands.
typedef struct ArgParser ArgParser;
// A command callback function should accept two arguments: the command's name
// and the command's ArgParser instance.
typedef void (*ap_callback_t)(char* cmd_name, ArgParser* cmd_parser);
// -----------------------------------------------------------------------------
// Initialization, parsing, teardown.
// -----------------------------------------------------------------------------
// Initializes a new ArgParser instance. Returns NULL if sufficient memory
// cannot be allocated for the new parser.
ArgParser* ap_new();
// Specifies a helptext string for the parser. If [helptext] is not NULL, this
// activates an automatic --help/-h flag. (Either --help or -h can be overridden
// by explicitly registered flags.) The parser stores and manages its own copy
// of the [helptext] string so [helptext] can be freed immediately after this
// call if it was dynamically constructed.
void ap_set_helptext(ArgParser* parser, const char* helptext);
// Returns a pointer to the parser's helptext string.
char* ap_get_helptext(ArgParser* parser);
// Specifies a version string for the parser. If [version] is not NULL, this
// activates an automatic --version/-v flag. (Either --version or -v can be
// overridden by explicitly registered flags.) The parser stores and manages its
// own copy of the [version] string so [version] can be freed immediately after
// this call if it was dynamically constructed.
void ap_set_version(ArgParser* parser, const char* version);
// Returns a pointer to the parser's version string.
char* ap_get_version(ArgParser* parser);
// If toggled to true, the first positional argument ends option parsing; all
// subsequent arguments will be treated as positionals. Defaults to false.
void ap_first_pos_arg_ends_options(ArgParser* parser, boolean enable);
// Parses the application's command line arguments. The parameters are assumed
// to be [argc] and [argv] as supplied to main(), i.e. the first element of the
// array is assumed to be the binary name and is therefore ignored. Returns true
// if the arguments were successfully parsed. Returns false if parsing failed
// due to a memory allocation error. (This memory allocation error may have
// occured during set-up rather than during parsing.)
boolean ap_parse(ArgParser* parser, int argc, char** argv);
// Frees the memory associated with the parser and any subparsers.
void ap_free(ArgParser* parser);
// -----------------------------------------------------------------------------
// Register flags and options.
// -----------------------------------------------------------------------------
// Registers a new flag.
void ap_flag(ArgParser* parser, const char* name);
// Registers a new string-valued option.
void ap_str_opt(ArgParser* parser, const char* name, const char* fallback);
// Registers a new integer-valued option.
void ap_int_opt(ArgParser* parser, const char* name, int fallback);
// Registers a new double-valued option.
void ap_dbl_opt(ArgParser* parser, const char* name, double fallback);
// -----------------------------------------------------------------------------
// Inspect flags and options.
// -----------------------------------------------------------------------------
// Returns the number of times the specified flag or option was found.
int ap_count(ArgParser* parser, const char* name);
// Returns true if the specified flag or option was found.
boolean ap_found(ArgParser* parser, const char* name);
// Returns the value of a string option.
char* ap_str_value(ArgParser* parser, const char* name);
// Returns the string value at the specified index.
char* ap_str_value_at_index(ArgParser* parser, const char* name, int index);
// Returns the value of an integer option.
int ap_int_value(ArgParser* parser, const char* name);
// Returns the integer value at the specified index.
int ap_int_value_at_index(ArgParser* parser, const char* name, int index);
// Returns the value of a floating-point option.
double ap_dbl_value(ArgParser* parser, const char* name);
// Returns the floating-point value at the specified index.
double ap_dbl_value_at_index(ArgParser* parser, const char* name, int index);
// Returns an option's values as a freshly-allocated array of string
// pointers. The array's memory is not affected by calls to ap_free().
// Returns NULL if memory allocation fails.
char** ap_str_values(ArgParser* parser, const char* name);
// Returns an option's values as a freshly-allocated array of integers.
// The array's memory is not affected by calls to ap_free().
// Returns NULL if memory allocation fails.
int* ap_int_values(ArgParser* parser, const char* name);
// Returns an option's values as a freshly-allocated array of doubles.
// The array's memory is not affected by calls to ap_free().
// Returns NULL if memory allocation fails.
double* ap_dbl_values(ArgParser* parser, const char* name);
// -----------------------------------------------------------------------------
// Positional arguments.
// -----------------------------------------------------------------------------
// Returns true if the parser has found one or more positional arguments.
boolean ap_has_args(ArgParser* parser);
// Returns the number of positional arguments.
int ap_count_args(ArgParser* parser);
// Returns the positional argument at the specified index.
char* ap_arg(ArgParser* parser, int index);
// Returns the positional arguments as a freshly-allocated array of string
// pointers. The memory occupied by the returned array is not affected by
// calls to ap_free(). Returns NULL if memory allocation fails.
char** ap_args(ArgParser* parser);
// Attempts to parse and return the positional arguments as a freshly allocated
// array of integers. Exits with an error message on failure. The memory
// occupied by the returned array is not affected by calls to ap_free().
// Returns NULL if memory allocation fails.
int* ap_args_as_ints(ArgParser* parser);
// Attempts to parse and return the positional arguments as a freshly allocated
// array of doubles. Exits with an error message on failure. The memory
// occupied by the returned array is not affected by calls to ap_free().
// Returns NULL if memory allocation fails.
double* ap_args_as_doubles(ArgParser* parser);
// -----------------------------------------------------------------------------
// Commands.
// -----------------------------------------------------------------------------
// Registers a new command. Returns the ArgParser instance for the command.
// Returns NULL if sufficient memory cannot be allocated for the new parser.
ArgParser* ap_cmd(ArgParser* parser, const char* name);
// Registers a callback function on a command parser. The function will be
// called if the command is found.
void ap_callback(ArgParser* parser, ap_callback_t function);
// Returns true if the parser has found a command.
boolean ap_has_cmd(ArgParser* parser);
// Returns the command name, if the parser has found a command.
char* ap_cmd_name(ArgParser* parser);
// Returns the command's parser instance, if the parser has found a command.
ArgParser* ap_cmd_parser(ArgParser* parser);
// This booleanean switch toggles support for an automatic 'help' command that
// prints subcommand helptext. The value defaults to false but gets toggled
// automatically to true whenever a command is registered. You can use this
// function to disable the feature if required.
void ap_enable_help_command(ArgParser* parser, boolean enable);
// -----------------------------------------------------------------------------
// Debugging utilities.
// -----------------------------------------------------------------------------
// Dump a parser instance for debugging.
void ap_print(ArgParser* parser);
// True if an attempt to allocate memory failed.
boolean ap_had_memory_error(ArgParser* parser);
// -----------------------------------------------------------------------------
// Deprecated.
// -----------------------------------------------------------------------------
// Replaced by ap_enable_help_command().
void ap_cmd_help(ArgParser* parser, boolean enable);
// Replaced by ap_set_helptext().
void ap_helptext(ArgParser* parser, const char* helptext);
// Replaced by ap_set_version().
void ap_version(ArgParser* parser, const char* version);
#endif
+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])
+162 -9
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
//
@@ -1490,9 +1641,11 @@ void D_SRB2Main(void)
I_StartupSound();
I_InitMusic();
S_InitSfxChannels(cv_soundvolume.value);
S_InitMusicDefs();
}
S_InitMusicDefs();
S_InitMTDefs();
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();
+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)));
}
}
+66 -50
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,11 @@ 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};
static CV_PossibleValue_t cv_pingstyle_cons_t[] = {{0, "New"}, {1, "Old"}, {0, NULL}};
consvar_t cv_pingstyle = {"pingstyle", "New", CV_SAVE, cv_pingstyle_cons_t, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_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 +519,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 +533,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 +784,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 +798,8 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_pingtimeout);
CV_RegisterVar(&cv_showping);
CV_RegisterVar(&cv_pingmeasurement);
CV_RegisterVar(&cv_pingicon);
CV_RegisterVar(&cv_pingstyle);
#ifdef SEENAMES
CV_RegisterVar(&cv_allowseenames);
@@ -965,6 +979,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 +1111,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 +1162,7 @@ void D_RegisterClientCommands(void)
#endif
COM_AddCommand("listskins", Command_ListSkins);
COM_AddCommand("skinsearch", Command_SkinSearch);
}
/**
@@ -3080,7 +3087,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
if (paused)
{
if (!menuactive || netgame)
if ((!menuactive || netgame) && (!cv_pausemusic.value))
S_PauseAudio();
}
else
@@ -4603,14 +4610,6 @@ static void Command_Addfile(void)
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
}
// i hate myself
static boolean DumbStartsWith(const char *pre, const char *str)
{
size_t lenpre = strlen(pre),
lenstr = strlen(str);
return lenstr < lenpre ? false : memcmp(pre, str, lenpre) == 0;
}
/** Adds something at runtime.
*/
static void
@@ -4647,16 +4646,13 @@ Command_Addskins (void)
*/
}
// args n stuff
#include "args.h"
static void Command_GLocalSkin (void)
static void Command_GLocalSkin (void)
{
size_t first_option;
size_t option_display;
size_t option_all;
size_t option_player;
option_player = COM_CheckPartialParm("-p");
option_display = COM_CheckPartialParm("-d");
option_all = COM_CheckPartialParm("-a");
@@ -4684,31 +4680,27 @@ static void Command_GLocalSkin (void)
fuck = ConcatCommandArgv(1, first_option);
char* player_name = player_names[consoleplayer];
char* display_num = "0";
const char* player_name = player_names[consoleplayer];
const char* display_num = "0";
size_t dnum = 0;
if (option_display) // -display
{
// handle default: 0
if (COM_Argv(option_display + 1)[0] == "" || COM_Argv(option_display + 1)[0] != "-")
if (COM_Argc() >= option_display)
display_num = COM_Argv(option_display + 1);
if (isdigit(display_num[0]) || display_num == "0")
{
dnum = atoi(display_num);
if (dnum > 3 || dnum < 0) // nuh uh
dnum = 0;
SetLocalPlayerSkin(displayplayers[dnum], fuck, NULL);
dnum = atoi(display_num);
if (dnum > 3) // nuh uh
dnum = 0;
CONS_Printf("Successfully applied localskin to displayed player.\n");
return;
}
CONS_Printf("Could not apply localskin.\n");
SetLocalPlayerSkin(displayplayers[dnum], fuck, NULL);
CONS_Printf("Successfully applied localskin to displayed player.\n");
Z_Free(fuck);
return;
}
}
else if (option_all) // -all
{
int i;
@@ -4721,34 +4713,38 @@ static void Command_GLocalSkin (void)
}
CONS_Printf("Successfully applied localskin to all players.\n");
Z_Free(fuck);
return;
}
}
else // -player or no other arguments
{
if (option_player)
if (option_player)
{
int i;
player_name = COM_Argv(option_player + 1);
for (i = 0; i < MAXPLAYERS; ++i)
for (i = 0; i < MAXPLAYERS; ++i)
{
if (fasticmp(player_names[i], player_name))
SetLocalPlayerSkin(i, fuck, NULL);
}
CONS_Printf("Successfully applied localskin to specified player.\n");
Z_Free(fuck);
return;
}
else
}
else
{
SetLocalPlayerSkin(consoleplayer, fuck, &cv_localskin);
CONS_Printf("Successfully applied localskin.\n");
Z_Free(fuck);
return;
}
CONS_Printf("Could not apply localskin.\n");
Z_Free(fuck);
return;
}
}
@@ -6058,6 +6054,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>
+7 -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,8 @@ 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_pingstyle;
//extern consvar_t cv_smallpos;
extern consvar_t cv_showminimapnames;
@@ -163,6 +167,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 +187,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},
+5 -1
View File
@@ -101,7 +101,7 @@ static void DRPC_HandleReady(const DiscordUser *user)
{
if (cv_discordstreamer.value)
{
CONS_Printf("Discord: connected to %s\n", user->username);
CONS_Printf("Discord: connection successful\n");
}
else
{
@@ -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.1 "
#define VERSIONSTRINGW L"Saturn v5.1"
// 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);
+34 -25
View File
@@ -496,12 +496,11 @@ 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};
consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, 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};
static CV_PossibleValue_t slamsound_t[] = {{0, "Off"}, {1, "On"}, {0, NULL}};
consvar_t cv_slamsound = {"slamsound", "1", CV_SAVE, slamsound_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -512,17 +511,14 @@ static CV_PossibleValue_t sloperolldist_cons_t[] = {
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, "Everything"}, {0, NULL}};
consvar_t cv_spriteroll = {"spriteroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sparkroll = {"sparkroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
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++;
}
+29 -30
View File
@@ -127,25 +127,33 @@ extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
// Hud offsets
extern consvar_t cv_item_xoffset;
extern consvar_t cv_item_yoffset;
extern consvar_t cv_time_xoffset;
extern consvar_t cv_time_yoffset;
extern consvar_t cv_laps_xoffset;
extern consvar_t cv_laps_yoffset;
extern consvar_t cv_spdm_xoffset;
extern consvar_t cv_spdm_yoffset;
extern consvar_t cv_posi_xoffset;
extern consvar_t cv_posi_yoffset;
extern consvar_t cv_face_xoffset;
extern consvar_t cv_face_yoffset;
extern consvar_t cv_stcd_xoffset;
extern consvar_t cv_stcd_yoffset;
extern consvar_t cv_chek_yoffset;
extern consvar_t cv_mini_xoffset;
extern consvar_t cv_mini_yoffset;
extern consvar_t cv_want_xoffset;
extern consvar_t cv_want_yoffset;
#define DECL_HUD_OFFSET_X(name)\
extern consvar_t cv_##name##_xoffset;
#define DECL_HUD_OFFSET_Y(name)\
extern consvar_t cv_##name##_yoffset;
#define DECL_HUD_OFFSET(name)\
DECL_HUD_OFFSET_X(name)\
DECL_HUD_OFFSET_Y(name)
DECL_HUD_OFFSET(item); // Item box
DECL_HUD_OFFSET(time); // Time
DECL_HUD_OFFSET(laps); // Number of laps
DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
DECL_HUD_OFFSET(spdm); // Speedometer
DECL_HUD_OFFSET(posi); // Position in race
DECL_HUD_OFFSET(face); // Mini rankings
DECL_HUD_OFFSET(stcd); // Starting countdown
DECL_HUD_OFFSET_Y(chek); // Check gfx
DECL_HUD_OFFSET(mini); // Minimap
DECL_HUD_OFFSET(want); // Wanted
DECL_HUD_OFFSET(stat); // Stats
#undef DECL_HUD_OFFSET
#undef DECL_HUD_OFFSET_X
#undef DECL_HUD_OFFSET_Y
extern consvar_t cv_showinput;
extern consvar_t cv_newspeedometer;
@@ -156,23 +164,14 @@ extern consvar_t cv_saltysquish;
extern consvar_t cv_driftsparkpulse;
extern consvar_t cv_gravstretch;
extern consvar_t cv_sloperoll;
extern consvar_t cv_spriteroll;
extern consvar_t cv_sliptideroll;
extern consvar_t cv_slamsound;
extern consvar_t cv_sloperolldist;
extern consvar_t cv_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_sparkroll;
extern consvar_t cv_cechotoggle;
extern consvar_t cv_resume;
extern consvar_t cv_fading;
#ifndef NONET
extern consvar_t cv_chatlogsize;
#endif
-8
View File
@@ -672,14 +672,6 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
grmip->colormap += (256*32);
#endif
grmip->colormap = colormaps;
#ifdef GLENCORE
if (!noencoremap && encoremap)
grmip->colormap += (256*32);
#endif
if (!grmip->downloaded && !grmip->grInfo.data)
HWR_CacheFlat(grmip, flatlumpnum);
+8 -6
View File
@@ -129,8 +129,10 @@ typedef struct
FLOAT x,y,z; // position
#ifdef USE_FTRANSFORM_ANGLEZ
FLOAT anglex,angley,anglez; // aimingangle / viewangle
FLOAT anglex2,anglez2; // secondaries
#else
FLOAT anglex,angley; // aimingangle / viewangle
FLOAT anglex2; // secondaries
#endif
FLOAT scalex,scaley,scalez;
FLOAT spritexscale,spriteyscale;
@@ -183,14 +185,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 +211,6 @@ enum ETextureFlags
typedef struct GLMipmap_s FTextureInfo;
// jimita 14032019
struct FLightInfo
{
FUINT light_level;
@@ -225,14 +227,14 @@ struct FSurfaceInfo
RGBA_t TintColor;
RGBA_t FadeColor;
UINT32 LightTableId;
FLightInfo LightInfo; // jimita 14032019
FLightInfo LightInfo;
};
typedef struct FSurfaceInfo FSurfaceInfo;
enum hwdsetspecialstate
{
HWD_SET_SHADERS,
HWD_SET_PALETTE_SHADER_ENABLED,
HWD_PAL_SHADER,
HWD_SET_TEXTUREFILTERMODE,
HWD_SET_TEXTUREANISOTROPICMODE,
+22 -4
View File
@@ -567,9 +567,14 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
}
else // Do TRANSMAP** fade.
{
Surf.PolyColor.rgba = pLocalPalette[color].rgba;
if (HWR_ShouldUsePaletteRendering())
Surf.PolyColor.rgba = pLocalPalette[color&0xFF].rgba;
else
Surf.PolyColor.rgba = pLocalPalette[color].rgba;
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
}
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
}
@@ -960,11 +965,13 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
// -----------------+
// HWR_DrawFill : draw flat coloured rectangle, with no texture
// -----------------+
// alug: now with translucency support X)
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
{
FOutVector v[4];
FSurfaceInfo Surf;
float fx, fy, fw, fh;
UINT8 alphalevel = ((color & V_ALPHAMASK) >> V_ALPHASHIFT);
if (w < 0 || h < 0)
return; // consistency w/ software
@@ -1061,8 +1068,16 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
Surf.PolyColor = V_GetColor(color);
HWD.pfnDrawPolygon(&Surf, v, 4,
PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
if (alphalevel)
{
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
}
else
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
}
#ifdef HAVE_PNG
@@ -1138,10 +1153,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;
+8 -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);
@@ -82,6 +84,7 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void);
EXPORT void HWRAPI(StartBatching) (void);
EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, int *sNumPolys, int *sNumVerts, int *sNumCalls, int *sNumShaders, int *sNumTextures, int *sNumPolyFlags, int *sNumColors);
EXPORT void HWRAPI(InitPalette) (int flashnum, boolean skiplut);
EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable);
EXPORT void HWRAPI(ClearLightTableCache) (void);
@@ -94,6 +97,7 @@ EXPORT void HWRAPI(ClearLightTableCache) (void);
struct hwdriver_s
{
Init pfnInit;
SetupGLInfo pfnSetupGLInfo;
SetPalette pfnSetPalette;
FinishUpdate pfnFinishUpdate;
Draw2DLine pfnDraw2DLine;
@@ -117,6 +121,7 @@ struct hwdriver_s
DoScreenWipe pfnDoScreenWipe;
DrawIntermissionBG pfnDrawIntermissionBG;
MakeScreenTexture pfnMakeScreenTexture;
RenderVhsEffect pfnRenderVhsEffect;
MakeScreenFinalTexture pfnMakeScreenFinalTexture;
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
@@ -134,6 +139,7 @@ struct hwdriver_s
StartBatching pfnStartBatching;
RenderBatches pfnRenderBatches;
InitPalette pfnInitPalette;
AddLightTable pfnAddLightTable;
ClearLightTableCache pfnClearLightTableCache;
};
@@ -144,4 +150,4 @@ extern struct hwdriver_s hwdriver;
#endif //not defined _CREATE_DLL_
#endif //__HWR_DRV_H__
#endif //__HWR_DRV_H__
+749 -596
View File
File diff suppressed because it is too large. Load diff
+15 -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,13 @@ 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);
void HWR_InitPalette(int flashnum, boolean skiplut);
// 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 +133,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 +168,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 +187,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[];
+51 -12
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);
@@ -1401,18 +1401,55 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.anglex = 0.0f;
p.anglex2 = 0.0f;
#ifdef USE_FTRANSFORM_ANGLEZ
// Slope rotation from Kart
p.anglez = 0.0f;
p.anglez2 = 0.0f;
// use secondary angles for the slope rotation
if (spr->mobj->standingslope)
{
fixed_t tempz = spr->mobj->standingslope->normal.z;
fixed_t tempy = spr->mobj->standingslope->normal.y;
fixed_t tempx = spr->mobj->standingslope->normal.x;
fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
p.anglez = FIXED_TO_FLOAT(tempangle);
p.anglez2 = FIXED_TO_FLOAT(tempangle);
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
p.anglex = FIXED_TO_FLOAT(tempangle);
p.anglex2 = FIXED_TO_FLOAT(tempangle);
}
else if ((spr->mobj->sloperoll || spr->mobj->slopepitch) && (!P_IsObjectOnGround(spr->mobj)) && (!paused))
{
SINT8 flipfactor = flip ? -1 : 1;
angle_t camang = R_PointToAngle(interp.x, interp.y);
angle_t mobjang;
if (spr->mobj->flags & (MF_NOTHINK|MF_SCENERY))
mobjang = spr->mobj->angle;
else
mobjang = interp.angle;
angle_t fmoang;
fmoang = camang - mobjang;
// slopepitch
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
p.anglez -= flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
// sloperoll
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
p.anglez += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
p.roll = true;
}
// pitch and roll
if (interp.roll || interp.pitch)
{
SINT8 flipfactor = flip ? -1 : 1;
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.roll));
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.pitch));
p.roll = true;
}
#endif
@@ -1423,20 +1460,22 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
HWD.pfnSetShader(4); // model shader
{
float this_scale = FIXED_TO_FLOAT(interp.scale);
SINT8 flipfactor = flip ? -1 : 1;
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);
float ox = xs * FIXED_TO_FLOAT(interp.spritexoffset);
float oy = ys * FIXED_TO_FLOAT(interp.spriteyoffset);
float ox = xs * flipfactor*FIXED_TO_FLOAT(interp.spritexoffset);
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
// offset perpendicular to the camera angle
p.x -= ox * gr_viewsin;
p.y += ox * gr_viewcos;
p.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);
}
}
}
+382 -116
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;
@@ -487,6 +495,10 @@ static PFNglColorPointer pglColorPointer;
#define GL_TEXTURE1 0x84C1
#endif
#ifndef GL_TEXTURE2
#define GL_TEXTURE2 0x84C2
#endif
boolean SetupGLfunc(void)
{
#ifndef STATIC_OPENGL
@@ -629,8 +641,8 @@ 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 boolean gl_palshader = false;
static INT32 gl_enable_screen_textures = 1;
@@ -676,20 +688,19 @@ static float shader_leveltime = 0;
// ========================
//
// GLSL Software fragment shader
// GLSL generic fragment shader
//
#define GLSL_DOOM_COLORMAP_floors \
"float R_DoomColormap(float light, float z)\n" \
"{\n" \
"float lightnum = clamp(light / 17.0, 0.0, 15.0);\n" \
"float lightz = clamp(z / 16.0, 0.0, 127.0);\n" \
"float startmap = (15.0 - lightnum) * 4.0;\n" \
"float scale = 160.0 / (lightz + 1.0);\n" \
"return startmap * 1.06 - scale * 0.5 * 1.15;\n" \
"}\n"
#define GLSL_DEFAULT_FRAGMENT_SHADER \
"uniform sampler2D tex;\n" \
"uniform vec4 poly_color;\n" \
"void main(void) {\n" \
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * poly_color;\n" \
"}\0"
// 1.06 and 1.15 were chosen when trying to match software lighting in a test map
//
// GLSL Software fragment shader
//
#define GLSL_DOOM_COLORMAP \
"float R_DoomColormap(float light, float z)\n" \
@@ -698,17 +709,7 @@ static float shader_leveltime = 0;
"float lightz = clamp(z / 16.0, 0.0, 127.0);\n" \
"float startmap = (15.0 - lightnum) * 4.0;\n" \
"float scale = 160.0 / (lightz + 1.0);\n" \
"return startmap - scale * 0.5;\n" \
"}\n"
#define GLSL_DOOM_COLORMAP_walls \
"float R_DoomColormap(float light, float z)\n" \
"{\n" \
"float lightnum = clamp(light / 17.0, 0.0, 15.0);\n" \
"float lightz = clamp(z / 16.0, 0.0, 127.0);\n" \
"float startmap = (15.0 - lightnum) * 4.0;\n" \
"float scale = 160.0 / (lightz + 1.0);\n" \
"return startmap * 1.05 - scale * 1.0 * 1.1;\n" \
"return (startmap * STARTMAP_FUDGE - scale * MULT_FUDGE * SCALE_FUDGE);\n" \
"}\n"
#define GLSL_DOOM_LIGHT_EQUATION \
@@ -758,16 +759,28 @@ static float shader_leveltime = 0;
"gl_FragColor = final_color;\n" \
"}\n"
#define GLSL_FLOOR_FUDGES \
"#define STARTMAP_FUDGE 1.06\n" \
"#define MULT_FUDGE 0.5\n" \
"#define SCALE_FUDGE 1.15\n"
#define GLSL_WALL_FUDGES \
"#define STARTMAP_FUDGE 1.05\n" \
"#define MULT_FUDGE 1.0\n" \
"#define SCALE_FUDGE 1.1\n"
#define GLSL_SOFTWARE_FRAGMENT_SHADER_FLOORS \
GLSL_SOFTWARE_UNIFORMS \
GLSL_DOOM_COLORMAP_floors \
GLSL_FLOOR_FUDGES \
GLSL_DOOM_COLORMAP \
GLSL_DOOM_LIGHT_EQUATION \
GLSL_SOFTWARE_MAIN \
"\0"
#define GLSL_SOFTWARE_FRAGMENT_SHADER_WALLS \
GLSL_SOFTWARE_UNIFORMS \
GLSL_DOOM_COLORMAP_walls \
GLSL_WALL_FUDGES \
GLSL_DOOM_COLORMAP \
GLSL_DOOM_LIGHT_EQUATION \
GLSL_SOFTWARE_MAIN \
"\0"
@@ -795,18 +808,15 @@ static float shader_leveltime = 0;
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_FLOORS \
GLSL_SOFTWARE_PAL_UNIFORMS \
GLSL_DOOM_COLORMAP_floors \
GLSL_FLOOR_FUDGES \
GLSL_DOOM_COLORMAP \
GLSL_SOFTWARE_PAL_MAIN \
"\0"
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_WALLS \
GLSL_SOFTWARE_PAL_UNIFORMS \
GLSL_DOOM_COLORMAP_walls \
GLSL_SOFTWARE_PAL_MAIN \
"\0"
#define GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_POSTPROCESS \
GLSL_SOFTWARE_PAL_UNIFORMS \
GLSL_WALL_FUDGES \
GLSL_DOOM_COLORMAP \
GLSL_SOFTWARE_PAL_MAIN \
"\0"
@@ -818,6 +828,7 @@ static float shader_leveltime = 0;
//
#define GLSL_WATER_FRAGMENT_SHADER \
GLSL_FLOOR_FUDGES \
"uniform sampler2D tex;\n" \
"uniform vec4 poly_color;\n" \
"uniform vec4 tint_color;\n" \
@@ -845,7 +856,37 @@ static float shader_leveltime = 0;
"final_color.a = texel.a * poly_color.a;\n" \
"gl_FragColor = final_color;\n" \
"}\0"
#define GLSL_PALETTE_WATER_FRAGMENT_SHADER \
GLSL_FLOOR_FUDGES \
"const float freq = 0.025;\n" \
"const float amp = 0.025;\n" \
"const float speed = 2.0;\n" \
"const float pi = 3.14159;\n" \
"uniform sampler2D tex;\n" \
"uniform sampler2D lighttable_tex;\n" \
"uniform sampler3D lookup_tex;\n" \
"uniform int palette[768];\n" \
"uniform vec4 poly_color;\n" \
"uniform float lighting;\n" \
"uniform float leveltime;\n" \
GLSL_DOOM_COLORMAP \
"void main(void) {\n" \
"float water_z = (gl_FragCoord.z / gl_FragCoord.w) / 2.0;\n" \
"float a = -pi * (water_z * freq) + (leveltime * speed);\n" \
"float sdistort = sin(a) * amp;\n" \
"float cdistort = cos(a) * amp;\n" \
"vec4 texel = texture2D(tex, vec2(gl_TexCoord[0].s - sdistort, gl_TexCoord[0].t - cdistort));\n" \
"int tex_pal_idx = int(texture3D(lookup_tex, vec3((texel * 63.0 + 0.5) / 64.0))[0] * 255.0);\n" \
"float z = gl_FragCoord.z / gl_FragCoord.w;\n" \
"int light_y = int(clamp(floor(R_DoomColormap(lighting, z)), 0.0, 31.0));\n" \
"vec2 lighttable_coord = vec2((float(tex_pal_idx) + 0.5) / 256.0, (float(light_y) + 0.5) / 32.0);\n" \
"int final_idx = int(texture2D(lighttable_tex, lighttable_coord)[0] * 255.0);\n" \
"vec4 final_color = vec4(float(palette[final_idx*3])/255.0, float(palette[final_idx*3+1])/255.0, float(palette[final_idx*3+2])/255.0, 1.0);\n" \
"final_color.a = texel.a * poly_color.a;\n" \
"gl_FragColor = final_color;\n" \
"}\0"
//
// Fog block shader
//
@@ -853,6 +894,7 @@ static float shader_leveltime = 0;
//
#define GLSL_FOG_FRAGMENT_SHADER \
GLSL_FLOOR_FUDGES \
"uniform vec4 tint_color;\n" \
"uniform vec4 fade_color;\n" \
"uniform float lighting;\n" \
@@ -883,14 +925,14 @@ static float shader_leveltime = 0;
"}\0"
//
// GLSL generic fragment shader
//
#define GLSL_DEFAULT_FRAGMENT_SHADER \
// Sky fragment shader
// Modulates poly_color with gl_Color
//
#define GLSL_SKY_FRAGMENT_SHADER \
"uniform sampler2D tex;\n" \
"uniform vec4 poly_color;\n" \
"void main(void) {\n" \
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * poly_color;\n" \
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * gl_Color * poly_color;\n" \
"}\0"
static const char *fragment_shaders[] = {
@@ -916,19 +958,19 @@ static const char *fragment_shaders[] = {
GLSL_FOG_FRAGMENT_SHADER,
// Sky fragment shader
"uniform sampler2D tex;\n"
"void main(void) {\n"
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st);\n"
"}\0",
GLSL_SKY_FRAGMENT_SHADER,
// Palette fragment shader
GLSL_PALETTE_FRAGMENT_SHADER,
// Palette floor fudge shader
GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_FLOORS,
// Palette wall fudge shader
GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_WALLS,
GLSL_SOFTWARE_PAL_FRAGMENT_SHADER_POSTPROCESS,
// Palette water shader
GLSL_PALETTE_WATER_FRAGMENT_SHADER,
NULL,
};
@@ -977,9 +1019,8 @@ static const char *vertex_shaders[] = {
// Palette vertex shader
GLSL_DEFAULT_VERTEX_SHADER,
GLSL_DEFAULT_VERTEX_SHADER,
GLSL_DEFAULT_VERTEX_SHADER,
GLSL_DEFAULT_VERTEX_SHADER,
NULL,
@@ -1029,6 +1070,10 @@ void SetupGLFunc4(void)
// GLU
pgluBuild2DMipmaps = GetGLFunc("gluBuild2DMipmaps");
#ifdef GL_VERSION_3_0
pglGenerateMipmap = GetGLFunc("glGenerateMipmap");
#endif
}
// jimita
@@ -1250,11 +1295,6 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void)
#ifdef GL_SHADERS
KillShaders();
return LoadShaders();
if (gl_use_palette_shader)
{
InitPalette(0, false);
}
#endif
}
@@ -1304,7 +1344,7 @@ GLuint palette_tex_num;
// the +2 in the NearestColor call also needs to be adjusted if LUT_SIZE is changed!
// the hardcoded values in the shader also need to be adjusted if LUT_SIZE is changed!
void InitPalette(int flashnum, boolean skiplut)
EXPORT void HWRAPI(InitPalette) (int flashnum, boolean skiplut)
{
int i, r, g, b;
@@ -1340,6 +1380,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 +1415,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
@@ -1383,6 +1442,12 @@ void InitPalette(int flashnum, boolean skiplut)
// bind tex unit 2 to lighttable tex
pglUniform1i(gl_shaderprograms[10].uniforms[gluniform_lighttable_tex], 2);
pglUniform1i(gl_shaderprograms[10].uniforms[gluniform_color_lookup], 1);
// bind stuff to wöter shader
pglUseProgram(gl_shaderprograms[11].program);
pglUniform1iv(gl_shaderprograms[11].uniforms[gluniform_palette], 768, gl_palette);
pglUniform1i(gl_shaderprograms[11].uniforms[gluniform_lighttable_tex], 2);
pglUniform1i(gl_shaderprograms[11].uniforms[gluniform_color_lookup], 1);
pglUseProgram(0);
pglBindTexture(GL_TEXTURE_3D, 0);
@@ -1561,6 +1626,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 +1658,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 +1815,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) && (gl_palshader))
InitPalette(0, false); // just gonna put this here for now
}
@@ -1923,6 +2017,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
const GLvoid *ptex = tex;
INT32 w, h;
GLuint texnum = 0;
if (!pTexInfo->downloaded)
{
@@ -2044,12 +2139,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 +2173,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 +2206,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 +2438,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 (gl_palshader)
{
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 +2581,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 (gl_palshader)
{
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 +2698,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 && gl_palshader)
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
@@ -2578,7 +2712,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) && (!gl_palshader))
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
@@ -2709,7 +2843,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade);
if (gl_use_palette_shader)
if (gl_palshader)
{
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 +2927,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 (gl_palshader && gl_allowshaders)
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
pglActiveTexture(GL_TEXTURE0);
}
}
}
Shader_Load(pSurf, &poly, &tint, &fade);
}
@@ -3166,8 +3303,8 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
}
break;
case HWD_SET_PALETTE_SHADER_ENABLED:
gl_use_palette_shader = Value;
case HWD_PAL_SHADER:
gl_palshader = Value;
break;
case HWD_SET_TEXTUREFILTERMODE:
@@ -3205,11 +3342,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 +3668,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 +3729,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 +3743,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,22 +3753,32 @@ 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
pglRotatef(pos->anglez2, 0.0f, 0.0f, -1.0f); // rotate by slope from Kart
#endif
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
pglRotatef(pos->anglex2, -1.0f, 0.0f, 0.0f);
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
if (pos->roll)
{
float roll = (1.0f * pos->rollflip);
pglTranslatef(pos->centerx, pos->centery, 0);
// rotate model for pitch and roll
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
#ifdef USE_FTRANSFORM_ANGLEZ
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
#endif
if (pos->rotaxis == 2) // Z
pglRotatef(pos->rollangle, 0.0f, 0.0f, roll);
else if (pos->rotaxis == 1) // Y
pglRotatef(pos->rollangle, 0.0f, roll, 0.0f);
else // X
pglRotatef(pos->rollangle, roll, 0.0f, 0.0f);
pglTranslatef(-pos->centerx, -pos->centery, 0);
}
@@ -3729,9 +3891,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 +4307,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;
@@ -4236,15 +4499,18 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
clearColour.red = clearColour.green = clearColour.blue = 0;
clearColour.alpha = 1;
ClearBuffer(true, false, false, &clearColour);
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
// prepare shader, if it is enabled
Shader_SetUniforms(NULL, NULL, NULL, NULL);
if (gl_use_palette_shader && cv_grshaders.value)
if (gl_palshader)
{
pglUseProgram(gl_shaderprograms[8].program); // palette shader
pglActiveTexture(GL_TEXTURE1);
SetBlend(PF_NoDepthTest);
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
}
else
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
if (gl_palshader)
{
pglUseProgram(gl_shaderprograms[8].program); // palette postprocess shader
pglActiveTexture(GL_TEXTURE2);
}
pglColor4ubv(white);
@@ -4255,7 +4521,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height)
tex_downloaded = finalScreenTexture;
if (gl_use_palette_shader && cv_grshaders.value)
if (gl_palshader)
{
pglUseProgram(0);
pglActiveTexture(GL_TEXTURE0);
-1
View File
@@ -135,6 +135,5 @@ typedef enum
// in order for custom playpals n shit to work properly
extern boolean gl_palette_initialized;
void InitPalette(int flashnum, boolean skiplut);
#endif
-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
}
+93 -19
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();
}
@@ -2575,28 +2579,92 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
UINT8 *colormap = NULL;
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
INT32 gfxnum; // gfx to draw
//SRB2/Kart v1.0 style
UINT8 numbars = 0; // how many ping bars do we draw?
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
SINT8 i = 0;
SINT8 yoffset = 6;
INT32 dx;
gfxnum = Ping_gfx_num(lag);
if (measureid == 1)
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
if (servermaxping && lag > servermaxping && hu_tick < 4)
if (!cv_pingstyle.value)
{
// flash ping red if too high
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
}
if (measureid == 1)
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
if (cv_pingicon.value)
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
if (cv_pingmeasurement.value)
if (servermaxping && lag > servermaxping && hu_tick < 4)
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE); // flash ping red if too high
if (cv_pingmeasurement.value)
lag = (INT32)(lag * (1000.00f / TICRATE));
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
if (measureid == 0)
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
}
else if (cv_pingstyle.value) // old style ping
{
lag = (INT32)(lag * (1000.00f / TICRATE));
if (cv_pingicon.value)
{
if (lag < 4)
{
numbars = 3;
barcolor = 184;
}
else if (lag < 7)
{
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
barcolor = 103;
}
else if (lag < 10)
{
numbars = 1;
barcolor = 155; // need a better red
}
else // brazil
{
numbars = 0;
barcolor = 31;
}
}
if (cv_pingmeasurement.value)
lag = (INT32)(lag * (1000.00f / TICRATE));
if (vid.width >= 640) // how sad, we're using a shit resolution.
{
if (measureid == 1)
{
//dx = x+1 - (V_SmallStringWidth(va("%dms", lag), V_ALLOWLOWERCASE|flags)/2);
//V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", lag));
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", lag));
}
else if (measureid == 0)
{
//dx = x+1 - (V_SmallStringWidth(va("d%d", lag), flags)/2);
//V_DrawSmallString(dx, y+4, flags, va("d%d", lag));
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", lag));
}
}
if (cv_pingicon.value)
{
for (i=0; (i<3); i++) // Draw the ping bar
{
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
if (i < numbars)
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
yoffset -= 2;
}
}
}
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]);
}
//
@@ -2684,10 +2752,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();
}
}
+472 -297
View File
File diff suppressed because it is too large. Load diff
+6 -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);
@@ -45,6 +49,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
void K_StealBumper(player_t *player, player_t *victim, boolean force);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
void K_SpawnMineExplosion(mobj_t *source, UINT8 color);
void K_RollMobjBySlopes(mobj_t *mo, boolean usedistance);
void K_SpawnBoostTrail(player_t *player);
void K_SpawnSparkleTrail(mobj_t *mo);
void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent);
+13
View File
@@ -538,6 +538,18 @@ static int lib_pFlashPal(lua_State *L)
return 0;
}
// not sure if this is netsafe...
static int lib_pRollPitchMobj(lua_State *L)
{
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
P_RollPitchMobj(source);
return 0;
}
static int lib_pGetClosestAxis(lua_State *L)
{
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@@ -3033,6 +3045,7 @@ static luaL_Reg lib[] = {
{"P_GetMobjGravity",lib_pGetMobjGravity},
{"P_WeaponOrPanel",lib_pWeaponOrPanel},
{"P_FlashPal",lib_pFlashPal},
{"P_RollPitchMobj",lib_pRollPitchMobj},
{"P_GetClosestAxis",lib_pGetClosestAxis},
{"P_SpawnParaloop",lib_pSpawnParaloop},
{"P_BossTargetPlayer",lib_pBossTargetPlayer},
+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,
+49 -8
View File
@@ -83,8 +83,11 @@ static const udata_field_t mobj_fields[] = {
FIELD(mobj_t, snext, udatalib_getter_mobj, mobj_snext_noset),
FIELD(mobj_t, sprev, mobj_sprev_unimplemented, mobj_sprev_unimplemented),
FIELD(mobj_t, angle, udatalib_getter_angle, mobj_angle_setter),
FIELD(mobj_t, pitch, udatalib_getter_angle, udatalib_setter_angle),
FIELD(mobj_t, roll, udatalib_getter_angle, udatalib_setter_angle),
FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle),
FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noop),
FIELD(mobj_t, slopepitch, udatalib_getter_angle, mobj_sloperoll_noop),
// Macro fails here
{ "rollsum", 0, mobj_rollsum_getter, mobj_rollsum_noset },
FIELD(mobj_t, sprite, udatalib_getter_spritenum, udatalib_setter_spritenum),
@@ -143,6 +146,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 +221,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 +419,48 @@ 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_optstring(L, 2, "none"), NULL);
}
else
{
INT32 i;
char skin[SKINNAMESIZE+1]; // all skin names are limited to this length
strlcpy(skin, luaL_optstring(L, 2, "none"), sizeof skin);
strlwr(skin); // all skin names are lowercase
if (strcasecmp(skin, "none"))
{
// 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;
}
}
}
else
{
mo->localskin = 0;
mo->skinlocal = false;
}
}
SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL);
return 0;
}
@@ -596,7 +635,9 @@ int mobj_rollsum_getter(lua_State *L)
{
mobj_t *mo = GETMO();
angle_t rollsum = mo->rollangle + cv_sloperoll.value ? mo->sloperoll : 0;
angle_t pitchnroll = P_MobjPitchAndRoll(mo);
angle_t rollsum = mo->rollangle + pitchnroll;
if (mo->player)
{
+1 -1
View File
@@ -303,7 +303,7 @@ int player_localskin_setter(lua_State *L)
{
player_t *plr = GETPLAYER();
SetLocalPlayerSkin(plr - players, luaL_checkstring(L, 2), NULL);
SetLocalPlayerSkin(plr - players, luaL_optstring(L, 2, "none"), 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);
+1677 -198
View File
File diff suppressed because it is too large. Load diff
+30
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);
@@ -278,6 +285,10 @@ INT32 HU_GetHighlightColor(void);
void M_PopupMasterServerRules(void);
#ifdef MASTERSERVER
void M_PopupMasterServerConnectError(void);
#endif
// These defines make it a little easier to make menus
#define DEFAULTMENUSTYLE(header, source, prev, x, y)\
{\
@@ -288,6 +299,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 +325,7 @@ void M_PopupMasterServerRules(void);
M_DrawPauseMenu,\
x, y,\
0,\
NULL,\
NULL\
}
@@ -312,6 +338,7 @@ void M_PopupMasterServerRules(void);
M_DrawCenteredMenu,\
BASEVIDWIDTH/2, y,\
0,\
NULL,\
NULL\
}
@@ -324,6 +351,7 @@ void M_PopupMasterServerRules(void);
M_DrawServerMenu,\
24,40,\
0,\
NULL,\
NULL\
}
@@ -336,6 +364,7 @@ void M_PopupMasterServerRules(void);
M_DrawControl,\
26, 40,\
0,\
NULL,\
NULL\
}
@@ -348,6 +377,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);
+27 -6
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
@@ -121,7 +140,7 @@ static void WarnGUI (void)
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_StartMessage(M_GetText("There was a problem connecting to\nthe Master Server\n\nCheck the console for details.\n"), NULL, MM_NOTHING);
M_PopupMasterServerConnectError();
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
@@ -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;
+149 -18
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);
@@ -6240,6 +6251,87 @@ static void P_KoopaThinker(mobj_t *koopa)
}
}
//
// P_RollPitchMobj
// Assigns slopepitch and sloperoll to objects, and resets said values when slope-rolling
// is turned off completely.
//
void P_RollPitchMobj(mobj_t* mobj)
{
boolean usedist = false;
if (cv_sloperolldist.value > 0)
usedist = true;
if ((cv_spriteroll.value) && (cv_sloperoll.value == 2))
{
K_RollMobjBySlopes(mobj, usedist);
}
else
{
mobj->sloperoll = FixedAngle(0);
mobj->slopepitch = FixedAngle(0);
}
}
angle_t P_MobjPitchAndRoll(mobj_t *mobj)
{
spritedef_t *sprdef;
spriteframe_t *sprframe;
angle_t ang = 0;
angle_t camang = 0;
angle_t return_angle = 0;
if (!cv_spriteroll.value)
return 0;
if (P_MobjWasRemoved(mobj))
return 0;
size_t rot = mobj->frame & FF_FRAMEMASK;
boolean papersprite = (mobj->frame & FF_PAPERSPRITE);
if (mobj->skin && mobj->sprite == SPR_PLAY)
{
sprdef = &((skin_t *)mobj->skin)->spritedef;
if (rot >= sprdef->numframes)
sprdef = &sprites[mobj->sprite];
}
else
{
sprdef = &sprites[mobj->sprite];
}
if (rot >= sprdef->numframes)
{
sprdef = &sprites[states[S_UNKNOWN].sprite];
rot = states[S_UNKNOWN].frame&FF_FRAMEMASK;
}
sprframe = &sprdef->spriteframes[rot];
// No sprite frame? I guess it is possible
if (!sprframe) return 0;
if (sprframe->rotate != SRF_SINGLE || papersprite)
{
ang = R_PointToAngle(mobj->x, mobj->y) - mobj->angle;
camang = R_PointToAngle(mobj->x, mobj->y);
}
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch);
if (cv_sloperoll.value)
{
return_angle += FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
}
return return_angle;
}
//
// P_MobjThinker
//
@@ -6382,6 +6474,12 @@ void P_MobjThinker(mobj_t *mobj)
return;
}
if (mobj->state == &states[S_PLAY_SIGN]) // hack to make the player sign icon roll with the sign itself
{
mobj->slopepitch = mobj->target->slopepitch;
mobj->sloperoll = mobj->target->sloperoll;
}
P_AddOverlay(mobj);
break;
case MT_SHADOW:
@@ -6417,6 +6515,7 @@ void P_MobjThinker(mobj_t *mobj)
P_RemoveMobj(mobj);
return;
}
P_RollPitchMobj(mobj);
break;
case MT_SMOLDERING:
if (leveltime % 2 == 0)
@@ -7845,6 +7944,7 @@ void P_MobjThinker(mobj_t *mobj)
fixed_t distbarrier = 512*mapobjectscale;
fixed_t distaway;
P_RollPitchMobj(mobj);
P_SpawnGhostMobj(mobj);
if (mobj->threshold > 0)
@@ -7912,6 +8012,7 @@ void P_MobjThinker(mobj_t *mobj)
}
else
{
P_RollPitchMobj(mobj);
P_SpawnGhostMobj(mobj);
mobj->angle = R_PointToAngle2(0, 0, mobj->momx, mobj->momy);
P_InstaThrust(mobj, mobj->angle, mobj->movefactor);
@@ -7945,6 +8046,9 @@ void P_MobjThinker(mobj_t *mobj)
mobj->momx = mobj->momy = 0;
mobj->health = 1;
}
P_RollPitchMobj(mobj);
if (mobj->threshold > 0)
mobj->threshold--;
break;
@@ -7992,6 +8096,8 @@ void P_MobjThinker(mobj_t *mobj)
|| (mobj->state >= &states[S_SSMINE_DEPLOY8] && mobj->state <= &states[S_SSMINE_DEPLOY13]))
A_GrenadeRing(mobj);
P_RollPitchMobj(mobj);
if (mobj->threshold > 0)
mobj->threshold--;
break;
@@ -8344,6 +8450,10 @@ void P_MobjThinker(mobj_t *mobj)
}
}
}
// fancy sign rotation
P_RollPitchMobj(mobj);
break;
case MT_CDUFO:
if (!mobj->spawnpoint || mobj->fuse)
@@ -9524,6 +9634,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->height = info->height;
mobj->flags = info->flags;
mobj->sloperoll = 0;
mobj->slopepitch = 0;
mobj->pitch_sprite = 0;
mobj->roll_sprite = 0;
mobj->health = info->spawnhealth;
@@ -10359,7 +10473,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 +10484,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 +10524,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);
}
}
//
@@ -11376,7 +11507,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
mobj = P_SpawnMobj(x, y, z, i);
if (!mobj || P_MobjWasRemoved(mobj)) {
CONS_Alert(CONS_WARNING, "Failed to spawn map thing #%d at %d, %d\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
CONS_Alert(CONS_ERROR, "Failed to spawn map thing #%d at %d, %d. This will crash vanilla clients!\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
return;
}
+19 -8
View File
@@ -283,9 +283,9 @@ typedef struct mobj_s
struct mobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
// More drawing info: to determine current sprite.
angle_t angle; // orientation
angle_t old_angle; // orientation interpolation
angle_t old_angle2;
angle_t angle, pitch, roll; // orientation
angle_t old_angle, old_pitch, old_roll; // orientation interpolation
angle_t old_angle2, old_pitch2, old_roll2;
angle_t rollangle;
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
@@ -302,7 +302,10 @@ typedef struct mobj_s
fixed_t stretchslam; // "squish" effect when you land
//sloperollangle
angle_t sloperoll, reservezangle, reservexydir;
angle_t sloperoll, slopepitch;
angle_t old_sloperoll, old_slopepitch;
angle_t old_sloperoll2, old_slopepitch2;
angle_t pitch_sprite, roll_sprite;
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@@ -395,6 +398,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;
@@ -432,9 +436,9 @@ typedef struct precipmobj_s
struct precipmobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
// More drawing info: to determine current sprite.
angle_t angle; // orientation
angle_t old_angle; // orientation interpolation
angle_t old_angle2;
angle_t angle, pitch, roll; // orientation
angle_t old_angle, old_pitch, old_roll; // orientation interpolation
angle_t old_angle2, old_pitch2, old_roll2;
angle_t rollangle;
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
@@ -451,7 +455,10 @@ typedef struct precipmobj_s
fixed_t stretchslam; // "squish" effect when you land
//sloperollangle
angle_t sloperoll, reservezangle, reservexydir;
angle_t sloperoll, slopepitch;
angle_t old_sloperoll, old_slopepitch;
angle_t old_sloperoll2, old_slopepitch2;
angle_t pitch_sprite, roll_sprite;
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@@ -493,6 +500,10 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum);
// check mobj against water content, before movement code
void P_MobjCheckWater(mobj_t *mobj);
// fancy sprite rotation
void P_RollPitchMobj(mobj_t *mobj);
angle_t P_MobjPitchAndRoll(mobj_t *mobj);
// Player spawn points
void P_SpawnPlayer(INT32 playernum);
void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing);
+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
+19 -5
View File
@@ -1976,14 +1976,28 @@ 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->pitch = 0;
mobj->roll = 0;
mobj->sloperoll = 0;
mobj->slopepitch = 0;
mobj->pitch_sprite = 0;
mobj->roll_sprite = 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;
+17 -12
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;
@@ -3616,9 +3621,7 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
ST_LoadGraphics();
ST_ReloadSkinFaceGraphics();
if (!partadd_important)
partadd_stage = -1; // everything done
else if (fullsetup)
if (fullsetup)
++partadd_stage; // run next stage too
}
@@ -3627,15 +3630,17 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
// Reload all textures, unconditionally for better or worse.
R_LoadTextures();
if (fullsetup)
// Reload ANIMATED / ANIMDEFS
P_InitPicAnims();
if (!partadd_important)
partadd_stage = -1; // everything done
else if (fullsetup)
++partadd_stage;
}
if (partadd_stage == 2)
{
// Reload ANIMATED / ANIMDEFS
P_InitPicAnims();
// reload status bar (warning should have valid player!)
if (gamestate == GS_LEVEL)
ST_Start();
+89 -30
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;
@@ -3568,8 +3627,8 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
case 5: // Spikes
// Don't do anything. In Soviet Russia, spikes find you.
break;
case 6: // Death Pit (Camera Mod)
case 7: // Death Pit (No Camera Mod)
case 6: // Death Pit (Camera Tilt)
case 7: // Death Pit (No Camera Tilt)
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
P_DamageMobj(player->mo, NULL, NULL, 10000);
break;
@@ -3626,8 +3685,8 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
{
case 1: // Trigger Linedef Exec (Pushable Objects)
break;
case 2: // Linedef executor requires all players present+doesn't require touching floor
case 3: // Linedef executor requires all players present
case 2: // Linedef executor requires all players present+doesn't require touching floor // Trigger Linedef Exec (Anywhere, All Players)
case 3: // Linedef executor requires all players present // Trigger Linedef Exec (Floor Touch, All Players)
/// \todo check continues for proper splitscreen support?
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && !players[i].bot && players[i].mo && (gametype != GT_COOP || players[i].lives > 0))
@@ -3684,16 +3743,16 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
}
}
/* FALLTHRU */
case 4: // Linedef executor that doesn't require touching floor
case 5: // Linedef executor
case 6: // Linedef executor (7 Emeralds)
case 7: // Linedef executor (NiGHTS Mare)
case 4: // Linedef executor that doesn't require touching floor // Trigger Linedef Exec (Anywhere in Sector)
case 5: // Linedef executor // Trigger Linedef Exec (Floor Touch)
case 6: // Linedef executor (7 Emeralds) // unused
case 7: // SRB2kart: Linedef executor (Race Lap)
if (!player->bot)
P_LinedefExecute(sector->tag, player->mo, sector);
break;
case 8: // Tells pushable things to check FOFs
case 8: // Tells pushable things to check FOFs // Check for Linedef Executor on FOFs
break;
case 9: // Egg trap capsule
case 9: // Egg trap capsule // unused
{
thinker_t *th;
mobj_t *mo2;
@@ -3733,12 +3792,12 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
P_DoPlayerExit(&players[i]);
break;
}
case 10: // Special Stage Time/Rings
case 10: // Special Stage Time/Rings // unused
case 11: // Custom Gravity
break;
case 12: // Lua sector special
case 12: // SRB2kart: Invert Encore Remap
break;
case 15: // Invert Encore Remap
case 15: // no idea but keep it dont want anything to break
break;
}
DoneSection2:
+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();
+37 -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;
}
}
@@ -1687,11 +1697,15 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
else
ghost->angle = mobj->angle;
ghost->pitch = mobj->pitch;
ghost->roll = mobj->roll;
ghost->sprite = mobj->sprite;
ghost->frame = mobj->frame;
ghost->tics = -1;
ghost->frame &= ~FF_TRANSMASK;
ghost->frame |= tr_trans50<<FF_TRANSSHIFT;
ghost->slopepitch = mobj->slopepitch;
ghost->sloperoll = mobj->sloperoll;
ghost->fuse = ghost->info->damage;
@@ -1714,6 +1728,10 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
ghost->old_y = mobj->old_y2;
ghost->old_z = mobj->old_z2;
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2);
ghost->old_pitch = mobj->old_pitch2;
ghost->old_roll = mobj->old_roll2;
ghost->old_sloperoll = mobj->old_sloperoll2;
ghost->old_slopepitch = mobj->old_slopepitch2;
return ghost;
}
@@ -7159,7 +7177,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 +8080,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 +8116,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 +8134,7 @@ boolean P_SpectatorJoinGame(player_t *player)
}
// Joining in game from firing.
else
{
{
if (player->mo)
{
P_RemoveMobj(player->mo);
@@ -8124,6 +8145,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;
+5 -5
View File
@@ -39,7 +39,7 @@ INT32 doorclosed;
boolean R_NoEncore(sector_t *sector, boolean ceiling)
{
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15);
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 12);
#if 0 // perfect implementation
INT32 val = GETSECSPECIAL(sector->special, 3);
if (val != 1 && val != 3 // spring panel
@@ -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;
+29
View File
@@ -282,6 +282,10 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
out->scale = mobj->scale;
out->subsector = mobj->subsector;
out->angle = mobj->player ? mobj->player->frameangle : mobj->angle;
out->pitch = mobj->pitch;
out->roll = mobj->roll;
out->slopepitch = mobj->slopepitch;
out->sloperoll = mobj->sloperoll;
out->spritexscale = mobj->spritexscale;
out->spriteyscale = mobj->spriteyscale;
out->spritexoffset = mobj->spritexoffset;
@@ -313,6 +317,14 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
{
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
}
// pitch roll stuff
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
out->roll = mobj->resetinterp ? mobj->roll : R_LerpAngle(mobj->old_roll, mobj->roll, frac);
// and the slope stuff
out->slopepitch = mobj->resetinterp ? mobj->slopepitch : R_LerpAngle(mobj->old_slopepitch, mobj->slopepitch, frac);
out->sloperoll = mobj->resetinterp ? mobj->sloperoll : R_LerpAngle(mobj->old_sloperoll, mobj->sloperoll, frac);
}
void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
@@ -755,10 +767,27 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
mobj->old_z2 = mobj->old_z;
mobj->old_angle2 = mobj->old_angle;
mobj->old_scale2 = mobj->old_scale;
// rotation humor
mobj->old_pitch2 = mobj->old_pitch;
mobj->old_roll2 = mobj->old_roll;
mobj->old_slopepitch2 = mobj->old_slopepitch;
mobj->old_sloperoll2 = mobj->old_sloperoll;
mobj->old_x = mobj->x;
mobj->old_y = mobj->y;
mobj->old_z = mobj->z;
mobj->old_angle = mobj->angle;
// rotation humor, again
// pitch and roll first
mobj->old_pitch = mobj->pitch;
mobj->old_roll = mobj->roll;
mobj->old_slopepitch = mobj->slopepitch;
mobj->old_sloperoll = mobj->sloperoll;
mobj->old_scale = mobj->scale;
mobj->old_spritexscale = mobj->spritexscale;
mobj->old_spriteyscale = mobj->spriteyscale;
+2
View File
@@ -65,6 +65,8 @@ typedef struct {
fixed_t spriteyscale;
fixed_t spritexoffset;
fixed_t spriteyoffset;
angle_t pitch, roll;
angle_t sloperoll, slopepitch;
} interpmobjstate_t;
// Level interpolators
+39 -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,13 +1951,14 @@ 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);
CV_RegisterVar(&cv_sloperoll);
CV_RegisterVar(&cv_spriteroll);
CV_RegisterVar(&cv_sliptideroll);
CV_RegisterVar(&cv_sloperolldist);
CV_RegisterVar(&cv_sparkroll);
CV_RegisterVar(&cv_showhud);
CV_RegisterVar(&cv_translucenthud);
+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
-19
View File
@@ -29,13 +29,6 @@
#include "p_tick.h"
#include "r_fps.h"
#ifdef TIMING
#include "p5prof.h"
INT64 mycount;
INT64 mytotal = 0;
UINT32 nombre = 100000;
#endif
//
// opening
//
@@ -340,19 +333,7 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_x1 = x1;
ds_x2 = x2;
// profile drawer
#ifdef TIMING
ProfZeroTimer();
#endif
spanfunc();
#ifdef TIMING
RDMSR(0x10, &mycount);
mytotal += mycount; // 64bit add
if (!(nombre--))
I_Error("spanfunc() CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1), (INT32)mytotal);
#endif
}
//
+17 -30
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);
}
@@ -1248,19 +1248,6 @@ static boolean R_FFloorCanClip(visffloor_t *pfloor)
#define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS)
//profile stuff ---------------------------------------------------------
//#define TIMING
#ifdef TIMING
#include "p5prof.h"
INT64 mycount;
INT64 mytotal = 0;
UINT32 nombre = 100000;
//static char runtest[10][80];
#endif
//profile stuff ---------------------------------------------------------
static void R_RenderSegLoop (void)
{
angle_t angle;
@@ -1517,21 +1504,7 @@ static void R_RenderSegLoop (void)
dc_texturemid = rw_midtexturemid;
dc_source = R_GetColumn(midtexture,texturecolumn);
dc_texheight = textureheight[midtexture]>>FRACBITS;
//profile stuff ---------------------------------------------------------
#ifdef TIMING
ProfZeroTimer();
#endif
colfunc();
#ifdef TIMING
RDMSR(0x10,&mycount);
mytotal += mycount; //64bit add
if (nombre--==0)
I_Error("R_DrawColumn CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1),
(INT32)mytotal);
#endif
//profile stuff ---------------------------------------------------------
// dont draw anything more for this column, since
// a midtexture blocks the view
@@ -2653,8 +2626,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
}
}
}
+169 -50
View File
@@ -143,11 +143,11 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
// rotsprite
#ifdef ROTSPRITE
for (r = 0; r < 16; r++)
{
sprtemp[frame].rotated[0][r] = NULL;
sprtemp[frame].rotated[1][r] = NULL;
}
for (r = 0; r < 16; r++)
{
sprtemp[frame].rotated[0][r] = NULL;
sprtemp[frame].rotated[1][r] = NULL;
}
#endif/*ROTSPRITE*/
@@ -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,15 +1315,19 @@ 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
angle_t camang = 0;
fixed_t iscale;
fixed_t scalestep; // toast '16
fixed_t offset, offset2;
@@ -1339,6 +1347,7 @@ static void R_ProjectSprite(mobj_t *thing)
patch_t *rotsprite = NULL;
INT32 rollangle = 0;
angle_t rollsum = 0;
angle_t pitchnroll = 0;
angle_t sliptiderollangle = 0;
#endif
@@ -1393,11 +1402,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 +1448,10 @@ static void R_ProjectSprite(mobj_t *thing)
if (sprframe->rotate != SRF_SINGLE || papersprite)
{
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
camang = R_PointToAngle (interp.x, interp.y);
if (mirrored)
ang = InvAngle(ang);
if (papersprite)
ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT));
}
@@ -1468,7 +1481,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,34 +1493,63 @@ static void R_ProjectSprite(mobj_t *thing)
spr_topoffset = spritecachedinfo[lump].topoffset;
#ifdef ROTSPRITE
pitchnroll = 0; // set this to 0, non-paper sprites will affect this value
if (thing->player)
if (cv_spriteroll.value)
{
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->player)
rollsum = (thing->rollangle) + (thing->sloperoll) + sliptiderollangle;
else
rollsum = (thing->rollangle) + (thing->sloperoll);
rollangle = R_GetRollAngle(rollsum);
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
if (rotsprite != NULL)
if (papersprite)
{
spr_width = rotsprite->width << FRACBITS;
spr_height = rotsprite->height << FRACBITS;
spr_offset = rotsprite->leftoffset << FRACBITS;
spr_topoffset = rotsprite->topoffset << FRACBITS;
spr_topoffset += FEETADJUST;
if (ang >= ANGLE_180)
{
// Makes Software act much more sane like OpenGL
rollangle = InvAngle(thing->rollangle);
}
else
{
rollangle = thing->rollangle;
}
}
else
{
// this is very messy, but it on-the-fly calculates rotations for all the
// pitch and roll variables
pitchnroll = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll) +
FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch) +
FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll) +
FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch);
// flip -> rotate, not rotate -> flip
flip = 0;
rollangle = thing->rollangle;
}
if ((rollangle) || (pitchnroll) || (thing->player && thing->player->sliproll))
{
rollsum = pitchnroll;
if (thing->player)
{
sliptiderollangle =
cv_sliptideroll.value ? thing->player->sliproll * (thing->player->sliptidemem) : 0;
rollsum += thing->rollangle +
FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
}
else
rollsum += thing->rollangle;
rollangle = R_GetRollAngle(rollsum);
rotsprite = Patch_GetRotatedSprite(
sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
if (rotsprite != NULL)
{
spr_width = rotsprite->width << FRACBITS;
spr_height = rotsprite->height << FRACBITS;
spr_offset = rotsprite->leftoffset << FRACBITS;
spr_topoffset = rotsprite->topoffset << FRACBITS;
spr_topoffset += FEETADJUST;
// flip -> rotate, not rotate -> flip
flip = 0;
}
}
}
#endif
@@ -1515,6 +1557,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 +1576,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;
@@ -1757,7 +1802,7 @@ static void R_ProjectSprite(mobj_t *thing)
//Fab: lumppat is the lump number of the patch to use, this is different
// than lumpid for sprites-in-pwad : the graphics are patched
#ifdef ROTSPRITE
if (rotsprite != NULL)
if ((rotsprite != NULL) && (cv_spriteroll.value))
vis->patch = rotsprite;
else
#endif
@@ -2193,6 +2238,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 +2259,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 +2629,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 +2850,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 +2927,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 +2952,9 @@ void R_ClipSprites(void)
}
R_ClipVisSprite(spr, spr->x1, spr->x2);
if ((spr->cut & SC_NOTVISIBLE) == 0)
numvisiblesprites++;
}
}
@@ -2923,6 +3034,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 +3127,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 +3652,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 +3663,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 +3713,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);
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff. Show more